diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java index 501b4edbc..fa1817b97 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java @@ -460,9 +460,13 @@ public class WhisperServerService extends Application { - final String abbreviatedCallChain = getAbbreviatedCallChain(new RuntimeException().getStackTrace()); + mismatchedAccounts.put(uuid); - logger.info("Mismatched account data: {}", StructuredArguments.entries(Map.of( - "type", mismatchDescription, - "uuid", maybeUUid.get(), - "callChain", abbreviatedCallChain - ))); - } + if (dynamicConfigurationManager.getConfiguration().getAccountsDynamoDbMigrationConfiguration() + .isLogMismatches()) { + final String abbreviatedCallChain = getAbbreviatedCallChain(new RuntimeException().getStackTrace()); + + logger.info("Mismatched account data: {}", StructuredArguments.entries(Map.of( + "type", mismatchDescription, + "uuid", uuid, + "callChain", abbreviatedCallChain + ))); + } + }); }); } diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/DeleteUserCommand.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/DeleteUserCommand.java index 7138dfb07..1b7c55217 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/DeleteUserCommand.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/workers/DeleteUserCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2020 Signal Messenger, LLC + * Copyright 2013-2021 Signal Messenger, LLC * SPDX-License-Identifier: AGPL-3.0-only */ @@ -50,6 +50,7 @@ import org.whispersystems.textsecuregcm.storage.MessagesCache; import org.whispersystems.textsecuregcm.storage.MessagesDynamoDb; import org.whispersystems.textsecuregcm.storage.MessagesManager; import org.whispersystems.textsecuregcm.storage.MigrationDeletedAccounts; +import org.whispersystems.textsecuregcm.storage.MigrationMismatchedAccounts; import org.whispersystems.textsecuregcm.storage.MigrationRetryAccounts; import org.whispersystems.textsecuregcm.storage.Profiles; import org.whispersystems.textsecuregcm.storage.ProfilesManager; @@ -107,37 +108,57 @@ public class DeleteUserCommand extends EnvironmentCommand()); - DynamoDbClient reportMessagesDynamoDb = DynamoDbFromConfig.client(configuration.getReportMessageDynamoDbConfiguration(), + DynamoDbClient reportMessagesDynamoDb = DynamoDbFromConfig.client( + configuration.getReportMessageDynamoDbConfiguration(), software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.create()); DynamoDbClient messageDynamoDb = DynamoDbFromConfig.client(configuration.getMessageDynamoDbConfiguration(), software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.create()); DynamoDbClient preKeysDynamoDb = DynamoDbFromConfig.client(configuration.getKeysDynamoDbConfiguration(), software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.create()); - DynamoDbClient accountsDynamoDbClient = DynamoDbFromConfig.client(configuration.getAccountsDynamoDbConfiguration(), + DynamoDbClient accountsDynamoDbClient = DynamoDbFromConfig.client( + configuration.getAccountsDynamoDbConfiguration(), software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.create()); - DynamoDbAsyncClient accountsDynamoDbAsyncClient = DynamoDbFromConfig.asyncClient(configuration.getAccountsDynamoDbConfiguration(), + DynamoDbAsyncClient accountsDynamoDbAsyncClient = DynamoDbFromConfig.asyncClient( + configuration.getAccountsDynamoDbConfiguration(), software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.create(), accountsDynamoDbMigrationThreadPool); - DynamoDbClient deletedAccountsDynamoDbClient = DynamoDbFromConfig.client(configuration.getDeletedAccountsDynamoDbConfiguration(), + DynamoDbClient deletedAccountsDynamoDbClient = DynamoDbFromConfig.client( + configuration.getDeletedAccountsDynamoDbConfiguration(), + software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.create()); + DynamoDbClient migrationMismatchedAccountsDynamoDb = DynamoDbFromConfig.client( + configuration.getMigrationMismatchedAccountsDynamoDbConfiguration(), software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.create()); - FaultTolerantRedisCluster cacheCluster = new FaultTolerantRedisCluster("main_cache_cluster", configuration.getCacheClusterConfiguration(), redisClusterClientResources); + FaultTolerantRedisCluster cacheCluster = new FaultTolerantRedisCluster("main_cache_cluster", + configuration.getCacheClusterConfiguration(), redisClusterClientResources); - ExecutorService keyspaceNotificationDispatchExecutor = environment.lifecycle().executorService(name(getClass(), "keyspaceNotification-%d")).maxThreads(4).build(); - ExecutorService backupServiceExecutor = environment.lifecycle().executorService(name(getClass(), "backupService-%d")).maxThreads(8).minThreads(1).build(); - ExecutorService storageServiceExecutor = environment.lifecycle().executorService(name(getClass(), "storageService-%d")).maxThreads(8).minThreads(1).build(); + ExecutorService keyspaceNotificationDispatchExecutor = environment.lifecycle() + .executorService(name(getClass(), "keyspaceNotification-%d")).maxThreads(4).build(); + ExecutorService backupServiceExecutor = environment.lifecycle() + .executorService(name(getClass(), "backupService-%d")).maxThreads(8).minThreads(1).build(); + ExecutorService storageServiceExecutor = environment.lifecycle() + .executorService(name(getClass(), "storageService-%d")).maxThreads(8).minThreads(1).build(); - ExternalServiceCredentialGenerator backupCredentialsGenerator = new ExternalServiceCredentialGenerator(configuration.getSecureBackupServiceConfiguration().getUserAuthenticationTokenSharedSecret(), new byte[0], false); - ExternalServiceCredentialGenerator storageCredentialsGenerator = new ExternalServiceCredentialGenerator(configuration.getSecureStorageServiceConfiguration().getUserAuthenticationTokenSharedSecret(), new byte[0], false); + ExternalServiceCredentialGenerator backupCredentialsGenerator = new ExternalServiceCredentialGenerator( + configuration.getSecureBackupServiceConfiguration().getUserAuthenticationTokenSharedSecret(), new byte[0], + false); + ExternalServiceCredentialGenerator storageCredentialsGenerator = new ExternalServiceCredentialGenerator( + configuration.getSecureStorageServiceConfiguration().getUserAuthenticationTokenSharedSecret(), new byte[0], + false); - DynamicConfigurationManager dynamicConfigurationManager = new DynamicConfigurationManager(configuration.getAppConfig().getApplication(), configuration.getAppConfig().getEnvironment(), configuration.getAppConfig().getConfigurationName()); + DynamicConfigurationManager dynamicConfigurationManager = new DynamicConfigurationManager( + configuration.getAppConfig().getApplication(), configuration.getAppConfig().getEnvironment(), + configuration.getAppConfig().getConfigurationName()); dynamicConfigurationManager.start(); - ExperimentEnrollmentManager experimentEnrollmentManager = new ExperimentEnrollmentManager(dynamicConfigurationManager); + ExperimentEnrollmentManager experimentEnrollmentManager = new ExperimentEnrollmentManager( + dynamicConfigurationManager); - DynamoDbClient migrationDeletedAccountsDynamoDb = DynamoDbFromConfig.client(configuration.getMigrationDeletedAccountsDynamoDbConfiguration(), + DynamoDbClient migrationDeletedAccountsDynamoDb = DynamoDbFromConfig.client( + configuration.getMigrationDeletedAccountsDynamoDbConfiguration(), software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.create()); - DynamoDbClient migrationRetryAccountsDynamoDb = DynamoDbFromConfig.client(configuration.getMigrationRetryAccountsDynamoDbConfiguration(), + DynamoDbClient migrationRetryAccountsDynamoDb = DynamoDbFromConfig.client( + configuration.getMigrationRetryAccountsDynamoDbConfiguration(), software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.create()); DynamoDbClient pendingAccountsDynamoDbClient = DynamoDbFromConfig.client(configuration.getPendingAccountsDynamoDbConfiguration(), software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider.create()); @@ -163,22 +184,38 @@ public class DeleteUserCommand extends EnvironmentCommand account = accountsManager.get(user); if (account.isPresent()) { diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/SetUserDiscoverabilityCommand.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/SetUserDiscoverabilityCommand.java index 34682780f..a2ae5c167 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/SetUserDiscoverabilityCommand.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/workers/SetUserDiscoverabilityCommand.java @@ -48,6 +48,7 @@ import org.whispersystems.textsecuregcm.storage.MessagesCache; import org.whispersystems.textsecuregcm.storage.MessagesDynamoDb; import org.whispersystems.textsecuregcm.storage.MessagesManager; import org.whispersystems.textsecuregcm.storage.MigrationDeletedAccounts; +import org.whispersystems.textsecuregcm.storage.MigrationMismatchedAccounts; import org.whispersystems.textsecuregcm.storage.MigrationRetryAccounts; import org.whispersystems.textsecuregcm.storage.Profiles; import org.whispersystems.textsecuregcm.storage.ProfilesManager; @@ -153,6 +154,9 @@ public class SetUserDiscoverabilityCommand extends EnvironmentCommand