Detail
When creating a secondary index through a client library, the following error may be returned:FAIL:201:NO INDEX
Answer
Here are the steps for the creation of secondary indices as initiated from a client library:
-
Client sends a create index command to a single node.
-
The receiving node asynchronously forwards the create index command to all other nodes in the cluster (through SMD) and does not wait for a response.
-
Each node puts the create index command on a queue to be processed.
-
The receiving node returns immediately.
-
The client isDone() polls all server nodes for index status.
The problem that can arise is that some nodes may not have started processing the create index command by the time the client polls for status, resulting in the above error.
Notes
The Java client has implemented the following 2 methods:waitTillComplete() and queryIfDone().queryIfDone() (called by waitTillComplete()) will not treat error conditions as done. If the timeout is defined, waitTillComplete() will timeout if nodes continue to return errors or incomplete status. At the time of the timeout, an exception will be thrown.