Commit Graph

17389 Commits

Author SHA1 Message Date
Paweł Dziepak
adcb3ec20c row_cache: read is not single-partition if inter-partition forwarding is enabled 2018-12-20 13:27:25 +00:00
Paweł Dziepak
7ecee197c4 row_cache: use make_forwardable() to implement streamed_mutation::forwarding
Implementing intra-partition fast-forwarding adds more complexity to
already very-much-not-trivial cache readers and isn't really critical in
any way since it is not used outside of the tests. Let's use the generic
adapter instead of natively implementing it.
2018-12-20 13:27:25 +00:00
Paweł Dziepak
e96a5f96d9 sstables: add more tracing in mp_row_consumer_m 2018-12-20 13:27:25 +00:00
Paweł Dziepak
18825af830 memtable: it is not a single partition read if partition fast-forwaring is enabled
Single-partition reader is less expensive than the one that accepts any
range of partitions, but it doesn't support fast-forwarding to another
partition range properly and therefore cannot be used if that option is
enabled.
2018-12-20 13:27:25 +00:00
Paweł Dziepak
bcb5aed1ef Revert "mutation_source_test: add option to skip intra-partition fast-forwarding tests"
This reverts commit b36733971b. That commit made
run_mutation_reader_tests() support  mutation_sources that do not implement
streamed_mutation::forwarding::yes. This is wrong since mutation_sources
are not allowed to ignore or otherwise not support that mode. Moreover,
there is absolutely no reason for them to do so since there is a
make_forwardable() adapter that can make any mutation_reader a
forwardable one (at the cost of performance, but that's not always
important).
2018-12-20 13:27:25 +00:00
Paweł Dziepak
8706750b9b tests/mutation_readers: do not ignore streamed_mutation::forwarding
It is wrong to silently ignore streamed_mutation::forwarding option
which completely changes how the reader is supposed to operate. The best
solution is to use make_forwardable() adapter which changes
non-forwardable reader to a forwardable one.
2018-12-20 13:27:25 +00:00
Paweł Dziepak
edf2c71701 tests/flat_mutation_reader_assertions: relax has_monotonic_positions() check
Since 41ede08a1d "mutation_reader: Allow
range tombstones with same position in the fragment stream" mutation
readers emit fragments in non-decreasing order (as opposed to strictly
increasing), has_monotonic_posiitons() needs to be updated to allow
that.
2018-12-20 13:27:25 +00:00
Paweł Dziepak
787d1ba7b2 tests/flat_mutation_reader_assertions: add more test messages 2018-12-20 13:27:25 +00:00
Paweł Dziepak
593fb936c2 tests/flat_mutation_reader_assertions: accumulate received tombstones
Current data model employed by mutation readers doesn't have an unique
representation of range tombstones. This complicates testing by making
multiple ways of emitting range tombstones and rows equally valid.

This patch adds an option to verify mutation readers by checking whether
tombstones they emit properly affect the clustered rows regardless of how
exactly the tombstones are emitted. The interface of
flat_mutation_reader_assertions is extended by adding
may_produce_tombstones() that accepts any number of tombstones and
accumulates them. Then, produces_row_with_key() accepts an additional
argument which is the expected timestamp of the range tombstone that
affects that row.
2018-12-20 13:27:25 +00:00
Amos Kong
385d74db01 redhat/scylla.spec: add python34-setuptools dependency
Commit 00476c3946 switched some scripts to python3, it introduced an
ImportError: No module named 'pkg_resources'.

Signed-off-by: Amos Kong <amos@scylladb.com>
Message-Id: <293c05d9315ec6c9da1f32e8cb3d2fdf8d8d3924.1545272049.git.amos@scylladb.com>
2018-12-20 06:32:36 +02:00
Duarte Nunes
122737a8ab Merge seastar upstream
* seastar 132e6cd...6c8c229 (3):
  > reactor: disable nowait aio due to a kernel bug
  > core/semaphore: Allow combining semaphore_units()
  > core/shared_ptr: Allow releasing a lw_shared_ptr to a non-const object

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
Message-Id: <20181217153241.67514-2-duarte@scylladb.com>
2018-12-19 12:57:07 +02:00
Duarte Nunes
bf05e59672 seastar: Change the source repository to scylla-seastar
Scylla is at the moment incompatible with the Seastar master branch,
so in order to allow Scylla commits that depend on Seastar patches,
we change the submodule to point to scylla-seastar and use a branch
(master-20181217) to hold these dependent commits.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
Message-Id: <20181217153241.67514-1-duarte@scylladb.com>
2018-12-19 12:57:03 +02:00
Rafael Ávila de Espíndola
ff18c837b7 tests: Add missing include in random-utils.hh
This file uses std::cout and so should include <iostream>.

Found with a patch to seastar that removes some redundant <iostream>
includes.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20181218183816.34504-1-espindola@scylladb.com>
2018-12-19 10:52:19 +00:00
Avi Kivity
dd51c659f7 config: remove "to be removed before release" notice mc sstable config
The "enable_sstables_mc_format" config item help text wants to remove itself
before release. Since scylla-3.0 did not get enough mc format mileage, we
decided to leave it in, so the notice should be removed.

Fixes #4003.
Message-Id: <20181219082554.23923-1-avi@scylladb.com>
2018-12-19 09:39:29 +00:00
Duarte Nunes
a7456db687 Merge 'Simplify natural endpoint calculation' from Calle
"
Implementation of origin change c000da13563907b99fe220a7c8bde3c1dec74ad5

Modifies network topology calculation, reducing the amount of
maps/sets used by applying the knowledge of how many replicas we
expect/need per dc and sharing endpoint and rack set (since we cannot have
overlaps).

Also includes a transposed origin test to ensure new calculation
matches the old one.

Fixes #2896
"

* 'calle/network_topology' of github.com:scylladb/seastar-dev:
  network_topology_test: Add test to verify new algorith results equals old
  network_topology_strategy: Simplify calculate_natural_endpoints
  token_metadata: Add "get_location" ip to dc+rack accessor
  sequenced_set: Add "insert" method, following std::set semantics
2018-12-19 09:39:29 +00:00
Rafael Ávila de Espíndola
b93d8d863d Add a test with mismatched timestamps.
Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20181218035931.3554-1-espindola@scylladb.com>
2018-12-18 11:30:56 +01:00
Duarte Nunes
1f578be187 Merge 'Fix evictable shard reader related issues' from Botond
"
Recently some additional issues were discovered related to recent
changes to the way inactive readers are evicted and making shard readers
evictable.
One such issue is that the `querier_cache` is not prepared for the
querier to be immediately evicted by the reader concurrency semaphore,
when registered with it as an inactive read (#3987).
The other issue is that the multishard mutation query code was not
fully prepared for evicted shard readers being re-created, or failing
why being re-created (#3991).

This series fixes both of these issues and adds a unit test which covers
the second one. I am working on a unit test which would cover the second
issue, but it's proving to be a difficult one and I don't want to delay
the fixes for these issues any longer as they also affect 3.0.

Fixes: #3987
Fixes: #3991

Tests: unit(release, debug)
"

* 'evictable-reader-related-issues/v2' of https://github.com/denesb/scylla:
  multishard_mutation_query: reset failed readers to inexistent state
  multishard_mutation_query: handle missing readers when dismantling
  multishard_mutation_query: add support for keeping stats for discarded partitions
  multishard_mutation_query: expect evicted reader state when creating reader
  multishard_mutation_query: pretty-print the reader state in log messages
  querier_cache: check that the query wasn't evicted during registering
  reader_concurrency_semaphore: use the correct types in the constructor
  reader_concurrency_semaphore: add consume_resources()
  reader_concurrency_semaphore::inactive_read_handle: add operator bool()
2018-12-17 15:36:23 +00:00
Calle Wilund
e353a8633a network_topology_test: Add test to verify new algorith results equals old
Transposed from origin unit test.

Creates a semi-random topology of racks, dcs, tokens and replication
factors and verifies endpoint calculation equals old algo.
2018-12-17 13:10:59 +00:00
Calle Wilund
bfc6c89b00 network_topology_strategy: Simplify calculate_natural_endpoints
Fixes #2896 (hopefully)

Implementation of origin change c000da13563907b99fe220a7c8bde3c1dec74ad5

Reduces the amount of maps and sets and general complexity of
endpoint calculation by simply mapping dc:s to expected node
counts, re-using endpoint sets and iterate thusly.

Tested with transposed origin unit test comparing old vs. new
algo results. (Next patch)
2018-12-17 13:10:59 +00:00
Botond Dénes
b4c3aab4a7 multishard_mutation_query: reset failed readers to inexistent state
When attempting to dismantling readers, some of the to-be-dismantled
readers might be in a failed state. The code waiting on the reader to
stop is expecting failures, however it didn't do anything besides
logging the failure and bumping a counter. Code in the lower layers did
not know how to deal with a failed reader and would trigger
`std::bad_variant_access` when trying to process (save or cleanup) it.
To prevent this, reset the state of failed readers to `inexistent_state`
so code in the lower layers doesn't attempt to further process them.
2018-12-17 13:18:08 +02:00
Botond Dénes
9cef043841 multishard_mutation_query: handle missing readers when dismantling
When dismantling the combined buffer and the compaction state we are no
longer guaranteed to have the reader each partition originated from. The
reader might have been evicted and not resumed, or resuming it might
have failed. In any case we can no longer assume the originating reader
of each partition will be present. If a reader no longer exists,
discard the partitions that it emitted.
2018-12-17 13:18:08 +02:00
Botond Dénes
438bef333b multishard_mutation_query: add support for keeping stats for discarded partitions
In the next patches we will add code that will have to discard some of
the dismantled partitions/fragments/bytes. Prepare the
`dismantle_buffer_stats` struct for being able to track the discarded
partitions/fragments/bytes in addition to those that were successfully
dismantled.
2018-12-17 13:18:08 +02:00
Botond Dénes
ce52436af4 multishard_mutation_query: expect evicted reader state when creating reader
Previously readers were created once, so `make_remote_reader()` had a
validation to ensure readers were not attempted at being created more
than once. This validation was done by checking that the reader-state is
either `inexistent` or `successful_lookup`. However with the
introduction of pausing shard readers, it is now possible that a reader
will have to be created and then re-created several times, however this
validation was not updated to expect this.
Update the validation so it also expects the reader-state to be
`evicted`, the state the reader will be if it was evicted while paused.
2018-12-17 13:18:08 +02:00
Botond Dénes
1effb1995b multishard_mutation_query: pretty-print the reader state in log messages 2018-12-17 13:18:08 +02:00
Botond Dénes
5780f2ce7a querier_cache: check that the query wasn't evicted during registering
The reader concurrency semaphore can evict the querier when it is
registered as an inactive read. Make the `querier_cache` aware of this
so that it doesn't continue to process the inserted querier when this
happens.
Also add a unit test for this.
2018-12-17 13:18:08 +02:00
Botond Dénes
e1d8237e6b reader_concurrency_semaphore: use the correct types in the constructor
Previously there was a type mismatch for `count` and `memory`, between
the actual type used to store them in the class (signed) and the type
of the parameters in the constructor (unsigned).
Although negative numbers are completely valid for these members,
initializing them to negative numbers don't make sense, this is why they
used unsigned types in the constructor. This restriction can backfire
however when someone intends to give these parameters the maximum
possible value, which, when interpreted as a signed value will be `-1`.
What's worse the caller might not even be aware of this unsigned->signed
conversion and be very suprised when they find out.
So to prevent surprises, expose the real type of these members, trusting
the clients of knowing what they are doing.

Also add a `no_limits` constructor, so clients don't have to make sure
they don't overflow internal types.
2018-12-17 13:18:08 +02:00
Botond Dénes
dfd649a6b4 reader_concurrency_semaphore: add consume_resources() 2018-12-17 13:18:08 +02:00
Botond Dénes
21b44adbfe reader_concurrency_semaphore::inactive_read_handle: add operator bool() 2018-12-17 13:18:08 +02:00
Amnon Heiman
571755e117 node-exporter.service: Update command line to fix service startup
The upgrade to node_exporter 0.17 commit
09c2b8b48a ("node_exporter_install: switch
to node_exporter 0.17") caused the service to no longer start. Turns out
node_exported broke backwards compatibility of the command line between
0.15 to 0.16. Fix it up.

While fixing the command line, all the collector that are enabled by
default were removed.

Fixes #3989

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
[ penberg@scylladb.com: edit commit message ]
Message-Id: <20181213114831.27216-1-amnon@scylladb.com>
2018-12-17 10:22:17 +02:00
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
Duarte Nunes
224821303c Merge 'Reduce the dependency on database.hh' from Botond
"
Working on database.hh or any header that is included in database.hh
(of which there is a lot), is a major pain as each change involves the
recompilation of half of our compilation units.
Reduce the impact by removing the `#include "database.hh"` directive
from as many header files as possible. Many headers can make do with
just some forward declarations and don't need to include the entire
headers. I also found some headers that included database.hh without
actually needing it.

Results

Before:
    $ touch database.hh
    $ ninja build/release/scylla
    [1/154] CXX build/release/gen/cql3/CqlParser.o

After:
    $ touch database.hh
    $ ninja build/release/scylla
    [1/107] CXX build/release/gen/cql3/CqlParser.o
"

* 'reduce-dependencies-on-database-hh/v2' of https://github.com/denesb/scylla:
  treewide: remove include database.hh from headers where possible
  database_fwd.hh: add keyspace fwd declaration
  service/client_state: de-inline set_keyspace()
  Move cache_temperature into its own header
2018-12-14 12:24:48 +00:00
Piotr Sarna
63bd43e57e cql3: add refusing to create an index on static column
Secondary indexes on static columns are not yet supported,
so creating such index should return an appropriate error.

Fixes #3993
Message-Id: <700b0a71e80da52d2d5250edacc12626b55681fa.1544785127.git.sarna@scylladb.com>
2018-12-14 11:15:28 +00: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
Botond Dénes
1865e5da41 treewide: remove include database.hh from headers where possible
Many headers don't really need to include database.hh, the include can
be replaced by forward declarations and/or including the actually needed
headers directly. Some headers don't need this include at all.

Each header was verified to be compilable on its own after the change,
by including it into an empty `.cc` file and compiling it. `.cc` files
that used to get `database.hh` through headers that no longer include it
were changed to include it themselves.
2018-12-14 08:03:57 +02:00
Botond Dénes
efe2b2c75d database_fwd.hh: add keyspace fwd declaration 2018-12-14 08:03:57 +02: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
Piotr Sarna
6743af5dbd cql3: refuse to create index on COMPACT STORAGE with ck
To follow C* compatibility, creating an index on COMPACT STORAGE
table should be disallowed not only on base primary keys,
but also when the base table contains clustering keys.
Message-Id: <ab40c39730aff2e164d11ee5159ff62b8ec9e8e8.1544698186.git.sarna@scylladb.com>
2018-12-13 13:39:12 +00:00
Duarte Nunes
f8878238ed service/storage_proxy: Embed the expire timer in the response handler
Embedding the expire timer for a write response in the
abstract_write_response_handler simplifies the code as it allows
removing the rh_entry type.

It will also make the timeout easily accessible inside the handler,
for future patches.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
Message-Id: <20181213111818.39983-1-duarte@scylladb.com>
2018-12-13 14:25:21 +02:00
Tomasz Grabiec
3889b05d7e Merge "Tests and small fixes for composite markers" from Rafael
* https://github.com/espindola/scylla espindola/add-composite-tests:
  Remove newline from exception messages.
  Fix end marker exception message.
  Add tests for broken start and end composite markers.
2018-12-13 10:29:44 +01:00
Rafael Ávila de Espíndola
51fd880892 Add tests for broken start and end composite markers. 2018-12-13 10:29:44 +01:00
Rafael Ávila de Espíndola
64439f6477 Fix end marker exception message.
The code tested the end marker, but the exception mentioned the start
marker.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2018-12-13 10:29:44 +01:00
Rafael Ávila de Espíndola
cfd07185b7 Remove newline from exception messages.
They are inconsistent with other uses of malformed_sstable_exception
and incompatible with adding " in sstable ..." to the message.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2018-12-13 10:29:44 +01:00
Vlad Zolotarov
7da1ac2c2c large_partition_handler: fix the message
We currently detect large partitions - not rows. So this is what we
should be reporting.

Fixes #3986

Signed-off-by: Vlad Zolotarov <vladz@scylladb.com>
Message-Id: <20181212215506.9879-1-vladz@scylladb.com>
2018-12-13 00:11:27 +00:00
Rafael Ávila de Espíndola
894f07f912 Move default case out of two switches.
These switches are fully covered, having the default label disables
-Wswitch.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20181212160904.17341-1-espindola@scylladb.com>
2018-12-12 18:20:24 +01:00
Botond Dénes
10336c13fc service/client_state: de-inline set_keyspace() 2018-12-12 18:14:03 +02:00
Botond Dénes
76fe4ebc18 Move cache_temperature into its own header
Some headers need to include database.hh just because of
cache_temperature. Move it into its own header so these includes can be
removed.
2018-12-12 16:03:45 +02:00
Tomasz Grabiec
0a853b8866 sstables: index_reader: Avoid schema copy in advance_to()
Introduced in 7e15e43.

Exposed by perf_fast_forward:

  running: large-partition-skips on dataset large-part-ds1
  Testing scanning large partition with skips.
  Reads whole range interleaving reads with skips according to read-skip pattern:
  read    skip      time (s)     frags     frag/s (...)
  1       0         5.268780   8000000    1518378

  1       1        31.695985   4000000     126199
Message-Id: <1544614272-21970-1-git-send-email-tgrabiec@scylladb.com>
2018-12-12 11:33:46 +00:00
Tomasz Grabiec
ff2ad2f6bb sstables: Make variadic write() not picked on substitution error
If write(v, out, x) doesn't match any overload, the variadic write()
will be picked, with Rest = {}. The compiler will print error messages
about unable to find write(v, out), which totally obscures the
original cause of mismatch.

Make it picked only when there are at least two write() parameters so
that debugging compilation errors is actually possible.
2018-12-12 12:07:31 +01:00
Tomasz Grabiec
a14633c6d0 sstables: Extract MC format writer to mc/writer.cc
This moves all MC-related writing code to mc/writer.cc:

  - m_format_write_helpers.hh is dropped
  - m_format_write_helpers_impl.hh is dropped
  - sstable_writer_m is moved out of sstables.cc

sstable_writer_m is renamed to sstables::mc::writer
2018-12-12 12:07:31 +01:00