How can I get more information when creating the index?

Hello,

I’m trying to create an index on a big collection. It’s been running for 1 hour and I don’t have any messages/details.

      numYields: 0,
      waitingForLatch: {
        timestamp: ISODate('2024-01-13T11:29:37.435Z'),
        captureName: 'AnonymousLockable'
      },
      locks: {},
      waitingForLock: false,
      lockStats: {
        ParallelBatchWriterMode: { acquireCount: { r: Long('5') } },
        FeatureCompatibilityVersion: { acquireCount: { r: Long('4'), w: Long('2') } },
        ReplicationStateTransition: { acquireCount: { w: Long('6') } },
        Global: { acquireCount: { r: Long('4'), w: Long('2') } },
        Database: { acquireCount: { r: Long('4'), w: Long('1') } },
        Collection: { acquireCount: { r: Long('4'), W: Long('1') } },
        Mutex: { acquireCount: { r: Long('5') } }
      },
      waitingForFlowControl: false,
      flowControlStats: { acquireCount: Long('2'), timeAcquiringMicros: Long('18') }

DB size: 3TiB and collection (with the future index) 3GB. Maybe I just have to wait but I’m confuse with the “waitingForLatch” information.

How can I have more information? Thanks.

Hi @Boow Welcome to the Community Forums.

In progress index builds can observed via db.currentOp() or $currentOp please see:

If you are building on a replicaSet or sharded cluster ensure that all members are online and healthy, a degraded cluster will prevent the completion of an Index build

1 Like

Hi @Boow,
As suggested from @chris, you can get information from current op or if you want to see the percentage of progress of index building, you can get the information from the log.

Regards

1 Like

Thank you for your answers!

@chris I already read this page and tried the following command :

db.adminCommand(
    {
      currentOp: true,
      $or: [
        { op: "command", "command.createIndexes": { $exists: true }  },
        { op: "none", "msg" : /^Index Build/ }
      ]
    }
)

But I don’t have more information…

If you are building on a replicaSet or sharded cluster ensure that all members are online and healthy, a degraded cluster will prevent the completion of an Index build

I have 4 nodes, all heath:1 but one of them is in STARTUP2 (because I had an outage a few days ago, so it is resyncing). The STARTUP2 node is hidden: true

I just want to know if the index will ever end (secs_running: Long(‘25785’))…

@Fabio_Ramohitaj I grep the log with “index” but nothing about my building index…

Hi @Boow
you should find a message like this:

{"t":{"$date":"2023-09-28T09:45:40.015+02:00"},"s":"I",  "c":"-",        "id":51773,   "ctx":"IndexBuildsCoordinatorMongod-2","msg":"progress meter","attr":{"name":"Index Build: scanning collection","done":1546800,"total":1984049,"percent":77}}

so try the grep in this way:

grep -i index fileName

Regards

I found results with grep “progress meter” :

{"t":{"$date":"2024-01-13T11:42:46.006+01:00"},"s":"I",  "c":"-",        "id":51773,   "ctx":"IndexBuildsCoordinatorMongod-3","msg":"progress meter","attr":{"name":"Index Build: scanning collection","done":864200,"total":1294528,"percent":66}}
{"t":{"$date":"2024-01-13T12:29:40.003+01:00"},"s":"I",  "c":"-",        "id":51773,   "ctx":"IndexBuildsCoordinatorMongod-4","msg":"progress meter","attr":{"name":"Index Build: scanning collection","done":337100,"total":1294528,"percent":26}}
{"t":{"$date":"2024-01-13T12:29:43.003+01:00"},"s":"I",  "c":"-",        "id":51773,   "ctx":"IndexBuildsCoordinatorMongod-4","msg":"progress meter","attr":{"name":"Index Build: scanning collection","done":794900,"total":1294528,"percent":61}}

@Fabio_Ramohitaj my index just finished! Thank you!

1 Like