Commit Graph

137 Commits

Author SHA1 Message Date
Calle Wilund
0729580f84 Separate replay_position into its own header
Less include bloat...

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-06-01 14:17:43 +03:00
Gleb Natapov
fc176415f1 remove leftovers from db/serializer.hh 2015-06-01 09:31:58 +02:00
Asias He
3b4c233f55 system_keyspace: Add get_local_host_id and set_local_host_id 2015-06-01 11:24:39 +08:00
Pekka Enberg
257511d271 db/legacy_schema_tables: make_create_table_mutations()
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-27 16:22:13 +03:00
Pekka Enberg
a388b088c6 map_difference: Parametrize value comparison
If map value type is lw_shared_ptr<T>, for example, we need to be able
to pass our own value comparison function to the difference() function.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-27 16:22:13 +03:00
Avi Kivity
a83d0b258c commitlog: fix build error in default_size 2015-05-26 20:47:39 +03:00
Avi Kivity
51b0e2a1e9 commitlog: don't specify the default_size in terms of alignment
Use kiB units instead.
2015-05-26 18:50:21 +03:00
Calle Wilund
e77b23c34f commitlog: Bump up buffer size
Still not "properly" profiled what the best size is, but testing shows this
helps a bit at least.

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-26 18:49:17 +03:00
Pekka Enberg
89a466ce7f db/legacy_schema_tables: Fix use-after-move in add_table_to_schema_mutation()
Spotted by Tomek.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-25 20:49:16 +03:00
Asias He
898233ddcf Remove redundant const in static constexpr const
From http://en.cppreference.com/w/cpp/language/constexpr:

  A constexpr specifier used in an object declaration implies const.
2015-05-25 13:09:23 +03:00
Pekka Enberg
4dc488afb2 database: Store metadata in 'struct keyspace'
Store a lw_shared_ptr<keyspace_metadata> in struct keyspace so callers
in migration manager, for example, can look it up.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-25 09:12:29 +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
Amnon Heiman
b95dabba38 Expose the segment names in commit log
This adds a method to return a vector with full-path to the active
segment names. It will be used by the API.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-19 15:27:52 +03:00
Pekka Enberg
cd35617855 database: Use keyspace_metadata for creation functions
Use the keyspace_metadata type for keyspace creation functions. This is
needed to be able to have a mapping from keyspace name to keyspace
metadata for various call-sites.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-19 15:27:47 +03:00
Pekka Enberg
8380df84b4 database: Rename ks_meta_data to keyspace_metadata
Follow the naming convention set by user_types_metadata and rename
ks_meta_data to keyspace_metadata.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-19 11:24:06 +03:00
Pekka Enberg
032af4d53b database: Move ks_meta_data definition to database.hh
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-19 11:03:28 +03:00
Pekka Enberg
e80fe254d2 config: Encapsulate ks_meta_data member variables
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-19 10:51:39 +03:00
Avi Kivity
07d7f410f3 Merge branch 'memtable' into db
Conflicts:
	database.hh
	memtable changes moved to memtable.hh
2015-05-18 15:50:24 +03:00
Avi Kivity
dda5cbfd0d db: make column_family and keyspace configurable
Currently used for the data directory.
2015-05-18 15:00:31 +03:00
Gleb Natapov
3838d82c1f merge_schema copies storage_proxy unintentionally 2015-05-18 10:47:36 +02:00
Calle Wilund
46480ca836 config: Add support for maps in command lines + fix seed_provider
* Allow boost::config to translate string_maps via iostream
* Special case seed_provider (struct) into two parameters (for lack of a
good way to express it on command line)

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-14 10:36:13 +03:00
Avi Kivity
b300a05468 Merge branch 'master' of github.com:cloudius-systems/urchin into db 2015-05-12 15:07:16 +03:00
Avi Kivity
548646d4ba Merge branch 'master' of github.com:cloudius-systems/seastar into db
Should fix use-after-free when a frozen_mutation is applied to the
local shard.

Includes two adjustments to urchin collectd usage from Calle:

  - Updated thrift collectd registration to use proper move semantics
  - Commitlog: Fix collectd registration to use move semantics + test

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-12 14:47:07 +03:00
Tomasz Grabiec
c779fa880f Merge branch 'penberg/keyspace-merging-improvements/v2' from seastar-dev.git
From Pekka:

 "This series implements a Maps.difference() function in C++, changes
 storage_proxy::query_local() to not return foreign_ptr>, and finally
 changes the keyspace merging code to follow Origin."
2015-05-12 13:08:02 +02:00
Pekka Enberg
96a1955cea db/legacy_schema_tables: Use map_difference() instead of open-coding it
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 13:18:56 +03:00
Pekka Enberg
d3f9af7239 Make storage_proxy::query_local() return bare lw_shared_ptr<>
Don't return foreign_ptr<> which is not copyable so that we can use
map_difference for maps with result_set in them.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 13:18:56 +03:00
Calle Wilund
183e0b52e6 commitlog: Add collectd counters
- # segments
- # allocting segments
- # unused segments
- # allocations
- # cycles (disk writes)
- # flush
- # total bytes allocated
- # total bytes disk slack (due to dma blocks)

Counters are per-commitlog (shard). Can be extended to be per-segment also,
but would be transient and probably not much more useful.

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-11 16:06:51 +03:00
Tomasz Grabiec
4ab66de0ae db: Introduce frozen_mutation
The immediate motivation for introducing frozen_mutation is inability
to deserialize current "mutation" object, which needs schema reference
at the time it's constructed. It needs schema to initialize its
internal maps with proper key comparators, which depend on schema.

frozen_mutation is an immutable, compact form of a mutation. It
doesn't use complex in-memory strucutres, data is stored in a linear
buffer. In case of frozen_mutation schema needs to be supplied only at
the time mutation partition is visited. Therefore it can be trivially
deserialized without schema.
2015-05-08 09:19:01 +02:00
Calle Wilund
46e0676a7d commitlog: Add reader stream/subscription
Generic read-all-stream from a commit log segmen file.
Provides a byte view for each data entry, doing CRC checks and padding skips.

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-06 16:45:13 +03:00
Calle Wilund
7f685abca0 commitlog: added file header space twice
Checked wrong var == 0 when creating second mem buffer in segment

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-06 16:19:56 +03:00
Calle Wilund
897083e213 commitlog: Sync check time delta was inverted
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-06 16:19:49 +03:00
Calle Wilund
d2d3547115 commitlog: Initial data chunk offset should be 16
As in "after file header".

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-06 16:19:43 +03:00
Pekka Enberg
bf1734c480 db/commitlog: Use 'pragma once' in commitlog.hh
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-06 09:47:42 +03:00
Pekka Enberg
a32ae69b2b db/commitlog: Minor formatting fixes
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-06 09:47:21 +03:00
Pekka Enberg
9920d58b70 db/commitlog: Use C++ type aliases
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-06 09:43:04 +03:00
Calle Wilund
2835da3d8c config: make sure aliases actually work properly
The nature of how boost::program_options are applied made
alias definitions clash and overwrite each other.
Make aliases not have default, and overrride bpo handling
of defaults so that they are not applied to the config object
(only used in pretty-print)

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-05 10:56:54 +03:00
Calle Wilund
e1c0ddea93 commitlog: make sure we don't race creating segments
Use a semaphore as gatekeeper to make sure we finish creating a segment
before starting a new one.

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-05-05 09:59:27 +03:00
Tomasz Grabiec
aec740f895 db: Make decorated_key have ordering compatible with Origin 2015-04-30 12:02:39 +02:00
Calle Wilund
2f4e7a00f6 Use db/config object in main, database etc
* Uses config object to augument/impl options parsing
* Database now holds config obj
* Commitlog can now be inited with global config obj.
2015-04-29 18:01:17 +02:00
Calle Wilund
5054892657 Cassandra compatible "config" object
* Based on the property set of cassandra 2.1
* Structure mapping all "known" cassandra.yaml config properties
* YAML and command line parsing of opts.
* Tracks is-set? and set-from-where?
* Uses giant macros to make Avi happy.
2015-04-29 17:00:15 +02:00
Avi Kivity
6290dee438 db: const correctness for abstract_type and friends
Types are immutable.
2015-04-29 15:40:38 +03:00
Avi Kivity
3162873d7f Merge branch 'calle/commitlog' of github.com:cloudius-systems/seastar-dev into db
Use commit log in database, from Calle:

"Initial" usage of the commitlog in database mutation path.
A commitlog is created in "work" dirs when initing the db
from a datadir. However, since we have neither disk data storage,
nor replay capability yet (and no real db config), the settings
are basically to just write in-memory serialization, write them to
disk and then discard them. So in fact, pointless. But at least using
the log...
2015-04-29 11:28:05 +03:00
Calle Wilund
aeb83f2874 Add commitlog to db + use it in storage_proxy/handler
* A commitlog is created in "work" dirs when initing the db
  from a datadir. However, since we have neither disk data storage,
  nor replay capability yet (and no real db config), the settings 
  are basically to just write in-memory serialization, write them to 
  disk and then discard them. So in fact, pointless. But at least using
  the log...
* Moved the actual "apply" of mutation into database. If a commitlog
  is active, add an entry to it before applying mutation.
2015-04-29 10:10:21 +02:00
Calle Wilund
07f1208926 Make commitlog respect max disk size setting. 2015-04-29 10:10:21 +02:00
Pekka Enberg
9ec10c240f db: Convert LegacySchemaTables keyspace merging
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-28 15:49:34 +03:00
Pekka Enberg
5b409baa99 db: Return a vector of mutations for 'create keyspace'
Origin supports chaining multiple mutations but we don't. Therefore,
return a vector of mutations for 'create keyspace'.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-27 10:38:11 +03:00
Tomasz Grabiec
474dbbbc88 db/serializer: Avoid unnecessary lookup of column family ID
We can now get it from schema.
2015-04-24 18:01:01 +02:00
Tomasz Grabiec
9f3053a867 db/serializer: Fix coding style 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
1c3275c950 mutation: Encapsulate fields 2015-04-24 18:01:01 +02:00
Tomasz Grabiec
a9972b4b28 Relax header dependencies 2015-04-24 18:01:01 +02:00