@Override
  public Account getAccountById(short accountId) {
    Account primaryResult = primaryAccountService.getAccountById(accountId);
    if (shouldCompare()) {
      Account secondaryResult = secondaryAccountService.getAccountById(accountId);
      if (primaryResult != null && !primaryResult.equals(secondaryResult)) {
        logger.warn("Inconsistency detected between primary and secondary for accountId ={}", accountId);
        metrics.getAccountInconsistencyCount.inc();
      }
    }
    return primaryResult;
  }
An implementation of {@link AccountService} that combines two sources. The "primary" acts as the source of
truth for users of this class, but results obtained are compared against the "secondary" source. This class can be
useful for safe migrations between account service implementations using different backing stores.
ambry-account/src/main/java/com/github/ambry/account/CompositeAccountService.java