Fix issues with StorageSyncV2 bookkeeping.

1. I screwed up the comparators in the record processor. Pretty bad, glad this was caught.
2. Previously I was sort of keeping track of which local-only records were accounted for while I was merging, and then hoping everything worked out in the end. Now I just very directly take some set differences and retrieve the appropriate records, so it's clear that we should never fail certain validations.
3. Rev's the feature flag so we don't turn on something broken.
This commit is contained in:
Greyson Parrelli
2021-04-13 11:32:24 -04:00
committed by GitHub
parent fb316a22c6
commit 35c102aa98
14 changed files with 81 additions and 40 deletions

View File

@@ -2737,7 +2737,7 @@ public class RecipientDatabase extends Database {
}
}
public void clearDirtyStateForRecords(@NonNull List<SignalStorageRecord> records) {
public void clearDirtyStateForStorageIds(@NonNull Collection<StorageId> ids) {
SQLiteDatabase db = databaseHelper.getWritableDatabase();
Preconditions.checkArgument(db.inTransaction(), "Database should already be in a transaction.");
@@ -2747,8 +2747,8 @@ public class RecipientDatabase extends Database {
String query = STORAGE_SERVICE_ID + " = ?";
for (SignalRecord record : records) {
String[] args = SqlUtil.buildArgs(Base64.encodeBytes(record.getId().getRaw()));
for (StorageId id : ids) {
String[] args = SqlUtil.buildArgs(Base64.encodeBytes(id.getRaw()));
db.update(TABLE_NAME, values, query, args);
}
}