Source:
<code>public boolean updateAccounts(Collection<Account> accounts) { checkOpen(); Objects.requireNonNull(accounts, "accounts cannot be null"); if (hasDuplicateAccountIdOrName(accounts)) { logger.debug("Duplicate account id or name exist in the accounts to update"); accountServiceMetrics.updateAccountErrorCount.inc(); return false; } long startTimeMs = System.currentTimeMillis(); logger.trace("Start updating to HelixPropertyStore with accounts={}", accounts); boolean hasSucceeded = false; if (hasConflictWithCache(accounts)) { logger.debug("Accounts={} conflict with the accounts in local cache. Cancel the update operation.", accounts); accountServiceMetrics.updateAccountErrorCount.inc(); } else { ZkUpdater zkUpdater = new ZkUpdater(accounts); hasSucceeded = helixStore.update(FULL_ACCOUNT_METADATA_PATH, zkUpdater, AccessOption.PERSISTENT); <START> zkUpdater.persistBackup(hasSucceeded); <END> } long timeForUpdate = System.currentTimeMillis() - startTimeMs; if (hasSucceeded) { logger.trace("Completed updating accounts, took time={} ms", timeForUpdate); accountServiceMetrics.updateAccountTimeInMs.update(timeForUpdate); if (notifier == null) { logger.warn("Notifier is not provided. Cannot notify other entities interested in account data change."); } else if (notifier.publish(ACCOUNT_METADATA_CHANGE_TOPIC, FULL_ACCOUNT_METADATA_CHANGE_MESSAGE)) { logger.trace("Successfully published message for account metadata change"); } else { logger.error("Failed to send notification for account metadata change"); accountServiceMetrics.notifyAccountDataChangeErrorCount.inc(); } } else { logger.error("Failed updating accounts={}, took ms", accounts, timeForUpdate); accountServiceMetrics.updateAccountErrorCount.inc(); } return hasSucceeded; }</code><technical_language>If zk level version match update is called again, means persistence is a desired property - is happen? for issue bring (not knowing if update succeeded not), do writing "new state" of update() function ? (i.e. do currently). combine writing of new state success status file. I guess spirit of this change is "previous state" is more important "new state" - new is for informational purposes</technical_language>

Target:
public boolean updateAccounts(Collection<Account> accounts) { checkOpen(); Objects.requireNonNull(accounts, "accounts cannot be null"); if (hasDuplicateAccountIdOrName(accounts)) { logger.debug("Duplicate account id or name exist in the accounts to update"); accountServiceMetrics.updateAccountErrorCount.inc(); return false; } long startTimeMs = System.currentTimeMillis(); logger.trace("Start updating to HelixPropertyStore with accounts={}", accounts); boolean hasSucceeded = false; if (hasConflictWithCache(accounts)) { logger.debug("Accounts={} conflict with the accounts in local cache. Cancel the update operation.", accounts); accountServiceMetrics.updateAccountErrorCount.inc(); } else { ZkUpdater zkUpdater = new ZkUpdater(accounts); hasSucceeded = helixStore.update(FULL_ACCOUNT_METADATA_PATH, zkUpdater, AccessOption.PERSISTENT); zkUpdater.maybePersistNewState(hasSucceeded); } long timeForUpdate = System.currentTimeMillis() - startTimeMs; if (hasSucceeded) { logger.trace("Completed updating accounts, took time={} ms", timeForUpdate); accountServiceMetrics.updateAccountTimeInMs.update(timeForUpdate); if (notifier == null) { logger.warn("Notifier is not provided. Cannot notify other entities interested in account data change."); } else if (notifier.publish(ACCOUNT_METADATA_CHANGE_TOPIC, FULL_ACCOUNT_METADATA_CHANGE_MESSAGE)) { logger.trace("Successfully published message for account metadata change"); } else { logger.error("Failed to send notification for account metadata change"); accountServiceMetrics.notifyAccountDataChangeErrorCount.inc(); } } else { logger.error("Failed updating accounts={}, took ms", accounts, timeForUpdate); accountServiceMetrics.updateAccountErrorCount.inc(); } return hasSucceeded; }