Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cqlsh DESC SCHEMA generates malformed schemas #249

Open
AnuraDev opened this issue Apr 26, 2021 · 0 comments
Open

cqlsh DESC SCHEMA generates malformed schemas #249

AnuraDev opened this issue Apr 26, 2021 · 0 comments

Comments

@AnuraDev
Copy link

i have a small database with like 30 tables (and no data almost) i run cqlsh DESC SCHEMA it exports a schema file.
everything seems ok.
but after i try to restore this schema with cqlsh -f /exported_schema.cql for some tables (the one with extra indexes) i get this error

Error from server: code=2200 [Invalid query] message="Unknown column name detected in CREATE MATERIALIZED VIEW statement: idx_token"

the point of issues is, why the tool generates this code in first place? and this happens after everything is in scylla so has nothing to do with some legacy tables.

if everything is correct exported schemas (on the same server/version) shouldn't cause any warnings because they were filtered before serialization.

maybe this will help to understand the issue, my old cassandra table definition (but this table was reimported long ago so the schema now is different)

"CREATE TABLE IF NOT EXISTS passrecovery (" +
" h text, " + // hash
" u bigint," + // user
" PRIMARY KEY(h)" +
")"

"CREATE INDEX IF NOT EXISTS ON passrecovery (u);"

and here is what the tool exports

CREATE TABLE dr_1.passrecovery (
h text PRIMARY KEY,
u bigint
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99.0PERCENTILE';
CREATE INDEX passrecovery_u_idx ON dr_1.passrecovery (u);

CREATE MATERIALIZED VIEW dr_1.passrecovery_u_idx_index AS
SELECT u, idx_token, h
FROM dr_1.passrecovery
WHERE u IS NOT NULL
PRIMARY KEY (u, idx_token, h)
WITH CLUSTERING ORDER BY (idx_token ASC, h ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'ALL'}
AND comment = ''
AND compaction = {'class': 'SizeTieredCompactionStrategy'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.0
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99.0PERCENTILE';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant