You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "ZhaoYang (JIRA)" <ji...@apache.org> on 2017/12/07 02:10:00 UTC

[jira] [Created] (CASSANDRA-14100) proper value skipping when only pk columns are selected

ZhaoYang created CASSANDRA-14100:
------------------------------------

             Summary: proper value skipping when only pk columns are selected
                 Key: CASSANDRA-14100
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14100
             Project: Cassandra
          Issue Type: Bug
          Components: Local Write-Read Paths
            Reporter: ZhaoYang
            Priority: Minor
             Fix For: 4.x


In CASSANDRA-10657, value skipping is re-enabled to avoid reading unselected columns from disk to reduce heap pressure.

In 3.11, ColumnFilter.builder#addAll() will initialize {{queriedBuilder}} as {{empty}} even if the parameter is empty list.

In trunk, CASSANDRA-7396 made some changes on ColumnFilter.builder#addAll() that ColumnFilter-queried will no longer be {{empty}} when no regular column is selected, it's now {{null}} instead.

There is subtle difference between {{empty}} and {{null}} in ColumnFilter.

So {{ColumnFilter.fetchedColumnIsQueried}} will return true and  {{SerializationHeader.canSkipValue()}} will return {{false}} in trunk.

Probably we need to refactor ColumnFilter...

{code:title=reproduce}
// passed on 3.11, failed on trunk
createTable("CREATE TABLE %s (k1 int, v1 int, v2 int, PRIMARY KEY (k1))");
execute("INSERT INTO %s(k1,v1,v2) VALUES(1,1,1)  USING TIMESTAMP 5");
flush();

Prepared prepared = QueryProcessor.prepareInternal("SELECT k1 FROM " + keyspace() + "." + currentTable() + " WHERE k1=1");
CQLStatement cqlStatement = prepared.statement;
SelectStatement selectStatement = (SelectStatement) cqlStatement;
ColumnFilter columnFilter = selectStatement.queriedColumns();

// v1/v2 are fetched but not queried, so no need to read them from disk in Cell.Serializer#deserialize() by checking
// SerializationHeader.canSkipValue()
assertFalse(columnFilter.fetchedColumnIsQueried(ColumnMetadata.regularColumn(keyspace(), currentTable(), "v1", Int32Type.instance)));

assertFalse(columnFilter.fetchedColumnIsQueried(ColumnMetadata.regularColumn(keyspace(), currentTable(), "v2", Int32Type.instance)));
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org