I have a private network of Stellar core nodes running on docker swarm with the DB and ledger data persisted correctly. When I remove or update the service for maintenance/upgrade of the docker image and then restart it I often see this:
2019-03-04T04:43:12.761 GAWSB [default INFO] Loading last known ledger
2019-03-04T04:43:12.763 GAWSB [Ledger WARNING] Some buckets are missing in 'buckets'.
2019-03-04T04:43:12.763 GAWSB [Ledger WARNING] Attempting to recover from the history store.
2019-03-04T04:43:12.763 GAWSB [History INFO] Starting RepairMissingBucketsWork
2019-03-04T04:43:12.818 GAWSB [Process WARNING] process 118 exited 1: cp /tmp/stellar-core/history/vs/bucket/61/83/ea/bucket-6183ea169e9b74480c793417fa42694cc961df5e47d4ca9e9a89164ceadccfa8.xdr.gz buckets/tmp/repair-buckets-7460063929a1b56d/bucket/61/83/ea/bucket-6183ea169e9b74480c793417fa42694cc961df5e47d4ca9e9a89164ceadccfa8.xdr.gz.tmp
2019-03-04T04:43:12.819 GAWSB [Work WARNING] Reached retry limit 0 for get-remote-file bucket/61/83/ea/bucket-6183ea169e9b74480c793417fa42694cc961df5e47d4ca9e9a89164ceadccfa8.xdr.gz
2019-03-04T04:43:12.819 GAWSB [Work WARNING] Scheduling retry #1/32 in 1 sec, for get-and-unzip-remote-file bucket/61/83/ea/bucket-6183ea169e9b74480c793417fa42694cc961df5e47d4ca9e9a89164ceadccfa8.xdr.gz
2019-03-04T04:43:13.829 GAWSB [Process WARNING] process 122 exited 1: cp /tmp/stellar-core/history/vs/bucket/61/83/ea/bucket-6183ea169e9b74480c793417fa42694cc961df5e47d4ca9e9a89164ceadccfa8.xdr.gz buckets/tmp/repair-buckets-7460063929a1b56d/bucket/61/83/ea/bucket-6183ea169e9b74480c793417fa42694cc961df5e47d4ca9e9a89164ceadccfa8.xdr.gz.tmp
2019-03-04T04:43:13.829 GAWSB [Work WARNING] Reached retry limit 0 for get-remote-file bucket/61/83/ea/bucket-6183ea169e9b74480c793417fa42694cc961df5e47d4ca9e9a89164ceadccfa8.xdr.gz
These buckets don't exist and I presume it is because the container was killed in the middle of a bucket write. There are issues here and here which seem to suggest the only fix for this is to run newdb which is not going to work in production...
Is there a clean way of stopping Stellar Core on a container shutdown so that this issue is avoided?
stellar-core --forcescp
after restart?