Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-13663

Investigate slow query waiting on schemaLock

    • Storage Engines
    • 5
    • StorEng - 2024-11-12, StorEng - 2024-12-24

      HELP-65855 The mongod log of this ticket shows a slow query waiting on schemaLock for 182 secs where the table being accessed was just queried 5 mins before. Given a default 10 mins wiredTigerFileHandleCloseIdleTime of the workload that is more than 5 mins, wiredtiger should keep the dhandle in memory and the schemaLock is not required as only open handle will need the schemaLock.

      This ticket is to investigate why wiredtiger is waiting on schemaLock for dhandles being accessed within the wiredTigerFileHandleCloseIdleTime window, and provide solutions to mitigate this issue. The cluster details and log are shown as below:
      https://cloud.mongodb.com/v2/5996907f0bd66b5400d64817#/clusters/detail/dms-prod3

      {"t":{"$date":"2024-10-09T22:25:39.472Z"},"s":"I","c":"COMMAND","id":51803,"ctx":"conn8464895","msg":"Slow query","attr":{"type":"command","ns":"dealer_martenschevrolet_1222.dealerProperty","appName":"properties-service","command":{"find":"dealerProperty","filter":{"deleted":false,"dealerId":"1222","name":"ACCOUNTING_SITE_OVERRIDE_ENABLED"},"limit":1,"singleBatch":true,"_db":"dealer_martenschevrolet_1222","_clusterTime":{"clusterTime":{"_timestamp":{"t":1728512737,"i":13}},"signature":{"hash":{"_binary":{"base64":"kfBUgY16coEsbjrbBOd3DtTLpD4=","subType":"0"}},"keyId":7393966275157819397}},"lsid":{"id":{"_uuid":"e59d30bd-db98-4430-bcee-3127aba43472"}}},"planSummary":"IXSCAN { dealerId: 1, name: 1 }","planningTimeMicros":104,"keysExamined":0,"docsExamined":0,"nBatches":1,"cursorExhausted":true,"numYields":1,"nreturned":0,"queryHash":"A3F054B4","planCacheKey":"BDD22A6B","queryFramework":"classic","reslen":257,"locks":{"FeatureCompatibilityVersion":{"acquireCount":{"r":2}},"Global":{"acquireCount":{"r":2}},"Mutex":{"acquireCount":{"r":1}}},"readConcern":{"level":"local","provenance":"implicitDefault"},"storage":{"timeWaitingMicros":{"schemaLock":1927191}},"remote":"172.31.245.16:40244","protocol":"op_msg","durationMillis":2102}}
      ...
      {"t":{"$date":"2024-10-09T22:30:18.717Z"},"s":"I","c":"COMMAND","id":51803,"ctx":"conn8458149","msg":"Slow query","attr":{"type":"command","ns":"dealer_martenschevrolet_1222.dealerProperty","appName":"properties-service","command":{"find":"dealerProperty","filter":{"deleted":false,"dealerId":"1222","name":"MULTI_OEM_SWITCH_ENABLED"},"limit":1,"singleBatch":true,"_db":"dealer_martenschevrolet_1222","_clusterTime":{"clusterTime":{"_timestamp":{"t":1728512819,"i":18}},"signature":{"hash":{"_binary":{"base64":"cFtqYpoODAH+z24LqwlFL+n3XWw=","subType":"0"}},"keyId":7393966275157819397}},"lsid":{"id":{"_uuid":"ddf694c6-e7b3-4048-8830-c6c2c4044700"}}},"planSummary":"IXSCAN { dealerId: 1, name: 1 }","planningTimeMicros":93,"keysExamined":0,"docsExamined":0,"nBatches":1,"cursorExhausted":true,"numYields":1,"nreturned":0,"queryHash":"A3F054B4","planCacheKey":"BDD22A6B","queryFramework":"classic","reslen":257,"locks":{"FeatureCompatibilityVersion":{"acquireCount":{"r":2}},"Global":{"acquireCount":{"r":2}},"Mutex":{"acquireCount":{"r":1}}},"readConcern":{"level":"local","provenance":"implicitDefault"},"storage":{"timeWaitingMicros":{"handleLock":44540,"schemaLock":182775829}},"remote":"172.31.135.175:56314","protocol":"op_msg","durationMillis":199443
      

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            zunyi.liu@mongodb.com Zunyi Liu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: