Commit Graph

714 Commits

Author SHA1 Message Date
Glauber Costa
21ebaeffae schema_builder: provide a build function that doesn't take compact storage.
We will invoke the schema builder from schema_tables.cc, and at that point, the
information about compact storage no longer exists anywhere. If we just call it
like this, it will be the same as calling it with compact_storage::no, which
will trigger a (wrong) recomputation for compact_storage::yes CFs

The best way to solve that, is make the compact_storage parameter mandatory
every time we create a new table - instead of defaulting to no. This will
ensure that the correct dense and compound calculation are always done when
calling the builder with a parameter, and not done at all when we call it
without a parameter.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 09:30:54 -05:00
Glauber Costa
976de6f6f4 sstables: get cf and ks strings for filename
We will need them to properly build names in some situations.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:55 -05:00
Glauber Costa
cd8c9ad288 sstables: add ks and cf name to sstable constructor
When a schema is available, we use it. However, we have, by now, way too many
tests. Some of them use tables for which we don't even know the schema. It would
have been a massive amount of work to require a schema for all of them - so I am
keeping both constructors around.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:55 -05:00
Pekka Enberg
87f0e50a46 tests/bytes_ostream_test: Test case for appending big and small chunks
Add a test case that triggers the heap overflow fixed in previous commit
("bytes_ostream: Fix current_space_left()").

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-07 13:00:31 +03:00
Raphael S. Carvalho
004af400de tests: add method in sstables::test to write components
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-08-06 17:39:05 +03:00
Tomasz Grabiec
343f84e3aa tests: Fix condition in allocation_strategy_test 2015-08-06 15:32:02 +02:00
Avi Kivity
48a1ce28fc Merge "Switch to log-structured allocator" from Tomasz 2015-08-06 15:45:39 +03:00
Tomasz Grabiec
8978d0ba1a tests: Test memtable data survives full compaction 2015-08-06 14:05:16 +02:00
Tomasz Grabiec
658c21a060 tests: Add LSA tests 2015-08-06 14:05:16 +02:00
Tomasz Grabiec
e7e79af435 tests: Add allocation_strategy_test 2015-08-06 12:52:43 +02:00
Avi Kivity
640db3383a Revert "tests: give cql_test_env a directory"
This reverts commit 6b2be41df00bc42331eccd423b7031b345cf979d; tests should
work without a data directory, so let's find why they don't and fix it
instead.
2015-08-06 13:09:06 +03:00
Asias He
b27201bd56 storage_service: Pass db into storage_service
It is needed for db.get_version(). I really hated to pass &db everywhere
If we had a global helper function like get_local_db(), life will be much
easier.
2015-08-06 15:23:51 +08:00
Avi Kivity
6b2be41df0 tests: give cql_test_env a directory
While supposedly running in memory, looks like it still wants a data
directory.  Give it one.
2015-08-05 15:05:50 +03:00
Avi Kivity
c720cddc5c tests: mv tests/urchin/* -> tests/
Now that seastar is in a separate repository, we can use the tests/
directory.
2015-08-05 14:16:52 +03:00
Tomasz Grabiec
eba7121bf5 Merge branch 'pdziepak/select-distinct/v2' from seastar-dev.git
From Pawel:

This series fixes SELECT DISTINC statements. Previously, we relied on the
existance of static row to get proper results. That obviously doesn't work
when there is no static row in the partition. The solution for that is
to introduce new option to partition_slice: distinct which informs that
the only important information is static row and whether the partition
exists.
2015-08-04 17:00:56 +02:00
Paweł Dziepak
b4d967fcf2 tests/cql3: add tests for SELECT DISTINCT
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 15:39:57 +02:00
Avi Kivity
318cc489c8 mutation_reader: add make_joining_reader()
Reads from provided readers, in order (assumes provided readers are
disjoint and in required order).
2015-08-04 15:49:09 +03:00
Paweł Dziepak
77dd2faee0 tests/cql3: add tests for multi column relations
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-04 10:59:15 +02:00
Pekka Enberg
a3c95235e6 migration_manager: Make stateful with sharded<>
In preparation for adding listener state to migration manager, use
sharded<> for migration manager.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-04 11:23:23 +03:00
Avi Kivity
536d6fa32a tests: fix mutation_test use-after-free
Two bugs:
 - column_family not stop()ped after use
 - flush() future not waited on
2015-08-04 11:19:59 +03:00
Tomasz Grabiec
b88fc51e2a tests: Introduce test for storage_proxy::make_local_reader() 2015-08-03 15:21:40 +02:00
Tomasz Grabiec
14f8c242b2 tests: cql_test_env: Simplify make_env_for_test() using seastar::async() 2015-08-03 15:21:36 +02:00
Paweł Dziepak
6121fded85 tests/cql3: add more ttl tests
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-07-30 14:10:06 +02:00
Asias He
079ea13e67 main: Add init_storage_service helper
Simplifies deinit call.
2015-07-28 15:21:08 +03:00
Avi Kivity
fa13050f64 tests: deinit storage_service in cql_tests_env 2015-07-28 14:57:57 +03:00
Asias He
a2b54fc757 main: Introduce init.cc to cleanup service startup code
This patch introduce init.cc file which hosts all the initialization
code. The benefits are 1) we can share initialization code with tests
code. 2) all the service startup dependency / order code is in one
single place instead of everywhere.
2015-07-28 18:20:45 +08:00
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