Commit Graph

53948 Commits

Author SHA1 Message Date
Avi Kivity
89b3883783 cql3: fix too eager move in functions.hh
Can't use f and move it in the same expression.
2015-04-01 20:54:54 +03:00
Avi Kivity
db1df139e2 cql3: convert functions.hh to C++ some more 2015-04-01 20:52:21 +03:00
Avi Kivity
84b0a71716 cql3: convert function_name to C++ some more (native_function bits) 2015-04-01 20:49:35 +03:00
Avi Kivity
a59d8b384f cql3: convert scalar_functions from protocol_version to serialization_format 2015-04-01 20:48:07 +03:00
Avi Kivity
03bbcf55c2 cql3: fix max() function
Registration was done with a null shared_ptr<> instead of make_shared(),
and as a result the max template wasn't even instantiated, so it did not
even build.
2015-04-01 20:17:10 +03:00
Avi Kivity
955f1ebf06 db: fix to_hex(bytes_opt)
Result was inverted.
2015-04-01 20:16:00 +03:00
Avi Kivity
874249800d cql3: provide ostream operator for assignment_testable
To prevent name clashes, we don't call the virtual function implementing
this to_string(), but rather assignment_testable_source_context(), as its
use will be error reporting.
2015-04-01 20:12:39 +03:00
Avi Kivity
c6bee5ee2e cql3: don't require a vector<> for assignment_testable::test_all()
Allow any range.  Apologies for error message spew.
2015-04-01 20:12:39 +03:00
Avi Kivity
deb21cfa7e db: export ostream operator for partition_slice 2015-04-01 20:12:39 +03:00
Avi Kivity
a9ce81a2f8 db: add ostream operator for exploded_clustering_prefix 2015-04-01 20:12:39 +03:00
Avi Kivity
bb4b303bba db: add ostream operators for atomic_cell 2015-04-01 20:12:39 +03:00
Avi Kivity
bd3aa31c18 db: make join() work on any range, not just a vector 2015-04-01 20:12:39 +03:00
Tomasz Grabiec
889e7c12b6 Revert "Alternative way to deal with allocating reactor vs early init"
This reverts commit 9d93dd1ac3.

Committed by mistake.
2015-04-01 16:15:07 +02:00
Tomasz Grabiec
535f39eb91 Merge remote-tracking branch 'dev/calle/serializer'
Mutation serialization from Calle
2015-04-01 15:47:49 +02:00
Gleb Natapov
dbe2443c03 rpc: wait for message to be send in rpc::no_wait client's handlers
rpc::no_wait is too "no_wait" currently. When client sends a no_wait
message it immediately gets ready future in return, so client cannot
know when data is actually sent and can be discarded. This patch fixes
this by returning a future that will become ready when data is no longer
needed.
2015-04-01 14:55:58 +03:00
Marek Waszkiewicz
08a67006e7 build: build either with xen or dpdk not both
Signed-off-by: Marek Waszkiewicz <marek.waszkiewicz77@gmail.com>
2015-04-01 11:37:20 +03:00
Gleb Natapov
58c62dd121 core: drop superfluous qualifier from discard_result 2015-04-01 11:33:19 +03:00
Calle Wilund
358c370758 Add serializer test 2015-04-01 10:08:00 +02:00
Calle Wilund
6f6f924c9c Serializer object(s) for internal use
For serializing to commit log, and potentially internal wire messaging.

Note: intentionally incompatible with stock C wire/serial format.

Note: intentionally separate from the CQL-centric serialization
for a few reasons.

1.) Need "bulk serializers" for internal objects (mutation etc)
which might not fit well into the "types.hh" serializer schemes.
2.) No need for polymorphism/virtual type parameters since we know
exactly what we serialize and to where.
2015-04-01 10:08:00 +02:00
Calle Wilund
9979ee8d45 Modify commit log to use dataoutput
Both internal usage and external interface.
2015-04-01 10:08:00 +02:00
Calle Wilund
f1489bf325 Add data_output interface
For slight abstraction and OO-ification of serialization.
2015-04-01 10:08:00 +02:00
Calle Wilund
ef807ed53f Add data_input interface
Wrapper around bytes_view for input data marshalling
For more OO-style deserialization...
2015-04-01 10:08:00 +02:00
Calle Wilund
d3fe0c5182 Refactor db/keyspace/column_family toplogy
* database now holds all keyspace + column family object
* column families are mapped by uuid, either generated or explicit
* lookup by name tuples or uuid
* finder functions now return refs + throws on missing obj
2015-04-01 10:08:00 +02:00
Calle Wilund
70936e5391 Hash helper test 2015-04-01 09:43:48 +02:00
Calle Wilund
2be0cbf683 Add tuple/pair hash helper. 2015-04-01 09:43:47 +02:00
Calle Wilund
9d93dd1ac3 Alternative way to deal with allocating reactor vs early init
of "local_engine" pointer that does not mix allocation types.
2015-04-01 09:43:47 +02:00
Avi Kivity
2642f82d89 Merge branch 'tgrabiec/tests' of github.com:cloudius-systems/seastar-dev into db
Use cql_test_env in tests, from Tomasz.
2015-03-31 18:14:24 +03:00
Raphael S. Carvalho
6f3e25d935 core: add future<> remove_file()
So far, we haven't had a function to asynchronously remove a file.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-31 17:35:40 +03:00
Avi Kivity
62da83f416 Merge branch 'tgrabiec/fixes' of github.com:cloudius-systems/seastar-dev into db
Use cql_test_env in tests, query limit bug fix, IN restriction, from Tomasz.
2015-03-31 17:18:29 +03:00
Raphael S. Carvalho
44735a3c88 sstables: add support to write the component filter
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-31 17:11:00 +03:00
Raphael S. Carvalho
b3175f115d tests: sstables: move code to be reused for other components
Also, semaphore was removed because it's useless there.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-31 17:11:00 +03:00
Tomasz Grabiec
7b6d340d8a tests: Convert all test cases in cql_query_test.cc to use cql_test_env
Reduces duplication.
2015-03-31 15:58:44 +02:00
Tomasz Grabiec
f73524ddaa tests: Add cql_test_env::require_column_has_value()
Copied from cql_query_test.cc.
2015-03-31 15:57:40 +02:00
Tomasz Grabiec
eddb479ec4 tests: Move CQL response assertions to cql_assertions.hh 2015-03-31 15:56:59 +02:00
Gleb Natapov
5558abe9ec rpc: drop unused template parameter 2015-03-31 16:45:20 +03:00
Avi Kivity
4f94829792 cql3: reindent term.hh 2015-03-31 13:03:44 +03:00
Raphael S. Carvalho
f49888c649 fstream: sync file when file output stream is closed
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-31 10:26:03 +03:00
Tomasz Grabiec
3da0c3035f tests: Add test for querying static row with limit and many ranges 2015-03-30 18:38:26 +02:00
Tomasz Grabiec
09cd4c4cf0 cql3: Enable 'in' restriction
Adds support for queries like this:

  select * from cf where key in (1, 2);
2015-03-30 18:38:26 +02:00
Tomasz Grabiec
9e5a02421a db: Fix static row not being populated when query limit kicks in
Spotted during code review.
2015-03-30 18:38:26 +02:00
Tomasz Grabiec
d21966ecbc Revert "tests: Use lowres_clock in time_it()"
This reverts commit e605a0368a.

lowres_clock is not updated when reactor is not running and this
variant of time_it() is not meant to be run in a rector.
2015-03-30 18:38:26 +02:00
Nadav Har'El
f49c065cd1 sstables: fix use-after-free of temporary object
The debug-mode sanitizer discovered a bug in sstable::data_read.
I had optimistically wrote this code:

     return data_stream_at(pos).read_exactly(len);

This is wrong - data_stream_at returns a temporary input_stream object,
which gets destructed immediately and doesn't live throughout the life
of read_exactly. Obviously, this object does need to live on (among other
things, it holds the buffer which read_exactly reads into).

The solution is an ugly variant of the same thing, but which allocates
memory to hold a copy of the input stream object. Because there is no
single reader (in theory we can have a hundred different reads ongoing
in parallel from the same sstable), we really have choice but to allocate
this read context somewhere. A better solution would not use an input
stream at all, but this is a different issue, already in a FIXME.

This patch fixes the sstable test failure that Jenkins reports.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-30 18:25:38 +02:00
Avi Kivity
22b08208ef Merge branch 'amnon/future_http1' of github.com:cloudius-systems/seastar-dev
Futurize http server stack, from Amnon.
2015-03-30 17:57:51 +03:00
Pekka Enberg
6b0ad02019 cql3: Remove QueryHandler class
Cassandra added support for specifying user-specified query handlers
instead of the default QueryProcessor in CASSANDRA-6659. We don't really
need that now and as we're C++, we cannot even support existing custom
query handlers. Therefore, remove the QueryHandler class and references
to it.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-30 14:49:49 +02:00
Amnon Heiman
006b061aba Adding hello world swagger demo
This demonstrate how to use a swagger definition file to create an API.

The swagger file demo.json define one api called hello_world, it has
both query and path parameters and return an object as a result.

The handler implementation simply places the given parameters in the
return object.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-30 15:38:41 +03:00
Amnon Heiman
ff6d48bb27 adding swagger code generation to configure 2015-03-30 15:38:41 +03:00
Amnon Heiman
b93dcf3dbd json adding the swagger code generation
This takes the json2code perl script from the osv and pass it with small
adaptation.

It takes a swagger definition file and creates a hh file from it with
the following code support.

Api opperations are translated to path_description with a name that
determine by their nick name.

Moduls are defined as json object with the same name.

Enums are defined as enum class, a string to enum function is defined
for any query enum parameters.

For enums that are part of a json object a conversion function is
defined so enum of a different type can be assigned to the target enum
as long as it has the same enum values.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-30 15:38:41 +03:00
Amnon Heiman
f2147e7490 Http adding the json path
Json path are used when parsing the swagger files. Each path represent
an operation in the swagger files.

They are used to simplified setting a handler or a function to a path.

For example: the code generation would define a json_path like:

path_description hello_world("/hello/world",GET,"hello_world", {},{});

Now to define the handler that would use hello_world, you can simply do:

hello_world.set(r,
            [](const_req req) {
               return "hello world";
});

When r is a reference to a route object.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-30 15:38:41 +03:00
Amnon Heiman
f6d253b713 request return http as the protocol name 2015-03-30 15:38:41 +03:00
Amnon Heiman
2ff0f41cfb http adding file handler
File handlers support reading local file and return it as the result
for the http request.

There are two kind of handler, a file handler will return a specific
file when called. A directory handler expect to find a path parameter
called 'path' and would concatinate this parameter to the direcoty path.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-30 15:38:41 +03:00