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

@@ -12,6 +12,7 @@ import org.whispersystems.signalservice.api.util.UuidUtil;
import org.whispersystems.signalservice.internal.storage.protos.AccountRecord;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
@@ -64,6 +65,10 @@ public final class SignalAccountRecord implements SignalRecord {
SignalAccountRecord that = (SignalAccountRecord) other;
List<String> diff = new LinkedList<>();
if (!Arrays.equals(this.id.getRaw(), that.id.getRaw())) {
diff.add("ID");
}
if (!Objects.equals(this.givenName, that.givenName)) {
diff.add("GivenName");
}

View File

@@ -10,6 +10,7 @@ import org.whispersystems.signalservice.api.util.UuidUtil;
import org.whispersystems.signalservice.internal.storage.protos.ContactRecord;
import org.whispersystems.signalservice.internal.storage.protos.ContactRecord.IdentityState;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
@@ -56,6 +57,10 @@ public final class SignalContactRecord implements SignalRecord {
SignalContactRecord that = (SignalContactRecord) other;
List<String> diff = new LinkedList<>();
if (!Arrays.equals(this.id.getRaw(), that.id.getRaw())) {
diff.add("ID");
}
if (!Objects.equals(this.getAddress().getNumber(), that.getAddress().getNumber())) {
diff.add("E164");
}

View File

@@ -40,6 +40,10 @@ public final class SignalGroupV1Record implements SignalRecord {
SignalGroupV1Record that = (SignalGroupV1Record) other;
List<String> diff = new LinkedList<>();
if (!Arrays.equals(this.id.getRaw(), that.id.getRaw())) {
diff.add("ID");
}
if (!Arrays.equals(this.groupId, that.groupId)) {
diff.add("MasterKey");
}

View File

@@ -42,6 +42,10 @@ public final class SignalGroupV2Record implements SignalRecord {
SignalGroupV2Record that = (SignalGroupV2Record) other;
List<String> diff = new LinkedList<>();
if (!Arrays.equals(this.id.getRaw(), that.id.getRaw())) {
diff.add("ID");
}
if (!Arrays.equals(this.getMasterKeyBytes(), that.getMasterKeyBytes())) {
diff.add("MasterKey");
}