Commit Graph

6126 Commits

Author SHA1 Message Date
Paweł Dziepak
3758a6d0a9 atomic_cell_or_collection: add operator==()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:27:20 +02:00
Paweł Dziepak
f2c6c0164e mutation_partition: use remove_if() in row::compact_and_expire()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:27:20 +02:00
Paweł Dziepak
0c575aec53 mutation_partition: add row::remove_if()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:26:55 +02:00
Paweł Dziepak
e0d5ab1459 mutation_partition: use row::merge() in apply()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:26:55 +02:00
Paweł Dziepak
899b0eacc6 mutation_partition: add merge()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:26:40 +02:00
Paweł Dziepak
4246c6b47a mutation_partition: use for_each_cell() in has_any_live_data()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:26:35 +02:00
Paweł Dziepak
4896307597 mutation_partition_serializer: use for_each_cell()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:26:29 +02:00
Paweł Dziepak
ee6ae2264c sstables: use for_each_cell() to iterate through mutation partition
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:26:25 +02:00
Paweł Dziepak
55a8467ac8 mutation_partition: add for_each_cell()
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:26:09 +02:00
Paweł Dziepak
f1167a594a tests/cql_env: make sure that value views are correct
Query options need to have correct _value_views in order to
get_value_at() to work. With this patch we switch to constructor that
generates value views from the passed values and sets remaining options
to their default values.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:25:36 +02:00
Paweł Dziepak
4b9791230a tests/perf/simple_query: fix write mode
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-08-31 17:25:32 +02:00
Avi Kivity
349015a269 Merge "Fix migration manager logging" from Pekka
"Fix migration manager logging to output what origin does. Fixes #112."
2015-08-31 16:27:49 +03:00
Avi Kivity
f2a79aa7f6 Merge Prepare for closing sstables, part 1
Read-ahead will require that we close input_streams.  As part of that
we have to close sstables, and mutation_readers (which encapsulate
input_streams).  This is part 1 of a patchset series to do that.

(The overarching goal is to enable read-ahead for sstables, see #244)

Conflicts:
	sstables/compaction.cc
2015-08-31 16:15:18 +03:00
Avi Kivity
702de43ce3 Merge "Commit log replay" from Calle
"Initial implementation/transposition of commit log replay.

* Changes replay position to be shard aware
* Commit log segment ID:s now follow basically the same scheme as origin;
  max(previous ID, wall clock time in ms) + shard info (for us)
* SStables now use the DB definition of replay_position.
* Stores and propagates (compaction) flush replay positions in sstables
* If CL segments are left over from a previous run, they, and existing
  sstables are inspected for high water mark, and then replayed from
  those marks to amend mutations potentially lost in a crash
* Note that CPU count change is "handled" in so much that shard matching is
  per _previous_ runs shards, not current.

Known limitations:
* Mutations deserialized from old CL segments are _not_ fully validated
  against existing schemas.
* System::truncated_at (not currently used) does not handle sharding afaik,
  so watermark ID:s coming from there are dubious.
* Mutations that fail to apply (invalid, broken) are not placed in blob files
  like origin. Partly because I am lazy, but also partly because our serial
  format differs, and we currently have no tools to do anything useful with it
* No replay filtering (Origin allows a system property to designate a filter
  file, detailing which keyspace/cf:s to replay). Partly because we have no
  system properties.

There is no unit test for the commit log replayer (yet).
Because I could not really come up with a good one given the test
infrastructure that exists (tricky to kill stuff just "right").
The functionality is verified by manual testing, i.e. running scylla,
building up data (cassandra-stress), kill -9 + restart.
This of course does not really fully validate whether the resulting DB is
100% valid compared to the one at k-9, but at least it verified that replay
took place, and mutations where applied.
(Note that origin also lacks validity testing)"

Fixes #98.
2015-08-31 15:58:12 +03:00
Avi Kivity
7090dffe91 mutation_reader: switch to a class based implementation
Using a lambda for implementing a mutation_reader is nifty, but does not
allow us to add methods.

Switch to a class-based implementation in anticipation of adding a close()
method.
2015-08-31 15:53:53 +03:00
Avi Kivity
a9b56133d6 sstables: close input_streams opened in random_access_reader
Read-ahead requires input_streams to be closed, so add a close() method
to random_access_reader() and use it.

We don't yet call actually input_stream::close(), because that is not yet
merged; this patch lays the groundwork.
2015-08-31 15:53:02 +03:00
Avi Kivity
6e4b9b57ca sstables: remove unused class shared_file_random_access_reader 2015-08-31 15:53:02 +03:00
Calle Wilund
1ba655d905 Main: Do commit log replay at startup 2015-08-31 14:29:51 +02:00
Calle Wilund
d3a01072af CommitLogReplayer: Java -> C++
Initial implementation
2015-08-31 14:29:50 +02:00
Calle Wilund
987454d012 Database: Add "flush_all_memtables" 2015-08-31 14:29:50 +02:00
Calle Wilund
a349fbe1e6 Compaction: propagate metadata replay position from compacted tables 2015-08-31 14:29:49 +02:00
Calle Wilund
c0018f85e9 SStables: put memtable replay_position in metadata on write 2015-08-31 14:29:49 +02:00
Calle Wilund
bbf82e80d0 Commitlog: Allow skipping X bytes in commit log reader
Also refactor reader into named methods for debugging sanity.
2015-08-31 14:29:49 +02:00
Calle Wilund
da9ea641e5 Commitlog: Handle full paths in descriptor file name parse. 2015-08-31 14:29:48 +02:00
Calle Wilund
02d2bef1f2 Commitlog: Expose convinience method "list_existing_segments" 2015-08-31 14:29:48 +02:00
Calle Wilund
19052b3c09 Commitlog: Expose list_existing_descriptors 2015-08-31 14:29:48 +02:00
Calle Wilund
e068ffb5a5 Commitlog: Make file reader provide replay_position for entries 2015-08-31 14:29:47 +02:00
Calle Wilund
41b1ad8600 Commitlog: Make descriptor type visible/usable from outside 2015-08-31 14:29:47 +02:00
Calle Wilund
f14e3cf8d0 Database: do not create shard-specific dirs for commitlog
New ID scheme allows for a single dir for all segments from all shards.
2015-08-31 14:29:46 +02:00
Calle Wilund
ea38b223bd Commitlog: change the ID generation scheme
* Make it more like origin, i.e. based on wall clock time of app start
* Encode shard ID in the, RP segement ID, to ensure RP:s and segement names
  are unique per shard
2015-08-31 14:29:46 +02:00
Calle Wilund
4ac07fa87d Commitlog test: remove some hardcoded assumptions on segment IDs
To enable changing the ID generation scheme.
2015-08-31 14:29:45 +02:00
Calle Wilund
c040565bf9 runtime: expose boot_time
(boot == app start, I did not rename the var).
2015-08-31 14:29:45 +02:00
Calle Wilund
d4ae43862d SStables: Use db::commitlog::replay_position (not own type) 2015-08-31 14:29:45 +02:00
Calle Wilund
0fcf7e3e91 Commitlog: Make "position" type 32-bit to align replay_position with
Origin

* Note: removed commitlog_test:test_allocation_failure because with 
  segments limited to 4GB -> mutation limited to 2GB, actually forcing
  a fail is not guaranteed or even likely.
2015-08-31 14:29:44 +02:00
Avi Kivity
8c69098c89 Merge "Optimize memtable's scanning_reader" from Tomasz
"I saw about 4% improvement in perf_sstable write on muninn with this. The
decorated_key comparison is gone from the perf profile now. Now most of the
work inside the reader is for copying the mutation."
2015-08-31 15:07:27 +03:00
Tomasz Grabiec
f4038b1c04 memtable: scanning_reader: Avoid lookups when iterators not invalidated
Fixes #230.
2015-08-31 13:58:42 +02:00
Tomasz Grabiec
110a55886c lsa: Introduce region::compaction_counter() 2015-08-31 13:58:42 +02:00
Tomasz Grabiec
9ad3dbe592 lsa: Add region::compaction_enabled() 2015-08-31 13:58:42 +02:00
Tomasz Grabiec
048387782a lsa: Rename region::set_compactible() to set_compaction_enabled()
To avoid confusion with region_impl::is_compactible() when the getter
is added.
2015-08-31 13:58:42 +02:00
Tomasz Grabiec
d9ce307c6a memtable: Add non-const partition_entry::key() variant
Helps moving from memtable to cache.
2015-08-31 14:54:26 +03:00
Avi Kivity
0558a56ab5 transport: improve exception handling on connection close
An exception would cause us not to wait on the _ready_to_respond future,
causing a use-after-free.
2015-08-31 14:45:11 +03:00
Calle Wilund
3f1a91b89c Commitlog: do not eagerly create first segment on init
Deferring makes it easier to separate old segments from new, which in turn
helps replay logic.
2015-08-31 13:11:44 +02:00
Pekka Enberg
dd1126f2c2 service/migration_manager: Fix keyspace and CF creation logging
Fix logging output to match origin. Fixes #112.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-31 13:36:02 +03:00
Pekka Enberg
7c9eeb519a schema: Add operator<< for 'schema'
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-31 13:35:26 +03:00
Pekka Enberg
ae9e3e049c schema: Improve column_definition operator<< output
Make operator<< for column_definition print more information.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-31 13:35:26 +03:00
Pekka Enberg
61d7e8de1c schema: Add to_string() for column_kind and index_type enums
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-31 13:35:26 +03:00
Pekka Enberg
03e0bcd8cb database: Add operator<< for keyspace_metadata
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-31 13:35:19 +03:00
Tomasz Grabiec
fabda26871 Merge branch 'penberg/fix-create-keyspace-validation/v1' from seastar-dev.git
From Pekka:

This adds replication strategy validation and wires it up to CREATE
KEYSPACE via migration manager. Fixes #191.
2015-08-31 12:21:52 +02:00
Pekka Enberg
01900996b9 service/migration_manager: Wire up create keyspace validation
Fixes #191.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-31 11:54:56 +03:00
Pekka Enberg
04a65ec06f database: Add keyspace_metadata::validate() helper
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-08-31 11:54:56 +03:00