Commit Graph

2705 Commits

Author SHA1 Message Date
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
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