Commit Graph

53948 Commits

Author SHA1 Message Date
Asias He
06fb6f6b30 messaging_service: Introduce send_message_timeout
It is used to send a message with timeout.
2015-09-06 15:01:21 +08:00
Avi Kivity
9b1d08d734 Merge: protect gossip/failure detected sharded<> instances against async calls from Asias 2015-09-06 09:48:24 +03:00
Asias He
16522bc2da failure_detector: Protect failure_detector from been destroyed while in use
failure_detector::{interpret, force_conviction} will call into callback: convict
, which might start an async operation. Protect it by ref count.

Fixes #269
2015-09-06 11:25:23 +08:00
Asias He
5bec8cba82 gossip: Kill one async::thread for mark_dead
We have this call chain,

  gossiper::run -> do_status_check -> interpret -> convict -> mark_dead

since gossip::run is executed inside a seastar thread, we can assure all
functions above run inside a seastar thread.
2015-09-06 11:04:41 +08:00
Asias He
2ba8497399 gossip: Protect gossiper from been destroyed while in use
There are three places where async operations can be scheduled

- gossiper timer handler
- API called by user
- messaging service handler

Use reference tracking infrastructure to protect.

Fixes #268
2015-09-06 09:56:38 +08:00
Tomasz Grabiec
704cfc13d8 tests: cql_query_test: Init local cache only once
It's a singleton, so we can't attempt to init it more than once.

Fixes cql_query_test failure:

/home/tgrabiec/src/urchin2/seastar/core/future.hh:315: void future_state<>::set(): Assertion `_u.st == state::future' failed.
unknown location(0): fatal error in "test_create_table_statement": signal: SIGABRT (application abort requested)
seastar/tests/test-utils.cc(31): last checkpoint
2015-09-04 20:01:55 +02:00
Tomasz Grabiec
25e4f10c14 utils/file_lock: Fix compilation error
Fixes complaint about ignored result:

utils/file_lock.cc: In destructor 'utils::file_lock::impl::~impl()':
utils/file_lock.cc:29:33: error: ignoring return value of 'int lockf(int, int, __off_t)', declared with attribute warn_unused_result [-Werror=unused-result]
2015-09-04 13:00:54 +02:00
Raphael S. Carvalho
6f07379646 row consumer: don't fallthrough if mask cannot be consumed
When row consumer fallthrough from ATOM_NAME_BYTES to ATOM_MASK,
we assume that mask can be consumed, but it may happen that
data.size() equals to zero, thus mask cannot be consumed.
Solution is to add read_8 so that the code will only fallthrough
if mask can be consumed right away.

Fixes #197.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-09-04 12:26:03 +03:00
Shlomi Livne
2e6dd2f585 Update CQL start message
Align with origin CQL boot message

Resolves an issue when starting a cluster with CCM - wait till all
servers have openned their CQL port

Fixes #39

Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-09-04 11:02:02 +02:00
Avi Kivity
deccb0f718 result_set: fix deserialization of collection types
Collection cells in query results are serialized using the "mutation form",
and must be deserialized using that format as well.

Fixes "--logger-log-level storage_proxy=trace" crasher.
2015-09-03 20:39:30 +03:00
Avi Kivity
067051868f Merge seastar upstream
* seastar cb905f6...0db706a (2):
  > fstream: don't trim requested buffer size unnecessarily
  > memory: Fix posix_memalign() in case allocation fails

Fixes index read performance regression.
2015-09-03 18:58:56 +03:00
Gleb Natapov
cea529f490 messaging_service: protect messaging_service from been destroyed while in use
Pointer to messageing_service object is stored in each request
continuation, so the object destruction should not happen while
any of these continuations is scheduled. Use shared pointer instead.

Fixes #273.
2015-09-03 13:59:05 +03:00
Gleb Natapov
1d96dcdbbe Revert "protect messaging_service destruction by a gate object"
This reverts commit 8599e9d84f.
2015-09-03 13:58:46 +03:00
Avi Kivity
999e9d0f91 Merge "RPM build using mock" from Pekka
"This series changes build_rpm.sh to use mock which ensures RPM is built
in a clean chroot environment:

  https://fedoraproject.org/wiki/Mock

Build steps are document in README.md file."
2015-09-03 13:01:05 +03:00
Pekka Enberg
e5a1e34d35 README: Document RPM build steps on Fedora
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-09-03 12:24:37 +03:00
Avi Kivity
42dc29619d Merge "Optimize mutation copies and moves" from Paweł
"This series deals with copies and moves of mutation. The former are dealt
with by adding std::move() and missing 'mutable' (in case of lambdas). The
latter are improved by storing mutation_partition externally thus removing
the need for moving mutation_partition each time mutation is moved.

Storing mutation_partition externally is obviously trading the cost of
move constructor for the cost of allocation which shows in perf_mutation
results since mutations aren't moved in that test.

perf_mutation (-c 1):
before: 3289520.06 tps
after:  3183023.37 tps
diff: -3.24%

perf_simple_query (read):
before: 526954.05 tps
after:  577225.16 tps
diff +9.54%

perf_simple_query (write):
before: 731832.70 tps
after:  734923.60 tps
diff: +0.42%

Fixes #150 (well, not completely)."
2015-09-03 12:05:28 +03:00
Pekka Enberg
4f5e4a7195 dist/redhat/build_rpm: Use mock to build RPMs
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-09-03 11:55:01 +03:00
Pekka Enberg
e536d57872 dist/redhat/scylla-server.spec: Limit ninja-build jobs
Our C++ compilation takes up so much memory that we cannot really use
RPM defaults. Limit the number of jobs to 2 for now to fix SIGBUS errors
in VMs as well as swap storm when building with mock.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-09-03 11:55:01 +03:00
Pekka Enberg
ed78ace390 dist/redhat/scylla-server.spec: Add python3 to build dependencies
Fixes the following build error in clean Fedora chroot when building
with mock:

  /var/tmp/rpm-tmp.xx23K7: ./configure.py: /usr/bin/python3: bad interpreter: No such file or directory
  error: Bad exit status from /var/tmp/rpm-tmp.xx23K7 (%build)

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-09-03 11:33:27 +03:00
Paweł Dziepak
08e3192b52 service: avoid copying mutations
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-09-03 10:30:36 +02:00
Paweł Dziepak
830a86258b db: avoid copying mutations
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-09-03 10:30:32 +02:00
Paweł Dziepak
ddec2b4d09 batchlog_manager: pass mutations by const ref
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-09-03 10:30:29 +02:00
Paweł Dziepak
8188896eb7 schema_tables: add missing mutable
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-09-03 10:30:25 +02:00
Paweł Dziepak
2d0112b11f migration_manager: add missing mutable
If lambda is not marked as mutable objects from its capture list cannot
be moved.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-09-03 10:30:22 +02:00
Paweł Dziepak
39e5f92433 cql3: modification_statement: avoid copying mutations
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-09-03 10:30:18 +02:00
Paweł Dziepak
11efd5c639 mutation: store mutation data externally
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-09-03 10:29:53 +02:00
Paweł Dziepak
868f5d91df mutation: avoid moving mutation_partition
By passing mutation_partition oither by const ref or rref instead of
by value one move can be avoided if copying is necessary.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-09-03 10:29:32 +02:00
Nadav Har'El
b80849beaa Repair: add an info message
Add in repair another info message, "Endpoints ... and ... have ... range(s)
out of sync for <column-family>", which the repair dtest expects.

This patch is a kind of silly attempt to appease issue #81 (should we mark
it fixed?). It's kind of silly, because without merkle trees (see issue #82),
we really have no way of knowing if there's any differences between the two
nodes, so we always say there is "1 range" difference. So if the dtest expects
such a message *not* to appear (because there are no differences), it might
fail.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-09-03 09:12:38 +03:00
Nadav Har'El
f91b5fabd2 repair: fail if unknown option is used
As requested in issue #79, this patch ensures that if the user attempts
to pass an unknown repair option, the operation fails rather than the
option simply be ignored.

An "unknown repair option" may be one of Cassandra's options we don't yet
support ("parallelism", "incremental", "jobThreads", "columnFamilies",
"dataCenters", "hosts" and "trace"), or any other unknown option name -
in either case, the operation will fail rather than ignore the option
which might have been important.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-09-03 09:12:04 +03:00
Glauber Costa
28f315fad4 system_keyspace: keep msg alive when needed
Fixes #266

Some callsites are fine: if we just get the message and process it, as is the
case with check_health for instance, msg will be alive and all is good. But if
we return a future inside the processing, msg must be kept alive. Classic bug,
appearing again.

Pekka saw this in practice in another bug. We haven't seen anything that is
related to this, but it is certainly wrong.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-09-03 09:11:07 +03:00
Glauber Costa
1ed6333566 storage_proxy: log failed attempts at communicating
If an exception happens in the query path, we'll never know about it. They are
currently being ignored.

Investigating this, I found out that this is because the readers in
storage_proxy.cc handles them - but don't log they anywhere.

This patch introduces such logging. the error() function takes an sstring not
an exception_ptr: this is so we can reuse it in the future to also log problems
from other hosts (currently not done).

We have a separate helper to extract the message from the current exception
before we pass it to error()

Fixes #110

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-09-03 09:10:51 +03:00
Tomasz Grabiec
a540a4352b scylla-gdb.py: Make 'scylla memory' also print page span info
Example output:

Page spans:
index      size [B] free [B]
    0          4096 0
    1          8192 0
    2         16384 0
    3         32768 0
    4         65536 0
    5        131072 40239104
    6        262144 32505856
    7        524288 1835008
    8       1048576 0
    9       2097152 0
   10       4194304 0
   11       8388608 0
   12      16777216 0
   13      33554432 0
   14      67108864 0
   15     134217728 0
   16     268435456 0
   17     536870912 0
   18    1073741824 0
   19    2147483648 0
   20    4294967296 0
   21    8589934592 0
   22   17179869184 0
   23   34359738368 0
   24   68719476736 0
   25  137438953472 0
   26  274877906944 0
   27  549755813888 0
   28 1099511627776 0
   29 2199023255552 0
   30 4398046511104 0
   31 8796093022208 0
2015-09-03 09:07:14 +03:00
Avi Kivity
ce6cd6fffa Merge seastar upstream
* seastar 3e4a237...cb905f6 (8):
  > sharded: introduce get_local_service() function
  > test: add reference tracking test to distributed test
  > sharded: reference tracking infrastructure
  > sharded: do not capture remote service pointer on remote invocation lambda (part 2)
  > build: put user cflags after default cflags
  > Revert "memory: simplify new (nothrow) variants"
  > build: drop unused dpdk libraries
  > memory: simplify new (nothrow) variants
2015-09-02 17:31:15 +03:00
Pekka Enberg
dd861e104d dist/redhat/scylla-server.spec: Kill boost-test dependency
Spotted by Gleb in issue #260.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-09-02 16:37:44 +03:00
Pekka Enberg
ce39f9d57a db/system_keyspace: Fix use-after-free in build_dc_rack_info()
Fixes #264.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-09-02 16:37:34 +03:00
Raphael S. Carvalho
6fe853fe7b sstables: fix possible use-after-free
buf is a stack variable, so it may be destroyed by the time it's
used by output_stream::write().

Spotted while auditing the code.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-09-02 09:26:06 +03:00
Glauber Costa
b1c59ab995 sstable_mutation_test: test condition related to #188
This patch tests that collection within a mutation behave properly.
That is what lead to #188.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-09-02 06:01:39 +03:00
Glauber Costa
0fc2995b54 database: initialize sst field
The reader has a field for the sstable, but we are not initializing it, so it
can be destroyed before we finish our job. It seems to work here, but transposing
this code to the test case crashed it. So this means at some point we will crash
here as well.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-09-02 06:01:38 +03:00
Glauber Costa
268a308d3f sstables::mutation_reader: do not spill previous collection
The sstable mutation_reader knows how to handle the case of multiple
mutations: it wraps the mutation into an optional element, and when a
new mutation comes along, it just moves that to the caller.

However, it fails to do the same for collections. We have the same collection
tracking structure, and as long as we are trying to read a single row, all
works fine.

When we are reading more than a row, though, things change: because we have
stale data for the previous collection, the new one will end up including this.

In the case in which we tested, we had an sstable that contained mutations for
all columns in a row, and another row containing all columns but one, and that
one was precisely a collection. What we ended up seeing, is that the new row
would have that collection nevertheless, with the former row's collection
value.

This patch applies the same method as we use for tracking mutations, to tracking
collections. And with this, it all works.

Fixes #188

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-09-02 03:49:57 +03:00
Tomasz Grabiec
57d41e2155 tests: Don't run lsa_async_eviction_test on very large batch size
Since commit 870e9e5729 eviction no
longer happens during allocation from a region and batch size of 30000
became too large to handle. 3000 is low enough and that test case was
left.
2015-09-01 20:11:17 +03:00
Avi Kivity
ef582753c0 Merge "Lock files for CL+Data dirs" from Calle
"Acquires and maintains lock files during execution.
Lock files are deleted on "clean" exit, and re-taken on uncontended
startup.

Fixes #34 "
2015-09-01 19:18:46 +03:00
Calle Wilund
2fa699896b Main: Use lock files in data dir + CL dir to ensure single instance.
Acquires and maintains lock files during execution. 
Lock files are deleted on "clean" exit, and re-taken on uncontended 
startup.

Fixes #34
2015-09-01 17:50:18 +02:00
Calle Wilund
e3abde50f9 Add lock file helper class "file_lock"
Using posix "lockf" per-fd region locking
2015-09-01 17:50:18 +02:00
Tomasz Grabiec
870e9e5729 lsa: Replace compaction_lock with broader reclaim_lock
Disabling compaction of a region is currently done in order to keep
the references valid. But disabling only compaction is not enough, we
also need to disable eviction, as it also invalidates
references. Rather than introducing another type of lock, compaction
and eviction are controlled together, generalized as "reclaiming"
(hence the reclaim_lock).
2015-09-01 17:29:04 +03:00
Tomasz Grabiec
48569651ea lsa: Fix calculation of bytes.non_lsa_used_space 2015-09-01 17:29:03 +03:00
Avi Kivity
ab2a24486e Merge seastar upstream
* seastar 7a8b261...3e4a237 (1):
  > Merge "net::dpdk: add TCP client support on top of Intel's 40Gbps NICs" from Vlad
2015-09-01 15:23:46 +03:00
Calle Wilund
d95101664d Commitlog: Don't throw exceptions on unrecognized files in CL dir 2015-09-01 14:23:03 +02:00
Avi Kivity
6d1dd76c98 Merge "Scylla RPM fixes" from Pekka
"Fix various issues in the Scylla RPM spec file and support scripts:

  - Include scylla.conf in the RPM

  - Fix tarball generation on Fedora 21

  - Fix scylla user home directory

  - Simplify DPDK build

Scylla RPM now builds and runs on Fedora 21 with DPDK manually disabled
as I don't have matching kernel headers installed on my machine.

Fixes #245."
2015-09-01 15:18:16 +03:00
Tomasz Grabiec
3115a1aaa0 tests: logalloc_test: Disable test_compaction_lock with default allocator
It relies on the fact that the process has a fixed amount of memory
assigned and std::bad_alloc is thrown in a timely manner when it fills
up, which is the case for seastar's allocator, but not with the
default allocator. With the latter the OOM killer kills the process.
2015-09-01 15:17:43 +03:00
Avi Kivity
cc6fa97b35 Revert "transport: improve exception handling on connection close"
This reverts commit 0558a56ab5.  As Vlad points
out, it is bogus.  Real fix in 5ddbaf8612.
2015-09-01 15:16:18 +03:00