void updateAccountsFromFile(String accountJsonPath, boolean ignoreSnapshotVersion)
      throws IOException, AccountServiceException {
    long startTime = System.currentTimeMillis();
    Collection<Account> accountsToUpdate = getAccountsFromJson(accountJsonPath);
    if (!hasDuplicateAccountIdOrName(accountsToUpdate)) {
      if (ignoreSnapshotVersion) {
        Collection<Account> allAccounts = accountService.getAllAccounts();
        // Update the snapshot version to resolve conflict
        Map<Short, Account> existingAccountsMap = new HashMap<>();
        for (Account account : allAccounts) {
          existingAccountsMap.put(account.getId(), account);
        }
        Collection<Account> newAccounts = new ArrayList<>(accountsToUpdate.size());
        // resolve the snapshot conflict.
        for (Account account : accountsToUpdate) {
          Account accountInMap = existingAccountsMap.get(account.getId());
          if (accountInMap != null && accountInMap.getSnapshotVersion() != account.getSnapshotVersion()) {
            newAccounts.add(new AccountBuilder(account).snapshotVersion(accountInMap.getSnapshotVersion()).build());
          } else {
            newAccounts.add(account);
          }
        }
        accountsToUpdate = newAccounts;
      }
      accountService.updateAccounts(accountsToUpdate);
      System.out.println(
          accountsToUpdate.size() + " account(s) successfully created or updated, took " + (System.currentTimeMillis()
              - startTime) + " ms");
    } else {
      throw new IllegalArgumentException("Duplicate id or name exists in the accounts to update");
    }
  }
Update accounts from a file containing a json array of account metadata.
@param accountJsonPath the path to the file containing the account metadata to upload.
@param ignoreSnapshotVersion if {@code true}, don't verify the snapshot version.
@throws IOException
ambry-tools/src/main/java/com/github/ambry/account/AccountUpdateTool.java