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

schema: column_mapping::{static,regular}_column_at(): use on_internal_error() #17080

Merged

Conversation

denesb
Copy link
Contributor

@denesb denesb commented Jan 31, 2024

Instead of std::out_of_range(). Accessing a non-existing column is a serious bug and the backtrace coming with on_internal_error() can be very valuable when debugging it. As can be the coredump that is possible
to trigger with --abort-on-internal-error.

This change follows another similar change to schema::column_at().

This should help us get to the bottom of the mysterious repair failures caused by invalid column access, seen in #16821.

Refs: #16821

…_error()

Instead of std::out_of_range(). Accessing a non-existing column is a
serious bug and the backtrace coming with on_internal_error() can be
very valuable when debugging it. As can be the coredump that is possible
to trigger with --abort-on-internal-error.

This change follows another similar change to schema::column_at().
@denesb denesb force-pushed the column-mapping-at-internal-error branch from 5aa7f41 to ecf654e Compare January 31, 2024 10:13
@@ -94,15 +94,15 @@ const column_mapping_entry& column_mapping::column_at(column_kind kind, column_i

const column_mapping_entry& column_mapping::static_column_at(column_id id) const {
if (id >= _n_static) {
throw std::out_of_range(format("static column id {:d} >= {:d}", id, _n_static));
on_internal_error(dblog, format("static column id {:d} >= {:d}", id, _n_static));
Copy link
Contributor

Choose a reason for hiding this comment

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

Just yesterday I had a similar problem: I wanted to add a call to on_internal_error() inside a header file, and realized that I can't, because it requires a logger and you don't have one in a header file.

Instead of moving code out of the header file (which can have performance implications, which you probably didn't measure) just to please on_internal_error, I propose that we had a new utils::on_internal_error() function in Scylla (not in Seastar) which uses one specific logger (e.g., internal_error_logger) for all of internal errors. Then we can use this new on_internal_error in an existing header file.

(however, maybe there's reason to move this stuff out of the header file in any case - e.g., issue #1 - but if there is, please mention it. If you only moved it because of on_internal_error, I'm suggesting here an alternative that can be useful in the future in many places).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The similar schema::column_at() method is also in schema.cc, so I followed suit. I think there is no reason for this to be in a header file, it was probably just convenient to leave it there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, sounds good, but just tell me if I guessed correctly, and the reason why you had to move it in this patch was your sudden desire for symmetry with schema, but the on_internal_error() logger? :-)

Hopefully the new utils::on_internal_error() that I'm proposing will make people less reluctant to use on_internal_error() everywhere.

@scylladb-promoter
Copy link
Contributor

🟢 CI State: SUCCESS

✅ - Build
✅ - Container Test
✅ - dtest
✅ - Unit Tests

Build Details:

  • Duration: 3 hr 16 min
  • Builder: i-0c89bae693a2b48e6 (m5d.8xlarge)

@scylladb-promoter scylladb-promoter merged commit b2c02d8 into scylladb:master Jan 31, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

None yet

4 participants