Commit Graph

24 Commits

Author SHA1 Message Date
Paweł Dziepak
3fe5ed3cd9 query: use result_view::consume() where appropriate
Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
2016-08-22 09:31:33 +01:00
Gleb Natapov
2a00c06dd5 query: fix non full clustering key deserialization
Clustering key prefix may have less columns than described in schema.
Deserailiaztion should stop when end of buffer is reached.

Message-Id: <20160503140420.GP23113@scylladb.com>
2016-05-04 17:42:28 +02:00
Avi Kivity
db03295c8a Merge "Fix query digest mismatch" from Tomasz
"Currently data query digest includes cells and tombstones which may have
expired or be covered by higher-level tombstones. This causes digest
mismatch between replicas if some elements are compacted on one of the
nodes and not on others. This mismatch triggers read-repair which doesn't
resolve because mutations received by mutation queries are not differing,
they are compacted already.

The fix adds compacting step before writing and digesting query results by
reusing the algorithm used by mutation query. This is not the most optimal
way to fix this. The compaction step could be folded with the query writing,
there is redundancy in both steps. However such change carries more risk,
and thus was postponed.

perf_simple_query test (cassandra-stress-like partitions) shows regression
from 83k to 77k (7%) ops/s.

Fixes #1165."
2016-04-08 12:13:29 +03:00
Pekka Enberg
38a54df863 Fix pre-ScyllaDB copyright statements
People keep tripping over the old copyrights and copy-pasting them to
new files. Search and replace "Cloudius Systems" with "ScyllaDB".

Message-Id: <1460013664-25966-1-git-send-email-penberg@scylladb.com>
2016-04-08 08:12:47 +03:00
Tomasz Grabiec
f15c380a4f database: Compact mutations when executing data queries
Currently data query digest includes cells and tombstones which may have
expired or be covered by higher-level tombstones. This causes digest
mismatch between replicas if some elements are compacted on one of the
nodes and not on others. This mismatch triggers read-repair which doesn't
resolve because mutations received by mutation queries are not differing,
they are compacted already.

The fix adds compacting step before writing and digesting query results by
reusing the algorithm used by mutation query. This is not the most optimal
way to fix this. The compaction step could be folded with the query writing,
there is redundancy in both steps. However such change carries more risk,
and thus was postponed.

perf_simple_query test (cassandra-stress-like partitions) shows regression
from 83k to 77k (7%) ops/s.

Fixes #1165.
2016-04-07 19:56:58 +02:00
Paweł Dziepak
82d2a2dccb specify whether query::result, result_digest or both are needed
Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
2016-03-11 18:27:13 +00:00
Tomasz Grabiec
63006e5dd2 query: Serialize collection cells using CQL format
We want the format of query results to be eventually defined in the
IDL and be independent of the format we use in memory to represent
collections. This change is a step in this direction.

The change decouples format of collection cells in query results from
our in-memory representation. We currently use collection_mutation_view,
after the change we will use CQL binary protocol format. We use that because
it requires less transformations on the coordinator side.

One complication is that some list operations need to retrieve keys
used in list cells, not only values. To satisfy this need, new query
option was added called "collections_as_maps" which will cause lists
and sets to be reinterpreted as maps matching their underlying
representation. This allows the coordinator to generate mutations
referencing existing items in lists.
2016-02-15 17:05:55 +01:00
Tomasz Grabiec
5f756fcbe5 query: Add cql_format property to partition_slice
It will specify in which format CQL values should be serialized. Will
allow for rolling out new CQL binary protocol versions without
stalling reads.
2016-02-15 17:05:55 +01:00
Tomasz Grabiec
9d11968ad8 Rename serialization_format to cql_serialization_format 2016-02-15 16:53:56 +01:00
Tomasz Grabiec
22254e94cc query::result_set: Add constructor from mutation 2016-01-08 21:10:26 +01:00
Avi Kivity
2c3591cbd9 data_value de-any-fication
We use boost::any to convert to and from database values (stored in
serlialized form) and native C++ values.  boost::any captures information
about the data type (how to copy/move/delete etc.) and stores it inside
the boost::any instance.  We later retrieve the real value using
boost::any_cast.

However, data_value (which has a boost::any member) already has type
information as a data_type instance.  By teaching data_type intances about
the corresponding native type, we can elimiante the use of boost::any.

While boost::any is evil and eliminating it improves efficiency somewhat,
the real goal is growing native type support in data_type.  We will use that
later to store native types in the cache, enabling O(log n) access to
collections, O(1) access to tuples, and more efficient large blob support.
2015-10-30 17:38:51 +01:00
Avi Kivity
d5cf0fb2b1 Add license notices 2015-09-20 10:43:39 +03:00
Avi Kivity
deccb0f718 result_set: fix deserialization of collection types
Collection cells in query results are serialized using the "mutation form",
and must be deserialized using that format as well.

Fixes "--logger-log-level storage_proxy=trace" crasher.
2015-09-03 20:39:30 +03:00
Tomasz Grabiec
9aec8b9591 query: result_set: Use type's to_string() to get prettier printout 2015-07-09 19:55:00 +02:00
Tomasz Grabiec
cb9b48d9be query: result_set: Add static columns even if there are no clustered rows 2015-07-09 19:55:00 +02:00
Tomasz Grabiec
724099abe9 query: result_set_builder: Use the set of columns which was queried for
This builder is the one used to build the convenient result_set (not
on fast path). The builder was assuming that the whole set of columns
was always queried, which resulted in buffer underflow exceptions
during parsing of the results if this was not the case. Let's also
handle queries which have narrower column sets.
2015-07-09 11:35:31 +03:00
Tomasz Grabiec
4c008e059a result_set: Store schema pointer with result_set 2015-07-02 13:25:46 +02:00
Tomasz Grabiec
f388139a7b result_set_builder: Move to source file 2015-07-02 13:25:46 +02:00
Tomasz Grabiec
a1f6dec067 result_set: Introduce from_raw_result() factory method 2015-07-02 13:25:46 +02:00
Tomasz Grabiec
c9e5508e3c result_set_builder: Make build() return unwrapped object
It's better to let the user decide which kind (if any) of smart
pointer to wrap it into.
2015-07-02 13:25:46 +02:00
Pekka Enberg
ee3dbcd294 query-result-set: Add operator<< for result sets
Add operator<< for result sets to make debugging schema merging code
issues easier.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-05 12:59:57 +03:00
Pekka Enberg
446555f2de query-result-set.hh: Use data_value instead of boost::any
Switch to data_value in preparation for adding support for comparison
operators.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-27 11:49:12 +03:00
Avi Kivity
6290dee438 db: const correctness for abstract_type and friends
Types are immutable.
2015-04-29 15:40:38 +03:00
Pekka Enberg
f17a8a7a92 query: Add support for result sets
Add a query::result_set class that contains per-row cells that can be
accessed by column name. Partition keys, clustering keys, and static
values are duplicated for every row for convenience.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-28 15:49:34 +03:00