Commit Graph

2801 Commits

Author SHA1 Message Date
Rafael Ávila de Espíndola
4de14e6143 Add tests on broken mc range tombstones.
This tests that we diagnose both two consecutive range starts and two
consecutive range ends.
Message-Id: <20181214212608.95452-1-espindola@scylladb.com>
2018-12-15 13:53:25 +01:00
Avi Kivity
b023e8b45d Merge " Extract MC sstable writer to a separate compilation unit" from Tomasz
"
The motivation is to keep code related to each format separate, to make it
easier to comprehend and reduce incremental compilation times.

Also reduces dependency on sstable writer code by removing writer bits from
sstales.hh.

The ka/la format writers are still left in sstables.cc, they could be also extracted.
"

* 'extract-sstable-writer-code' of github.com:tgrabiec/scylla:
  sstables: Make variadic write() not picked on substitution error
  sstables: Extract MC format writer to mc/writer.cc
  sstables: Extract maybe_add_summary_entry() out of components_writer
  sstables: Publish functions used by writers in writer.hh
  sstables: Move common write functions to writer.hh
  sstables: Extract sstable_writer_impl to a header
  sstables: Do not include writer.hh from sstables.hh
  sstables: mc: Extract bound_kind_m related stuff into mc/types.hh
  sstables: types: Extract sstable_enabled_features::all()
  sstables: Move components_writer to .cc
  tests: sstable_datafile_test: Avoid dependency on components_writer
2018-12-14 15:05:00 +02:00
Rafael Ávila de Espíndola
f48d54543f Use read_rows_flat to test broken sstables.
The previous code was using mp_row_consumer_k_l to be as close to the
tested code as possible.

Given that it is testing for an unhandled exception, there is probably
more value in moving it to a higher level, easier to use, API.

This patch changes it to use read_rows_flat().

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20181210235016.41133-1-espindola@scylladb.com>
2018-12-14 10:14:28 +01:00
Tomasz Grabiec
245a0d953a tests: cql_test_env: Start the compaction manager
Broken in fee4d2e

Not doing this results in compaction requests being ignored.

One effect of this is that perf_fast_forward produces many sstables instead of one.

Refs #3984
Refs #3983

Message-Id: <1544719540-10178-1-git-send-email-tgrabiec@scylladb.com>
2018-12-13 18:58:50 +02:00
Rafael Ávila de Espíndola
51fd880892 Add tests for broken start and end composite markers. 2018-12-13 10:29:44 +01:00
Tomasz Grabiec
eff47a59ee tests: sstable_datafile_test: Avoid dependency on components_writer
It's LA format specific and it's going to become private to sstable.cc
2018-12-12 12:06:22 +01:00
Nadav Har'El
a0379209e6 secondary indexes: fail attempts to create a CUSTOM INDEX
Cassandra supports a "CREATE CUSTOM INDEX" to create a secondary index
with a custom implementation. The only custom implementation that Cassandra
supports is SASI. But Scylla doesn't support this, or any other custom
index implementation. If a CREATE CUSTOM INDEX statement is used, we
shouldn't silently ignore the "CUSTOM" tag, we should generate an error.

This patch also includes a regression test that "CREATE CUSTOM INDEX"
statements with valid syntax fail (before this patch, they succeeded).

Fixes #3977

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20181211224545.18349-2-nyh@scylladb.com>
2018-12-11 23:33:02 +00:00
Tomasz Grabiec
1dd2bf52ca Merge "Add a couple of tests of broken sstables" From Rafael
These are the current uninteresting cases I found when looking at
malformed_sstable_exception. The existing code is working, just not
being tested.

* https://github.com/espindola/scylla.git espindola/espindola/broken-sst:
  Add a broken sstable test.
  Add a test with mismatched schema.
2018-12-10 19:30:58 +01:00
Tomasz Grabiec
538e041f22 Merge "Remove some dependencies on db::config" from Avi
db::config is a global class; changes in any module can cause changes
in db::config. Therefore, it is a cause of needless recompilation.

Remove some of these dependencies by having consumers of db::config
declare an intermediate config struct that is contains only
configuration of interest to them, and have their caller fill it out
(in the case of auth, it already followed this scheme and the patchset
only moves the translation function).

In addition, some outright pointless inclusions of db/config.hh are
removed.

The result is somewhat shorter compile times, and fewer needless
recompiles.

* https://github.com/avikivity/scylla unconfig-1/v1:
  config: remove inclusions of db/config.hh from header files
  repair: remove unneeded config.hh inclusion
  batchlog_manager: remove dependency on db::config
  auth: remove permissions_cache dependency on db::config
  auth: remove auth::service dependency on db::config
  auth: remove unneeded db/config.hh includes
2018-12-10 14:53:14 +01:00
Avi Kivity
475b151c97 Merge "Use utils::small_vector more in read path" from Paweł
"
This series optimises the read path by replacing some usages of
std::vector by utils::small_vector. The motivation for this change was
an observation that memory allocation functions are pointed out by the
profiler as the ones where we spent most time and while they have a
large number of callers storage allocation for some vectors was close to
the top. The gains are not huge, since the problem is a lot of things
adding up and not a single slow thing, but we need to start with
something.

Unfortunately, the performance of boost::container::small_vector is
quite disappointing so a new implementation of a small_vector was
introduced.

perf_simple_query -c4 --duration 60, medians:

       ./perf_before  ./perf_after  diff
 read      343086.80     360720.53  5.1%

Tests: unit(release, small_vector in debug)
"

* tag 'small_vector/v2.1' of https://github.com/pdziepak/scylla:
  partition_slice: use small_vector for column_ids
  mutation_fragment_merger: use small_vector
  auth: use small_vector in resource
  auth: avoid list-initialisation of vectors
  idl: serialiser: add serialiser for utils::small_vector
  idl: serialiser: deduplicate vector serialisers
  utils: introduce small_vector
  intrusive_set_external_comparator: make iterator nothrow move constructible
  mutation_fragment_merger: value-initialise iterator
2018-12-10 13:50:59 +02:00
Avi Kivity
904db433d9 Merge "Re-use commitlog segments" from Calle
"
Refs #3929

Enables re-use of commitlog segments.

First, ensures we never succeed playing back a commitlog
segment with name not matching the ID:s in the actual
file data, by determining expected id based on file name.
This will also handle partially written re-used files, as
each chunk headers CRC is dependent on the ID, and will
fail once we hit any left-overs.

Second part renamed and puts files into a recycle list
instead of actually deleting them when finished.
Allocating new files will the prioritize this list
before creating a new file.

Note that since consumtion and release of segments can
be somewhat unbalanced, this does not really guarantee
we will use recycled files even in all cases when it
might be possible, simply because of timing. It does
however give a good chance of it.

We limit recycled files based on the max disk size
setting, thus we can potentially grow disk size
more than without depending on timing, but not
uncontrolled.

While all this theoretially might improve disk
writes in some cases, it is far from any magic bullet.
No real performance testing has been done yet, only
functional.
"

* 'calle/commitlog-reuse' of github.com:scylladb/seastar-dev:
  commitlog: Recycle used segments instead of delete + new file
  commitlog: Terminate all segments with a zero chunk
  commitlog_replay: Enforce file name based id matching
2018-12-10 11:15:02 +02:00
Calle Wilund
b35af84599 commitlog_replay: Enforce file name based id matching
When reading the header chunk of a commitlog file, check the stored id
value against the id derived from the file name, and ignore if
mismatched. This is a prerequisite for re-using renamed commitlog files,
as we can then fail-fast should one such be left on disk, instead of
trying to replay it.

We also check said id via the CRC check for each chunk parsed. If we
find a chunk with
mismatched id, we will get a CRC error for the chunk, and replay will
terminate (albeit not gracefully).
2018-12-10 09:09:07 +00:00
Avi Kivity
40677fae37 Merge "Compaction strategy aware major compaction" from Raphael
"
Make major compaction aware of compaction strategy, by using an
optimal approach which suits the strategy needs.

Refs #1431.
"

* 'compaction_strategy_aware_major_compaction_v2' of github.com:raphaelsc/scylla:
  tests: add test for compaction-strategy-aware major compaction
  compaction: implement major compaction heuristic for leveled strategy
  compaction: introduce notion of compaction-strategy-aware major compaction
2018-12-10 10:10:22 +02:00
Avi Kivity
89be47e291 batchlog_manager: remove dependency on db::config
Extract configuration into a new struct batchlog_manager_config and have the
callers populate it using db::config. This reduces dependencies on global objects.
2018-12-09 20:11:38 +02:00
Avi Kivity
864f55e745 config: remove inclusions of db/config.hh from header files
Instead, distribute those inclusions to .cc files that require them. This
reduces rebuilds when config.hh changes, and makes it easier to locate files
that need config disaggregation.
2018-12-09 20:11:38 +02:00
Tomasz Grabiec
b78d98a358 tests: perf_fast_forward: Fix result_collector::add() for multi-element results
The results vector should be populated vertically, not horizontally.

Responsible for assertion failure with --cache-enabled:

  void result_collector::add(test_result_vector): Assertion `rs.size() == results.size()' failed.

Introduced in 3fc78a25bf.
Message-Id: <1544105835-24530-2-git-send-email-tgrabiec@scylladb.com>
2018-12-07 12:44:32 +00:00
Tomasz Grabiec
10cde9ae50 tests: perf_fast_forward: Fix live_range not being initialized
Broken in 470552b7ab

Causes test failure when running with --cache-enabled
Message-Id: <1544105835-24530-1-git-send-email-tgrabiec@scylladb.com>
2018-12-07 12:38:01 +00:00
Tomasz Grabiec
bb24d378b2 Merge "Fixes for collecting stats in SST3 + more tests" from Vladimir
This patchset fixes several remaining issues found during thorough
testing of SSTables 3.x statistics and enriches ~30 unit tests with
statistics validation against Cassandra-generated golden copies.

* https://github.com/argenet/scylla/tree/projects/sstables-30/sst3-tests-statistics/v1:
  sstables: Enforce estimated_partitions in generate_summary() to be
    always positive.
  sstables: Don't enforce default max_local_deletion_time value for 'mc'
    files.
  sstables: Update TTL/local deletion stats for non-expiring and live
    liveness_info.
  sstables: Collect statistics when writing RT markers to SSTables 3.x.
  tests: Return sstable_assertions from validate_read() helper.
  tests: Introduce helper for validating stats metadata in SSTables 3.x
    tests.
  tests: Add stats metadata validation to test_write_static_row.
  tests: Add stats metadata validation to
    test_write_composite_partition_key.
  tests: Add stats metadata validation to
    test_write_composite_clustering_key.
  tests: Add stats metadata validation to test_write_wide_partitions.
  tests: Add stats metadata validation to write_ttled_row
  tests: Add stats metadata validation to write_ttled_column
  tests: Add stats metadata validation to write_deleted_column
  tests: Add stats metadata validation to write_deleted_row
  tests: Add stats metadata validation to write_collection_wide_update
  tests: Add stats metadata validation to
    write_collection_incremental_update
  tests: Add stats metadata validation to write_multiple_partitions
  tests: Add stats metadata validation to write_multiple_rows
  tests: Add stats metadata validation to
    write_missing_columns_large_set
  tests: Add stats metadata validation to write_different_types
  tests: Add stats metadata validation to write_empty_clustering_values
  tests: Add stats metadata validation to write_large_clustering_key
  tests: Add stats metadata validation to write_compact_table
  tests: Add stats metadata validation to write_user_defined_type_table
  tests: Add stats metadata validation to write_simple_range_tombstone
  tests: Add stats metadata validation to
    write_adjacent_range_tombstones
  tests: Add stats metadata validation to
    write_non_adjacent_range_tombstones
  tests: Add stats metadata validation to
    write_mixed_rows_and_range_tombstones
  tests: Add stats metadata validation to
    write_adjacent_range_tombstones_with_rows
  tests: Add stats metadata validation to
    write_range_tombstone_same_start_with_row
  tests: Add stats metadata validation to
    write_range_tombstone_same_end_with_row
  tests: Add stats metadata validation to
    write_two_non_adjacent_range_tombstones
  tests: Delete unused (bogus) Statistics.db file from write_ SST3
    tests.
2018-12-07 12:05:55 +01:00
Vladimir Krivopalov
98ae39f920 tests: Delete unused (bogus) Statistics.db file from write_ SST3 tests.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
dcd639b4d5 tests: Add stats metadata validation to write_two_non_adjacent_range_tombstones
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
d07ab3b3ef tests: Add stats metadata validation to write_range_tombstone_same_end_with_row
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
b856cf837e tests: Add stats metadata validation to write_range_tombstone_same_start_with_row
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
ba24572fb6 tests: Add stats metadata validation to write_adjacent_range_tombstones_with_rows
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
4167c9e51d tests: Add stats metadata validation to write_mixed_rows_and_range_tombstones
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
fd1c9b84c6 tests: Add stats metadata validation to write_non_adjacent_range_tombstones
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
1a6d613654 tests: Add stats metadata validation to write_adjacent_range_tombstones
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
57d2d1a1c6 tests: Add stats metadata validation to write_simple_range_tombstone
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
bc5d5633dc tests: Add stats metadata validation to write_user_defined_type_table
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
d9f2829ca0 tests: Add stats metadata validation to write_compact_table
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
3a1e287c6a tests: Add stats metadata validation to write_large_clustering_key
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
722fc7222a tests: Add stats metadata validation to write_empty_clustering_values
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
1367243b7e tests: Add stats metadata validation to write_different_types
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
12b10c0cca tests: Add stats metadata validation to write_missing_columns_large_set
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
c990c518fc tests: Add stats metadata validation to write_multiple_rows
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
9bb46f7cc6 tests: Add stats metadata validation to write_multiple_partitions
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
99d3cbd2fc tests: Add stats metadata validation to write_collection_incremental_update
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
0118b15c06 tests: Add stats metadata validation to write_collection_wide_update
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
85782ed729 tests: Add stats metadata validation to write_deleted_row
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
66913adcc6 tests: Add stats metadata validation to write_deleted_column
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
997101f105 tests: Add stats metadata validation to write_ttled_column
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
a018388049 tests: Add stats metadata validation to write_ttled_row
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
260dfb3492 tests: Add stats metadata validation to test_write_wide_partitions.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
349a73c464 tests: Add stats metadata validation to test_write_composite_clustering_key.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
4f14e65d70 tests: Add stats metadata validation to test_write_composite_partition_key.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
a7b85e8009 tests: Add stats metadata validation to test_write_static_row.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
ccb2dec22b tests: Introduce helper for validating stats metadata in SSTables 3.x tests.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Vladimir Krivopalov
5f6240cd7d tests: Return sstable_assertions from validate_read() helper.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-12-06 16:40:27 -08:00
Rafael Ávila de Espíndola
298873d33b Add a test with mismatched schema.
The sstable in the test is fine, but the schema thinks a static column
is regular.
2018-12-06 15:38:01 -08:00
Rafael Ávila de Espíndola
d392bc4924 Add a broken sstable test.
This sstable has a static column with clustering information.
2018-12-06 15:23:33 -08:00
Raphael S. Carvalho
1ddbbe51e6 tests: add test for compaction-strategy-aware major compaction
Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
2018-12-06 18:37:16 -02:00