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

functions: Do not crash when schema is missing #18639

Closed

Conversation

xemul
Copy link
Contributor

@xemul xemul commented May 13, 2024

Getting token() function first tries to find a schema for underlying table and continues with nullptr if there's no one. Later, when creating token_fct, the schema is passed as is and referenced. If it's null crash happens.

It used to throw before 5983e9e (cql3: test_assignment: pass optional schema everywhere) on missing schema, but this commit changed the way schema is looked up, so nullptr is now possible.

fixes: #18637

Getting token() function first tries to find a schema for underlying
table and continues with nullptr if there's no one. Later, when creating
token_fct, the schema is passed as is and referenced. If it's null crash
happens.

It used to throw before 5983e9e (cql3: test_assignment: pass optional
schema everywhere) on missing schema, but this commit changed the way
schema is looked up, so nullptr is now possible.

fixes: scylladb#18637

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
@xemul xemul added the backport/5.4 Issues that should be backported to 5.4 branch once they'll be fixed label May 13, 2024
@scylladb-promoter
Copy link
Contributor

🔴 CI State: FAILURE

✅ - Build
✅ - Container Test
✅ - dtest with topology changes
❌ - dtest
✅ - Unit Tests

Failed Tests (1/30706):

Build Details:

  • Duration: 6 hr 12 min
  • Builder: i-09b60f9230bd004a4 (r5ad.8xlarge)

@xemul
Copy link
Contributor Author

xemul commented May 13, 2024

🔴 CI State: FAILURE

✅ - Build ✅ - Container Test ✅ - dtest with topology changes ❌ - dtest ✅ - Unit Tests

Failed Tests (1/30706):

* [test_increment_decrement_counters_in_threads_nodes_restarted](https://jenkins.scylladb.com//job/scylla-master/job/scylla-ci/8747/testReport/junit/update_cluster_layout_tests/TestUpdateClusterLayout/Tests___dtest___test_increment_decrement_counters_in_threads_nodes_restarted) [🔍](https://github.com/scylladb/scylladb/issues?q=is:issue+is:open+test_increment_decrement_counters_in_threads_nodes_restarted)

Build Details:

* Duration: 6 hr 12 min

* Builder: i-09b60f9230bd004a4 (r5ad.8xlarge)

https://github.com/scylladb/scylla-dtest/issues/3686

@scylladb-promoter
Copy link
Contributor

🟢 CI State: SUCCESS

✅ - Build
✅ - Container Test
✅ - dtest with topology changes
✅ - dtest
✅ - Unit Tests

Build Details:

  • Duration: 6 hr 0 min
  • Builder: i-0e60cce893cdaaaaf (m5ad.8xlarge)

@xemul
Copy link
Contributor Author

xemul commented May 15, 2024

@scylladb/scylla-maint , please merge

@@ -332,6 +332,9 @@ functions::get(data_dictionary::database db,
if (!receiver_cf.has_value()) {
throw exceptions::invalid_request_exception("functions::get for token doesn't have a known column family");
}
if (schema == nullptr) {
throw exceptions::invalid_request_exception(format("functions::get for token cannot find {} table", *receiver_cf));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mutation_fragments(tab) should have a pseudo-schema. Oh well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @denesb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has pseudo-schema, but it's temporary and not find-able via database/data_disctionary, thus this issue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could inject it into the schema registry for the duration of the query.
What query reproduces this problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denesb , #18759 has the test for that

@nyh
Copy link
Contributor

nyh commented May 15, 2024

This PR needed a regression test (a test that crashes before this patch, and passes afterwards). It's easy with the example in #18637.

@avikivity
Copy link
Member

This PR needed a regression test (a test that crashes before this patch, and passes afterwards). It's easy with the example in #18637.

@xemul please post in a follow-up

@kbr-scylla
Copy link
Contributor

@xemul please post in a follow-up

@avikivity I have an alternative proposal: let's avoid merging bugfixes without regression tests, especially if it's something that can be very easily amended, like when the original issue has a reproducer already attached to it, so regression test can be created with minimum effort?

@avikivity
Copy link
Member

Absolutely agree, but if the maintainer did not follow this rule, the next best thing is to ask for a follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/5.4 Issues that should be backported to 5.4 branch once they'll be fixed promoted-to-master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scylla crash when reading from mutation fragments with token() filtering
6 participants