Commit Graph

5051 Commits

Author SHA1 Message Date
Paweł Dziepak
789be9be10 tests/cql3: add tests for ORDER BY with IN clause
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-23 02:38:14 +02:00
Avi Kivity
45c5b0c318 Merge "Fix handling of contradicting token restrictions" from Tomasz 2015-07-22 19:47:49 +03:00
Tomasz Grabiec
e416e800c8 commitlog: Fix use-after-move
"f" was passed to make_file_input_stream() after it was moved-from.
2015-07-22 19:21:57 +03:00
Avi Kivity
3d867fc808 Merge 2015-07-22 19:14:57 +03:00
Avi Kivity
02ad246158 Merge seastar upstream 2015-07-22 19:11:41 +03:00
Tomasz Grabiec
a71ac80537 test: Add test for contradicting token restrictions 2015-07-22 17:58:16 +02:00
Tomasz Grabiec
76bf7b228c cql: token_restriction: Fix range produced for contradicting restrictions
We want to return no results in this case, so we should return no
range instead of range open on both sides, which yields all data.
2015-07-22 17:55:50 +02:00
Tomasz Grabiec
47e006bfae cql: token_restriction: Fix the check detecting contradicting restrictions
The condition is incorrect after 9b52f5bf2b.

We no longer express the full range as (min, min], and missing upper
bound as bound as (x, min] so we don't need to exclude those cases in
the check.
2015-07-22 17:55:42 +02:00
Raphael S. Carvalho
eb2e48f019 compaction: get compaction threshold from schema instead
Get values from cf->schema instead of using hardcoded threshold
values. In addition, move DEFAULT_MIN_COMPACTION_THRESHOLD and
DEFAULT_MAX_COMPACTION_THRESHOLD to schema.hh so as not to have
knowledge duplicated.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-07-22 17:05:54 +02:00
Pekka Enberg
dcbbafd41c api: Switch to "#pragma once" as include guard
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 18:03:42 +03:00
Raphael S. Carvalho
e57fe36249 compaction: get compaction threshold from schema instead
Get values from cf->schema instead of using hardcoded threshold
values. In addition, move DEFAULT_MIN_COMPACTION_THRESHOLD and
DEFAULT_MAX_COMPACTION_THRESHOLD to schema.hh so as not to have
knowledge duplicated.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-07-22 18:03:23 +03:00
Pekka Enberg
ea668b5d41 db/legacy_schema_tables: Merge schema locking
Add locking to merge_schema() to ensure only one CPU is able to fiddle
with internals at a time.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 18:03:17 +03:00
Avi Kivity
6a9d0495f8 sstables: fix memory corruption in metadata parsing
Since parsing involves a unique_ptr<metadata> holding a pointer to a
subclass of metadata, it must define a virtual destructor, or it can
cause memory leaks when deleted, or, with C++14 sized deallocators, it
can cause the wrong memory pool to be used for deleting the object.

Seen on EC2.

Define a virtual destructor to tell the compiler how to destroy
and free the object.
2015-07-22 17:46:37 +03:00
Avi Kivity
69a94732df Merge "logging compaction activity" from Raphael 2015-07-22 16:00:57 +03:00
Nadav Har'El
630ccf5a09 sstables: remember to close() files
It is now necessary to close() a file before destroying it, otherwise a big
ugly warning message is printed by the reactor. Our sstable read path was
especially careless about closing the countless files it opens, and the
sstable test generated as many as 400 (!) of these warning messages, despite
running correctly. This patch adds the missing close() calls.

After this patch, the sstable test still shows 3 warning messages.
Those are unavoidable: They happen while broken sstables are being
tested, and an exception is thrown in the middle of the sstable processing,
causing us to destroy a file object without calling close() on it first.
This, in my opinion, proves that requiring close() in the read path is not
a good thing, it is un-RAII-like and not exception-safe. But it is benign
except the warning message, so whatever. 3 scary warning messages from the
test are better than 400...

If these 3 remaining messages really bother us, I guess we can fix it by
catching the exceptions in the sstable code, closing the file and rethrowing
the exception, but it will be quite ugly...

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-07-22 15:30:59 +03:00
Avi Kivity
8870bf1bf8 Merge "Handling of non-full partition range queries" from Tomasz 2015-07-22 15:18:02 +03:00
Raphael S. Carvalho
63b41cc068 sstables: log compaction activity
There is some missing information in the last log printout, because
it's currently hard to generate such information.
Anyway, this patch is a good start towards providing the same log
messages as origin.

Addresses issue #12

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-07-22 09:15:18 -03:00
Avi Kivity
aa4dae29f3 build: unconditionally rebuild libseastar.a
Instead of trying to second-guess the seastar build system, always rebuild
libseastar.a.  Specify restat = 1 so that binaries are only relinked if
something truly changed.
2015-07-22 15:04:32 +03:00
Pekka Enberg
55858137e0 utils: Clean up runtime::get_uptime() API
Return a std::chrono::steady_clock::duration and switch the caller in
migration manager to also use proper C++ durations.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 14:56:52 +03:00
Raphael S. Carvalho
713953ee5e sstables: add function to return file name of data component
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-07-22 08:18:10 -03:00
Tomasz Grabiec
5c647dffe9 tests: Add test for range queries on CQL level 2015-07-22 13:14:33 +02:00
Tomasz Grabiec
440962dbbf tests: Run mutation source tests on memtable 2015-07-22 13:14:33 +02:00
Tomasz Grabiec
f9da612581 memtable: Implement range queries 2015-07-22 13:14:33 +02:00
Tomasz Grabiec
9c4956c5dc memtable: Use boost::intrusive_set<> to store partition entries
So that we can use heterogenous comparators. For range queries we will
need to compare keys with ring_position.
2015-07-22 13:14:33 +02:00
Tomasz Grabiec
0f3588708e tests: Extract range query tests from sstable_mutation_test into mutation_source_test
The idea is to reuse the same testing code on any mutation_source, for
example on memtable.

The range query test cases are now part of a generic mutation_source
test suite.
2015-07-22 13:14:33 +02:00
Tomasz Grabiec
33bcf9e8d3 tests: Make reader_assertions::produces() work on any range 2015-07-22 13:14:10 +02:00
Tomasz Grabiec
c8f3471055 sstable_mutation_tests: Add tests for inclusive/exclusive bounds with keys and tokens 2015-07-22 13:14:07 +02:00
Tomasz Grabiec
59b91fe350 mutation: Introduce slice() helper 2015-07-22 13:13:38 +02:00
Tomasz Grabiec
4248d87544 Introduce mutation_decorated_key_less_comparator 2015-07-22 13:13:38 +02:00
Tomasz Grabiec
152582a869 sstables: Add read_range_rows() variant which takes a partition_range 2015-07-22 13:13:38 +02:00
Tomasz Grabiec
6373987704 partition_range: Introduce is_wrap_around() helper 2015-07-22 13:13:38 +02:00
Tomasz Grabiec
5fe7c1093f sstables: Make mutation_reader::impl unmovable and uncopyable 2015-07-22 13:13:38 +02:00
Tomasz Grabiec
7aea858108 sstables: Make data_consume_rows(0, 0) return no rows
data_consume_rows(0, 0) was returning all partitions instead of no
partitions, because -1 was passed as count in such case, which was
then casted to uint64_t.

Special-casing it that way is problematic for code which calculates
the bounds, and when the key is not found we simple end up with 0 as
upper bound. Instead of convoluting the range lookup code to special
case for 0, let's simplify the interface so that (0, 0) returns no
rows, same as (1, 1). There is a new overload of data_consume_rows()
without bounds, which returns all data.
2015-07-22 13:10:01 +02:00
Tomasz Grabiec
3de682ebeb tests: sstable_data_file_test: Fix use-after-free on reader 2015-07-22 13:10:00 +02:00
Gleb Natapov
150c28e941 storage_proxy: do not ignore connection errors
Do nothing about them for now. Read will eventually fail on timeout.
2015-07-22 13:44:47 +03:00
Gleb Natapov
98fae1a010 storage_proxy: handle read timeout 2015-07-22 13:44:46 +03:00
Avi Kivity
a547b881a7 Merge "Schema pull" from Pekka
"This series enables the schema pull functionality. It's used to
synchronize schema at node startup for schema changes that happened in
the cluster while the node was down.

Node 1:

  # Node 2 is not running.

  [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> CREATE KEYSPACE keyspace3 WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
  cqlsh> SELECT * FROM system.schema_keyspaces;

   keyspace_name | durable_writes | strategy_class                             | strategy_options
  ---------------+----------------+--------------------------------------------+----------------------------
       keyspace3 |           True |                             SimpleStrategy | {"replication_factor":"1"}
          system |           True | org.apache.cassandra.locator.LocalStrategy |                         {}

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

   key   | schema_version
  -------+--------------------------------------
   local | c3a18ddc-80c5-3a25-b82d-57178a318771

  (1 rows)

Node 2:

  # Node 2 is started.

  [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 * FROM system.schema_keyspaces;

   keyspace_name | durable_writes | strategy_class                             | strategy_options
  ---------------+----------------+--------------------------------------------+----------------------------
       keyspace3 |           True |                             SimpleStrategy | {"replication_factor":"1"}
          system |           True | org.apache.cassandra.locator.LocalStrategy |                         {}

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

   key   | schema_version
  -------+--------------------------------------
   local | c3a18ddc-80c5-3a25-b82d-57178a318771

  (1 rows)"
2015-07-22 13:32:47 +03:00
Gleb Natapov
b737a85f08 storage_proxy: fix get_live_sorted_endpoints()
remove_if() does not really removes anything.

Fixes #33
2015-07-22 12:14:40 +02:00
Pekka Enberg
fa02929165 service/storage_service: Wire up schema pull
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 13:08:18 +03:00
Pekka Enberg
f1d5b9c4ae service/migration_manager: Convert scheduleSchemaPull() to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 13:08:18 +03:00
Pekka Enberg
e361f2a436 utils/runtime: Add uptime helpers
The functionality is similar to RuntimeMBean.getUptime() that's needed
in schema pulling logic.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 13:02:43 +03:00
Pekka Enberg
5033858551 service/storage_service: Fix schema version announce in prepare_to_join()
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 11:57:00 +03:00
Pekka Enberg
791031fbc7 database: Extract update_schema_version_and_announce() function
It's needed in storage proxy.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 11:57:00 +03:00
Pekka Enberg
d4d2e2fa0e service/storage_proxy: add get_storage_proxy() helpers
Make storage proxy a singleton and add helpers to look up a reference.
This makes it easier to convert code from Origin in areas such as
storage service.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 11:57:00 +03:00
Pekka Enberg
67f4b55b16 gms/gossiper: Fix is_gossip_only_member() logic
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 11:57:00 +03:00
Pekka Enberg
91e601ed11 gms/gossiper: Make is_gossip_only_member() public
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 11:57:00 +03:00
Pekka Enberg
bc4c04a2ab gms: Make endpoint_state::get_application_state() const
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 11:57:00 +03:00
Pekka Enberg
c6dc61eab4 service: Convert MigrationTask to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 11:57:00 +03:00
Pekka Enberg
03a43678af service: Import MigrationTask.java
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 11:57:00 +03:00
Pekka Enberg
d81b04f356 service/storage_proxy: Wire up MIGRATION_REQUEST messages
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-07-22 11:57:00 +03:00