There are several known issues with bottomless restore process:
There is a bug in case when S3 has more than 1 page of data - in this case bottomless always stopped it's work after first page due to incorrect usage of last_received_frame_no var
bottomless relies on the fact that last connection will perform checkpoint. This is true if DB is valid, but in case of malformed DB last connection will just exit silently and leave DB empty (4KB DB file and some data in WAL). Current implementation will ignore this situation and just restore empty DB
Changes
Fixed bug with restore process from more than 1 page in S3
Add validation that after drop of the last connection there will be no WAL files on the disk. In other case now bottomless will fail to restore because most probably DB were malformed
Added BOTTOMLESS CAUTION prefix to all cases when bottomless can behave kind of fishy
Added simple restore_from_partial_db test which drops several files from S3 and check that DB will be able to start from this partial backup
This is not immediately trivial why we need to restore in such cases - but as server can crash at any point of time and we are uploading frame ranges in parallel - this is a valid case that some small suffix of frame ranges can have a gap. So we can't just easily fail restore process because it will create troubles in "almost valid scenario"
Context
There are several known issues with
bottomless
restore process:last_received_frame_no
varbottomless
relies on the fact that last connection will perform checkpoint. This is true if DB is valid, but in case of malformed DB last connection will just exit silently and leave DB empty (4KB DB file and some data in WAL). Current implementation will ignore this situation and just restore empty DBChanges
bottomless
will fail to restore because most probably DB were malformedBOTTOMLESS CAUTION
prefix to all cases when bottomless can behave kind of fishyrestore_from_partial_db
test which drops several files from S3 and check that DB will be able to start from this partial backup