Commit Graph

4727 Commits

Author SHA1 Message Date
Avi Kivity
4b1fd3d48d Merge "Set currently commented out properties for system tables" from Glauber
"Some of the system tables will set gc_grace_seconds, or default_time_to_live
but right now we are commenting them out.

The best way to do it would have been to somehow save the fields so we don't need to
set it all the time - as this function is effectively doing.

However, those fields would feel very spurious in the constructor, and it is not
like there isn't a lot of other things for us to set. More importantly, calling
those schema functions is a very rare event. We usually call it once and store
the pointer somewhere.

With that, we're very close to implementing everything that the system tables
needs set, missing only COMPACT STORAGE and information about compaction
strategy."
2015-07-14 10:52:22 +03:00
Avi Kivity
6024e9489a Merge seastar upstream 2015-07-14 10:52:00 +03:00
Amnon Heiman
7b355a6a02 json-api: Add an assignment operator to the json_list obj
This patch adds a general assignment operator to the json_list object.
It can accept any data structure that support const range iteration and
that its contained object can be assigned to the json_list object.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-14 10:41:40 +03:00
Glauber Costa
62364fcdd7 sstring: add compare method for parts of a sstring
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-14 09:26:03 +03:00
Glauber Costa
5ac6ed72f4 system tables: set default ttl according to Origin settings
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-13 23:58:03 -04:00
Glauber Costa
7b1b8f0e09 system tables: set gc grace period according to Origin settings
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-13 23:58:03 -04:00
Glauber Costa
39ca76fd03 schema: allow for the setting of default time to live
We have been leaving all the setter functions in the schema_builder, which is
usually fine.

The system tables, however, are not built this way, which means we need set
properties needed by them in some other way.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-13 23:58:03 -04:00
Glauber Costa
5165e8b439 schema: allow for the setting of gc grace period
We have been leaving all the setter functions in the schema_builder, which is
usually fine.

The system tables, however, are not built this way, which means we need set
properties needed by them in some other way.

Most properties are right there in the constructor, but I argue that this one
does not belong there.

Instead, provide a set method so that the system tables which need it can call.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-13 23:30:27 -04:00
Avi Kivity
62babd6b39 Merge seastar upstream 2015-07-13 19:09:36 +03:00
Avi Kivity
66451d5a9c tcp: fix assertion failure on connection reset
The connection reset code posted an exception on the _data_received promise
to break a waiter (if any), but left the optional<promise<>> engaged.  This
caused the connection destructor to attempt to post a new exception on the
same promise, which is not legal.

Fix by disengaging the optional promise, and give the same treatment to
_all_data_acked_promise.
2015-07-13 19:07:35 +03:00
Avi Kivity
0171dfbf81 tests: drop http server from messaging test
Not needed, and doesn't compile.
2015-07-13 13:20:56 +03:00
Tomasz Grabiec
f2502ae1ad row_cache: Value-initialize stats 2015-07-13 12:57:15 +03:00
Avi Kivity
bfe9d21808 Merge "Adding the storage proxy metrics" from Amnon
"This series adds the storage proxy metrics API. The definition are based on the
StorageProxyMetrics definition. This series also adds stats object to the
storage_proxy a getter function for it and an implementation based on it, but
it is currently does not adds the code to manipulate the counters."
2015-07-13 11:55:50 +03:00
Avi Kivity
e03b26ef9b Merge "Cleanup storage_proxy::query_local()" from Tomasz 2015-07-13 11:35:50 +03:00
Tomasz Grabiec
d4ec9d9566 system_keyspace: Remove the out-of-date comment from query()
The function is currently just a simple wrapper over
storage_proxy::query(). The comment has description of details which
are much lower level than this interface.
2015-07-13 10:27:02 +02:00
Tomasz Grabiec
9aed3fdbfc system_keyspace: Simplify query() by using partition_slice_builder 2015-07-13 10:27:02 +02:00
Tomasz Grabiec
bc0874d299 db: Move storage_proxy::query_local() to db::system_keyspace::query() 2015-07-13 10:27:02 +02:00
Gleb Natapov
f3adc5b729 drop unneeded && qualifier from query::result_merger::get() 2015-07-13 10:24:31 +02:00
Paweł Dziepak
38cf77b16b transport: use begin() and end() instead of sstring_view::data()
sstring_view::data() can return a pointer to a string that isn't null
terminated.

Fixes #19.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-13 10:20:39 +03:00
Amnon Heiman
06df13b091 API: Adding an implementation to storage_proxy counters
This adds an implementation to the storage_service counters. The
implementation uses the stats object inside the storage_proxy.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 22:59:43 +03:00
Amnon Heiman
dfc7121fd8 API: Add a helper function to sum stat values of a distributed objec
A common scenario in the API is to get a sigle value from a distributed
object that has a get_stats method.

The helper function would get the object and a function that return a
single value from the stat object and would perform the map_reduce.

It would return a future that can be used as a return value from the
API.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 22:59:37 +03:00
Amnon Heiman
d0ce45efbb API: Add a reference to storage_proxy into API context
The API needs to call the storage_proxy, for that a reference to the
distribute storage_proxy is added to the context and is set in main.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 22:59:37 +03:00
Amnon Heiman
0eeef904d7 Storage proxy: Adding a stats object
This adds a stat object with counters that will be used by the API. The
stat object instance will be return with a get_stats method.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 22:59:32 +03:00
Avi Kivity
b89c54df9d query::range: fix call to internal deserialized_size() template
query::range::serialized_size() calls a template method (also
called serialized_size()) within a lambda, however it is called with
a const 'this' while the template is non-const-qualified.  gcc 5
rightly rejects it (nicely annotating the template as a near miss).

Fix by making the template static; it doesn't need 'this' anyway.
2015-07-12 21:18:21 +03:00
Avi Kivity
1072a960e7 build: avoid false positive warning on gcc 5
Maybe-uninitialized, but maybe it is?  No thanks.
2015-07-12 20:55:49 +03:00
Glauber Costa
d162922e03 core: simplify do_flush_directory
files can be copied now. No need to play the unique_ptr card anymore.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-12 19:58:31 +03:00
Avi Kivity
8a50b3d9ba main: be more explicit about make directory errors 2015-07-12 19:38:59 +03:00
Glauber Costa
322b1c30dd main: make sure data directory exists before proceeding
Right now when we initiate the database, we exist with just an exception if the
data directory does not exist. That does not tell much to the user about what
is going on.

It would be nice to at the very least catch the exception and turn it into a
user friendly message. But we can obviously do much better and create the
directory.

If we fail, then we can capture and tell the user why.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-12 19:14:06 +03:00
Avi Kivity
d9a4645e24 Merge seastar upstream 2015-07-12 19:13:52 +03:00
Avi Kivity
2a622304ed file: make files copyable
Often a single file is used in multiple fibers, and so it is wrapped in a
lw_shared_ptr.  Remove the need for this by making files internally reference
counted.
2015-07-12 18:11:46 +03:00
Glauber Costa
50e2f24dfa core: add recursive_touch directory
Often, when we create a directory, it is useful to make sure that the path
leading to it exists.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-12 18:05:08 +03:00
Avi Kivity
8c7bcf52e2 Merge seastar upstream 2015-07-12 17:06:14 +03:00
Avi Kivity
c84b6a948f Merge "fstream optimizations"
file::size() was excessively slow, and fstreams were needlessly calling
it.  Optimize file::size(), and also make fstream not call it.
2015-07-12 16:56:01 +03:00
Avi Kivity
35f29dcdb4 fstream: add read-until-end tests without knowning the file size beforehand 2015-07-12 16:52:24 +03:00
Avi Kivity
7684f2f541 Merge "Add ByteOrderedPartitioner" from Paweł
This patch series adds partial implementation of ByteOrderedPartitioner
and allows choosing it in configuration file.
While ByteOrderedPartitioner is generally not recommended it is used by
some tests in DTEST due to its order guarantees.
2015-07-12 16:20:19 +03:00
Gleb Natapov
83bbd87966 storage_proxy: simplify net::messaging_verb::READ_DATA handler 2015-07-12 16:19:20 +03:00
Gleb Natapov
67d494c4ee storage_proxy: fix waiting_for to check for local dataceneter 2015-07-12 16:19:20 +03:00
Paweł Dziepak
351b113913 dht: allow configuration file to choose partitioner
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-12 15:14:53 +02:00
Avi Kivity
82b621b857 Merge "Fix insert statement to preperly handle tables without clustering key" from Tomasz 2015-07-12 16:14:13 +03:00
Tomasz Grabiec
18c48dbb14 tests: Add test for inserting a row without setting any regular column 2015-07-12 15:04:38 +02:00
Tomasz Grabiec
28c1c3eaf1 tests: Use 'update' instead of 'insert' in test_ttl
We don't really handle expiration of entrie rows yet, due to issue #17.

Fixing a bug in 'insert' made this test start to fail because the
expired row started to appear in the results. Until #17 is fixed,
let's use 'update' to create the row, so that the expectations are
met.
2015-07-12 15:04:38 +02:00
Tomasz Grabiec
05e2e9d5ea cql: Fix 'insert' statement not creating row marker for non-clustered tables
Fixes #18.

The problem was that the row entry was not getting created for tables
without clustering key. The empty prefix was mistakenly taken as a
belonging to a static row.
2015-07-12 15:04:38 +02:00
Avi Kivity
ddc98ac45d Merge "Mutation query interface"
"Node interface is:

   storage_proxy::query_mutations_locally()

Shard interface is:

   database::query_mutations()

Query results are returned in a form of reconcilable_result object, which
contains a vector of frozen_mutation."
2015-07-12 15:17:37 +03:00
Amnon Heiman
3dd694b8c6 API: Adding a stub implementation to the storage_proxy
This adds a stub implementation to the metrics of the storage proxy.
After this patch the following URL will be available:
/storage_service/metrics/cas_write/contention
/storage_service/metrics/cas_write/condition_not_met
/storage_service/metrics/cas_read/unfinished_commit
/storage_service/metrics/cas_read/contention
/storage_service/metrics/cas_read/condition_not_met
/storage_service/metrics/read/timeouts
/storage_service/metrics/read/unavailables
/storage_service/metrics/range/timeouts
/storage_service/metrics/range/unavailables
/storage_service/metrics/write/timeouts
/storage_service/metrics/write/unavailables

The implementation returns 0 for all queries.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 14:07:28 +03:00
Amnon Heiman
c82b89a8b0 Adding the metrics definition to the storage_proxy
This adds the storage definition to the storage proxy swagger definition
file.
It adds the definitions for the following command:
get_cas_write_metrics_unfinished_commit
get_cas_write_metrics_contention
get_cas_write_metrics_condition_not_met
get_cas_read_metrics_unfinished_commit
get_cas_read_metrics_contention
get_cas_read_metrics_condition_not_met
get_read_metrics_timeouts
get_read_metrics_unavailables
get_range_metrics_timeouts
get_range_metrics_unavailables
get_write_metrics_timeouts
get_write_metrics_unavailables

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-07-12 14:05:05 +03:00
Tomasz Grabiec
674dfdcf25 tests: Test consistent ordering of partitions in range queries
In Origin, partitions in range query results are ordered using
decorated_key ordering. This allows the use of token() function for
incremental iterating over results, as mentioned here:

http://www.datastax.com/dev/blog/client-side-improvements-in-cassandra-2-0
2015-07-12 12:54:39 +02:00
Tomasz Grabiec
e35854b33c storage_proxy: Preserve partition order in range queries
In Origin, partitions in range query results are ordered using
decorated_key ordering. This allows the use of token() function for
incremental iterating over results, as mentioned here:

http://www.datastax.com/dev/blog/client-side-improvements-in-cassandra-2-0

We may also need this to implement paging.

The old code didn't preserve ordering, because it didn't merge-sort
data coming from different shards. The fix relies on
query_mutations_locally(), which already preserves the ordering. We're
going to use mutation queries for range queries anyway.
2015-07-12 12:54:38 +02:00
Tomasz Grabiec
ad99e84505 storage_proxy: Take schema_ptr in query()
It will be needed for reconciliation.
2015-07-12 12:54:38 +02:00
Tomasz Grabiec
5b332c6f7c messaging_service: Add RPC call for mutation queries. 2015-07-12 12:54:38 +02:00
Tomasz Grabiec
4931d3fdcd storage_proxy: Implement query_mutations_locally() 2015-07-12 12:54:38 +02:00