Commit Graph

170 Commits

Author SHA1 Message Date
Asias He
e82bdf2995 streaming: Swith to use shared_ptr from std::shared_ptr
Since our shared_ptr works with incomplete types now, switch to it.
2015-07-14 20:41:14 +08:00
Asias He
8fd8f39d63 streaming: Add more debug info for message exchange 2015-07-14 20:41:14 +08:00
Asias He
ca7f5ca5c9 streaming: Set proper dst_cpu_id in shard_id for PREPARE_MESSAGE and STREAM_MUTATION 2015-07-14 20:41:14 +08:00
Asias He
845de56614 streaming: Fix handler of PREPARE_MESSAGE
With this patch, the receiver of PREPARE_MESSAGE can create a session
correctly now.
2015-07-14 20:41:14 +08:00
Asias He
0282d4d6d0 streaming: Start stream_manager on startup 2015-07-14 20:41:14 +08:00
Asias He
8734213890 streaming: Lookup session 2015-07-14 20:41:14 +08:00
Asias He
fd04337e80 streaming: Wire up register_receiving init_receiving_side
Now stream_result_future can create a stream_coordinator if not
provided.

So
 - On sending side, stream_coordinator is created by stream_plan
 - On receiving side, stream_coordinator is created by stream_result_future
2015-07-14 20:41:14 +08:00
Asias He
d1720ffed1 streaming: Hold a shared_ptr inside stream_plan 2015-07-14 20:41:14 +08:00
Asias He
1828019d60 streaming: Convert StreamManager.java to C++ 2015-07-14 20:41:14 +08:00
Asias He
692c5b4c40 streaming: Import StreamManager.java 2015-07-14 20:41:14 +08:00
Asias He
f1cab93212 streaming: Return empty prepare_message for now
We can not find a session on the receiver side currently. Return a empty
prepare_message for now.
2015-07-14 20:41:14 +08:00
Asias He
38ee079916 streaming: Add test helper function
This is a very preliminary test to make sure negotiating between two
nodes is ok.
2015-07-14 20:41:14 +08:00
Asias He
01aa42ddca streaming: Add streaming_debug
Add debug print for message exchange
2015-07-14 20:41:14 +08:00
Asias He
285d1907ef streaming: Fix Assertion _instances.empty() failed
seastar: ./core/sharded.hh:227: seastar::sharded<Service>::~sharded()
[with Service = streaming::stream_session::handler]: Assertion
`_instances.empty()' failed.
2015-07-14 20:41:14 +08:00
Asias He
85d9204d0e streaming: Drop connection_handler
stream_session::stream_session(inet_address peer_, inet_address connecting_,
    int index_, bool keep_ss_table_level_)
    : peer(peer_)
    , connecting(connecting_)
    , conn_handler(shared_from_this())

Calling shared_from_this() inside stream_session's constructor is
problematic. I got

   Exiting on unhandled exception of type 'std::bad_weak_ptr': bad_weak_ptr

exceptions, with

   auto session = std::make_shared<stream_session>(peer, connecting, size, _keep_ss_table_level)

Also, the logic in connection_handler is not very useful for us. The
sending and receiving of messages are handled using messaging_service.
There is no need to add another layer.
2015-07-14 20:41:14 +08:00
Asias He
0f2bc82f82 streaming: Fix stream_init_message destination
It should be peer, not ourself.
2015-07-14 20:41:14 +08:00
Asias He
14ae9e66ae streaming: Use shared_ptr to track back to stream_session
I tried our lw_shared_ptr, the compiler complained endless usage of
incomplete type stream_session. I can not include stream_session.hh
everywhere due to circular dependency.

For now, I'm using std::shared_ptr which works fine.
2015-07-14 20:41:14 +08:00
Asias He
5ffb946dac streaming: futurize stream_session::on_initialization_complete 2015-07-14 20:41:14 +08:00
Asias He
b7b0aa3318 streaming: Negotiate core to core connection.
In streaming code, we need core to core connection(the second connection
from B to A). That is when node A initiates a stream to node B, it is
possible that node A will transfer data to node B and vice verse, so we
need two connections. When node A creates a tcp connection (within the
messaging_service) to node B, we have a connection ip_a:core_a to
ip_b:core_b. When node B creates a connection to node B, we can not
guarantee it is ip_b:core_b to ip_a:core_a.

Current messaging_service does not support core to core connection yet,
although we use shard_id{ip, cpu_id} as the destination of the message.

We can solve the issue in upper layer. We can pass extra cpu_id as a
user msg.

Node A sends stream_init_message with my_cpu_id = current_cpu_id

Node B receives stream_init_message, it runs on whatever cpu this
connection goes to, then it sends response back with Node B's
current_cpu_id.

After this, each node knows which cpu_id to send to each other.

TODO: we need to handle the case when peer node reboots with different
number of cpus.
2015-07-09 15:52:28 +08:00
Asias He
853175fc61 streaming: Implement prepare_message handler
This is a bit different from Origin. We always send back a
prepare_message even if the initializer requested no data from the
follower, to unify the handling.
2015-07-09 15:52:28 +08:00
Asias He
abfcf7d825 streaming: Send prepare_message message 2015-07-09 15:52:28 +08:00
Asias He
7ae860a43a streaming: Enable init_receiving_side 2015-07-09 15:52:28 +08:00
Asias He
f1dc4f21d5 streaming: Send stream_init_message to remote 2015-07-09 15:52:28 +08:00
Asias He
3256a21556 streaming: Use frozen_mutation to send mutations
Each outgoing_file_message might contain multiple mutations. Send them
one mutation per RPC call (using frozen_mutation), instead of one big
outgoing_file_message per one RPC call.
2015-07-09 15:52:28 +08:00
Asias He
1dd80bac65 streaming: Make get_local_db() and ms() public 2015-07-09 15:52:28 +08:00
Asias He
1aab3c7bb9 streaming: Drop serialization interface for {outgoing,incoming}_file_message
We will send mutations using the frozen_mutation verb
2015-07-09 15:52:28 +08:00
Asias He
4718211d4a streaming: Wire up stream_transfer_task::add_transfer_file
Wire up with outgoing_file_message
2015-07-09 15:52:27 +08:00
Asias He
ad3692f666 streaming: Implement stream_session::add_transfer_ranges
Given keyspace names, ranges and column_families names, figure out
mutation_readers to transfer.
2015-07-09 15:52:27 +08:00
Asias He
3d42a9f9ad streaming: Introduce stream_detail
It is used to hold mutations which we will send over network.
2015-07-09 15:52:27 +08:00
Asias He
4b676bfac5 streaming: Init streaming service in main
We need a reference to <distributed> db.
2015-07-09 15:52:27 +08:00
Asias He
dec8bee44d streaming: Add stream_session::description 2015-06-30 17:12:37 +08:00
Asias He
1e5cfa89d1 streaming: Kill a FIXME in stream_session::plan_id 2015-06-30 17:08:45 +08:00
Asias He
7ec2ee6b86 streaming: Add stream_plan::listeners 2015-06-30 16:55:30 +08:00
Asias He
6f0994349a streaming: Add stream_plan::execute 2015-06-30 16:47:25 +08:00
Asias He
92dd0616fa streaming: Wire up stream_result_future in stream_session 2015-06-30 16:39:12 +08:00
Asias He
212a70f42f streaming: Add constructor for stream_result_future 2015-06-30 16:08:53 +08:00
Asias He
60449c4b59 streaming: Convert StreamResultFuture to C++ 2015-06-30 16:00:56 +08:00
Asias He
ee1f4f022b streaming: Import StreamResultFuture.java 2015-06-30 15:48:21 +08:00
Asias He
abf24b3bfa streaming: Add flush_before_transfer to stream_plan 2015-06-30 15:38:18 +08:00
Asias He
878611beee streaming: Enable connect_all_stream_sessions 2015-06-30 15:25:53 +08:00
Asias He
fcecca89af streaming: Rename start to init_streaming_service
stream_session::start is used to start a session instead of
initialization on startup.
2015-06-30 15:07:19 +08:00
Asias He
e8156ca552 streaming: Implement serialize interface for file_message_header 2015-06-30 12:19:01 +08:00
Asias He
b35d29f91f streaming: Implement serialize interface for prepare_message 2015-06-30 11:43:29 +08:00
Asias He
3beb3e749d streaming: Implement serialize interface for stream_summary 2015-06-30 11:14:21 +08:00
Asias He
72394f3739 streaming: Implement serialize interface for stream_request 2015-06-30 11:07:04 +08:00
Asias He
237fedb1fc streaming: Implement serialize interface for received_message 2015-06-30 10:37:49 +08:00
Asias He
85ecd6b2f2 streaming: Implement serialize interface for retry_message 2015-06-30 10:33:13 +08:00
Asias He
8c67244a13 streaming: Implement serialize interface for stream_init_message 2015-06-30 10:33:13 +08:00
Asias He
c0cd69517a streaming: Implement stream_session::file_sent 2015-06-26 15:04:33 +08:00
Asias He
6a92924a75 streaming: Add stream_session::on_error 2015-06-26 14:49:24 +08:00