Commit Graph

53948 Commits

Author SHA1 Message Date
Avi Kivity
a99956db8e future-util: implement range-based map_reduce() variant 2015-06-21 20:21:24 +03:00
Avi Kivity
33a4f1b32b reactor: move destructor to .cc file
It's totally uninteresting to anyone else.
2015-06-21 18:02:28 +03:00
Avi Kivity
cebe81082b reactor: destroy system timer in destructor
Keeping the timer armed can cause a signal to be sent, which will not
be handled, terminating the program too early.
2015-06-21 17:59:18 +03:00
Nadav Har'El
d7099358a7 tests: Fix shared/lw_shared mixup in test
In a couple of places in sstable_datafile_test.cc, we had
make_shared<memtable> instead of the usual make_lw_shared<memtable>.

It appears that since commit bc468f9a0e,
which made memtables inherit from enable_lw_shared_from_this (not the "lw"),
this no longer works correctly. I'm not sure I can really explain the
details of what's wrong, but with some refactoring I did on the sstable
writing code, it stopped working giving various strange crashes which appear
like the object protected by this shared_ptr got prematurely destructed.

Changing the test to use make_lw_shared() fixes the problems I was having.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-06-21 17:28:20 +03:00
Gleb Natapov
52aa0a3f91 db: hold onto write response handler until timeout handler is executed
If last response comes after write timeout is triggered, but before
continuation, that suppose to handle it runs the handler can be removed
to earlier and be access from the continuation after deletion. Fix it by
making response handler to be shared pointer instead of unique and
holding to it in timeout continuation.
2015-06-21 13:09:43 +03:00
Avi Kivity
614da559d0 semaphore: provide broken() variant accepting an std::exception_ptr 2015-06-21 11:44:57 +03:00
Glauber Costa
f4a167670a database: seal active memtables when we close the database
Failing to do so can lead to data not being written to disk when
we terminate.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-06-21 09:39:31 +03:00
Glauber Costa
1f13d3e38f database: gate seal_active_memtable
We need to do that in order to close the database cleanly, flushing all pending
data before we do.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-06-21 09:39:29 +03:00
Avi Kivity
7faebf4524 Merge "Bloom filter tracker" from Glauber
"This is the code responsible for tracking bloom filter activity. Origin uses
atomics, we will just keep local counters and map-reduce (yay!)"
2015-06-21 08:15:54 +03:00
Raphael S. Carvalho
113d3b1001 sstables: update compression ratio stats
If compression is used, we should provide both uncompressed and
compressed length to metadata collector, so as for the ratio to
be computed. Stats metadata stores compression ratio.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-06-21 08:14:07 +03:00
Avi Kivity
42a0089e5d Merge "streaming updates" from Asias 2015-06-21 08:09:47 +03:00
Avi Kivity
971c116207 Merge seastar upstream 2015-06-21 08:08:42 +03:00
Avi Kivity
439b9c848a tests: fix fstream_test misuse of shared_ptr
'static shared_ptr' causes the shared_ptr to be destroyed on a cpu other
than the one it was constructed on, which is illegal.
2015-06-20 12:02:00 +03:00
Avi Kivity
535928c643 tests: fix fstream_test use-after-free 2015-06-20 11:43:14 +03:00
Avi Kivity
033d919eaa tests: add missing tests to test.py 2015-06-20 11:30:13 +03:00
Avi Kivity
1c8ee4e160 tests: convert foreign_ptr_test to SEASTAR_TEST_CASE
Makes it pass.
2015-06-20 11:29:53 +03:00
Avi Kivity
32ede23303 tests: remove obsolete test-reactor test 2015-06-20 11:17:28 +03:00
Nadav Har'El
9b884b3435 reactor: more information on ignored exceptional future
When an exceptional future is ignored, we print a message, and for an
std::exception we print its what(). However, it would be useful to also
see the exception's type. We already had such exception type printing
code for engine_exit(), and this patch extracts that code into a separate
function, and also uses it to print the warning message when an exceptional
future is ignored.

For example, in one test before this patch I see:
 WARNING: exceptional future ignored: _Map_base::at

After this patch,
 WARNING: exceptional future ignored of type 'std::out_of_range': _Map_base::at

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-06-20 11:07:09 +03:00
Nadav Har'El
13a68fa62c pipe: fix syntax error in pipe reader
I'm not sure how my compiler didn't complain earlier...

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-06-20 11:07:06 +03:00
Avi Kivity
7a596dfa61 Merge seastar upstream 2015-06-19 21:53:39 +03:00
Avi Kivity
39218c32f7 core: extend do_with() to support multiple parameters
do_with(1, 2, 3, [] (int& v1, int& v2, int& v3) {
      return make_ready_future<int>(v1 + v2 + v3);
  });
2015-06-19 20:24:56 +03:00
Avi Kivity
6595ad0bde core: introduce gate class
Gate allows stopping new incoming requests, and detecting when the last
in-progress request has left.
2015-06-19 19:03:15 +03:00
Nadav Har'El
2f4e123eab core: pipe for passing data between fibers
Our queue<T> is a convenient mechanism for passing data between a producer
fiber (a set of consecutive continuations) and a consumer fiber.

However, queue<T> is difficult to use *correctly*. The biggest problem is
how to handle premature stopping: What if one of the two fibers (the reader
or the writer) stops prematurely, and will never read or write any more?
When queue<T> is used naively, the other fiber will just hang indefinitely
while it waits to read from the empty queue, or write to the full queue.

The solution proposed in this patch is a new pipe mechanism, implemented
internally over a queue. pipe<T>() returns two separate objects - a pipe
reader, and a pipe writer. Typically each object is std::move()ed into a
different fiber. When a fiber stops and its captured variables are destroyed,
one end of the pipe is destroyed, and that causes the other end's operations
to return immediately (if the other end was already blocked, it will resume
immediately, and return an exceptions). This behavior is analogous to
Unix's EOF or broken-pipe behavior.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-06-19 19:03:13 +03:00
Asias He
a794dd28e1 streaming: Convert ConnectionHandler.java to C++ 2015-06-19 15:29:13 +08:00
Asias He
04fa228091 streaming: Convert StreamEventHandler.java to C++ 2015-06-19 15:11:35 +08:00
Asias He
6707c9f8af streaming: Convert StreamEvent.java to C++ 2015-06-19 15:07:22 +08:00
Asias He
739cf1b3ef streaming: Add is_success() and plan_id() to stream_session 2015-06-19 15:07:06 +08:00
Asias He
4604ae7d4b streaming: Import ConnectionHandler.java 2015-06-19 14:23:14 +08:00
Asias He
ad81a5f0a9 streaming: Import StreamEventHandler.java 2015-06-19 14:22:50 +08:00
Asias He
ebc6d6166c streaming: Import StreamEvent.java 2015-06-19 14:22:30 +08:00
Asias He
c3ba169d64 streaming: Convert StreamCoordinator.java to C++ 2015-06-18 23:42:50 +08:00
Asias He
067108f094 streaming: Import StreamCoordinator.java 2015-06-18 23:42:50 +08:00
Asias He
5ed8f689f7 streaming: Add gossip callback 2015-06-18 23:42:50 +08:00
Glauber Costa
23cae98cd6 sstables: count filter hits and misses
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-06-18 11:17:36 -04:00
Glauber Costa
272b97f01c sstables: initialize filter_tracker when filter file is read
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-06-18 11:17:29 -04:00
Glauber Costa
1c5d2141db add sstables filter tracker
This class will be used to generate filter hit / miss statistics to be consumed
by upper layers

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-06-18 11:17:22 -04:00
Asias He
0aa9fdff5d streaming: Convert SessionInfo.java to C++ 2015-06-18 23:02:31 +08:00
Asias He
8c3a32a3cf streaming: Import SessionInfo.java 2015-06-18 23:02:31 +08:00
Asias He
3f97d610f3 streaming: Add stream_session::state 2015-06-18 23:02:31 +08:00
Asias He
849519946e streaming: Convert ProgressInfo.java to C++ 2015-06-18 23:02:31 +08:00
Asias He
01d52f8bb1 streaming: Import ProgressInfo.java 2015-06-18 23:02:31 +08:00
Asias He
9e8512a783 streaming: Convert StreamPlan.java to C++ 2015-06-18 23:02:31 +08:00
Asias He
3e5aa7a3d5 streaming: Import StreamPlan.java 2015-06-18 23:02:31 +08:00
Avi Kivity
f221301d5e Merge "preparation work - system table handling" from Glauber 2015-06-18 17:49:29 +03:00
Avi Kivity
ce1e936d72 Merge "Cleanups around mutation reading" from Tomasz
"This series addresses two things:

  1) fixes a long standing problem with query::partition_range being modeled
  inappropriately. It worked on key values only, whereas partition ordering is
  determined by token and key. This will be needed by clustering code soon,
  which will split a full range into many slices based on token ring topology.

  2) refactors mutation reading code in preparation for adding row cache.
  mutation_reader merging was extracted to make_combined_reader(). sstables
  are now represented by a single mutation_reader."
2015-06-18 17:39:41 +03:00
Tomasz Grabiec
51cae834e3 db: Put all sstables behind single reader
This change abstracts reading from on-disk data sources behind a single
reader which is then composed with memtable readers. This change also
abstracts all data sources behind a single reader obtained via
column_family::make_reader(). That reader is then used by algorithms
like column_family::for_all_partitions() or
column_family::query(). Having those abstractions will make it easier
to add row cache, because it will be encapsulated in a single place.
2015-06-18 16:33:33 +02:00
Tomasz Grabiec
bc468f9a0e memtable: Make memtable inherit from enable_lw_shared_from_this 2015-06-18 15:48:21 +02:00
Tomasz Grabiec
a8fde0847e db: Fix too broad catch clause
The current handling, which ignores the future and a FIXME, should
apply only to the case when a table is missing.
2015-06-18 15:47:40 +02:00
Tomasz Grabiec
370712f741 tests: Add mutation_reader_test 2015-06-18 15:47:40 +02:00
Tomasz Grabiec
df0243d90e mutation_reader: Introduce simple reader adaptors
Useful for testing.
2015-06-18 15:47:40 +02:00