Commit Graph

4060 Commits

Author SHA1 Message Date
Avi Kivity
9ea9626bdf Merge seastar upstream 2015-06-22 12:51:01 +03:00
Avi Kivity
b879fabf36 reactor: block SIGALRM while we're still not ready to handle it
If some code sets up a timer before we've set up the SIGALRM signal handler,
we die.  Block it in the meantime.
2015-06-22 12:48:50 +03:00
Avi Kivity
7859f5a421 Merge seastar upstream 2015-06-22 10:45:06 +03:00
Avi Kivity
6d09819d1d Merge "repeat" from Tomasz
"repeat() is a single-callback version of do_until(), which makes it easier to
stop the loop if the stop condition is calculated in the loop body."
2015-06-22 10:38:55 +03:00
Vlad Zolotarov
ea274a0eda locator: Fix a typo in a token_metadata constructor
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-06-22 09:16:24 +02:00
Tomasz Grabiec
e5e7348f76 core: Reimplement keep_doing() using repeat() 2015-06-22 09:08:38 +02:00
Tomasz Grabiec
61992f84c5 core: Introduce repeat()
It's like do_until(), but the stop condition is calculated by the
callback instead of being supplied separately.
2015-06-22 09:08:38 +02:00
Nadav Har'El
00e9f9e06a sstables: don't use size_t for on-disk sizes
As Avi suggested, we should use size_t only for memory sizes, not disk
sizes, as some hypothetical 32-bit machine could have 32-bit size_t
but still support 64-bit file sizes.

So this patch changes a number of places we used size_t in sstables/
to use uint64_t instead. It doesn't change *all* uses of size_t: Where
the size_t refers to a size of an object in memory (or an object that
should fit into memory - like the summary file), I left size_t.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-06-22 08:02:50 +03:00
Avi Kivity
bd3044a38d do_with: doc: mark cherry_pick_tuple as internal 2015-06-21 23:37:12 +03:00
Nadav Har'El
646c31e596 sstables: take generic mutation_reader instead of memtable
The current sstable write interface only knows how to write a memtable.
For compaction, we also want it to be able to write the compaction's
output, which we can represent as a mutation_reader. So this patch
changes the sstable::write_components() method to accept a mutation_reader,
and whatever else is needed (a schema and the number of partitions in
the reader - or an estimate thereof).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-06-21 23:32:17 +03:00
Avi Kivity
5367a0fb8b doc: unhide static functions 2015-06-21 23:27:33 +03:00
Avi Kivity
6975be8e12 Merge seastar upstream 2015-06-21 21:16:48 +03:00
Avi Kivity
9679075b30 shared_mutex: reinstate FIFO ordering
Noticed by Nadav.
2015-06-21 20:54:53 +03:00
Avi Kivity
18fd73b065 gate: fix doc typo 2015-06-21 20:36:15 +03:00
Avi Kivity
a2ec5ebe87 doc: add gate class to fiber module 2015-06-21 20:35:54 +03:00
Avi Kivity
ac94c1d68e doc: add fiber module to main page 2015-06-21 20:33:34 +03:00
Avi Kivity
d9bfbe55c8 core: introduce shared_mutex class
Similar to std::shared_mutex, allows shared and exclusive locking of a
resource (also known as a reader/writer lock).  This implementation is
strictly FIFO.
2015-06-21 20:28:43 +03:00
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