-
Notifications
You must be signed in to change notification settings - Fork 172
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
Now store the session as JSON. #4829
Conversation
- Add a `session_json` column to `persistent_session`. - `PersistentSessionFields` now includes the type for `session_json`. - `sessionToTable` now takes a value of type `Value` to populate the `session_json` column with. - Added `sessionMapToJSON` to validate the `SessionMap` value we expect as well as to construct the JSON that goes into `session_json`. - `lookupSession` backfills the `session_json` column if it is null. - `insertSession` and `replaceSession` functions of the `Storage SessionStorage` instance now streamline in a value for the `session_json` column.
Job #10216: Bundle Size — 62.34MiB (~-0.01%).
Warning Bundle contains 66 duplicate packages – View duplicate packages Bundle metrics
Bundle size by type
View job #10216 report View feature/session-stored-as-json branch activity View project dashboard |
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.
I was wondering if we should make the new column not nullable for consistency
(alter table ... add column session_json jsonb not null default '{}'
) but I think it's fine this way.
Problem:
Our server serialises the content of the session with a binary serialisation which means that it's difficult for anything else to look into the content of that session even if it has access to the database.
Fix:
This adds an additional column
session_json
to thepersistent_session
table, which is populated at these points:session_json
column is NULL.The
session_json
column is stored as the PostgreSQL nativejsonb
type which means it can be manipulated directly in PostgreSQL itself, rather than being stored as a text type.Commit Details:
session_json
column topersistent_session
.PersistentSessionFields
now includes the type forsession_json
.sessionToTable
now takes a value of typeValue
to populate thesession_json
column with.sessionMapToJSON
to validate theSessionMap
value we expect as well as to construct the JSON that goes intosession_json
.lookupSession
backfills thesession_json
column if it is NULL.insertSession
andreplaceSession
functions of theStorage SessionStorage
instance now streamline in a value for thesession_json
column.