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

[restatectl] Introduces replicated-loglet top-level command #2231

Merged
merged 4 commits into from
Nov 8, 2024

Conversation

AhmedSoliman
Copy link
Contributor

@AhmedSoliman AhmedSoliman commented Nov 7, 2024

Currently this only implements a very basic info. Note that the command is built merely as an example, it's UI/UX and behaviour will change by follow-ups.

Pass by stringified log_id (<log_id>_<segment>)

cargo run -q --bin restatectl -- replicated-loglet info 1_0                                                                              ✘ 1
Log Configuration (v1)
Loglet Referenced in:
    - LogId=1, Segment=0

Loglet Parameters:
    Loglet Id: 1_0 (4294967296)
    Sequencer: N1:1
    Replication: {node: 2}
    Node Set: [N3, N2, N1]

Or raw loglet id (<loglet_id>)

cargo run -q --bin restatectl -- replicated-loglet info 1_0                                                                              ✘ 1
Log Configuration (v1)
Loglet Referenced in:
    - LogId=1, Segment=0

Loglet Parameters:
    Loglet Id: 1_0 (4294967296)
    Sequencer: N1:1
    Replication: {node: 2}
    Node Set: [N3, N2, N1]


Stack created with Sapling. Best reviewed with ReviewStack.

Copy link

github-actions bot commented Nov 7, 2024

Test Results

  7 files  ±0    7 suites  ±0   4m 30s ⏱️ ±0s
 47 tests ±0   46 ✅ ±0  1 💤 ±0  0 ❌ ±0 
182 runs  ±0  179 ✅ ±0  3 💤 ±0  0 ❌ ±0 

Results for commit fafa712. ± Comparison against base commit 7a28dad.

♻️ This comment has been updated with latest results.

Copy link
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.

LGTM. +1 for merging.

MetadataContainer enum was ~450 bytes and it's being used often. It also forces users to clone input which is not great. The PR contains mostly mechanical changes.
This introduces a lookup table to find replicated loglets by id in Log metadata. This also promotes replicated loglet as a core feature in restate-types since it'll become the default soon.


In future follow-up we can explore deserializing the loglet params prematurely (or use typed structure instead of string) and maintain reference-counted container to avoid memory bloat. In this PR, we treat replicated loglet as a special case to speed up implementation and since this will be the de-facto loglet provider anyway.
Currently this only implements a very basic `info`. Note that the command is built merely as an example, it's UI/UX and behaviour will change by follow-ups.

Pass by stringified log_id (`<log_id>_<segment>`)
```
cargo run -q --bin restatectl -- replicated-loglet info 1_0                                                                              ✘ 1
Log Configuration (v1)
Loglet Referenced in:
    - LogId=1, Segment=0

Loglet Parameters:
    Loglet Id: 1_0 (4294967296)
    Sequencer: N1:1
    Replication: {node: 2}
    Node Set: [N3, N2, N1]
```

Or raw loglet id (`<loglet_id>`)
```
cargo run -q --bin restatectl -- replicated-loglet info 1_0                                                                              ✘ 1
Log Configuration (v1)
Loglet Referenced in:
    - LogId=1, Segment=0

Loglet Parameters:
    Loglet Id: 1_0 (4294967296)
    Sequencer: N1:1
    Replication: {node: 2}
    Node Set: [N3, N2, N1]

```
@AhmedSoliman AhmedSoliman merged commit fafa712 into main Nov 8, 2024
12 checks passed
@AhmedSoliman AhmedSoliman deleted the pr2231 branch November 8, 2024 15:52
Copy link
Contributor

@pcholakov pcholakov left a comment

Choose a reason for hiding this comment

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

Apologies for the slow turnaround, just a minor callout on info vs. describe - we can update other places to info if we want to standardize on this sub-command rather.


#[derive(Run, Parser, Collect, Clone, Debug)]
#[cling(run = "get_info")]
pub struct InfoOpts {
Copy link
Contributor

Choose a reason for hiding this comment

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

No strong opinion her but we've used the verb "describe" for this type of command elsewhere - we can solve with aliases and the internal struct doesn't need to be consistent, but it may be nice for users to see the same set of sub-commands everywhere.

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.

3 participants