[SERVER-60641] Return better error message when trying to shard time series collection using hashed timefield Created: 13/Oct/21  Updated: 29/Oct/23  Resolved: 09/Jun/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Rushan Chen Assignee: Alice Li (Inactive)
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-60642 shard time series collection using ha... Closed
is duplicated by SERVER-60643 shard time series collection using ha... Closed
is duplicated by SERVER-60644 sharding time series on timeField sho... Closed
Assigned Teams:
Query Integration
Backwards Compatibility: Fully Compatible
Sprint: QI 2023-06-12
Participants:

 Description   

 

db.runCommand({ create: "tscoll", timeseries:{timeField: 'time', metaField: 'id' }})                                                           

db.adminCommand({ shardCollection: "test.tscoll", key:

{ time: "hashed" }

, numInitialChunks: 6 } )                                                                                                                                     **                                                                                                                                                                                                                                                                     returns               

{                                                                                                                                                       "ok" : 0,                                                                                                                                       "errmsg" : "Invalid index spec for time-series collection: \{ time: \"hashed\" }

. Indexes on the time field must be ascending or descen\

ding (numbers only): time: \"hashed\"",                                                                                                        

        "code" : 2,                                                                                                                            

        "codeName" : "BadValue",                                                                                                               

        "$clusterTime" : {                                                                                                                     

                "clusterTime" : Timestamp(1634110955, 1),                                                                                      

                "signature" :

{                                                                                                                                         "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),                                                                                             "keyId" : NumberLong(0)                                                                                                                 }

                                                                                                                             

        },                                                                                                                                     

        "operationTime" : Timestamp(1634110952, 1)                                                                                             

}

 

Rather the user should be asked to shard the collection using range if the shard key happens to be the timeField.



 Comments   
Comment by Githook User [ 08/Jun/23 ]

Author:

{'name': 'Alice Li', 'email': 'alice.li@mongodb.com', 'username': ''}

Message: SERVER-60641 Descriptive error message for sharded time series
Branch: master
https://github.com/mongodb/mongo/commit/52a84a78161b9c031c34653023e3fad6b82ff02a

Comment by Ana Meza [ 05/Sep/22 ]

Removing Sprint since this is assigned to QE backlog and neweng

Comment by Rushan Chen [ 06/Apr/22 ]

returning this to backlog for new eng to pick up.

Comment by Kyle Suarez [ 22/Oct/21 ]

The context of this is that the user would have to know that enabling sharding here implicitly creates an index on the time field.

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