Commit Graph

28601 Commits

Author SHA1 Message Date
Benny Halevy
a1098c0094 replication strategies: calculate_natural_endpoints: split into sync and async variants
calculate_natural_endpoints_sync and _async are both provided
temporarily until all users of them are converted to use
the async version which will remain.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2021-10-13 12:39:36 +03:00
Benny Halevy
32c7314b80 network_topology_strategy: refactor calculate_natural_endpoints
Extract natural_endpoints_tracker out of calculate_natural_endpoints
so we easily split the function to sync and async variants.

Test: network_topology_strategy_test(dev, debug)

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2021-10-13 12:39:36 +03:00
Benny Halevy
416531cce7 network_topology_strategy: use rslogger to debug-log configuration
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2021-10-13 12:39:36 +03:00
Benny Halevy
330d9772d4 abstract_replication_strategy: move logger to locator namespace
To be used by network_topology_strategy and later, by
effective_replication_map_registry.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2021-10-13 12:39:36 +03:00
Benny Halevy
7401d03e8c abstract_replication_strategy: define replication_map
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2021-10-13 12:39:36 +03:00
Benny Halevy
5001d261d4 abstract_replication_strategy: define replication_strategy_config_options
To be used for searching effective replication strategy instances.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2021-10-13 12:39:36 +03:00
Pavel Solodovnikov
8b917f7c99 db: mark --experimental option deprecated
The documentation for --experimental config option states
that it enables all experimental features, but this is no
longer true, i.e.: raft feature is not enabled with it and
should be explicitly enabled via `--experimental-features=raft`
switch (we don't want to enable it by default alongside
other features).

Since the flag doesn't do what it's intended to, we should
mark it as "deprecated", because documenting each exception
(there could be more than only raft in the future) will be
a burden and docs will constantly go out-of-sync with the
code.

Adjust the description for the option to reflect that, mark
it "deprecated" and suggest using --experimental-features, instead.

Fixes: #9467

Signed-off-by: Pavel Solodovnikov <pa.solodovnikov@scylladb.com>
Message-Id: <20211012093005.20871-2-pa.solodovnikov@scylladb.com>
2021-10-12 13:22:12 +03:00
Pavel Solodovnikov
162f1899e8 db: update the list of supported experimental features
`raft` and `alternator-streams` features were missing
from the description for `experimental-features` config
flag.

Update `scylla.yaml` template comments to reflect that, too.

Signed-off-by: Pavel Solodovnikov <pa.solodovnikov@scylladb.com>
Message-Id: <20211012093005.20871-1-pa.solodovnikov@scylladb.com>
2021-10-12 13:22:11 +03:00
Avi Kivity
0d48c39cb3 Merge 'tools/scylla-sstable: allow opening sstables from any path' from Botond Dénes
Currently it is required that sstables (in particular la/mx ones) are located at a valid path. This is required because `sstables::entry_descriptor::make_descriptor()` extracts the keyspace and table names from the sstable dir components. This PR relaxes this by using a newly introduced  `sstables::entry_descriptor::make_descriptor()` overload which allows the caller to specify keyspace and table names, not necessitating these to be extracted from the path.

Tests: unit(dev), manual(testing that `scylla-sstables` can indeed load sstables from invalid path)

Closes #9466

* github.com:scylladb/scylla:
  tools/scylla-sstable: allow loading sstables from any path
  sstables: entry_descriptor::make_descriptor(): add overload with provided ks/cf
2021-10-12 12:50:11 +03:00
Takuya ASADA
06c28585f9 dist: raise fs.file-max and fs.nr_open to enough size for scylla
Currently, we configure LimitNOFILE on scylla-server.service, but we
don't configure fs.nr_open and fs.file-max.
When fs.nr_open or fs.file-max are smaller than LimitNOFILE, we may fail
to allocate FDs.
To fix this issue, raise fs.file-max and fs.nr_open to enogh size for
scylla.

Fixes #9461

Closes #9461
2021-10-12 12:47:35 +03:00
Botond Dénes
cc65c9d0da compaction: scrub/segregate: adjust partition-estimate as buckets accumulate
Scrub compaction in segregate mode can split the input sstable into as
many as hundreds or even thousands of output sstables in the extreme
case. But even at a few dozen output sstables, most of these will only
have a few partitions with a few rows. These sstables however will still
have their bloom filter allocated according to the original
partition-count estimate, causing memory bloat or even OOM in the
extreme case.
This patch solves this by aggressively adjusting the partition count
downwards after the second bucket has been created. Each subsequent
bucket will halve the partition estimate, which will quickly reach 1.

Fixes: #9463

Closes #9464
2021-10-12 12:44:42 +03:00
Botond Dénes
d535346a6e tools/scylla-sstable: allow loading sstables from any path
Currently it is required that sstables (in particular la/mx ones) are
located at a valid path. This is required because
`sstables::entry_descriptor::make_descriptor()` extracts the keyspace
and table names from the sstable dir components.
This patch relaxes this by using the freshly introduced
`sstables::entry_descriptor::make_descriptor()` overload which allows
the caller to specify keyspace and table names.
2021-10-12 11:47:58 +03:00
Botond Dénes
1b7b3a81e6 sstables: entry_descriptor::make_descriptor(): add overload with provided ks/cf
Not necessitating these to be extracted from the sstable dir path. This
practically allows for la/mx sstables at non-standard paths to be
opened. This will be used by the `scylla-sstable` tool which wants to be
flexible about where the sstables it opens are located.
2021-10-12 11:43:23 +03:00
Nadav Har'El
e4bc97349c cql-pytest: XFAILing test was fixed by a Python driver fix
Issue #8203 describes a bug in a long scan which returns a lot of empty
pages (e.g., because most of the results are filtered out). We have two
cql-pytest test cases that reproduced this bug - one for a whole-table
scan and one for a single-partition scan.

It turned out that the bug was not in the Scylla server, but actually in
the Python driver which incorrectly stopped the iteration after an empty
page even though this page did contain the "more pages" flag.

This driver bug was already fixed in the Datastax driver (see
6ed53d9f70,
and in the Scylla fork of the driver:
1d9077d3f4

So in this patch we drop the XFAIL, and if the driver is not new enough
to contain this fix - the test is skipped.

Since our Jenkins machines have the latest Scylla fork of the driver and
it already contains this fix, these tests will not be skipped - and will
run and should pass. Developers who run these tests on their development
machine will see these tests either passing or skipped - depending on
which version of the driver they have installed.

Closes #8203

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20211011113848.698935-1-nyh@scylladb.com>
2021-10-12 10:04:02 +02:00
Nadav Har'El
33f8ec09df Merge 'treewide: improve compatibility with gcc 11' from Avi Kivity
Our source base drifted away from gcc compatibility; this mostly
restores the ability to build with gcc. An important exception is
coroutines that have an initializer list [1]; this still doesn't work.

We aim to switch back to gcc 11 if/when this gives us better
C++ compatibility and performance.

Test: unit (dev)

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98056

Closes #9459

* github.com:scylladb/scylla:
  test: radix_tree_printer: avoid template specialization in class context
  test: raft: avoid ignored variable errors
  test: reader_concurrency_semaphore_test: isolate from namespace of source_location
  test: cql_query_test: drop unused lambda assert_replication_not_contains
  test: commitlog_test: don't use deprecated seastar::unaligned_cast
  test: adjust signed/unsigned comparisons in loops and boost tests
  build: silence some gcc 11 warnings
  sstables: processing_result_generator: make coroutine support palatable for C++20 compilers
  managed_bytes: avoid compile-time loop in converting constructor
  service: service_level_controller: drop unused variable sl_compare
  raft: disambiguate promise name in raft::active_read
  locator: azure_snitch: use full type name in definition of globals
  cql3: statements: create_service_level_statement: don't ignore replace_defaults()
  cql3: statement_restrictions: adjust call to std::vector deduction guide
  types: remove recursive constraint in deserialize_value
  cql3: restrictions: relax constraint on visitor_with_binary_operator_content
  treewide: handle switch statements that return
  cql3: expr: correct type of captured map value_type
  cdc: adjust type of streams_count
  alternator: disambiguate attrs_to_get in table_requests
2021-10-11 16:54:01 +03:00
Nadav Har'El
5e4c60e19a Merge: Unload storage service from irrelevant APIs
Meged patch series from Pavel Emelyanov:

There's a long-term (well, likely mid-term already) goal to keep a
single role for the storage_service, namely -- managing the state of
a node in the ring. Then rename it once it happens to stop people
from loading new stuff into storage_service. There are at least three
REST API endpoints that stand on the way.

1. load_new_ss_tables. This part is moved to a new sharded sstables
   loader that wraps existing distributed_loader

2. view_build_statuses. Satuses are maintained by view_builder so must
   be retrieved from the same place

3. enable_|disable_auto_compaction. This is purely database knob that
   used to be such some time ago

This change also removes view_update_generator from storage_service list
of dependencies and leaves the system_distributed_keyspace be the
start-only one (another not yet published branch makes use of it and
removes s.d.ks from storage service at all).

branch: https://github.com/xemul/scylla/tree/br-unload-storage-service-api-3
tests: unit(dev)
refs: #5489

* 'br-unload-storage-service-api-3' of github.com:xemul/scylla:
  storage_service, api: Move set-tables-autocompaction back into API
  api: Fix indentation after previous patch
  api, database, storage_service: Unify auto-compaction toggle
  api: Remove storage service from new APIs
  view_builder: Accept view_build_statuses
  storage_service: Move view_build_statuses code
  api, storage_service: Keep view builder API handlers separate
  storage_service: Remove view update generator from
  sstables_loader: Accept the sstables loading code
  storage_service: Move the sstables loading code
  storage_service, api: Keep sstables loading API handlers separate
  sstables_loader: Introduce
  distributed_loader, utils: Move verify_owner_and_mode
  distributed_loader: Fix methods visibility
2021-10-11 15:22:06 +03:00
Kamil Braun
339b9bc38a sstables: mx: partition_reversing_data_source: close internal data consumers
`partition_reversing_data_source` uses `continuous_data_consumer`s
internally (`partition_header_context`, `row_body_skipping_context`)
which hold `input_stream`s opened to sstable data files. These
`input_stream`s must be closed before destruction. Right now they would
sometimes cause "Assertion `_reads_in_progress == 0' failed" on
destruction.

Close the `continuous_data_consumer`s before they are destroyed so they
can close their `input_stream`s.

Fixes #9444.

Closes #9451
2021-10-11 12:35:54 +02:00
Pavel Emelyanov
f0b5ab1c61 storage_service, api: Move set-tables-autocompaction back into API
The global autocompaction toggle is no longer tied to the storage
service. It naturally belongs to the database, but is small and
tidy enough not to pollute database methods and can be placed into
the api/ dir itself.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:13:59 +03:00
Pavel Emelyanov
fece1a2f9f api: Fix indentation after previous patch
Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:13:56 +03:00
Pavel Emelyanov
c5128eea67 api, database, storage_service: Unify auto-compaction toggle
There are two knobs here -- global and per-table one. Both were added
without any synchronisation, but the former one was later fixed to
become serialized and not to be available "too early".

This patch unifies both toggles to be serialized with each-other and
not be enabled too early.

The justification for this change is to move the global toggle from out
of the storage service, as it really belongs to the database, not the
storage service. Respectively, the current synchronization, that depends
on storage service internals, should be replaced with something else.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:12:39 +03:00
Pavel Emelyanov
c53c74258a api: Remove storage service from new APIs
The APIs that had been recently switched to using relevant services no
longer need the storage service reference capture, so remove it.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:11:52 +03:00
Pavel Emelyanov
c504361c15 view_builder: Accept view_build_statuses
The code itself is already in relevant .cc file, not move it to the
relevant class.

The only significant change is where to get token metadata from.
In its old location tokens were provided by the storage service
itself, now when it's in the view builder there's no "native" place
to get them from, however the rest of the view building code gets
tokens from global storage proxy, so do the same here.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:11:40 +03:00
Pavel Emelyanov
3b6e8c7d93 storage_service: Move view_build_statuses code
This code belongs to view builder, so put it into its .cc. No changes,
just move. This needs some ugly namespace breakage, but they will
be patched away with the next patch.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:11:29 +03:00
Pavel Emelyanov
540c6fa5ae api, storage_service: Keep view builder API handlers separate
There's the 'storage_service/view_build_statuses' endpoint. It's
handler code sits in the storage_service, but the functionality
belongs purely to view_builder. Same as with sstables loader,
detach the enpoint's API set/unset code, next patches will fix
the handler to use view_builder.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:09:07 +03:00
Pavel Emelyanov
99d8994835 storage_service: Remove view update generator from
It's not used by storage service any longer.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:09:02 +03:00
Pavel Emelyanov
68ecec0197 sstables_loader: Accept the sstables loading code
The code was moved in the relevant .cc file by previous patch, now
make it sit in the relevant class. One "significant" change is that
the messaging service is available by local reference already, not
by the sharded one. Other dependencies are already satisfied by the
patch that introduced the sstables_loader class.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:08:21 +03:00
Pavel Emelyanov
42f83f6669 storage_service: Move the sstables loading code
Just cut-n-paste the code into sstables_loader.cc. No other
changes but replace storage service logger with its own one.
For now the code stays in storage_service class, but next
patch will relocate the code into the sstables_loader one.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:07:39 +03:00
Pavel Emelyanov
7e49359720 storage_service, api: Keep sstables loading API handlers separate
Right now the handlers sit in one boat with the rest of the storage
service APIs. Next patches will switch this particular endpoint to
use previously introduced sstables_loader, before doing so here's
the respective API set/unset stubs.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:05:45 +03:00
Pavel Emelyanov
13ab22d3c7 sstables_loader: Introduce
It's a sharded service that will be responsible for loading
sstables via the respective REST API (the endpoint in question
is in turn handling the nodetool refresh command). This patch
adds the loader, equips with the needed dependencies and
starts/stops one from main. Next patches will move the loader
code from storage_service into this new one. The list of
dependencies that are introduced in this patch is exactly
what's needed by the mentioned code move.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:03:54 +03:00
Pavel Emelyanov
581382edad distributed_loader, utils: Move verify_owner_and_mode
This method sits in dist.loader, but really belongs to util/ as it
just works on an "abstract" path and doesn't need to know what this
path is about. Another sign of layering violation is the inclusion
of dist.loader code into util/ stuf.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:03:51 +03:00
Pavel Emelyanov
e106e0571a distributed_loader: Fix methods visibility
Most of the methods are marked public, but only few of them should.
Test needs a bit more, however, so the distributed_loader_for_tests
is declared as friend class.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2021-10-11 11:03:29 +03:00
Avi Kivity
ef45a208ef test: radix_tree_printer: avoid template specialization in class context
gcc complains that it's illegal. It's unnecessary too - we can replace
it with a simple overload.
2021-10-10 18:17:53 +03:00
Avi Kivity
11cc772388 test: raft: avoid ignored variable errors
Avoid instantiating unused variables, and in one case ignore it,
to avoid a gcc warning.
2021-10-10 18:17:53 +03:00
Avi Kivity
cdb50b1972 test: reader_concurrency_semaphore_test: isolate from namespace of source_location
More modern gcc uses std::source_location instead of
std::experimental::source_location. Rely on seastar::compat to get it
right for us.
2021-10-10 18:17:53 +03:00
Avi Kivity
a08bcc0528 test: cql_query_test: drop unused lambda assert_replication_not_contains
gcc complains that it exists.
2021-10-10 18:17:53 +03:00
Avi Kivity
9166d1ab1d test: commitlog_test: don't use deprecated seastar::unaligned_cast
unaligned_cast is deprecated, and gcc complains that it violates
strict aliasing rules. Switch to std::copy_n() instead.
2021-10-10 18:17:53 +03:00
Avi Kivity
9907303bf5 test: adjust signed/unsigned comparisons in loops and boost tests
gcc complains about comparing a signed loop induction variable
with an unsigned limit, or comparing an expected value and measured
value. Fix by using unsigned throughout, except in one case where
the signed value was needed for the data_value constructor.
2021-10-10 18:16:50 +03:00
Avi Kivity
15ffd84473 build: silence some gcc 11 warnings
These warnings are valuable, but limit the noise for now by disabling
them.
2021-10-10 18:16:50 +03:00
Avi Kivity
029560c232 sstables: processing_result_generator: make coroutine support palatable for C++20 compilers
clang implement the coroutine technical specification, in namespace
std::experimental. gcc implements C++20 coroutines, in namespace std.
Detect which one is in use and select the namespace accordingly.
2021-10-10 18:16:50 +03:00
Avi Kivity
c38f18163e managed_bytes: avoid compile-time loop in converting constructor
managed_bytes_basic_view is a template with a constructor that
converts from one instantiation of the template to another.
Unfortunately when gcc encounters the associated constraint, it
instantiates the template which forces it to evaluate the constraint
again, sending it into a loop.

Fix that by making the converting constructor a template itself,
delaying instantiation. The constraint is strengthened so the set
of types on which the constructor works is unchanged.
2021-10-10 18:16:50 +03:00
Avi Kivity
f6d59c33ff service: service_level_controller: drop unused variable sl_compare
Reported by gcc 11.
2021-10-10 18:16:50 +03:00
Avi Kivity
cd4af0c722 raft: disambiguate promise name in raft::active_read
gcc complains tha the name 'promise' changes meaning (from type
to variable) within active_read. Help it by disambiguating the
use as type.
2021-10-10 18:16:50 +03:00
Avi Kivity
3f9ec5302a locator: azure_snitch: use full type name in definition of globals
Some globals in azure_snitch use std::string in the declaration
and auto in the definition. gcc 11 complains. I don't know if it's
correct, but it's easy to use the type in both declaration and
definition.
2021-10-10 18:16:50 +03:00
Avi Kivity
d83b565938 cql3: statements: create_service_level_statement: don't ignore replace_defaults()
We call replace_defaults on an object named 'slo', but then ignore it.

Use the new object that replace_defaults() returned.

Reported by gcc 11.
2021-10-10 18:16:50 +03:00
Avi Kivity
25f8e9c078 cql3: statement_restrictions: adjust call to std::vector deduction guide
gcc 11 has a hard time parsing a deduction guide use with
braced initializer. The bug [1] was already fixed in gcc 12,
and I've requested a backport, but reduce friction meanwhile
by switching to a form that works in gcc 11.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89062
2021-10-10 18:16:50 +03:00
Avi Kivity
df73d12272 types: remove recursive constraint in deserialize_value
deserialize_value() has a constraint that depends on another
deserialize_value() implementation. Apprently gcc wants to
instantiate the deserialize_value() instance we're constraining
while evaluating the constraint, leading to a loop.

Since this deserialize_value() is just an internal helper, drop
the constraint rather than fighting it.
2021-10-10 18:16:50 +03:00
Avi Kivity
58a0e80021 cql3: restrictions: relax constraint on visitor_with_binary_operator_content
We require that v.current_binary_operator is a 'const binary_operator*',
but it's really a 'const binary_operator*&'. Relax the constraint so it
works with both gcc and clang.
2021-10-10 18:16:50 +03:00
Avi Kivity
fd8beeaea9 treewide: handle switch statements that return
A switch statement where every case returns triggers a gcc
warning if the surrounding function doesn't return/abort.

Fix by adding an abort(). The abort() will never trigger since we
have a warning on unhandled switch cases.
2021-10-10 18:16:50 +03:00
Mikołaj Sielużycki
235c38e78f sstables, gdb: Retire usage of sstable_tracker
sstables_manager superseeds previous implementation of sstables_tracker
for tracking lifetime of the tables. Update scylla-gdb.py to use
sstables_manager in a backwards compatible way, as sstables_manager is
not available in Scylla Enterprise 2020.1. Add explicit test for
"scylla sstables" command, as previously only "scylla active-sstables"
was tested.

Closes #9439
2021-10-07 14:40:47 +02:00
Piotr Sarna
59bd25d1ea transport: respond with overloaded exception during shedding
This commit makes shedding always respond - with overloaded exception,
instead of ignoring the request.

Fixes #9442

Closes #9443
2021-10-07 15:38:40 +03:00