Commit Graph

5541 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
6d7a3d2f0a schema: always rebuild the schema
If we alter the compound property, we also have to rebuild the schema,
since some aspects of the columns depend on it. Let's just go ahead and
always rebuild the schema.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 09:30:53 -05:00
Glauber Costa
68bdb1d0c1 schema: set thrift properties in schema, not schema builder
We will use those properties during initialization - for instance, to calculate
thrift_bits.is_on_all_components. In order to do that, it has to be available at
schema creation, and not through the schema builder.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 09:30:53 -05:00
Glauber Costa
4bfd5b9f65 schema_tables: handle caching options
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 09:30:53 -05:00
Glauber Costa
498824971d schema: handle caching options
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 09:30:53 -05:00
Glauber Costa
97e965aac8 add caching_options
This is basically a glorified map<sstring, sstring>, that does some validation
on the options. Analoguous structures in the past were put directly at
schema.hh, but I will keep this one separate because it got slightly more
complex than the average.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 09:30:53 -05:00
Avi Kivity
ea485fdb0b Merge "SSTables format change" from Glauber
"This still doesn't achieve compatibility with Cassandra-2.1.8, my next series
will. But let's merge this one first so the rest can be reviewed separately."
2015-08-07 17:12:14 +03:00
Glauber Costa
c2a0232048 database: generate UUIDs compatible with Cassandra 2.1.8
Without this, Cassandra won't even try to read our sstables. The containing
directories will be ignored.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:56 -05:00
Glauber Costa
c19819290a system.size_estimates: define schema
This table exists in 2.1.8, and although it is dropped in 2.2, we
should at least list its schema.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:56 -05:00
Glauber Costa
28c0498bb6 system.local: add more fields
2.1.8 tables have 3 more fields in their system tables, that 2.2 don't.
Since we aim at 2.1 compatibility, we have to include them.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:56 -05:00
Glauber Costa
e9ec0ad7f7 schema_columnfamilies: add columns present in 2.1.8 version
They do not exist in 2.2, and don't serve a huge purpose. But we will
need them for compatibility with 2.1

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:55 -05:00
Glauber Costa
8e44aa214b schema: extend column acessors to allow access to compact columns
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:55 -05:00
Glauber Costa
9ee7b5d8f2 legacy schema tables: disable unused tables
Let's leave their schema in here, since it's ready and we may need them in the
future. But since they are not present in 2.1.8, we will remove them from the
schema list.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:55 -05:00
Glauber Costa
7bbf8c2a6f sstable types: correctly state version of metadata field
Don't let the current name fool you: Having this listed as "la" here
was just lack of discipline on my part. I meant by it "the format from
which we are importing" - which was named la for Origin. I wasn't
really thinking at the time that it would be dangerous to stop between
versions.

This should read ka, not la.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:55 -05:00
Glauber Costa
c8ca9b376d database: change default sstable version
Let's change the default generated tables to ka, which is the one that is present
in Origin

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:55 -05:00
Glauber Costa
2d1b965f91 database: change filename parser to also accept ka
A ka file has a slightly different name on disk. Change the
parser so we can deal with both

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:55 -05:00
Glauber Costa
a7f88004be sstables: build a descriptor from filename
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:55 -05:00
Glauber Costa
859dc58511 sstables: construct filename for ka sstables
A helper struct - entry_descriptor - is introduced to aid in this goal.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:55 -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
d5a5ee98f0 sstables: add new version
We'll keep the old one around. Eventually we'll need it.

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
Glauber Costa
2cbfe261e3 sstables: reuse code for filename
We have currently two versions of filename: one static, where the caller has to
pass all parameters, and an internal one where those parameters are derived
from the sstable attributes. Implement the latter in terms of the former so
making changes gets easier.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:55 -05:00
Glauber Costa
77e06c3ab1 sstables: remove name parameter
It is currently only used to log a message, and for that we have an sstable
method that will do just fine. Using the name itself just makes it being passed
along throughout the captures.  Remove it.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:31:53 -05:00
Glauber Costa
8a3c935c21 sstables: component_from_sstring
Analogous to version and format

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-08-07 08:18:09 -05:00
Tomasz Grabiec
3e1fe072d4 Merge branch 'penberg/fix-heap-overflow-in-bytes-ostream/v2' from seastar-dev.git
Fix fro heap overflow in bytes_ostream::append() from Pekka.
2015-08-07 13:13:47 +03: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
Pekka Enberg
5164932f1e bytes_ostream: Fix current_space_left()
We also allocate chunks larger than "usable_chunk_size" in alloc(). Fix
up the calculation in current_space_left().

Spotted by ASan.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-07 13:00:31 +03:00
Tomasz Grabiec
038183eabd Merge branch 'penberg/event-cleanups/v1' from seastar-dev.git
Cleanups of CQL events code from Pekka.
2015-08-07 12:18:26 +03:00
Nadav Har'El
b6fd3dd623 storage_proxy::make_local_reader: support wrap-around ranges
If the requested range wraps around the end of the ring, make_local_reader()
ends up trying to create an sstable reader with that wrapping range, which
is not supported. Also our shard-looping code is wrong in a wrapping range.

The solution is simple: split the wrap-around range into two (from the start
of the range until the end of the ring, and then from the beginning of the
ring until the end of the range), and read each of these subranges normally.

This feature is needed to allow streaming a range that wraps around, because
streaming currently uses make_local_reader().

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-08-07 11:38:03 +03:00
Nadav Har'El
6af8fb1d4a storage_proxy::make_local_reader: simplify lifetime of range parameter
make_local_reader takes a partition-range parameter, passed by *reference*.
The meaning of this passing-by-reference is not documented: when
make_local_reader returns, which of the following two statements holds?

  1. make_local_reader still holds this reference, so the caller is
     forced to keep the range object alive. For how long?
or
  2. make_local_reader reads the range before returning, and when it
     returns, the caller continues to "own" the range object, and is
     allowed to do anything, including delete it.

The principle of least surprise suggests that #2 is better, unless
there is a very good reason to choose #1, and unless this requirement to
keep the argument alive (and for how long) was clearly documented.
But neither is the case here - the overhead of copying the argument is
negligable compared to the other overheads of make_local_reader, and
nothing was documented.

But it turns out the current code did #1 - the address of the range was
passed around *after* make_local_reader returns - the different readers
on different cpus continue to use it to eventually find the right sstable
byte range to iterate over. It very easy to forget this and call
make_local_reader on a on-stack range variable, and the result is a
hard-to-debug use-after-free mess.

This patch switches us to situation #2: Before make_local_reader returns,
the range is copied to whoever needs to hold it after the return, namely
each individual shard_reader. The patch to do this is trivial (one
character removed).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-08-07 11:38:03 +03:00
Pekka Enberg
33ce99b732 transport/event: Move implementation to source file
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-07 09:28:46 +03:00
Pekka Enberg
fad7b28abf transport/event: Convert ifdef'd assertion
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-07 09:23:51 +03:00
Pekka Enberg
ce9f78932e transport/event: Fix class definition indentation
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-07 09:21:28 +03:00
Avi Kivity
4ce70f67eb Merge "Various cleanups and fixes around LSA" from Tomasz 2015-08-06 20:24:12 +03:00
Tomasz Grabiec
831cdf74c4 db: Avoid allocation of temporary bytes object
We're storing data inside managed_bytes now, so conversion to "bytes"
is futile.
2015-08-06 18:56:48 +02:00
Tomasz Grabiec
7b7b6dd301 lsa: Don't initialize segments 2015-08-06 18:56:48 +02:00
Tomasz Grabiec
d60c04542a lsa: Consistently use segment::at() to access data 2015-08-06 18:56:48 +02:00
Tomasz Grabiec
112385455e lsa: Drop unnecessary use of __int128_t in reclaim() 2015-08-06 18:56:48 +02:00
Tomasz Grabiec
6ae0747fe5 lsa: Use size_t for sizes 2015-08-06 18:40:06 +02:00
Tomasz Grabiec
5d7500d648 api: lsa: Make logger static 2015-08-06 18:40:06 +02:00
Raphael S. Carvalho
915b05c956 dht: fix load of misaligned address
Error reported by debug mode when running sstable test
Solution is to use unaligned cast.

dht/murmur3_partitioner.cc:67:25: runtime error: load of misaligned
address 0x6030000478fc for type 'const long int', which requires 8
byte alignment

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-08-06 18:28:38 +03:00
Avi Kivity
a71e88d057 Merge "Add basic LSA API" from Tomasz
Adds ability to force compaction of all regions like this:

  $ curl -X POST http://localhost:10000/lsa/compact

Mainly for testing.
2015-08-06 18:05:44 +03:00
Tomasz Grabiec
9a1ee1b96a api: Introduce RESTful API for LSA
To force compaction, invoke:

  $ curl -X POST http://localhost:10000/lsa/compact
2015-08-06 16:50:15 +02:00
Tomasz Grabiec
f5fdaa61a2 lsa: Avoid overflow in reclaim() 2015-08-06 16:50:15 +02:00
Raphael S. Carvalho
9916bff975 sstables: remove sstable::store
It was initially created to be the function to write all sstable
components, but later on, its purpose was only to write a few
components for testing. A similar function was created in the
tests, so now it can be removed.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-08-06 17:39:05 +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
Raphael S. Carvalho
64fcd16c0c db: adding data to column family statistics for API
Adding required data for column family API to be implemented.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-08-06 17:38:59 +03:00
Tomasz Grabiec
4389bc748e lsa: Fix target calculation in reclaim() 2015-08-06 16:19:48 +02:00
Tomasz Grabiec
343f84e3aa tests: Fix condition in allocation_strategy_test 2015-08-06 15:32:02 +02:00
Pekka Enberg
4b5a89be69 transport/event: Eliminate ifdef'd code
We do serialization in transport/server.cc and there's no need for
the equals() and hashCode() function so just drop ifdef'd code.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-06 15:55:51 +03:00