(core) correctly delete pruned document versions

Summary:
After switch to using an inventory file, old document versions were
not in fact being pruned.  This corrects that and adds a test
that fails with the previous implementation.

The pruner was operating correctly, but was being applied to an
inventory list rather than s3 directly - and the inventory list
did not pass through version removals to s3.

This fix will leave a stock of undeleted versions that can
be eliminated by an external script (there are alternatives
but that seems simplest overall).

Test Plan: updated test

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2693
This commit is contained in:
Paul Fitzpatrick 2020-12-16 14:27:32 -05:00
parent 12a7059bde
commit b1c4af4ee9

View File

@ -148,6 +148,7 @@ export class DocSnapshotInventory implements IInventory {
if (oldIds.size > 0) {
const results = current.filter(v => !oldIds.has(v.snapshotId));
const fname = await this._getFilename(key);
await this._doc.remove(key, snapshotIds);
await this._saveToFile(fname, results);
this._needFlush.add(key);
}