-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Diagnostics
-
None
-
ALL
hi:
i have mongodb 4.4.2 Sharded clusters including one shard.i test nearest.when sql direct to primary using IXSCAN,secondary using COUNT_SCAN.the following is my test:
mongos> db.getMongo().setReadPref('nearest')
mongos> db.POCCOLL.count({fld3:"invidunt ut labore et dolore"})
2695802
mongos>
from primary logs:
{"t":\{"$date":"2020-12-04T17:15:07.841+08:00"},"s":"I", "c":"COMMAND", "id":51803, "ctx":"conn1969","msg":"Slow query","attr":\{"type":"command","ns":"POCDB.POCCOLL","appName":"MongoDB Shell","command":{"count":"POCCOLL","query":{"fld3":"invidunt ut labore et dolore"},"readConcern":\{"provenance":"implicitDefault"},"shardVersion":[\{"$timestamp":{"t":1,"i":2894}},\{"$oid":"5fc737fe7209449001f7369d"}],"clientOperationKey":\{"$uuid":"f0fa77d1-9ebb-40fa-bad5-fbc18251052a"},"lsid":\{"id":{"$uuid":"3acac26a-0f29-414a-a339-b8b43cc66e69"},"uid":\{"$binary":{"base64":"O0CMtIVItQN4IsEOsJdrPL8s7jv5xwh5a/A5Qfvs2A8=","subType":"0"}}},"maxTimeMSOpOnly":120,"$readPreference":\{"mode":"nearest","hedge":{"enabled":true}},"$clusterTime":\{"clusterTime":{"$timestamp":{"t":1607073306,"i":1}},"signature":\{"hash":{"$binary":{"base64":"XszqboCQ7DhMofAB6xOzk39BdJk=","subType":"0"}},"keyId":6901213159848149013}},"$audit":\{"$impersonatedUsers":[{"user":"admin","db":"admin"}],"$impersonatedRoles":[\{"role":"root","db":"admin"}]},"$client":\{"application":{"name":"MongoDB Shell"},"driver":\{"name":"MongoDB Internal Client","version":"4.4.2"},"os":\{"type":"Linux","name":"CentOS Linux release 7.4.1708 (Core) ","architecture":"x86_64","version":"Kernel 3.10.0-693.21.1.el7.x86_64"},"mongos":\{"host":"vmt20130:31051","client":"10.130.9.150:60544","version":"4.4.2"}},"$configServerState":\{"opTime":{"ts":{"$timestamp":{"t":1607073306,"i":1}},"t":3}},"$db":"POCDB"},"planSummary":"IXSCAN \{ fld3: 1 }","numYields":7,"queryHash":"97EEEEB2","planCacheKey":"EC620B13","ok":0,"errMsg":"Exec error resulting in state FAILURE :: caused by :: operation exceeded time limit","errName":"MaxTimeMSExpired","errCode":50,"reslen":450,"locks":\{"ReplicationStateTransition":{"acquireCount":{"w":8}},"Global":\{"acquireCount":{"r":8}},"Database":\{"acquireCount":{"r":8}},"Collection":\{"acquireCount":{"r":8}},"Mutex":\{"acquireCount":{"r":3}}},"readConcern":\{"provenance":"implicitDefault"},"protocol":"op_msg","durationMillis":148}}
from secondary logs:
{"t":\{"$date":"2020-12-04T17:15:08.812+08:00"},"s":"I", "c":"COMMAND", "id":51803, "ctx":"conn1913","msg":"Slow query","attr":\{"type":"command","ns":"POCDB.POCCOLL","appName":"MongoDB Shell","command":{"count":"POCCOLL","query":{"fld3":"invidunt ut labore et dolore"},"readConcern":\{"provenance":"implicitDefault"},"shardVersion":[\{"$timestamp":{"t":1,"i":2894}},\{"$oid":"5fc737fe7209449001f7369d"}],"clientOperationKey":\{"$uuid":"f0fa77d1-9ebb-40fa-bad5-fbc18251052a"},"lsid":\{"id":{"$uuid":"3acac26a-0f29-414a-a339-b8b43cc66e69"},"uid":\{"$binary":{"base64":"O0CMtIVItQN4IsEOsJdrPL8s7jv5xwh5a/A5Qfvs2A8=","subType":"0"}}},"$readPreference":\{"mode":"nearest","hedge":{"enabled":true}},"$clusterTime":\{"clusterTime":{"$timestamp":{"t":1607073306,"i":1}},"signature":\{"hash":{"$binary":{"base64":"XszqboCQ7DhMofAB6xOzk39BdJk=","subType":"0"}},"keyId":6901213159848149013}},"$audit":\{"$impersonatedUsers":[{"user":"admin","db":"admin"}],"$impersonatedRoles":[\{"role":"root","db":"admin"}]},"$client":\{"application":{"name":"MongoDB Shell"},"driver":\{"name":"MongoDB Internal Client","version":"4.4.2"},"os":\{"type":"Linux","name":"CentOS Linux release 7.4.1708 (Core) ","architecture":"x86_64","version":"Kernel 3.10.0-693.21.1.el7.x86_64"},"mongos":\{"host":"vmt20130:31051","client":"10.130.9.150:60544","version":"4.4.2"}},"$configServerState":\{"opTime":{"ts":{"$timestamp":{"t":1607073306,"i":1}},"t":3}},"$db":"POCDB"},"planSummary":"COUNT_SCAN \{ fld3: 1 }","keysExamined":2695803,"docsExamined":0,"numYields":2695,"queryHash":"97EEEEB2","planCacheKey":"EC620B13","reslen":320,"locks":\{"ReplicationStateTransition":{"acquireCount":{"w":2696}},"Global":\{"acquireCount":{"r":2696}},"Database":\{"acquireCount":{"r":2696}},"Collection":\{"acquireCount":{"r":2696}},"Mutex":\{"acquireCount":{"r":1}}},"readConcern":\{"provenance":"implicitDefault"},"storage":\{"data":{"bytesRead":10114025,"timeReadingMicros":18241}},"protocol":"op_msg","durationMillis":1120}}