[SERVER-78227] Create index for config.cache.chunks.* collections on min/max fields Created: 20/Jun/23  Updated: 27/Oct/23  Resolved: 10/Jul/23

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 4.0.28, 4.2.24, 6.0.6, 4.4.22, 5.0.18, 7.0.0-rc4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Pierlauro Sciarelli Assignee: Jordi Serra Torrens
Resolution: Works as Designed Votes: 0
Labels: shardingemea-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Sharding EMEA
Operating System: ALL
Sprint: Sharding EMEA 2023-07-24
Participants:
Story Points: 2

 Description   

The updateShardChunks function is deleting outdated chunks and replacing it with the new document covering the same range.

Currently only an index on the lastmod field is created on config.cache.chunks.* collections.

Since the deletion relies on a range query on min/max, the absence of an index on such fields is resulting in a collection scan when having to find matching documents.

This is bad because when a collection has of a lot of chunks:

  • It is a resource-consuming task (always paging in/out metadata documents to/from the WT cache )
  • In case of shard version mismatch, secondaries are waiting for chunk entries to be persisted before being able to serve queries, hence they will be waiting for the COLLSCAN to complete


 Comments   
Comment by Jordi Serra Torrens [ 10/Jul/23 ]

Actually, that query is already supported by the {_id: 1} index because ChunkType::minShardID is _id. Therefore there's no bug.

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