diff --git a/kernel/src/actions/mod.rs b/kernel/src/actions/mod.rs index 630eedc816..d03abc6162 100644 --- a/kernel/src/actions/mod.rs +++ b/kernel/src/actions/mod.rs @@ -331,8 +331,13 @@ where struct CommitInfo { /// The time this logical file was created, as milliseconds since the epoch. /// Read: optional, write: required (that is, kernel always writes). - /// If in-commit timestamps are enabled, this is always required. pub(crate) timestamp: Option, + /// The time this logical file was created, as milliseconds since the epoch. Unlike + /// `timestamp`, this field is guaranteed to be monotonically increase with each commit. + /// Note: If in-commit timestamps are enabled, both the following must be true: + /// - The `inCommitTimestamp` field must always be present in CommitInfo. + /// - The CommitInfo action must always be the first one in a commit. + pub(crate) in_commit_timestamp: Option, /// An arbitrary string that identifies the operation associated with this commit. This is /// specified by the engine. Read: optional, write: required (that is, kernel alwarys writes). pub(crate) operation: Option, @@ -694,6 +699,7 @@ mod tests { "commitInfo", StructType::new(vec![ StructField::new("timestamp", DataType::LONG, true), + StructField::new("inCommitTimestamp", DataType::LONG, true), StructField::new("operation", DataType::STRING, true), StructField::new( "operationParameters", diff --git a/kernel/src/transaction.rs b/kernel/src/transaction.rs index c73782f644..6cc7ff38b7 100644 --- a/kernel/src/transaction.rs +++ b/kernel/src/transaction.rs @@ -315,6 +315,12 @@ fn generate_commit_info( .get_mut("operationParameters") .ok_or_else(|| Error::missing_column("operationParameters"))? .data_type = hack_data_type; + + // Since writing in-commit timestamps is not supported, we remove the field so it is not + // written to the log + commit_info_data_type + .fields + .shift_remove("inCommitTimestamp"); commit_info_field.data_type = DataType::Struct(commit_info_data_type); let commit_info_evaluator = engine.get_expression_handler().get_evaluator(