When engine.exit() is used, e.g., on trapping SIGINT, the engine
exits before doing db.stop(), causing an assertion failure.
This patch adds an at_exit([&db] { return db.stop(); }). This means
that before the engine exits, it runs db.stop() and waits for the
future that it returns to be completed. This is exactly what we need.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
s/database/distributed<database>/ everywhere.
Use simple distribution rules: writes are broadcast, reads are local.
This causes tremendous data duplication, but will change soon.
cql/, where the binary protocol code resides, is too similar to cql3/, where
the grammar lives. Rename it to transport/ to reduce confusion. While the
name isn't perfect, it matches origin.
If data directory does not exist, Urchin starts up without printing
anything and hangs. Make sure the error is shown to user by terminating
the application.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
This patch implement initial support for CQL binary protocol versions 1,
2, 3, and 4. The CQL server is able to handshake with cqlsh and
cassandra-stress from Cassandra 2.1 which uses the STARTUP and OPTIONS
messages. Queries or other functionality is not supported.
To try it out, start Urchin:
$ build/release/seastar --smp 1 --datadir data
CQL server listening on port 9042 ...
Thrift server listening on port 9160 ...
Then try to login with cqlsh:
$ ./bin/cqlsh 127.0.0.1
Urchin side will fail with:
CQL_VERSION => 3.2.0
warning: ignoring event registration
warning: ignoring query SELECT peer, data_center, rack, tokens, rpc_address, schema_version FROM system.peers
seastar: cql/server.cc:222: future<> cql_server::connection::process_query(uint16_t, temporary_buffer<char>&): Assertion `0' failed.
Aborted (core dumped)
TODO:
- Compression is not supported.
- Authentication is not supported.
- Supported options are defined to make cqlsh and cassandra-stress
happy. We really need to decide which CQL versions and compression
algorithms we want to support.
- std::string is used everywhere because sstring does not work with
std::map, std::multimap, and others.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
This patch includes a helper function that executes a function for each entry
in a directory. It is future based and can include in the future, future-based
code to asychronously read, for instance, an sstable.
At the moment, it only scan all keyspaces and make sure they appear in the
keyspaces hash.
Both the database and keyspace classes gain a populate<T> factory that returns a
populated database. At this point, the names found are just listed, but not really
stored anywhere.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This is the directory from which we will read the sstables.
Code to actually parse them will come later.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>