Commit Graph

688 Commits

Author SHA1 Message Date
Tomasz Grabiec
3c79525530 tests: row_cache_test: Test harder 2015-07-27 13:27:35 +02:00
Avi Kivity
095c2f2920 Merge "Fixes for partition_range model" from Tomasz
"range::is_wrap_around() will not work with current ring_position, because it
relies on total ordering. Same for range::contains(). Currently ring_position
is weakly ordered. This series fixes this problem by making ring_position
totally ordered.

Another problem fixed by this series is handling of wrap-around ranges. In
Origin, ]x; x] is treated as a wrap around range covering whole ring."
2015-07-25 17:47:40 +03:00
Glauber Costa
7fdb21ae8c sstable_test: test clustering order
If we revert the type of the clustering key, which is what would happen if we
defined the table as with clustering order by (cl desc), we expect the
clustering keys to be in descending order on disk.

There is no work needed for sstables for that to happen. But we should still
verify that this is indeed the case.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-24 22:55:12 -04:00
Glauber Costa
e169cd8e4f type_test: test reversed types
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-24 22:55:12 -04:00
Tomasz Grabiec
45b4471a0e tests: Introduce test for query::partition_range 2015-07-24 16:08:41 +02:00
Tomasz Grabiec
e5feff5d71 dht: ring_position: Switch to total ordering
range::is_wrap_around() and range::contains() rely on total ordering
on values to work properly. Current ring_position_comparator was only
imposing a weak ordering (token positions equal to all key positions
with that token).

range::before() and range::after() can't work for weak ordering. If
the bound is exclusive, we don't know if user-provided token position
is inside or outside.

Also, is_wrap_around() can't properly detect wrap around in all
cases. Consider this case:

 (1) ]A; B]
 (2) [A; B]

For A = (tok1) and B = (tok1, key1), (1) is a wrap around and (2) is
not. Without total ordering between A and B, range::is_wrap_around() can't
tell that.

I think the simplest soution is to define a total ordering on
ring_position by making token positions positioned either before or
after all keys with that token.
2015-07-24 16:08:41 +02:00
Asias He
c0ff7feeb3 tests: Set logger level to trace for tests/urchin/gossip.cc 2015-07-24 15:56:04 +08:00
Avi Kivity
be32746c58 Merge "Handle Compact Storage" from Glauber
"This is my current proposal for Compact Storage tables - plus
the needed infrastructure.

Getting rid of the CellName abstraction allows us to simplify
things by quite a lot: now all we need is to mark whether or
not a table is composite, and provide functions to play the
role of the comparator when dealing with the strings."
2015-07-23 16:20:31 +03:00
Asias He
e558efc42c tests: Use time based generation_number number 2015-07-23 15:26:46 +08:00
Asias He
879ca5adaf tests: Fix tests/urchin/gossip.cc
After commit 67f4b55b16 "gms/gossiper: Fix is_gossip_only_member() logic",
storage_service is needed by gossip.

To fix, start storage_service in the test. Also, improve the
indentation.
2015-07-23 15:26:46 +08:00
Avi Kivity
c1aed26377 Merge "More fixes for ORDER BY clauses"
"These patches fix more problems related to ORDER BY clauses.
Firstly, mutation_partition::query() can now return rows in reveresed
order which makes it easy for select statements to ask for data from
single partition with clustering keys in reversed order even if limit
of rows is set.
That alone is not sufficient, though, if the request contains IN clause
on partition keys and number of returned rows is limited. The information
needed to determine which rows need to be in the reply isn't available
before post-query sort is done, so select statement asks for more rows
than the limit and trims the output later."
2015-07-23 07:27:53 +03:00
Glauber Costa
81e7a9ced7 sstable tests: test the writing of a compact sstable
Since the read tests are validated using Origin-generated tables, our
write test will just write to the tables and make sure we can read them
back ok.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:22 -04:00
Glauber Costa
c2232d2f2e tests: move some definition from mutation_test to the common header
I would like to use them from sstable_datafile_test.cc to make sure that
the tables we write are really correct.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:22 -04:00
Glauber Costa
cd91f2ecdc sstables: add tests for dense tables
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:22 -04:00
Glauber Costa
bb78499063 sstables: test for non-compound tables
Test the read of a table that is not compound NOR dense.
Dense tables will be handled later.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
d7cb078592 sstable_tests: convert schemas to use the schema_builder
Technically, this is not needed for the existing schemas: the builder is only
necessary when we are setting properties. For consistency, however, let's
convert them all.

Soon we will have some schemas that will set properties. In particular, compact
storage.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Glauber Costa
194a24fd37 sstable_tests: move cs schema to sstable_test.hh
This solitary schema definition should go live with the rest.
We give it a more descriptive name now that it is going.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-07-22 23:10:21 -04:00
Paweł Dziepak
23cccb3c1a tests/cql3: add more ordering tests
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-23 02:38:43 +02:00
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
Tomasz Grabiec
a71ac80537 test: Add test for contradicting token restrictions 2015-07-22 17:58:16 +02:00
Paweł Dziepak
2221604fed tests/cql3: test setting collections to null
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-22 15:30:22 +02: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
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
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
3de682ebeb tests: sstable_data_file_test: Fix use-after-free on reader 2015-07-22 13:10:00 +02: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
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
Nadav Har'El
4edf7fe206 clean up uses of lw_shared_ptr<file>
recently, "file" started to use a shared_ptr internally, and is already
copy-able and reference counted, and there is no reason to use
lw_shared_ptr<file>. This patch cleans up a few remaining places where
lw_shared_ptr<file> was used.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-07-22 11:51:40 +03:00
Paweł Dziepak
e24aa67177 tests/cql3: add varint to test_types
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-21 14:47:17 +02:00
Paweł Dziepak
27c5bb6ada test/types: add tests for varint type
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-21 14:46:54 +02:00
Asias He
fa2aee57ac utils: Move util/serialization.hh to utils/serialization.hh
Now we will not have the ugly utils and util directories, only utils.
2015-07-21 16:12:54 +08:00
Asias He
d6df358f2f tests: Bring back tests/urchin/message.cc
Change to use the new messaging_service API.
2015-07-21 16:12:54 +08:00
Raphael S. Carvalho
729b975438 tests: add testcase to size-tiered strategy
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-07-20 12:27:41 -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
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
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
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
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
Tomasz Grabiec
db331efaa1 tests: Add test for exception propagation from make_lw_shared() 2015-07-17 16:31:43 +03: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
Avi Kivity
c74e36c30e Merge branch 'master' of github.com:cloudius-systems/urchin into db
Conflicts:
	message/messaging_service.cc
	message/messaging_service.hh
2015-07-16 12:51:19 +03:00
Avi Kivity
1d4805236b messaging_service: don't include config.hh in .hh
config.hh changes rapidly, so don't force lots of recompiles by including it.

Need to place seed_provider_type in namespace scope, so we can forward
declare it for that.
2015-07-16 12:26:02 +03:00
Asias He
14526e31b0 tests: Disable tests/urchin/message.cc for now
The interface of ms.send_message() will be gone shortly. We need to
write the tests using the new interface. Let's postpone it a bit.
2015-07-16 17:23:26 +08:00
Avi Kivity
6257ef1d83 Merge "Add mutation::live_row_count()" from Tomasz 2015-07-16 10:32:11 +03:00