Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-158

"Get more" cursor operation broken when talking to mongos with slaveOk=true

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • None
    • 0.11
    • None
    • None

    Description

      celestine-3 is an instance of mongos (nightly 27 Jan 2011) with one shard, referring to a replica set with 3 machines.
      The replica set has database "test1" which contains "items" collection with 320000 documents.
      Connecting to mongos with slaveOk=false or a a replica set underlying the mongos instance works fine even with slaveOk=true works fine.

      The following code reads some records, then bails out with an exception (see below):
      static void ReadTest()
      {
      try

      { const string connectionString = "mongodb://celestine-3/test1?slaveOk=true"; var database = MongoDatabase.Create(MongoUrl.Create(connectionString)); var items = database["items"]; var cursor = items.FindAll(); long sum = 0; foreach (var item in cursor) sum += item["v"].ToInt64(); }

      catch (Exception ex)

      { Console.WriteLine(ex.ToString()); }

      Console.ReadKey();
      }

      Exception:
      MongoDB.Driver.MongoQueryException: Cursor not found.
      at MongoDB.Driver.Internal.MongoReplyMessage`1.ReadFrom(BsonBuffer buffer) in Driver\Internal\MongoReplyMessage.cs
      at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage[TDocument](MongoServer server) in Driver\Internal\MongoConnection.cs
      at MongoDB.Driver.Internal.MongoCursorEnumerator`1.GetReply(MongoRequestMessage message) in Driver\Internal\MongoCursorEnumerator.cs
      at MongoDB.Driver.Internal.MongoCursorEnumerator`1.GetMore() in Driver\Internal\MongoCursorEnumerator.cs
      at MongoDB.Driver.Internal.MongoCursorEnumerator`1.MoveNext() in Driver\Internal\MongoCursorEnumerator.cs
      at mongotest.Program.ReadTest() in Program.cs:line 115

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            onyxmaster Aristarkh Zagorodnikov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: