Changing index type from forestdb (Legacy GSI) to plasma (Standard GSI)

Hi,

I have upgraded a single node couchbase cluster from version 4.6.2 to 5.0.1 Enterprise Edition
But, in the settings, the indexer service is showing index type as ‘Legacy Global Secondary’.
Since it is old forestdb, all the queries are taking time even with proper indexes.

  • How can I change the index type to plasma with minimum efforts?
  • What option is there on the time of upgrade that decides which index technique to use from these two ?

Please let me know.

@krishan.jangid, could you please share the exact build number you use (like 5.0.1-xxxx) and the OS? It would also be great if you can share the output of http(s)://node-ip-or-hostname:9102/getIndexStatus. Thanks.

It’s 5.0.1-5003-enterprise.

Response of getIndexStatus:

   [
       {
                "defnId": 15896771814358534828,
                "name": "IX_ReservationGuestModeration2_Pending",
                "bucket": "reporting",
                "secExprs": [
                    "`embarkDate`",
                    "`shipCode`",
                    "`verificationStatus`",
                    "`lastPendingDocumentDate`"
                ],
                "where": "((`type` = \"ReservationGuestModeration\") and (`verificationStatus` = \"PENDING\"))",
                "indexType": "plasma",
                "status": "Ready",
                "definition": "CREATE INDEX `IX_ReservationGuestModeration2_Pending` ON `reporting`(`embarkDate`,`shipCode`,`verificationStatus`,`lastPendingDocumentDate`) WHERE ((`type` = \"ReservationGuestModeration\") and (`verificationStatus` = \"PENDING\"))",
                "hosts": [
                    "127.0.0.1:8091"
                ],
                "completion": 0,
                "progress": 0,
                "scheduled": false
            },
            {
                "defnId": 15771263179663315862,
                "name": "IX_ReservationGuestModeration3_Pending",
                "bucket": "reporting",
                "secExprs": [
                    "`embarkDate`",
                    "`debarkDate`",
                    "`shipCode`",
                    "`verificationStatus`",
                    "`lastPendingDocumentDate`"
                ],
                "where": "((`type` = \"ReservationGuestModeration\") and (`verificationStatus` = \"PENDING\"))",
                "indexType": "plasma",
                "status": "Ready",
                "definition": "CREATE INDEX `IX_ReservationGuestModeration3_Pending` ON `reporting`(`embarkDate`,`debarkDate`,`shipCode`,`verificationStatus`,`lastPendingDocumentDate`) WHERE ((`type` = \"ReservationGuestModeration\") and (`verificationStatus` = \"PENDING\"))",
                "hosts": [
                    "127.0.0.1:8091"
                ],
                "completion": 0,
                "progress": 0,
                "scheduled": false
            },
          {
                    "defnId": 17363102299637365442,
                    "name": "ix_primary_multimedia",
                    "bucket": "multimedia",
                    "isPrimary": true,
                    "indexType": "plasma",
                    "status": "Ready",
                    "definition": "CREATE PRIMARY INDEX `ix_primary_multimedia` ON `multimedia`",
                    "hosts": [
                        "127.0.0.1:8091"
                    ],
                    "completion": 100,
                    "progress": 100,
                    "scheduled": false
                },
                {
                    "defnId": 18398846114132495938,
                    "name": "ix_primary_reporting",
                    "bucket": "reporting",
                    "isPrimary": true,
                    "indexType": "plasma",
                    "status": "Ready",
                    "definition": "CREATE PRIMARY INDEX `ix_primary_reporting` ON `reporting`",
                    "hosts": [
                        "127.0.0.1:8091"
                    ],
                    "completion": 100,
                    "progress": 100,
                    "scheduled": false
                }...
        ]

It’s interesting here that the index type is showing ‘plasma’ and the indexes that I created after the upgrade have value 0 in progress and completion fields. While on the console screen, it is showing Legacy Global Secondary Index and empty build progress column for those indexes.

@krishan.jangid For offline upgrade, there is an additional step of rebalance an index node(in/out/swap). Only after the rebalance, storage format upgrade is complete. Now since your config is a single node, I would suggest you perform a dummy rebalance using the couchbase-cli, like :
/opt/couchbase/bin/couchbase-cli rebalance -c -u -p

Once this is completed successfully, you should no longer see ‘Legacy Global Secondary Index’ on the Settings page.

Let me know how it goes.

Can you please tell the solution for a two node cluster as well? (Both nodes having index, data and query services enabled).

The rebalance worked and the index setting is changed to Standard GSI, also, the indexes are built 100 percent. But, still queries are slow on it as compared to another server which already had plasma indexes with same data and indexes.
Do I have to drop and recreate the indexes that I created before the rebalance?

The solution is the same for multiple nodes as well. A rebalance is required. If you have a spare node, you can do a swap rebalance, or else, just use couchbase-cli to rebalance without adding or removing nodes, like above.

@mihir.kamdar, performance-wise, there’s no improvement even after the rebalance. Any suggestion?

@krishan.jangid, assuming that all indexes have been upgraded to plasma successfully, I recommend raising a support ticket for any performance or functional issues. Thats a better platform to get such things resolved.

Hi @mihir.kamdar, dummy rebalancing is not working on few other servers(single node clusters) I had same problem with. However, the server on which it worked had couchbase version: 5.0.1-5003-enterprise while the servers on which it is not working have couchbase version: 5.1.0-5552-enterprise.

The command I executed is:
/opt/couchbase/bin/couchbase-cli rebalance -c 127.0.0.1 -u Administrator -p ******

The response of this command is:
SUCCESS: Rebalance complete

But I can still see Legacy GSI on Index page. I have tried dropping all the indexes and recreating them as well. After server restart, it still shows the same.
Am I missing something here?

Hi Krishan, This looks like a defect. We have logged a defect to investigate further. https://issues.couchbase.com/browse/MB-28291

Thanks for logging the defect. Can you suggest any workaround for this problem?

I guess your indexes would already have been upgraded to Plasma storage mode. Can you pls share the output of http(s)://node-ip-or-hostname:9102/getIndexStatus ?

@mihir.kamdar, This call does show index type as ‘plasma’ just like earlier. But I’m not sure the queries will perform as expected. Earlier, with 5.0.1 version, I had to remove the couchbase server and then reinstall it. After doing so, the performance related issue went away.

Thanks @krishan.jangid. We are investigating the Performance issue that you had reported earlier.

Thanks for the update.