When running with boost unit-tests, cpu threads can be destroyed, causing
static object destructors to fail when they try to free data which was
allocated on a cpu thread that no longer exists.
Leak the memory instead.
By using free functions that take the serializer as a parameter (rather than
'this'), we can add serialization functions without changing the serializer
class.
Switch rpc from using futurized serialization/deserialization to
in-memory, atomic serialization. This is much faster, especially to
compile, and results in no loss of functionality, as it was illegal
for serialization to defer (except due to the connection being blocked),
because that would result in further rpc requests being stalled.
rpc currently allows serializers and deserializers to defer, because
the input and output stream may not be ready. They may not, however,
defer on behalf of the object being serialized or deserialized (i.e.
you cannot serialize to disk or deserialize from disk) because that
causes the tcp connection to block until serialization/deserialization is
complete. So in practice messages must be small enough to fit in memory,
and there is nothing gained by the complexity.
To simplify things, switch to non-deferring serialization. Add a frame
header to messages that specifies the buffer size, which allows rpc to
use a read_exacly() to consume the message, and thereafter deserialize it
immediately.
The result is significantly simpler, which should help with compile time.
Singular range is a range of the form [x; x]. Internally such ranges
are optimized to avoid storing the value twice, so _end is empty.
Client shouldn't have to special case for it if it's not interested,
so make end() and split() work for singular ranges too.
"In the beginning, we needed to set fields in the schema, so we had set_
functions. Then the schema_builder came, and it acquired a lot of set_
functions.
Because its role is actually to build the schema, it is obvious that those
functions are much better placed if they are there. In this sense, having
them to stay in schema as well, is just duplication.
Some of the functions were already orphans in this sense. No callers left.
But some others had callers. This patchset fixes them so they build through
the builder. And once this is done, schema will now consistently have getters
only.
This will become more pressing once I introduce the compact storage changes -
which is the reason I am doing this now. For those, the process of computing
the right value is a bit complicated - definitely not just val = x, and we
definitely don't need the code living in two places. It would be much
better if the existing users - specially the system tables, would be already
fixed."
Make all callers go through the builder. Current callers - there are many
in the system tables code, are patched.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)
[1/6] CXX build/release/log.o
FAILED: g++ -MMD -MT build/release/log.o -MF build/release/log.o.d
-std=gnu++1y -g -Wall -Werror -fvisibility=hidden -pthread -I.
-U_FORTIFY_SOURCE -I/usr/include/jsoncpp/ -Wno-maybe-uninitialized
-DHAVE_XEN -DHAVE_HWLOC -DHAVE_NUMA -O2 -I build/release/gen -c -o
build/release/log.o log.cc
log.cc: In member function ‘void
logging::logger::really_do_log(logging::log_level, const char*,
logging::logger::stringer**, size_t)’:
log.cc:86:19: error: no match for ‘operator<<’ (operand types are
‘std::ostream {aka std::basic_ostream<char>}’ and ‘std::ostringstream
{aka std::basic_ostringstream<char>}’)
std::cout << out;
^
log.cc:86:19: note: candidate: operator<<(int, int) <built-in>
log.cc:86:19: note: no known conversion for argument 2 from
‘std::ostringstream {aka std::basic_ostringstream<char>}’ to ‘int’
In file included from /usr/include/c++/5.1.1/iostream:39:0,
from core/sstring.hh:31,
from log.hh:8,
from log.cc:5:
calculate_natural_endpoints needs to limit the list of returned
addresses by the replication_factor current impl will return all nodes
in cluster
for reference origins code:
while (endpoints.size() < replicas && iter.hasNext())
{
InetAddress ep = metadata.getEndpoint(iter.next());
if (!endpoints.contains(ep))
endpoints.add(ep);
}
}
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
This is meant to allow std::moving the returned object when needed.
Otherwise std::move(s.get_vector()) will be degraded to copying.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Tomek pointed out that we shouldn't be passing a reference to commitlog every
time we use the add_column_family interface, because that will at times pass a
reference to a null object.
Test that, and pass no_commitlog if there is none.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
The patch introduces reconciliation code. The same code suppose to be
working for both range and single key queries. Handling of raw_limit,
short reads and read repairs is still very much missing.
--
v1->v2:
- call live_row_count() only once.
According to the comments, we are doing this for simplicity, to avoid
creating a new type_parse object.
However, while this approach works well for the simple case where we expect
a single token, it won't work as the parser becomes more able to recognize
other cases.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Note that the multicell attribute can't be part of the parse instance, because
otherwise we would either freeze every subsequent element, or complicate the
flow considerably to handle it.
It is instead, passed as a parameter to get_instance_types(), which will then
have to be propagated to parse() and get_abstract_type()
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
We currently have a bug when parsing collection types that contains collections
themselves.
We call the recursion correctly, but get_abstract_type gets its value by copy, not
reference. Therefore, all work it does in the _idx manipulation is done in the copy,
and when the callee returns, the caller, with its _idx unchanged, will try recursing
again.
Fix it by passing by reference
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Collections can at times have the form <hex>:type. This is the case,
for instance, for the strings that compose the comparator string. The
actual hex number isn't terribly interesting: it is used as a key to
hash the collection types, but since we hash them by their types anyway,
we can safely ignore them.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Schema versioning from Pekka:
"This series adds support for schema versioning. It's a prerequisite for
schema pull functionality which needs to know if the schema has been
changed on other nodes.
Schema version is a content-based hash of the schema. When there's a
schema change on local node, "schema_version" UUID is updated using a
MD5 hash of system table contents:
Node 1:
[penberg@nero apache-cassandra-2.1.7]$ ./bin/cqlsh --no-color 127.0.0.1
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.2.0 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh> SELECT key, schema_version FROM system.local;
key | schema_version
-------+--------------------------------------
local | d41d8cd9-8f00-3204-a980-0998ecf8427e
(1 rows)
cqlsh> CREATE KEYSPACE keyspace3 WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
cqlsh> SELECT key, schema_version FROM system.local;
key | schema_version
-------+--------------------------------------
local | 02a099fa-9914-324b-b0c7-b62916584844
(1 rows)
Node 2:
[penberg@nero apache-cassandra-2.1.7]$ ./bin/cqlsh --no-color 127.0.0.2
Connected to Test Cluster at 127.0.0.2:9042.
[cqlsh 5.0.1 | Cassandra 2.2.0 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh> SELECT key, schema_version FROM system.local;
key | schema_version
-------+--------------------------------------
local | d41d8cd9-8f00-3204-a980-0998ecf8427e
(1 rows)
cqlsh> SELECT key, schema_version FROM system.local;
key | schema_version
-------+--------------------------------------
local | 02a099fa-9914-324b-b0c7-b62916584844
(1 rows)
"