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

[AMORO-3340]: Database based http session store #3341

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

baiyangtx
Copy link
Contributor

Why are the changes needed?

Close #3340.

Brief change log

  • Implement the SessionDataStore of the Javalin framework
  • A new configuration was introduced to control the expiration time of HTTP sessions stored in the database.

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before making a pull request

Documentation

  • Does this pull request introduce a new feature? (yes)
  • If yes, how is the feature documented? (docs)

@github-actions github-actions bot added the module:ams-server Ams server module label Nov 22, 2024
@github-actions github-actions bot added type:docs Improvements or additions to documentation type:build labels Nov 22, 2024
@baiyangtx
Copy link
Contributor Author

After login, we can find session info in amoro sysdb.
image

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 76.03306% with 29 lines in your changes missing coverage. Please review.

Project coverage is 27.48%. Comparing base (243d289) to head (eed6c9e).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...he/amoro/server/persistence/DataSourceFactory.java 63.01% 19 Missing and 8 partials ⚠️
.../server/persistence/HttpSessionHandlerFactory.java 97.22% 1 Missing ⚠️
...persistence/converter/Object2ByteArrayConvert.java 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3341      +/-   ##
============================================
+ Coverage     21.59%   27.48%   +5.88%     
- Complexity     2309     3509    +1200     
============================================
  Files           426      593     +167     
  Lines         39719    48295    +8576     
  Branches       5624     6231     +607     
============================================
+ Hits           8577    13272    +4695     
- Misses        30414    34087    +3673     
- Partials        728      936     +208     
Flag Coverage Δ
core 27.48% <76.03%> (?)
trino ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if (parameter == null) {
if (SqlSessionFactoryProvider.getDbType().equals(AmoroManagementConf.DB_TYPE_POSTGRES)) {
if (dbName.startsWith(AmoroManagementConf.DB_TYPE_POSTGRES)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I check source code and i find it's PostgreSQL in org.postgresql.jdbc.PgDatabaseMetaData that is not equails to postgres

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The dbName has been converted to lower case.

Copy link
Contributor

Choose a reason for hiding this comment

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

the lower case postgresql is also not equails to postgres

cache.setSessionDataStore(dataStore);
// set session timeout
Duration sessionTimeout = configurations.get(AmoroManagementConf.HTTP_SERVER_SESSION_TIMEOUT);
handler.setMaxInactiveInterval((int) sessionTimeout.getSeconds());
Copy link
Contributor

Choose a reason for hiding this comment

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

New to Javalin, Is that means we need to re-login after max_inactive_interval?

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:ams-server Ams server module type:build type:docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement]: Support database based http session management.
3 participants