Commit Graph

3005 Commits

Author SHA1 Message Date
Avi Kivity
8073abb070 Merge branch 'tgrabiec/compound-fixes' of github.com:cloudius-systems/seastar-dev into db
Bug fixes in the compound class, from Tomasz.
2015-04-28 12:41:18 +03:00
Tomasz Grabiec
b4c400612a tests: Introduce compound_test 2015-04-28 11:03:21 +02:00
Tomasz Grabiec
4c2390348e tests: Introduce range_assert
Makes it wasier to express requirements about ranges.
2015-04-28 11:03:20 +02:00
Tomasz Grabiec
923aca98f4 compound: Fix handling of empty components in prefixable compounds
We didn't handle properly the case when the last component of a
prefixable compound was empty. Because we do not encode component's
length, we did not distinguish a compound with last element empty from
a compound without the last element.

The fix is to always encode lengths in prefixable tuples.
2015-04-28 11:03:20 +02:00
Tomasz Grabiec
bdf0db974a compound: Swap order of enum elements
The order doesn't matter for correctness, but now "yes" will show as
"1" and "no" as "0" in GDB (it doesn't seem to resolve enum values to
names).
2015-04-28 11:01:04 +02:00
Tomasz Grabiec
6e78344c87 Merge tag 'avi/usertypes-addendum/v1' from seastar-dev.git 2015-04-27 12:53:00 +02:00
Avi Kivity
23db4e0b54 db: rename db_tuple_type to tuple_type
Now that we reclaimed the tuple_type name, use it for its rightful owner.
2015-04-27 12:27:18 +02:00
Avi Kivity
f779c54d75 db: rename tuple_type family to compound_type
tuples already have a meaning in Cassandra and in C++, let's not overload
the word even more.  Use compound, which is the word used in Origin as well.
2015-04-27 12:27:18 +02:00
Avi Kivity
28f9f629c9 Merge branch 'asias/locator_v1' of github.com:cloudius-systems/seastar-dev into db
Convert some more snitch related classes, from Asias.
2015-04-27 10:46:05 +03:00
Asias He
b8e56254ee locator: Convert RackInferringSnitch.java to C++ 2015-04-27 15:13:14 +08:00
Asias He
c8c7a37afa locator: Import RackInferringSnitch.java 2015-04-27 14:58:18 +08:00
Asias He
bc034aeaec locator: Convert AbstractNetworkTopologySnitch.java to C++ 2015-04-27 14:57:25 +08:00
Asias He
23ae3da303 locator: Import AbstractNetworkTopologySnitch.java 2015-04-27 14:15:00 +08:00
Avi Kivity
803481792b tests: test cql3 type-cast with user-defined types 2015-04-26 19:25:39 +03:00
Avi Kivity
fcaf33328f tests: fix test_user_type comment 2015-04-26 19:25:39 +03:00
Avi Kivity
57b5907572 tests: add local_db() method to cql_test_env
Needed for functionality not yet exposed by cql.
2015-04-26 19:25:39 +03:00
Avi Kivity
01347bf091 cql3: enable grammar for frozen<type> 2015-04-26 19:25:39 +03:00
Avi Kivity
74cd3a58ef cql3: add frozen type support to cql3_type 2015-04-26 19:25:39 +03:00
Avi Kivity
3fec0842ef cql3: enable grammar for user type names 2015-04-26 19:25:39 +03:00
Avi Kivity
bc1ab16adc cql3: convert reserved_type_names() in grammar 2015-04-26 19:25:39 +03:00
Avi Kivity
6f2751750f cql3: add uninitialized<> helper for ANTLR
ANTLR insists on default-initializing rule return values, which doesn't
always make sense.  Rather than wrapping with optional<> or shared_ptr<>,
introduce a specialized wrapper that only handles late initialization (by
assignment).

Example:

  foo returns [uninitialized<some_type> ret]
     ...
         { $ret = ...; }
2015-04-26 19:25:39 +03:00
Avi Kivity
0ef85e2be6 cql3: implement cql3_type support for user types 2015-04-26 19:25:39 +03:00
Avi Kivity
7f781e314e cql3: add ut_name ostream operator 2015-04-26 19:25:39 +03:00
Avi Kivity
bc4d23883b cql3: simplify ut_name constructor
shared_ptr<> is already optional, so remove the outer optional<> wrapper.
2015-04-26 19:25:39 +03:00
Avi Kivity
31133ee47a cql3: disambiguate join() call in cql3_type
Gets confused with boost::join() due to ADL, when boost::join() is available.
2015-04-26 18:45:59 +03:00
Avi Kivity
8825a2bd74 cql3: add missing include to ut_name.hh 2015-04-26 18:45:59 +03:00
Avi Kivity
ba0afecf2e db: implement user_types_metadata
This is a simple map of type names to types, with the slight complication
of checking for compatibility when replacing a type.
2015-04-26 18:33:25 +03:00
Avi Kivity
b3b553821f Merge branch 'master' of github.com:cloudius-systems/seastar into db
Contains patch from Amnon to update the calls to http set_routes().
2015-04-26 13:16:35 +03:00
Amnon Heiman
f06c12e031 http: fix crash due to set_routes() not managing lifetime correctly
When using the set_routes with the registry builder, the shared_ptr of
the registry builder should be captured.

In the original implementation the api_registery_builder captured this
parameter, but as the shared_ptr was not captured it was deleted,
causing the http to crash when running in debug.

In this implementation the method that use the registry creates a lambda
function and inside it calls the set_api_doc method, this allows to
catch the shared_ptr so it lives until the function complete.

It also replaces the c style cast to static_cast and add a FIXME note to
the routes implementation, that handlers should be deleted to prevent
memory leak.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-04-26 13:09:26 +03:00
Avi Kivity
65b8b19ca7 Merge branch 'tgrabiec/order-partitions-by-decorated-key' of github.com:cloudius-systems/seastar-dev into db
Use decorated_key in partition maps, from Tomasz:

"Partitions should be ordered using Origin's ordering, which is the natural
ordering of decorated_key. This is achieved by switching column_family's
partition map to use decorated_key instead of a bare partition_key.

This also includes some cleanups."

[avi] trivial adjustments to sstables/keys.cc
2015-04-25 19:22:51 +03:00
Avi Kivity
53eb59e8ab Merge branch 'bsearch' of github.com:glommer/urchin into db
sstable index/summary binary search, from Glauber.
2015-04-25 18:54:43 +03:00
Avi Kivity
adfd737ad9 Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-04-25 18:54:11 +03:00
Glauber Costa
2b8035a718 sstring: add a fill constructor
std::string has it, we don't.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-04-25 02:02:04 +03:00
Tomasz Grabiec
5a7e3d3278 db: Order partitions by decorated_key
Partitions should be ordered using Origin's ordering, which is first
by token, then by Origin's representation of the key. That is the
natural ordering of decorated_key.

This also changes mutation class to hold decorated_key, to avoid
decoration overhead at different layers.
2015-04-24 18:01:01 +02:00
Tomasz Grabiec
474dbbbc88 db/serializer: Avoid unnecessary lookup of column family ID
We can now get it from schema.
2015-04-24 18:01:01 +02:00
Tomasz Grabiec
9f3053a867 db/serializer: Fix coding style 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
1c3275c950 mutation: Encapsulate fields 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
2b157a5526 locator: Take token by const& 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
71041eb0d6 dht: Implement operator<< for decorated_key 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
841a13da93 dht: Implement operator!= for decorated_key 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
4641bc6f95 database: Move implementation to source file 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
88b9966c38 keys: Avoid unnecessary lw_shared_ptr copy 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
a9972b4b28 Relax header dependencies 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
6c07f4ae5d Introduce database_fwd.hh with forward declarations 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
731a63e371 schema: Embed raw_schema inside schema
Public fields got encapsulated.
2015-04-24 18:01:01 +02:00
Glauber Costa
00f8c148d6 tests: test summary binary search.
Make sure that, for selected Summary files, the first key is always found to be
in position 0. In order to do that, we need to create an sstable::key. By having
this test using multiple data types (including collections and composites), we also
make sure that the serialization is sound.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-24 10:11:50 -04:00
Glauber Costa
28f936d6d2 sstables: summary binary search
Search code is trivially taken from Origin, but adapted so that the comparison
is done explicitly.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-24 10:11:50 -04:00
Glauber Costa
8508a246bb sstable: convenient view for types
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-24 10:11:49 -04:00
Glauber Costa
7c7da26347 dht: generate a token from a bytes_view
It has been determined that we will store partition_keys in the decorated_keys.
That is totally fine, but the token needs to be generatable from an sstable::key
as well.

Since both types convert well to a bytes_view - and the first thing get_token() does
is precisely to generate that view, let's generate the token from a bytes_view instead.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-24 10:11:49 -04:00
Glauber Costa
5b8b2e835a sstable: add sstable::key type
We have our own representation of a partition_key, clustering_key, etc. They
may different slightly from a legacy sstable key because we don't necessarily
serialize composites in our internal representation the same way as Origin
does. This patch encodes the Origin composite serialization, so we can create
keys that are compatible with Origin's understanding of what a partition key
should look like.

This whould be used when serializing or deserializing to/from an sstable.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-24 10:11:49 -04:00