Commit Graph

53948 Commits

Author SHA1 Message Date
Asias He
4829965496 storage_service: Enable handleStateBootstrap and friends
They will be used in on_change functions.
2015-06-01 11:24:38 +08:00
Asias He
904e584c14 storage_service: Implement on_join 2015-06-01 11:24:38 +08:00
Asias He
9f5093230c locator: Import TokenMetadata.java
We still need a lot of functions in Origin. Import the complete
TokenMetadata.java and convert as needed. For example, storage_service
will need updateHostId, addBootstrapTokens and more.
2015-06-01 11:24:38 +08:00
Asias He
8be4226a36 storage_service: Update _token_metadata with update_normal_token 2015-06-01 11:24:38 +08:00
Asias He
74fcb3d9aa storage_service: Add get_broadcast_address helper 2015-06-01 11:24:38 +08:00
Asias He
cbbaecf85c storage_service: Drop messaging_service handler registration code
We register the messaging_service handler within the subsystem who uses
it, e.g., we register gossip related in the gossiper class.
2015-06-01 11:24:38 +08:00
Asias He
3dc03738bc storage_service: Add debug info in gossip state change callback
Now, we can verify that get_tokens_for(ip) get the correct tokens
through gossip.

Start the seed node first:
$./seastar --listen-address 127.0.0.1 --seed-provider-parameters 127.0.0.1

Then start a normal node:
$./seastar --listen-address 127.0.0.2 --seed-provider-parameters 127.0.0.1

On the second node:

SS::on_join endpoint=127.0.0.1
endpoint=127.0.0.1,
tokens_string=8768e8a2d360bce8;d99d50eae7e514a2;f937ba030e4f1fa2
t=87 68 e8 a2 d3 60 bc e8
t=d9 9d 50 ea e7 e5 14 a2
t=f9 37 ba 03 0e 4f 1f a2

ep=127.0.0.1, eps=EndpointState: HeartBeatState = generation =
1432868747, version = 52, AppStateMap =  { 0 : Value(BOOT,TOKENS,11) }
{ 5 : Value(urchin_1_0,4) }  { 8 : Value(,3) }  { 11 : Value(ms_1_0,1) }
{ 12 : Value(9a6e8c60-05af-11e5-b9b8-000000000000,2) }  { 13 :
Value(8768e8a2d360bce8;d99d50eae7e514a2;f937ba030e4f1fa2,9) }
2015-06-01 11:24:38 +08:00
Asias He
e1b9b2e09a storage_service: Set tokens on startup 2015-06-01 11:24:38 +08:00
Asias He
03b526f06b storage_service: Implement get_tokens_for 2015-06-01 11:24:38 +08:00
Asias He
322b27c12b storage_service: Implement set_tokens 2015-06-01 11:24:38 +08:00
Asias He
d28503374d storage_service: Add debug print helper 2015-06-01 11:24:38 +08:00
Asias He
8d7aff89e3 storage_service: Reduce default num_tokens to 3
The default value 256 in Origin is too big for debug. We can set it back
when storage_service is maturer.
2015-06-01 11:24:38 +08:00
Asias He
1e289018ea gossip: Implement versioned_value for tokens
Tokens are store in versioned_value hex string split by semicolon, e.g.:

9f6fd6dd5149e39c;59068b2415190651;63684ccb1b73c1e3
2015-06-01 11:24:38 +08:00
Asias He
d026ca6852 token: Add constructor token(kind, bytes) 2015-06-01 11:24:38 +08:00
Asias He
487768732f storage_service: Rename bootstrapTokens to _bootstrap_tokens 2015-06-01 11:24:38 +08:00
Asias He
e6f5618d97 storage_service: Rename tokenMetadata to _token_metadata 2015-06-01 11:24:37 +08:00
Avi Kivity
3d4314b7e4 doc: disambigute class future from the future documentation module 2015-05-31 19:08:16 +03:00
Avi Kivity
3a63706f97 future: document more future-util functions 2015-05-31 19:00:40 +03:00
Amnon Heiman
bdb2a7ff47 api: Remove empty parameter from storage_service.json
Empty parameter definition is not accepted by the swagger UI, instead,
the parameter list itself should be empty.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-31 18:17:29 +03:00
Amnon Heiman
e83c392120 http: Support file transformers
This runs the file transformer on a file before returning the result.

This is used for templating support.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-31 18:11:43 +03:00
Avi Kivity
abaad55a66 future: fix documentation errors
Noted by Nadav.
2015-05-31 18:10:54 +03:00
Avi Kivity
ff8769fdf7 Merge "Extend storage_service API support"
From Amnon:

"This seriese adds functionality to the storage_service API. It focus on tokens
information, that are partially supported in the storage_service and the call
to the API will return an empty list."
2015-05-31 17:57:30 +03:00
Gleb Natapov
699a47342d message: drop tuple<int, long> serializer
It is used only in test and even there it is not needed.
2015-05-31 17:53:51 +03:00
Avi Kivity
65ff797ec1 doc: add main doxygen page 2015-05-31 17:51:53 +03:00
Avi Kivity
aa519f86a8 future: user-level documentation 2015-05-31 17:29:31 +03:00
Avi Kivity
2877364947 future: separate task class into its own header
tasks are a lower-level concept than future/promise, so move them to their
own header.
2015-05-31 15:49:05 +03:00
Gleb Natapov
c5077ce99b tests: add missing header 2015-05-31 15:24:00 +03:00
Vlad Zolotarov
81c9b327c6 compress: Use file::dma_read_exactly() instead of a local version of it.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-05-31 11:21:56 +03:00
Nadav Har'El
33270efc39 sstables: make consume_row_end() a future
After commit 3ae81e68a0, we already support
in input_stream::consume() the possibility of the consumer blocking by
returning a future. But the code for sstable consumption had now way to
use this capability. This patch adds a future<> return code for
consume_row_end(), allowing the consumer to pause after reading each
sstable row (but not, currently, after each cell in the row).

We also need to use this capability in read_range_rows(), which wrongly
ignored the future<> returned by the "walker" function - now this future<>
is returned to the sstable reader, and causes it to pause reading until
the future is fulfilled.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-05-28 18:53:32 +03:00
Glauber Costa
c02e3fc16a tests:: fix sstable test files removal for good
The current scheme of creating temporary files inside the current directory is
very fragile.

First, whenever we start writing new files, the test breaks if we forget to
include it in the list of removed files (likely).

Second, because we have to manually delete the files after we're done with
them, we can either forget, or if the test crashes, the final condition may not
run.

Instead of doing that, let's move the files to a separate directory. That makes
it a lot easier to make sure we're deleting all the relevant files, because we
can just wipe out the whole directory.

All tests are then wrapped in a function that makes sure that the proper setup
is in place.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-28 18:03:37 +03:00
Avi Kivity
7e4d8c3796 Merge seastar upstream 2015-05-28 18:01:10 +03:00
Glauber Costa
b77605cdba reactor: call remove instead of unlink
remove() is a convenient glibc wrapper that will unlink() a file and rmdir() a
directory. It will allow us to operate on both without creating a separate
function for a directory.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-28 17:56:42 +03:00
Glauber Costa
a209a5c2cb bloom filter: go back to size for bitset
max_size, as currently used, will return -1 and while it will fix the previous
bug, it will uncover another.

We can go back to using size, as long as we make sure that all sites correctly
pick a size when creating the bitset. Aside from that, for compatibility with
the java code, the total number of bits has to be a power of two.

The best way to achieve those goals, is to just set the size ourselves through
resize() in the filter constructor. num_blocks() * bits_per_block is guaranteed
to yield a power of two as we need, and in case one caller did not explicitly
set a size, it will be set from this moment on.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-28 17:12:39 +03:00
Avi Kivity
9dd680493c Merge seastar upstream 2015-05-28 13:30:11 +03:00
Vlad Zolotarov
c547f9a718 fstream: prevent ANY exceptions to be thrown in good get() flow
There is a hidden exception that could be thrown insize file::dma_get_bulk()
if file size is not aligned with fstream::_buffer_size. In this case
file::dma_read_bulk() will be given a _buffer_size as a length for the last data
chunk in the file too. file::dma_read_bulk() will get a short read (till EOF)
and then will try to read beyond it (by calling file::read_maybe_eof())
in order to differentiate between I/O error and EOF. file::read_maybe_eof()
will throw a file::eof_error exception to indicate the EOF, it will be caught
by file::dma_read_bulk() and since we have read some "good" bytes by now this
exception won't be forwarded further. However the damage by throwing the exception
has already been done and we want to avoid this in fstream flow (unless there are
real errors).

In order to prevent the above we will always request file::dma_read_bulk() to
read the amount of data it should be able to deliver (not beyond EOF).

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-05-28 13:25:40 +03:00
Vlad Zolotarov
b70c9a2e18 file: read_maybe_eof(): Don't throw file::eof_error().
Make read_maybe_eof() return zero-sized buffer when pos is at or beyond
EOF. This will prevent an internal exception throwing inside "file" class
in cases when dma_read_bulk() is going to succeed and return read data, e.g. when
it was called with "offset" less than file size but "offset" + "range_size"
beyond EOF.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-05-28 13:25:40 +03:00
Vlad Zolotarov
ae03cfbb5d file: clarify the class interface.
Move read_state helper class, file::dma_read_bulk() and file::read_maybe_eof()
definitions outside the class declaration in order to make reading the class
interface easier.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-05-28 13:25:40 +03:00
Avi Kivity
9243187ac2 stream: make subscriptions a little more usable
Requiring next_fn to be available at listen() time means you can't pass
subscriptions around, and it is often hard to create next_fn, since it
usually needs to capture 'this', while this also points to the subscription
itself, creating a chicken and egg problem.

Fix by separating the registration process into two steps: listen() creates
the subscription, and start() accepts the next callback and starts processing
events.
2015-05-28 13:11:40 +03:00
Pekka Enberg
c2675980b9 database: Fix data_value comparison operator
Tomek says:

  "Some types may yield different byte-representations for equal
   values."

Fix that up.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-28 11:21:22 +02:00
Avi Kivity
40e8985f64 Merge "Make migration manager announce new column families"
From Pekka:

"This series wires up migration manager column family announcements in
preparation for eventually storing column family schema in system
tables."
2015-05-27 16:42:00 +03:00
Pekka Enberg
42cfcfb32d database: Remove compose() function
Convert code to use the deserialize() function and drop the duplicate
compose() wrapper that we inherited from Origin.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-27 16:22:35 +03:00
Pekka Enberg
27749769e8 migration_manager: Convert announce_new_column_family() to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-27 16:22:13 +03: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
Takuya ASADA
c620bab8e5 VM image build script to running SeaStar on Linux guest
Creates Linux guest with SeaStar + DPDK in just 2 commands.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-05-27 15:39:30 +03:00
Amnon Heiman
dc4584254b API: Adding storage_service implementation
This adds implementation to the added storage service definitions.
After this patch, the following calls will be supported:
/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:29:49 +03:00
Amnon Heiman
041fd4c617 storage_service: expose the storage functionality
The storage service runs on CPU 0, this adds a wrapper function that
would expose the relevent storage_service function but will hide the
cpu this is actually be run on.

The implemented methods are the one needed by the API and are equivelent
to the ones defined in StorageServiceMBean

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-27 15:29:49 +03:00
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