solana-bigtable icon indicating copy to clipboard operation
solana-bigtable copied to clipboard

get_latest_snapshot() doesn't find the latest snapshot

Open the-nando opened this issue 2 years ago • 0 comments

This commit introduced stable numerical sorting in get_latest_snapshot() but it doesn't seem to be working as it should. Given this directory's content:

root@solana1:/opt/solana-bigtable# find /mnt/data/snapshots -name snapshot-\*.tar\*
/mnt/data/snapshots/snapshot-131873380-7cQMZQPjxzmfYhCB5xbH8atKGoUdcQTVm3fvKojpThyf.tar.zst
/mnt/data/snapshots/snapshot-131847476-zzqcB1f36J8SvyeWTKd7Sns6Z2sYJJZbEAb6TmDbGdk.tar.zst
/mnt/data/snapshots/snapshot-131761946-82Ey2xMXvpr6EbJZrxF9a716kfscg6mqjyabfcBZup5B.tar.zst
root@solana1:/opt/solana-bigtable#

I would expect the last snapshot to be found to be snapshot-131873380-7cQMZQPjxzmfYhCB5xbH8atKGoUdcQTVm3fvKojpThyf.tar.zst but instead:

root@solana1:/opt/solana-bigtable# find /mnt/data/snapshots -name snapshot-\*.tar\* | sort -ns | tail -n1
/mnt/data/snapshots/snapshot-131761946-82Ey2xMXvpr6EbJZrxF9a716kfscg6mqjyabfcBZup5B.tar.zst
root@solana1:/opt/solana-bigtable#

Leaving only the numerical sorting by removing the last-resort sorting fixes the issues:

root@solana1:/opt/solana-bigtable# find /mnt/data/snapshots -name snapshot-\*.tar\* | sort -n | tail -n1
/mnt/data/snapshots/snapshot-131873380-7cQMZQPjxzmfYhCB5xbH8atKGoUdcQTVm3fvKojpThyf.tar.zst
root@solana1:/opt/solana-bigtable#

the-nando avatar Apr 30 '22 05:04 the-nando