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
base: jetty-12.0.x
Are you sure you want to change the base?
Conversation
dcb8d8a
to
bb593bd
Compare
@@ -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); |
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.
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(); |
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 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()) |
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.
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); |
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.
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); |
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.
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.
bb593bd
to
f134d84
Compare
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>
f134d84
to
5482e74
Compare
No description provided.