Commit Graph

2720 Commits

Author SHA1 Message Date
Asias He
d7f053a494 gossip: Implement GossipDigestSynVerbHandler 2015-04-13 14:31:02 +08:00
Asias He
3809934a05 gossip: Add operator< for gossip_digest 2015-04-13 14:31:02 +08:00
Asias He
e21d38684d gossip: Add default constructor for gossip_digest 2015-04-13 14:31:02 +08:00
Asias He
005a88699f gossip: Remove const for gossip_digest 2015-04-13 14:31:02 +08:00
Asias He
c1325f8cbe gossip: Implement GossipDigestAckVerbHandler 2015-04-13 14:31:02 +08:00
Asias He
7ee239e7e7 gossip: Implement GossipDigestAck2VerbHandler 2015-04-13 14:31:02 +08:00
Asias He
1ad7af3bca gossip: Initial hook of gossip and messaging_service
Register the handler of gossip verbs using ms::register_handler.
Implement send_gossip using ms::send_message. The handlers are only
placeholders for now. Will implement them later.

A periodic timer (1 seconds) is added to send gossip message
periodically.
2015-04-13 14:31:02 +08:00
Asias He
5dc18de0f8 gossip: Move some of gms/gossiper.hh code to gms/gossiper.cc
This makes it possible to call get_local_failure_detector() in gossiper.
Otherwise there is a cyclic dependency between gms/gossiper.hh and
gms/failure_detector.hh
2015-04-13 14:30:52 +08:00
Avi Kivity
0bc505b5ad cql3: remove gunk from modification_statement 2015-04-12 11:18:58 +03:00
Avi Kivity
4d38dfc303 cql3: enable grammar for delete statement conditions 2015-04-12 11:12:22 +03:00
Avi Kivity
5f05fa7087 cql3: move function_call.hh code to .cc file 2015-04-11 17:31:54 +03:00
Raphael S. Carvalho
2ecc93523f sstables: add support to write the component TOC
The on-disk format is about name of the components, where each is
followed by a new line character. The text is encoded using ASCII
code.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-04-11 11:34:38 +03:00
Avi Kivity
a190f2db79 db: drop compile-time dependeny on sstables
Move #include "sstables.hh" to .cc file.  Need to explicitly define
destructor for this.
2015-04-11 11:27:48 +03:00
Raphael S. Carvalho
c6e31346d8 sstables: add support to write the component Summary
The definition of summary_la at types.hh provides a good explanation
on the on-disk format of the Summary file.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-04-11 11:24:53 +03:00
Glauber Costa
a505ac487f sstables: use bytes instead of sstring
We should have done that from the start

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-11 11:22:30 +03:00
Avi Kivity
44eaca2204 Merge branch 'primitives' into urchin
Enable float and double.
2015-04-11 11:08:42 +03:00
Avi Kivity
339bf29753 cql3: enable float and double types in grammar 2015-04-11 00:54:44 +03:00
Avi Kivity
77552d3407 db: fix float_type's implementation
Was double, should be float.
2015-04-11 00:54:10 +03:00
Avi Kivity
40a0dd1f6f Merge branch 'master' of github.com:cloudius-systems/urchin into db 2015-04-09 12:40:33 +03:00
Avi Kivity
5bfd66770b Merge branch 'asias/message_v3_rebase' of github.com:cloudius-systems/seastar-dev into db
Cluster messaging service, from Asias.
2015-04-09 12:08:34 +03:00
Avi Kivity
b264aea0a3 Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-04-09 12:08:24 +03:00
Glauber Costa
aa1f33df22 output_stream: generalize basic_sstring writes further
The current code assumes that the sstring will have the same char_type as the
output_stream.  That was working well, until I was forced to change the type of
my basic_sstring to another one that is backed by signed chars.

Of course, the best solution for this would be to change the output_stream (as
well as the input_stream), to take a signed char as well.

And oh boy, have I tried. The data_sink assumes a char type, and when it tries
to allocate a new buffer from it, the buffer will have no other choice than to
be of a char type. Fix that one, and another one appears.

I eventually gave up when the code wouldn't compile because struct fragment has
a char type - and both using a template for such a simple struct, as well as
sprinkling casts all over the place where it is used, sounded like horrible
ideas to me.

It's true that quitters never win, and winners never quit. But for now, my
proposal would be to generalize the write code to accept basic_sstrings of
general types. At least the cast lives in a single place.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
2015-04-09 12:03:40 +03:00
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