Skip to content

[LogServer][Bifrost][compat] Native support for HLC timestamps#4173

Merged
AhmedSoliman merged 1 commit intomainfrom
pr4173
Jan 13, 2026
Merged

[LogServer][Bifrost][compat] Native support for HLC timestamps#4173
AhmedSoliman merged 1 commit intomainfrom
pr4173

Conversation

@AhmedSoliman
Copy link
Copy Markdown
Contributor

@AhmedSoliman AhmedSoliman commented Jan 12, 2026

Adds support for HLC timestamps and extended headers in the record format
for both log-server and local_loglet storage layers.

Note that in this commit we don't actually write the HLC timestamp nor the extended header, but we handle decoding them correctly for forward compatibility. Additionally,
the new flag for ExtendedHeader allows arbitrary header fields to be added (based on flags) in the future.

Fixes #4149

  • Add RecordFlags bitflags with HlcTimestamp and ExtendedHeader flags
  • Decode HLC timestamps (UniqueTimestamp) when HlcTimestamp flag is set
  • Skip extended header bytes when ExtendedHeader flag is set (forward compat)
  • Add test cases for decoding records with various flag combinations
  • Fix missing ExtendedHeader handling in bifrost decode_custom_encoded_record

Stack created with Sapling. Best reviewed with ReviewStack.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 12, 2026

Test Results

  7 files  +  2    7 suites  +2   3m 11s ⏱️ + 1m 54s
 47 tests + 13   47 ✅ + 13  0 💤 ±0  0 ❌ ±0 
200 runs  +148  200 ✅ +148  0 💤 ±0  0 ❌ ±0 

Results for commit 9fed329. ± Comparison against base commit 96bd772.

This pull request removes 34 and adds 47 tests. Note that renamed tests count towards both.
dev.restate.sdktesting.tests.AwakeableIngressEndpointTest ‑ completeWithFailure(Client)
dev.restate.sdktesting.tests.AwakeableIngressEndpointTest ‑ completeWithSuccess(Client)
dev.restate.sdktesting.tests.BackwardCompatibilityTest$NewVersion ‑ completeAwakeable(Client)
dev.restate.sdktesting.tests.BackwardCompatibilityTest$NewVersion ‑ completeRetryableOperation(Client)
dev.restate.sdktesting.tests.BackwardCompatibilityTest$NewVersion ‑ proxyCallShouldBeDone(Client)
dev.restate.sdktesting.tests.BackwardCompatibilityTest$NewVersion ‑ proxyOneWayCallShouldBeDone(Client)
dev.restate.sdktesting.tests.BackwardCompatibilityTest$OldVersion ‑ createAwakeable(Client)
dev.restate.sdktesting.tests.BackwardCompatibilityTest$OldVersion ‑ startOneWayProxyCall(Client)
dev.restate.sdktesting.tests.BackwardCompatibilityTest$OldVersion ‑ startProxyCall(Client)
dev.restate.sdktesting.tests.BackwardCompatibilityTest$OldVersion ‑ startRetryableOperation(Client)
…
dev.restate.sdktesting.tests.CallOrdering ‑ ordering(boolean[], Client)[1]
dev.restate.sdktesting.tests.CallOrdering ‑ ordering(boolean[], Client)[2]
dev.restate.sdktesting.tests.CallOrdering ‑ ordering(boolean[], Client)[3]
dev.restate.sdktesting.tests.Cancellation ‑ cancelFromAdminAPI(BlockingOperation, Client, URI)[1]
dev.restate.sdktesting.tests.Cancellation ‑ cancelFromAdminAPI(BlockingOperation, Client, URI)[2]
dev.restate.sdktesting.tests.Cancellation ‑ cancelFromAdminAPI(BlockingOperation, Client, URI)[3]
dev.restate.sdktesting.tests.Cancellation ‑ cancelFromContext(BlockingOperation, Client)[1]
dev.restate.sdktesting.tests.Cancellation ‑ cancelFromContext(BlockingOperation, Client)[2]
dev.restate.sdktesting.tests.Cancellation ‑ cancelFromContext(BlockingOperation, Client)[3]
dev.restate.sdktesting.tests.Combinators ‑ awakeableOrTimeoutUsingAwakeableTimeoutCommand(Client)
…

♻️ This comment has been updated with latest results.

@AhmedSoliman AhmedSoliman force-pushed the pr4173 branch 3 times, most recently from 5925c06 to 8ec68cd Compare January 12, 2026 14:26
@AhmedSoliman AhmedSoliman marked this pull request as ready for review January 12, 2026 14:26
Copy link
Copy Markdown
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for creating this PR @AhmedSoliman. The changes look good to me. I only had some clarifying questions. +1 for merging.

Comment thread crates/bifrost/src/providers/local_loglet/record_format.rs Outdated
Comment on lines +49 to +65
#[derive(Debug, Clone, Default)]
#[repr(transparent)]
pub struct RecordFlags(u16);
bitflags! {
impl RecordFlags: u16 {
/// Record timestamp is in HLC format (UniqueTimestamp)
/// If unset, the timestamp is in NanosSinceEpoch format.
const HlcTimestamp = 0b00000000_00000001;
/// This flag indicates that instead of reading the payload directly from its position
/// in the message buffer, we should expect a u8 field that contains the number of extra
/// bytes the header occupies before the payload.
///
/// This allows future versions to add extra header fields without breaking backwards
/// compatibility.
const ExtendedHeader = 0b00000000_00000010;
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why adding this to the local loglet? Are we planning on keeping the local loglet for the future?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until we completely remove it, I'd like to keep it compatible. Note that we currently have it as default in restate-lite which we might change, but until then, let's keep them in sync (loosely)

/// compatibility.
const ExtendedHeader = 0b00000000_00000010;
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we share the RecordFlags between the local loglet and the log-server?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like to create direct coupling between the two, let's keep them roughly+manually in sync until we have a clear decision on the future of local loglet.

Copy link
Copy Markdown
Contributor

@muhamadazmy muhamadazmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you :)

Adds support for HLC timestamps and extended headers in the record format
for both log-server and local_loglet storage layers.

Note that in this commit we don't actually write the HLC timestamp nor the extended header, but we handle decoding them correctly for forward compatibility. Additionally,
the new flag for ExtendedHeader allows arbitrary header fields to be added (based on flags) in the future.

Fixes #4149


- Add RecordFlags bitflags with HlcTimestamp and ExtendedHeader flags
- Decode HLC timestamps (UniqueTimestamp) when HlcTimestamp flag is set
- Skip extended header bytes when ExtendedHeader flag is set (forward compat)
- Add test cases for decoding records with various flag combinations
- Fix missing ExtendedHeader handling in bifrost decode_custom_encoded_record
@AhmedSoliman AhmedSoliman merged commit 9fed329 into main Jan 13, 2026
59 checks passed
@AhmedSoliman AhmedSoliman deleted the pr4173 branch January 13, 2026 13:16
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Forward Compatibility] Support for UniqueTimestamps in LogServer record format

3 participants