[SERVER-61039] Sharded time-series listIndexes should report the view's namespace Created: 27/Oct/21  Updated: 29/Oct/23  Resolved: 12/Nov/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.2.0, 5.0.5, 5.1.1

Type: Bug Priority: Major - P3
Reporter: David Percy Assignee: Arun Banala
Resolution: Fixed Votes: 0
Labels: read-only-views
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Duplicate
is duplicated by SERVER-61041 Sharded time-series listIndexes shoul... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.1, v5.0
Sprint: QE 2021-11-01, QE 2021-11-15, QE 2021-11-29
Participants:

 Description   

If I run the listIndexes command on a time-series view, normally it returns the name of the view as "ns":

> db.runCommand({listIndexes: 'example'})
{
        "id" : NumberLong(0),
        "ns" : "test.example",
        "firstBatch" : [
                ...
        ]
}

But if it's a sharded time-series view, instead it replies with the name of the buckets collection:

> db.runCommand({listIndexes: 'example'})
{
        "id" : NumberLong(0),
        "ns" : "test.system.buckets.example",
        "firstBatch" : [
                ...
        ]
}

I think it should return the name of the view in both cases, since the buckets collection is an implementation detail.

Sounds like this happens because mongos translates a listIndexes request on the view, to listIndexes on the buckets collection. So it needs to also translate the response.



 Comments   
Comment by Githook User [ 18/Nov/21 ]

Author:

{'name': 'Arun Banala', 'email': 'arun.banala@mongodb.com', 'username': 'banarun'}

Message: SERVER-61039 Make sharded time-series listIndexes report the view's namespace

(cherry picked from commit e2089fc73a76db6bcf2ca2729e7e886258d3ad2f)
(cherry picked from commit c80ff81b19a3c5d28892c02f380e8c12ad0a0253)
Branch: v5.0
https://github.com/mongodb/mongo/commit/24b97fd8f5ed708e6d0ed0d5999fe547b95b2206

Comment by Githook User [ 17/Nov/21 ]

Author:

{'name': 'Arun Banala', 'email': 'arun.banala@mongodb.com', 'username': 'banarun'}

Message: SERVER-61039 Make sharded time-series listIndexes report the view's namespace

(cherry picked from commit e2089fc73a76db6bcf2ca2729e7e886258d3ad2f)
Branch: v5.1
https://github.com/mongodb/mongo/commit/eb30abacf9a89a141feb07971777fec892265f41

Comment by Githook User [ 12/Nov/21 ]

Author:

{'name': 'Arun Banala', 'email': 'arun.banala@mongodb.com', 'username': 'banarun'}

Message: SERVER-61039 Make sharded time-series listIndexes report the view's namespace
Branch: master
https://github.com/mongodb/mongo/commit/96c864de616fb9e482fb6708a8f7da432042b8ec

Comment by Kyle Suarez [ 12/Nov/21 ]

arun.banala, is this actually resolved? I don't see a Git hook user comment with the commit landing on master.

Comment by David Percy [ 27/Oct/21 ]

This is one of the ways time-series views are different from other views, to make them behave more like a collection. We support createIndexes / listIndexes / dropIndexes on the view, so that you don't have to interact with the buckets collection directly. Internally, we translate each index key to something that makes sense for the bucket format.

Comment by Kyle Suarez [ 27/Oct/21 ]

I was surprised this is allowed at all, since normally you cannot run the listIndexes command on a view:

> db.createView("view", "coll", [])
{ "ok" : 1 }
> db.runCommand({listIndexes: "view"})
{
        "ok" : 0,
        "errmsg" : "Namespace test.view is a view, not a collection",
        "code" : 166,
        "codeName" : "CommandNotSupportedOnView"
}

Generated at Thu Feb 08 05:51:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.