cardano-db-sync
cardano-db-sync copied to clipboard
Snapshot script incompatible w/ MAC OS and BSD
Just circling back on a few issues:
Just a friendly reminder ;-)
" :sob: Ok, I will fix it."
Originally posted by @erikd in https://github.com/input-output-hk/cardano-db-sync/pull/1235#discussion_r950622116
I feel the tar test is kind of not very useful now ( hence why it's probably missing from MAC and BSD version of tar command... ), it's not gziped tar, so what is it testing exactly? it just adds to the snapshot creation time. If the pg dump completed with no error, and the tar command is successful, i think it's good to go, no? Maybe test sha256 file that is now created as part of snapshot instead? that's a better test, IMO, if we really need a test here.
Example:
Linux:
shasum -a 256 --check db-sync-snapshot-schema-13-block-8136142-aarch64.tgz.sha256sum
MAC/BSD:
shasum -a 256 -c db-sync-snapshot-schema-13-block-8136142-aarch64.tgz.sha256sum
Actually, this is related. I found that MAC does not have sha256sum ( BSD does now after version 13 ).
This line needs change:
https://github.com/input-output-hk/cardano-db-sync/blob/035d30b01850df97915063e1eb68f6e24efd7ddc/scripts/postgresql-setup.sh#L167 to: | shasum -a 256 | head -c 64 | sed -e "s/$/ ${tgz_file}\n/" > "${tgz_file}.sha256sum"
And second issue: Is this really necessary? https://github.com/input-output-hk/cardano-db-sync/blob/master/scripts/postgresql-setup.sh#L164
I tested on MAC OS and BSD, those packages don't come in OS by default. This means we would have to add a new package dependency requirement for Mac and BSD for db-sync. What about using this command instead, that looks just like the tree command:
find . -type d -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
@kderme what do you think about these changes? Should i submit a PR? Let me know if you have any comments.
@kderme @erikd let me know if you have any comments? I can submit PR to fix.
If you can fix it for Mac/BSD without busting it for Linux (the only officially supported OS) then please submit a PR.