Commit Graph

3473 Commits

Author SHA1 Message Date
Asias He
4dfd445466 locator: Return optional for token_metadata::get_endpoint 2015-05-27 13:06:33 +08: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
Glauber Costa
f04f7f2819 sstables: turn composite into a class
Encapsulating it into a composite class is a more natural way to handle this,
and will allow for extending that class later.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-25 20:58:50 -04:00
Glauber Costa
0519dec0d7 sstable tests: remove filter file
It is not being remove, and is thus left as garbage in the sstable directory.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-25 20:47:16 -04:00
Glauber Costa
8b2f5979c9 sstable tests: replace last then statement with finally
Currently, a failed test is leaving files behind.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-25 20:47:16 -04:00
Avi Kivity
d115f9cef6 future: modernize lambda_task, make_task
Use inline, override, final, make_unique.
2015-05-25 22:21:49 +03:00
Avi Kivity
d1bc08e9e7 future: merge two variants of make_task()
Using universal references we can unify the two cases.
2015-05-25 22:18:24 +03:00
Avi Kivity
8812504e4b future: sprinke always_inline attributes in strategic places
gcc makes poor inlining decisions sometimes, which cause all the value-
tracking optimizations to be lost.  Forcing it to inline (particularly
around destructors) allows ready futures to be inlined with fewer always-
true tests and data movements.
2015-05-25 21:27:40 +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
Pekka Enberg
f092f33848 cql_test_env: Create keyspace for all test cases
Make sure keyspace exists for all test cases, not just ones that call
the create_table() helper.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-25 19:31:51 +03:00
Amnon Heiman
f61dcfddc2 Adding the gossiper API implementation
This implement the gossipier API. All actions perform on the local
gossiper.

The following functionality is supported:
/gossiper/downtime/{addr}
/gossiper/generation_number/{addr}
/gossiper/assassinate/{addr}

The following are extened API beyond the MBean definition:
/gossiper/endpoint/down
/gossiper/endpoint/live

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-25 18:28:47 +03:00
Amnon Heiman
313074c980 API: Add the gossiper API
This holds the swagger definition equivelent to the GossiperMBean API.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-25 18:28:47 +03:00
Amnon Heiman
588fb4fdcd Gossiper: Add global function
The current gossiper implementation runs the gossiper on CPU 0, this is
irelevent to user of the gossiper, that may want to inquire it.

This adds a globally available API for get_unreachable_members,
get_live_members, get_endpoint_downtime, get_current_generation_number,
unsafe_assassinate_endpoint and assassinate_endpoint that returns a
future and perform on the correct CPU.

The target user is the API that would use this function to expose the
gossiper.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-25 18:28:38 +03:00
Amnon Heiman
6d6872063d http: simplify using the parameters in the request
The parameters in the request holds the path parameters. The current
implementation based on unorder_map has a few downside:

1. Because path parameters are sometime used to mark a file path and
they can extend to multiple url section (may contain /) the value will
always contain the leading slash. Though this is true for files, for
the common case, it would be easier to return the value without it.

2. The []operator of the hash map is non const, this mean that it cannot
be used in the common case where the request object is passed as a const
reference.

3. There is no exists method in an ordered_map - Usually query
parameters are mandatory, still it is usefull to have an easy way of
testing if a parameter is found.

This series wrap the unordered_map implementation in a manner more
suitable for the request.

The [] operator will be const and retrun a copy of the parameter value
without the leading slash.

The at method will keep the old meaning. For clearer code, a path method
was added to indicate that the return value has a leading slash.

A set method is used for assignment.

Older code will continue to work without changes.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-05-25 15:47:56 +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
Glauber Costa
ab5ccf1a87 sstables: write filter component
Before sealing an sstable, here's what we have to do, filter-wise:
1) determine wether or not we should have a filter file. We won't write
   one, if our fp_chance is 1.0,
2) add each index key to the filter,
3) and write the actual filter.

This patch implements those steps.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-25 12:49:17 +03:00
Asias He
88e7dcfa86 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.

However, We can not change from
   static constexpr const char* TIME_FORMAT = "%a %b %d %I:%M:%S %Z %Y";
to
   static constexpr char* TIME_FORMAT = "%a %b %d %I:%M:%S %Z %Y";

The compiler complains:

   In file included from json/formatter.cc:22:0:
   json/formatter.hh:132:42: error: deprecated conversion from string
   constant to ‘char*’ [-Werror=write-strings]
        static constexpr char* TIME_FORMAT = "%a %b %d %I:%M:%S %Z %Y";

Since, unlike const, constexpr does not modify a type. It just applies
to an object (or function), and incidentally implies const to the
top-level type.
2015-05-25 11:57:19 +03:00
Avi Kivity
5b259ff9e3 Merge "sstable range reads"
Sstable range reads, from Glauber.
2015-05-25 10:53:00 +03:00
Avi Kivity
b5beef0529 Merge seastar upstream 2015-05-25 10:53:00 +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
0bd48b37ed future: consolidate task_with_state, task_with_ready_state
The internal structs task_with_state and task_with_ready_state are
identical except for their constructors.  Merge them into a new
struct continuation.
2015-05-23 11:40:39 +03:00
Raphael S. Carvalho
28e14a08d8 sstables: add FIXME comment
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-22 09:30:08 +02:00
Raphael S. Carvalho
617484c8f1 sstables: use u-ref to avoid copy of partitions
Suggested-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-05-22 09:29:20 +02:00
Glauber Costa
fc735de91c tests: test range reader
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-21 16:31:07 -04:00
Glauber Costa
62327ff25d sstables: allow to convert a full range
While trying to write code to populate the system table's data, I found out
that currently, there is no publicly exported way for an entity outside the
sstable to find out which are the keys available in the index.

Without the full list of keys, it is very hard to make the kind of
"read-everything" queries we will need for that to work.

Although I haven't checked the internals fully, Origin seems to do that through
token-based range searches, where you can specify start and end tokens and
return everything in the middle (this is how the WHERE clauses are
implemented).

I am proposing in this patchset a subscription interface that will allow us
to extract data from the sstables in this fashion.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-21 16:27:35 -04:00
Glauber Costa
6a8049dce1 dht: add maximum_token
Analogous to minimum_token.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-21 16:27:35 -04:00
Glauber Costa
d4ed0d4c85 sstables: add a maximum and minimum key
They will compare as greater and lesser than any other given key, respectively.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-05-21 16:27:35 -04:00