Commit Graph

17100 Commits

Author SHA1 Message Date
Rafael Ávila de Espíndola
e5c5afffc9 Check the exception message.
This makes the tests a bit more strict by also checking the message
returned by the what() function.

This shows that some of the tests are out of sync with which errors
they check for. I will hopefully fix this in another pass.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2018-12-03 12:31:53 -08:00
Rafael Ávila de Espíndola
f9d81bcd43 Move some tests to broken_sstable_test.cc
sstable_test.cc was already a bit too big and there is potential for
having a lot of tests about broken sstables.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2018-12-03 12:16:30 -08:00
Benny Halevy
d257e5c123 sstable: remove unused get_sstable_key_range
Since 024c8ef8a1
db: adjust sstable load to use sstable self-reporting of shard ownership

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20181202114523.14296-1-bhalevy@scylladb.com>
2018-12-02 18:32:34 +02:00
Avi Kivity
224c4c0b81 tools: add frozen toolchain support
Add a reference to a docker image that contains an "official" toolchain
for building Scylla. In addition, add a script that allows easy usage of
the image, and some documentation.
Message-Id: <20181202120829.21218-1-avi@scylladb.com>
2018-12-02 18:32:34 +02:00
Takuya ASADA
0fdf807f51 install-dependencies.sh: add missing packages to run build in Fedora container
git, python, sudo packages are installed by default on normal Fedora
installation but not in Docker image, we need to install it by this
script.

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <20181201020834.24961-1-syuu@scylladb.com>
2018-12-02 12:51:29 +02:00
Avi Kivity
009cbd3dcb Merge "Fix multiple summary regeneration bugs." from Vladimir
"
This patchset addresses two recently discovered bugs both triggered by
summary regeneration:

Tests: unit {release}

+

Validated with debug build of Scylla (ASAN) that no use-after-free
occurs when re-generating Summary.db.
"

* 'projects/sstables-30/summary-regeneration/v1' of https://github.com/argenet/scylla:
  tests: Add test reading SSTables in 'mc' format with missing summary.
  sstables: When loading, read statistics before summary.
  database: Capture io_priority_class by reference to avoid dangling ref.
2018-12-02 11:56:18 +02:00
Vladimir Krivopalov
d24875b736 tests: Add test reading SSTables in 'mc' format with missing summary.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-11-30 11:56:56 -08:00
Vladimir Krivopalov
b0e5404071 sstables: When loading, read statistics before summary.
In case if summary is missing and we attempt to re-generate it,
statistics must be already read to provide us with values stored in
serialization header to facilitate clustering prefixes deserialization.

Fixes #3947

Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-11-30 11:56:56 -08:00
Vladimir Krivopalov
68458148e7 database: Capture io_priority_class by reference to avoid dangling ref.
The original reference points to a thread-local storage object that
guaranteed to outlive the continuation, but copying it make the
subsequent calls point to a local object and introduces a use-after-free
bug.

Fixes #3948

Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-11-30 10:43:36 -08:00
Duarte Nunes
1afda28cf3 Merge 'Fix filtering with LIMIT' from Piotr
"
This series adds proper handling of filtering queries with LIMIT.
Previously the limit was erroneously applied before filtering,
which leads to truncated results.

To avoid that, paged filtering queries now use an enhanced pager,
which remembers how many rows dropped and uses that information
to fetch for more pages if the limit is not yet reached.

For unpaged filtering queries, paging is done internally as in case
of aggregations to avoid returning keeping huge results in memory.

Also, previously, all limited queries used the page size counted
from max(page size, limit). It's not good for filtering,
because with LIMIT 1 we would then query for rows one-by-one.
To avoid that, filtered queries ask for the whole page and the results
are truncated if need be afterwards.

Tests: unit (release)
"

* 'fix_filtering_with_limit_2' of https://github.com/psarna/scylla:
  tests: add filtering with LIMIT test
  tests: split filtering tests from cql_query_test
  cql3: add proper handling of filtering with LIMIT
  service/pager: use dropped_rows to adjust how many rows to read
  service/pager: virtualize max_rows_to_fetch function
  cql3: add counting dropped rows in filtering pager
2018-11-29 23:07:40 +00:00
Avi Kivity
2dba809844 Merge "scylla_io_setup: support multiple devices" from Benny
"
This patchset adds support to scylla_io_setup for
multiple data directories as well as commitlog,
hints, and saved_caches directories.

Refs #2415

Tests: manual testing with scylla-ccm generated scylla.yaml
"

* 'projects/multidev/v3' of https://github.com/bhalevy/scylla:
  scylla_io_setup: assume default directories under /var/lib/scylla
  scylla_io_setup: add support for commitlog, hints, and saved_caches directory
  scylla_io_setup: support multiple data directories
2018-11-29 16:44:33 +02:00
Piotr Sarna
7adbdaba0b tests: add filtering with LIMIT test
Refs #3902
2018-11-29 14:53:30 +01:00
Piotr Sarna
5f97c78875 tests: split filtering tests from cql_query_test
In order to avoid blowing cql_query_test even more out of proportions,
all filtering tests are moved to a separate file.
2018-11-29 14:53:30 +01:00
Piotr Sarna
acf4eadf88 cql3: add proper handling of filtering with LIMIT
Previously, limit was erroneously applied before filtering,
which might have resulted in truncated results.
Now, both paged and unpaged queries are filtered first,
and only after that properly trimmed so only X rows are returned
for LIMIT X.

Fixes #3902
2018-11-29 14:53:30 +01:00
Piotr Sarna
5b052bdae5 service/pager: use dropped_rows to adjust how many rows to read
Filtering pager may drop some rows and as a result return less
than what was fetched from the replica. To properly adjust how
many rows were actually read, dropped_rows variable is introduced.
2018-11-29 14:53:29 +01:00
Piotr Sarna
021caeddf7 service/pager: virtualize max_rows_to_fetch function
Regular pagers use max_rows to figure out how many rows to fetch,
but filtering pager potentially needs the whole page to be fetched
in order to filter the results.
2018-11-29 14:14:37 +01:00
Benny Halevy
5ec191536e scylla_io_setup: assume default directories under /var/lib/scylla
If a specific directory is not configure in scylla.yaml, scylla assumes
a default location under /var/lib/scylla.

Hard code these locations in scylla_io_setup until we have a better way
to probe scylla about it.

Be permissive and ignore the default directories if they don't not exist
on disk and silently ignore them.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2018-11-29 15:07:29 +02:00
Piotr Sarna
4f5ee3dfcd cql3: add counting dropped rows in filtering pager
Counter for dropped rows is added to the filtering pager.
This metrics can be used later to implement applying LIMIT
to filtering queries properly.
Dropped rows are returned on visitor::accept_partition_end.
2018-11-29 14:06:59 +01:00
Benny Halevy
88b85b363a scylla_io_setup: add support for commitlog, hints, and saved_caches directory
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2018-11-29 10:09:17 +02:00
Benny Halevy
e4382caa4a scylla_io_setup: support multiple data directories
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2018-11-29 10:09:17 +02:00
Dan Yasny
019a2e3a27 scylla_setup: Mark required args
Fixes #3945

Message-Id: <20181128220549.3083-1-dyasny@gmail.com>
2018-11-28 22:30:02 +00:00
Avi Kivity
de17150cb2 Update seastar submodule
* seastar 1fbb633...132e6cd (2):
  > scripts: json2code: port to Python 3
  > docker/dev/Dockerfile: add c-ares-devel to docker setup
2018-11-28 19:05:21 +02:00
Duarte Nunes
a589dade07 Merge 'Fix checking for multi-column restrictions in filtering' from Piotr
"
This series fixes #3891 by amending the way restrictions
are checked for filtering. Previous implementation that returned
false from need_filtering() when multi-column restrictions
were present was incorrect.
Now, the error is going to be returned from restrictions filter layer,
and once multi-column support is implemented for filtering, it will
require no further changes.

Tests: unit (release)
"

* 'fix_multi_column_filtering_check_3' of https://github.com/psarna/scylla:
  tests: add multi-column filtering check
  cql3: remove incorrect multi-column check
  cql3: check filtering restrictions only if applicable
  cql3: add pk/ck_restrictions_need_filtering()
2018-11-28 15:36:37 +00:00
Piotr Sarna
ae0ffa6575 tests: add multi-column filtering check
Multi-column restrictions filtering is not supported yet,
so a simple case to ensure that is added.
2018-11-28 13:58:16 +01:00
Piotr Sarna
0013929782 cql3: remove incorrect multi-column check
need_filtering() incorrectly returned false if multi-column restrictions
were present. Instead, these restrictions should be allowed to need
filtering.

Fixes #3891
2018-11-28 13:58:16 +01:00
Piotr Sarna
65f21cc518 cql3: check filtering restrictions only if applicable
Primary key restrictions should be checked only when they need
filtering - otherwise it's superfluous, since they were already
applied on query level.
2018-11-28 13:58:16 +01:00
Piotr Sarna
f59ddcab52 cql3: add pk/ck_restrictions_need_filtering()
These functions return true if partition/clustering key restriction
parts of statement restrictions require filtering.
2018-11-28 13:58:16 +01:00
Duarte Nunes
d09d4bbd91 Merge 'Fix checking if system tables need view updates' from Piotr
"
This miniseries ensures that system tables are not checked
for having view updates, because they never do.
What's more, distributed system table is used in the process,
so it's unsafe to query the table while streaming it.

Tests: unit (release), dtest(update_cluster_layout_tests.py:TestUpdateClusterLayout.simple_decommission_node_2_test)
"

* 'fix_checking_if_system_tables_need_view_updates_3' of https://github.com/psarna/scylla:
  streaming: don't check view building of system tables
  database: add is_internal_keyspace
  streaming: remove unused sstable_is_staging bool class
2018-11-28 10:00:34 +00:00
Piotr Sarna
8e6021dfa1 streaming: don't check view building of system tables
System tables will never need view building, and, what's more,
are actually used in the process of view build checking.
So, checking whether system tables need a view update path
is simplified to returning 'false'.
2018-11-28 09:21:56 +01:00
Piotr Sarna
1336b9ee31 database: add is_internal_keyspace
Similarly to is_system_keyspace, it will allow checking if a keyspace
is created for internal use.
2018-11-28 09:21:56 +01:00
Piotr Sarna
6ad2c39f88 streaming: remove unused sstable_is_staging bool class
sstable_is_staging bool class is not used anywhere in the code anymore,
so it's removed.
2018-11-28 09:21:56 +01:00
Duarte Nunes
9f639edaa2 Merge 'storage_proxy: fix some bugs in early (due to errors) request completion' from Gleb
"
The series fixed #3565 and #3566
"

* 'gleb/write_failure_fixes' of github.com:scylladb/seastar-dev:
  storage_proxy: store hint for CL=ANY if all nodes replied with failure
  storage_proxy: complete write request early if all replicas replied with success of failure
  storage_proxy: check that write failure response comes from recognized replica
  storage_proxy: move code executed on write timeout into separate function
2018-11-27 21:44:01 +00:00
Takuya ASADA
52f030806f install-dependencies.sh: fix dependency issues on Debian variants
Sync Debian variants dependencies with dist/debian/control.mustache
(before merging relocatable), use scylla 3rdparty packages.

Since we use 3rdparty repo on seastar/install-dependencies.sh, drop repo
setup part from this script.

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <20181031122800.11802-1-syuu@scylladb.com>
2018-11-27 21:44:01 +00:00
Gleb Natapov
17197fb005 storage_proxy: store hint for CL=ANY if all nodes replied with failure
Current code assumes that request failed if all replicas replied with
failure, but this is not true for CL=ANY requests. Take it into account.

Fixed: #3565
2018-11-27 15:06:37 +02:00
Gleb Natapov
d1d04eae3c storage_proxy: complete write request early if all replicas replied with success of failure
Currently if write request reaches CL and all replicas replied, but some
replied with failures, the request will wait for timeout to be retired.
Detect this case and retire request immediately instead.

Fixes #3566
2018-11-27 14:49:37 +02:00
Gleb Natapov
76ab3d716b storage_proxy: check that write failure response comes from recognized replica
Before accounting failure response we need to make sure it comes from a
replica that participates in the request.
2018-11-27 14:44:49 +02:00
Rafael Ávila de Espíndola
777ea893e6 Delete data_consume_rows_at_once.
As far as I can tell the old sstable reading code required reading the
data into a contiguous buffer. The function data_consume_rows_at_once
implemented the old behavior and incrementally code was moved away
from it.

Right now the only use is in two tests. The sstables used in those
tests are already used in other tests with data_consume_rows.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20181127024319.18732-2-espindola@scylladb.com>
2018-11-27 14:11:50 +02:00
Avi Kivity
1ff6b8fb96 Merge "Don't binary compare compressed sstables in test_write_many_partitions_* tests" from Piotr
"
Compression is not deterministic so instead of binary comparing the sstable files we just read data back
and make sure everything that was written down is still present.

Tests: unit(release)
"

* 'haaawk/binary-compare-of-compressed-sstables/v3' of github.com:scylladb/seastar-dev:
  sstables: Remove compressed parameter from get_write_test_path
  sstables: Remove unused sstable test files
  sstables: Ensure compare_sstables isn't used for compressed files
  sstables: Don't binary compare compressed sstables
  sstables: Remove debug printout from test_write_many_partitions
2018-11-27 14:01:20 +02:00
Duarte Nunes
098dd90bd2 Merge 'Reduce dependencies around consistency_level.hh' from Avi
"
consistency_level.hh is rather heavyweighy in both its contents and what it
includes. Reduce the number of inclusion sites and split the file to reduce
dependencies.
"

* tag 'cl-header/v2' of https://github.com/avikivity/scylla:
  consistency_level: simplify validation API
  Split consistency_level.hh header
  database: remove unneeded consistency_level.hh include
  cql: remove unneeded includes of consistency_level.hh
2018-11-27 11:59:34 +00:00
Piotr Jastrzebski
4366302c4c sstables: Extract mp_row_cosumer_m::check_schema_mismatch
This method will contain common logic used in multiple places
and reduce code duplication.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
Message-Id: <bbda2f4ea4f9325055f096dc549f63b1bb03d3b6.1543311990.git.piotr@scylladb.com>
2018-11-27 12:45:12 +01:00
Avi Kivity
4676e07400 consistency_level: simplify validation API
Remove unused parameters, replace refcounted pointers by references.
2018-11-27 13:41:49 +02:00
Avi Kivity
2c08bff8d5 Split consistency_level.hh header
It has two unrelated users: cql for validation, and storage_proxy for
complicated calculations. Split the simple stuff into a new header to reduce
dependencies.
2018-11-27 13:32:10 +02:00
Avi Kivity
b015f41344 database: remove unneeded consistency_level.hh include 2018-11-27 13:30:56 +02:00
Gleb Natapov
7bc68aa0eb storage_proxy: move code executed on write timeout into separate function
Currently the callback is in lambda, but we will want to call the code
not only during timer expiration.
2018-11-27 13:23:30 +02:00
Avi Kivity
9201d22c06 cql: remove unneeded includes of consistency_level.hh
Move the includes to .cc to reduce include pollution.
2018-11-27 13:18:33 +02:00
Raphael S. Carvalho
626afa6973 database: conditionally release sstable references from compaction manager
Not all compaction operations submitted through compaction manager sets a callback
for releasing references of exhausted sstables in compaction manager itself.
That callback lives in compaction descriptor which is passed to table::compaction().
Let's make the call conditional to avoid bad function call exceptions.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
Message-Id: <20181126235616.10452-1-raphaelsc@scylladb.com>
2018-11-27 12:10:43 +01:00
Avi Kivity
2eaeb3e4eb Update swagger-ui submodule
Updates to version 2.2.10 with a local change (from Amnon) to support our location.

Fixes #3942.
2018-11-27 13:01:02 +02:00
Tomasz Grabiec
17a8a9d13d gdb: Properly parse unique_ptr in 'scylla lsa'
There's no _M_t._M_head_impl any more in the standard library.

We now have std_unique_ptr wrapper which abstracts this fact away so
use that.

Message-Id: <20181126174837.11542-1-tgrabiec@scylladb.com>
2018-11-27 12:32:41 +02:00
Tomasz Grabiec
eecda72175 gdb: Adjust 'scylla lsa' for removal of emergency reserve
There's no _emergency_reserve any more. Show _free_segments instead.

Message-Id: <20181126174837.11542-2-tgrabiec@scylladb.com>
2018-11-27 12:32:37 +02:00
Avi Kivity
5e759b0c07 Merge "Optimize checksum computation for the MC sstable format" from Tomek
"
One part of the improvement comes from replacing zlib's CRC32 with the one
from libdeflate, which is optimized for modern architecture and utilizes the
PCLMUL instruction.

perf_checksum test was introduced to measure performance of various
checksumming operations.

Results for 514 B (relevant for writing with compression enabled):

    test                                      iterations      median         mad         min         max
    crc_test.perf_deflate_crc32_combine            58414    16.711us     3.483ns    16.708us    16.725us
    crc_test.perf_adler_combine                165788278     6.059ns     0.031ns     6.027ns     7.519ns
    crc_test.perf_zlib_crc32_combine               59546    16.767us    26.191ns    16.741us    16.801us
    ---
    crc_test.perf_deflate_crc32_checksum        12705072    83.267ns     4.580ns    78.687ns    98.964ns
    crc_test.perf_adler_checksum                 3918014   206.701ns    23.469ns   183.231ns   258.859ns
    crc_test.perf_zlib_crc32_checksum            2329682   428.787ns     0.085ns   428.702ns   510.085ns

Results for 64 KB (relevant for writing with compression disabled):

    test                                      iterations      median         mad         min         max
    crc_test.perf_deflate_crc32_combine            25364    38.393us    17.683ns    38.375us    38.545us
    crc_test.perf_adler_combine                169797143     5.842ns     0.009ns     5.833ns     6.901ns
    crc_test.perf_zlib_crc32_combine               26067    38.663us    95.094ns    38.546us    40.523us
    ---
    crc_test.perf_deflate_crc32_checksum          202821     4.937us    14.426ns     4.912us     5.093us
    crc_test.perf_adler_checksum                   44684    22.733us   206.263ns    22.492us    25.258us
    crc_test.perf_zlib_crc32_checksum              18839    53.049us    36.117ns    53.013us    53.274us

The new CRC32 implementation (deflate_crc32) doesn't provide a fast
checksum_combine() yet, it delegates to zlib so it's as slow as the latter.

Because for CRC32 checksum_combine() is several orders of magnitude slower
than checksum(), we avoid calling checksum_combine() completely for this
checksummer. We still do it for adler32, which has combine() which is faster
than checksum().

SStable write performance was evaluated by running:

  perf_fast_forward --populate --data-directory /tmp/perf-mc \
     --rows=10000000 -c1 -m4G --datasets small-part

Below is a summary of the average frag/s for a memtable flush. Each result is
an average of about 20 flushes with stddev of about 4k.

Before:

 [1] MC,lz4: 330'903
 [2] LA,lz4: 450'157
 [3] MC,checksum: 419'716
 [4] LA,checksum: 459'559

After:

 [1'] MC,lz4: 446'917 ([1] + 35%)
 [2'] LA,lz4: 456'046 ([2] + 1.3%)
 [3'] MC,checksum: 462'894 ([3] + 10%)
 [4'] LA,checksum: 467'508 ([4] + 1.7%)

After this series, the performance of the MC format writer is similar to that
of the LA format before the series.

There seems to be a small but consistent improvement for LA too. I'm not sure
why.
"

* tag 'improve-mc-sstable-checksum-libdeflate-v3' of github.com:tgrabiec/scylla:
  tests: perf: Introduce perf_checksum
  tests: Add test for libdeflate CRC32 implementation
  sstables: compress: Use libdeflate for crc32
  sstables: compress: Rename crc32_utils to zlib_crc32_checksummer
  licenses: Add libdeflate license
  Integrate libdeflate with the build system
  Add libdeflate submodule
  sstables: Avoid checksum_combine() for the crc32 checksummer
  sstables: compress: Avoid unnecessary checksum_combine()
  sstables: checksum_utils: Add missing include
2018-11-26 20:10:46 +02:00