Commit Graph

1153 Commits

Author SHA1 Message Date
Pekka Enberg
5e4fc9b88c cql3: convert TruncateStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-01 10:35:26 +02:00
Avi Kivity
852f63f918 Merge branch 'cql' into db
Convert AggregateFcts, adding some infrastructure along the way.
2014-12-31 18:04:14 +02:00
Pekka Enberg
18d92f6cd6 cql3: convert AssignmentTestable to C++
The conversion is not 1:1 because 'enum class' in C++ does not support
methods. As the methods are rather simple, I moved them out of the class
as standalone functions.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-31 18:04:08 +02:00
Avi Kivity
7cab37ddad cql: convert AggregateFcts to C++
Use templates to reduce code duplication for each data type.
2014-12-31 16:09:21 +02:00
Avi Kivity
3900173c75 db: add data_type_for<> helper
Converts C++ data type to corresponding data_type class, during compile time.
2014-12-31 16:07:50 +02:00
Avi Kivity
d19043fca2 db: add data_type::decompose
Convert any -> bytes.
2014-12-31 16:07:17 +02:00
Avi Kivity
719a7f87f3 cql: add helpers for constructing native aggregate functions 2014-12-31 16:06:28 +02:00
Avi Kivity
f303499d01 cql: fix native_aggregate_function base classes
Must be public.
2014-12-31 16:05:50 +02:00
Avi Kivity
adc78b8959 cql: fix function/abstract_function inheritence
Make a few functions virtual and fix the types.
2014-12-31 16:04:22 +02:00
Avi Kivity
35608909b0 cql: use optional<bytes> for function arguments and return types
Allow null values.
2014-12-31 16:03:43 +02:00
Nadav Har'El
774579d8b4 Move murmur_hash to the right directory
In the original Java code, MurmurHash was in the "utils" package, not
"util", so move it to a new "utils" directory (and namespace), not
"util".

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-12-30 17:43:30 +02:00
Avi Kivity
cf2152555a Merge branch 'master' into db
Fixes from seastar.
2014-12-30 17:04:23 +02:00
Nadav Har'El
5b071fd224 sstring: support to_sstring() for floating-point
std::to_string() can also convert a floating-point argument to string,
using the "%f" printf format (see
	http://en.cppreference.com/w/cpp/string/basic_string/to_string )
So add this support to our to_sstring() as well.

Note that if you want to use a different format, e.g., "%g", you can,
by using the to_sstring_sprintf function, for example

	to_sstring_sprintf(12345678.9, "%g")

results in "1.23457e+07".

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-12-30 17:00:46 +02:00
Tomasz Grabiec
c2fe4c3e29 memcached/tests.py: wait for memcached process before proceeding
To ensure that the old process is no longer running when the new one
is started.
2014-12-30 17:00:44 +02:00
Pekka Enberg
c5d8506086 cql3: use unique_ptr for parsed_statement::prepare()
We cannot keep a C++ reference to the statement object because we then
lose ownership information. Start using unique_ptr as suggested by Avi
instead.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 16:27:47 +02:00
Avi Kivity
ddeb9aee13 Merge branch 'cql3/statement' of github.com:cloudius-systems/seastar-dev into db
From Pekka:

"Here's a v2 of a patch series that converts some CQL3 AST statement base
classes to C++."
2014-12-30 15:53:59 +02:00
Pekka Enberg
de4f0f8455 cql3: convert CFStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:59 +02:00
Pekka Enberg
229b44968a cql3: convert CFName to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:59 +02:00
Pekka Enberg
cff499989d cql3: convert UseStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:58 +02:00
Pekka Enberg
a17c3f8993 cql3: convert ParsedStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:58 +02:00
Pekka Enberg
7edbcb1ae9 cql3: convert ColumnSpecification to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:58 +02:00
Pekka Enberg
bb46ca9003 cql3: convert ColumnIdentifier to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:58 +02:00
Pekka Enberg
5025ebfb61 cql3: convert VariableSpecifications to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 15:53:58 +02:00
Avi Kivity
833d5c2262 thrift: fix get_slice column index calculations
Both lower and upper bound calculations were broken.

Fix by using iterators instead of calculating indices using std::distance().
2014-12-30 15:34:27 +02:00
Gleb Natapov
6ad9114c0b reactor: add at_destroy() function to the reactor and use it
Unfortunately at_exit() cannot be used to delete objects since when
it runs the reactor is still active and deleted object may still been used.
We need another API that runs its task after reactor is already stopped.
at_destroy() will be such api.
2014-12-30 15:21:10 +02:00
Gleb Natapov
2fb7490bf9 stream: reset subscription's stream pointer in stream's destructor 2014-12-30 15:21:08 +02:00
Pekka Enberg
bf3112f331 cql3: convert CQLStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-30 10:03:44 +02:00
Avi Kivity
a99c732577 Merge branch 'cql' into db
More cql3 conversions.
2014-12-30 09:03:57 +02:00
Avi Kivity
f9c7eb3e9b cql3: convert NativeScalarFunction to C++ 2014-12-30 09:00:22 +02:00
Avi Kivity
66138dc189 cql3: convert NativeAggregateFunction to C++
Requires virtual inheritence from functions::function due to an
inheritence diamond.
2014-12-30 09:00:22 +02:00
Avi Kivity
9a2c40c931 cql3: convert AggregateFunction to C++ 2014-12-30 09:00:22 +02:00
Avi Kivity
a4f64e980c cql3: convert NativeFunction to C++ 2014-12-30 09:00:22 +02:00
Avi Kivity
8be65f234d Merge branch 'log' into db
Basic sl4j compatible logger.
2014-12-29 19:02:54 +02:00
Nadav Har'El
6710a97537 Convert util/MurmurHash.java to C++
Port the Murmur hash functions from Java to C++. This is ironic,
because these functions actually originated in C code, which the
Cassandra guys converted to Java :-)

The Murmur hash is used in Cassandra for several things, including the
bloom filter (which is part of each sstable), and the default
data partitioner (Murmur3Partitioner).

I tested on some example string that all three methods (hash32, hash2_64
and hash3_x64_128) produce exactly the same output in the new C++ code as
they do in the original Java functions. This is important, because we want
the C++ node to be able to run alongside Java nodes, so they have to agree
on the same hash function.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
[avi: update configure.py]
2014-12-29 19:01:12 +02:00
Avi Kivity
eee158ed22 Merge branch 'master' of github.com:cloudius-systems/seastar into db
Merge seastar framework fixes.
2014-12-29 17:49:04 +02:00
Nadav Har'El
7a84dff0b2 sstring: constructor from C string
The constructor from "const char_type *" wouldn't really work when
char_type != char, because strlen() won't work on such pointers.

It is more convenient to have a constructor from an ordinary const char *
(e.g., a C string literal), and solve the type problem with an ugly cast.

This only makes sense when sizeof(char_type)==1 (i.e., it is char, unsigned
char, or signed char), but I think we make this assumption in other places
as well (e.g., in determining the size we need to allocate).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-12-29 17:29:32 +02:00
Nadav Har'El
f7fbf8ba02 sstring: add operator[]
std::string has an operator[] to get access (read or modify) to one
character in the string. This patch adds the same operator for our
sstring.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-12-29 17:29:10 +02:00
Nadav Har'El
9be5590fcd sstring: fix character type
The basic_sstring<> template allows picking char_type - which instead of
being just "char" could be chosen to be something similar, like "unsigned char"
or "signed char".

Unfortunately some hard-coded uses of "char" were left in the code. This
did not cause any problems for existing code because of implicit conversions,
but it does cause problems once I try to implement operator[] when char_type
is not char. This results in an attempt to return a reference to the result
of a conversion, which is not allowed.

So this patch fixes the leftover uses of "char" to "char_type".

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-12-29 17:29:06 +02:00
Avi Kivity
0362800e8d log: add slf4j-compatible logger class
Supports variadic logging with placeholders, e.g.

  logger.error("what happened? x = {}, y = {}", x, y);

Instantiate loggers as static thread_local, e.g.

  class foo {
      static thread_local logging::logger logger;
  };

  thread_local logging::logger foo::logger{logging::logger_for<foo>};
2014-12-29 17:09:41 +02:00
Avi Kivity
d4217da768 Merge branch 'thrift' into db
Add partial support for get_slice().  With this, the cassandra-stress read
test can complete in thrift mode (yielding 78krps on my desktop).

Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-12-29 15:00:05 +02:00
Avi Kivity
fa3ae18dcf cql: make function_name more similar to origin
- make members const
- drop overeager assert
2014-12-29 14:27:10 +02:00
Gleb Natapov
f0cdc47a3a net: do not sleep while waiting for link in dpdk
Use promise and seastar timers instead.
2014-12-29 13:06:10 +02:00
Gleb Natapov
a445b8174e net: wait for link to be ready before creating network stack 2014-12-29 13:06:10 +02:00
Gleb Natapov
efd6c33af0 reactor: remove no longer needed thread_pool function 2014-12-28 18:19:20 +02:00
Gleb Natapov
3eefc1ada2 reactor: replace thread_pool poller with signal notification
Drops one poller since now signal poller is used to process thread_pool
completions.
2014-12-28 18:19:18 +02:00
Avi Kivity
27955d47f6 Merge branch 'gleb/nopoll' of github.com:cloudius-systems/seastar-dev
Remove pre-poll-mode code, from Gleb:

"This series moves most of eventfd users to use other form of notification
which can be polled without entering the kernel and moving epoll in its own
poller which is enabled only if there is an fd that needs to be polled."

[avi: add -lrt to linker command line]
2014-12-28 15:34:36 +02:00
Gleb Natapov
367bbd75f3 reactor: move epoll to its own poller
Enable it only if there is fd to poll.
2014-12-28 14:54:43 +02:00
Gleb Natapov
889cc69a28 reactor: remove non polling mode 2014-12-28 14:54:43 +02:00
Gleb Natapov
7d3fb282c5 reactor: poll thread pool for completion instead of using eventfd 2014-12-28 14:54:43 +02:00
Gleb Natapov
d329a0a614 net: remove non polling mode from virtio-net 2014-12-28 14:54:43 +02:00