Commit Graph

296 Commits

Author SHA1 Message Date
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
Avi Kivity
ae3a360725 database: Move database, keyspace, table classes to replica/ directory
The database, keyspace, and table classes represent the replica-only
part of the objects after which they are named. Reading from a table
doesn't give you the full data, just the replica's view, and it is not
consistent since reconciliation is applied on the coordinator.

As a first step in acknowledging this, move the related files to
a replica/ subdirectory.
2022-01-06 17:07:30 +02:00
Nadav Har'El
788b9c7bc0 dbuild: better documentation for how to use with ccache
dbuild's README contained some vague and very partial hints on how to use
ccache with dbuild. Replace them with more concrete instructions.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20211229180433.781906-1-nyh@scylladb.com>
2022-01-05 16:53:08 +02:00
Botond Dénes
015d09a926 tools: utils: add configure_tool_mode()
Which configures seastar to act more appropriate to a tool app. I.e.
don't act as if it owns the place, taking over all system resources.
These tools are often run on a developer machine, or even next to a
running scylla instance, we want them to be the least intrusive
possible.
Also use the new tool mode in the existing tools.

Signed-off-by: Botond Dénes <bdenes@scylladb.com>
Message-Id: <20211220143104.132327-1-bdenes@scylladb.com>
2022-01-05 15:33:57 +02:00
Avi Kivity
5eccb42846 Merge "Host tool executables in the scylla main executable" from Botond
"
A big problem with scylla tool executables is that they include the
entire scylla codebase and thus they are just as big as the scylla
executable itself, making them impractical to deploy on production
machines. We could try to combat this by selectively including only the
actually needed dependencies but even ignoring the huge churn of
sorting out our depedency hell (which we should do at one point anyway),
some tools may genuinely depend on most of the scylla codebase.

A better solution is to host the tool executables in the scylla
executable itself, switching between the actual main function to run
some way. The tools themselves don't contain a lot of code so
this won't cause any considerable bloat in the size of the scylla
executable itself.
This series does exactly this, folds all the tool executables into the
scylla one, with main() switching between the actual main it will
delegate to based on a argv[1] command line argument. If this is a known
tool name, the respective tool's main will be invoked.
If it is "server", missing or unrecognized, the scylla main is invoked.

Originally this series used argv[0] as the mean to switch between the
main to run. This approach was abandoned for the approach mentioned above
for the following reasons:
* No launcher script, hard link, soft link or similar games are needed to
  launch a specific tool.
* No packaging needed, all tools are automatically deployed.
* Explicit tool selection, no surprises after renaming scylla to
  something else.
* Tools are discoverable via scylla's description.
* Follows the trend set by modern command line multi-command or multi-app
  programs, like git.

Fixes: #7801

Tests: unit(dev)
"

* 'tools-in-scylla-exec-v5' of https://github.com/denesb/scylla:
  main,tools,configure.py: fold tools into scylla exec
  tools: prepare for inclusion in scylla's main
  main: add skeleton switching code on argv[1]
  main: extract scylla specific code into scylla_main()
2022-01-04 17:55:07 +02:00
Avi Kivity
e6f7ade60c Update tools/java submodule (python2 dependency)
* tools/java 8fae618f7f...6249bfbe2f (1):
  > dist/debian: replace "python (>=2.7)" with "python2"

Ref #9498.
2021-12-29 17:31:53 +02:00
Botond Dénes
bb0874b28b main,tools,configure.py: fold tools into scylla exec
The infrastructure is now in place. Remove the proxy main of the tools,
and add appropriate `else if` statements to the executable switch in
main.cc. Also remove the tool applications from the `apps` list and add
their respective sources as dependencies to the main scylla executable.
With this, we now have all tool executables living inside the scylla
main one.
2021-12-20 18:27:25 +02:00
Botond Dénes
0761113d8b tools: prepare for inclusion in scylla's main
Rename actual main to `${tool_name}_main` and have a proxy main call it.
In the next patch we will get rid of these proxy mains and the tool
mains will be invoked from scylla's main, if the `argv[0]` matches their
name.
The main functions are included in a new `tools/entry_point.hh` header.
2021-12-20 18:27:19 +02:00
Avi Kivity
e772fcbd57 Merge "Convert combined reader to v2" from Botond
"
Users are adjusted by sprinkling `upgrade_to_v2()` and
`downgrade_to_v1()` where necessary (or removing any of these where
possible). No attempt was made to optimize and reduce the amount of
v1<->v2 conversions. This is left for follow-up patches to keep this set
small.

The combined reader is composed of 3 layers:
1. fragment producer - pop fragments from readers, return them in batches
  (each fragment in a batch having the same type and pos).
2. fragment merger - merge fragment batches into single fragments
3. reader implementation glue-code

Converting layers (1) and (3) was mostly mechanical. The logic of
merging range tombstone changes is implemented at layer (2), so the two
different producer (layer 1) implementations we have share this logic.

Tests: unit(dev)
"

* 'combined-reader-v2/v4' of https://github.com/denesb/scylla:
  test/boost/mutation_reader_test: add test_combined_reader_range_tombstone_change_merging
  mutation_reader: convert make_clustering_combined_reader() to v2
  mutation_reader: convert position_reader_queue to v2
  mutation_reader: convert make_combined_reader() overloads to v2
  mutation_reader: combined_reader: convert reader_selector to v2
  mutation_reader: convert combined reader to v2
  mutation_reader: combined_reader: attach stream_id to mutation_fragments
  flat_mutation_reader_v2: add v2 version of empty reader
  test/boost/mutation_reader_test: clustering_combined_reader_mutation_source_test: fix end bound calculation
2021-12-20 14:01:03 +02:00
Botond Dénes
aeddcf50a1 mutation_reader: convert make_combined_reader() overloads to v2
Just sprinkle the right amount downgrade_to_v1() and upgrade_to_v2() to
call sites, no attempts at optimization was done.
2021-12-20 09:29:05 +02:00
Avi Kivity
7c23ed888d Update tools/jmx submodule (dropping unneeded dependencies)
* tools/jmx 2c43d99...53f7f55 (1):
  > pom.xml: drop unneeded logging dependencies
2021-12-16 21:54:36 +02:00
Avi Kivity
d768e9fac5 cql3, related: switch to data_dictionary
Stop using database (and including database.hh) for schema related
purposes and use data_dictionary instead.

data_dictionary::database::real_database() is called from several
places, for these reasons:

 - calling yet-to-be-converted code
 - callers with a legitimate need to access data (e.g. system_keyspace)
   but with the ::database accessor removed from query_processor.
   We'll need to find another way to supply system_keyspace with
   data access.
 - to gain access to the wasm engine for testing whether used
   defined functions compile. We'll have to find another way to
   do this as well.

The change is a straightforward replacement. One case in
modification_statement had to change a capture, but everything else
was just a search-and-replace.

Some files that lost "database.hh" gained "mutation.hh", which they
previously had access to through "database.hh".
2021-12-15 13:54:23 +02:00
Botond Dénes
04306d762f tools/scylla-sstables: remove unused variables and captures
Signed-off-by: Botond Dénes <bdenes@scylladb.com>
Message-Id: <20211210142949.527545-1-bdenes@scylladb.com>
2021-12-10 18:24:08 +03:00
Nadav Har'El
36c3b92b19 alternator, schema_loader: get rid of deprecation warnings
Seastar moved the read_entire_stream(), read_entire_stream_contiguous()
and skip_entire_stream() from the "httpd" namespace to the "util"
namespace. Using them with their old names causes deprecation warnings
when compiling alternator/server.cc.

This patch fixes the namespace (and adds the new include) to get rid of
the deprecation warnings.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20211209132759.1319420-1-nyh@scylladb.com>
2021-12-09 21:11:56 +03:00
Avi Kivity
965ea4a3fa Merge "tools/scylla-sstable: add dumpers for all components" from Botond
"
Except for TOC, Filter, Digest and CRC32, these are trivial to read with
any text/binary editor.
"

* 'scylla-sstable-dump-components' of https://github.com/denesb/scylla:
  tools/scylla-sstable: add --dump-scylla-metadata
  tools/scylla-sstable: add --dump-statistics
  tools/scylla-sstable: add --dump-summary
  tools/scylla-sstable: add --dump-compression-info
  tools/scylla-sstable: extract unsupported flag checking into function
  sstables/sstable: add scylla metadata getter
  sstables/sstable: add statistics accessor
2021-11-23 16:13:02 +02:00
Botond Dénes
f8a6857987 tools/scylla-sstable: add --dump-scylla-metadata
Dumps the scylla component.
2021-11-19 15:52:41 +02:00
Botond Dénes
a0d1c0948c tools/scylla-sstable: add --dump-statistics
Dumps the statistics component.
2021-11-19 15:52:41 +02:00
Botond Dénes
d3dbf1b0e4 tools/scylla-sstable: add --dump-summary
Dumps the summary component.
2021-11-19 15:52:41 +02:00
Botond Dénes
5f59aabc1b tools/scylla-sstable: add --dump-compression-info
Dump the compression-info component.
2021-11-19 15:52:41 +02:00
Botond Dénes
25e9e1f2d4 tools/scylla-sstable: extract unsupported flag checking into function
Some of the common flags are unsupported for dumping components other
than the data one. Currently this is checked in the only non-data
dumper: dump-index. Move this into a separate function in preparation of
adding dumpers for other components as well.
2021-11-19 15:52:41 +02:00
Benny Halevy
0a3d66839a tools: schema_loader: start a sharded erm_factory
This is required for an upcoming change to create effective_replication_map
on all shards in storage_service::replication_to_all_cores.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2021-11-19 10:52:41 +02:00
Benny Halevy
5947de7674 keyspace: get a reference to the erm_factory
To be used for creating effective_replication_map.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2021-11-19 10:46:51 +02:00
Botond Dénes
802e3642a0 Update tools/java submodule
* tools/java cb6c1d07a7...8fae618f7f (2):
  > removeNode: support ignoreNodes options
  > build: replace yum with dnf
2021-11-15 15:41:27 +02:00
Botond Dénes
f313706d80 Update tools/jmx submodule
* tools/jmx d6225c5...2c43d99 (2):
  > removeNode: support ignoreNodes options
  > build: replace yum with dnf
2021-11-15 15:41:27 +02:00
Avi Kivity
d949202615 Update tools/java submodule (PyYAML dependency removal)
* tools/java fd10821045...cb6c1d07a7 (1):
  > dist: remove unneeded dependency to PyYAML
2021-11-10 14:16:01 +02:00
Avi Kivity
c6ac1462c2 build, submodules: use utc for build datestamp
This helps keep packages built on different machines have the
same datestamp, if started on the same time.

* tools/java 05ec511bbb...fd10821045 (1):
  > build: use utc for build datestamp

* tools/jmx 48d37f3...d6225c5 (1):
  > build: use utc for build datestamp

* tools/python3 c51db54...8a77e76 (1):
  > build: use utc for build datestamp

[avi: commit own patches as this one requires excessive coordination
      across submodules, for something quite innocuous]

Ref #9563 (doesn't really fix it, but helps a little)
2021-11-07 15:58:48 +02:00
Avi Kivity
1d4f6498c8 Update tools/python3 submodule for .orig cleanup
* tools/python3 279aae1...c51db54 (1):
  > reloc: clean up '.orig' temporary directory before building deb package
2021-11-07 15:55:49 +02:00
Avi Kivity
15a80bb5ce Update tools/jmx submodule
* tools/jmx 5c383b6...48d37f3 (1):
  > StorageService: scrub: fix scrubMode is empty condition

Ref scylladb/scylla-jmx#180.
2021-11-02 15:21:31 +02:00
Benny Halevy
b79e9b7396 tools: scylla-sstable: improve error reporting when loading schema from file
Throw a proper exception from do_load_schemas if parse_statements
fails to parse the schema cql.

Catch it in scylla-sstable main() function so
it won't be reported as seastar - unhandled exception.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20211027124032.1787347-1-bhalevy@scylladb.com>
2021-10-28 08:58:25 +03:00
Benny Halevy
3393df45eb token_metadata, storage_service: unify token_metadata_lock and merge_lock.
Serialize the metadata changes with
keyspace create, update, or drop.

This will become necessary in the following patch
when we update the effective_replication_map
on all keyspaces and we want instances on all shards
end up with the same replication map.

Note that storage_service::keyspace_changed is called
from the scheme_merge path so it already holds
the merge_lock.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2021-10-13 13:01:25 +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
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
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
Raphael S. Carvalho
9067a13eac compaction: split compaction info and data for control
compaction_info must only contain info data to be exported to the
outside world, whereas compaction_data will contain data for
controlling compaction behavior and stats which change as
compaction progresses.
This separation makes the interface clearer, also allowing for
future improvements like removing direct references to table
in compaction.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
2021-09-30 13:16:57 -03:00
Avi Kivity
bf94c06fc7 Revert "Merge "simplifications and layer violation fix for compaction manager" from Raphael"
This reverts commit 7127c92acc, reversing
changes made to 88480ac504. We need to
revert b5cf0b4489 to fix #9388, and this stands
in the way.

Ref #9388.
2021-09-26 18:30:36 +03:00
Avi Kivity
2d352820f4 Update tools/java and tools/jmx submodules
* tools/java 9c5c0ad1fd...05ec511bbb (2):
  > reloc/build_reloc.sh: Add missing space
  > reloc: stop removing entire BUILDDIR

* tools/jmx 658818b...5c383b6 (1):
  > reloc: stop removing entire $BUILDDIR
2021-09-26 12:33:55 +03:00
Raphael S. Carvalho
5bf51ced14 compaction: split compaction info and data for control
compaction_info must only contain info data to be exported to the
outside world, whereas compaction_data will contain data for
controlling compaction behavior and stats which change as
compaction progresses.
This separation makes the interface clearer, also allowing for
future improvements like removing direct references to table
in compaction.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
2021-09-23 10:56:18 -03:00
Botond Dénes
bd8e2e6691 tools/utils.hh: make self-sufficient
Signed-off-by: Botond Dénes <bdenes@scylladb.com>
Message-Id: <20210915055910.167091-1-bdenes@scylladb.com>
2021-09-15 12:55:54 +03:00
Avi Kivity
64537beb38 Update tools/java submodule (nodetool stop reshape)
* tools/java 3b378f7095...9c5c0ad1fd (1):
  > nodetool stop: Support Reshape
2021-09-13 21:17:01 +03:00
Avi Kivity
1b75e9312d Update tools/java and tools/jmx submodules (load-and-stream support)
* tools/java a2fe67fd42...3b378f7095 (1):
  > nodetool: add `--load-and-stream` option to `refresh`

* tools/jmx 70b19e6...658818b (1):
  > Support `--load-and-stream` option from `nodetool refresh`
2021-09-13 18:48:11 +03:00
Botond Dénes
6e78e6c97f tools: remove scylla-sstable-index
It is replaced by scylla-sstable --dump-index.
2021-09-07 17:10:44 +03:00
Botond Dénes
2c600e34aa tools: introduce scylla-sstable
A tool which can be used to examine the content of sstable(s) and
execute various operations on them. The currently supported operations
are:
* dump - dumps the content of the sstable(s), similar to sstabledump;
* index-dump - dumps the content of the sstable index(es), similar to
  scylla-sstable-index;
* writetime-histogram - generates a histogram of all the timestamps in
  the sstable(s);
* custom - a hackable operation for the expert user (until scripting
  support is implemented);
* validate - validate the content of the sstable(s) with the mutation
  fragment stream validator, same as scrub in validate mode;
2021-09-07 17:10:44 +03:00
Botond Dénes
e86073c703 tools: extract finding selected operation (handler) into function
We want to use the pattern of having a command line flag for each
operation in more tools, so extract the logic which finds the selected
operation from the command line arguments into a function.
2021-09-07 15:47:22 +03:00
Botond Dénes
23a56beccc tools: add schema_loader
A utility which can load a schema from a schema.cql file. The file has
to contain all the "dependencies" of the table: keyspace, UDTs, etc.
This will be used by the scylla-sstable-crawler in the next patch.
2021-09-07 15:47:22 +03:00
Takuya ASADA
729d0feef0 install-dependencies.sh: add scylla-driver to relocatable python3
Pass --pip-packages option to tools/python3/reloc/build_reloc.sh,
add scylla-driver to relocatable python3 which required for
fix_system_distributed_tables.py.

[avi: regenrate toolchain]

Ref #9040
2021-09-02 11:52:47 +03:00
Beni Peled
4fe4aa190d dist-check: add podman support
...and use container term instead of docker

Closes #9265
2021-08-31 09:10:58 +03:00
Avi Kivity
3de5b849e0 Update tools/java submodule (JAVA8_HOME)
* tools/java 0b6ecbeb90...a2fe67fd42 (1):
  > build_reloc.sh: set JAVA8_HOME if not already set
2021-08-29 12:27:17 +03:00
Pekka Enberg
a53c1949cd Update tools/jmx submodule
* tools/jmx 5311e9b...70b19e6 (1):
  > scrub: support scrubMode and deprecate skipCorrupted
2021-08-26 12:27:13 +03:00
Pekka Enberg
bd8fa47d84 Update tools/java submodule
* tools/java 4ef8049e07...0b6ecbeb90 (1):
  > nodetool scrub: support --mode and deprecate --skip-corrupted
2021-08-26 11:07:14 +03:00
Benny Halevy
fe479aca1d reader_permit: add timeout member
To replace the timeout parameter passed
to flat_mutation_reader methods.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2021-08-24 14:29:44 +03:00