Understanding sharding chunks further

Hello. I was trying to find jumbo chunks in our database and was purely depending on the output of the sh.status("true") command to find that. But unfortunately, setting the verbose flag to true doesn’t print all the chunks of a given collection, so couldn’t find a jumbo chunk

Then, later found a jumbo by querying the config.chunks collection as mentioned in this percona blog post. Now, the chunk doc doesn’t mention which collection this jumbo chunk belongs to nor how many documents are in this chunk nor its size. The key mentioned in the min/max is present in multiple collections of our database, so it is not possible to narrow down

how can I drill down further? Please let me know if you need more info

[direct: mongos] config> db.chunks.find({"jumbo":true} )
[
  {
    _id: ObjectId("63a5537d7c71b9f73c26d76a"),
    uuid: new UUID("b8d18a69-1f62-4370-98ee-9e2c349f8c2f"),
    min: {
      'value.id': Long("-3006967400825036684")
    },
    max: {
      'value.id': Long("-3006947767359106207")
    },
    shard: 'mongos-01-shard-02',
    lastmod: Timestamp({ t: 89, i: 1 }),
    jumbo: true,
    history: [
      {
        validAfter: Timestamp({ t: 1671689810, i: 6 }),
        shard: 'mongos-01-shard-02'
      }
    ]
  }
]

Please note that the schema of the config database is internal and may change between releases of MongoDB. Additionally, the config database is internal: applications and administrators should not modify or depend upon its content in the course of normal operation.

Depending on your version of MongoDB, the output from the config.chunks namespace could differ. Based off your output, you may be able to use the uuid value to search against the config.collections namespace to find the namespace associated with that chunk in the _id value.

Note: Links above are for MongoDB version 6.0, please change the version on the left hand side of the documentation page to your MongoDB version

Example below:

db.chunks.find()
[
  {
    _id: ObjectId("63b638f9274f40da76935449"),
    uuid: new UUID("ee586014-f716-428b-a4af-9d59362f8c04"),
    min: { userid: MinKey() },
    max: { userid: Long("-4611686018427387902") },
    shard: 'shard01',
    lastmod: Timestamp({ t: 1, i: 0 }),
    history: [
      {
        validAfter: Timestamp({ t: 1672886521, i: 3 }),
        shard: 'shard01'
      }
    ]
  }
]
db.collections.find({uuid: new UUID("ee586014-f716-428b-a4af-9d59362f8c04")})
[
  {
    _id: 'db.collection', /// <--- namespace
    lastmodEpoch: ObjectId("63b638f94a0188fa77f67902"),
    lastmod: ISODate("2023-01-05T02:42:01.525Z"),
    timestamp: Timestamp({ t: 1672886521, i: 3 }),
    uuid: new UUID("ee586014-f716-428b-a4af-9d59362f8c04"),
    key: { userid: 'hashed' },
    unique: false,
    noBalance: false
  }
]

I’ve not yet tested it myself but you can also perhaps consider using $lookup on the jumbo chunks query as well.

I am using MongoDB version 5.0.14 for the above example.

I understand you have tagged multiple MongoDB community users here for visibility. However, please note there is no SLA or guarantee of a timely response. If you are looking for commercial support options (which have support SLAs), consulting services, or private support please see Get Started with MongoDB Support or Contact our Sales team. MongoDB commercial support is staffed by a 24x7 team of engineers.

Regards,
Jason

2 Likes

thank you so much, @Jason_Tran . This collection has the necessary info

sorry about the tagging. I was only trying to get attention and I totally understand the community/forums are free service provided on a best-effort basis

thank you for the help again! much appreciated :slight_smile:

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.