In my experiments with the recent upgrade to 5.5 Beta, I’m seeing some odd behaviors related to creating partitioned indexes with node assignments.
My testing is using a 3 node cluster of Enterprise Edition 5.5.0 build 2473 using the Docker images and running on my local machine.
Regarding controlling nodes assignments and replicas
- If I use
{"num_replica": 1}
, everything works as intended. I get one main index and one replica, each using all nodes. - If I use
{"nodes": ["node1:8091", "node2:8091"]}
, everything works as intended. I get one index using the defined nodes. - If I use
{"nodes": ["node1:8091", "node2:8091"], "num_replica": 0}
, everything works as intended. I get one index using the defined nodes. - If I use
{"nodes": ["node1:8091", "node2:8091"], "num_replica": 1}
it works as I would expect, one main index and one replica, both spread across node1 and node2. - If I use
{"nodes": ["node1:8091", "node2:8091", "node3:8091"], "num_replica": 1}
, I would expect to get 2 replicas each using those three nodes. Instead I get an error on createFails to create index. Parameter num_replica should be one less than parameter nodes.
like I would with unpartitioned indexes.
Regarding replica builds
Additionally, when creating replicas, I’m seeing problems where the replica sometimes fails to build. I’ve done some experimentation and I believe I’ve narrowed down to the following case:
- Creating using a script so that steps proceed very quickly (in this case I was using the NodeJS SDK)
- Creating a partitioned index with
{"num_replica": 1, "defer_build": true}
- Immediately following this with a
BUILD INDEX
step to build the index
In this case, it seems to sporadically fail to build the replica. I’ve seen it with no build progress, or stick at an even percentage (i.e. 50%). I suspect it’s because the BUILD is being triggered before all nodes are up to date with replica and partition information.
In case it’s applicable, in my testing BUILD INDEX was being done using the NodeJS buildDeferredIndexes call:
http://docs.couchbase.com/sdk-api/couchbase-node-client-2.2.1/BucketManager.html#buildDeferredIndexes in the NodeJS SDK
Internally, this uses a SELECT from system:indexes to get the list of deferred indexes and builds that into a BUILD INDEX statement for a single bucket.
Thanks,
Brant