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

Issue #11322 Upgrade to mongodb-driver-sync 5.x #11681

Draft
wants to merge 17 commits into
base: jetty-12.0.x
Choose a base branch
from

Conversation

olamy
Copy link
Member

@olamy olamy commented Apr 22, 2024

No description provided.

@@ -181,17 +182,18 @@ public SessionData doLoad(String id) throws Exception
if (sessionDocument == null)
return null;

Boolean valid = (Boolean)sessionDocument.get(__VALID);
boolean valid = (Boolean)sessionDocument.get(__VALID);
Copy link
Contributor

Choose a reason for hiding this comment

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

If sessionDocument doesn't contain the __VALID field, this will throw NPE.


DBObject sessionDocument = _dbSessions.findOne(new BasicDBObject(__ID, id), fields);
Bson filterId = Filters.eq(__ID, id);
Document sessionDocument = _dbSessions.find(filterId).first();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the old code was trying to be efficient about the fields that we returned, ie only returning the fields that would be examined, rather than the whole set of serialized session attributes (which won't be examined). Does the new API provide a similar efficiency?

@@ -332,48 +335,37 @@ public boolean doExists(String id) throws Exception
Long expiry = (Long)sessionDocument.get(__EXPIRY);

//expired?
if (expiry.longValue() > 0 && expiry.longValue() < System.currentTimeMillis())
if (expiry > 0 && expiry < System.currentTimeMillis())
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this throw NPE if expiry is null ?

@@ -487,12 +495,12 @@ public void doStore(String id, SessionData data, long lastSaveTime) throws Excep
sets.put(getContextSubfield(__LASTNODE), data.getLastNode());
version = ((Number)version).longValue() + 1L;
((NoSqlSessionData)data).setVersion(version);
update.put("$inc", _version1);
//update.put("$inc", _version1);
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to update the version stored in the session document.

@@ -458,8 +466,8 @@ public void initialize(SessionContext context) throws Exception
public void doStore(String id, SessionData data, long lastSaveTime) throws Exception
{
// Form query for upsert
final BasicDBObject key = new BasicDBObject(__ID, id);

//final BasicDBObject key = new BasicDBObject(__ID, id);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure that mongo hasn't changed the way it stores documents? In other words, we need to check that a session written out by the older version of mongo is still readable by this new version of mongo.

@olamy olamy force-pushed the jetty-12.0.x-mongodb-driver-sync branch from bb593bd to f134d84 Compare May 6, 2024 05:56
olamy added 17 commits May 6, 2024 19:01
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
Signed-off-by: Olivier Lamy <olamy@apache.org>
@olamy olamy force-pushed the jetty-12.0.x-mongodb-driver-sync branch from f134d84 to 5482e74 Compare May 6, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Change jetty-nosql MongoDB dependency from unmaintained mongo-java-driver to mongodb-driver-sync
2 participants