Skip to content

Commit 89e2e6f

Browse files
committed
RUBY-264 - Table erroneously reported as using compact storage
1 parent 63132d1 commit 89e2e6f

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Features:
1313

1414
Bug Fixes:
1515
* [RUBY-255](https://datastax-oss.atlassian.net/browse/RUBY-255) ControlConnection.peer_ip ignores peers that are missing critical information in system.peers.
16+
* [RUBY-264](https://datastax-oss.atlassian.net/browse/RUBY-255) Table erroneously reported as using compact storage.
1617

1718
# 3.0.3
1819

integration/metadata_test.rb

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ def setup
4545
@listener.wait_for_table('simplex', 'test2')
4646
@session.execute("CREATE TABLE simplex.audit (key timeuuid, keyspace_name text, table_name text, primary_key text, PRIMARY KEY(key))")
4747
@listener.wait_for_table('simplex', 'audit')
48+
@session.execute(<<EOF)
49+
CREATE TABLE rb264(inclusion_r_t text, inclusion_r_id text, inclusion_uaid timeuuid, own_t text, own_id text,
50+
PRIMARY KEY (inclusion_r_t, inclusion_r_id, inclusion_uaid, own_t, own_id)
51+
) WITH CLUSTERING ORDER BY (inclusion_r_id ASC, inclusion_uaid ASC, own_t ASC, own_id ASC)
52+
EOF
53+
@listener.wait_for_table('simplex', 'rb264')
4854
end
4955

5056
def teardown
@@ -69,7 +75,7 @@ def test_can_retrieve_keyspace_metadata
6975
assert_equal 1, ks_meta.replication.options['replication_factor'].to_i
7076
assert ks_meta.durable_writes?
7177
assert ks_meta.has_table?('users')
72-
assert_equal 7, ks_meta.tables.size
78+
assert_equal 8, ks_meta.tables.size
7379

7480
ks_cql = Regexp.new(/CREATE KEYSPACE simplex WITH replication = {'class': 'SimpleStrategy', \
7581
'replication_factor': '1'} AND durable_writes = true;/)
@@ -109,6 +115,23 @@ def test_can_retrieve_table_metadata
109115
end
110116
end
111117

118+
# Regression test for retrieving table metadata, RUBY-264
119+
#
120+
# test_ruby_264 tests that a table with a relatively large number of clustering columns is not erroneously
121+
# considered to use compact storage.
122+
#
123+
# @since 3.0.0
124+
# @jira_ticket RUBY-264
125+
# @expected_result table metadata should be retrieved.
126+
#
127+
# @test_category metadata
128+
#
129+
def test_ruby_264
130+
assert @cluster.keyspace('simplex').has_table?('rb264')
131+
table_meta = @cluster.keyspace('simplex').table('rb264')
132+
assert(!table_meta.options.compact_storage?)
133+
end
134+
112135
# Test for column ordering in table metadata
113136
#
114137
# test_column_ordering_is_deterministic tests that the metadata relating to the columns are retrieved in the proper

lib/cassandra/cluster/schema/fetchers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ def create_table(table_data, rows_columns, rows_indexes, rows_triggers)
632632
clustering_columns[ind] = column
633633
clustering_order[ind] = column.order
634634

635-
clustering_size = ind + 1 if clustering_size.zero? || ind == clustering_size
635+
clustering_size += 1
636636
else
637637
other_columns << column
638638
end

0 commit comments

Comments
 (0)