Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9921

db.coll.find() returns nothing after drop and recreate

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.2
    • Component/s: Querying
    • None
    • ALL
    • Hide

      drop a collection via mongos
      insert data to the collection via mongos
      run db.collection.find() via mongos

      Show
      drop a collection via mongos insert data to the collection via mongos run db.collection.find() via mongos

      2 shards, 2replica+arbiter each, connecting via mongos.

      Hi there. I've dropped a collection, then continued to write data there(it was a lot of stale data, that I had to remove).
      However, newly written data cannot be read from mongos, via mongod everything looks ok.

      here some logs:

      mongos>use vertis-creativework
      mongos>db.pused.drop()

      mongod logs:
      Thu Jun 13 13:20:54 [conn1571507] command vertis-creativework.$cmd command: { drop: "pushed", $auth: { admin:

      { root: 2 }

      } } ntoreturn:1 keyUpdates:0 locks(micros) w:12584 reslen:133 12ms
      Thu Jun 13 13:20:54 [conn1408958] CoveredIndexMatcher::matches() {} 9:70c84318 0
      Thu Jun 13 13:20:54 [conn1408966] CoveredIndexMatcher::matches() {} 9:70c84318 0
      Thu Jun 13 13:20:54 [conn1408958] Matcher::matches() { ts: Timestamp 1371115254000|1, h: 630211948944288504, v: 2, op: "c", ns: "vertis-creativework.$cmd", o: { drop: "pushed", $auth: { admin:

      { root: 2 }

      } } }
      Thu Jun 13 13:20:54 [conn1408966] Matcher::matches() { ts: Timestamp 1371115254000|1, h: 630211948944288504, v: 2, op: "c", ns: "vertis-creativework.$cmd", o: { drop: "pushed", $auth: { admin:

      { root: 2 }

      } } }
      Thu Jun 13 13:20:54 [conn1408958] CoveredIndexMatcher _docMatcher->matches() returns 1
      Thu Jun 13 13:20:54 [conn1408966] CoveredIndexMatcher _docMatcher->matches() returns 1

      mongos>db.pushed.insert({_id:1})

      mongod logs:

      Thu Jun 13 13:23:08 [conn1571507] _reuse extent was:vertis-creativework.pushed now:vertis-creativework.pushed
      Thu Jun 13 13:23:08 [conn1571507] allocExtent vertis-creativework.pushed size 1024 1
      Thu Jun 13 13:23:08 [conn1571507] adding _id index for collection vertis-creativework.pushed
      Thu Jun 13 13:23:08 [conn1571507] build index vertis-creativework.pushed

      { _id: 1 }

      mem info: before index start vsize: 241624 resident: 6123 mapped: 119344
      Thu Jun 13 13:23:08 [conn1571507] external sort root: /var/lib/mongodb/_tmp/esort.1371115388.220/
      mem info: before final sort vsize: 241624 resident: 6123 mapped: 119344
      mem info: after final sort vsize: 241624 resident: 6123 mapped: 119344
      Thu Jun 13 13:23:08 [conn1571507] external sort used : 0 files in 0 secs
      Thu Jun 13 13:23:08 [conn1571507] reuse extent was:vertis-creativework.pushed.$_id now:vertis-creativework.pushed.$id
      Thu Jun 13 13:23:08 [conn1571507] allocExtent vertis-creativework.pushed.$id size 36864 1
      Thu Jun 13 13:23:08 [conn1571507] New namespace: vertis-creativework.pushed.$id
      Thu Jun 13 13:23:08 [conn1571507] done building bottom layer, going to commit
      Thu Jun 13 13:23:08 [conn1571507] build index done. scanned 0 total records. 0.002 secs
      Thu Jun 13 13:23:08 [conn1571507] New namespace: vertis-creativework.pushed
      Thu Jun 13 13:23:08 [conn1571507] insert vertis-creativework.pushed keyUpdates:0 locks(micros) w:3851 3ms
      Thu Jun 13 13:23:08 [conn1408958] CoveredIndexMatcher::matches() {} 9:70c85470 0
      Thu Jun 13 13:23:08 [conn1571507] runQuery called vertis-creativework.$cmd { getlasterror: 1.0, w: 1.0, $auth: { admin:

      { root: 2 }

      } }
      Thu Jun 13 13:23:08 [conn1408958] Matcher::matches() { ts: Timestamp 1371115388000|1, h: -1867873785266695569, v: 2, op: "i", ns: "vertis-creativework.pushed", o:

      { _id: 1.0 }

      }
      Thu Jun 13 13:23:08 [conn1571507] run command vertis-creativework.$cmd { getlasterror: 1.0, w: 1.0, $auth: { admin:

      { root: 2 }

      } }
      Thu Jun 13 13:23:08 [conn1408958] CoveredIndexMatcher _docMatcher->matches() returns 1
      Thu Jun 13 13:23:08 [conn1571507] Setting temporary authorization to: { admin:

      { root: 2 }

      }
      Thu Jun 13 13:23:08 [conn1571507] command vertis-creativework.$cmd command: { getlasterror: 1.0, w: 1.0, $auth: { admin:

      { root: 2 }

      } } ntoreturn:1 keyUpdates:0 reslen:94 0ms
      Thu Jun 13 13:23:08 [conn1408958] getmore local.oplog.rs query: { ts:

      { $gte: new Date(5880820189783654401) }

      } cursorid:2864578847244946404 ntoreturn:0 keyUpdates:0 locks(micros) r:478 nreturned:1 reslen:121 169ms
      Thu Jun 13 13:23:08 [conn1408966] CoveredIndexMatcher::matches() {} 9:70c85470 0
      Thu Jun 13 13:23:08 [conn1408966] Matcher::matches() { ts: Timestamp 1371115388000|1, h: -1867873785266695569, v: 2, op: "i", ns: "vertis-creativework.pushed", o:

      { _id: 1.0 }

      }
      Thu Jun 13 13:23:08 [conn1408966] CoveredIndexMatcher _docMatcher->matches() returns 1

      mongos>db.pushed.find()

      mongod:
      Thu Jun 13 13:24:35 [conn1571507] query vertis-creativework.pushed ntoreturn:0 keyUpdates:0 locks(micros) r:89 nreturned:0 reslen:20 0ms

      mongos>db.pushed.stats()
      {
      "sharded" : false,
      "primary" : "cs_mongodb-sh2-testing",
      "ns" : "vertis-creativework.pushed",
      "count" : 1,
      "size" : 20,
      "avgObjSize" : 20,
      "storageSize" : 4096,
      "numExtents" : 1,
      "nindexes" : 1,
      "lastExtentSize" : 4096,
      "paddingFactor" : 1,
      "systemFlags" : 1,
      "userFlags" : 0,
      "totalIndexSize" : 8176,
      "indexSizes" :

      { "_id_" : 8176 }

      ,
      "ok" : 1
      }

      mongos>db.pushed.find().explain()
      {
      "cursor" : "BasicCursor",
      "isMultiKey" : false,
      "n" : 0,
      "nscannedObjects" : 1,
      "nscanned" : 1,
      "nscannedObjectsAllPlans" : 1,
      "nscannedAllPlans" : 1,
      "scanAndOrder" : false,
      "indexOnly" : false,
      "nYields" : 0,
      "nChunkSkips" : 1,
      "millis" : 0,
      "indexBounds" : {

      },
      "server" : "cs-mongodb02gt.yandex.ru:27017",
      "millis" : 0
      }

      in config.collections there is no document for mentioned collection.

            Assignee:
            Unassigned Unassigned
            Reporter:
            gabol Anton V. Volokhov
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: