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

Scylla crashes on SELECT by indexed part of the pkey with WHERE like "key = X AND key = Y" #7772

Closed
enaydanov opened this issue Dec 8, 2020 · 1 comment
Assignees
Milestone

Comments

@enaydanov
Copy link
Contributor

Installation details

Scylla version (or git commit hash): 4.3.rc2, 4.4.dev-0.20201207.0cd05dd0fdc with build-id f6b2d03ddf484e23702c303e8058015fc3e8fc55
Cluster size: 1
OS (RHEL/CentOS/Ubuntu/AWS AMI): CentOS

CREATE TABLE test ( id int, rand_id uuid, value text, PRIMARY KEY(rand_id, id) );
CREATE INDEX ON test(id);

... insert some data...

SELECT * FROM test WHERE id = 1 AND id = 2;

Scylla crashes on the last statement with assertion error:

TRACE 2020-12-08 06:17:19,903 [shard 1] query_processor - execute_direct: "SELECT * FROM paging_test WHERE id = 1 AND id = 2"                                                                                        
scylla: ./cql3/restrictions/single_column_restrictions.hh:111: virtual bytes_opt cql3::restrictions::single_column_restrictions::value_for(const column_definition &, const cql3::query_options &) const: Assertion `
Aborting on shard 1.                                                                                                                                                                                                 
Backtrace:                                                                                                                                                                                                           
  0x00000000038a62c4                                                                                                                                                                                                 
  0x00000000038b0779                                                                                                                                                                                                 
  0x00007fb5d6cac1df                                                                                                                                                                                                 
  /home/vagrant/.ccm/scylla-repository/unstable/master/2020-12-07T00%3A49%3A11Z/scylla/libreloc/libc.so.6+0x000000000003dbc4                                                                                         
  /home/vagrant/.ccm/scylla-repository/unstable/master/2020-12-07T00%3A49%3A11Z/scylla/libreloc/libc.so.6+0x00000000000268a3                                                                                         
  /home/vagrant/.ccm/scylla-repository/unstable/master/2020-12-07T00%3A49%3A11Z/scylla/libreloc/libc.so.6+0x0000000000026788                                                                                         
  /home/vagrant/.ccm/scylla-repository/unstable/master/2020-12-07T00%3A49%3A11Z/scylla/libreloc/libc.so.6+0x0000000000035fc5                                                                                         
  0x0000000001b306a8                                                                                                                                                                                                 
  0x0000000001b2fe9d                                                                                                                                                                                                 
  0x0000000001aed2fa                                                                                                                                                                                                 
  0x0000000001b443db                                                                                                                                                                                                 
  0x0000000001af3771                                                                                                                                                                                                 
  0x0000000001ae0b5a                                                                                                                                                                                                 
  0x0000000001b3f107                                                                                                                                                                                                 
  0x0000000001b3f14c                                                                                                                                                                                                 
  0x0000000001b07374                                                                                                                                                                                                 
  0x0000000003839bb5                                                                                                                                                                                                 
  0x00000000038914ef                                                                                                                                                                                                 
  0x00000000038926a7                                                                                                                                                                                                 
  0x00000000038b0c64                                                                                                                                                                                                 
  0x000000000385cdea                                                                                                                                                                                                 
  /home/vagrant/.ccm/scylla-repository/unstable/master/2020-12-07T00%3A49%3A11Z/scylla/libreloc/libpthread.so.0+0x00000000000093f8                                                                                   
  /home/vagrant/.ccm/scylla-repository/unstable/master/2020-12-07T00%3A49%3A11Z/scylla/libreloc/libc.so.6+0x0000000000101b02

Decoded:

void seastar::backtrace<seastar::backtrace_buffer::append_backtrace()::{lambda(seastar::frame)#1}>(seastar::backtrace_buffer::append_backtrace()::{lambda(seastar::frame)#1}&&) at ./build/release/seastar/./seastar/include/seastar/util/backtrace.hh:59
 (inlined by) ?? at ./build/release/seastar/./seastar/src/core/reactor.cc:732
 (inlined by) seastar::print_with_backtrace(seastar::backtrace_buffer&) at ./build/release/seastar/./seastar/src/core/reactor.cc:753
 (inlined by) seastar::print_with_backtrace(char const*) at ./build/release/seastar/./seastar/src/core/reactor.cc:760
@tzach tzach added this to the 4.3 milestone Dec 8, 2020
avikivity added a commit that referenced this issue Dec 17, 2020
… column' from Dejan Mircevski

There were two problems with handling conflicting equalities on the same PK column (eg, c=1 AND c=0):
1. When the column is indexed, Scylla crashed (#7772)
2. Computing ranges and slices was throwing an exception

This series fixes them both; it also happens to resolve some old TODOs from restriction_test.

Tests: unit (dev, debug)

Closes #7804

* github.com:scylladb/scylla:
  cql3: Fix value_for when restriction is impossible
  cql3: Fix range computation for p=1 AND p=1
denesb pushed a commit to denesb/scylla that referenced this issue Oct 20, 2021
Previously, single_column_restrictions::value_for() assumed that a
column's restriction specifies exactly one value for the column.  But
since 37ebe52, multiple equalities on the same column are allowed,
so the restriction could be a conjunction of conflicting
equalities (eg, c=1 AND c=0).  That violates an assert and crashes
Scylla.

This patch fixes value_for() by gracefully handling the
impossible-restriction case.

Fixes scylladb#7772

Signed-off-by: Dejan Mircevski <dejan@scylladb.com>

(cherry picked from commit 46b4b59)
Message-Id: <20210527205909.207481-3-dejan@scylladb.com>

Fixes scylladb#1741.
@avikivity
Copy link
Member

No vulnerable branches, not backporting.

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

5 participants