Commit Graph

6272 Commits

Author SHA1 Message Date
Tomasz Grabiec
122bd8ea46 row_cache: Restore indentation 2015-09-06 21:25:44 +02:00
Tomasz Grabiec
d1f89b4eab row_cache: Use allocation_section
See #259.

When transferring mutations between memtable and cache, lsa sometimes
runs out of memory. This solves the first two points, keeping reserve
filled up and adjusting the amount of reserve based on execution
history.
2015-09-06 21:25:44 +02:00
Tomasz Grabiec
7efcde12aa row_cache: Introduce row_cache::touch()
Useful in tests for ensuring that certain entries survive eviction.
2015-09-06 21:25:44 +02:00
Tomasz Grabiec
24a5221280 row_cache: Avoid leaking of partitions when exception is thrown inside update() 2015-09-06 21:25:44 +02:00
Tomasz Grabiec
1d182903cd mutation_partition: Document exception guarantees of apply() 2015-09-06 21:25:44 +02:00
Tomasz Grabiec
c82325a76c lsa: Make region evictor signal forward progress
In some cases region may be in a state where it is not empty and
nothing could be evicted from it. For example when creating the first
entry, reclaimer may get invoked during creation before it gets
linked. We therefore can't rely on emptiness as a stop condition for
reclamation, the evction function shall signal us if it made forward
progress.
2015-09-06 21:25:44 +02:00
Tomasz Grabiec
94f0db933f lsa: Fix typo in the word 'emergency' 2015-09-06 21:24:59 +02:00
Tomasz Grabiec
200562abe7 lsa: Reclaim over-max segments from segment pool reserve 2015-09-06 21:24:59 +02:00
Tomasz Grabiec
d022a1a4a3 lsa: Introduce allocating_section
Related to #259. In some cases we need to allocate memory and hold
reclaim lock at the same time. If that region holds most of the
reclaimable memory, allocations inside that code section may
fail. allocating_section is a work-around of the problem. It learns
how big reserves shold be from past execution of critical section and
tries to ensure proper reserves before entering the section.
2015-09-06 21:24:59 +02:00
Tomasz Grabiec
3caad2294b lsa: Tolerate empty segments when region is destroyed
Some times we may close an empty active segment, if all data in it was
evicted. Normally segments are removed as soon as the last object in
it is freed, but if the segment is already empty when closed, noone is
supposed to call free on it. Such segments would be quickly reclaimed
during compaction, but it's possible that we will destroy the region
before they're reclaimed by compaction. Currently we would fail on an
assertion which checks that there are no segments. This change fixes
the problem by handling empty closed segments when region is
destroyed.
2015-09-06 21:24:59 +02:00
Tomasz Grabiec
c37aa73051 lsa: Drop alignment requirement from segment 2015-09-06 21:24:59 +02:00
Tomasz Grabiec
2c1536b5a7 lsa: Make free() path noexcept
Memory releasing is invoked from destructors so should not throw. As a
consequence it should not allocate memory, so emergency segment pool
was switched from std::deque<> to an alloc-free intrusive stack.
2015-09-06 21:24:59 +02:00
Tomasz Grabiec
773595a1f3 mutation_partition: row: Mark move assignment noexcept 2015-09-06 21:24:59 +02:00
Tomasz Grabiec
f404a238bb allocation_strategy: Make construct() exception-safe 2015-09-06 21:24:59 +02:00
Tomasz Grabiec
1c68045b61 mutation_partition: row: Make copy constructor exception-safe 2015-09-06 21:24:58 +02:00
Tomasz Grabiec
828b7c2f54 mutation_partition: Make copy constructor exception-safe 2015-09-06 21:24:58 +02:00
Tomasz Grabiec
0d7cdab0ff utils: managed_vector: Make copy assignment exception-safe 2015-09-06 21:24:58 +02:00
Tomasz Grabiec
81d81c81f2 utils: managed_vector: Make copy constructor exception-safe
Copying values may throw (std::bad_alloc for example), which will
result in a leak because destructor will not be called when
constructor throws.

May manifest as the following assertion failure:

utils/logalloc.cc:672: virtual logalloc::region_impl::~region_impl(): Assertion `_active->is_empty()' failed.
2015-09-06 21:24:58 +02:00
Tomasz Grabiec
802a9db9b0 Fix spelling of 'definitely_doesnt_exist' 2015-09-06 21:24:58 +02:00
Tomasz Grabiec
c08742e4fc query-result-writer: Remove assert(_finished) guards from destructors
They're not exception-safe. If exception is thrown before finish() is
called, they'll trigger.
2015-09-06 21:24:58 +02:00
Tomasz Grabiec
fa8d530cc2 lsa: Add ability to trace reclaiming latency 2015-09-06 21:24:58 +02:00
Avi Kivity
0ed6e9c439 Merge "Use rpc's timeout support when sending gossip message" from Asias
"Timeout support was added to gossip message by using semaphore's timeout
support, now that rpc has timeout support, switch to it.

Fixes #284"
2015-09-06 15:31:58 +03:00
Asias He
8cff2318dc gossip: Add timeout support for send_echo 2015-09-06 16:35:11 +08:00
Asias He
2a06214306 gossip: Switch to use rpc timeout for send_gossip_digest_syn
Timeout support was added to gossip message by using semaphore's
timeout support, now that rpc has timeout support, switch to it.
2015-09-06 16:34:41 +08:00
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