Commit Graph

32 Commits

Author SHA1 Message Date
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
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
Vladimir Krivopalov
ad2b9e44ee tests: Extend reader assertions to check clustering keys made full.
Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
2018-09-25 18:02:46 -07:00
Botond Dénes
eb357a385d flat_mutation_reader: make timeout opt-out rather than opt-in
Currently timeout is opt-in, that is, all methods that even have it
default it to `db::no_timeout`. This means that ensuring timeout is used
where it should be is completely up to the author and the reviewrs of
the code. As humans are notoriously prone to mistakes this has resulted
in a very inconsistent usage of timeout, many clients of
`flat_mutation_reader` passing the timeout only to some members and only
on certain call sites. This is small wonder considering that some core
operations like `operator()()` only recently received a timeout
parameter and others like `peek()` didn't even have one until this
patch. Both of these methods call `fill_buffer()` which potentially
talks to the lower layers and is supposed to propagate the timeout.
All this makes the `flat_mutation_reader`'s timeout effectively useless.

To make order in this chaos make the timeout parameter a mandatory one
on all `flat_mutation_reader` methods that need it. This ensures that
humans now get a reminder from the compiler when they forget to pass the
timeout. Clients can still opt-out from passing a timeout by passing
`db::no_timeout` (the previous default value) but this will be now
explicit and developers should think before typing it.

There were suprisingly few core call sites to fix up. Where a timeout
was available nearby I propagated it to be able to pass it to the
reader, where I couldn't I passed `db::no_timeout`. Authors of the
latter kind of code (view, streaming and repair are some of the notable
examples) should maybe consider propagating down a timeout if needed.
In the test code (the wast majority of the changes) I just used
`db::no_timeout` everywhere.

Tests: unit(release, debug)

Signed-off-by: Botond Dénes <bdenes@scylladb.com>

Message-Id: <1edc10802d5eb23de8af28c9f48b8d3be0f1a468.1536744563.git.bdenes@scylladb.com>
2018-09-20 11:31:24 +02:00
Tomasz Grabiec
604c8baed8 tests: flat_mutation_reader_assertions: Introduce produces(mutation_fragment)
Message-Id: <1531908313-29810-1-git-send-email-tgrabiec@scylladb.com>
2018-07-18 13:52:23 +01:00
Piotr Jastrzebski
176305c2f2 flat_mutation_reader_assertions: add more flexible asserts
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-06-07 23:39:51 +02:00
Paweł Dziepak
aa25f0844f atomic_cell: introduce fragmented buffer value interface
As a prepratation for the switch to the new cell representation this
patch changes the type returned by atomic_cell_view::value() to one that
requires explicit linearisation of the cell value. Even though the value
is still implicitly linearised (and only when managed by the LSA) the
new interface is the same as the target one so that no more changes to
its users will be needed.
2018-05-31 15:51:11 +01:00
Paweł Dziepak
93130e80fb atomic_cell: require column_definition for creating atomic_cell views 2018-05-31 15:51:11 +01:00
Piotr Jastrzebski
18cced2edc flat_mutation_reader_assertions: improve static row assertions
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-05-29 14:52:55 +02:00
Piotr Jastrzebski
0a5d06b2f3 flat_reader_assertions: Add produces_row taking column values
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-05-23 19:54:16 +02:00
Tomasz Grabiec
1039850515 tests: flat_reader_assertions: Improve failure message 2018-02-14 16:42:49 +01:00
Piotr Jastrzebski
b4cfe4dde2 flat_mutation_reader_assertions: add produces_compacted
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-01-24 20:54:44 +01:00
Piotr Jastrzebski
eeef0e0f07 Clean up imports in tests
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-01-19 09:30:57 +01:00
Piotr Jastrzebski
872b1c9122 Add flat_mutation_reader_assertions::is_buffer_full
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-01-19 08:56:37 +01:00
Piotr Jastrzebski
5a5a5149e3 Add flat_mutation_reader_assertions::fast_forward_to overload
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-01-19 08:56:37 +01:00
Piotr Jastrzebski
82bdc54588 Add flat_mutation_reader_assertions::produces_eos_or_empty_mutation
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-01-19 08:56:37 +01:00
Piotr Jastrzebski
f0716d34df Accept clustering_row_ranges in flat_mutation_reader_assertions::produces
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-01-19 08:56:37 +01:00
Piotr Jastrzebski
16e2bc8741 Add flat_mutation_reader_assertions::produces_range_tombstone
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2018-01-19 08:56:37 +01:00
Piotr Jastrzebski
20e31e462e Simplify flat_reader_assertions& produces(const mutation& m)
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-12-21 11:47:07 +01:00
Piotr Jastrzebski
ddecd385c1 Migrate test_partition_version_consistency_after_lsa_compaction_happens
to flat reader

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-12-21 11:47:07 +01:00
Piotr Jastrzebski
b18c075470 Add next_mutation() to flat_mutation_reader_assertions
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-12-21 11:47:07 +01:00
Paweł Dziepak
52c1e9fcf4 tests/flat_mutation_reader_assertions: add has_monotonic_positions()
has_monotonic_positions() verifies that the stream is monotonic.
Based on streamed_mutation_assertions::has_monotonic_positions().
2017-12-05 14:47:46 +00:00
Paweł Dziepak
5b6f680b45 tests/flat_mutation_reader_assertions: add produces(Range)
The assertions already have produces(mutation) and
produces(dht::decorated_key) overloads. Additional overload that accepts
a range of elements will allow to check if a range of mutations of
decorated keys is produced.
The same interface is exposed by mutation_reader_assertions.
2017-12-05 14:47:46 +00:00
Paweł Dziepak
ef4fa1a8c1 tests/flat_mutation_reader_assertions: add produces(mutation) 2017-12-05 14:47:31 +00:00
Paweł Dziepak
d2dfca458f tests/flat_mutation_reader_assertions: add produces(dht::decorated_key)
There is an equivalent member function in mutation_reader assertions.
2017-12-05 13:11:55 +00:00
Paweł Dziepak
28caa76c8c tests/flat_mutation_reader_assertions: add produces(mutation_fragment::kind)
produces(mutation_fragment::kind) is provided by
streamed_mutation_assertions and is going to be needed in order to
fully convert tests to the flat mutation readers.
2017-12-05 13:04:16 +00:00
Paweł Dziepak
21886b7a3f tests/flat_mutation_reader_assertions: fix fast forwarding
Both fast_forward_to() overloads return a future which should be waited
for. Additionally, fast_forward_to(const dht::partition_range&) expects
the range to remain valid at least until the next call to
fast_forward_to(). The original mutation_reader_assertions guaranteed
that and so should flat_mutation_reader_assertions.
2017-12-05 13:04:16 +00:00
Paweł Dziepak
15099a0e8c tests/flat_mutation_reader_assertion: add produces_partition() 2017-11-27 20:07:22 +01:00
Botond Dénes
a1a0d445d6 flat_mutation_reader_assertions: add fast_forward_to(position_range)
Signed-off-by: Botond Dénes <bdenes@scylladb.com>
Message-Id: <7b530909cf188887377aec3985f9f8c0e3b9b1e8.1511180262.git.bdenes@scylladb.com>
2017-11-20 13:35:57 +01:00
Paweł Dziepak
d23813cd41 tests/flat_mutation_reader_assertions: add fast_forward_to() 2017-11-13 16:49:52 +00:00
Piotr Jastrzebski
e7a0732f72 Add schema_ptr to flat_mutation_reader
It is usefull to have a schema inside a flat reader
the same way we had schema inside a streamed_mutation.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
Message-Id: <b37e0dbf38810c00bd27fb876b69e1754c16a89f.1510312137.git.piotr@scylladb.com>
2017-11-10 13:54:55 +01:00
Piotr Jastrzebski
1c9e4ba04c Add flat_mutation_reader_assertions
This will be usefull in tests.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-11-08 12:58:31 +01:00