Commit Graph

3498 Commits

Author SHA1 Message Date
Amnon Heiman
df7a06c8dc token_metadata expose the token and token mapping
This adds an API that expose the token to endpoint mapping and the token
that are associate with an address.

Both method will be used by the API to expose the tokens.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-27 15:29:49 +03:00
Amnon Heiman
a28b90bfd3 Adding definitions to the storage_service
This adds the following definitions to the storage_service swagger
definition file:
/storage_service/tokens
/storage_service/tokens/{endpoint}
/storage_service/commitlog
/storage_service/tokens_endpoint

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-27 15:28:20 +03:00
Amnon Heiman
f0e5d76d85 API: Add helper function to transfer collection to list of sstring
These adds a helper function to transfer a list of object to a list of
string. It will be used by the API implementation.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-27 15:28:20 +03:00
Asias He
6673b510d0 main: Set a default seed ip address
If user does not specify one, set it to 127.0.0.1 as Origin does.
2015-05-27 13:06:00 +03:00
Avi Kivity
3ef36a952b Merge "Query result set comparison support"
Pekka says:

"This series adds comparison operators for query result sets that are
needed by schema merging code. The operators are implemented using a
newly added "data_value" type that encodes the type of the value."
2015-05-27 12:38:20 +03:00
Pekka Enberg
6ed0d8c0e4 query-result-set.hh: Add comparison operators
Schema merging code needs to be able to compare two result sets to
determine if a keyspace, for example, has changed. Add comparison
operators for that.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-27 11:49:12 +03:00
Pekka Enberg
446555f2de query-result-set.hh: Use data_value instead of boost::any
Switch to data_value in preparation for adding support for comparison
operators.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-27 11:49:12 +03:00
Pekka Enberg
ea0e1ff3b5 types.hh: Add data_value class
Add a data_value class that also encodes a value type. This makes it
easier to use than plain boost::any for comparing two values.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-27 11:49:12 +03:00
Avi Kivity
4f45633464 Merge "token bootstrap"
From Asias: "With this series, when a node bootstraps, it can get 256 tokens."
2015-05-27 10:56:38 +03:00
Asias He
64a9935206 storage_service: Implement join_token_ring 2015-05-27 15:05:12 +08:00
Asias He
ff099c44ce gossip: Convert more versioned_value 2015-05-27 15:03:29 +08:00
Avi Kivity
876af389be Merge "sstable bloom filter fixes"
Bloom filter fixes from Glauber.
2015-05-27 08:36:03 +03:00
Avi Kivity
0e29f9a3c5 Merge "sstable write bug fix"
Glauber says:

"Our stress tests found today a bug in sstable writing.
This fixes it, at least locally for me."
2015-05-27 08:34:55 +03:00
Raphael S. Carvalho
1d4c92b7fb sstables: fix scope problem when writing a vector
There is no guarantee that vector tmp will be alive by the time
it's written via output stream. Let's use do_with here.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-27 08:34:22 +03:00
Asias He
de169ca9e7 storage_service: Call boot_strapper::get_random_tokens 2015-05-27 13:06:33 +08:00
Asias He
aa4a23a248 dht: Virtualize get_random_token
murmur3_partitioner::get_random_token is implemented.
2015-05-27 13:06:33 +08:00
Asias He
a66f06ad44 dht: Specify override on a virtual function in a derived class
The murmur3_partitioner overrides functions in i_partitioner.
2015-05-27 13:06:33 +08:00
Asias He
ee1d79cd2b dht: Convert BootStrapper.java to C++ 2015-05-27 13:06:33 +08:00
Asias He
1c9e88dcb9 dht: Import BootStrapper.java 2015-05-27 13:06:33 +08:00
Asias He
4dfd445466 locator: Return optional for token_metadata::get_endpoint 2015-05-27 13:06:33 +08:00
Glauber Costa
989bc91de3 bloom filter: use unsigned quantities for signed math
We are using signed quantities to be compatible with the code java uses.
However, the current code will eventually overflow.

To avoid that, let's cast the quantities to unsigned, and then back to signed

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-26 15:50:18 -04:00
Glauber Costa
17557ca3f2 bloom filter: fix incorrect size
There is a tricky bug in our current filter implementation: is_present will
return a different value depending on the order keys are inserted.

The problem here, is that _bitmap.size() will return the maximum *currently*
used bit in the set. Therefore, when we hash a given key, the maximum bit it
sets in the bitmap is used as "max" in the expression

    results[i] = (base % max);

If the next keys do not set any bit higher than this one, everything works as
expected, because the keys will always hash the same way.

However, if one of the following keys happens to set a bit higher than the
highest bit which was set at the time a certain key was set, it will hash using
two different values of "max" in the aforementioned expression; one at insertion,
and another one at the test.

We should be using max_size() to be sure that we will always have the same
hash results.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-26 15:50:05 -04:00
Glauber Costa
7013791d62 sstables: avoid copying val
Noted by Avi while we were searching for a fix for an unrelated bug.
We haven't actually seen this trigger, but the current in-tree behavior
is wrong.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-26 15:35:30 -04:00
Glauber Costa
78b93b21b3 sstables: don't cast composites to bytes_view
Now that we can write composites directly, we no longer should use bytes_view.

As a matter of fact, write(out, ... bytes_view(x)) is wrong, because our write
function can't handle rvalue-references very well. Doing both those things, we
can fix a tricky bug that showed up recently in our stress tests.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-26 15:34:55 -04:00
Glauber Costa
4b7e5d0565 sstable: describe composite type
This way, we don't need to rely on an external byte_view conversion to write
this element. Note that because we don't have a writer to const byte&, we will
cast away the qualifier.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-26 15:34:25 -04:00
Glauber Costa
414502fe21 sstables: make sure composites stay alive
We create some composites for use in writing the column names, but we have
done nothing to guarantee they will stay alive.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-26 15:34:25 -04: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
Avi Kivity
cc94019326 Merge seastar upstream
Added missing includes to tests/urchin/commitlog_test.cc.
2015-05-26 17:08:31 +03:00
Avi Kivity
f2b82fd455 sstables/types.hh: add missing includes 2015-05-26 16:53:34 +03:00
Avi Kivity
bdfe41820a future-util.hh: add missing include 2015-05-26 16:42:15 +03:00
Vlad Zolotarov
7b1f433aed file: Rework read interface
Move the get() logic in fstream.cc into the file::dma_read_bulk()
fixing some issues:
   - Fix the funny "alignment" calculation.
   - Make sure the length is aligned too.
   - Added new functions:
      - dma_read(pos, len): returns a temporary_buffer with read data and
                            doesn't assume/require any alignment from either "pos"
                            or "len". Unlike dma_read_bulk() this function will
                            trim the resulting buffer to the requested size.
      - dma_read_exactly(pos, len): does exactly what dma_read(pos, len) does but it
                                    will also throw and exception if it failed to read
                                    the required number of bytes (e.g. EOF is reached).
   - Changed the names of parameters of dma_read(pos, buf, len) in order to emphasize
     that they have to be aligned.
   - Added a description to dma_read(pos, buf, len) to make it even more clear.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-05-26 15:15:39 +03:00
Vlad Zolotarov
796c203d68 core: remove #include "reactor.hh" from future-util.hh
When future-util.hh is included in files included in reactor.hh (e.g. file.hh).

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-05-26 15:15:28 +03:00
Avi Kivity
fba9df4a8b Merge "Preparatory patches for token bootstrap"
Preparatory patches for token bootstrap, from Asias.
2015-05-26 15:02:27 +03:00
Asias He
7c85b8763a storage_service: Enable bootstrapTokens
We need BootStrapper.getBootstrapTokens and BootStrapper.getRandomTokens
to calculate it.
2015-05-26 17:45:29 +08:00
Asias He
9736dc6d9c storage_service: Convert should_bootstrap 2015-05-26 17:45:29 +08:00
Asias He
efd879297e gossip: Add debug_show helper
This starts a periodic timer to dump gossip state every second. It is useful to
debug the internal of gossiper.
2015-05-26 17:45:29 +08:00
Asias He
e98ec068ca storage_service: Start gossiper inside prepare_to_join 2015-05-26 17:45:29 +08:00
Asias He
93f4ba820e storage_service: Make storage_service distributed 2015-05-26 17:45:29 +08:00
Asias He
eefc5a688e storage_service: Call join_token_ring
After prepare_to_join, call join_token_ring to join the ring. We do
nothing ATM.
2015-05-26 17:45:29 +08:00
Asias He
8c47b04958 storage_service: Inject application_states in prepare_to_join 2015-05-26 17:45:20 +08:00
Asias He
87a8d1f77e gossip: Convert more versioned_value factory functions 2015-05-26 16:16:52 +08:00
Avi Kivity
4c6bd14465 Merge "gossipper API"
Gossipper RESTful API, from Amnon.
2015-05-26 09:52:49 +03:00
Raphael S. Carvalho
4611fd373d sstables: add missing copyright
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-26 09:51:15 +03:00
Avi Kivity
be4e09b8b8 Merge "Fixes and improvements for sstables write path"
From Glauber:

"Here are some fixes for the sstables write path. The code is made
simpler by mainly:

- taking advantage of the fact that we don't have to chain futures
  that will do nothing more than write a value to the output stream.
  The compiler will do that for us if we use the recursive template
  interface,

- moving most of the composite logic to sstable/key.cc.

The last one has the interesting side effect of making the code correct.
A nice bonus."
2015-05-26 09:50:06 +03:00
Glauber Costa
87eda7eb5d sstables: adjust static column name creation interface
The column_name can be comprised of more than one element. This will
be the case for collections, that will embed part of the collection
data in the column name.

While doing this, we also take advantage of the infrastructure we have
added to composite. We are duplicating this logic unnecessarily, which
is prone to bugs. Those bugs are not just theoretical in this case: the
static prefix is not "followed by a null composite, i.e. three null bytes."
as the code implies.

The static prefix is created by appending one empty element for each element in
the clustering key, and will only be three null bytes in the case where the
clustering key has one element.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-25 21:10:16 -04:00
Glauber Costa
eaa61ba86c sstables: encode logic for creating a static key component in composite
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-25 21:09:39 -04:00
Glauber Costa
c5b6786094 sstables: adjust write_column_name interface
The column_name can be comprised of more than one element. This will
be the case for collections, that will embed part of the collection
data in the column name.

While doing this, we also take advantage of the infrastructure we have
added to composite. We are duplicating this logic unnecessarily, which
is prone to bugs. Those bugs are not just theoretical in this case: we
are not writing the final marker for empty composite keys.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-25 21:07:10 -04:00
Glauber Costa
299a185376 sstable: create a key from an exploded view
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-25 21:02:55 -04:00