Fix code to always set HistoryEntry modification time using txn time

Since HistoryEntry always represents a read-only log of mutation to a core resource, that mutation should always happen in a transaction, and the HistoryEntry should be saved in that transaction.  As such, it's always more accurate to use ofy().getTransactionTime() for the modificationTime of the HistoryEntry rather than just DateTime.now(UTC).

In addition, having these be the exact same timestamp makes it possible to align HistoryEntries with commit log manifests using modificationTime = transactionTime, which is useful for recovery and analysis purposes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170136957
This commit is contained in:
nickfelt 2017-09-26 17:41:39 -07:00 committed by Ben McIlwain
parent ceadfea11f
commit 2702c3a7f3
3 changed files with 3 additions and 6 deletions

View file

@ -104,7 +104,7 @@ public class HistoryEntry extends ImmutableObject implements Buildable {
/** The actual EPP xml of the command, stored as bytes to be agnostic of encoding. */
byte[] xmlBytes;
/** The time the command occurred. */
/** The time the command occurred, represented by the ofy transaction time.*/
@Index
DateTime modificationTime;