Commit Graph

53948 Commits

Author SHA1 Message Date
Avi Kivity
ee5b6d0f2e Merge branch 'penberg/sstable-cleanups' of github.com:cloudius-systems/seastar-dev into db
Sstable cleanups, from Pekka.
2015-05-12 19:03:08 +03:00
Avi Kivity
3e04c30c00 Merge branch 'penberg/cql-cleanups' of github.com:cloudius-systems/seastar-dev into db
cql cleanups, from Pekka.
2015-05-12 17:04:10 +03:00
Avi Kivity
f3c8994535 distributed: add map_reduce() variant accepting an initial value
Separating the initial value (and accumulator) from the reducer function
can result in simpler invocations.

Unfortunately, the name conflicts with another variant, so we have to name
the method map_reduce0.
2015-05-12 16:57:50 +03:00
Pekka Enberg
f2438d0124 sstables: Formatting cleanups
Clean up some formatting issues spotted while reading the code.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:57:24 +03:00
Pekka Enberg
5c515dcad8 sstables: Define public members first
Shuffle code in sstables.hh so that public members are defined first.
Makes the code easier to digest.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:52:15 +03:00
Pekka Enberg
11b633208d cql3: Remove Java imports from C++ files
Remove left-over Java imports from files that are already translated to
C++.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:41:12 +03:00
Pekka Enberg
c6da7e6844 cql3: Use std::nullopt constant
There's a std::nullopt constant for unset optionals. Use it.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:37:29 +03:00
Pekka Enberg
d50139351f cql3: Use pragma once everywhere
There's no benefit to using C include guards so switch to pragma once
everywhere for consistency.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:32:56 +03:00
Avi Kivity
b300a05468 Merge branch 'master' of github.com:cloudius-systems/urchin into db 2015-05-12 15:07:16 +03:00
Avi Kivity
548646d4ba Merge branch 'master' of github.com:cloudius-systems/seastar into db
Should fix use-after-free when a frozen_mutation is applied to the
local shard.

Includes two adjustments to urchin collectd usage from Calle:

  - Updated thrift collectd registration to use proper move semantics
  - Commitlog: Fix collectd registration to use move semantics + test

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-12 14:47:07 +03:00
Avi Kivity
50d65f1d86 smp: protect lifetime of function parameter to submit_to()
When submit_to() calls to a different core, and when the function to
be executed is a temporary (the usual case), we copy it to the heap for
the duration of execution.  However when the function happens to execute
locally, we don't copy it, which can lead to a use-after-free if the function
defers.

Fix by detecting the case of local execution of a temporary function, and
copying it to the heap in that case.
2015-05-12 14:33:18 +03:00
Tomasz Grabiec
c779fa880f Merge branch 'penberg/keyspace-merging-improvements/v2' from seastar-dev.git
From Pekka:

 "This series implements a Maps.difference() function in C++, changes
 storage_proxy::query_local() to not return foreign_ptr>, and finally
 changes the keyspace merging code to follow Origin."
2015-05-12 13:08:02 +02:00
Pekka Enberg
96a1955cea db/legacy_schema_tables: Use map_difference() instead of open-coding it
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 13:18:56 +03:00
Pekka Enberg
d3f9af7239 Make storage_proxy::query_local() return bare lw_shared_ptr<>
Don't return foreign_ptr<> which is not copyable so that we can use
map_difference for maps with result_set in them.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 13:18:56 +03:00
Avi Kivity
6173d1af62 Merge branch 'calle/scollectd-fixes' of github.com:cloudius-systems/seastar-dev
collectd fixes, from Calle.
2015-05-12 12:42:19 +03:00
Calle Wilund
ad5feda8ae Collectd: Fix registration/deregistration and reg. anchor managment
Obviously, I was sleeping or something when I wrote the reg/unreg code, since
using copy semantics for anchors is equivalent with double unregistrations.
Luckily, unregister was broken as well, so counters did stay active. Which
however broke things once actual non-persistent counters were added. Doh.

* Anchors must be non-copyable
* Above makes creating std::vector<registration> from initializer list
tricky, so added helper type "registrations" which inherits vector<reg>
but constructs from initializer_list<type_instance_id>, avoiding illegal
copying.
* Both register and unregister were broken (map semantics does not overwrite
on insert, only [] or iterator operation).
* Modified the various registration callsites to use registrations and move
semantics.
2015-05-12 11:30:44 +02:00
Calle Wilund
2646fa188f Collectd: Add virtual destructor to value_list
Since we bind actual std::functions etc, a virtual destructor is needed.
2015-05-12 11:30:44 +02:00
Calle Wilund
e941b5a378 Collectd: Make sure get_instance_ids only returns active id:s 2015-05-12 11:30:44 +02:00
Calle Wilund
db9869639c Collectd: change string types to sstring 2015-05-12 11:30:44 +02:00
Pekka Enberg
a264f42bd6 Add map_difference::difference() helper
This implements Maps.difference() helper function in C++. We need it to
translate various Origin call-sites that use it. The implementation is
written from scratch with Guava code used as reference to preserve
semantics.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 10:19:52 +03:00
Raphael S. Carvalho
7bb43cb961 gitorderfile: make changes into *.py files appear first
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-12 10:13:25 +03:00
Raphael S. Carvalho
e1de49e233 tests: move sstable data file generation testcases to another file
I didn't want to create another executable for it because doing so
would take a lot more of disk space. The motivation behind this
change is to debloat the sstables test file, which is growing very
quickly. Suggested by Glauber Costa.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-11 19:37:29 +03:00
Avi Kivity
7630fe332d db: pass correct mutation size to commitlog
Use serialized_size() instead of reprentation().size(), to account for the
size header.
2015-05-11 19:19:23 +03:00
Avi Kivity
dff2b74a60 Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-05-11 18:10:20 +03:00
Avi Kivity
22e261e24b Merge branch 'sstables-write' of github.com:raphaelsc/urchin into db
Sstable support for expiring and tombstone cells, from Raphael.
2015-05-11 18:09:41 +03:00
Avi Kivity
4cea444fb2 collectd: avoid using an exception as end-of-packet indicator
Collectd uses an exception to signal that the buffer space in the packet
is exhausted and a new packet needs to be started.  This violates the
"exceptions are for exceptional conditions" guideline, but more practically,
makes it hard to use the gdb "catch throw" command to trap exceptions.

Fix by using a data member to store the overflow condition instead.
2015-05-11 18:02:41 +03:00
Raphael S. Carvalho
feeaae06cf sstables: add support to write tombstone cells
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-11 11:57:32 -03:00
Raphael S. Carvalho
f62f4ef5de sstables: add support to write expiring cells
Expiring cell means a cell with a TTL.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-05-11 11:55:30 -03:00
Avi Kivity
134e1040b1 Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-05-11 17:39:06 +03:00
Calle Wilund
183e0b52e6 commitlog: Add collectd counters
- # segments
- # allocting segments
- # unused segments
- # allocations
- # cycles (disk writes)
- # flush
- # total bytes allocated
- # total bytes disk slack (due to dma blocks)

Counters are per-commitlog (shard). Can be extended to be per-segment also,
but would be transient and probably not much more useful.

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-11 16:06:51 +03:00
Avi Kivity
0e23702dfd core: add make_directory() API 2015-05-11 13:33:33 +03:00
Asias He
bbb4b90542 gms: Use unordered_map for endpoint_state_map
We do not really care about order.
2015-05-11 11:27:06 +03:00
Gleb Natapov
3188ae6b8b rpc: remove unneeded capture
Also 'sent' is moved twice. I wonder how it even worked. Second move was
probably done first.
2015-05-11 10:49:11 +03:00
Asias He
cce98e19e4 message: Remove more leftover
class handler_base and handler are not used anymore.
2015-05-10 12:03:27 +03:00
Tomasz Grabiec
eaceb61801 db: Add atomic_cell::deletion_time()
Deleted cells store deletion time not expiry time. This change makes
expiry() valid only for live cells with TTL and adds deletion_time(),
which is inteded to be used with deleted cells.
2015-05-10 12:03:26 +03:00
Avi Kivity
ec43027d46 Merge branch 'tgrabiec/frozen_mutation' of github.com:cloudius-systems/seastar-dev into db
Introduce frozen_mutation, from Tomasz:

"The immediate motivation for introducing frozen_mutation is inability to
deserialize current "mutation" object, which needs schema reference at the
time it's constructed. It needs schema to initialize its internal maps with
proper key comparators, which depend on schema. We can't lookup schema before
we deserialize column family ID. Another problem is that even if we had the ID
somehow, low level RPC layer doesn't know how to lookup the schema.

This form is primarily destined to be sent over the network channel. Data can
be wrapped in frozen_mutation without schema information, the schema is only
needed to access some of the fields.

frozen_mutation supports reading via visiting, without having to explode it
into an object graph. Because of that, application should be more efficient
because of fewer cache misses.

We also don't have to serialize it back for the commit log, it's serialized
only once on the coordinator node.

Different serialization formats are not supported yet."

Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-10 11:54:03 +03:00
Raphael S. Carvalho
68d76cb915 sstables: fix a bug in data_consume_rows_context::read_64
When the temporary buffer has enough data for a uint64 to be
consumed, we readily consume it.
The problem is that we were wrongly storing the uint64 into
a uint32 variable.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-08 11:16:42 +02:00
Tomasz Grabiec
e4ef356cc3 Revert "sstables: fix a bug in data_consume_rows_context::read_64"
This reverts commit f80f00476c.

This is the vrong version of the patch.
2015-05-08 11:16:10 +02:00
Raphael S. Carvalho
f80f00476c sstables: fix a bug in data_consume_rows_context::read_64
When the temporary buffer has enough data for a uint64 to be
consumed, we readily consume it.
The problem is that we were wrongly storing the uint64 into
a uint32 variable.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-08 11:05:20 +02:00
Tomasz Grabiec
08cdeb75d9 tests: Add test for application of mutation_partition_view 2015-05-08 09:19:02 +02:00
Tomasz Grabiec
f7abbda156 db: Apply frozen_mutation directly
We don't convert it back to mutation before applying.

mutation_partition has now apply() which works on
mutation_partition_view.
2015-05-08 09:19:02 +02:00
Tomasz Grabiec
bdcd11efe9 db: Use operator<< for partition printing 2015-05-08 09:19:02 +02:00
Tomasz Grabiec
b5bac12a48 tests: Introduce frozen_mutation_test 2015-05-08 09:19:02 +02:00
Tomasz Grabiec
677b57dea2 tests: Introduce mutation_assertions.hh
For fluent asserting mutations:

  assert_that(what_we_got).is_equal_to(what_we_expect);

We could extend that in future with more specific checks, like
has_cell() etc.
2015-05-08 09:19:01 +02:00
Tomasz Grabiec
4ab66de0ae db: Introduce frozen_mutation
The immediate motivation for introducing frozen_mutation is inability
to deserialize current "mutation" object, which needs schema reference
at the time it's constructed. It needs schema to initialize its
internal maps with proper key comparators, which depend on schema.

frozen_mutation is an immutable, compact form of a mutation. It
doesn't use complex in-memory strucutres, data is stored in a linear
buffer. In case of frozen_mutation schema needs to be supplied only at
the time mutation partition is visited. Therefore it can be trivially
deserialized without schema.
2015-05-08 09:19:01 +02:00
Tomasz Grabiec
6047b6d9b2 mutation: Introduce set_static_cell() 2015-05-08 09:19:01 +02:00
Tomasz Grabiec
386d17dff6 mutation_partition: Introduce apply_insert() 2015-05-08 09:19:01 +02:00
Tomasz Grabiec
84d2b2b2ea mutation_partition: Add view version of apply_delete() 2015-05-08 09:19:01 +02:00
Tomasz Grabiec
9235ca57ad mutation_partition: Reuse clustered_row() in apply_delete() 2015-05-08 09:19:01 +02:00
Tomasz Grabiec
cc4e2ec622 mutation_partition: Add r-value variant of clustered_row() 2015-05-08 09:19:01 +02:00