Commit Graph

569 Commits

Author SHA1 Message Date
Tomasz Grabiec
d4e0e5957b db: Integrate cache with the read path 2015-06-23 13:49:25 +02:00
Tomasz Grabiec
d11773bc14 tests: Introduce row cache test 2015-06-23 13:49:24 +02:00
Tomasz Grabiec
2b5d9a917f tests: Convert mutation_reader_test to use seastar threads
Also extract assertions into header file.
2015-06-23 13:49:24 +02:00
Tomasz Grabiec
b9288d9fa7 db: Make column_family managed by lw_shared_ptr<>
It will be share-owned by readers.
2015-06-23 13:49:24 +02:00
Tomasz Grabiec
bdd3fd5019 tests: Add missing blank line 2015-06-23 13:44:37 +02:00
Avi Kivity
792a19d40d Merge "global snitch" from Vlad
"
   - Introduce a global distributed snitch object.
   - Add the corresponding methods in i_endpoint_snitch class needed to work with
     this object.
   - Added additional check to gossiping_property_file_snitch_test.
"
2015-06-23 10:49:30 +03:00
Avi Kivity
cbd0be5a68 Merge seastar upstream 2015-06-23 10:46:39 +03:00
Nadav Har'El
9f7794752f sstables: basic compaction test
This tests the basic compaction functionality: I created three small
tables using Cassandra (see commands below), compact them into one,
load the resulting table and check its content.

This test demonstrates, but is commented out to make the test succeed,
a bug: If a partition had old values and then a newer deletion (tombstone)
in another sstable, both values and tombstones are left behind in the
compacted table.  This will be fixed (and the test uncommented) in a later
patch.

The three sstables were created with:

USE try1;
CREATE TABLE compaction (
	name text,
	age int,
	height int,
	PRIMARY KEY (name)
);
INSERT INTO compaction (name, age) VALUES ('nadav', 40);
INSERT INTO compaction (name, age) VALUES ('john', 30);
<flush>
INSERT INTO compaction (name, height) VALUES ('nadav', 186);
INSERT INTO compaction (name, age, height) VALUES ('jerry', 40, 170);
<flush>
DELETE FROM compaction WHERE name = 'nadav';
INSERT INTO compaction (name, age) VALUES ('john', 20);
INSERT INTO compaction (name, age, height) VALUES ('tom', 20, 180);

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-06-23 09:48:59 +03:00
Vlad Zolotarov
319491dad7 gossiping_property_file_snitch_test: check that the distribution
Check that the distribution of the new values between shards works.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-06-22 23:18:40 +03:00
Vlad Zolotarov
3520d4de10 locator: introduce a global distributed<snitch_ptr> i_endpoint_snitch::snitch_instance()
Snitch class semantics defined to be per-Node. To make it so we
introduce here a static member in an i_endpoint_snitch class that
has to contain the pointer to the relevant snitch class instance.

Since the snitch contents are not always pure const it has to be per
shard, therefore we'll make it a "distributed". All the I/O is going
to take place on a single shard and if there are changes - they are going
to be propagated to the rest of the shards.

The application is responsible to initialize this distributed<shnitch>
before it's used for the first time.

This patch effectively reverts most of the "locator: futurize
snitch creation" a2594015f9 patch - the part that modifies the
code that was creating the snitch instance. Since snitch is
created explicitly by the application and all the rest of the code
simply assumes that the above global is initialized we won't need
all those changes any more and the code will get back to be nice and simple
as it was before the patch above.

So, to summarize, this patch does the following:
   - Reverts the changes introduced by a2594015f9 related to the fact that
     every time a replication strategy was created there should have been created
     a snitch that would have been stored in this strategy object. More specifically,
     methods like keyspace::create_replication_strategy() do not return a future<>
     any more and this allows to simplify the code that calls it significantly.
   - Introduce the global distributed<snitch_ptr> object:
      - It belongs to the i_endpoint_snitch class.
      - There has been added a corresponding interface to access both global and
        shard-local instances.
      - locator::abstract_replication_strategy::create_replication_strategy() does
        not accept snitch_ptr&& - it'll get and pass the corresponding shard-local
        instance of the snitch to the replication strategy's constructor by itself.
      - Adjusted the existing snitch infrastructure to the new semantics:
         - Modified the create_snitch() to create and start all per-shard snitch
           instances and update the global variable.
         - Introduced a static i_endpoint_snitch::stop_snitch() function that properly
           stops the global distributed snitch.
         - Added the code to the gossiping_property_file_snitch that distributes the
           changed data to all per-shard snitch objects.
         - Made all existing snitches classes properly maintain their state in order
           to be able to shut down cleanly.
         - Patched both urchin and cql_query_test to initialize a snitch instance before
           all other services.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>

New in v6:
   - Rebased to the current master.
   - Extended a commit message a little - the summary.

New in v5:
   - database::create_keyspace(): added a missing _keyspaces.emplace()

New in v4:
   - Kept the database::create_keyspace() to return future<> by Glauber's request
     and added a description to this method that needs to be changed when Glauber
     adds his bits that require this interface.
2015-06-22 23:18:31 +03:00
Avi Kivity
6ce39d8399 tests: move a semaphore test from futures_test to semaphore_test 2015-06-22 19:14:05 +03:00
Glauber Costa
b008f8cf06 sstables: test table with wrong marker
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-06-22 11:13:42 -04:00
Avi Kivity
7859f5a421 Merge seastar upstream 2015-06-22 10:45:06 +03:00
Tomasz Grabiec
61992f84c5 core: Introduce repeat()
It's like do_until(), but the stop condition is calculated by the
callback instead of being supplied separately.
2015-06-22 09:08:38 +02:00
Avi Kivity
6975be8e12 Merge seastar upstream 2015-06-21 21:16:48 +03:00
Avi Kivity
d9bfbe55c8 core: introduce shared_mutex class
Similar to std::shared_mutex, allows shared and exclusive locking of a
resource (also known as a reader/writer lock).  This implementation is
strictly FIFO.
2015-06-21 20:28:43 +03:00
Nadav Har'El
d7099358a7 tests: Fix shared/lw_shared mixup in test
In a couple of places in sstable_datafile_test.cc, we had
make_shared<memtable> instead of the usual make_lw_shared<memtable>.

It appears that since commit bc468f9a0e,
which made memtables inherit from enable_lw_shared_from_this (not the "lw"),
this no longer works correctly. I'm not sure I can really explain the
details of what's wrong, but with some refactoring I did on the sstable
writing code, it stopped working giving various strange crashes which appear
like the object protected by this shared_ptr got prematurely destructed.

Changing the test to use make_lw_shared() fixes the problems I was having.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-06-21 17:28:20 +03:00
Avi Kivity
971c116207 Merge seastar upstream 2015-06-21 08:08:42 +03:00
Avi Kivity
439b9c848a tests: fix fstream_test misuse of shared_ptr
'static shared_ptr' causes the shared_ptr to be destroyed on a cpu other
than the one it was constructed on, which is illegal.
2015-06-20 12:02:00 +03:00
Avi Kivity
535928c643 tests: fix fstream_test use-after-free 2015-06-20 11:43:14 +03:00
Avi Kivity
1c8ee4e160 tests: convert foreign_ptr_test to SEASTAR_TEST_CASE
Makes it pass.
2015-06-20 11:29:53 +03:00
Avi Kivity
32ede23303 tests: remove obsolete test-reactor test 2015-06-20 11:17:28 +03:00
Avi Kivity
7a596dfa61 Merge seastar upstream 2015-06-19 21:53:39 +03:00
Avi Kivity
39218c32f7 core: extend do_with() to support multiple parameters
do_with(1, 2, 3, [] (int& v1, int& v2, int& v3) {
      return make_ready_future<int>(v1 + v2 + v3);
  });
2015-06-19 20:24:56 +03:00
Avi Kivity
f221301d5e Merge "preparation work - system table handling" from Glauber 2015-06-18 17:49:29 +03:00
Tomasz Grabiec
bc468f9a0e memtable: Make memtable inherit from enable_lw_shared_from_this 2015-06-18 15:48:21 +02:00
Tomasz Grabiec
370712f741 tests: Add mutation_reader_test 2015-06-18 15:47:40 +02:00
Glauber Costa
2a36eb7b6e cql_test_env: apply the vegas doctrine
"What happens in memory, stays in memory"

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-06-18 09:22:20 -04:00
Avi Kivity
daa0009eaf Merge "add support to snappy and deflate compressors" from Raphael 2015-06-18 13:44:49 +03:00
Avi Kivity
27f332c315 Merge seastar upstream 2015-06-18 13:20:46 +03:00
Gleb Natapov
56193079a4 tests: add one more semaphore test
Test that wait with timeout and without work on the same semaphore
simultaneously.
2015-06-18 12:35:27 +03:00
Raphael S. Carvalho
7a0f4ab527 tests: test sstable snappy and deflate compressors
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-06-17 11:58:04 -03:00
Tomasz Grabiec
7964be8458 Merge branch 'glommer/summary-fix' from git@github.com:glommer/urchin.git
From Glauber:

"Shlomi found a bug when writing summary files under certain conditions.
The current patchset fixes it, while also performing some generally useful
cleanups."
2015-06-17 16:23:09 +02:00
Pekka Enberg
6a65b0e684 cql_query_test: Use CQL table with static columns
Use CQL for table creation now that static columns actually work.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-17 16:34:22 +03:00
Tomasz Grabiec
1767da1162 Merge branch 'penberg/cql-create-table-tests' from seastar-dev.git
From Pekka:

"This series improves the CQL test for 'create table' statement. It
hardens the test_create_statement() test case and converts
create_table() calls to use CQL where possible. Please note that we need
to go through the remaining create_table() call-sites and fix potential
issues in the CQL front-end or schema management code."
2015-06-17 15:24:25 +02:00
Gleb Natapov
a338407e29 make storage_proxy object distributed
storage_proxy holds per cpu state now to track clustering, so it has to
be distributed otherwise smp setup does not work.
2015-06-17 15:14:06 +02:00
Pekka Enberg
fcb18e9550 cql_query_test: Use CQL for table creation where possible
Use CQL for creating tables instead of the low-level in-memory APIs
where possible.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-17 16:01:36 +03:00
Pekka Enberg
3d9785677a cql_query_test: Verify 'create table' statement operation
Add a require_table_exists() assertion after 'create table' statement is
executed to ensure in-memory schema is updated accordingly.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-17 15:48:18 +03:00
Pekka Enberg
6f2bf01ae3 cql_test_env: Add require_table_exists() helper
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-17 15:46:02 +03:00
Glauber Costa
95c8da8276 tests: test corner case for summary creation
We have recently had a bug where we were messing up with the summary generation
in certain corner cases. In particular, when the number of keys was an exact multiple
of the sampling rate.

Add a test case to make sure we never regress on this.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-06-17 08:44:54 -04:00
Avi Kivity
2b282d3553 Merge seastar upstream 2015-06-17 10:55:27 +03:00
Tomasz Grabiec
cf42e4c1a4 core: Fix enable_lw_shared_from_this<T>::shared_from_this() const
Compilation failed when shared_from_this() was called on a const object.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
2015-06-16 20:32:08 +03:00
Avi Kivity
c357c5b853 Merge "sstable compression support" from Raphael
"only lz4 is supported so far, but other algorithms should be fairly easy to
add, given that the infrastructure for compression is introduced here.

NOTE:
our sstable read code already reads compressed data file, so a test was added
to guarantee that data from a compressed sstable generated by our write code
can be successfully loaded."
2015-06-16 18:54:33 +03:00
Raphael S. Carvalho
3300041f5f tests: add test to sstable compression
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-06-16 12:42:02 -03:00
Avi Kivity
5bce7b84d0 Merge seastar upstream 2015-06-16 17:12:54 +03:00
Pekka Enberg
194cb68c8b tests: add thread-in-thread test case 2015-06-16 17:11:50 +03:00
Amnon Heiman
0ffea496ac Adding the http server to the messaging_service test
To test the messaging service API it needs to be included in the
messaging service test.

To test it, start the server with --stay-alive true
then you can use the API to get the messges information:
http://localhost:10001/messaging_service/messages/exception
will return the number of exception per connection
http://localhost:10001/messaging_service/command/completed
will return the number of completed command per connection.

Note that because the two servers are running on the same machine, to
prevent port conflict, the server port will be increment by one (i.e
10001)

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-16 14:40:08 +03:00
Gleb Natapov
969134280a initial mutation clustering code 2015-06-15 12:53:10 +03:00
Gleb Natapov
c418f9496b fix cql_query_test to initialize service that will be needed by clustering 2015-06-15 12:51:09 +03:00
Avi Kivity
5be417175e Merge "snitch creation"
From Vlad:

"Currently database always created a SimpleSnitch and ignores the corresponding parameter
provided by the user. This series fixes this situation:
   - Changes the snitch creation interface to comply the Java-like interface that
     has already been used in a topology_strategy classes family.
   - Fix all the places where a SimpleSnitch has been created ignoring the user configuration."
2015-06-14 17:59:15 +03:00