Commit Graph

53948 Commits

Author SHA1 Message Date
Avi Kivity
6ade74b7c3 db: recover sstable generation counter on startup
Don't attempt to overwrite an existing sstable.
2015-07-20 12:00:34 +02:00
Avi Kivity
5339783d56 build: handle case where ninja command is named 'ninja-build' 2015-07-19 21:41:42 +03:00
Avi Kivity
6ccf8f8d86 build: make sure to ask seastar to build http/request_parser.hh, and depend on it 2015-07-19 21:37:14 +03:00
Avi Kivity
799b95aac0 tests: drop old seastar tests
Belong in seastar.
2015-07-19 20:57:38 +03:00
Avi Kivity
cc17c44640 Move seastar to a submodule
Instead of urchin being layered on top of seastar, move seastar to a
subdirectory (as a submodule) and use seastar.pc/libseastar.a to link
with it.
2015-07-19 20:48:36 +03:00
Avi Kivity
04b4047cac Merge seastar upstream 2015-07-19 16:28:13 +03:00
Avi Kivity
fa73a25146 memory: prevent cross-cpu free to dead cpu
When running with boost unit-tests, cpu threads can be destroyed, causing
static object destructors to fail when they try to free data which was
allocated on a cpu thread that no longer exists.

Leak the memory instead.
2015-07-19 16:24:07 +03:00
Avi Kivity
8712796e0f Merge seastar upstream
Add messaging_service thunk from new-style serialization (free functions)
to old-style serialization (serializer methods).
2015-07-19 14:18:35 +03:00
Avi Kivity
01e8cc8df2 rpc: switch user-defined serialization to free functions
By using free functions that take the serializer as a parameter (rather than
'this'), we can add serialization functions without changing the serializer
class.
2015-07-19 13:09:20 +03:00
Shlomi Livne
78b0554cce simple_strategy: coding convention fixes
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-07-19 12:45:25 +03:00
Gleb Natapov
605e5c04ab rpc: allocate header space together with payload 2015-07-18 21:15:38 +03:00
Avi Kivity
0d68b4614d Merge seastar upstream
Rewrote messaging_service serialization for new non-deferring rpc
serialization.
2015-07-18 20:21:20 +03:00
Avi Kivity
95970cfda0 Merge "rpc non-deferring serialization"
Switch rpc from using futurized serialization/deserialization to
in-memory, atomic serialization.  This is much faster, especially to
compile, and results in no loss of functionality, as it was illegal
for serialization to defer (except due to the connection being blocked),
because that would result in further rpc requests being stalled.
2015-07-18 19:16:49 +03:00
Avi Kivity
3942546d41 rpc: switch to non-deferring serialization
rpc currently allows serializers and deserializers to defer, because
the input and output stream may not be ready.  They may not, however,
defer on behalf of the object being serialized or deserialized (i.e.
you cannot serialize to disk or deserialize from disk) because that
causes the tcp connection to block until serialization/deserialization is
complete.  So in practice messages must be small enough to fit in memory,
and there is nothing gained by the complexity.

To simplify things, switch to non-deferring serialization.  Add a frame
header to messages that specifies the buffer size, which allows rpc to
use a read_exacly() to consume the message, and thereafter deserialize it
immediately.

The result is significantly simpler, which should help with compile time.
2015-07-18 19:08:07 +03:00
Tomasz Grabiec
8267eb3c1f mutation_partition: Simplify range() 2015-07-18 11:10:31 +02:00
Tomasz Grabiec
93d607aac6 range: Make singular ranges transparent
Singular range is a range of the form [x; x]. Internally such ranges
are optimized to avoid storing the value twice, so _end is empty.

Client shouldn't have to special case for it if it's not interested,
so make end() and split() work for singular ranges too.
2015-07-18 11:10:31 +02:00
Avi Kivity
c1906a3d2a future: add futurize::make_exception_future()
Add a way to create an exceptional future of a type that is not directly
known.
2015-07-18 11:14:19 +03:00
Avi Kivity
f2577c8af3 function_traits: export the function signature as a type
This makes it easy to further examine using pattern matching instead
of std::index_sequence.
2015-07-18 11:14:19 +03:00
Avi Kivity
bf2395a727 Merge "Remove all set functions from the schema" from Glauber
"In the beginning, we needed to set fields in the schema, so we had set_
functions. Then the schema_builder came, and it acquired a lot of set_
functions.

Because its role is actually to build the schema, it is obvious that those
functions are much better placed if they are there. In this sense, having
them to stay in schema as well, is just duplication.

Some of the functions were already orphans in this sense. No callers left.
But some others had callers. This patchset fixes them so they build through
the builder. And once this is done, schema will now consistently have getters
only.

This will become more pressing once I introduce the compact storage changes -
which is the reason I am doing this now. For those, the process of computing
the right value is a bit complicated - definitely not just val = x, and we
definitely don't need the code living in two places. It would be much
better if the existing users - specially the system tables, would be already
fixed."
2015-07-18 10:49:39 +03:00
Glauber Costa
443178ef81 schema: remove set_default_time_to_live
Make calls go through the builder. Current caller is patched.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-17 20:40:40 -04:00
Glauber Costa
8b68fb5ff6 schema: remove set_gc_grace_period
Make all callers go through the builder. Current callers - there are many
in the system tables code, are patched.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-17 20:40:40 -04:00
Glauber Costa
4d6457ba18 schema: remove set_comment
There are no more callers left, all already happens through the builder.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-17 20:29:21 -04:00
Glauber Costa
2d1561d4d2 schema: remove set_id
Pass it through the builder. Existing caller is patched.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-17 20:29:21 -04:00
Glauber Costa
75ffcefd90 schema: remove set_compressor_params
use the builder instead. Sole current user is patched

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-17 20:29:21 -04:00
Glauber Costa
d3e539e868 schema: delete set_bloom_filter_fp_chance
We do this through the builder now, and there are no more callers to
this one.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-17 20:29:21 -04:00
Asias He
744fa25852 logger: Fix compile error
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)

[1/6] CXX build/release/log.o
FAILED: g++ -MMD -MT build/release/log.o -MF build/release/log.o.d
-std=gnu++1y -g  -Wall -Werror -fvisibility=hidden -pthread -I.
-U_FORTIFY_SOURCE  -I/usr/include/jsoncpp/ -Wno-maybe-uninitialized
-DHAVE_XEN -DHAVE_HWLOC -DHAVE_NUMA -O2 -I build/release/gen -c -o
build/release/log.o log.cc
log.cc: In member function ‘void
logging::logger::really_do_log(logging::log_level, const char*,
logging::logger::stringer**, size_t)’:
log.cc:86:19: error: no match for ‘operator<<’ (operand types are
‘std::ostream {aka std::basic_ostream<char>}’ and ‘std::ostringstream
{aka std::basic_ostringstream<char>}’)
         std::cout << out;
                   ^
log.cc:86:19: note: candidate: operator<<(int, int) <built-in>
log.cc:86:19: note:   no known conversion for argument 2 from
‘std::ostringstream {aka std::basic_ostringstream<char>}’ to ‘int’
In file included from /usr/include/c++/5.1.1/iostream:39:0,
                 from core/sstring.hh:31,
                 from log.hh:8,
                 from log.cc:5:
2015-07-17 20:02:18 +02:00
Tomasz Grabiec
db331efaa1 tests: Add test for exception propagation from make_lw_shared() 2015-07-17 16:31:43 +03:00
Tomasz Grabiec
0bfcf27b15 core: lw_shared_ptr: Don't mark make() as noexcept
The constructor or operator new may throw, and we don't want to
std::terminate() on that occasion.
2015-07-17 16:31:42 +03:00
Shlomi Livne
c2ba0df3a9 calculate_natural_endpoints limit retuned ips by replication factor
calculate_natural_endpoints needs to limit the list of returned
addresses by the replication_factor current impl will return all nodes
in cluster

for reference origins code:

while (endpoints.size() < replicas && iter.hasNext())
{
    InetAddress ep = metadata.getEndpoint(iter.next());
    if (!endpoints.contains(ep))
        endpoints.add(ep);
    }
}

Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-07-17 10:33:11 +02:00
Vlad Zolotarov
6017d7f6bc sequenced_set: add a non-const version of get_vector()
This is meant to allow std::moving the returned object when needed.
Otherwise std::move(s.get_vector()) will be degraded to copying.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-07-17 10:24:57 +02:00
Glauber Costa
c71dace86c type_parser: reword exception message
The current message makes exactly at least no sense.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-17 10:23:11 +02:00
Avi Kivity
6d9e95ef93 Merge "Fixes and enhancements for type parser" from Glauber 2015-07-16 20:08:40 +03:00
Glauber Costa
4250b7dd64 database: do not use commitlog constructor if there is no commitlog
Tomek pointed out that we shouldn't be passing a reference to commitlog every
time we use the add_column_family interface, because that will at times pass a
reference to a null object.

Test that, and pass no_commitlog if there is none.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-16 20:04:29 +03:00
Gleb Natapov
640e65b947 storage_proxy: Reconciliation. The beginning
The patch introduces reconciliation code. The same code suppose to be
working for both range and single key queries. Handling of raw_limit,
short reads and read repairs is still very much missing.

--
v1->v2:
  - call live_row_count() only once.
2015-07-16 19:23:58 +03:00
Tomasz Grabiec
388c23291a Merge branch 'pdziepak/random-cql3-fixes/v2' from seastar-dev.git
Fixes for CQL from Pawel.
2015-07-16 18:16:44 +03:00
Paweł Dziepak
fe491ee5f5 cql3: make sure an exception is caught in create statements
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-16 16:23:39 +02:00
Paweł Dziepak
b2cdd36769 cql3: make sure an exception is caught in delete statements
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-16 16:23:27 +02:00
Paweł Dziepak
6107c6dd09 types: rename why() to what() in exception classes
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-16 16:23:14 +02:00
Paweł Dziepak
a6d0ed205b cql3: use api::missing_timestamp for missing timestamps
A missing timestamp is a missing one, not the smallest one.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-16 16:23:03 +02:00
Glauber Costa
bfe7656cfc types_test: add test for collection parser
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-16 09:47:00 -04:00
Glauber Costa
e5dbbc61a2 type_parser: parse tuples
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-16 09:47:00 -04:00
Glauber Costa
8b94cc8654 type_parser: don't duplicate parsing code.
According to the comments, we are doing this for simplicity, to avoid
creating a new type_parse object.

However, while this approach works well for the simple case where we expect
a single token, it won't work as the parser becomes more able to recognize
other cases.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-16 09:47:00 -04:00
Glauber Costa
9b96a2441a type parser: detect frozen types
Note that the multicell attribute can't be part of the parse instance, because
otherwise we would either freeze every subsequent element, or complicate the
flow considerably to handle it.

It is instead, passed as a parameter to get_instance_types(), which will then
have to be propagated to parse() and get_abstract_type()

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-16 09:47:00 -04:00
Glauber Costa
31e22034f2 type_parser: fix a bug with recursive parsing
We currently have a bug when parsing collection types that contains collections
themselves.

We call the recursion correctly, but get_abstract_type gets its value by copy, not
reference. Therefore, all work it does in the _idx manipulation is done in the copy,
and when the callee returns, the caller, with its _idx unchanged, will try recursing
again.

Fix it by passing by reference

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-16 09:47:00 -04:00
Glauber Costa
85be9f55e8 type_parser: find - and ignore strings in the form <hex>:type
Collections can at times have the form <hex>:type. This is the case,
for instance, for the strings that compose the comparator string. The
actual hex number isn't terribly interesting: it is used as a key to
hash the collection types, but since we hash them by their types anyway,
we can safely ignore them.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-16 09:47:00 -04:00
Tomasz Grabiec
b176917a13 Merge branch 'penberg/schema-version/v2' from seastar-dev.git
Schema versioning from Pekka:

"This series adds support for schema versioning. It's a prerequisite for
schema pull functionality which needs to know if the schema has been
changed on other nodes.

Schema version is a content-based hash of the schema. When there's a
schema change on local node, "schema_version" UUID is updated using a
MD5 hash of system table contents:

Node 1:

  [penberg@nero apache-cassandra-2.1.7]$ ./bin/cqlsh --no-color 127.0.0.1
  Connected to Test Cluster at 127.0.0.1:9042.
  [cqlsh 5.0.1 | Cassandra 2.2.0 | CQL spec 3.2.0 | Native protocol v3]
  Use HELP for help.
  cqlsh> SELECT key, schema_version FROM system.local;

   key   | schema_version
  -------+--------------------------------------
   local | d41d8cd9-8f00-3204-a980-0998ecf8427e

  (1 rows)
  cqlsh> CREATE KEYSPACE keyspace3 WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
  cqlsh> SELECT key, schema_version FROM system.local;

   key   | schema_version
  -------+--------------------------------------
   local | 02a099fa-9914-324b-b0c7-b62916584844

  (1 rows)

Node 2:

  [penberg@nero apache-cassandra-2.1.7]$ ./bin/cqlsh --no-color 127.0.0.2
  Connected to Test Cluster at 127.0.0.2:9042.
  [cqlsh 5.0.1 | Cassandra 2.2.0 | CQL spec 3.2.0 | Native protocol v3]
  Use HELP for help.
  cqlsh> SELECT key, schema_version FROM system.local;

   key   | schema_version
  -------+--------------------------------------
   local | d41d8cd9-8f00-3204-a980-0998ecf8427e

  (1 rows)
  cqlsh> SELECT key, schema_version FROM system.local;

   key   | schema_version
  -------+--------------------------------------
   local | 02a099fa-9914-324b-b0c7-b62916584844

  (1 rows)
"
2015-07-16 16:28:57 +03:00
Pekka Enberg
da53127e35 service/migration_manager: Wire up versioning to merge_schema()
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-16 14:53:31 +03:00
Pekka Enberg
c090ac076f service/migration_manager: Convert passiveAnnounce() to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-16 14:53:31 +03:00
Pekka Enberg
b417405f48 service/migration_manager: Enable logging
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-16 14:53:31 +03:00
Pekka Enberg
822d3cab55 service/storage_service: Make value_factory public
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-16 14:53:31 +03:00