[JAVA-1111] isLocked is incompatible with MongoDB 2.5.5 Created: 13/Feb/14  Updated: 14/Feb/14  Resolved: 14/Feb/14

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 2.12.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: John Morales Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Issue Links:
Related
is related to SERVER-12734 CurrentOp (inprog) fails with wrapped... Closed

 Description   

MongoClient exposes a method `isLocked()` that checks if the given node is fsync locked.

On 2.5.5 via a mongoS, this operation fails with the following exception:

com.mongodb.MongoException: DBClientBase::findN: transport error: mms-db1:50000 ns: admin.$cmd.sys.inprog query: { $query: {} }
	at com.mongodb.QueryResultIterator.throwOnQueryFailure(QueryResultIterator.java:213)
	at com.mongodb.QueryResultIterator.init(QueryResultIterator.java:197)
	at com.mongodb.QueryResultIterator.initFromQueryResponse(QueryResultIterator.java:175)
	at com.mongodb.QueryResultIterator.<init>(QueryResultIterator.java:64)
	at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:78)
	at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:59)
	at com.mongodb.DBCollection.findOne(DBCollection.java:869)
	at com.mongodb.DBCollection.findOne(DBCollection.java:843)
	at com.mongodb.DBCollection.findOne(DBCollection.java:789)
	at com.mongodb.DBCollection.findOne(DBCollection.java:778)
	at com.mongodb.Mongo.isLocked(Mongo.java:734)

Note:

  • The command was given to a mongoS listed in the URI mentioned in Environment above.
  • The mms-db1:50000 from the trace is the primary of the first shard.

In the mms-db1:50000's mongod.log, the following message is logged:

[conn551] AssertionException handling request, closing client connection: 16810 bad query: BadValue unknown top level operator: $query

It appears to be dependent on going through the mongoS, but unclear if auth-enabled is a factor.



 Comments   
Comment by John Morales [ 14/Feb/14 ]

Created: SERVER-12734

Comment by John Morales [ 14/Feb/14 ]

I see - I think the intention on 2.4.9 was the fan out the check to shards rather than performing the fsync lock. The MongoClient.isLocked() is only doing a check of fsync "status".

Will create a SERVER ticket.

Comment by Jeffrey Yemin [ 14/Feb/14 ]

Is there a use case for calling isLocked on a mongos? If you try to lock a mongos, you get:

mongos> db.fsyncLock()
{ "ok" : 0, "errmsg" : "can't do lock through mongos" }

I think it would be best if all lock-related methods threw an exception unless the MongoClient represents a direct connection to a mongod.

Comment by John Morales [ 14/Feb/14 ]

No, sorry - now I see how that's confusing.

I first discovered the issue using 2.11.2. I then only tried 2.12.0 snapshot as a sanity check for perhaps it was fixed in 2.12.0 which I know provides support for some MongoDB 2.5.5 changes.

In conclusion, neither 2.11.2 nor 2.12.0 snapshot works against MongoDB 2.5.5. But (at least) 2.11.2 works with MongoDB 2.4.9 - didn't try 2.12.0 with server 2.4.9.

Comment by Jeffrey Yemin [ 14/Feb/14 ]

Just to be clear, this works with 2.11.x?

Generated at Thu Feb 08 08:53:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.