diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/dynamic/DynamicAccountsDynamoDbMigrationConfiguration.java b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/dynamic/DynamicAccountsDynamoDbMigrationConfiguration.java index 984a9c1e4..2729d0a1b 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/dynamic/DynamicAccountsDynamoDbMigrationConfiguration.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/dynamic/DynamicAccountsDynamoDbMigrationConfiguration.java @@ -20,6 +20,9 @@ public class DynamicAccountsDynamoDbMigrationConfiguration { @JsonProperty boolean readEnabled; + @JsonProperty + boolean postCheckMismatches; + @JsonProperty boolean logMismatches; @@ -70,6 +73,10 @@ public class DynamicAccountsDynamoDbMigrationConfiguration { return readEnabled; } + public boolean isPostCheckMismatches() { + return postCheckMismatches; + } + public boolean isLogMismatches() { return logMismatches; } diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java index 11ab3e98a..cf149310b 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java @@ -731,7 +731,10 @@ public class AccountsManager { maybeUUid.ifPresent(uuid -> { - mismatchedAccounts.put(uuid); + if (dynamicConfigurationManager.getConfiguration().getAccountsDynamoDbMigrationConfiguration() + .isPostCheckMismatches()) { + mismatchedAccounts.put(uuid); + } if (dynamicConfigurationManager.getConfiguration().getAccountsDynamoDbMigrationConfiguration() .isLogMismatches()) { diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/MigrationMismatchedAccountsTableCrawler.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/MigrationMismatchedAccountsTableCrawler.java index d81932245..7c84a7675 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/MigrationMismatchedAccountsTableCrawler.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/MigrationMismatchedAccountsTableCrawler.java @@ -64,6 +64,11 @@ public class MigrationMismatchedAccountsTableCrawler extends ManagedPeriodicWork @Override public void doPeriodicWork() { + if (!dynamicConfigurationManager.getConfiguration().getAccountsDynamoDbMigrationConfiguration() + .isPostCheckMismatches()) { + return; + } + final List uuids = this.mismatchedAccounts.getUuids(MAX_BATCH_SIZE); final List processedUuids = new ArrayList<>(uuids.size());