Commit Graph

1112 Commits

Author SHA1 Message Date
Botond Dénes
f46cdce9d3 Merge 'Make memtable flush tolerate misconfigured S3 storage' from Pavel Emelyanov
Nowadays if memtable gets flushed into misconfigured S3 storage, the flush fails and aborts the whole scylla process. That's not very elegant. First, because upon restart garbage collecting non-sealed sstables would fail again. Second, because re-configuring an endpoint can be done runtime, scylla re-reads this config upon HUP signal.

Flushing memtable restarts when seeing ENOSPC/EDQUOT errors from on-disk sstables. This PR extends this to handle misconfigured S3 endpoints as well.

fixes: #13745

Closes scylladb/scylladb#15635

* github.com:scylladb/scylladb:
  test: Add object_store test to validate config reloading works
  test: Add config update facility to test cluster
  test: Make S3_Server export config file as pathlib.Path
  config: Make object storage config updateable_value_source
  memtable: Extend list of checking codes
  sstables/storage/s3: Fix missing TOC status check
  s3/client: Map http exceptions into storage_io_error
  exceptions: Extend storage_io_error construction options
2023-11-28 09:33:37 +02:00
Raphael S. Carvalho
157a5c4b1b treewide: Avoid using namespace sstables in header to avoid conflicts
That's needed for compaction_group.hh to be included in headers.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
2023-11-23 17:36:57 +02:00
Kamil Braun
c3257bf546 Revert "test: cql_test_env: Interrupt all components on cql_test_env teardown"
This reverts commit 93ee7b7df9.

It's causing assertion failures when shutting down `cql_test_env` in
boost unit tests: scylladb/scylladb#16144
2023-11-23 15:32:13 +01:00
Tomasz Grabiec
b06a0078fb Merge 'Support for sending tablet info to the drivers' from Sylwia Szunejko
There is a need for sending tablet info to the drivers so they can be tablet aware. For the best performance we want to get this info lazily only when it is needed.

The info is send when driver asks about the information that the specific tablet contains and it is directed to the wrong node/shard so it could use that information for every subsequent query. If we send the query to the wrong node/shard, we want to send the RESULT message with additional information about the tablet (replicas and token range) in custom_payload.

Mechanism for sending custom_payload added.

Sending custom_payload tested using three node cluster and cqlsh queries. I used RF=1 so choosing wrong node was testable.

I also manually tested it with the python-driver and confirmed that the tablet info can be deserialized properly.

Automatic tests added.

Closes scylladb/scylladb#15410

* github.com:scylladb/scylladb:
  docs: add documentation about sending tablet info to protocol extensions
  Add tests for sending tablet info
  cql3: send tablet if wrong node/shard is used during modification statement
  cql3: send tablet if wrong node/shard is used during select statement
  locator: add function to check locality
  locator: add function to check if host is local
  transport: add function to add tablet info to the result_message
  transport: add support for setting custom payload
2023-11-22 17:44:07 +02:00
Nadav Har'El
242a4b23c0 Merge 'tests: Skip unnecessary sleeps in cql_test_env teardown' from Tomasz Grabiec
This PR contains two patches which get rid of unnecessary sleeps on cql_test_env teardown greatly reducing run time of tests.

Reduces run time of `build/dev/test/boost/schema_change_test` from 90s to 6s.

Closes scylladb/scylladb#16111

* github.com:scylladb/scylladb:
  test: cql_test_env: Interrupt all components on cql_test_env teardown
  tests: cql_test_env: Skip gossip shutdown sleep
2023-11-22 17:44:07 +02:00
Botond Dénes
b1a76ebb93 Merge 'Sanitize storage service init/deinit sequences' from Pavel Emelyanov
Currently storage service starts too early and its initialization is split into several steps. This PR makes storage service start "late enough" and makes its initialization (minimally required before joining cluster) happen in on place.

refs: #2795
refs: #2737

Closes scylladb/scylladb#16103

* github.com:scylladb/scylladb:
  storage_service: Drop (un)init_messaging_service_part() pair
  storage_service: Init/Deinit RPC handlers in constructor/stop
  storage_service: Dont capture container() on RPC handler
  storage_service: Use storage_service::_sys_dist_ks in some places
  storage_service: Add explicit dependency on system dist. keyspace
  storage_service: Rurn query processor pointer into reference
  storage_service: Add explicity query_processor dependency
  main: Start storage service later
2023-11-22 17:44:07 +02:00
sylwiaszunejko
cea4c40685 cql3: send tablet if wrong node/shard is used during modification statement 2023-11-22 09:23:43 +01:00
Pavel Emelyanov
210b01a5ce config: Make object storage config updateable_value_source
Now its plain updateable_value, but without the ..._source object the
updateable_value is just a no-op value holder. In order for the
observers to operate there must be the value source, updating it would
update the attached updateable values _and_ notify the observers.

In order for the config to be the u.v._source, config entries should be
comparable to each other, thus the <=> operator for it

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-21 16:47:50 +03:00
Tomasz Grabiec
93ee7b7df9 test: cql_test_env: Interrupt all components on cql_test_env teardown
This should interrupt all sleeps in component teardown.

Before this patch, there was a 1s sleep on gossiper shutdown, which I
don't know where it comes from. After the patch there is no such
sleep.
2023-11-21 12:22:32 +01:00
Tomasz Grabiec
7f3a74efab tests: cql_test_env: Skip gossip shutdown sleep
Removes unnecessary 2s sleep on each cql test env teardown.
2023-11-21 12:22:24 +01:00
Pavel Emelyanov
8ae751a3ff tests: Shorten the write_memtable_to_sstable_for_test()
The wrapper just calls the test-only core write_memtable_to_sstable()
overload, tests can do it on their own.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-20 14:27:57 +03:00
Pavel Emelyanov
4df5af931a storage_service: Add explicit dependency on system dist. keyspace
This effectively reverts bc051387c5 (storage_service: Remove sys_dist_ks
from storage_service dependencies) since now storage service needs the
sys. disk. ks not only cluster join time. Next patch will make more use
of it as well.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-20 13:52:42 +03:00
Pavel Emelyanov
e59544674a storage_service: Add explicity query_processor dependency
It's now set via a dedicated call that happens after query processor is
started. Now query processor is started before storage service and the
latter can get the q.p. local reference via constructor.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-20 13:51:09 +03:00
Pavel Emelyanov
f4696f21a8 test/utils: Drop compaction_manager_test
This class only provides a .run() method which allocates a task and
calls sstables::test_env::perform_compaction(). This can be done in a
helper method, no need for the whole class for it.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-13 11:44:51 +03:00
Pavel Emelyanov
b68f9c32bb test/utils: Get compaction manager from test_env
This is just to reduce churn in the next patch.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-13 11:44:51 +03:00
Pavel Emelyanov
9fd270566a test/sstables: Introduce test_env_compaction_manager::perform_compaction()
Take it from compaction_manager_test::run() which is simplified overwite
of the compaction_manager::perform_compaction().

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-13 11:44:51 +03:00
Pavel Emelyanov
0160265c7d test/env: Add sstables::test_env& to compaction_manager_test::run()
Continuation of the previous patch that will also be used further.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-13 11:44:51 +03:00
Pavel Emelyanov
393c066f3e test/utils: Add sstables::test_env& to compact_sstables()
Will be used in next patches.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-13 11:44:51 +03:00
Pavel Emelyanov
ca18db4a71 test/utils: Simplify and unify compaction_manager_test::run()
The method is the simplified rewrite of the compaction_manager's
perform_compaction() one, but it makes task registration and
unregistration to hard way. Keep it shorter and simpler resembling the
compaction_manager's prototype.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-13 11:44:51 +03:00
Pavel Emelyanov
9a9e1fdd7d test/utils: Squash two compact_sstables() helpers
Now the one sitting in utils is only called from its peer in compaction
test. Things get simpler if they get merged.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-13 11:44:51 +03:00
Pavel Emelyanov
59943267c2 test/utils: Keep test task compaction gate on task itself
They both have the same scope, but keeping it on the task frees the
caller from the need to mess with its private fields. For now it's not a
problem, but it will be critical in one of the next patches.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-13 11:44:51 +03:00
Pavel Emelyanov
aec3fc493a test/utils: Move compaction_manager_test::propagate_replacement()
The purpose of this method is to turn public the private
compaction_manager method of the same name. The caller of this method is
having sstable_test_env at hand with its test_env_compaction_manager, so
the de-private-isation call can be moved.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-13 11:44:51 +03:00
Tomasz Grabiec
457d170078 Merge 'Multishard mutation query test fix misses expectations' from Botond Dénes
There are two tests, test_read_all and test_read_with_partition_row_limits, which asserts on every page as well
as at the end that there are no misses whatsoever. This is incorrect, because it is possible that on a given page, not all shards participate and thus there won't be a saved reader on every shard. On the subsequent page, a shard without a reader may produce a miss. This is fine. Refine the asserts, to check that we have only as much misses, as many
shards we have without readers on them.

Fixes: https://github.com/scylladb/scylladb/issues/14087

Closes scylladb/scylladb#15806

* github.com:scylladb/scylladb:
  test/boost/multishard_mutation_query_test: fix querier cache misses expectations
  test/lib/test_utils: add require_* variants for all comparators
2023-11-12 13:15:29 +01:00
Botond Dénes
7679152209 Merge 'Sanitize usage of make_sstable_easy+make_memtable in tests' from Pavel Emelyanov
The helper makes sstable, writes mutations into it and loads one. Internally it uses the make_memtable() helper that prepares a memtable out of a vector of mutations. There are many test cases that don't use these facilities generating some code duplication.

The make_sstable() wrapper around make_sstable_easy() is removed along the way.

Closes scylladb/scylladb#15930

* github.com:scylladb/scylladb:
  tests: Use make_sstable_easy() where appropriate
  sstable_conforms_to_mutation_source_test: Open-code the make_sstable() helper
  sstable_mutation_test: Use make_sstable_easy() instead of make_sstable()
  tests: Make use of make_memtable() helper
  tests: Drop as_mutation_source helper
  test/sstable_utils: Hide assertion-related manipulations into branch
2023-11-07 09:29:30 +02:00
Benny Halevy
a1acf6854b everywhere: reduce dependencies on i_partitioner.hh
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2023-11-05 20:47:44 +02:00
Pavel Emelyanov
cc89acff67 sstable_conforms_to_mutation_source_test: Open-code the make_sstable()
helper

This test case is pretty special in the sense that it uses custom path
for tempdir to create, write and load sstable to/from. It's better to
open-code the make_sstable() helper into the test case rather than
encourage callers to use custom tempdirs. "Good" test cases can use
make_sstable_easy() for the same purposes (in fact they alredy do).

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-02 19:30:54 +03:00
Pavel Emelyanov
7f6423bc35 sstable_mutation_test: Use make_sstable_easy() instead of make_sstable()
The latter is only used in the former test case and doesn't provide
extra value.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-02 19:30:02 +03:00
Pavel Emelyanov
eeee58def8 tests: Make use of make_memtable() helper
There's one in the utils that creates lw_shared_ptr<memtable> and
applies provided vector of mutations into it. Lots of other test cases
do literally the same by hand.

The make_memtable() assumes that the caller is sitting in the seastar
thread, and all the test cases that can benfit from it already are.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-02 19:28:35 +03:00
Pavel Emelyanov
3ff32a2ca5 test/sstable_utils: Hide assertion-related manipulations into branch
The make_sstable_containing() can validate the applied mutations are
produced by the resulting sstable if the callers asks for it. To do so
the mutations are merged prior to checking and this merging should only
happen if validation is requested, otherwise it just makes no sense.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-02 19:26:46 +03:00
Pavel Emelyanov
787c6576fe test_services: Ditch compaction_manager_for_testing
Now this wrapper is unused, all (both) test cases that needed it were
patched to use make_table_for_tests().

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-01 14:18:17 +03:00
Pavel Emelyanov
9b8f03bdb0 table_for_tests: Add const operator-> overload
Will be used later in boost transformation lambda

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-01 14:18:17 +03:00
Pavel Emelyanov
3021fb7b6c sstable_test_env: Add test_env_compaction_manager() getter
Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-01 14:18:17 +03:00
Pavel Emelyanov
19b524d0f3 sstable_test_env: Tune up maybe_start_compaction_manager() method
Make it public and add `bool enable` flag so that test cases could start
the compaction manager (to call make_table_for_tests() later) but keep
it disabled for their testing purposes.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-11-01 14:18:17 +03:00
Pavel Emelyanov
4db80ed61f table_for_tests: Use test_env's compaction manager
Now when the sstables::test_env provides the compaction manager
instance, the table_for_tests can start using it and can remove c.m. and
the sidecar task_manager.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:42:19 +03:00
Pavel Emelyanov
2c78b46c78 sstables::test_env: Carry compaction manager on board
Most of the test cases that use sstables::test_env do not mess with
table objects, they only need sstables. However, compaction test cases
do need table objects and, respectively, a compaction manager instance.
Today those test cases create compaction manager instance for each table
they create, but that's a bit heaviweight and doesn't work the way core
code works. This patch prepares the sstables::test_env to provide
compaction manager on demand by starting it as soon as it's asked to
create table object.

For now this compaction manager is unused, but it will be in next patch.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:39:54 +03:00
Pavel Emelyanov
b96d39e63a table_for_tests: Stop table on stop
Next patches will stop using compaction manager from table_for_tests in
favor of external one (spoiler: the one from sstables::test_env), thus
the compaction manager would outsurvive the table_for_tests object and
the table object wrapped by it. So in order for the table_for_tests to
stop correctly, it also needs to stop the wrapped table too.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:38:03 +03:00
Pavel Emelyanov
e71409df38 table_for_tests: Get compaction manager from table
There's table_for_tests::get_compaction_manager() helper that's
excessive as compaction manager reference can be provided by the wrapped
table object itself.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:37:22 +03:00
Pavel Emelyanov
ac45aae0c4 table_for_tests: Ditch on-board concurrency semaphore
It's not used any longer and can be removed. This make table_for_tests
stopping code a bit shorter as well.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:36:59 +03:00
Pavel Emelyanov
21998296a7 table_for_tests: Require config argument to make table
This is the continuation of the previous patch. Make the caller of
table_for_tests constructor provide the table::config. This makes the
table_for_tests constructor shorter and more self-contained.

Also, the caller now needs to provide the reference to reader
concurrency semaphore, and that's good news, because the only caller for
today is the sstables::test_env that does have it. This makes the
semaphore sitting on table_for_tests itself unused and it will be
removed eventually.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:34:59 +03:00
Pavel Emelyanov
5ab1af3804 table_for_tests: Create table config locally
The table_for_tests keeps a copy of table::config on board. That's not
"idiomatic" as table config is a temporary object that should only be
needed while creating table object. Fortunately, the copy of config on
table_for_tests is no longer needed and it can be made temporary.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:33:29 +03:00
Pavel Emelyanov
76e57cc805 table_for_tests: Get concurrency semaphore from table
Making compaction permit needs a semaphore. Current code gets it from
the table_for_tests, but the very same semaphore reference sits on the
table. So get it from table, as the core code does. This will allow
removing the dedicated semaphore from table_for_tests in the future.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:32:32 +03:00
Pavel Emelyanov
35f7ada949 table_for_tests: Get table directory from table itself
Making sstable for a table needs passing table directory as an argument.
Current table_for_tests's helper gets the directory from table config,
but the very same path sits on the table itself. This makes testing code
to construct sstable look closer to the core code and is also the
prerequisite for removing the table config from table_for_tests in the
future.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:30:59 +03:00
Pavel Emelyanov
769d9f17eb table_for_tests: Reuse cache tracker from sstables manager
When making table object it needs the cache tracker reference. The
table_for_tests keeps one on board, but the very same object already
sits on the sstables manager which has public getter.

This makes the table_for_tests's cache tracker object not needed.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:29:49 +03:00
Pavel Emelyanov
89e253c77e table_for_tests: Remove unused constructor
No code constructs it with just sstables manager argument.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:29:29 +03:00
Pavel Emelyanov
8d704f2532 sstable_test_env: Coroutinize and move to .cc test_env::stop()
It's going to get larger, so better to move.
Also when coroutinized it's goind to be easier to extend.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-10-31 09:26:58 +03:00
Avi Kivity
e349a2657c Merge 'Allow running perf-simple-query with tablets' from Tomasz Grabiec
Usage:

```
build/dev/scylla perf-simple-query --tablets
```

Closes scylladb/scylladb#15656

* github.com:scylladb/scylladb:
  perf_simple_query: Allow running with tablets
  tests: cql_test_env: Allow creating keyspace with tablets
  tests: cql_test_env: Register storage_service in migration notifier
  test: cql_test_env: Initialize node state in topology
2023-10-29 18:30:32 +02:00
Pavel Emelyanov
7c580b4bd4 Merge 'sstable: switch to uuid identifier for naming S3 sstable objects' from Kefu Chai
before this change, we create a new UUID for a new sstable managed by the s3_storage, and we use the string representation of UUID defined by RFC4122 like "0aa490de-7a85-46e2-8f90-38b8f496d53b" for naming the objects stored on s3_storage. but this representation is not what we are using for storing sstables on local filesystem when the option of "uuid_sstable_identifiers_enabled" is enabled. instead, we are using a base36-based representation which is shorter.

to be consistent with the naming of the sstables created for local filesystem, and more importantly, to simplify the interaction between the local copy of sstables and those stored on object storage, we should use the same string representation of the sstable identifier.

so, in this change:

1. instead of creating a new UUID, just reuse the generation of the sstable for the object's key.
2. do not store the uuid in the sstable_registry system table. As we already have the generation of the sstable for the same purpose.
3. switch the sstable identifier representation from the one defined by the RFC4122 (implemented by fmt::formatter<utils::UUID>) to the base36-based one (implemented by fmt::formatter<sstables::generation_type>)

Fixes #14175
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#14406

* github.com:scylladb/scylladb:
  sstable: remove _remote_prefix from s3_storage
  sstable: switch to uuid identifier for naming S3 sstable objects
2023-10-23 21:05:13 +03:00
Aleksandra Martyniuk
0c6a3f568a compaction: delete default_compaction_progress_monitor
default_compaction_progress_monitor returns a reference to a static
object. So, it should be read-only, but its users need to modify it.

Delete default_compaction_progress_monitor and use one's own
compaction_progress_monitor instance where it's needed.

Closes scylladb/scylladb#15800
2023-10-23 16:03:34 +03:00
Botond Dénes
0a34f29ea5 test/lib/test_utils: add require_* variants for all comparators
Not just equal. This allows for better error messages, printing both
values and the failed relation operator, instead of a generic fail
message.
2023-10-23 07:52:38 -04:00
Kefu Chai
af8bc8ba63 sstable: switch to uuid identifier for naming S3 sstable objects
before this change, we create a new UUID for a new sstable managed
by the s3_storage, and we use the string representation of UUID
defined by RFC4122 like "0aa490de-7a85-46e2-8f90-38b8f496d53b" for
naming the objects stored on s3_storage. but this representation is
not what we are using for storing sstables on local filesystem when
the option of "uuid_sstable_identifiers_enabled" is enabled. instead,
we are using a base36-based representation which is shorter.

to be consistent with the naming of the sstables created for local
filesystem, and more importantly, to simplify the interaction between
the local copy of sstables and those stored on object storage, we should
use the same string representation of the sstable identifier.

so, in this change:

1. instead of creating a new UUID, just reuse the generation of the
   sstable for the object's key.
2. do not store the uuid in the sstable_registry system table. As
   we already have the generation of the sstable for the same purpose.
3. switch the sstable identifier representation from the one defined
   by the RFC4122 (implemented by fmt::formatter<utils::UUID>) to the
   base36-based one (implemented by
   fmt::formatter<sstables::generation_type>)
4. enable the `uuid_sstable_identifers` cluster feature if it is
   enabled in the `test_env_config`, so that it the sstable manager
   can enable the uuid-based uuid when creating a new uuid for
   sstable.
5. throw if the generation of sstable is not UUID-based when
   accessing / manipulating an sstable with S3 storage backend. as
   the S3 storage backend now relies on this option. as, otherwise
   we'd have sstables with key like s3://bucket/number/basename, which
   is just unable to serve as a unique id for sstable if the bucket is
   shared across multiple tables.

Fixes #14175
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-10-23 10:08:22 +08:00