New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compaction API #350
Compaction API #350
Changes from 1 commit
5fe3f99
df40ca1
b95ffb2
6e945b2
78e8d89
File filter...
Jump to…
Address review feedbacks
- Loading branch information
Verified
| @@ -448,17 +448,21 @@ RequestUtil.prototype.compactCategory = function (category) { | ||
| this.withRetry(() => { | ||
| return s3Helper.listObjects(this.s3, options, false) | ||
| }).then((s3Objects) => { | ||
| // This is used to keep the most recent records for each object id | ||
| let latestRecords = {} | ||
|
||
| let s3ObjectsToDelete = [] | ||
| const recordObjects = this.s3ObjectsToRecords(s3Objects.contents) | ||
| recordObjects.forEach((recordObject) => { | ||
| const record = recordObject.record | ||
|
This conversation was marked as resolved
by AlexeyBarabash
AlexeyBarabash
Contributor
|
||
| if (latestRecords[record.objectId]) { | ||
| console.log('compaction deletes') | ||
| if (record.syncTimestamp > latestRecords[record.objectId].record.syncTimestamp) { | ||
| s3ObjectsToDelete = s3ObjectsToDelete.concat(latestRecords[record.objectId].objects) | ||
| console.log(latestRecords[record.objectId].record) | ||
|
This conversation was marked as resolved
by AlexeyBarabash
AlexeyBarabash
Contributor
|
||
| latestRecords[record.objectId] = recordObject | ||
| } else { | ||
| s3ObjectsToDelete = s3ObjectsToDelete.concat(recordObject.objects) | ||
| console.log(record) | ||
|
This conversation was marked as resolved
by AlexeyBarabash
|
||
| } | ||
| } else { | ||
| latestRecords[record.objectId] = recordObject | ||
this is going to keep the most recent record in each batch, which is fine, but I think we should add a comment to make that clear