Commit Graph

18 Commits

Author SHA1 Message Date
Benny Halevy
3a4e4f9914 compaction: to_string: handle invalid values as internal error
Although the switch in `to_string(compaction_options::scrub::mode)`
covers all possible cases, gcc 10.3.1 warns about:
```
    sstables/compaction.cc: In function ‘std::string_view sstables::to_string(sstables::compaction_options::scrub::mode)’:
    sstables/compaction.cc:95:1: error: control reaches end of non-void function [-Werror=return-type]
```

Adding __builtin_unreachable(), as in `to_string(compaction_type)`
does calm the compiler down, but it might cause undefined behavior
in the future in case the switch won't cover all cases, or
the passed value is corrupt somehow.

Instead, call on_internal_error_noexcept to report the
error and abort if configure to do so, otherwise,
just return an "(invalid)" string.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20210727130251.2283068-1-bhalevy@scylladb.com>
2021-07-27 16:04:09 +03:00
Pavel Emelyanov
c39f04fa6f code: Remove storage-service header from irrelevant places
Some .cc files over the code include the storage service
for no real need. Drop the header and include (in some)
what's really needed.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-07-22 18:50:19 +03:00
Botond Dénes
a819f013f6 compaction/compaction: create_compaction_info(): take const compaction_descriptor&
Don't copy the descriptor.

Signed-off-by: Botond Dénes <bdenes@scylladb.com>
Message-Id: <20210721120219.326972-1-bdenes@scylladb.com>
2021-07-21 16:19:03 +03:00
Botond Dénes
7bfa40a2f1 treewide: use make_tracking_only_permit()
For all those reads that don't (won't or can't) pass through admission
currently.
2021-07-14 17:19:02 +03:00
Botond Dénes
2bbfb76cc5 compaction/leveled_compaction_strategy.cc: remove unused <ranges> include
Signed-off-by: Botond Dénes <bdenes@scylladb.com>
Message-Id: <20210713063506.419658-1-bdenes@scylladb.com>
2021-07-13 10:34:22 +03:00
Botond Dénes
47283ed151 sstables/compaction_manager: add perform_sstable_validation()
Exposing validation compaction on the compaction manager level.
To keep things simple, validation compaction uses the custom job
infrastructure.
2021-07-12 10:25:15 +03:00
Botond Dénes
4c05e5f966 sstables/compaction_manager: rewrite_sstables(): resolve maintenance group FIXME
Run this compaction in the maintenance group which is now available,
resolving the FIXME asking for this.
2021-07-12 10:25:15 +03:00
Botond Dénes
c8f8e9232c sstables/compaction_manager: add maintenance scheduling group
rewrite_sstables() wants to be run in the maintenance group and soon we
will add another compaction type which also wants to be run in the
said group. To enable this propagate the maintenance scheduling group
(both CPU and IO) to the compaction manager.
2021-07-12 10:25:15 +03:00
Botond Dénes
12b8b650b7 sstables/compaction_manager: drop _scheduling_group field
Use the equivalent _compaction_controller.sg() instead.
2021-07-12 10:25:15 +03:00
Botond Dénes
75bad71f0e sstables/compaction_manager: run_custom_job(): replace parameter name with compaction type
All callers use it to do operations that are closely associated with one
of the standard compaction types, so no reason to pass in a custom
string instead of the compaction type enum.
2021-07-12 10:25:15 +03:00
Botond Dénes
ddf2700b2e sstables/compaction_manager: run_custom_job(): keep job function alive
For the duration of the job, allowing coroutine lambdas to be used as
well.
2021-07-12 10:25:15 +03:00
Botond Dénes
891921377d sstables/compaction_descriptor: compaction_options: add validation compaction type
This enables starting validation compaction via `compact_sstables()`.
2021-07-12 10:25:15 +03:00
Botond Dénes
349a3ed4e8 sstables/compaction: compaction_options::type(): add static assert for size of index_to_type
To remind those adding a member to the variant, to also add the
corresponding entry here.
2021-07-12 10:25:15 +03:00
Botond Dénes
a57caf5229 sstables/compaction: implement validation compaction type
Validation just reads all the passed-in sstables and runs the mutation
stream through a mutation fragment stream validator, logging all errors
found, and finally also logging whether all the sstables are valid or
not. Validation is not really a compaction as it doesn't write any
output. As such it bypasses most of the usual compaction machinery, so
the latter doesn't have to be adapted to this outlier.
This patch only adds the implementation, but it still cannot be started
via `compact_sstables()`, that will be implemented by the next patches.
2021-07-12 10:25:15 +03:00
Botond Dénes
cae8624edb sstables/compaction: extract compaction info creation into static method
To make this snippet reusable by the soon-to-be-added validation
compaction as well.
2021-07-12 07:53:11 +03:00
Botond Dénes
3b5ae0b894 sstables/compaction: extract sstable list formatting to a class
To make it reusable both inside compaction class itself (between
compaction start and end messages) and for outside code as well.
2021-07-12 07:11:29 +03:00
Botond Dénes
35f49a5baa sstables/compaction: scrub_compaction: extract reporting code into static methods
All the error messages reporting about invalid bits found in the stream.
This allows reusing these messages in the soon-to-be-added validation
compaction. In the process, the error messages are made more
comprehensive and more uniform as well.
2021-07-12 07:11:29 +03:00
Raphael S. Carvalho
1924e8d2b6 treewide: Move compaction code into a new top-level compaction dir
Since compaction is layered on top of sstables, let's move all compaction code
into a new top-level directory.
This change will give me extra motivation to remove all layer violations, like
sstable calling compaction-specific code, and compaction entanglement with
other components like table and storage service.

Next steps:
- remove all layer violations
- move compaction code in sstables namespace into a new one for compaction.
- move compaction unit tests into its own file

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
Message-Id: <20210707194058.87060-1-raphaelsc@scylladb.com>
2021-07-07 23:21:51 +03:00