Right now when we initiate the database, we exist with just an exception if the
data directory does not exist. That does not tell much to the user about what
is going on.
It would be nice to at the very least catch the exception and turn it into a
user friendly message. But we can obviously do much better and create the
directory.
If we fail, then we can capture and tell the user why.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Often a single file is used in multiple fibers, and so it is wrapped in a
lw_shared_ptr. Remove the need for this by making files internally reference
counted.
Often, when we create a directory, it is useful to make sure that the path
leading to it exists.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This patch series adds partial implementation of ByteOrderedPartitioner
and allows choosing it in configuration file.
While ByteOrderedPartitioner is generally not recommended it is used by
some tests in DTEST due to its order guarantees.
We don't really handle expiration of entrie rows yet, due to issue #17.
Fixing a bug in 'insert' made this test start to fail because the
expired row started to appear in the results. Until #17 is fixed,
let's use 'update' to create the row, so that the expectations are
met.
Fixes#18.
The problem was that the row entry was not getting created for tables
without clustering key. The empty prefix was mistakenly taken as a
belonging to a static row.
"Node interface is:
storage_proxy::query_mutations_locally()
Shard interface is:
database::query_mutations()
Query results are returned in a form of reconcilable_result object, which
contains a vector of frozen_mutation."
In Origin, partitions in range query results are ordered using
decorated_key ordering. This allows the use of token() function for
incremental iterating over results, as mentioned here:
http://www.datastax.com/dev/blog/client-side-improvements-in-cassandra-2-0
We may also need this to implement paging.
The old code didn't preserve ordering, because it didn't merge-sort
data coming from different shards. The fix relies on
query_mutations_locally(), which already preserves the ordering. We're
going to use mutation queries for range queries anyway.
Mutation query differs from data query in that returns information
needed to reconcile data slice with that retruned by other data
sources.
There is a generic mutation_query() algorithm introduced, which can
work with any mutation_source.
database::query_mutations() is a shard-local interface for mutation
queries.
The reconcilable_result is introduced as a medium for mutation query
results. It piggy backs on frozen_mutation as a medium for
reconcilable data.
Prepares the partition to be returned in a mutation query:
- throws out data which doesn't belong to row_ranges
- expires cells based on query_time
- drops cells covered by higher-level tombstones (compaction)
- leaves at most row_limit live rows
Until we have a fine-grained reader, it's best to perform these on an
existing object. Later we can do it on-the-fly. Based on Origin's
org.apache.cassandra.db.filter.SliceQueryFilter#collectReducedColumns
"Fix index name case sensitivity as per Origin commit 68be72f ("Fix
case-sensitivity of index name on CREATE/DROP INDEX") which addressed
CASSANDRA-8365.
Please note that the imported code is from "cassandra-2.2.0-rc2" tag
that points to the following commit:
ebc50d783505854f04f183297ad3009b9095b07e"
Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
This method was incomplete, and thus would fail if map size were
greater than max_bin_size, bringing the application down.
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
From Glauber:
"In order to make describe tables work, we need to wire up a lot of options that cqlsh will expect
to be present, and represent the status of the table.
The options that I am wiring up here are ones that are more or less "self-suficient", in the sense
that we don't need anything else outside the schema itself - that we don't have - to decide.
Even is_super(), for instance: while marking a table as super has consequences, code in Origin is
expect to explicitly set that value: we don't have to derive it. So we can, for now, just expose it
(the same way we do for is_dense), and worry about setting it later.
After this patchset, describing a particular table still does not work, *BUT*,
it does if write synthetic values for the compaction string/options. I am not
going to worry about it now, because Raphael is about to merge some patches
that introduce the classes I need anyway.
But with those patches here + the compaction data, then it all works"
All CFMetaData has a type, either Standard or Super. Right now, we do not
support Super, but we still would like to query for it, and use that information
to build our schemas.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Fix index name case sensitivity as per Origin commit 68be72f ("Fix
case-sensitivity of index name on CREATE/DROP INDEX") which addressed
CASSANDRA-8365.
The grammar rules were imported from the following Origin commit:
ebc50d783505854f04f183297ad3009b9095b07e
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
There are two versions of update_tokens: one for the tokens used by this node,
which goes to the local table, and another for the remote tokens, used by
remote nodes, which goes to the peers table.
The former was implemented, the latter was not. Implement it.
One node: Origin does not issue a flush here, at least in the version of the
code we imported. However, a flush is present in all other variants, and won't
hurt, aside from creating an extra, probably very small, sstable. So I'm
flushing.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
We ended up with two different implementations of force_blocking_flush,
none of them ideal.
This patch merges both in one that makes more sense, getting rid of the
duplication.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
From Pawel:
"These patches fix two issues with std::map to json. Firstly, an empty
map was serialized to 'null' instead of '{}'. Secondly, a newline was
needlessly added at the end of generated string."