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

Error when running examples/compare-tokens.rs and examples/custom_deserialization.rs #844

Closed
nsipplswezey opened this issue Oct 17, 2023 · 1 comment · Fixed by #846
Closed
Assignees

Comments

@nsipplswezey
Copy link
Contributor

When running the compare-tokens and custom_deserialization examples locally using the following:

SCYLLA_URI="127.0.0.1:9042" cargo run --example compare-tokens
SCYLLA_URI="127.0.0.1:9042" cargo run --example custom_deserialization

The scylla-rust-driver reports table-related errors such as:

scylla-rust-driver % cargo run --example custom_deserialization
    Finished dev [unoptimized + debuginfo] target(s) in 0.38s
     Running `target/debug/examples/custom_deserialization`
Connecting to 127.0.0.1:9042 ...
Error: Database returned an error: The query is syntactically correct but invalid, Error message: Unknown identifier pk
scylla-rust-driver % cargo run --example compare-tokens        
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `target/debug/examples/compare-tokens`
Connecting to 127.0.0.1:9042 ...
Error: Database returned an error: The query is syntactically correct but invalid, Error message: Exception while binding column pk: marshaling error: Validation failed for type org.apache.cassandra.db.marshal.Int32Type: got 8 bytes

After taking a look it seems that these tests use the same simple ks for keyspace and ks.t for table naming convention for keyspace and table creation.

"CREATE TABLE IF NOT EXISTS ks.t (pk bigint primary key)",
"INSERT INTO ks.t (pk) VALUES (?)"
"INSERT INTO ks.t (pk) VALUES (?)"
"SELECT token(pk) FROM ks.t where pk = {}"
"CREATE TABLE IF NOT EXISTS ks.t (pk int PRIMARY KEY, v text)"
"INSERT INTO ks.t (pk, v) VALUES (1, 'asdf')"

When running against a local Scylla cluster, ks.t persists between example runs causing examples to run inconsistently. These two examples would error in different ways depending on when they were run... and dropping ks.t as needed resolved the issue. This issue also persisted when running examples in my own CI environment on my own scylla-rust-driver fork.

@nsipplswezey
Copy link
Contributor Author

Proposed fix/improvement: #846

@Lorak-mmk Lorak-mmk self-assigned this Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants