Commit Graph

2653 Commits

Author SHA1 Message Date
Duarte Nunes
9464fffc8c tests/cql_query_test: Assert default compression options
Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2018-11-20 22:47:27 +00:00
Duarte Nunes
5f64e34fcc tests: Be explicit about absence of compression
Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2018-11-20 22:47:26 +00:00
Vladimir Krivopalov
759fbbd5f6 random_mutation_generator: Add row_marker to rows regardless of whether they're deleted.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
Message-Id: <f55b91f1349f0e98def6b7ca9755b5ccf4f48a3e.1542308626.git.vladimir@scylladb.com>
2018-11-16 13:17:07 +01:00
Duarte Nunes
6fbf792777 db/view/view_builder: Don't timeout waiting for view to be built
Remove the timeout argument to
db::view::view_builder::wait_until_built(), a test-only function to
wait until a given materialized view has finished building.

This change is motivated by the fact that some tests running on slow
environments will timeout. Instead of incrementally increasing the
timeout, remove it completely since tests are already run under an
exterior timeout.

Fixes #3920

Tests: unit release(view_build_test, view_schema_test)

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
Message-Id: <20181115173902.19048-1-duarte@scylladb.com>
2018-11-15 19:41:43 +02:00
Nadav Har'El
45f05b06d2 view_complex_test: fix another ttl
In a previous patch I fixed most TTLs in the view_complex_test.cc tests
from low numbers to 100 seconds. I missed one. This one never caused
problems in practice, but for good form, let's fix it too.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20181115160234.26478-1-nyh@scylladb.com>
2018-11-15 18:03:28 +02:00
Vladimir Krivopalov
51afb1d8bd tests: Generate deleted rows and shadowable tombstones in random_mutation_generator.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
Message-Id: <77e956890264023227e07cc6d295df870d0a5af2.1542295208.git.vladimir@scylladb.com>
2018-11-15 16:26:07 +01:00
Avi Kivity
0216f49bb0 Merge "Add filtering support for CONTAINS" from Piotr
"
This series enables filtering support for CONTAINS restriction.
"

* 'enable_filtering_for_contains_2' of https://github.com/psarna/scylla:
  tests: add CONTAINS test case to filtering tests
  cql3: enable filtering for CONTAINS restriction
  cql3: add is_satisfied_by(bytes_view) for CONTAINS
2018-11-15 16:49:29 +02:00
Nadav Har'El
4108458b8e view_complex_test: increase low ttl which may fail test on busy machine
Several of the tests in tests/view_complex_test.cc set a cell with a
TTL, and then skip time ahead artificially with forward_jump_clocks(),
to go past the TTL time and check the cell disappeared as expected.

The TTLs chosen for these tests were arbitrary numbers - some had 3 seconds,
some 5 seconds, and some 60 seconds. The actual number doesn't matter - it
is completely artificial (we move the clock with forward_jump_clocks() and
never really wait for that amount of time) and could very well be a million
seconds. But *low* numbers, like the 3 seconds, present a problem on extremely
overcomitted test machines. Our eventually() function already allows for
the possibility that things can hang for up to 8 seconds, but with a 3 second
TTL, we can find ourselves with data being expired and the test failing just
after 3 seconds of wall time have passed - while the test intended that the
dataq will expire only when we explicitly call forward_jump_clocks().

So this patch changes all the TTLs in this test to be the same high number -
100 seconds. This hopefully fixes #3918.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20181115125607.22647-1-nyh@scylladb.com>
2018-11-15 15:34:08 +02:00
Piotr Sarna
b04508041d tests: add CONTAINS test case to filtering tests 2018-11-14 16:08:19 +01:00
Avi Kivity
447f953a2c Merge "Add DEFAULT UNSET support to JSON" from Piotr
"
This series adds DEFAULT UNSET and DEFAULT NULL keyword support
to INSERT JSON statement, as stated in #3909.

Tests: unit (release)
"

* 'add_json_default_unset_2' of https://github.com/psarna/scylla:
  tests: add DEFAULT UNSET case to JSON cql tests
  tests: split JSON part of cql query test
  cql3: add DEFAULT UNSET to INSERT JSON
2018-11-13 09:14:50 -08:00
Piotr Sarna
fc4ecf9be4 tests: add DEFAULT UNSET case to JSON cql tests
A case covering DEFAULT UNSET/DEFAULT NULL params is added
to json cql query test suite.

Refs #3909
2018-11-13 18:06:15 +01:00
Piotr Sarna
cb6fd6a30d tests: split JSON part of cql query test
JSON part of cql query test is split into another file
to make cql_query_test.cc less huge.
2018-11-13 18:06:15 +01:00
Piotr Sarna
1724ee55c7 tests: add materialized views test
Right now materialized_views_test.cc contains view updating tests,
but the intention is to move mv-related tests from cql_query_test
here and use it for all future unit testing of MV.
2018-11-13 15:21:55 +01:00
Piotr Sarna
056a78bbc7 tests: add view update generator to cql test env
Keeping view update generator in cql test env enables
generating updates from staging sstables in tests.
2018-11-13 15:04:43 +01:00
Vladimir Krivopalov
69b453fb69 tests: Test writing empty static rows for partitions in tables with static columns.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-11-05 13:47:30 -08:00
Vladimir Krivopalov
f767dfbb33 sstables: Ignore empty static rows on reading.
Fixes #3900.

Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-11-05 13:47:30 -08:00
Vladimir Krivopalov
2ebab69ce7 mutation_source_test: Use counter and collection columns in static rows.
They are legal and should be covered along with atomic columns.

Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
Message-Id: <a1c0e0f8c0c0f12b68af6df426370511f4e1253b.1541106233.git.vladimir@scylladb.com>

[tgrabiec: fixed the patch title]
2018-11-02 10:33:27 +01:00
Avi Kivity
f70ece9f88 tests: convert sprint() to format()
sprint() recently became more strict, throwing on sprint("%s", 5). Replace
with the more modern format().

Mechanically converted with https://github.com/avikivity/unsprint.
2018-11-01 13:16:17 +00:00
Avi Kivity
8ca4b7abea tests: perf_fast_forward: rename "format" variable
The format local variable will soon alias with the format function which we
intend to use in the same context. Rename it away to avoid a clash.
2018-11-01 13:16:17 +00:00
Avi Kivity
7908f09148 tests: perf_fast_forward: massage result of sprint() into std::string
sprint() returns std::string(), but the new format() returns an sstring. Usually
an sstring is wanted but in this case an sstring will fail as it is added to
an std::string.

Fix the failure (after spring->format conversion) by converting to an std::string.
2018-11-01 13:16:17 +00:00
Yibo Cai (Arm Technology China)
79136e895f utils/crc: calculate crc in parallel
It achieves 2.0x speedup on intel E5 and 1.1x to 2.5x speedup on
various arm64 microarchitectures.

The algorithm cuts data into blocks of 1024 bytes and calculates crc
for each block, which is furthur divided into three subblocks of 336
bytes(42 uint64) each, and 16 remaining bytes(2 uint64).

For each iteration, three independent crc are caculated for one uint64
from each subgroup. It increases IPC(instructions per cycle) much.
After subblocks are done, three crc and remaining two uint64 are
combined using carry-less multiplication to reach the final result
for one block of 1024 bytes.

Signed-off-by: Yibo Cai <yibo.cai@arm.com>
Message-Id: <1541042759-24767-1-git-send-email-yibo.cai@arm.com>
2018-11-01 10:19:32 +02:00
Vladimir Krivopalov
d82ac02fad tests: Add test covering inverleaved atomic and collection cells in static row.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-10-29 15:01:34 -07:00
Vladimir Krivopalov
7bd95399ed tests: Add/fix comments to test_write_interleaved_atomic_and_collection_columns.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-10-29 15:00:55 -07:00
Avi Kivity
75dbff984c Merge "Re-order columns when reading/writing SSTables 3.x" from Vladimir
"
In Cassandra, row columns are stored in a BTree that uses the following
ordering on them:
    - all atomic columns go first, then all multi-cell ones
    - columns of both types (atomic and multi-cell) are
      lexicographically ordered by name regarding each other

Scylla needs to store columns and their respective indices using the
same ordering as well as when reading them back.

Fixes #3853

Tests: unit {release}

+

Checked that the following SSTables are dumped fine using Cassandra's
sstabledump:

cqlsh:sst3> CREATE TABLE atomic_and_collection3 ( pk int, ck int, rc1 text, rc2 list<text>, rc3 text, rc4 list<text>, rc5 text, rc6 list<text>, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''};
cqlsh:sst3> INSERT INTO atomic_and_collection3 (pk, ck, rc1, rc4, rc5) VALUES (0, 0, 'hello', ['beautiful','world'], 'here');
<< flush >>

sstabledump:

[
  {
    "partition" : {
      "key" : [ "0" ],
      "position" : 0
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 96,
        "clustering" : [ 0 ],
        "liveness_info" : { "tstamp" : "1540599270139464" },
        "cells" : [
          { "name" : "rc1", "value" : "hello" },
          { "name" : "rc5", "value" : "here" },
          { "name" : "rc4", "deletion_info" : { "marked_deleted" : "1540599270139463", "local_delete_time" : "1540599270" } },
          { "name" : "rc4", "path" : [ "45e22cb0-d97d-11e8-9f07-000000000000" ], "value" : "beautiful" },
          { "name" : "rc4", "path" : [ "45e22cb1-d97d-11e8-9f07-000000000000" ], "value" : "world" }
        ]
      }
    ]
  }
]
"

* 'projects/sstables-30/columns-proper-order/v1' of https://github.com/argenet/scylla:
  tests: Test interleaved atomic and multi-cell columns written to SSTables 3.x.
  sstables: Re-order columns (atomic first, then collections) for SSTables 3.x.
  sstables: Use a compound structure for storing information used for reading columns.
2018-10-28 10:56:09 +02:00
Rafi Einstein
32525f2694 Space-Saving Top-k algorithm for handling stream summary statistics
Based on the following implementation ([2]) for the Space-Saving algorithm from [1].
[1] http://www.cse.ust.hk/~raywong/comp5331/References/EfficientComputationOfFrequentAndTop-kElementsInDataStreams.pdf
[2] https://github.com/addthis/stream-lib/blob/master/src/main/java/com/clearspring/analytics/stream/StreamSummary.java

The algorithm keeps a map between keys seen and their counts, keeping a bound on the number of tracked keys.
Replacement policy evicts the key with the lowest count while inheriting its count, and recording an estimation
of the error which results from that.
This error estimation can be later used to prove if the distribution we arrived at corresponds to the real top-K,
which we can display alongside the results.
Accuracy depends on the number of tracked keys.

Introduced as part of 'nodetool toppartition' query implementation.

Refs #2811
Message-Id: <20181027220937.58077-1-rafie@scylladb.com>
2018-10-28 10:10:28 +02:00
Vladimir Krivopalov
f3dc2a4927 tests: Test interleaved atomic and multi-cell columns written to SSTables 3.x.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-10-26 16:58:34 -07:00
Vladimir Krivopalov
9843343ad8 tests: Add test for a static row with missing columns (SStables 3.x.).
This is a test case for #3892.

Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-10-25 17:16:31 -07:00
Tomasz Grabiec
dcac0ac80c tests: sstables: Verify no index reads during scans which dont need it
Reproducer for https://github.com/scylladb/scylla/issues/3868

Message-Id: <1540459849-27612-2-git-send-email-tgrabiec@scylladb.com>
2018-10-25 16:14:45 +03:00
Tomasz Grabiec
46d0c157ae tests: sstables: Extract make_sstable_mutation_source()
Message-Id: <1540459849-27612-1-git-send-email-tgrabiec@scylladb.com>
2018-10-25 16:14:39 +03:00
Duarte Nunes
e46ef6723b Merge seastar upstream
* seastar d152f2d...c1e0e5d (6):
  > scripts: perftune.py: properly merge parameters from the command line and the configuration file
  > fmt: update to 5.2.1
  > io_queue: only increment statistics when request is admitted
  > Adds `read_first_line.cc` and `read_first_line.hh` to CMake.
  > fstream: remove default extent allocation hint
  > core/semaphore: Change the access of semaphore_units main ctor

Due to a compile-time fight between fmt and boost::multiprecision, a
lexical_cast was added to mediate.

sprint("%s", var) no longer accepts numeric values, so some sprint()s were
converted to format() calls. Since more may be lurking we'll need to remove
all sprint() calls.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2018-10-25 12:53:30 +03:00
Avi Kivity
8210f4c982 Merge "Properly writing/reading shadowable deletions with SSTables 3.x." from Vladimir
"
This patchset adddresses two problems with shadowable deletions handling
in SSTables 3.x. ('mc' format).

Firstly, we previously did not set a flag indicating the presence of
extended flags byte with HAS_SHADOWABLE_DELETION bitmask on writing.
This would break subsequent reading and cause all types of failures up
to crash.

Secondly, when reading rows with this extended flag set, we need to
preserve that information and create a shadowable_tombstone for the row.

Tests: unit {release}
+

Verified manually with 'hexdump' and using modified 'sstabledump' that
second (shadowable) tombstone is written for MV tables by Scylla.

+
DTest (materialized_views_test.py:TestMaterializedViews.hundred_mv_concurrent_test)
that originally failed due to this issue has successfully passed locally.
"

* 'projects/sstables-30/shadowable-deletion/v4' of https://github.com/argenet/scylla:
  tests: Add tests writing both regular and shadowable tombstones to SSTables 3.x.
  tests: Add test covering writing and reading a shadowable tombstone with SSTables 3.x.
  sstables: Support Scylla-specific extension for writing shadowable tombstones.
  sstables: Introduce a feature for shadowable tombstones in Scylla.db.
  memtable: Track regular and shadowable tombstones separately in encoding_stats_collector.
  sstables: Error out when reading SSTables 3.x with Cassandra shadowable deletion.
  sstables: Support checking row extension flags for Cassandra shadowable deletion.
2018-10-24 18:20:16 +03:00
Paweł Dziepak
637b9a7b3b atomic_cell_or_collection: make operator<< show cell content
After the new in-memory representation of cells was introduced there was
a regression in atomic_cell_or_collection::operator<< which stopped
printing the content of the cell. This makes debugging more incovenient
are time-consuming. This patch fixes the problem. Schema is propagated
to the atomic_cell_or_collection printer and the full content of the
cell is printed.

Fixes #3571.

Message-Id: <20181024095413.10736-1-pdziepak@scylladb.com>
2018-10-24 13:29:51 +03:00
Raphael S. Carvalho
c958294991 tests/sstable_perf: fix compaction mode for a multi shard instance
Compaction mode fails if more than one shard is used because it doesn't
make sure sstables used as input for compaction only contain local keys.
Therefore, sstable generated by compaction has less keys than expected
because non-local keys are purged out.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
Message-Id: <20181022225153.12029-1-raphaelsc@scylladb.com>
2018-10-24 09:58:34 +03:00
Vladimir Krivopalov
ad599d4342 tests: Add tests writing both regular and shadowable tombstones to SSTables 3.x.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-10-23 16:30:42 -07:00
Vladimir Krivopalov
3dcf0acfc2 tests: Add test covering writing and reading a shadowable tombstone with SSTables 3.x.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-10-23 16:30:42 -07:00
Avi Kivity
1533487ba8 Merge "hinted handoff: give a sender a low priority" from Vlad
"
Hinted handoff should not overpower regular flows like READs, WRITEs or
background activities like memtable flushes or compactions.

In order to achieve this put its sending in the STEAMING CPU scheduling
group and its commitlog object into the STREAMING I/O scheduling group.

Fixes #3817
"

* 'hinted_handoff_scheduling_groups-v2' of https://github.com/vladzcloudius/scylla:
  db::hints::manager: use "streaming" I/O scheduling class for reads
  commitlog::read_log_file(): set the a read I/O priority class explicitly
  db::hints::manager: add hints sender to the "streaming" CPU scheduling group
2018-10-23 16:55:05 +00:00
Raphael S. Carvalho
65e8853e8d tests: test that sstable cleanup wont get rid of key which token belongs to node
Commit 1ce52d54 fixed sort order of local ranges, which is needed for cleanup to
work properly because it relies on that to perform a binary search.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
Message-Id: <20181023031322.22763-1-raphaelsc@scylladb.com>
2018-10-23 16:55:05 +00:00
Tomasz Grabiec
a34e417874 Merge "Stabilise perf_fast_forward results" from Paweł
his series attempts to make fragments per second results reported by
perf_fast_forward more stable. That includes running each test case
multiple time and reporting median, median average deviation, maximum
and minimum value. That should allow to relatively easily assess how
repeatable the presented results are. Moreover, since perf_fast_forward
does IO operation it is important that they do not introduce any
excessive noise to the results. The location of the data directory
is made configurable so that the user can choose less noisy disk or a
ramdisk.

 * github.com/pdziepak/scylla.git stabilise-perf_fast_forward/v3:
  tests/perf_fast_forward: make fragments/s measurements more stable
  tests/perf_fast_forward: make data directory location configurable
2018-10-22 18:33:25 +02:00
Avi Kivity
d5d831f41b tests: network_topology_strategy_test: remove quadratic complexity
network_topology_strategy test creates a ring with hundreds of tokens (and one
token per node). Then, for each token, it calls get_primary_ranges(), which in
turn walks the token ring. However, because the each datacenter occupies a
disjoint token range, this walk practically has to walk the entire ring until
it collects enough endpoints for each datacenter. The whole thing takes 15 minutes.

Speed this up by randomizing the token<->dc relationship. This is more realistic,
and switches the algorithm to be O(token count), and now it completes in less
than a minute (still not great, but better).
Message-Id: <20181022154026.19618-1-avi@scylladb.com>
2018-10-22 17:06:57 +01:00
Paweł Dziepak
63a705dca3 tests/perf_fast_forward: make data directory location configurable
perf_fast_forward populates perf_fast_forward_output with some data and
then runs performance tests that read it. That makes the disk a
significant factor in the final result and may make the results less
repeatable. This patch adds a flag that allows setting the location
of the data directory so that the user can opt for a less noisy disk
or a ramdisk.
2018-10-22 16:52:58 +01:00
Paweł Dziepak
29e872f865 tests/perf_fast_forward: make fragments/s measurements more stable
perf_fast_forward performs various operations, many of which involve
sstable reads and verifies the metrics that there weren't any
unnecessary IO operations. It also provides fragments per seconds
measurements for the tests it runs. However, since some of the tests are
very short and involve IO those values vary a lot what makes them not
very useful.

This commit attempts to stabilise those results. Each test case is run
multiple time (by default for a second, but at least 3 times) and shows
median, median absolute deviation, maximum and minimum value. This
should allow assessing whether the changes in the results are just noise
or a real regression or improvement.
2018-10-22 16:52:58 +01:00
George Kollias
c2343dc841 Make restricting reader fill_buffer more efficient
Currently, restricting_mutation_reader::fill_buffer justs reads
lower-layer reader's fragments one by one without doing any further
transformations. This change just swaps the parent-child buffers in a
single step, as suggested in #3604, and, hence, removing any possible
per-fragment overhead.

I couldn't find any test that exercises restricting_mutation_reader as
a mutation source, so I added test_restricted_reader_as_mutation_source
in mutation_reader_test.

Tests: unit (release), though these 4 tests are failing regardless of
my changes (they fail on master for me as well): snitch_reset_test,
sstable_mutation_test, sstable_test, sstable_3_x_test.

Fixes: #3604

Signed-off-by: George Kollias <georgioskollias@gmail.com>
Message-Id: <1540052861-621-1-git-send-email-georgioskollias@gmail.com>
2018-10-22 11:36:54 +03:00
Duarte Nunes
3fe92663d4 Merge 'Fix for a select statement with filtered columns' from Eliran
"
This patchset fixes #3803. When a select statement with filtering
is executed and the column that is needed for the filtering is not
present in the select clause, rows that should have been filtered out
according to this column will still be present in the result set.

Tests:
 1. The testcase from the issue.
 2. Unit tests (release) including the
 newly added test from this patchset.
"

* 'issues/3803/v10' of https://github.com/eliransin/scylla:
  unit test: add test for filtering queries without the filtered column
  cql3 unit test: add assertion for the number of serialized columns
  cql3: ensure retrieval of columns for filtering
  cql3: refactor find_idx to be part of statement restrictions object
  cql3: add prefix size common functionality to all clustering restrictions
  cql3: rename selection metadata manipulation functions
2018-10-21 09:53:37 +01:00
Eliran Sinvani
145f931ae7 unit test: add test for filtering queries without the filtered column
Test the usecase where the column that the filtering operates on
is not a part of the select clause. The expected result is a set
containing the columns of the select clause with the additional
columns for filtering marked as non serializable.

Signed-off-by: Eliran Sinvani <eliransin@scylladb.com>
2018-10-21 08:41:46 +03:00
Eliran Sinvani
86637a1d0d cql3 unit test: add assertion for the number of serialized columns
The result sets that the assertions are performed against
are result sets before serialization to the user and therefore
contain also columns that will not be serialized and sent as
the query's final result. The patch adds an assertion on the
number of columns that will be present in the final serialized
result.

Signed-off-by: Eliran Sinvani <eliransin@scylladb.com>
2018-10-21 08:41:46 +03:00
Tomasz Grabiec
fc37b80d24 Merge "Correctly handle dropped columns in SSTable 3" from Piotr J.
Previously we were making assumptions about missing columns
(the size of its value, whether it's a collection or a counter) but
they didn't have to be always true. Now we're using column type
from serialization header to use the right values.

Fixes #3859

* seastar-dev.git haaawk/projects/sstables-30/handling-dropped-columns/v4:
  sstables 3: Correctly handle dropped columns in column_translation
  sstables 3: Add test for dropped columns handling
2018-10-19 16:47:17 +00:00
Avi Kivity
1ce52d5432 locator: fix abstract_replication_strategy::get_ranges() and friends violating sort order
get_ranges() is supposed to return ranges in sorted order. However, a35136533d
broke this and returned the range that was supposed to be last in the second
position (e.g. [0, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9]). The broke cleanup, which
relied on the sort order to perform a binary search. Other users of the
get_ranges() family did not rely on the sort order.

Fixes #3872.
Message-Id: <20181019113613.1895-1-avi@scylladb.com>
2018-10-19 16:47:12 +00:00
Piotr Jastrzebski
e94254b563 sstables 3: Add test for dropped columns handling
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-10-18 19:13:58 +02:00
Vladimir Krivopalov
5b03fe7982 tests: Enable sstable_mutation_test for SSTables 'mc' format.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-10-12 14:18:15 +02:00
Piotr Jastrzebski
717cb2a9e7 sstables: Adopt test_clustering_slices test for SST3
Readers for SST3 return a bit more precise range tombstones
when reader is slicing. Namely, SST2 readers return whole
range tombstones that overlap with slicing range but SST3
trim those range tombstones to slicing range.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-10-11 15:47:47 +02:00