[SERVER-74826] Errors CommandOnShardedViewNotSupportedOnMongod on sharded view Created: 14/Mar/23  Updated: 11/May/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: 6.0.2, 6.0.3, 6.0.4, 4.4.21
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: mocxat mocxat Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File repro.js    
Issue Links:
Related
related to SERVER-42282 Consider replacing CommandOnShardedVi... Backlog
Assigned Teams:
Query Optimization
Participants:

 Description   

Hello.
I see a errors CommandOnShardedViewNotSupportedOnMongod  in mongos.log:

{"t":{"$date":"2023-03-14T16:36:24.640+03:00"},"s":"I",  "c":"QUERY",    "id":4625501, "ctx":"conn26972","msg":"Unable to establish remote cursors","attr":{"error":{"code":169,"codeName":"CommandOnShardedViewNotSupportedOnMongod","errmsg":"Resolved views on sharded collections must be executed by mongos","resolvedView":{"ns":"testdb.test_col_3","pipeline":[{"$unionWith":{"coll":"test_col_1"}},{"$unionWith":{"coll":"test_col_2"}},{"$unionWith":{"coll":"test_col_3"}}],"collation":{"locale":"simple"}}},"nRemotes":0}}

when using .find() or .findOne() in a view that union sharded collections.

The data in the collections is accessible through the view, but what does this error mean? And what to do with it?

My configuration:

Sharded cluster in 3 shard (2 node + 1 arbiter in each) / debian 11(bullseye)

mongodb-database-tools 100.6.1
mongodb-mongosh 1.8.1
mongodb-org 6.0.4
mongodb-org-database 6.0.4
mongodb-org-database-tools-extra 6.0.4
mongodb-org-mongos 6.0.4
mongodb-org-server 6.0.4
mongodb-org-shell 6.0.4
mongodb-org-tools 6.0.4



 Comments   
Comment by Edwin Zhou [ 04/May/23 ]

Hi taxmailtest@gmail.com, thank you for your report, patience, and reproduction of this issue! I've been able to successfully reproduce this error code on a single node sharded cluster.

We do have improvements to handle this error on our backlog in SERVER-42282. However, I agree that it is unusual for the find command to return the "CommandOnShardedViewNotSupportedOnMongod" error when the command appears to work and is being run from a mongos.

I will pass this on to the query team to further investigate this issue.

Kind regards,
Edwin

Generated at Thu Feb 08 06:28:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.