cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ZhaoYang (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-14100) proper value skipping when only pk columns are selected
Date Thu, 07 Dec 2017 02:12:00 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-14100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

ZhaoYang updated CASSANDRA-14100:
---------------------------------
    Description: 
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, there is 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}

  was:
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}


> 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, there is 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


Mime
View raw message