Commit Graph

2343 Commits

Author SHA1 Message Date
Pekka Enberg
9d17a4e6da transport: Use constant for CQL version
There's a CQL version constant in query processor. Use it when
advertising CQL version to clients.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-20 11:21:18 +02:00
Tomasz Grabiec
44f48adc85 Merge remote-tracking branch 'dev/penberg/cql-prepared-stmts'
From Pekka:

This series adds initial support for CQL prepared statements which gives
a nice 2.5x single core performance boost for Urchin:

  $ ./build/release/seastar --data data --smp 1

  $ ./tools/bin/cassandra-stress write -mode cql3 simplenative -rate threads=32

  Results:
  op rate                   : 31728
  partition rate            : 31728
  row rate                  : 31728
  latency mean              : 1.0
  latency median            : 0.9
  latency 95th percentile   : 1.8
  latency 99th percentile   : 1.8
  latency 99.9th percentile : 5.6
  latency max               : 181.7
  Total operation time      : 00:00:30
  END

  $ ./tools/bin/cassandra-stress write -mode cql3 simplenative prepared -rate threads=32

  Results:
  op rate                   : 75033
  partition rate            : 75033
  row rate                  : 75033
  latency mean              : 0.4
  latency median            : 0.4
  latency 95th percentile   : 0.7
  latency 99th percentile   : 0.8
  latency 99.9th percentile : 3.4
  latency max               : 205.0
  Total operation time      : 00:00:30
  END
2015-03-19 16:01:00 +01:00
Pekka Enberg
d04c41d8a8 transport: CQL prepared statements
This patch adds initial support for PREPARE and EXECUTE requests which
are used by the CQL binary protocol for prepared statements. The use of
prepared statement gives a nice 2.5x single core performance boost for
Urchin:

  $ ./build/release/seastar --data data --smp 1

  $ ./tools/bin/cassandra-stress write -mode cql3 simplenative -rate threads=32

  Results:
  op rate                   : 31728
  partition rate            : 31728
  row rate                  : 31728
  latency mean              : 1.0
  latency median            : 0.9
  latency 95th percentile   : 1.8
  latency 99th percentile   : 1.8
  latency 99.9th percentile : 5.6
  latency max               : 181.7
  Total operation time      : 00:00:30
  END

  $ ./tools/bin/cassandra-stress write -mode cql3 simplenative prepared -rate threads=32

  Results:
  op rate                   : 75033
  partition rate            : 75033
  row rate                  : 75033
  latency mean              : 0.4
  latency median            : 0.4
  latency 95th percentile   : 0.7
  latency 99th percentile   : 0.8
  latency 99.9th percentile : 3.4
  latency max               : 205.0
  Total operation time      : 00:00:30
  END

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-19 15:54:46 +02:00
Pekka Enberg
19978d6f4b transport: Make type_codec::type_id_to_type thread-local
Data type objects are thread-local so the lookup map also needs to be
thread-local. Fixes SMP issues when prepared statements are enabled
which exercise the type encoders.

Spotted by Tomek.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-19 15:54:46 +02:00
Pekka Enberg
52eca8a4ff cql3: Convert constants::marker binding to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-19 15:54:46 +02:00
Pekka Enberg
158a6f0023 transport: Clean up process_query()
Consistency level and flags are handled in read_options().

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-19 09:19:47 +02:00
Avi Kivity
d08308029a Merge branch 'asias/gossip' of github.com:cloudius-systems/seastar-dev into db
More gossip conversion, from Asias.
2015-03-19 09:18:58 +02:00
Pekka Enberg
e14821560c transport: Fix bytes serialization
The in-wire protocol wants raw bytes, not hex representation. Broken by
commit a2519926a6 ("db: add some iostream
output operators").

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-18 15:10:24 +02:00
Avi Kivity
d1310f4886 Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-03-18 13:14:19 +02:00
Raphael S. Carvalho
6e049a4a98 tests: add test_fstream_unaligned testcase to fstream test
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-18 13:10:00 +02:00
Avi Kivity
bdd188f459 Merge branch 'tgrabiec/select' of github.com:cloudius-systems/seastar-dev into db
Preparation for range queries, from Tomasz:

"This series adds static typic for different key variants.

It also changes clustered row map to boost implementation which allows to use
heterogenous keys, so that we can lookup a row by a full prefix without
reserializing it.

Similar change is made to row prefix tombstones."
2015-03-18 12:58:01 +02:00
Avi Kivity
cab0d4217c Merge branch 'penberg/cql-bind-variables' of github.com:cloudius-systems/seastar-dev into db
Bind variables grammar conversion, from Pekka.
2015-03-18 12:51:34 +02:00
Pekka Enberg
a7be56d787 cql3: Fix inverted condition in abstract_marker::raw::prepare()
If receiver type is not a collection type, we need to return early; not
the other way around.

Fixes SIGSEGV with cassandra-stress when prepared statements are
enabled.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-18 12:39:10 +02:00
Avi Kivity
6852f21463 future: mark state as invalid when moving away from *this
Avoid inconsistency between an future thinking it's an exception, while
the exception pointer is null.

Fixes smp_test.
2015-03-18 12:34:32 +02:00
Pekka Enberg
c3d2b39e80 cql3: Convert bind variable marker grammar
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-18 11:55:26 +02:00
Pekka Enberg
cb6aa2f0b5 cql3: Fix abstract_marker::to_string()
Needed to be able to instantiate abstract_marker class.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-18 11:55:26 +02:00
Pekka Enberg
4efaccaff6 cql3: Use forward declaration for result_message
There's a cyclic dependency between cql3 and transport namespaces when
we introduce prepared statements. The latter pulls
parsed_statement::prepared from the former. Break the cycle by using
a forward delcaration in cql_statement.hh.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-18 11:14:40 +02:00
Pekka Enberg
b40661c330 cql3: Use shared_ptr for prepared statements
Query processor needs to store prepared statements as part of a client
session for PREPARE and EXECUTE requests. Switch from unique_ptr to
shared_ptr in preparation for that.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-18 10:49:41 +02:00
Asias He
a53848b6dd gossip: Use distributed<> for the gossiper and failure_detector instance
They are per-node, we will run them on cpu0 only.
2015-03-18 15:39:38 +08:00
Asias He
aba6377898 gossip: Convert more of gossiper class 2015-03-18 15:39:38 +08:00
Asias He
febf32acfa gossip: Add default constructor for endpoint_state 2015-03-18 09:07:42 +08:00
Asias He
4772d18a6c gossip: Return reference in endpoint_state::get_application_state_map 2015-03-18 09:07:42 +08:00
Asias He
2f693d93e0 gossip: Return optional in endpoint_state::get_application_state 2015-03-18 09:07:42 +08:00
Asias He
b0c1be2412 gossip: Introduce the_failure_detector()
The global failure_detector instance.
2015-03-18 09:07:41 +08:00
Asias He
d4395c2d5d gossip: Rename beforechange to before_change 2015-03-18 09:07:41 +08:00
Asias He
40c1f6a4db gossip: Add operator== for inet_address 2015-03-18 09:07:41 +08:00
Tomasz Grabiec
83e91d6de4 tests: Add more tests for range tombstones 2015-03-17 15:56:29 +01:00
Tomasz Grabiec
6197c5306d db: Optimize range tombstone lookups
From O(N) to O(log(N)) where N is the number of range tombstones.
2015-03-17 15:56:29 +01:00
Tomasz Grabiec
9d1fe2c8d9 types: Rename tuple_type::component_iterator to 'iterator' 2015-03-17 15:56:29 +01:00
Tomasz Grabiec
9f60853271 db: Switch clustering key map and row tombstones to boost::intrusive::set
std::map<> does not support lookup using different comparator than the
one used to compare keys. For range prefix queries and for row prefix
tombstone queries we will need to perform lookups using different
comparators.
2015-03-17 15:56:29 +01:00
Tomasz Grabiec
1b1af8cdfd db: Introduce types to hold keys
Holding keys and their prefixes as "bytes" is error prone. It's easy
to mix them up (or use wrong types). This change adds wrappers for
keys with accessors which are meant to make misuses as difficult as
possible.

Prefix and full keys are now distinguished. Places which assumed that
the representation is the same (it currently is) were changed not to
do so. This will allow us to introduce more compact storage for non-prefix
keys.
2015-03-17 15:56:29 +01:00
Tomasz Grabiec
fffa35ac6b types: Make abstract_type::validate() work on bytes_view 2015-03-17 15:56:29 +01:00
Tomasz Grabiec
4b33888c23 types: Add algorithms for comparing optional types 2015-03-17 15:56:28 +01:00
Tomasz Grabiec
e3a04ae21b types: Introduce generic is_prefixed_by() 2015-03-17 15:56:28 +01:00
Tomasz Grabiec
1d5de9e428 types: Introduce lexicographical_compare() version with third sequence 2015-03-17 15:56:28 +01:00
Tomasz Grabiec
f321b9e9b5 util: Make hash functions work on bytes_view 2015-03-17 15:56:28 +01:00
Tomasz Grabiec
1f6360ec3b cql3: Drop redundant key validation
Keys are also validated right before in build_partition_keys().
2015-03-17 15:56:28 +01:00
Tomasz Grabiec
ecf0db17ce db: Drop comment which doesn't seem to be relevant any more 2015-03-17 15:56:28 +01:00
Tomasz Grabiec
a195df836d service: Cleanup formatting in storage_proxy.cc 2015-03-17 15:56:28 +01:00
Avi Kivity
5a6bef867c Merge branch 'master' of github.com:cloudius-systems/seastar into urchin 2015-03-17 15:48:42 +02:00
Tomasz Grabiec
a7d6e22baf sstring: fix bounds checks in find()
'end' iterator was set past the end if pos != 0.
2015-03-17 15:37:54 +02:00
Avi Kivity
d49804ad73 cql: maps: drop unused Java declarations 2015-03-16 18:27:42 +02:00
Tomasz Grabiec
a757041fdd Merge tag 'avi/serialization_format/v2'
From Avi:

The protocol_version variable is problematic for two reasons:
- as an integer, it can get confused with a nearby unrelated integer argument
- it represents a layering violation, where the transport protocol leaks into
  the database layer

Fix by abstracting it with a new serialization_format class.  The transport
layer converts protocol_version to serialization_format.
2015-03-16 17:19:59 +01:00
Avi Kivity
6fee695095 db: replace most uses of protocol_version with serialization_format
Better type safety.
2015-03-16 18:15:16 +02:00
Avi Kivity
2ae36bdc98 maps: fix parameter mismatch in call to get_with_protocol_version() 2015-03-16 18:10:09 +02:00
Avi Kivity
0710704311 transport: propagate serialization_format to query_options 2015-03-16 18:10:09 +02:00
Avi Kivity
3aa8231c7a db: add serialization_format class
This is an abstraction layer boundary between transport and the rest of the
code.  Instead of the protocol version permeating through the code, encapsulate
it in a serialization_format variable.

This is intended to replace all uses of protocol_version outside transport.
2015-03-16 18:10:09 +02:00
Tomasz Grabiec
5c1ec6f046 Merge tag 'avi/collections/some-set-ops/v3'
From Avi:

Supports cql syntax:

  set set_column = { 1, 2, 3 }
  set set_column = set_col + { 1, 2, 3 }
2015-03-16 16:14:44 +01:00
Avi Kivity
c99185677b tests: add test for set literals and set addiitions 2015-03-16 16:45:36 +02:00
Avi Kivity
e28938b8d6 tests: fix cql_query_test indentation 2015-03-16 16:45:36 +02:00