Commit Graph

53948 Commits

Author SHA1 Message Date
Pekka Enberg
73905ff7c4 transport: Add missing include to result_message.hh
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-05 15:06:31 +02:00
Avi Kivity
56d5c24a6a db: implement CollectionType (partial) 2015-03-05 14:04:19 +02:00
Avi Kivity
b14d9f1f02 mutation: support for collections
We simply store the collection mutation as we do atomic cells -- merging
will be done by the consumer.
2015-03-05 14:03:36 +02:00
Avi Kivity
57b6d4ada5 atomic_cell: add collection support
We leave interpretation to the backing type (map/set/list), so there is
not much code here.
2015-03-05 14:03:36 +02:00
Avi Kivity
2f8be37fca atomic_cell_or_collection: allow construction from atomic_cell
Since an atomic_cell has an is-a relationship to atomic_cell_or_collection,
we can allow direct conversion.  Type information is only lost, not added.
2015-03-05 14:03:36 +02:00
Avi Kivity
76d1256565 atomic_cell: add serialize() method
Since atomic_cell is already in serialized form, the implementation is
simple.
2015-03-05 14:03:36 +02:00
Avi Kivity
bb58deadc0 cql3: add virtual destructor to class operation 2015-03-05 14:03:36 +02:00
Avi Kivity
74beb62527 schema: add stringify operation for column_definition 2015-03-05 14:03:35 +02:00
Avi Kivity
853d0b2ca0 abstract_type: implement freeze() 2015-03-05 14:03:35 +02:00
Pekka Enberg
c72f5796c4 cql3: Fix create_keyspace_statement::prepare()
Move enable_shared_from_this to the concrete create_keyspace_statement
class to make sure prepare() instantiates the right type. Fixes "pure
virtual method called" errors when calling create_keyspace_statement
methods that are pure virtual in the base class.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-05 12:20:39 +01:00
Asias He
c2052c8791 gossip: Convert to bytes_view for deserialization 2015-03-05 18:25:57 +08:00
Asias He
0036ee16d8 types: Add read_simple_short_string
bytes_view version of deserialize_string
2015-03-05 18:25:24 +08:00
Avi Kivity
7eba98f18c atomic_cell: add missing include 2015-03-05 11:17:43 +02:00
Tomasz Grabiec
55fae09bf9 db: Remove unused parameter from atomic_cell::view::is_dead() 2015-03-05 10:09:38 +01:00
Asias He
bac2966f66 gossip: Convert gms/GossipDigestAck.java to C++ 2015-03-05 17:08:15 +08:00
Asias He
83eb3f0063 gossip: Import gms/GossipDigestAck.java 2015-03-05 17:08:15 +08:00
Asias He
7e3b52844e gossip: Move gossip_digest_serialization_helper to gossip_digest.hh
It makes more sense to put the helper near class gossip_digest not class
gossip_digest_syn. The helper is used by class gossip_digest_ack as
well. The moving makes the including more clear.
2015-03-05 17:08:15 +08:00
Asias He
ad18cd582c gossip: Convert gms/GossipDigestSyn.java to C++ 2015-03-05 17:08:15 +08:00
Asias He
b1c630a524 gossip: Import gms/GossipDigestSyn.java 2015-03-05 17:08:15 +08:00
Asias He
443bc857a2 gossip: Convert gms/GossipDigest.java to C++ 2015-03-05 17:08:15 +08:00
Asias He
c63bccd81b gossip: Import gms/GossipDigest.java 2015-03-05 17:08:14 +08:00
Asias He
030ad0caba gossip: Add inet_address class
Currently it is used by gossip code only. If we have more users of it,
we can move it to a better place later.
2015-03-05 17:08:14 +08:00
Calle Wilund
054f9ed082 Initial commit log support.
Implements a cassandra-file-compatible segmented log
of "mutations". Handles "batch" and "periodic" mode like
stock version. Also includes "dirty" management for the
interaction log/memtable.

Supports:
* add
* sync/flush
* clear dirty bits (thus discarding segments)

Many more estoric stock functions not yet implemented.

Missing: Storage management. Does not deal with total
size on disk of segments yet. Nor does it have any provisions
for dealing with active buffer bloat should async writes stall.

[avi: adjust for future<>::rescue() removal]
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-03-05 11:06:09 +02:00
Calle Wilund
d92971a2b4 Add hash function to UUID.
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-03-05 11:02:46 +02:00
Calle Wilund
663cb6c4b1 db: Import db/commmitlog/*
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-03-05 11:02:46 +02:00
Avi Kivity
5902243dc5 Merge branch 'master' of github.com:cloudius-systems/seastar into db
Global adjustment due to the removal of future<>::rescue().
2015-03-05 11:00:11 +02:00
Tomasz Grabiec
d674cd7deb core: add make_shared(T&&) overload
Allows for code like this:

  auto p = make_shared(object());
2015-03-04 18:49:26 +02:00
Tomasz Grabiec
83963b23d3 Replace rescue() usages with then_wrapped()
They are pretty much the same. This change removes rescue().
2015-03-04 17:34:59 +01:00
Tomasz Grabiec
e36115e1d4 core: add then_wrapped() overload which works with void-returning callbacks 2015-03-04 17:33:38 +01:00
Calle Wilund
7b5193b80c future: deferring finally() callback
Add "finally" continuation overload for functions returning future type that
awaits finishing the continuation in question before continuing the "present"
one. I.e. a wrapper around "then_wrapped" to remove the need to deal with the
original return value.

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-03-04 18:09:34 +02:00
Raphael S. Carvalho
89ec1f8f6a slab: Add reclaimer functionality
Basic explanation of the reclaimer algorithm:
- Each slab page has a descriptor containing information about it, such as
refcnt, vector of free objects, link into LRU, etc.
- The LRU list will only contain slab pages which items are unused, so as
to make the reclaiming process faster and easier. Maintaining the LRU of slab
pages has a performance penalty of ~1.3%. Shlomi suggested an approach where
LRU would no longer exist and timestamp would be used instead to keep track of
recency. Reclaimer would then iterate through all slab pages checking for an
unused slab page with the lowest timestamp.
- Reclaimer will get the least-recently-used slab page from the LRU list,
do all the management stuff required, and iterate through the page erasing any
of the items there contained. Once reclaimer was called, it's likely that slab
memory usage is calibrated, thus slab pages shouldn't be allocated anymore.
- Reclaimer is enabled by default but can be disabled by specifying the slab
size using the application parameter --max-slab-size.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-04 17:40:58 +02:00
Nadav Har'El
68d0cd2441 input_stream: remove buf_size parameter
input_stream's constructor had an unused buf_size parameter. Such a
parameter is not needed - whenever the input_stream needs more
data it calls the underlying data_source's get(), and thus only the
data_source gets to decide the buffer size. Moreover, in some
implementations, this read buffer size will be different each time -
e.g., in a chunk-compressed file, the uncompressed chunk's size will
be different each time.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-04 17:39:16 +02:00
Avi Kivity
6d18aa8f20 Decompose database.hh, types.hh into smaller headers
Avoid include hell for new code.
2015-03-04 16:18:48 +02:00
Avi Kivity
a49330095a db: wrap bytes in atomic_cell format
We use bytes for many different things, and it is easy to get confused as
to what format the data is actually in.

Fix that for atomic_cell by proving wrappers.  atomic_cell::one corresponds
to a bytes object holding exactly one atomic cell, and atomic_cell::view is
a bytes_view to an atomic_cell.  The static functions of atomic_cell itself
are privatized to prevent the unwashed masses from using them on the wrong
objects.

Since a row entry can hold either a an atomic cell, or a collection,
depending on the schema, also introduce a variant type
atomic_cell_or_collection and allow the user to pick the type explicitly.
Internally both are stored as bytes object.
2015-03-04 15:49:35 +02:00
Shlomi Livne
1bf71073e6 tests: Add a timeout to limit execution time of tests
Support a timout to assure that we do not have run away tests

Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-03-04 15:06:20 +02:00
Pekka Enberg
d6b5caa1f3 tests: Convert cql_query_test to use Boost.Test
Use Boost.Test so that we can easily specify multiple test cases.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-04 13:16:17 +01:00
Tomasz Grabiec
ee358aa9c1 Fix warnings map to be thread-local
The map is mutated so it should be thread-local. This will make the
warnings printed once per core, but I guess it's not a big deal.
2015-03-04 13:12:12 +01:00
Nadav Har'El
6f2a2529a2 add "double" and "float" types
Implement "double" and "float" cql types.

This implementation doesn't touch serialization.hh (which should be
eventually removed) and rather follows the other examples in types.cc.
It is relatively ugly, because of all the cleverness of our "general"
byte swapping implementation actually works only for integer types, and
we need to get it to work for float/double as well.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-04 10:54:19 +01:00
Avi Kivity
c7a1981525 Merge branch 'asias/gossip' of github.com:cloudius-systems/seastar-dev into db
Initial gossip support, from Asias and Nadav.
2015-03-04 10:31:44 +02:00
Asias He
8e15ed452f gossip: Add gms/gms.cc 2015-03-04 16:08:10 +08:00
Asias He
d5f0ce2663 gossip: Add missing #pragma once 2015-03-04 15:51:35 +08:00
Nadav Har'El
65f8ee2e5c gossip: Convert gms/VersionedValue.java to C++
Left some of the stuff I got tired of converting in #if 0. Most likely
I'll need them later, and convert them then.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-04 15:48:58 +08:00
Asias He
9af0a2925f gossip: Import gms/VersionedValue.java 2015-03-04 15:47:03 +08:00
Tomasz Grabiec
760d4e1d2a Merge branch git@github.com:cloudius-systems/seastar-dev.git penberg/create-keyspace-stmt
From Pekka:

Initial pass at converting create keyspace statement parsing to C++.
2015-03-03 15:40:53 +01:00
Calle Wilund
56dce3df51 Basic rw-lock impl around semaphore.
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-03-03 14:58:58 +02:00
Pekka Enberg
6751f7a305 cql3/Cql.g: Create keyspace statement
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-03 11:57:43 +02:00
Pekka Enberg
4b384ef705 cql3/Cql.g: Properties
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-03 11:57:43 +02:00
Pekka Enberg
79caf1bc95 cql3: Fix schema_altering_statement::uses_function()
The schema_altering_statement class must implement
cql_statement::uses_function() to be instantiable.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-03 11:57:43 +02:00
Pekka Enberg
8e0903fdbd cql3: Convert statements.CreateKeyspaceStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-03 11:57:43 +02:00
Pekka Enberg
48f21ff39b cql3: Convert statements.PropertyDefinitions to C++, take 2
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-03 11:30:18 +02:00