Marcel Reutegger created OAK-7959:
-------------------------------------

             Summary: MongoDocumentStore causes scan of entire nodes collection 
on startup
                 Key: OAK-7959
                 URL: https://issues.apache.org/jira/browse/OAK-7959
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: mongomk
    Affects Versions: 1.9.13, 1.9.12, 1.9.11, 1.9.10
            Reporter: Marcel Reutegger
            Assignee: Marcel Reutegger


This is a regression introduced with OAK-7645 when the MongoDB Java driver was 
updated to 3.8.

With the switch to the new driver, the use of a deprecated method {{count()}} 
was replaced with {{countDocuments()}}. The method {{countDocument()}} behaves 
differently and performs an aggregation command over all documents in the 
collection. The MongoDB log would then show something like:
{noformat}
2018-12-12T18:40:53.672+0100 I COMMAND  [conn6063] command oak.nodes command: 
aggregate { aggregate: "nodes", readConcern: { level: "local" }, pipeline: [ { 
$match: {} }, { $group: { _id: null, n: { $sum: 1 } } } ], cursor: {}, $db: 
"oak", $readPreference: { mode: "primaryPreferred" } } planSummary: COLLSCAN 
keysExamined:0 docsExamined:4038809 cursorExhausted:1 numYields:31584 
nreturned:1 reslen:127 locks:{ Global: { acquireCount: { r: 31586 } }, 
Database: { acquireCount: { r: 31586 } }, Collection: { acquireCount: { r: 
31586 } } } protocol:op_msg 1642ms
{noformat}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to