[Bug 371041] valid was not being set to new mongo db sessions, and the call to mongodb api was wrong in isIdInUse

This commit is contained in:
Jesse McConnell 2012-02-09 15:05:51 -06:00
parent 528c246163
commit 9ab7452f8f
2 changed files with 5 additions and 3 deletions

View File

@ -61,7 +61,9 @@ public class MongoSessionIdManager extends AbstractSessionIdManager
final static DBObject __version_1 = new BasicDBObject(MongoSessionManager.__VERSION,1); final static DBObject __version_1 = new BasicDBObject(MongoSessionManager.__VERSION,1);
final static DBObject __valid_false = new BasicDBObject(MongoSessionManager.__VALID,false); final static DBObject __valid_false = new BasicDBObject(MongoSessionManager.__VALID,false);
final static DBObject __valid_true = new BasicDBObject(MongoSessionManager.__VALID,true);
final DBCollection _sessions; final DBCollection _sessions;
protected Server _server; protected Server _server;
private Timer _scavengeTimer; private Timer _scavengeTimer;
@ -434,10 +436,10 @@ public class MongoSessionIdManager extends AbstractSessionIdManager
/* /*
* optimize this query to only return the valid variable * optimize this query to only return the valid variable
*/ */
DBObject o = _sessions.findOne(new BasicDBObject("id",sessionId), __valid_false); DBObject o = _sessions.findOne(new BasicDBObject("id",sessionId), __valid_true);
if ( o != null ) if ( o != null )
{ {
Boolean valid = (Boolean)o.get(MongoSessionManager.__VALID); Boolean valid = (Boolean)o.get(MongoSessionManager.__VALID);
if ( valid == null ) if ( valid == null )

View File

@ -118,7 +118,6 @@ public class MongoSessionManager extends NoSqlSessionManager
// Form query for upsert // Form query for upsert
BasicDBObject key = new BasicDBObject(__ID,session.getClusterId()); BasicDBObject key = new BasicDBObject(__ID,session.getClusterId());
key.put(__VALID,true);
// Form updates // Form updates
BasicDBObject update = new BasicDBObject(); BasicDBObject update = new BasicDBObject();
@ -133,6 +132,7 @@ public class MongoSessionManager extends NoSqlSessionManager
upsert = true; upsert = true;
version = new Long(1); version = new Long(1);
sets.put(__CREATED,session.getCreationTime()); sets.put(__CREATED,session.getCreationTime());
sets.put(__VALID,true);
sets.put(getContextKey(__VERSION),version); sets.put(getContextKey(__VERSION),version);
} }
else else