Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateSnapshot RPC returns min applied LSN #2743

Merged
merged 1 commit into from
Feb 17, 2025
Merged

Conversation

pcholakov
Copy link
Contributor

This enables the restatectl tool to print the minimum included LSN when ad-hoc snapshots are created.

This also enables the trim gap test to trim right up to the snapshotted LSN.

Verified

This commit was signed with the committer’s verified signature.
pcholakov Pavel Tcholakov
This enables the restatectl tool to print the minimum included LSN when ad-hoc snapshots are created.

This also enables the trim gap test to trim right up to the snapshotted LSN.
@@ -74,7 +75,13 @@ pub struct CreateSnapshotRequest {

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateSnapshotResponse {
pub result: Result<SnapshotId, SnapshotError>,
pub result: Result<Snapshot, SnapshotError>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this a reasonable shape for this RPC response? I made it this way when I first introduced it thinking it would be more evolvable - is that actually true? Should this just be a type alias for Result<Snapshot, SnapshotError> rather?

Copy link
Contributor

Choose a reason for hiding this comment

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

Compared to the previous version, that's better, although in the future we won't allow for marshaling "Result" like this. Since it has been already like this, I don't mind the change you introduced.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, sorry about that! I remember I called attention to this during the initial PR but didn't get clarity on this.

Copy link

github-actions bot commented Feb 14, 2025

Test Results

  7 files  ±0    7 suites  ±0   4m 24s ⏱️ +56s
 47 tests +2   46 ✅ +2  1 💤 ±0  0 ❌ ±0 
182 runs  +8  179 ✅ +8  3 💤 ±0  0 ❌ ±0 

Results for commit a6591d4. ± Comparison against base commit 36ba21a.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@AhmedSoliman AhmedSoliman left a comment

Choose a reason for hiding this comment

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

Left a few nits, and approving to unblock.

@@ -74,7 +75,13 @@ pub struct CreateSnapshotRequest {

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateSnapshotResponse {
pub result: Result<SnapshotId, SnapshotError>,
pub result: Result<Snapshot, SnapshotError>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Compared to the previous version, that's better, although in the future we won't allow for marshaling "Result" like this. Since it has been already like this, I don't mind the change you introduced.

@@ -133,11 +133,18 @@ async fn fast_forward_over_trim_gap() -> googletest::Result<()> {
.create_partition_snapshot(CreatePartitionSnapshotRequest { partition_id: 0 })
.await?
.into_inner();
info!(
"Snapshot created up to at least LSN {}",
Copy link
Contributor

Choose a reason for hiding this comment

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

"at least" might be misleading. Perhaps "that include LSN or higher"? Alternatively, describe it terms of what it doesn't have, i.e. "include changes up to LSN"

Comment on lines +102 to +104
"Snapshot created for partition {partition_id}: {} (LSN >= {})",
response.snapshot_id,
response.min_applied_lsn,
Copy link
Contributor

Choose a reason for hiding this comment

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

As a habbit, I wish we communicate the log-id when we talk about LSNs in general. I understand that the current equivalence of partition-id to log-id makes it redundant,, but it'll not always be like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted! It felt a bit premature to do so here but I'll make it a point to do so in the future. I'll update the response shape to return an explicit log id here, and have the server encapsulate the mapping.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugh, making the change I wanted to make - have CreatePartitionSnapshotResponse carry an explicit log id - is quite far-reaching. Let me send that as a follow-up PR.

@pcholakov pcholakov merged commit 5765dfd into main Feb 17, 2025
26 checks passed
@pcholakov pcholakov deleted the feat/return-snapshot-lsn branch February 17, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants