Commit Graph

3415 Commits

Author SHA1 Message Date
Glauber Costa
7ebfc7ef99 sstables: use a key_view instead of a key in the converter
Now we can explode key_views, let's use it instead of a key.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-05-21 16:27:35 -04:00
Glauber Costa
e69411cf32 sstables: allow a key_view to be exploded as well
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-05-21 16:27:35 -04:00
Glauber Costa
84cbe7c862 sstables: fix test position
This is my turn to make the same mistake as Nadav recently made: I have
written down the expected position from the test output itself, instead
of checking the file.

A position of 0x400c0000000000 is obviously ridiculous. The file itself is not
that big. My recent patch to fix the summary broke the test, and so we need to
fix it.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-21 18:28:55 +02:00
Glauber Costa
1e44a5ecbc sstables: summary: fix a bug when reading position
Since that whole entries array is memory mapped, we should not call
read_integer - which will byteswap it.

We should instead just fetch the position directly.

This was not spotted before because our test sstables tend to be relatively
small.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-21 16:47:32 +03:00
Avi Kivity
26e5a485dc Merge branch 'master' of github.com:cloudius-systems/urchin into db 2015-05-21 16:47:01 +03:00
Avi Kivity
bbc8dbbab5 db: abstract memtable empty test 2015-05-21 15:48:51 +03:00
Gleb Natapov
59f4b9af46 messaging: bind rpc client to listen-address 2015-05-21 15:17:42 +03:00
Gleb Natapov
be5676fc95 main: use rpc-address config option for cql and thrift
Currently if you run more than one instance on the same machine, they
all bind to the same local address and port (we enable an option that
makes this non error) and cql/thrift requests are distributed randomly
among them.
2015-05-21 15:17:41 +03:00
Gleb Natapov
a61007d6b2 stub dns resolver
Some urchin parameters has default value of localhost and need to be
resolved into IP address. Add stub resolver that do just that: if it
sees "localhost" string it translates it to a loopback address,
otherwise assume that string is IP address already.
2015-05-21 15:17:34 +03:00
Avi Kivity
c1a97ce9c5 Merge seastar upstream 2015-05-21 15:17:23 +03:00
Avi Kivity
068a3190d1 db: add written sstable to read set 2015-05-21 14:44:04 +03:00
Avi Kivity
21f7975b57 db: don't flush empty memtables
You can't have an empty sstable, so don't flush an empty memtable.
2015-05-21 13:28:14 +03:00
Avi Kivity
3961e0391a db: fix sstable use-after-free in seal_active_memtable()
We write the new sstable, but we don't wait for the write to complete,
so do_with() kills it.
2015-05-21 13:18:35 +03:00
Avi Kivity
b483d506eb Merge "generation of sstable files"
More sstable component generation, from Raphael.
2015-05-21 11:11:55 +03:00
Glauber Costa
3ffad6f127 tests: add sstable mutation test to the full set of regression tests
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-21 09:01:46 +02:00
Glauber Costa
ba60176d4d bloom_filter: fix index calculation to work on int, not uint
Java uses long, so we should use int64_t. Using uint64_t causes the wrong
indexes to be calculated, and therefore, the filter to respond incorrectly
to a given key.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-21 09:01:44 +02:00
Glauber Costa
601bb48fe7 bloom_filter: no need for a unique_ptr
I actually wrote this code before I learned that we could just return a local
vector by copy without major hassles.

Never too late for a cleanup.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-21 09:00:37 +02:00
Raphael S. Carvalho
f6073bea21 tests: test that generated sstable components can be loaded
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-20 15:20:05 -03:00
Raphael S. Carvalho
5051575ac4 sstables: add initial support to generation of TOC file
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-20 15:19:18 -03:00
Raphael S. Carvalho
57060b5dfe sstables: add initial support to generation of summary file
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-20 15:17:21 -03:00
Raphael S. Carvalho
9e71f6d35c sstables: add initial support to generation of index file
This patch is built on the previous one, where access to members of sstable
class was made possible.
Index file is being properly generated, but it's important mentioning that
promoted indexes aren't supported yet.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-20 14:37:08 -03:00
Raphael S. Carvalho
b00bb80c18 sstables: improve approach to generation of sstables
The function write_datafile was renamed to write_components and made a member
of sstable class because write of components requires access to private
members. This change is an important step towards the generation of components
other than data file.
The respective testcases were adapted to the changes.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-20 14:10:24 -03:00
Raphael S. Carvalho
ea6f8a0f5a tests: use sstable::filename
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-20 13:44:14 -03:00
Raphael S. Carvalho
ff52678eb5 sstables: add static method filename to sstable
This function is likely to be duplicated over time, so let's make
it available as a static method of sstable class.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-20 13:30:32 -03:00
Avi Kivity
32c274f69e db: wire up sstable read path for single partition lookups
Untested, as we never add sstables to the read set yet.
2015-05-20 17:01:28 +02:00
Raphael S. Carvalho
2e31147c70 sstables: add file_writer
file_writer wraps output_stream<char> around.
file_writer also adds the method offset(), intended to return the current
offset of the stream.
It's also a small step towards compression support where a specialized output
stream is required.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-20 11:27:18 -03:00
Gleb Natapov
cb6361ed03 rpc: add ability to bind client to a specified local address 2015-05-20 17:10:00 +03:00
Gleb Natapov
f77d3bbf52 net: extend connect() API to allow to bind to specific local address/port 2015-05-20 17:10:00 +03:00
Tomasz Grabiec
1c7ed0a86c Merge tag 'avi/cf-cow/v1'
A long running query may use memtables and sstables that are being removed
by memtable flush and sstable compaction paths.  Use copy-on-write to
prevent use-after-free.
2015-05-20 15:29:48 +02:00
Avi Kivity
ff42d58881 db: use CoW to modify the memtable list in column_family
Allow memtables to be removed from a column_family while a running query
continues to use them.
2015-05-20 16:00:00 +03:00
Avi Kivity
1342553fed db: remove column_family::testonly_all_memtables()
Unused and gets in the way.
2015-05-20 15:28:53 +03:00
Tomasz Grabiec
82af574e3f service: Remove const qualifier from client_state getter 2015-05-20 15:24:45 +03:00
Avi Kivity
f8f6e979ef db: use CoW to modify the sstable table in column_family
Allow sstables to be removed from a column_family while a running query
continues to use them.
2015-05-20 15:17:35 +03:00
Avi Kivity
4008347d89 sstable: add generation accessor 2015-05-20 15:11:59 +03:00
Pekka Enberg
866d39b5dc migration_manager: Fail announce_new_keyspace if keyspace already exists
If keyspace already exists, throw a already_exists_exception like Origin
does. Spotted while reading the code.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-20 15:08:24 +03:00
Avi Kivity
f8c8a55bfe Merge seastar upstream 2015-05-20 14:27:40 +03:00
Avi Kivity
788982df33 thrift: improve error messages for exceptions not declared in the thrift interface
When thrift sees an exception that was not declared as part of the interface,
it wraps it using std::exception::what() for the exception text.  This is
often cryptic, so add an "Internal server error" prefix.
2015-05-20 14:26:25 +03:00
Nadav Har'El
eda6a528eb iostream: consume() - fix hung test
The test tests/memcached/test_ascii_parser hung after the change to
consume(). The problem was that consume() notified the consumer of an
EOF by sending it an empty buffer, and then it expected to get back a
message that it shouldn't read more (by setting the unconsumed buffer),
if it didn't, it continued to send empty buffers in a never-ending loops.

So this patch changes consume() to send one empty buffer to the consumer
on the end-of-file, and then stop (regardless of what the consumer returns).

It would have probably made sense to *not* send an empty buffer to the
consumer after the data is done - not even once - but if we change this
behavior, it will break the existing tests.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Tested-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
2015-05-20 14:14:59 +03:00
Pekka Enberg
f34f195860 database: Fix capture by reference in create_keyspace()
We cannot capture keyspace_metadata by reference because it can be
allocated on the stack. Fixes SIGSEGV while running cassandra-stress.
The bug was introduced in commit commit cd35617 ("database: Use
keyspace_metadata for creation functions").

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-20 12:35:55 +03:00
Pekka Enberg
4657b24154 transport: Make CQL server less noisy
The CQL server is really noisy during cassandra-stress run because it
prints out STARTUP message options. Fix that up.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-20 11:51:35 +03:00
Gleb Natapov
ddf2167949 net: add new contractor for ipv4_addr
The one that takes IP as a string and port as a number.
2015-05-20 11:38:32 +03:00
Avi Kivity
0b2ba53e15 Merge "bloom filter read support"
Glauber says:

"This is the basic bloom filter implementation. We can read an existing
filter file, but we won't construct one (pending on Index creation)

TODO:
- add the tracker bloom filter (to track its statistics)
- write the filter file"
2015-05-20 10:44:16 +03:00
Avi Kivity
85f23f6894 tests: reindent test_multiple_memtables_multiple_partitions() 2015-05-19 23:48:17 +03:00
Avi Kivity
42a587a954 db: reindent column_family::query() 2015-05-19 23:47:26 +03:00
Avi Kivity
6867ad8fd7 db: reindent column_family::for_all_partitions 2015-05-19 23:46:11 +03:00
Tomasz Grabiec
137b3beb2f Merge tag 'avi/readpath-prep/v1' from seastar-dev.git
From Avi:

"This patchset prepares for adding sstables to the read path.  Because sstables
involve I/O, their APIs return futures, which means that APIs that may call
those sstable APIs also need to return futures.

This patchset uses the two-space indent + do_with + reference aliases trick
to make patches more readable.  Cleanup patches will follow once it is merged."
2015-05-19 20:39:36 +02:00
Avi Kivity
5e759aa2dd Merge "Keyspace creation cleanups"
Pekka says:

"Clean up keyspace creation functions by using keyspace_metadata. While
at it, simplify creation by moving replication strategy initialization
to database.cc. This paves the way for adding keyspace metadata lookup
functionality to database that's needed by migration manager."
2015-05-19 20:06:42 +03:00
Avi Kivity
3ae81e68a0 Merge seastar upstream
Updated sstables::data_consume_rows_context for input_stream::consume()
API change.
2015-05-19 19:57:09 +03:00
Nadav Har'El
c5f61666d3 input_stream::consume() overhaul
Our input_stream::consume() mechanism allows feeding data from an input
stream into a consumer, piece by piece, until the consumer doesn't want
any more. It currently assumed the input can block (when reading from disk),
but the consumption is assumed to be immediate. This patch adds support for
blocking in the consumption function: The consumer now returns a future
which it promises to fulfill after consuming the given buffer.

This patch goes further by somewhat simplifying (?) the interface of the
consumer. Instead of receiving a mysterious "done" lambda the consumer
is supposed to call when done (doesn't want any more input), the consumer
now returns a future<optional<temporary_buffer<char>>, which means:

1. The future is fulfilled when the consumer is done with this buffer
   and either wants more - or wants to stop.

2. If the consumer wants to stop, it returns the *remaining* part of the
   buffer it didn't want to process (this will be pushed back into the
   input stream).

3. If the consumer is not done, and wants to consume more, it returns an
   unset optional.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-05-19 19:33:18 +03:00
Glauber Costa
d03654c3d9 sstables: bloom filter implementation
Use the provided filter instead of always returning true. For existing tables,
this arrives from the bloom filter file. We don't yet fully write a bloom
filter file.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-19 11:22:41 -04:00