Commit Graph

43077 Commits

Author SHA1 Message Date
Avi Kivity
b6d76ed650 shared_ptr: add polymorphic-capable shared pointer
At the cost of doubling the pointer size, this shared_ptr is polymorphic
and can be upcast to a base class.
2015-01-04 23:15:58 +02:00
Avi Kivity
87f63f7b90 shared_ptr: rename to lw_shared_ptr (for light-weight)
The current shared_ptr implementation is efficient, but does not support
polymorphic types.

Rename it in order to make room for a polymorphic shared_ptr.
2015-01-04 22:38:49 +02:00
Shlomi Livne
b7a83903b5 tests: terminate memcached instance with SIGTERM
Terminate a running memcached instance with a SIGTERM instead of a
SIGKILL to allow the process to close in a cleaner manner

Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-01-04 17:17:40 +02:00
Shlomi Livne
3362851e55 reactor: add a SIGTERM handler
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-01-04 17:17:33 +02:00
Gleb Natapov
d72de7e959 net: signal space availability in tcp buffer only after
Currently space availability is signaled when packet is taken from
unsend queue, but packet can still be alive for a long time at his
point.
2015-01-04 16:37:17 +02:00
Asias He
4e13844f4b io: Import io/IVersionedSerializer.java 2015-01-04 18:36:51 +08:00
Avi Kivity
cef37f1546 tcp: fix unfulfilled read promise on RST
A user may be waiting for data, but we never we never notify them if we
receive an RST.  As a result the tcb, connection, and any user data structures
will hang around in memory.

Fix by notifying the user if they are waiting, and marking the connection as
nuked so they don't try to read again.

Reviewed-by: Asias He <asias@cloudius-systems.com>
2015-01-04 12:20:31 +02:00
Asias He
3fbb10b9ea db: Add stub db.cc file 2015-01-04 10:46:25 +02:00
Asias He
bfc17d2841 db: Convert db/composites/CellName.java to C++ 2015-01-04 10:46:25 +02:00
Asias He
72f5e22316 db: Convert db/composites/CBuilder.java to C++ 2015-01-04 10:46:24 +02:00
Asias He
5239ace214 db: Convert db/composites/Composite.java to C++ 2015-01-04 10:46:24 +02:00
Asias He
99d06f3698 db: Import db/composites/* 2015-01-04 10:46:23 +02:00
Pekka Enberg
36359850e6 cql3: Switch to our own shared_ptr implementation
Suggested by Avi.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-04 10:45:19 +02:00
Pekka Enberg
3368d44af7 cql3: Use optional for cf_name
Suggested by Avi.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-04 10:45:18 +02:00
Pekka Enberg
9292815bd9 cql3: convert Term to C++
This is not 1:1 conversion because some Term inner classes derive from
Term itself which is not allowed in C++. I therefore moved some of the
inner class definitions outside of Term.

Another painpoint is Terminal.bind() method which returns 'this'. I
changed the API to require callers to pass shared_ptr<terminal> which is
returned in place of 'this'. I went for shared_ptr because I wasn't able
to convince myself that the lifetime rules allow unique_ptr...

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-04 10:42:52 +02:00
Avi Kivity
98ac429983 Merge branch 'cql3/statement' of github.com:cloudius-systems/seastar-dev into db 2015-01-01 15:39:33 +02:00
Avi Kivity
33518ea9d0 shared_ptr: fix uninitialized enable_shared_from_this ref count
Caused immediate leak.
2015-01-01 14:29:27 +02:00
Pekka Enberg
537cc42397 cql3: convert SchemaAlteringStatement to C++
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-01 10:35:26 +02:00
Pekka Enberg
479c370212 cql3: use unique_ptr for cf_name to allow nullptr
There are cf_statement derived classes that pass 'null' as 'cf_name'.
Switch to unique_ptr to allow that.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-01 10:35:26 +02:00
Pekka Enberg
046d827be6 cql3: Fix use_statement class override annotations
Add a missing override annotation to the use_statement class.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-01 10:35:26 +02:00
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
Avi Kivity
05a02b93a0 Merge branch 'tcp'
Tcp protects tcbs using a shared_ptr, but in some cases captures an
unprotected [this] in lambdas, which can outlive the shared_ptr.

Introduce and use enable_shared_from_this to fix.

Reviewed-by: Asias He <asias@cloudius-systems.com>
2014-12-31 12:17:21 +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