Commit Graph

5719 Commits

Author SHA1 Message Date
Nadav Har'El
5a02eeaba9 v2: repair: track ongoing repairs
[in v2: 1. Fixed a few small bugs.
        2. Added rudementary support parallel/sequential repair.
	3. Verified that code works correctly with Asias's fix to streaming]

This patch adds the capability to track repair operations which we have
started, and check whether they are still running or completed (successfully
or unsuccessfully).

As before one starts a repair with the REST api:

   curl -X GET --header "Content-Type: application/json" --header "Accept: application/json" "http://127.0.0.1:10000/storage_service/repair_async/try1"

where "try1" is the name of the keyspace. This returns a repair id -
a small integer starting with 0. This patch adds support for similar
request to *query* the status of a previously started repair, by adding
the "id=..." option to the query, which enquires about the status of the
repair with this id: For example.,

    curl -i -X GET --header "Content-Type: application/json" --header "Accept: application/json" "http://127.0.0.1:10000/storage_service/repair_async/try1?id=0"

gets the current status of this repair 0. This status can be RUNNING,
SUCCESSFUL or FAILED, or a HTTP 400 "unknown repair id ..." in case an
invalid id is passed (not the id of any real repair that was previously
started).

This patch also adds two alternative code-paths in the main repair flow
do_repair_start(): One where each range is repaired one after another,
and one where all the ranges are repaired in parallel. At the moment, the
enabled code is the parallel version, just as before this patch. But the
will also be useful for implementing the "parallel" vs "sequential" repair
options of Cassandra.

Note that if you try to use repair, you are likely to run into a bug in
the streaming code which results in Scylla either crashing or a repair
hanging (never realising it finished). Asias already has a fix this this bug,
and will hopefully publish it soon, but it is unrelated to the repair code
so I think this patch can independently be committed.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-08-16 14:23:02 +03:00
Tzach Livyatan
e9754b9e16 README: Add missing prerequisites libs on Fedora 22
Add missing libs required for compiling on Fedora 22
thrift-devel antlr3-tool libasan libubsan

Signed-off-by: Tzach Livyatan <tzach@cloudius-systems.com>
2015-08-16 14:14:37 +03:00
Raphael S. Carvalho
82425fd24a sstables: initial work on handling a partially written sstable
The solution was proposed by Nadav. When writing a new sstable,
write all usual files, write the TOC to a temporary file, and
then rename it, which is atomic.
Files not belonging to any TOC are invalid, so we ensure that
partially written sstables aren't reused.

Avi also proposed using fsync on the sstable directory to guarantee
that the files reached the disk before sealing the sstable.

Subsequently, we should add code to avoid loading sstable which
TOC is either temporary or doesn't exist. Temporary TOC files
should also be deleted.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-08-16 13:01:44 +03:00
Vlad Zolotarov
cb55bdbfbc transport: register the correct "current number of open connections" statistics counter source
There are two counters for the "current number of open connections" in the cql_server:
   - _connects: incremented every time a new connection is opened. Should be used for
                a derived statistics of connections/sec
   - _connections: incremented and decremented every time a new connection is opened/closed
                correspondingly.

_connects has been registered as a source for both derived and gauge collectd statistics by
mistake while it had to be registered for a derived counter only and _connections had to be
registered as a source for a gauge counter.

Fixes issue #143

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-08-16 12:56:11 +03:00
Vlad Zolotarov
4e55033dc9 db::config: improve a help output for --endpoint_snitch parameter
- Improve the output formating.
   - Comment out not supported snitches.

Fixes issue #124

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-08-16 12:55:34 +03:00
Vlad Zolotarov
5f13ebad30 locator: create/reset_snitch(): improve the error message for a not-supported case
Fixes issue #124

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-08-16 12:55:33 +03:00
Gleb Natapov
6f9cc6efe4 fix query::read_command lifetime issue in mutation_result_merger
mutation_result_merger can outlive query::read_command, so it have to
hold shared pointer to it instead of reference. The bug was introduced by
89e36541c3
2015-08-16 10:59:43 +03:00
Avi Kivity
14ad301b26 Merge "Use proper token type" from Paweł
"These patches make sure that proper type is used to represent token."
2015-08-14 18:14:13 +03:00
Paweł Dziepak
498958878e tests/cql3: compare token() with bigints
The default partitioner is murmur3 for which correct token type is
bigint.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-14 16:51:20 +02:00
Paweł Dziepak
50abc62fe2 cql3: use proper token type in token relations
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-14 16:12:42 +02:00
Paweł Dziepak
15a0e2e386 cql3: use proper token type in token() function
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-14 16:12:38 +02:00
Paweł Dziepak
d06e450616 dht: add i_paritioner::token_to_bytes()
This allows token::_data to be in a different representation
than the one expected by the token type.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-14 16:12:30 +02:00
Paweł Dziepak
faa588cb0a dht: murmur3_paritioner: implement get_token_validator()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-14 15:58:39 +02:00
Avi Kivity
cc30da38f9 Merge "CQL3 and WITH COMPACT STORAGE" from Paweł
"This series of patches solves several remaining issues with COMPACT
STORAGE support and translates the missing parts of the CQL3 frontend."
2015-08-14 16:55:03 +03:00
Paweł Dziepak
d9f20ebbd1 tests/cql3: add tests for compact storage tables
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-14 14:53:35 +02:00
Paweł Dziepak
b42a9d6e6a cql3: translate support of update statements for dense tables
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-14 14:53:35 +02:00
Paweł Dziepak
1119141959 cql3: translate validation code for compact storage tables
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-14 14:53:35 +02:00
Paweł Dziepak
f6a93be655 cql3: skip compact value columns with no name
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-14 14:53:35 +02:00
Paweł Dziepak
eeb26ca8de compound: fix iterator comparison for null values
_v.begin() points to the next element. If the size of last element
in a compound is zero then iterators pointing to second to last and
last element would seem equal. To fix this we also have to compare
_types_left.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-14 14:53:22 +02:00
Paweł Dziepak
83b18597d9 keys: allow incomplete keys in from_clustering_prefix()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-14 14:10:36 +02:00
Avi Kivity
dc10545ef4 Merge seastar upstream
* seastar b56a6eb...432e973 (3):
  > dpdk: merge local patch to fix ixgbe
  > dpdk: rebase to latest upstream
  > net::dpdk: actually check the resulting cluster and not the original packet
2015-08-14 11:39:26 +03:00
Gleb Natapov
89e36541c3 Correctly enforce row limit in mutation_result_merger
Currently limit is enforced only on partition boundary, so real result
can contain 2*row_limit - 1 rows in the worst case. Fix it by trimming
rows from a mutation if only part of its rows fit the requested limit.
2015-08-13 18:28:30 +03:00
Avi Kivity
06c6432f1e messaging: fix bad return type in string deserializer
Found by gcc 6.
2015-08-13 17:51:29 +03:00
Avi Kivity
5c6a1eb1b0 Merge "Fixes for IN restrictions" from Paweł
"The following patches fix some remaining issues with IN restrictions,
namely empty IN () restriction and ordering of results."
2015-08-13 14:22:17 +03:00
Paweł Dziepak
36bd11bf96 tests/cql3: add tests for IN restrictions
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-13 11:36:16 +02:00
Paweł Dziepak
80fc1b1408 cql3: allow IN restriction only on last restricted column
2.2 allows IN on any column and it seems that we support that fine, but
DTESTs except us to reject such queries.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-13 11:34:26 +02:00
Paweł Dziepak
1402125bd8 cql3: reverse order of bounds for reversed selects
Because of the reverse flag in partition slice rows inside bounds will
be returned in reversed order, however, we still have to make sure
that the bounds are in the expected order.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-13 11:08:20 +02:00
Paweł Dziepak
486387bff8 cql3: sort and remove duplicates from clustering key restrictions
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-13 10:55:12 +02:00
Paweł Dziepak
9966a2eac6 cql3: sort and remove duplicates in multi-column IN restrictions
Values inside IN clause should be sorted and duplicates removed if the
restricted columns are part of the clustering key, which is always true
for multi column restrictions.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-13 10:52:42 +02:00
Paweł Dziepak
0afbbb9d44 cql3: fix empty IN () restriction
Values inside IN () restrictions may be either in a vector _in_values or
a marker (_in_marker or _value). To determine which one is appropriate
we check whether _in_values is empty, which is wrong because IN clause
can be empty (and there is no marker in such case). This is fixed by
using the presence of a marker to determine whether a vector of values
or a marker should be used.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-13 10:45:27 +02:00
Calle Wilund
562fa1a726 Disable allocation failure test in debug/sanitizer build
Since sanitizer does not fail gracefully on over-alloc
2015-08-12 20:00:44 +03:00
Avi Kivity
95847f86c3 Merge "locator: introduce i_endpoint_snitch::reset_snitch()" from Vlad
"This series introduces the i_endpoint_snitch::reset_snitch() static method
that allows to replace the current (global) snitch instance with the new one.
This is done in an (per-shard) atomic way transparent so anyone holding a reference
to snitch_ptr.

This series starts with some cleanups, adds the above method and the unit test
that verifies its functionality."
2015-08-12 19:29:08 +03:00
Avi Kivity
20e88a6f92 Merge seastar upstream
* seastar 4e35b8d...b56a6eb (1):
  > httpd: fix future exception handling
2015-08-12 18:34:09 +03:00
Avi Kivity
517ceed515 Merge "sstable index write benchmark"
"I am currently looking at the performance of our index_read, since it was in
the past pinpointed at the source of problems.

While the read side is the one that is mostly interesting, I would like to test
both - besides anything else, it is easier to test reads after writes so we
don't have to create synthetic data with outside tools.

This patch introduces the write side benchmark (read side will hopefully come
tomorrow).  While the write side is, as mentioned, not the most interesting
part, I did see some standing from the flamegraph that allowed me to optimize
one particular function, yielding a 8.6 % improvement."
2015-08-12 18:33:11 +03:00
Avi Kivity
bb83ba860a Merge seastar upstream
* seastar 7e7cef2...4e35b8d (3):
  > future: improve handle_exception
  > memory: attempt to catch underflows
  > memory: replace assert on too-large allocations with bad_alloc
2015-08-12 18:21:42 +03:00
Avi Kivity
11bf4efc72 Merge "Some changes to deal with allocation failures in CL" from Calle
"Related to 108
Does not fix the problem (fully at least), but at least:
* Throws exceptions instead of crashing
* Tries to back off slighly (allocate less) if possible
* Logs it

Also recycles segments to keep them from being fragmented by mem system"
2015-08-12 17:47:25 +03:00
Nadav Har'El
75384413f3 repair: fix use of handle_exception()
handle_exception() should really discard the future's value automatically,
and in an upcoming version of Seastar, won't. So instead of

	sp.execute().handle_exception(...)

(where execute() returns a future which is *not* future<>)
We need to write

	sp.execute().discard_result().handle_exception(...)

This already works in today's Seastar (the extra discard_result()
doesn't cause any harm), and will be necessary when handle_exception()
in Seastar is improved (I'll send a patch soon).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-08-12 17:46:41 +03:00
Glauber Costa
e1968c389e dht: use tri_compare for token comparisons
Loading data from memory tends to be the most expensive part of the comparison
operations. Because we don't have a tri_compare function for tokens, we end up
having to do an equality test, which will load the token's data in memory, and
then, because all we know is that they are not equal, we need to do another
one.

Having two dereferences is harmful, and shows up in my simple benchmark. This
is because before writing to sstables, we must order the keys in decorated key
order, which is heavy on the comparisons.

The proposed change speeds up index write benchmark by 8.6%:

Before:
41458.14 +- 1.49 partitions / sec (30 runs)

After:
45020.81 +- 3.60 partitions / sec (30 runs)

Parameters:
--smp 6 --partitions 500000

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-12 09:23:42 -05:00
Calle Wilund
47b7314c78 Commitlog: add test for too large alloc 2015-08-12 16:20:12 +02:00
Calle Wilund
2db7791c6a Commitlog: Attempt to reduce allocation size for segment if alloc fails 2015-08-12 16:20:12 +02:00
Calle Wilund
4fe98d3acf Commitlog: Throw bad_alloc on memalign fail (avoid sigsegv later) 2015-08-12 16:20:11 +02:00
Calle Wilund
7191a130bb Commitlog: recycle buffers to reduce fragmentation. 2015-08-12 16:20:11 +02:00
Glauber Costa
4ddef06ba6 perf tests: test sstables index reads and writes
This is a test that allow us to query the performance of our sstable index
reads and writes (currently only writes implemented). A lot of potentially
common code is put into a header, which will make writing new tests easier if
needed.

We don't want to take shortcuts for this, so all reading and writing is done
through public sstable interfaces.

For writing, there is no way to write the index without writing the datafile.
But because we are only writing the primary key, the datafile will not contain
anything else. This is the closest we can get to an index testing with the
public interfaces.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-12 09:18:37 -05:00
Glauber Costa
07eb98e799 tests: enhance _remove so it also removes directory structures
if a directory is found, recursively delete it. This will be useful for
allowing the creation of test structures like test/cpuX/sstable

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-12 09:17:37 -05:00
Glauber Costa
fa4cbe4844 tests: allow one to specify the directory in which test sstables will be created
Our normal test directory may not be good enough for performance testing. The
reason is, that while our git tree with its relative path will usually be
sitting in a standard ext4 filesystem, we want the performance tests to be run
against XFS, which is our deployment target.

It is a lot easier to point the perf test to an already mounted xfs directory,
than to meddle with mounts into the codebase's relative path for this alone.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-12 09:17:09 -05:00
Glauber Costa
da3cd1dc6a tests: expose create directory function
In some situations, it is useful to have the test directory persistent. To do that,
expose the inner function that creates it.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-12 09:12:59 -05:00
Gleb Natapov
987bf33865 storage_proxy: cleanup commented origin code
Remove code that was already reimplemented. Makes file navigation much
easier.
2015-08-12 16:50:57 +03:00
Vlad Zolotarov
806cc8c09a locator: snitch_reset_test
Checks that both successful and insuccessful calls for reset_snitch()
function as expected.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-08-12 16:44:47 +03:00
Vlad Zolotarov
6bffb9232e locator: added i_endpoint_snitch::reset_snitch()
Resets the global snitch with the new value

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-08-12 16:44:43 +03:00
Vlad Zolotarov
ef1c7deff4 locator: introduce i_endpoint_snitch::pause_io() and resume_io() methods
resume_io() is different from start() in that it won't try to read to configuration
and will only restart the periodic I/O task (if any).

This also means that resume_io() may not fail while start() will return an
exceptional future if it fails to read the configuration.

pause_io() is a counterpart of resume_io() - it stops the periodic I/O task (if any).
After it returns a ready future - snitch will not try to read any configuration until
either start() or resume_io() are called.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-08-12 16:38:04 +03:00