Repository: cassandra Updated Branches: refs/heads/trunk 4937451f5 -> 88b51539f
Fix slice size calculation for 2ary index table slices Patch by Tyler Hobbs; reviewed by Benjamin Lerer for CASSANDRA-8550 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/90780b55 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/90780b55 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/90780b55 Branch: refs/heads/trunk Commit: 90780b550f39bc318567ac53f8e8e7d797697f16 Parents: e16d76d Author: Tyler Hobbs <ty...@datastax.com> Authored: Wed Jan 14 11:31:26 2015 -0600 Committer: Tyler Hobbs <ty...@datastax.com> Committed: Wed Jan 14 11:32:45 2015 -0600 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ .../db/index/composites/CompositesSearcher.java | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/90780b55/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 92bf422..45b2b9c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,6 @@ 2.0.12: + * Use more efficient slice size for querying internal secondary + index tables (CASSANDRA-8550) * Fix potentially returning deleted rows with range tombstone (CASSANDRA-8558) * Make sure we unmark compacting after scrub/cleanup etc (CASSANDRA-8548) * Check for available disk space before starting a compaction (CASSANDRA-8562) http://git-wip-us.apache.org/repos/asf/cassandra/blob/90780b55/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java b/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java index b978021..9370133 100644 --- a/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java +++ b/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java @@ -107,9 +107,8 @@ public class CompositesSearcher extends SecondaryIndexSearcher private int limit = filter.currentLimit(); private int columnsCount = 0; - private int meanColumns = Math.max(index.getIndexCfs().getMeanColumns(), 1); - // We shouldn't fetch only 1 row as this provides buggy paging in case the first row doesn't satisfy all clauses - private int rowsPerQuery = Math.max(Math.min(filter.maxRows(), filter.maxColumns() / meanColumns), 2); + // We have to fetch at least two rows to avoid breaking paging if the first row doesn't satisfy all clauses + private int indexCellsPerQuery = Math.max(2, Math.min(filter.maxColumns(), filter.maxRows())); public boolean needsFiltering() { @@ -144,9 +143,9 @@ public class CompositesSearcher extends SecondaryIndexSearcher if (indexColumns == null || indexColumns.isEmpty()) { - if (columnsRead < rowsPerQuery) + if (columnsRead < indexCellsPerQuery) { - logger.trace("Read only {} (< {}) last page through, must be done", columnsRead, rowsPerQuery); + logger.trace("Read only {} (< {}) last page through, must be done", columnsRead, indexCellsPerQuery); return makeReturn(currentKey, data); } @@ -159,7 +158,7 @@ public class CompositesSearcher extends SecondaryIndexSearcher lastSeenPrefix, endPrefix, false, - rowsPerQuery, + indexCellsPerQuery, filter.timestamp); ColumnFamily indexRow = index.getIndexCfs().getColumnFamily(indexFilter); if (indexRow == null || indexRow.getColumnCount() == 0)