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

Split invocation status in invocation status/service status, Change keying of journal to invocation id #1169

Merged

Conversation

slinkydeveloper
Copy link
Contributor

@slinkydeveloper slinkydeveloper commented Feb 8, 2024

This PR has some followups:

  • We can now remove the FullInvocationId in a couple of places, such as within the invoker and in the ServiceInvocationResponseSink. I'll open 2 followup issues for those.
  • We should perhaps rename InvocationId in JournalId? Because that's what it is now.
  • Update documentation about sys_* tables

@slinkydeveloper slinkydeveloper force-pushed the issues/reorganize-status-pp branch 2 times, most recently from 211a3a6 to c453646 Compare February 8, 2024 12:48
@slinkydeveloper slinkydeveloper changed the title [WIP] Split invocation status in invocation status/service status, Change keying of journal to invocation id Split invocation status in invocation status/service status, Change keying of journal to invocation id Feb 21, 2024
@slinkydeveloper slinkydeveloper force-pushed the issues/reorganize-status-pp branch 3 times, most recently from 20dbe55 to 53ae351 Compare February 22, 2024 13:02
@slinkydeveloper
Copy link
Contributor Author

The last commit is optional, it's a refactoring i did which i figured would be useful now.

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.

Thanks for creating this impressive piece of work @slinkydeveloper. The changes look good to me. I mainly had minor comments. The one thing that we should address before merging is making sure that the CLI still works. I think the renaming of some of the datafusion tables might cause problems for the CLI. The documentation update for the datafusion tables will be done as a follow-up, right?


#[derive(Debug, Default, Clone, PartialEq)]
pub enum ServiceStatus {
Locked(InvocationUuid),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this maybe return an InvocationId?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Storing InvocationId is redudant here, because partition key is already part of the key.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the Rust type that the upper layers will interact with, right? How things are stored by storage can be different. I am mainly wondering whether we want the upper layers to know about the uuid part and then doing the right stitching with the right partition key or whether this is something that is done by the layers that return this type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, although due to how our code is organized, this is not easy to plug in those try/from implementations. Will do this change anyway as you proposed, and perhaps revisit later how to improve those try/from impls.

crates/storage-proto/src/lib.rs Show resolved Hide resolved
crates/storage-rocksdb/src/invocation_status_table/mod.rs Outdated Show resolved Hide resolved
crates/storage-rocksdb/src/invocation_status_table/mod.rs Outdated Show resolved Hide resolved
crates/storage-rocksdb/src/invocation_status_table/mod.rs Outdated Show resolved Hide resolved
@@ -27,6 +27,8 @@ pub enum InvokeInputJournal {
CachedJournal(JournalMetadata, Vec<PlainRawEntry>),
}

// TODO We can remove FullInvocationId awareness from the invoker completely
Copy link
Contributor

Choose a reason for hiding this comment

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

Where are we gonna retrieve the ServiceId from if we don't provide the FullInvocationId?

Copy link
Contributor Author

@slinkydeveloper slinkydeveloper Feb 26, 2024

Choose a reason for hiding this comment

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

It can come straight from the journal reader (JournalMetadata/InvocationMetadata effectively).

Comment on lines 322 to 330
effects.drop_journal_and_pop_inbox(
FullInvocationId::with_service_id(
invocation_status
.service_id()
.expect("InvocationStatus should be available"),
invocation_id.invocation_uuid(),
),
journal_length,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Was it a mistake to pop the inbox before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. inbox don't make sense for virtual journal remote context :)

crates/types/src/identifiers.rs Outdated Show resolved Hide resolved
crates/types/src/identifiers.rs Outdated Show resolved Hide resolved
@tillrohrmann
Copy link
Contributor

Ah one more thing, I think we need to bump the storage format version to 2. Depending on which PR gets merged first, this might already be done via #1210.

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.

CLI changes looks good to me but I've not reviewed the rest of the PR.

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.

Great work @slinkydeveloper. The changes look good to me. +1 for merging.

Comment on lines +630 to 631
FROM sys_invocation_status ss
LEFT JOIN sys_invocation_state sis ON ss.id = sis.id
Copy link
Contributor

Choose a reason for hiding this comment

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

I have to admit that I find sys_invocation_status and sys_invocation_state a bit too close in Levenshtein distance. I always find myself thinking about what each table represents. Maybe as a follow-up, can we try to find more distinct names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here, we'll have to fix this at a later point.

@slinkydeveloper slinkydeveloper merged commit 230d139 into restatedev:main Feb 28, 2024
3 checks passed
@slinkydeveloper slinkydeveloper deleted the issues/reorganize-status-pp branch February 28, 2024 09:44
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