Commit Graph

53948 Commits

Author SHA1 Message Date
Avi Kivity
ff9536fffc cql3: de-virtualize query_options
query_options is needlessy organized as a class hierarchy, even though it's
really a simple value type.

Fix by folding all the derived classes into it.
2015-04-09 09:31:48 +02:00
Avi Kivity
538c7fdf2a cql3: fix query_options::DEFAULT not smp safe
Contains a shared_ptr (inside specific_options), so cannot be global.  Make
it thread_local instead.
2015-04-09 09:31:11 +02:00
Asias He
2f56a360e7 message: Introduce messaging_service
It is built on top of seastar rpc infrastructure. I've sorted out all
the message VERBs which Origin use. All of them can be implemented using
this messaging_service.

Each Verb contains a handler. There are two types of handlers, one
will return a message back to sender, the other will not. The former
can be registered using ms.register_handler(), the latter can be
registered using ms.register_handler_oneway().

Usage example:
To use messaging_service to send a message. All you need is:

messaging_service& ms = get_local_messaging_service();

1) To register a message hander:
   ms.register_handler(messaging_verb::ECHO, [] (int x, long y) {
       print("Server got echo msg = (%d, %ld) \n", x, y);
       std::tuple<int, long> ret(x*x, y*y);
       return make_ready_future<decltype(ret)>(std::move(ret));
   });

   ms.register_handler_oneway(messaging_verb::GOSSIP_SHUTDOWN, [] (empty_msg msg) {
       print("Server got shutdown msg = %s\n", msg);
       return messaging_service::no_wait();
   });

2) To send a message:
    using RetMsg = std::tuple<int, long>;
    return ms.send_message<RetMsg>(messaging_verb::ECHO, id, msg1, msg2).then([] (RetMsg msg) {
        print("Client sent echo got reply = (%d , %ld)\n", std::get<0>(msg), std::get<1>(msg));
        return sleep(100ms).then([]{
            return make_ready_future<>();
        });
    });

    return ms.send_message_oneway<void>(messaging_verb::GOSSIP_SHUTDOWN, std::move(id), std::move(msg)).then([] () {
        print("Client sent gossip_shutdown got reply = void\n");
        return make_ready_future<>();
    });

Tests:
   send to cpu 0
   $ ./message --server 127.0.0.1  --cpuid 0  --smp 2
   send to cpu 1
   $ ./message --server 127.0.0.1  --cpuid 1  --smp 2
2015-04-09 10:54:17 +08:00
Asias He
1174e33c88 gossip: Add operator<< for gossip_digest_ack2 2015-04-09 10:54:17 +08:00
Asias He
76d00378d7 gossip: Add operator<< for gossip_digest_ack 2015-04-09 10:54:17 +08:00
Asias He
039d258565 gossip: Add operator<< for gossip_digest_syn 2015-04-09 10:54:17 +08:00
Asias He
fc1e4a2a3f gossip: Add default constructor for gossip_digest_syn 2015-04-09 10:54:17 +08:00
Asias He
a5fc0ce654 gossip: Remove const for gossip_digest_syn 2015-04-09 10:54:17 +08:00
Asias He
658b298bcb gossip: Add default constructor for gossip_digest_ack2 2015-04-09 10:54:17 +08:00
Asias He
b23a6a61cf gossip: Add default constructor for gossip_digest_ack 2015-04-09 10:54:17 +08:00
Asias He
54e5c71fdd gossip: Remove const for gossip_digest_ack 2015-04-09 10:54:17 +08:00
Asias He
745c09ee57 net: Add raw_addr helper for inet_address 2015-04-09 10:54:17 +08:00
Avi Kivity
d81320a2dd Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-04-08 22:26:25 +03:00
Glauber Costa
1760a8c5ad output_stream: generalize string writing
All basic_sstring writes the same way. Using sstring as the signature would
require other users that are using other variants of basic_sstring to add their
own signatures.

This general version will cover those use cases as well.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-08 19:36:59 +03:00
Nadav Har'El
2c78fcdc4e clean up byteorder.hh
byteorder.hh's "net::packed<T>" subclassed the basic unaligned<T> and
added a "adjust_endianess" method. This was completely unnecessary:
While ntoh's generic implementation indeed uses that method, we also
have a specialized overload for ntoh(packed<T>), so the generic
implementation would never be used for packed<T> anyway!

So for net::packed<T> we don't need anything more than unaligned<T>,
and can just make it an alias.

As a bonus, the "hton" function will now work also on unaligned<T>
(such as the result of the convenient unaligned_cast<>), not just on
net::packed<T>.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-04-08 18:41:48 +03:00
Asias He
9dff2bfa40 rpc: Fix indentation
Signed-off-by: Asias He <asias@cloudius-systems.com>
2015-04-08 17:10:53 +03:00
Asias He
60ece9f40d rpc: Do not initialize MsgType _type
Fix compiling issue when using rpc with MsgType other than int.

Signed-off-by: Asias He <asias@cloudius-systems.com>
2015-04-08 17:10:52 +03:00
Asias He
7c1bcc3ded core: Add args_as_tuple type for function_traits
Signed-off-by: Asias He <asias@cloudius-systems.com>
2015-04-08 17:10:51 +03:00
Avi Kivity
f0e10b34d4 tests: clean up test_writetime_and_ttl
- correct comment
- use with_rows()
- use USING WRITETIME syntax instead of hacking up the query_options
2015-04-08 13:28:44 +02:00
Takuya ASADA
04e0c5293b dpdk: enable -mavx/-mavx2 if available
To support HEAD version of DPDK, we need -mavx/-mavx2 on Seastar CFLAGS.
But we cannot enable it until Host CPU has the feature, so we need to check it.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-04-08 12:46:14 +03:00
Avi Kivity
a40d71044f Merge branch 'master' of github.com:cloudius-systems/urchin into db 2015-04-08 12:39:12 +03:00
Calle Wilund
bfa9b860a8 db: make database lookup functions explicitly non-modifying
To be more precise, do not take schema_ptr by value.
Fixes crashes in running smp > 1 where mutations applied across shards
(i.e. foreign memory) would cause schema_ptr:s to get out of sync (using
other shards ptr)
2015-04-08 12:25:05 +03:00
Tomasz Grabiec
5bd22924e6 Revert "tests: add WRITETIME test"
This reverts commit e311beebea.

It breaks the build.
2015-04-08 10:37:58 +02:00
Avi Kivity
e311beebea tests: add WRITETIME test 2015-04-08 10:36:03 +02:00
Amnon Heiman
88e67cb379 http: fix a wrongly used string_view in transformers.cc 2015-04-08 11:21:03 +03:00
Avi Kivity
dad3a3dd38 tests: test cql3 type cast
(text)'foo' is itself.  Wow!
2015-04-08 09:34:45 +02:00
Avi Kivity
c0be021c17 cql3: enable type cast grammar 2015-04-08 09:34:45 +02:00
Avi Kivity
cfac0c5105 cql3: convert type_cast to C++ 2015-04-08 09:34:45 +02:00
Takuya ASADA
db113d04f7 dpdk: ignore RTE_MBUF_REFCNT on v2.0.0 or later
Latest DPDK(which will be v2.1.0) causes compile error when referencing RTE_MBUF_REFCNT because it defained as "#pragma GCC poison RTE_MBUF_REFCNT".
And that configuration entry is not available v2.0.0 or later.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-04-08 09:02:17 +03:00
Avi Kivity
0c971d0959 sstring: fix std::string conversion for char_type != char 2015-04-08 08:55:45 +03:00
Raphael S. Carvalho
3c908f1ed0 core: Add do_for_each variant
This variant is intended to simplify do_for_each idiom where the
iterators begin() and end() will be implicit.

Allowing the user to do something as follow:
	return do_for_each(map, [] { ... });

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-04-07 23:10:34 +03:00
Avi Kivity
4874ac5c98 Merge tag 'avi/cql-collection-types/v1' of github.com:cloudius-systems/seastar-dev into db
cql3 collection types:
  map<foo, bar>
  set<baz>
  list<yo>

Reviewed-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-04-07 21:10:16 +03:00
Avi Kivity
48896caf8a Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-04-07 21:08:20 +03:00
Avi Kivity
558af3d9a5 shared_ptr: add nullptr_t overloads 2015-04-07 21:04:57 +03:00
Avi Kivity
e66fb58423 tests: test cql3 collection type syntax in "create table" 2015-04-07 20:14:37 +03:00
Avi Kivity
a29bba40bb cql3: enable grammar for collection types 2015-04-07 20:14:20 +03:00
Avi Kivity
83be5eb711 cql3: convert collection cql3_type to C++
Due to some vagarities of protected access, some members were made public.
2015-04-07 20:13:11 +03:00
Avi Kivity
13b59a1cfc Merge tag 'avi/writetime/v1' of github.com:cloudius-systems/seastar-dev into db 2015-04-07 17:57:26 +03:00
Avi Kivity
df8e8518ab Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-04-07 17:46:41 +03:00
Avi Kivity
14d668c07a tests: add WRITETIME test 2015-04-07 16:17:56 +03:00
Avi Kivity
cdab0a5a10 tests: execute_cql() with non-default query options
Needed to test WRITETIME.
2015-04-07 16:17:56 +03:00
Avi Kivity
75a53e165b cql3: enable WRITETIME and TTL functions
SELECT WRITETIME(col), TTL(col) FROM tab
2015-04-07 16:17:56 +03:00
Avi Kivity
33038a625f cql3: convert selectable::writetime_or_ttl to C++
Moved to new file to avoid cyclic dependencies.
2015-04-07 16:17:56 +03:00
Avi Kivity
1f15b4a73e cql3: convert writetime_or_ttl_selector to C++ 2015-04-07 16:17:56 +03:00
Avi Kivity
ae5c847326 cql3: add timestamp and ttl accessors to result_set 2015-04-07 16:17:56 +03:00
Avi Kivity
23e23c0a67 Merge tag 'avi/count-rows-functions/v1' of github.com:cloudius-systems/seastar-dev into db
cql3 COUNT(*) and COUNT(1) conversion
2015-04-07 10:57:16 +03:00
Avi Kivity
30b40bf7b1 db: make bytes even more distinct from sstring
bytes and sstring are distinct types, since their internal buffers are of
different length, but bytes_view is an alias of sstring_view, which makes
it possible of objects of different types to leak across the abstraction
boundary.

Fix this by making bytes a basic_sstring<int8_t, ...> instead of using char.
int8_t is a 'signed char', which is a distinct type from char, so now
bytes_view is a distinct type from sstring_view.

uint8_t would have been an even better choice, but that diverges from Origin
and would have required an audit.
2015-04-07 10:56:19 +03:00
Nadav Har'El
de58d08e59 sstable: fix compressed data file stream bug
We need to update _pos after we read, or we keep reading the same
chunk over and over :-( Also, don't read anything if we're already past
the end of file.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-04-07 10:47:29 +03:00
Avi Kivity
50b8ddd62a tests: add test for COUNT(*) and COUNT(1) 2015-04-06 19:09:35 +03:00
Avi Kivity
6933eeea1f cql3: enable grammar for COUNT(*) and COUNT(1) 2015-04-06 19:09:15 +03:00