Commit Graph

466 Commits

Author SHA1 Message Date
Avi Kivity
dabe70c9a2 cql3: remove Java remnants from maps.hh
The code was converted to C++ but the old Java remained.
2015-04-21 10:57:35 +03:00
Avi Kivity
7f78618a64 cql3: remove gunk from constants.hh 2015-04-21 10:41:20 +03:00
Avi Kivity
b4e380b922 cql3: enable user_type literal grammar 2015-04-20 16:15:35 +03:00
Avi Kivity
c01515d291 cql3: convert user_types.hh to C++ 2015-04-20 16:15:35 +03:00
Avi Kivity
3920ab18b2 cql3: enable user type grammar for field selection 2015-04-20 16:15:35 +03:00
Avi Kivity
f841a05475 cql3: convert selectable::with_field_selection to C++
Due to circular dependencies (selectable::with_field_selection ->
  column_identifier -> selectable) a new header file was created.
2015-04-20 16:15:34 +03:00
Avi Kivity
fa961f1e5e cql3: convert field_selector to C++ 2015-04-20 16:15:34 +03:00
Avi Kivity
3d38708434 cql3: pass a database& instance to most foo::raw::prepare() variants
To prepare a user-defined type, we need to look up its name in the keyspace.
While we get the keyspace name as an argument to prepare(), it is useless
without the database instance.

Fix the problem by passing a database reference along with the keyspace.
This precolates through the class structure, so most cql3 raw types end up
receiving this treatment.

Origin gets along without it by using a singleton.  We can't do this due
to sharding (we could use a thread-local instance, but that's ugly too).

Hopefully the transition to a visitor will clean this up.
2015-04-20 16:15:34 +03:00
Tomasz Grabiec
979b671adf cql3: Fix abstract_marker::raw::prepare()
It was using the wrong version of "collection_type(_impl)?" class.
2015-04-17 15:08:06 +02:00
Tomasz Grabiec
744d75e7f8 db: Move max_ttl from db/expiring_cell.hh to gc_clock.hh 2015-04-17 15:08:06 +02:00
Tomasz Grabiec
d87fbe9eb8 cql3: Fix references to obsolete collection types
The code was using the wrong version of list_type_impl and
collection_type_impl.
2015-04-17 15:08:06 +02:00
Avi Kivity
2f079e2810 Add missing maps.cc 2015-04-16 08:17:14 +03:00
Avi Kivity
3d134a797e Merge branch 'tgrabiec/query-format-v2' of github.com:cloudius-systems/seastar-dev into db 2015-04-15 21:59:34 +03:00
Avi Kivity
e50be70de2 cql3: move cql3_type's raw classes to .cc 2015-04-15 21:52:04 +03:00
Tomasz Grabiec
ee906471ab cql3: Move method implementations to .cc 2015-04-15 20:44:59 +02:00
Tomasz Grabiec
00f99cefd4 db: split query.hh to reduce header dependencies 2015-04-15 20:44:59 +02:00
Tomasz Grabiec
878a740b9d db: Write query results in serialized form
This gives about 30% increase in tps in:

  build/release/tests/perf/perf_simple_query -c1 --query-single-key

This patch switches query result format from a structured one to a
serialized one. The problems with structured format are:

  - high level of indirection (vector of vectors of vectors of blobs), which
    is not CPU cache friendly

  - high allocation rate due to fine-grained object structure

On replica side, the query results are probably going to be serialized
in the transport layer anyway, so this change only subtracts
work. There is no processing of the query results on replica other
than concatenation in case of range queries. If query results are
collected in serialized form from different cores, we can concatenate
them without copying by simply appending the fragments into the
packet. This optimization is not implemented yet.

On coordinator side, the query results would have to be parsed from
the transport layer buffers anyway, so this also doesn't add work, but
again saves allocations and copying. The CQL server doesn't need
complex data structures to process the results, it just goes over it
linearly consuming it. This patch provides views, iterators and
visitors for consuming query results in serialized form. Currently the
iterators assume that the buffer is contiguous but we could easily
relax this in future so that we can avoid linearization of data
received from seastar sockets.

The coordinator side could be optimized even further for CQL queries
which do not need processing (eg. select * from cf where ...)  we
could make the replica send the query results in the format which is
expected by the CQL binary protocol client. So in the typical case the
coordinator would just pass the data using zero-copy to the client,
prepending a header.

We do need structure for prefetched rows (needed by list
manipulations), and this change adds query result post-processing
which converts serialized query result into a structured one, tailored
particularly for prefetched rows needs.

This change also introduces partition_slice options. In some queries
(maybe even in typical ones), we don't need to send partition or
clustering keys back to the client, because they are already specified
in the query request, and not queried for. The query results hold now
keys as optional elements. Also, meta-data like cell timestamp and
ttl is now also optional. It is only needed if the query has
writetime() or ttl() functions in it, which it typically won't have.
2015-04-15 20:44:50 +02:00
Tomasz Grabiec
a22a9bd3fb cql3: Cache contains_static_columns() 2015-04-15 20:33:49 +02:00
Tomasz Grabiec
f9afd82231 cql3: Remove unnecessary indirection to result_set_builder 2015-04-15 20:33:49 +02:00
Tomasz Grabiec
7ebc7830b7 db: Optimize column family lookup in query path 2015-04-15 20:33:48 +02:00
Tomasz Grabiec
06f198b10c schema: Add id field
It uniquely identifies column_family globally. Will be used for
column_family lookups.
2015-04-15 20:33:48 +02:00
Tomasz Grabiec
4f774c3053 cql3: Reset timestamp and ttl when adding missing cell 2015-04-15 20:33:48 +02:00
Avi Kivity
a5b675b988 cql3: move maps.hh code to .cc 2015-04-15 21:21:05 +03:00
Avi Kivity
6866fd4620 cql3: enable IN marker grammar and some call sites 2015-04-15 18:01:50 +02:00
Tomasz Grabiec
560c972bb3 Merge tag 'avi/tuples/v3' from seastar-dev.git
Resolved trivial conflicts in:
	cql3/lists.cc
	tests/urchin/cql_query_test.cc
2015-04-15 18:01:37 +02:00
Avi Kivity
51b8c4c230 cql3: fix #include directive syntax in single_column_restriction.hh 2015-04-15 15:53:31 +03:00
Avi Kivity
1c630fa42a cql3: enable tuple-related grammar 2015-04-15 15:35:31 +03:00
Avi Kivity
609bda59f5 cql3: convert tuples.hh to C++ 2015-04-15 15:35:30 +03:00
Avi Kivity
7bd1d0b2ad cql3: support for tuple cql3_type 2015-04-15 15:35:30 +03:00
Avi Kivity
6a89d8291f cql3: fix multi_item_terminal::get_elements() signature
A tuple is a multi_item_terminal that can contain NULLs, so we need to
return a vector of bytes_opt, not bytes.

Unfortunately the lists code needs to be uglified as a result.
2015-04-15 15:35:30 +03:00
Avi Kivity
c9d3a06157 cql3: fix multi_column_raw::prepare() signature
Wants a shared_ptr<column_specification>, not a reference.  Arguably
column_specification should be made into a value type.

Luckily no users yet.
2015-04-15 15:35:30 +03:00
Tomasz Grabiec
452507ceb6 Merge tag 'avi/element_deletion/v2' from seastar-dev.git to db 2015-04-14 15:59:53 +02:00
Tomasz Grabiec
4763260d24 cql3: Add header with forward declaration of query_options 2015-04-14 15:36:42 +02:00
Avi Kivity
e679ec4675 cql3: enable deletion_operation grammar
DELETE foo[x] FROM tab;

where foo is some collection and x is a constant.
2015-04-14 12:25:30 +03:00
Avi Kivity
54b7cef55a cql3: convert element_deletion operation to C++ 2015-04-14 12:25:30 +03:00
Avi Kivity
94f4a23464 cql3: convert maps::discarder_by_key to C++ 2015-04-14 12:25:28 +03:00
Avi Kivity
f5e585bc38 cql3: enable batch statement grammar 2015-04-13 14:58:03 +03:00
Avi Kivity
656bd17de2 cql3: convert batch_statement to C++ 2015-04-13 14:57:22 +03:00
Avi Kivity
af4061e372 cql3: make modification_statement::get_mutations() public
batch_statement wants it.
2015-04-13 14:55:47 +03:00
Avi Kivity
f1fe44a407 cql3: add batch support to query_options
Transport support yet to be wired up.
2015-04-13 14:55:07 +03:00
Avi Kivity
de2bb71432 cql3: fix bad bracing in maps.hh
Random open and close brace, luckily no harm done.
2015-04-12 15:13:54 +03:00
Avi Kivity
5f7f925ca0 cql3: convert lists::discarder_by_index to C++ 2015-04-12 15:13:54 +03:00
Avi Kivity
0bc505b5ad cql3: remove gunk from modification_statement 2015-04-12 11:18:58 +03:00
Avi Kivity
4d38dfc303 cql3: enable grammar for delete statement conditions 2015-04-12 11:12:22 +03:00
Avi Kivity
5f05fa7087 cql3: move function_call.hh code to .cc file 2015-04-11 17:31:54 +03:00
Avi Kivity
339bf29753 cql3: enable float and double types in grammar 2015-04-11 00:54:44 +03:00
Avi Kivity
ff9536fffc cql3: de-virtualize query_options
query_options is needlessy organized as a class hierarchy, even though it's
really a simple value type.

Fix by folding all the derived classes into it.
2015-04-09 09:31:48 +02:00
Avi Kivity
538c7fdf2a cql3: fix query_options::DEFAULT not smp safe
Contains a shared_ptr (inside specific_options), so cannot be global.  Make
it thread_local instead.
2015-04-09 09:31:11 +02:00
Avi Kivity
c0be021c17 cql3: enable type cast grammar 2015-04-08 09:34:45 +02:00
Avi Kivity
cfac0c5105 cql3: convert type_cast to C++ 2015-04-08 09:34:45 +02:00