Commit Graph

349 Commits

Author SHA1 Message Date
Avi Kivity
333fdcb3f5 Update tools/java submodule (fix NodeProbe: Malformed IPv6 address at index)
* tools/java 9bc83b7a32...a4573759a2 (1):
  > CASSANDRA-17581 fix NodeProbe: Malformed IPv6 address at index

Fixes #10442.
2022-04-27 14:51:47 +03:00
Konstantin Osipov
a3b790b413 test.py: add a dependency on python3-aiohttp and tabulate
Satisfy the build system requirements.

[avi: regenerate frozen toolchain]
2022-04-19 18:22:50 +03:00
Avi Kivity
65720bcfd1 tools: toolchain: prepare: sqush intermediate container layers
Without this, the image contains awkward container layers with one
file (from the ADD commands). It's not a disaster, just pointless.
2022-04-10 19:00:36 +03:00
Avi Kivity
4bc5f1ba98 tools: toolchain: update container image first thing
Otherwise, rpm dependency resolution starts by installing an older
version of gcc (to satisfy an older preinstalled libgcc dependency),
then updates it. After the change, we install the updated gcc in
the first place.
2022-04-10 18:48:07 +03:00
Avi Kivity
69af7a830b tools: toolchain: prepare: build arch images in parallel
To speed up the build, run each arch in parallel, using bash's
awkward job control.
2022-04-10 18:45:08 +03:00
Avi Kivity
39ccd744de tools: toolchain: prepare: aloow running on non-x86
`prepare` builds a multiarch image using qemu emulation. It turns
out that aarch64 emulation is slowest (due to emulating pointer
authentication) so it makes sense to run it on an aarch64 host. To do
that, we need only to adjust the check for qemu installation.

Unfortunately, docker arch names and Linux arch names are different,
so we have to add an ungainly translation, but otherwise it is a
simple loop.
2022-04-10 18:17:00 +03:00
Wojciech Mitros
97408078a1 dependencies: add rust
The main reason for adding rust dependency to scylla is the
wasmtime library, which is written in rust. Although there
exist c++ bindings, they don't expose all of its features,
so we want to do that ourselves using rust's cxx.

Signed-off-by: Wojciech Mitros <wojciech.mitros@scylladb.com>
[avi: update toolchain]
[avi: remove example, saving for a follow-on]
2022-04-07 12:26:05 +03:00
Avi Kivity
0d5fd526a5 Merge "tools/scylla-sstable alternative schema load method for system tables" from Botond
"
Examining sstables of system tables is quite a common task. Having to
dump the schemas of such tables into a schema.cql is annoying knowing
that these schemas are readily available in scylla, as they are
hardcoded. This mini-series adds a method to make use of this fact, by
adding a new option: `--system-schema`, which takes the name of a system
table and looks up its schema.

Tests: unit(dev)
"

* 'scylla-sstable-system-schema/v1' of https://github.com/denesb/scylla:
  tools/scylla-sstable: add alternative schema load method for system tables
  tools/schema_loader: add load_system_schema()
  db/system_distributed_keyspace: add all tables methods
  tools/scylla-sstable: reorganize main help text
2022-04-05 15:48:29 +03:00
Avi Kivity
538fabc05d Update tools/java submodule
* tools/java ac5d6c840d...9bc83b7a32 (1):
  > fix metadata printing for ME sstables
2022-04-03 18:33:04 +03:00
Botond Dénes
e19cf6760a tools/scylla-sstable: add alternative schema load method for system tables
By providing its name via the new `--system-schema` option. The schema
will be loaded from the internal hardcoded definition.
2022-04-01 10:12:33 +03:00
Botond Dénes
095bb0d992 tools/schema_loader: add load_system_schema()
Allowing to load (or rather lookup) system schemas by name.
2022-04-01 10:10:31 +03:00
Botond Dénes
be788140ff tools/scylla-sstable: reorganize main help text
Currently the main help is a big wall of text. This makes it hard to
quickly jump to the section of interest. This patch reorganizes it into
clear sections, each with a title. Sections are now also ordered
according to the part they reference in the command-line.
This should make it easier for answers to questions regarding a certain
topic to be quickly found, without having to read a lot of text.
2022-04-01 10:10:31 +03:00
Avi Kivity
caa4cddebf Update tools/java submodule
* tools/java b1e09c8b8f...ac5d6c840d (1):
  > Merge 'Sync with Cassandra 3.11.12' from Michael Livshin
2022-03-30 17:03:55 +03:00
Botond Dénes
b029bd3db7 tree: remove mutation_reader.hh include
In most files it was unused. We should move these to the patch which
moved out the last interesting reader from mutation_reader.hh (and added
the corresponding new header include) but its probably not worth the
effort.
Some other files still relied on mutation_reader.hh to provide reader
concurrency semaphore and some other misc reader related definitions.
2022-03-30 15:42:51 +03:00
Botond Dénes
f8015d9c26 readers: move combined reader into readers/
Since the combined reader family weighs more than 1K SLOC, it gets its
own .cc file.
2022-03-30 15:42:51 +03:00
Botond Dénes
9e1a642e1f tools/schema_loader: use own data dictionary impl
And pass it to the cql3 layer when parsing statements. This allows the
schema loader to cut itself from replica::database, using a local, much
simpler database implementation. This not only makes the code much
simpler but also opens up the way to using the standard allocator in
tools. The real database uses LSA which is incompatible with the
standard allocator (in release builds that is).
2022-03-25 14:40:44 +02:00
Avi Kivity
975b0c0b03 Merge "tools/scylla-sstable: add validate-checksums and decompress" from Botond
"
This patchset adds two new operations to scylla-sstable:
* validate-checksums - helps identifying whether an sstable is intact or
  not, but checking the digest and the per-chunk checksums against the
  data on disk.
* decompress - helps when one wants to manually examine the content of a
  compressed sstable.

Refs: #497

Tests: unit(dev)
"

* 'scylla-sstable-validate-checksums-decompress/v3' of https://github.com/denesb/scylla:
  tools/scylla-sstable: consume_sstables(): s/no_skips/use_crawling_reader/
  tools/scylla-sstable: add decompress operation
  tools/scylla-sstables: add validate-checksums operation
  sstables/sstable: add validate_checksums()
  sstables/sstable: add raw_stream option to data_stream()
  sstables/sstable: make data_stream() and data_read() public
  utils/exceptions: add maybe_rethrow_exception()
2022-03-16 18:56:48 +02:00
Pavel Solodovnikov
95c8d65949 treewide: fix compilation issues with fmtlib 8.1.0+
Due to fd62fba985
scoped enums are not automatically converted to integers anymore,
this is the intended behavior, according to the fmtlib devs.

A bit nicer solution would be to use `std::to_underlying`
instead of a direct `static_cast`, but it's not available until
C++23 and some compilers are still missing the support for it.

Tests: unit(dev)

Signed-off-by: Pavel Solodovnikov <pa.solodovnikov@scylladb.com>
2022-03-16 12:31:50 +03:00
Botond Dénes
15a44805ba tools/scylla-sstable: consume_sstables(): s/no_skips/use_crawling_reader/
It more accurately describes what the role of this flag actually is.
2022-03-15 14:52:20 +02:00
Botond Dénes
d10700a83d tools/scylla-sstable: add decompress operation
Useful when one wants to manually check the content of a compressed
sstable.
2022-03-15 14:52:20 +02:00
Botond Dénes
488d145dc8 tools/scylla-sstables: add validate-checksums operation
Useful for determining whether sstables have been corrupted by factors
outside of scylla, e.g. the I/O subsystem.
2022-03-15 14:52:20 +02:00
Botond Dénes
daf0f7cee5 tools/types: update main description
Remove examples and instead point user to action-specific help for more
information about specific actions.
2022-02-25 15:02:07 +02:00
Botond Dénes
af19d5ccf1 tools/scylla-types: per-action help content
Just like scylla-sstable, have a separate --help content for reach
action. The existing description is shortened and is demoted to summary:
this now only appears in the listing in the main description.
2022-02-25 15:01:02 +02:00
Botond Dénes
629a5c3ed6 tools/scylla-types: description: remove -- from action listing
Actions are commands, not switches now, update the listing in the
description accordingly.
2022-02-25 15:00:47 +02:00
Botond Dénes
05bd6b2bce tools/scylla-types: use fmt::print() instead of std::cout <<
`std::cout <<` makes for very hard-to-read (and hard-to-write) code.
Replace with `fmt::print()`.
2022-02-25 15:00:21 +02:00
Botond Dénes
10880fb0a7 tools/scylla-sstable: fix description template
Quote '{' and '}' used in CQL example, so format doesn't try to
interpret it.

Signed-off-by: Botond Dénes <bdenes@scylladb.com>
Message-Id: <20220221140652.173015-1-bdenes@scylladb.com>
2022-02-21 17:14:41 +02:00
Botond Dénes
96082631c8 tools/schema_loader: auto-create the keyspace for all statements
Currently the keyspace is only auto-created for create type statements.
However the keyspace is needed even without UDTs being involved: for
example if the table contains a collection type. So auto-create the
keyspace unconditionally before preparing the first statement.

Also add a test-case with a create table statement which requires the
keyspace to be present at prepare time.
2022-02-17 15:24:24 +02:00
Botond Dénes
59ce247164 tools/scylla-sstable: change output of dump-scylla-metadata to json 2022-02-17 15:24:24 +02:00
Botond Dénes
2a7ed8212f tools/scylla-sstable: change output of dump-statistics to json 2022-02-17 15:24:24 +02:00
Botond Dénes
a617e66878 tools/scylla-sstable: change output of dump-summary to json 2022-02-17 14:17:11 +02:00
Botond Dénes
fb6b7c8036 tools/scylla-sstable: change output of dump-compression-info to json 2022-02-17 14:17:11 +02:00
Botond Dénes
f5c6d7e12e tools/scylla-sstable: change output of dump-index to json 2022-02-17 14:17:11 +02:00
Botond Dénes
bdbbda29c1 tools/scylla-sstable: add json support in --dump-data
But keep the old text output-format too. One can switch between the two
with the --output-format flag, which defaults to "json".
2022-02-17 14:17:11 +02:00
Botond Dénes
03bbf1b362 tools/scylla-sstable: add json_writer
Wrapping a rapidjson::Writer<> and mirrors the latter's API, providing
more convenient overloads for the Key() and String() methods, as well as
providing some extra, scylla-sstable specific methods too.
2022-02-17 14:17:11 +02:00
Botond Dénes
72f27c8782 tools/scylla-sstable: use fmt::print in --dump-data
The rest of the code is standardizing on fmt::print(), bring the code
for --dump-data in line.
2022-02-17 14:17:11 +02:00
Botond Dénes
ba2a61b2bc tools/scylla-sstable: prepare --dump-data for multiple output formats
Extract the actual dumping code into a separate class, which also
implements sstable_consumer interface. The dumping consumer now just
forwards calls to actual dumper through the abstract consumer interface,
allowing different concrete dumpers to be instantiated.
2022-02-17 14:17:11 +02:00
Michael Livshin
3fef604075 sstables_manager: add get_local_host_id() method and support
Since ME sstable format includes originating host id in stats
metadata, local host id needs to be made available for writing and
validation.

Both Scylla server (where local host id comes from the `system.local`
table) and unit tests (where it is fabricated) must be accomodated.
Regardless of how the host id is obtained, it is stored in the db
config instance and accessed through `sstables_manager`.

Signed-off-by: Michael Livshin <michael.livshin@scylladb.com>
2022-02-16 18:21:24 +02:00
Michael Livshin
c96708d262 add support for the ME sstable format
The ME format has been introduced in Cassandra 3.11.11:

11952fae77/src/java/org/apache/cassandra/io/sstable/format/big/BigFormat.java (L123)
d84c6e9810

It adds originating host id to sstable metadata in support of fixing
loss of commit log data when moving sstables between nodes:

https://issues.apache.org/jira/browse/CASSANDRA-16619

In Scylla:

* The supported way to ingest sstables is via upload/, where stored
  commit log replay position should be disregarded (but see
  https://github.com/scylladb/scylla/issues/10080).

* A later commit in this series implements originating host id
  validation for native ME sstables.

Signed-off-by: Michael Livshin <michael.livshin@scylladb.com>
2022-02-16 18:21:24 +02:00
Michael Livshin
3712a82ca7 scylla-sstable: add ability to dump optionals and utils::UUID
Needed for the ME sstable format.

Signed-off-by: Michael Livshin <michael.livshin@scylladb.com>
2022-02-16 18:21:24 +02:00
Avi Kivity
817d1aade8 tools: toolchain: regenerate with libstdc++-11.2.1-9.fc34.x86_64 2022-02-15 18:02:54 +02:00
Avi Kivity
f5cd6ec419 Update tools/python3 submodule (relicensed to Apache License 2.0)
* tools/python3 8a77e76...f725ec7 (2):
  > Relicense to Apache 2.0
  > treewide: use Software Package Data Exchange (SPDX) license identifiers
2022-01-25 18:50:39 +02:00
Avi Kivity
fcb8d040e8 treewide: use Software Package Data Exchange (SPDX) license identifiers
Instead of lengthy blurbs, switch to single-line, machine-readable
standardized (https://spdx.dev) license identifiers. The Linux kernel
switched long ago, so there is strong precedent.

Three cases are handled: AGPL-only, Apache-only, and dual licensed.
For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0),
reasoning that our changes are extensive enough to apply our license.

The changes we applied mechanically with a script, except to
licenses/README.md.

Closes #9937
2022-01-18 12:15:18 +01:00
Avi Kivity
2754e29a9d Merge "tools: make cli command-based" from Botond
"
Currently commands are regular switches. This has several disadvantages:
* CLI programs nowadays use the command-based UX, so our tools are
  awkward to use to anybody used to that;
* They don't stand out from regular options;
* They are parsed at the same time as regular options, so all options
  have to be dumped to a single description;

This series migrates the tools to the command based CLI. E.g. instead of

    scylla sstable --validate --merge /path/to/sst1 /path/to/sst2

we now have:

    scylla sstable validate --merge /path/to/sst1 /path/to/sst2

Which makes it much clearer that "validate" is the command and "merge"
is an option. And it just looks better.

Internally the command is parsed and popped from argv manually just as
we do with the tool name in scylla main(). This means we know the
command before even building the
boost::program_options::options_description representation and thus
before creating the seastar::app_template instance. Consequently we can
tailor the options registered and the --help content (the application
description) to the command run.
So now "scylla sstable --help" prints only a general description of the
tool and a list of the supported operations. Invoking "scylla sstable
{operation} --help" will print a detailed description of the operation
along with its specific options. This greatly improves the documentation
and the usability of the tool.
"

Refs #9882

* 'tools-command-oriented-cli/v1' of https://github.com/denesb/scylla:
  tools/scylla-sstable: update general description
  tools/scylla-sstable: proper operation-specific --help
  tools/scylla-sstable: proper operation-specific options
  tools/scylla-sstable: s/dump/dump-data/
  tools/utils: remove now unused get_selected_operation() overload
  tools: take operations (commands) as positional arguments
  tools/utils: add positional-argument based overload of get_selected_operation()
  tools: remove obsolete FIXMEs
2022-01-17 17:03:39 +02:00
Botond Dénes
77c9f252a1 tools/scylla-sstable: migrate to v2 2022-01-14 08:54:26 +02:00
Nadav Har'El
261c4b80b5 Update tools/java submodule
* tools/java 6249bfbe2f...b1e09c8b8f (1):
  > dist/debian:set either python (>=2.7) or python2
2022-01-11 17:01:08 +02:00
Botond Dénes
4f4df25687 tools/scylla-sstable: update general description
We now have detailed per-operation descriptions, so remove
operation-specific parts of the general one and instead add more details
on the common options and arguments.
2022-01-07 12:05:49 +02:00
Botond Dénes
c6d61d47b7 tools/scylla-sstable: proper operation-specific --help
Add a detailed description to each of the operations. This description
replaces the general one when the operation specific help is displayed
(scylla sstable {operation} --help). The existing short description of
the operations is demoted to a summary and is made even shorter. This
will serve as the headline on the operation specific help page, as well
as the summary on the operation listing.
This allows the specifics of each operation to be detailed in length
instead of the terse summary that was available before.
2022-01-07 12:05:48 +02:00
Botond Dénes
51deb051d9 tools/scylla-sstable: proper operation-specific options
Operation-specific options are a mess currently. Some of them are in the
general options, all individual operations having to check for their
presence and warn if unsupported ones are set. These options were
general only when scylla-sstable had a single operation (dump). They
(most of them) became specific as soon as a second one was added.
Other specific options are in the awkward to use (both on the CLI
and in code) operation-specific option map.

This patch cleans this mess up. Each operation declares the option it
supports and these are only added to the command line when the specific
operation is chosen. General options now only contain options that are
truly universal.
As a result scylla-sstable has a operation-specific --help content now.
Operation-specific options are only printed when the operation is
selected:

    scylla sstable --help

will only print generic options, while:

    scylla sstable dump-data --help

will also print options specific to said operation. The description is
the same still, but this will be fixed in the next patch too.
2022-01-07 12:05:48 +02:00
Avi Kivity
bbad8f4677 replica: move ::database, ::keyspace, and ::table to replica namespace
Move replica-oriented classes to the replica namespace. The main
classes moved are ::database, ::keyspace, and ::table, but a few
ancillary classes are also moved. There are certainly classes that
should be moved but aren't (like distributed_loader) but we have
to start somewhere.

References are adjusted treewide. In many cases, it is obvious that
a call site should not access the replica (but the data_dictionary
instead), but that is left for separate work.

scylla-gdb.py is adjusted to look for both the new and old names.
2022-01-07 12:04:38 +02:00
Botond Dénes
9b5fa12c3d tools/scylla-sstable: s/dump/dump-data/
We now have dump-{component} for all sstable components, so rename dump
to dump-data to follow the established naming scheme and to clear any
possible confusion about what it dumps.
2022-01-07 11:23:54 +02:00