Commit Graph

3647 Commits

Author SHA1 Message Date
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
Avi Kivity
32a7e3b21f Merge "failure detector REST API"
From Amnon:

"This series adds the failure detector API. The API definition is based on the
FailureDetectorMBean API."
2015-06-03 19:23:07 +03:00
Amnon Heiman
ba8365d95a Adding the Failure detector API implementation
This series adds the implementation for teh Failure detector API.
After this patch the following APIs will be supported:
/failure_detector/endpoints
/failure_detector/count/endpoint/up
/failure_detector/count/endpoint/down
/failure_detector/phi
POST:/failure_detector/phi
/failure_detector/simple_states
/failure_detector/endpoints/states

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-03 19:13:03 +03:00
Amnon Heiman
a75376e8e3 API: Add a helper function from map to key value list
When using swagger definition file, returning a map, needs to be in a
key, value list. To handle this common case in the API, a helper
function was added that gets an unorder_map and return a vector of key,
value mapping.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-03 19:13:03 +03:00
Amnon Heiman
711fe64208 Expose the failure_detector functionality
The failure detector runs on CPU 0, for external usage, this is an
implementation detail which is unrelevant.

This adds a wrapper functions for the functions that are defined in
FailureDetectorMBean which would map the request to the correct CPU.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-03 19:13:03 +03:00
Amnon Heiman
71bfd07d69 API Adding the failure detector swagger definition
This adds the failure detector definition that is based on the
FailureDetectorMBean

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-03 19:12:57 +03:00
Amnon Heiman
57a2777da9 api: fix string containing space cause boost execption
When the container_to_vec helper function has a string that contains
space, a boost exection is thrown.

This fixes it by using std::string for the conversion that the boost
recognize as a string type.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-03 19:00:32 +03:00
Pekka Enberg
0993142d8d sstable: Fix write buffer size
The current 4K write buffer is ridiculously small and forces Urchin to
issue small I/O batches. Increase the buffer size to 64K.

Before:

  Results:
  op rate                   : 27265
  partition rate            : 27265
  row rate                  : 27265
  latency mean              : 1.2
  latency median            : 0.9
  latency 95th percentile   : 2.4
  latency 99th percentile   : 10.6
  latency 99.9th percentile : 14.3
  latency max               : 44.7
  Total operation time      : 00:00:30
  END

After:

  Results:
  op rate                   : 35365
  partition rate            : 35365
  row rate                  : 35365
  latency mean              : 0.9
  latency median            : 0.8
  latency 95th percentile   : 1.8
  latency 99th percentile   : 8.8
  latency 99.9th percentile : 21.8
  latency max               : 272.2
  Total operation time      : 00:00:34
  END

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-06-03 16:32:55 +03:00
Tomasz Grabiec
3d7049f0de tests: Fix commitlog_test.cc
"file" should not go out of scope until async stat() completes.
2015-06-03 14:12:06 +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
5418673659 Column family seal_active_memtable fix: don't use local by ref in cont.
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-06-03 13:43:47 +02:00
Tomasz Grabiec
b2549a7b14 Merge branch 'calle/secondary_index' from seastar-dev.git 2015-06-03 13:22:01 +02:00
Calle Wilund
293dbf66e3 Forward and use replay_position when applying mutation
* Forward commitlog replay_position to column_family.memtable, updating
  highest RP if needed
* When flushing memtable, signal back to commitlog that RP has been dealt with
  to potentially remove finished segment(s)

Note: since memtable flushing right now is _not_ explicitly ordered,
this does not actually work, since we need to guarantee ordering with
regards to RP. I.e. if we flush N blocks, we must guarantee that:
a.) We report "flushed RP" in RP order
b.) For a given RP1, all RP* lower than RP1 must also have been flushed.
(The latter means that it is fine to say, flush X tables at the same time, as long as we report a single RP that is the highest, and no lower RP:s exist in non-flushed tables)

I am however letting someone else deal with ensuring MT->sstable flush order.

Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-06-03 12:38:13 +03:00
Calle Wilund
a157386f29 CreateIndexStatement Java -> c++
Initial translation. More or less complete, though dependent on some
schema attribtues with currently partial implementation. I.e. thrift.
2015-06-03 10:13:53 +02:00
Calle Wilund
a234414ae5 Added schema_builder::add_default_index_names
Transposition of CFMetaData.addDefaultIndexNames()
2015-06-03 10:13:53 +02:00
Calle Wilund
724a33c11d Database: add "existing_index_names" 2015-06-03 10:13:53 +02:00
Calle Wilund
71d4f3fb9b Add column_definition::is_on_all_components()
Most likely an incomplete emulation of the origin behaviour, but maybe
sufficient for now.
2015-06-03 10:13:53 +02:00
Calle Wilund
15b8267dab Add thrift_schema and placeholder "has_compound_comparator()"
thrift_schema == place to collect thrift compatibility aspects of
schema definition.
2015-06-03 10:13:53 +02:00
Calle Wilund
5d32364e34 Migration manager: add placeholder method for announce_column_family_update 2015-06-03 10:13:53 +02:00
Calle Wilund
61c1035c4f IndexName Java -> c++
Initial translation
2015-06-03 10:13:52 +02:00
Calle Wilund
e378ce70d6 IndexTarget Java -> c++
Initial translation
2015-06-03 10:13:52 +02:00
Calle Wilund
b28c71bf4c IndexPropDefs Java -> c++
Initial translation
2015-06-03 10:13:52 +02:00
Calle Wilund
2c603cc4bd SecondaryIndex Java -> c++
Initial translation
2015-06-03 10:13:52 +02:00
Calle Wilund
1631ce132e Add "storage_proxy&" argument to cql_statement::validate
To make db, schemas etc reachable
2015-06-03 10:13:52 +02:00
Calle Wilund
7a03c9275e Index: Import java files 2015-06-03 10:13:52 +02:00
Nadav Har'El
d42c05b6ad sstable: Pull-style read interface
This patch replaces the sstable read APIs from having "push" style,
to having "pull style".

The sstable read code has two APIs:
 1. An API for sequentially consuming low-level sstable items - sstable
    row's beginning and end, cells, tombstones, etc.
 2. An API for sequentially consuming entire sstable rows in our "mutation"
    format.

Before this patch, both APIs were in "push style": The user supplies
callback functions, and the sstable read code "pushes" to these functions
the desired items (low-level sstable parts, or whole mutations).
However, a push API is very inconvenient for users, like the query
processing code, or the compaction code, which both iterate over mutations.
Such code wants to control its own progression through the iteration -
the user prefers to "pull" the next mutation when it wants it; Moreover,
the user wants to *stop* pulling more mutations if it wants, without
worrying about various continuations that are still scheduled in the
background (the latter concern was especially problematic in the "push"
design).

The modified APIs are:

1. The functions for iterating over mutations, sstable::read_rows() et al.,
   now return a "mutation_reader" object which can be used for iterating
   over the mutation: mutation_reader::read() asks for the next mutation,
   and returns a future to it (or an unassigned value on EOF).
   You can see an example on how it is used in sstable_mutation_test.cc.

2. The functions for consuming low-level sstable items (row begin, cell,
   etc.) are still partially push-style - the items are still fed into
   the consume object - but consumpton now *stops* (instead of defering
   and continuing later, as in the old code) when the consumer asks to.
   The caller can resume the consumption later when it wishes to (in
   this sense, this is a "pull" API, because the user asks for more
   input when it wants to).

This patch does *not* remove input_stream's feature of a consumer
function returning a non-ready future. However, this feature is no longer
used anywhere in our code - the new sstable reader code stops the
consumption when old sstable reader code paused it temporarily with
a non-ready future.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-06-03 10:55:34 +03:00
Avi Kivity
3bb06a8b87 Merge seastar upstream 2015-06-03 10:24:21 +03:00
Amnon Heiman
38a22d9cd8 json: float and double support
This change how the json formatter handle float and adds double support.
float and double conversion will throw exceptions when try to convert
inf or nan.

It also contains tests for both float and double including inf, -inf and
nan for both float and double.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-06-03 10:01:00 +03:00
Avi Kivity
c12326d49b Merge "fix write of sstable statistics" 2015-06-03 09:55:16 +03: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
Raphael S. Carvalho
3eec6d7135 sstables: fix sigsegv in write code
c_stats is a thread local variable, which was being re-allocated
for every thrift row. It's intended to keep track of its stats.
Shlomi reported the sigsegv while running cassandra-stress, and
bisect pointed to the commit that introduce write of statistics.

After some investigation, I realized that the problem was about
c_stats, which was being explicitly deallocated by our code, and
that the implicit deallocator would find it after freed.

In addition to the problem above, Avi realized that our code to
write statistics was broken when concurrently writing sstables,
given that the same c_stats would be used for both.

To fix both problems, c_stats and functions to write sstables
were made members of the class sstable.

Reported-by: Shlomi Livne <shlomi@cloudius-systems.com>
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-06-02 18:47:00 -03:00
Raphael S. Carvalho
83d4b962ff sstables: move file writer to a new header
That was needed because new methods of sstable class will have a
file writer as a parameter, and thus the definition of the file
writer must be available from sstables header.
2015-06-02 17:30:50 -03:00
Avi Kivity
604b13633e distributed: document foreign_ptr<> 2015-06-02 22:37:43 +03:00
Avi Kivity
3fe6bb505e future: document traitless map_reduce() 2015-06-02 22:20:13 +03:00
Avi Kivity
7e98e39afd Merge "Thrift and keyspaces"
From Paweł:

"These series contains some improvements in the way thrift keyspace-related
operations are handled (checks whether set_keyspace was given an existing
keyspace, more informative error message when adding keyspace with
invalid/unsupported placement strategy) and initial implementation of
describe_keyspace and describe_keyspaces."
2015-06-02 17:11:55 +03:00
Avi Kivity
5a5c1860d2 Merge seastar upstream 2015-06-02 15:13:42 +03:00
Avi Kivity
ba0e4e45bc future: disable inline continuations in debug mode
Inline continuations can hide bugs where a stack variable is captured by
reference.  Disable them in debug mode.
2015-06-02 15:12:10 +03:00
Avi Kivity
f9dd73d57f tests: make httpd test wait for continuations to execute
The reactor may defer them at will.
2015-06-02 15:12:10 +03:00
Avi Kivity
06dd2899f5 tests: convert httpd tests to SEASTAR_TEST_CASE
Some of them use continuations.
2015-06-02 15:12:10 +03:00
Avi Kivity
919260f3bd tests: ensure continuation is executed
The reactor is free not to inline continuations, so run checks inside
the continuation.
2015-06-02 15:12:10 +03:00
Avi Kivity
1b52ca1bef tests: memcache ascii parser: fix use-after-free
The input stream needs to be kept alive until we're done reading.
2015-06-02 15:12:10 +03:00
Paweł Dziepak
f32a02a94e thrift: implement describe_keyspace[s]
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-06-02 14:11:34 +02:00
Paweł Dziepak
13e8ca96f1 compound: make compound_type::type() const
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-06-02 14:11:34 +02:00
Paweł Dziepak
8e66bfc9d4 db: add getter for database::_keyspaces
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-06-02 14:11:34 +02:00
Paweł Dziepak
d50859907f db: update keyspace_metadata when column family is added
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-06-02 14:11:34 +02:00
Paweł Dziepak
aa13da3952 thrift: translate no_such_class exception
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-06-02 14:11:34 +02:00
Paweł Dziepak
43d915f881 class_registrator: check whether the class exists
Without the check added in this patch if the class doesn't exist
a std::bad_function_call is thrown which is not very informative.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-06-02 14:11:34 +02:00
Paweł Dziepak
73ee82031b thrift: verify in set_keyspace that the keyspace exists
The original code just assigns value to _ks_name which is a sstring
so the try { } catch { } clause only gave the wrong impression that
something is checked.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
2015-06-02 14:11:34 +02:00
Avi Kivity
83fb8a37b6 sstables: fix bad capture-by-reference in sstable::read_row()
schema is a stack variable, yet it is captured by reference.
2015-06-02 13:04:24 +03:00
Avi Kivity
c5f8578ca1 Merge "preparations for secondary indexes"
From Calle:

"Yet another reworking of schema/schema_builder interaction.

* schema::raw_schema now has single sorted column vector + offsets
* schema can be constructed from raw_schema
* schema_builder also contains raw_schema
* schema_builder can construct from schema, ensuring all info is kept
* schema_builder->schema via raw_schema"
2015-06-02 12:24:55 +03:00