-
Notifications
You must be signed in to change notification settings - Fork 713
feat: user session migration from meta to new table #9183
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
Conversation
|
Failed to generate code suggestions for PR |
e8e8757 to
a916c55
Compare
|
Failed to generate code suggestions for PR |
aa55718 to
5df537f
Compare
e823806 to
533034a
Compare
src/infra/src/table/migration/m20251118_000002_create_sessions_table.rs
Outdated
Show resolved
Hide resolved
src/infra/src/table/migration/m20251118_000003_delete_meta_sessions.rs
Outdated
Show resolved
Hide resolved
533034a to
1fef4e6
Compare
1fef4e6 to
aab6915
Compare
|
Failed to generate code suggestions for PR |
Greptile OverviewGreptile SummaryThis PR migrates user session storage from the generic meta table to a dedicated sessions table with proper schema and indexing. The implementation adds a new sessions table with SeaORM entity model, CRUD operations, and two database migrations. Key Changes:
Issues Found:
Confidence Score: 3/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client
participant Service as service/db/session
participant Table as infra/table/sessions
participant DB as Database (ORM)
participant Coordinator as Cluster Coordinator
participant Cache as USER_SESSIONS Cache
Note over Client,Cache: Session Set Operation
Client->>Service: set(session_id, access_token)
Service->>Table: set(session_id, access_token)
Table->>DB: find().filter(SessionId).one()
DB-->>Table: Option<Model>
alt Session exists
Table->>Table: Convert to ActiveModel
Table->>DB: update(access_token, updated_at)
else Session not found
Table->>Table: Create new ActiveModel
Table->>DB: insert(new session)
end
DB-->>Table: Result
Table-->>Service: Ok(())
Service->>Coordinator: put_into_db_coordinator(key, empty_bytes)
Service->>Cache: insert(session_id, access_token)
Service-->>Client: Ok(())
Note over Client,Cache: Session Get Operation
Client->>Service: get(session_id)
Service->>Cache: get(session_id)
alt Cache hit
Cache-->>Service: access_token
Service-->>Client: Ok(access_token)
else Cache miss
Service->>Table: get(session_id)
Table->>DB: find().filter(SessionId).one()
DB-->>Table: Option<Model>
alt Found
Table-->>Service: Some(session)
Service->>Cache: insert(session_id, access_token)
Service-->>Client: Ok(access_token)
else Not found
Table-->>Service: None
Service-->>Client: Error("Session not found")
end
end
Note over Client,Cache: Session Watch & Sync
Coordinator->>Service: watch() event
alt Put Event
Service->>Table: get(session_id)
Table->>DB: find().filter(SessionId).one()
DB-->>Table: Option<Model>
Table-->>Service: Some(session)
Service->>Cache: insert(session_id, access_token)
else Delete Event
Service->>Cache: remove(session_id)
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 files reviewed, 4 comments
src/infra/src/table/migration/m20251118_000003_delete_meta_sessions.rs
Outdated
Show resolved
Hide resolved
YashodhanJoshi1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some nitpicks, some comments
src/infra/src/table/migration/m20251118_000002_create_sessions_table.rs
Outdated
Show resolved
Hide resolved
src/infra/src/table/migration/m20251118_000003_delete_meta_sessions.rs
Outdated
Show resolved
Hide resolved
afb9def to
86de80e
Compare
a8f32fc to
e220165
Compare
5fbb9ad to
07beaa2
Compare
This PR make necessary changing for using new sessions table for storing user sessions and also removes the existing sessions from meta table
NEED TO BE MERGED POST RELEASE