-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Environment:OS:
node.js / npm versions:
Additional info:
-
Developer Tools
-
2
-
Iteration Big Dipper, Iteration Fortitudo
Problem Statement/Rationale
allowPartialResults() is not working as expected.
Sharing an example run where this was spotted:
A user has sharded on site and sensor ID:
sh.shardCollection( '$DB.$COLL', {'metadata.site':1, 'metadata.sensorID': 1} );
{{}}
They are querying: db.sensorData.find( {"metadata.site": "site1"} ).allowPartialResults() but getting the error: "encountered non-retryable error during query: caused by: Could not find host matching read preference (mode: "primary") for set shard01".
{{}}
One of their zones is down. So, the cluster is only partially available.
{{}}
var data = sh.addTagRange( '$DB.$COLL',
{ 'metadata.site': 'site1', 'metadata.sensorID': MinKey },
{ 'metadata.site': 'site1', 'metadata.sensorID': MaxKey },
'US' );
data = sh.addTagRange( '$DB.$COLL',
{ 'metadata.site': 'site2', 'metadata.sensorID': MinKey },
{ 'metadata.site': 'site2', 'metadata.sensorID': MaxKey },
'WORLD' );
{{}}
this is the distribution in their cluster. WORLD is down.
{{}}
In the run, we don't see allowPartialResults:true in find command options.
{"t":\{"$date":"2023-08-23T18:26:14.403+00:00"},"s":"I", "c":"COMMAND", "id":51803, "ctx":"conn468","msg":"Slow query","attr":{"type":"command","ns":"zoneDB2.sensorData","appName":"mongosh 1.10.1","command":{"find":"sensorData","filter":{},"lsid":{"id":{"$uuid":"3286f1ad-0c0a-4624-a411-709769349561"}},"$clusterTime":{"clusterTime":{"$timestamp":{"t":1692814918,"i":1}},"signature":{"hash":{"$binary":{"base64":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","subType":"0"}},"keyId":0}},"$db":"zoneDB2"},"numYields":0,"queryHash":"17830885","ok":0,"errMsg":"Encountered non-retryable error during query :: caused by :: Could not find host matching read preference { mode: \"primary\" } for set myShard_1","errName":"FailedToSatisfyReadPreference","errCode":133,"reslen":373,"readConcern":{"level":"local","provenance":"implicitDefault"},"remote":"172.18.0.1:59882","protocol":"op_msg","remoteOpWaitMillis":14999,"durationMillis":15001}}
{{}}
When the same is built in mongo shell, we see that allowPartialResults:true is propagated in the find command options.
It is possible that this is a nodejs driver bug. So, please create a relevant drivers ticket if that's the case.
Please be sure to attach relevant logs with any sensitive data redacted.
How to retrieve logs for: Compass; Shell
Logs here - https://drive.google.com/drive/folders/1qfqVcEgrKQWMlgmJ-5Yo3b1FSf3AzMYL
Steps to Reproduce
How could an engineer replicate the issue you’re reporting?
Expected Results
What do you expect to happen?
Actual Results
What do you observe is happening?
Additional Notes
Any additional information that may be useful to include.