Commit Graph

154 Commits

Author SHA1 Message Date
Tomasz Grabiec
c53ed98731 Merge branch 'shlomi/enable_cluster_via_config' from seatar-dev.git 2015-06-15 09:22:41 +02:00
Vlad Zolotarov
e045d8465c db: use snitch name from the configuration file
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-06-14 15:31:58 +03:00
Shlomi Livne
2c6ba8971f Different seperator for map elements
Origin's --seed-provider-parameters format is seeds=<ip1>,<ip2>,<ip3> to
align with yaml configuration file format and command line options a
different seperator must be used instead of "," - switched to using ";"

Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-06-14 11:32:57 +03:00
Pekka Enberg
5b4c073170 db/legacy_schema_tables: Store keyspace strategy options
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-11 13:02:42 +03:00
Pekka Enberg
d088cb8181 Fix keyspace strategy options to preserve key-value ordering
Fix keyspace strategy options to preserve key-value ordering by
switching to std::map. We need this to be able to store the map in
database as JSON because unordered maps can cause the schema merging
code to attempt a keyspace update, which we don't support, even though
the values did not change.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-11 13:02:42 +03:00
Vlad Zolotarov
a2594015f9 locator: futurize snitch creation
- Forbid explicit snitch creation with constructor.
   - Allow the creation of snitches only with locator::make_snitch() template
     function.

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

New in v4:
   - Make sure the snitch is stopped before it's destroyed when _snitch_is_ready
     is returned in an exceptional state.

New in v2:
   - Change snitch_ptr to be std::unique_ptr<i_endpoint_snitch>
   - abstract_replication_strategy::create_replication_strategy(): explicitly
     specify (template) types of create_object() parameters.
   - Re-arrange the loop in marge_keyspaces() so that lambdas that depend on
     "this" complete before there is a chance that "this" gets destroyed.
   - create_keyspace(): Don't add a new keyspace if a keyspace with this name
     already exists.
   - i_endpoint_snitch: added a stop() virtual method
      - Added a stop() pure virtual method.
      - Added an enum class snitch_state and a _state member initialized to snitch_state::initializing,
        added an assert() in a destructor requiring _state to become snitch_state::stopped,
        which should be set when stop() is complete.
   - rack_inferring_snitch: added a stop() method.
   - simple_snitch: added a stop() method.
   - Added stop() methods to abstract_replication_strategy and keyspace.
   - Updated database::stop() to wait for all keyspaces in _keyspaces to stop.
2015-06-09 15:33:38 +03:00
Vlad Zolotarov
73278798a9 added missing methods (stubs) required for snitch implementation
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>

New in v2:
   - storage_service: add a non-const version of get_token_metadata().
   - get_broadcast_address(): check if net::get_messaging_service().local_is_initialized()
     before calling net::get_local_messaging_service().listen_address().
   - get_broadcast_address(): return an inet_address by value.
   - system_keyspace: introduce db::system_keyspace::endpoint_dc_rack
   - fb_utilities: use listen_address as broadcast_address for now
2015-06-09 15:33:29 +03:00
Shlomi Livne
bd89fa4905 config: add string_list (vec of sstring) as config data type + use for datadir
To handle the fact that --data-file-directories is supposed to be 1+
folders.

Note that boost::program_ops already "reserves" the use of std::vector
as reciever of values for multitoken options (i.e. those with more than
one value). Thus, values recieving a list of tokens via command line
should adhere to the multi-token rules, i.e. space separated values.

End result is that --data-file-directories now accept multiple paths,
white space separated,
i.e. --data-file-directories <path1> <path2>
And as it turns out, this is really a nicer way of writing stuff than
using "," or ":" seperation of paths etc, so...

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-06-09 10:40:45 +03:00
Pekka Enberg
d25bd89ee1 db/legacy_schema_tables: Convert table merging to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-08 14:59:06 +03:00
Avi Kivity
e343295667 commitlog: don't pass a temporary string to std::regex_match
The match results will point nowhere, and libstdc++ 5 rightly rejects it.
2015-06-08 09:23:18 +03:00
Pekka Enberg
1cac0c7b31 db/legacy_schema_tables: Fix read_schema_for_keyspaces()
Fix the check in read_schema_for_keyspaces() to not insert empty
result sets in the return value. There's no functional change as the
merge algorithms already deal with the case. However, the code is now
closer to what origin does.

Spotted while reading the code.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-05 12:58:46 +03:00
Pekka Enberg
fcd6f147fc db/legacy_schema_tables.cc: Use schema_result::value_type instead of std::pair
Switch to schema_result::value_type instead of the open-coded std::pair
so that the actual types are defined in one place.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-03 19:14:39 +02:00
Pekka Enberg
2eeabfcebc db/legacy_schema_tables: Fix merge_keyspaces()
Keys that are in "entries_only_on_right" need to be looked up from
"after". Fixes a regression introduced in commit 5418e32
("map_difference: Simplify difference value").

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-03 13:43:48 +02:00
Calle Wilund
2c603cc4bd SecondaryIndex Java -> c++
Initial translation
2015-06-03 10:13:52 +02:00
Calle Wilund
7a03c9275e Index: Import java files 2015-06-03 10:13:52 +02:00
Pekka Enberg
5418e32fc7 map_difference: Simplify difference value
Simplify the return value of map_difference() to return set of keys.
This makes it possible to use the function with value types such as
foreign_ptr<> that are non-copyable.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-03 09:19:00 +03:00
Pekka Enberg
2a68aefca9 db/legacy_schema_tables: Use sstring as schema results key
There's no need to use decorated_key as schema results map key because
we just convert it back to a keyspace name string. It does, however,
cause problems when trying to pass the results around to different CPUs
so just switch to the sstring type.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-02 12:24:11 +03:00
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