Commit Graph

17648 Commits

Author SHA1 Message Date
Piotr Jastrzebski
fc17bd376b Move "FrozenType(...)" addition to UDT name to user_type_impl
This logic belongs in types.hh/types.cc layer.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 12:07:47 +01:00
Piotr Jastrzebski
1fdfc461b8 Add "frozen<...>" to tuple CQL name only when it's frozen
At the moment Scylla supports only frozen tuples but
the code should be able to handle non-frozen tuples as well.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 11:14:30 +01:00
Piotr Jastrzebski
749eee2711 Move "frozen<...>" addition to tuple CQL name to tuple_type_impl
This logic belongs in types.hh/types.cc layer.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 11:14:30 +01:00
Piotr Jastrzebski
7aba17de2c Merge make_cql3_tuple_type into tuple_type_impl::as_cql3_type
This logic belongs in types.hh/types.cc layer.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 11:14:30 +01:00
Piotr Jastrzebski
56060573bb Add "frozen<...>" to UDT CQL name only when it's frozen
At the moment Scylla supports only frozen UDTs but
the code should be able to handle non-frozen UDTs as well.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 11:14:30 +01:00
Piotr Jastrzebski
a928c103c2 Move "frozen<...>" addition to UDT CQL name to user_type_impl
This logic belongs in types.hh/types.cc layer.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 11:09:00 +01:00
Benny Halevy
2dc3776407 sstables: mc: sign-extend serialization_header min_local_deletion_time_base and min_ttl_base
Refs #4074
Refs #3353

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20190110141439.1324-1-bhalevy@scylladb.com>
2019-01-10 16:23:20 +02:00
Gleb Natapov
a29182b447 sstable: fix use after free while applying extensions in sstable::open_file
sstable_file_io_extensions() return an array of pointers to extensions,
but do_for_each() may defer and the array will be destroyed. The match
keeps it alive until do_for_each completes.

Message-Id: <20190110125656.GC3172@scylladb.com>
2019-01-10 15:10:06 +02:00
Avi Kivity
b247ce01c3 table: restore indentation after changes to table::make_sstable_reader
Message-Id: <20190109175804.9352-2-avi@scylladb.com>
2019-01-10 13:00:53 +01:00
Avi Kivity
3d6be2f822 table: reduce duplication in table::make_sstable_reader
make_sstable_reader needs to deal with single-key and scanning reads, and
with restricting and non-restricting (in terms of read concurrency) readers.
Right now it does this combinatorically - there are separate cases for
restricting single-key reads, non-restricting single-key reads, restricing
scans, and non-restricting scans.

This makes further changes more complicated, so separate the two concepts.
The patch splits the code into two stages; the first selects between a single-key
and a scan, and the second selects between a restricting and non-restricting read.

This slightly pessimizes non-restricting reads (a mutation_source is created and
immediately destroyed), but that's not the common case.

Tests: unit(release)
Message-Id: <20190109175804.9352-1-avi@scylladb.com>
2019-01-10 13:00:40 +01:00
Benny Halevy
16dda033a5 sstables: row_marker: initialize _expiry
compare_row_marker_for_merge compares deletion_time also for row markers
that have missing timestamps.  This happened to succeed due to implicit
initialization to 0. However, we prefer the initialization to be explicit
and allow calling row_marker::deletion_time() in all states.

Fixes #4068

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20190110102949.17896-1-bhalevy@scylladb.com>
2019-01-10 12:45:07 +01:00
Avi Kivity
4a6aeced59 Merge "Fix UDTs representation in serialization header" from Piotr
"
Tests: unit(release)
"

Fixes #4073.

* commit 'FETCH_HEAD~1':
  Add test for serialization header with UDT
  Fix UDT names in serialization header
2019-01-10 12:57:11 +02:00
Piotr Jastrzebski
d4bc5b64cf Add test for serialization header with UDT
Serialization header stores column types for all
columns in sstable. If any of them is a UDT then it
has to be wrapped into
"org.apache.cassandra.db.marshal.FrozenType(...)".

This patch adds a test case to verify that.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-10 10:59:01 +01:00
Piotr Jastrzebski
3de85aebc9 Fix UDT names in serialization header
Serialization header stores type names of all
columns in a table. Including partition key columns,
clustering key columns, static columns and regular columns.

If one of those types is a user defined type then we need to
wrap its name into
"org.apache.cassandra.db.marshal.FrozenType(...)".

Fixes #4073

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-10 10:58:30 +01:00
Benny Halevy
60323b79d1 sstables: mc: sign-extend delta local_deletion_time and delta ttl
Follow Cassandra's encoding so that values that are less than the
baseline encoding_stats will wrap-around in 64-bits rather tham 32.

Fixes #4074
Refs #3353

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20190109192703.18371-1-bhalevy@scylladb.com>
2019-01-09 21:43:30 +02:00
Rafael Ávila de Espíndola
26ac2c23ef Change *_row_* names that refer to partitions
This renames some variables and functions to make it clear that they
refer to partitions and not rows.

Old versions of sstablemetadata used to refer to a row histogram, but
current versions now mention a partition histogram instead.

This patch doesn't change the exposed API names.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20181229223311.4184-2-espindola@scylladb.com>
2019-01-09 14:53:42 +02:00
Takuya ASADA
f00e9051ea reloc: show error message when relocatable package doesn't exist
Both build_rpm.sh/build_deb.sh are failing at beginning of the script
when relocatable package does not exist, need to prevent it and show
user friendly message.

Fixes #4071

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <20190109094353.16690-1-syuu@scylladb.com>
2019-01-09 12:53:08 +02:00
Raphael S. Carvalho
f5301990fc compaction: release reference of cleaned sstable in compaction manager
Compaction manager holds reference to all cleaning sstables till the very
end, and that becomes a problem because disk space of cleaned sstables
cannot be reclaimed due to respective file descriptors opened.

Fixes #3735.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
Message-Id: <20181221000941.15024-1-raphaelsc@scylladb.com>
2019-01-08 14:14:01 +02:00
Duarte Nunes
fa2b0384d2 Replace std::experimental types with C++17 std version.
Replace stdx::optional and stdx::string_view with the C++ std
counterparts.

Some instances of boost::variant were also replaced with std::variant,
namely those that called seastar::visit.

Scylla now requires GCC 8 to compile.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
Message-Id: <20190108111141.5369-1-duarte@scylladb.com>
2019-01-08 13:16:36 +02:00
Rafael Ávila de Espíndola
51a08c3240 sstable: remove constexpr from run time predicates
We never check these predicates at compile time.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20190108010055.92042-1-espindola@scylladb.com>
2019-01-08 12:28:42 +02:00
Piotr Sarna
c5346cdf9b database, table: split table-related code to table.cc
All table:: related code is moved to table.cc source file,
which splits database.cc size in half and thus allows
faster compilation on multiple cores.

Refs #1

Message-Id: <28e67f7793ff2147ffce18df5e0b077e14d3b8bd.1546940360.git.sarna@scylladb.com>
2019-01-08 12:02:42 +02:00
Avi Kivity
8ecb528d5a Update seastar submodule
* seastar 67fd967...af6b797 (1):
  > iotune: Initialize io_rates member variables

Fixes #4064
2019-01-08 12:02:42 +02:00
Avi Kivity
d8adbeda11 tests: mutation_source_test: generate valid utf-8 data
test_fast_forwarding_across_partitions_to_empty_range uses an uninitialized
string to populate an sstable, but this can be invalid utf-8 so that sstable
cannot be sstabledumped.

Make it valid by using make_random_string().

Fixes #4040.
Message-Id: <20190107193240.14409-1-avi@scylladb.com>
2019-01-08 12:02:42 +02:00
Asias He
1de24c8495 repair: Use mf.visit() in fragment_hasher
When new fragment type is added, it will fail to compile instead of
producing runtime errors.

Message-Id: <cf10200e4185c779aad15da3a776a5b79f5323af.1546930796.git.asias@scylladb.com>
2019-01-08 12:02:42 +02:00
Rafael Ávila de Espíndola
67039e942b Remove the only use of with_alignment from scylla
In c++17 there are standard ways of requesting aligned memory, so
seastar doesn't need to provide one.

This patch is in preparation for removing with_alignment from seastar.

Tests: unit (debug)

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20190107191019.22295-1-espindola@scylladb.com>
2019-01-07 21:34:47 +02:00
Rafael Ávila de Espíndola
0d4529a5f1 Change timeout to fix tests in a debug build
The current timeout is way too small for debug builds. Currently
jenkins runs avoid the problem by increasing the timeout by 100x. This
patch increases it by 10x, with seems to be sufficient to run the
tests in most desktop machines.

Message-Id: <20190107191413.22531-1-espindola@scylladb.com>
2019-01-07 21:34:06 +02:00
Avi Kivity
34251f5ea1 tools: toolchain: update image for all-user sudo 2019-01-07 21:22:42 +02:00
Takuya ASADA
3514b185fd tools: toolchain: allow sudo for all users
Non-privileged user may not belongs to "wheel" group, for example Debian
variants uses "sudo" group instead of "wheel".
To make sudo able to work on all environment we should allow sudo for
"ALL" instead of "wheel".

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <20190107173410.23140-1-syuu@scylladb.com>
2019-01-07 20:47:22 +02:00
Benny Halevy
40410465d7 sstables: mc: expired_liveness_ttl should be max int32_t rather than max uint32_t
Corresponding to Cassandra's EXPIRED_LIVENESS_TTL = Integer.MAX_VALUE;

Fixes #4060

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20190107172457.20430-1-bhalevy@scylladb.com>
2019-01-07 18:41:37 +01:00
Avi Kivity
20b6d00e56 tools: toolchain: support dbuild from subdirectory or parent directory of scylla.git
When building something other than Scylla (like scylla-tools-java or scylla-jmx)
it is convenient to run it from some other directory. To do that, allow running
dbuild from any directory (so we locate tools/toolchain/image relative to the
dbuild script rather than use a fixed path) and mount the current directory
since it's likely the user will want to access files there.
Message-Id: <20190107165824.25164-1-avi@scylladb.com>
2019-01-07 18:35:51 +01:00
Nadav Har'El
f6e0ce02fa docs/isolation.md: new document
Start a new document with an overview of isolation in Scylla, i.e.,
scheduling groups, I/O priority classes, controllers, etc.

As all documents in docs/, this is a document for developers (not users!)
who need to understand how isolation between different pieces of Scylla
(e.g., queries, compaction, repair, etc.) works, which scheduling groups
and I/O classes we have and why, etc.

The document is still very partial and includes a lot of TODOs on
places where the explanation needs to be expanded. In particular it
needs an accurate explanation (and not just a name) of what kind of
work is done under each of the groups and classes, and an explanation
of how we set up RPC to use which scheduling groups for the code it
executes.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20190103183232.21348-1-nyh@scylladb.com>
2019-01-07 17:48:35 +02:00
Nadav Har'El
da090a5458 materialized views: move hints to top-level directory
While we keep ordinary hints in a directory parallel to the data directory,
we decided to keep the materialized view hints in a subdirectory of the data
directory, named "view_pending_updates". But during boot, we expect all
subdirectories of data/ to be keyspace names, and when we notice this one,
we print a warning:

   WARN: database - Skipping undefined keyspace: view_pending_updates

This spurious warning annoyed users. But moreover, we could have bigger
problems if the user actually tries to create a keyspace with that name.

So in this patch, we move the view hints to a separate top-level directory,
which defaults to /var/lib/scylla/view_hints, but as usual can be configured.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20190107142257.16342-1-nyh@scylladb.com>
2019-01-07 16:43:43 +02:00
Takuya ASADA
eddecdd0b5 dist/redhat: drop unused dependencies
wget and yum-builddep are not used anymore, don't install them.

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <20190107091148.1590-7-syuu@scylladb.com>
2019-01-07 12:56:18 +00:00
Takuya ASADA
40dc62fa98 dist/debian: don't use sudo to rm debian dir
sudo does not allowed in dbuild with non-root privilege, and also it
should be owned by current user, stop using sudo.

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <20190107091148.1590-5-syuu@scylladb.com>
2019-01-07 12:56:18 +00:00
Takuya ASADA
237de20ff9 dist/debian: correct dbuild path
/usr/sbin/debuild is typo, should be /usr/bin.

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <20190107091148.1590-4-syuu@scylladb.com>
2019-01-07 12:56:17 +00:00
Pekka Enberg
2520c8caac Merge 'Improve frozen toolchain for continuous integration' from Avi
"Add features that are useful for continuous integration pipelines (and
also ordinary developers):

 - sudo support, with and without a tty, as our packaging scripts require it
 - install ccache package to allow reducing incremental build times
 - dependencies needed to build scylla-jmx and scylla-tools-java"

* tag 'toolchain-ci/v1' of https://github.com/avikivity/scylla:
  tools: toolchain: update image for ant, maven, ccache, sudo
  tools: toolchain: dbuild: pass-through supplementary groups
  tools: toolchain: defeat PAM
  tools: toolchain: improve sudo support
  tools: toolchain: break long line in dbuild
  tools: toolchain: prepare sudoers file
  tools: toolchain: install ccache
  install-dependencies.sh: add maven and ant
2019-01-07 12:56:17 +00:00
Pekka Enberg
9b27a3035c Merge 'Reduce inclusions of "database.hh"' from Avi
"This patchset reduces inclusions of database.hh, particularly in header
files. It reduces the number of objects depending on database.hh from 166
to 116.

Tests: unit(release), playing a little with tracing"

* tag 'database.hh/v1' of https://github.com/avikivity/scylla:
  streaming: stream_session: remove include of db/view/view_update_from_staging_generator.hh
  sstables: writer.hh: add some forward declarations
  table_helper: remove database.hh include
  table_helper: de-inline insert() and setup_keyspace()
  table_helper: de-template setup_keyspace()
  table_helper: simplify template body of table_helper::insert()
  schema_tables: remove #include of database.hh
  cql_type_parser: remove dependency on user_types_metadata
  thrift: add missing include of sleep.hh
  cql3: ks_prop_defs: remove #include "database.hh"
2019-01-07 12:56:17 +00:00
Benny Halevy
b017d87a43 tests: mc: add back missing sstable_3_x_test Statistics.db files
To be able to verify the golden version with sstabledump.
These files were generated by running sstable_3_x_test and keeping its
generated output files.

Refs #4043

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20190103112511.23488-2-bhalevy@scylladb.com>
2019-01-07 12:56:16 +00:00
Benny Halevy
517ad58823 tests: mc: delete empty line from write_static_row/mc-1-big-TOC.txt
Refs #4043

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20190103112511.23488-1-bhalevy@scylladb.com>
2019-01-07 12:56:16 +00:00
Nadav Har'El
b14616b879 docs/logging.md: improvements
Various small improvements to docs/logging.md:
1. Describe the options to log to stdout or syslog and their defaults.
2. Mention the possibility of using nodetool instead of REST API.
3. Additional small tweaks to formatting.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20190106111851.26700-1-nyh@scylladb.com>
2019-01-06 13:20:53 +02:00
Nadav Har'El
232e97ad06 docs/logging.md: new document
Add a new document about logging in Scylla, and how to change the log levels
when running Scylla and during the run.

It needs more developer-oriented information (e.g., how to create new logger
subsystems in the code) but I think it's a good start.

Some of the text is based on Glauber's writeup for the Scylla website on
changing log levels at runtime.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20190106103606.26032-1-nyh@scylladb.com>
2019-01-06 12:40:14 +02:00
Benny Halevy
2daf81e80f dist: redhat/debian specs: add dependency on 'file' package
Needed by seastar-addr2line

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20190101203434.14858-1-bhalevy@scylladb.com>
2019-01-06 12:13:08 +02:00
Avi Kivity
f02c64cadf streaming: stream_session: remove include of db/view/view_update_from_staging_generator.hh
This header, which is easily replaced with a forward declaration,
introduces a dependency on database.hh everywhere. Remove it and scatter
includes of database.hh in source files that really need it.
2019-01-05 17:33:25 +02:00
Avi Kivity
ca93b88cfb sstables: writer.hh: add some forward declarations
This makes the header less dependent on previously-included headers.
2019-01-05 17:04:16 +02:00
Avi Kivity
53a21c7787 table_helper: remove database.hh include 2019-01-05 16:39:26 +02:00
Avi Kivity
7534412071 table_helper: de-inline insert() and setup_keyspace()
After previous patches de-templated these functions, we can de-inline them.
This helps reduce compile time and prepares to reduce header dependencies.
2019-01-05 16:28:46 +02:00
Avi Kivity
cfedf4ab0f table_helper: de-template setup_keyspace()
This setup function has no reason to be a template and is easily
converted. We can then later de-inline it to reduce dependencies.
2019-01-05 16:23:10 +02:00
Avi Kivity
659147cd79 table_helper: simplify template body of table_helper::insert()
Move most of the body into a non-template overload to reduce dependencies
in the header (and template bloat). The function is not on any fast path,
and noncopyable_function will likely not even allocate anything.
2019-01-05 16:22:08 +02:00
Avi Kivity
c3ef99f84f schema_tables: remove #include of database.hh
Distribute in source files (and one header - table_helper.hh) that need it.
2019-01-05 15:43:07 +02:00
Avi Kivity
f43f82d1d2 cql_type_parser: remove dependency on user_types_metadata
A default parameter of type T (or lw_shared_ptr<T>) requires that T be
defined. Remove the depndency by redefining the default parameter
as an overload, for T = user_types_metadata.
2019-01-05 15:40:58 +02:00