[
https://issues.apache.org/jira/browse/CASSANDRA-4938?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17251689#comment-17251689
]
Benjamin Lerer commented on CASSANDRA-4938:
-------------------------------------------
[~kirktrue] The exception thrown is the result of CASSANDRA-8505 which
correspond to the choice number 3. that you originally proposed.
{quote}
1. No rows returned, i.e. leave existing behavior
2. Return rows as they become available in the index
3. Return error ('No indexed columns present') until index creation complete
4. Block until index creation complete as requested by OP. But who blocks? Just
the creating client, all clients? Block for reads, writes, or?
{quote}
Even if {{4.}} is implemented in the way suggested by [~jbellis] you will need
that safety net in case somebody queries the index from another client
application.
As explained by [~slebresne] implementing {{4.}} is not a simple thing to do
and I am not sure it is worth the effort.
[~maxwellguo] The index is effectively local but most of the clients (including
nodetool) connect to only a single node and by consequence do not have a full
view of the cluster. An index can be built on one node but not on another one.
Even if we succeed to check all the nodes that are alive, we would have to
check what happen if a node was down at the time where the {{CREATE INDEX}} was
fired and is restarted after the index of the others has been built. My guess
is that the node will accept queries before its index is build therefore
failing the query but I did not check.
> CREATE INDEX can block for creation now that schema changes may be concurrent
> -----------------------------------------------------------------------------
>
> Key: CASSANDRA-4938
> URL: https://issues.apache.org/jira/browse/CASSANDRA-4938
> Project: Cassandra
> Issue Type: Improvement
> Components: Feature/2i Index
> Reporter: Krzysztof Cieslinski Cognitum
> Assignee: Kirk True
> Priority: Low
> Labels: lhf
> Fix For: 4.x
>
>
> Response from CREATE INDEX command comes faster than the creation of
> secondary index. So below code:
> {code:xml}
> CREATE INDEX ON tab(name);
> SELECT * FROM tab WHERE name = 'Chris';
> {code}
> doesn't return any rows(of course, in column family "tab", there are some
> records with "name" value = 'Chris'..) and any errors ( i would expect
> something like ??"Bad Request: No indexed columns present in by-columns
> clause with Equal operator"??)
> Inputing some timeout between those two commands resolves the problem, so:
> {code:xml}
> CREATE INDEX ON tab(name);
> Sleep(timeout); // for column family with 2000 rows the timeout had to be set
> for ~1 second
> SELECT * FROM tab WHERE name = 'Chris';
> {code}
> will return all rows with values as specified.
> I'm using single node cluster.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]