Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-60988

empty chunk mongo 5.0

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Server Triage

      Dear mongo dev,

       

      With mongodb 5.0, if i have a shard collection with a key {"serial":1}, and a datetime TTL.

      i can get a chunk with serial 1, another chunk with serial 2. but one day i can have the chunk with serial 1 empty.

      How i can remove the unnecessary chunk, how can i know this chunk is empty ?

      with mongodb 5.0 scripts like :

      var ns = "ns.col";
      var key = db.getSiblingDB("config").collections.findOne({_id: ns}).key;
      db.getSiblingDB("config").chunks.find({ns : ns}).forEach(function(chunk) {
        var ds = db.getSiblingDB(chunk.ns.split(".")[0]).runCommand({datasize:chunk.ns, keyPattern:key, min:chunk.min, max:chunk.max, estimate:true});
        var size = ds.size/(1024*1024);
        printjson({chunk:chunk._id, datasize_MB: size});
      });
      

      doesn't work anymore because in config.chunk doesn't have NS now.

       

      Moreover i think mongodb should remove empty chunk automatically.

       

       

            Assignee:
            backlog-server-triage [HELP ONLY] Backlog - Triage Team
            Reporter:
            emmanuel.bial@forcewan-lelab.fr Manu Manu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: