@@ -116,11 +116,13 @@ use crate::{
116
116
latest_min_document_snapshot_timer,
117
117
latest_min_snapshot_timer,
118
118
log_document_retention_cursor_age,
119
+ log_document_retention_no_cursor,
119
120
log_document_retention_scanned_document,
120
121
log_retention_cursor_age,
121
122
log_retention_documents_deleted,
122
123
log_retention_expired_index_entry,
123
124
log_retention_index_entries_deleted,
125
+ log_retention_no_cursor,
124
126
log_retention_scanned_document,
125
127
log_snapshot_verification_age,
126
128
retention_advance_timestamp_timer,
@@ -1249,13 +1251,22 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
1249
1251
retention_type : RetentionType ,
1250
1252
) -> anyhow:: Result < Timestamp > {
1251
1253
let checkpoint = Self :: get_checkpoint_no_logging ( persistence, retention_type) . await ?;
1252
- match retention_type {
1253
- RetentionType :: Document => log_document_retention_cursor_age (
1254
- ( * snapshot_reader. lock ( ) . latest_ts ( ) ) . secs_since_f64 ( checkpoint) ,
1255
- ) ,
1256
- RetentionType :: Index => log_retention_cursor_age (
1257
- ( * snapshot_reader. lock ( ) . latest_ts ( ) ) . secs_since_f64 ( checkpoint) ,
1258
- ) ,
1254
+ if checkpoint > Timestamp :: MIN {
1255
+ // Only log if the checkpoint has been written once, to avoid logging time since
1256
+ // epoch when the instance is first starting up.
1257
+ match retention_type {
1258
+ RetentionType :: Document => log_document_retention_cursor_age (
1259
+ ( * snapshot_reader. lock ( ) . latest_ts ( ) ) . secs_since_f64 ( checkpoint) ,
1260
+ ) ,
1261
+ RetentionType :: Index => log_retention_cursor_age (
1262
+ ( * snapshot_reader. lock ( ) . latest_ts ( ) ) . secs_since_f64 ( checkpoint) ,
1263
+ ) ,
1264
+ }
1265
+ } else {
1266
+ match retention_type {
1267
+ RetentionType :: Document => log_document_retention_no_cursor ( ) ,
1268
+ RetentionType :: Index => log_retention_no_cursor ( ) ,
1269
+ }
1259
1270
}
1260
1271
Ok ( checkpoint)
1261
1272
}
0 commit comments