Triton Repository branch, master, updated. e0c571fadd3fbe0441e3bc147e230250c55b0b7a
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Triton Repository". The branch, master has been updated via e0c571fadd3fbe0441e3bc147e230250c55b0b7a (commit) from b8d60b592fb5e9704d3235bf13ffcc1bfe71668b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e0c571fadd3fbe0441e3bc147e230250c55b0b7a Author: Phil Carns <[email protected]> Date: Thu Oct 28 16:17:50 2010 -0400 refactor rosd_create ----------------------------------------------------------------------- Summary of changes: code/src/kv/kv.aer | 2 +- code/src/replicated-osd/replicated-osd.aer | 202 +++++++++++++++----- code/src/replicated-osd/replicated-osd.haer | 35 +++- .../src/replicated-osd/tests/rosd-create-bench.aer | 2 +- 4 files changed, 181 insertions(+), 60 deletions(-) Diff of changes: diff --git a/code/src/kv/kv.aer b/code/src/kv/kv.aer index 7ee8884..9279972 100644 --- a/code/src/kv/kv.aer +++ b/code/src/kv/kv.aer @@ -75,7 +75,7 @@ __blocking triton_ret_t triton_kv_put(triton_string_t *key, uint64_t value) req = malloc(sizeof(struct rosd_write_req)); /* TODO: need to check if all arguments are properly set */ - req->buffer.buffer = &value; + req->buffer.buffer = (char*)&value; req->buffer.size = sizeof(value); req->buffer.alloc_size = req->buffer.size; req->offset = 0; diff --git a/code/src/replicated-osd/replicated-osd.aer b/code/src/replicated-osd/replicated-osd.aer index 105adbb..b06d708 100644 --- a/code/src/replicated-osd/replicated-osd.aer +++ b/code/src/replicated-osd/replicated-osd.aer @@ -67,6 +67,55 @@ __attribute__((constructor)) void triton_rosd_init_register(void) 4, "triton.remote.retry", "triton.net.mpi", "triton.vosd", "triton.placement"); } +/* get_placement_info() + * + * utility function to gather placement information + */ +static __blocking triton_ret_t get_placement_info( + uint128_t oid, + uint32_t replication_factor, + int* my_position, + triton_addr_t* next_peer) +{ + triton_addr_t* closest; + triton_ret_t tret; + triton_addr_t self; + + /* TODO: how to error check this? */ + self = triton_addr_self("mpi"); + + /* find out who our peers are */ + closest = malloc(replication_factor * sizeof(*closest)); + if(!closest) + return(TRITON_ERR_NOMEM); + + tret = triton_place_lookup(oid, replication_factor, closest); + if(tret != TRITON_SUCCESS) + { + /* TODO: check for null addresses in array if they are possible? */ + free(closest); + return(tret); + } + + /* what position am I in the replication chain? */ + tret = triton_place_replica(self, closest, my_position); + if(tret != TRITON_SUCCESS) + { + free(closest); + return(tret); + } + + /* identify the next person in the chain */ + if(*my_position < (replication_factor-1)) + { + *next_peer = closest[*my_position + 1]; + } + + free(closest); + return(TRITON_SUCCESS); +} + + /* rosd_remove_local() * * performs the local steps needed in a replicated remove @@ -109,11 +158,11 @@ __blocking triton_ret_t rosd_remove_local( } -/* rosd_create_local() +/* rosd_create_local_storage() * * performs the local steps needed in a replicated create */ -__blocking triton_ret_t rosd_create_local( +__blocking triton_ret_t rosd_create_local_storage( uint128_t oid, uint32_t replication_factor ) @@ -165,46 +214,23 @@ __blocking triton_ret_t rosd_create_local( return(tret); } - -__remote __blocking triton_ret_t rosd_create( - struct rosd_create_req* req, - int32_t* out_nothing -) +static __blocking triton_ret_t rosd_create_do_work( + uint128_t oid, + uint32_t flags, + uint32_t replication_factor, + int my_position, + triton_addr_t peer_addr) { triton_ret_t local_tret; triton_ret_t remote_tret; - int my_position; - int32_t out; - triton_addr_t* closest; - triton_addr_t self; - triton_addr_t peer_addr; aer_remote_ctx_t rctx; - - self = triton_addr_self("mpi"); + struct rosd_s2s_create_req req; + int32_t dummy_out; /* right now only chained replication is supported */ /* TODO: implement fanout */ - assert(!(req->flags & ROSD_FLAG_FANOUT)); - req->flags |= ROSD_FLAG_CHAIN; - - /* find out who are peers are */ - closest = malloc(req->replication_factor * sizeof(*closest)); - /* TODO: remote code can't propigate fn errors yet */ - assert(closest != NULL); - local_tret = - triton_place_lookup(req->oid, req->replication_factor, closest); - /* TODO: remote code can't propigate fn errors yet */ - assert(local_tret == TRITON_SUCCESS); - - /* what position am I in the replication chain? */ - local_tret = triton_place_replica(self, closest, &my_position); - /* TODO: remote code can't propigate fn errors yet */ - assert(local_tret == TRITON_SUCCESS); - - /* this better be a server-to-server request if I'm not the master */ - /* TODO: real handling; may have been a client with stale node list */ - // assert((my_position == 0 && !(req->flags & ROSD_FLAG_S2S)) || - // (my_position > 0 && (req->flags & ROSD_FLAG_S2S))); + assert(!(flags & ROSD_FLAG_FANOUT)); + flags |= ROSD_FLAG_CHAIN; pwait { @@ -212,44 +238,109 @@ __remote __blocking triton_ret_t rosd_create( pbranch { /* forward on to peers if necessary */ - if(my_position == req->replication_factor-1) + if(my_position == replication_factor-1) { /* end of the chain; no one further to forward to */ remote_tret = TRITON_SUCCESS; } else { - triton_uint128_to_string(oid_str, TRITON_UINT128_STRLEN, req->oid); + triton_uint128_to_string(oid_str, TRITON_UINT128_STRLEN, oid); triton_debug(rosd_dbg_mask, "ROSD forwarding create of oid %s to %d'th server.\n", oid_str, my_position+1); - req->flags |= ROSD_FLAG_S2S; - peer_addr = closest[my_position+1]; + + /* TODO: error check this */ aesop_hints_get("triton.remote.context", sizeof(rctx), &rctx); - /* TODO: error check above; we are in trouble if hint not - * found - */ - remote_tret = remote_rosd_create(rctx, peer_addr, req, &out); + + req.oid = oid; + req.replication_factor = replication_factor; + req.flags = ROSD_FLAG_CHAIN; + remote_tret = remote_rosd_s2s_create(rctx, peer_addr, &req, &dummy_out); } } pbranch { - triton_uint128_to_string(oid_str, TRITON_UINT128_STRLEN, req->oid); + triton_uint128_to_string(oid_str, TRITON_UINT128_STRLEN, oid); triton_debug(rosd_dbg_mask, "ROSD local create of oid %s on %d'th server.\n", oid_str, my_position); /* perform local operation */ - local_tret = rosd_create_local(req->oid, req->replication_factor); + local_tret = rosd_create_local_storage(oid, replication_factor); } } - free(closest); - /* TODO: handle cases where one of local or remote succeeded, but not * both. What to clean up, and what to leave to the resync process? */ - /* TODO: remote code can't propigate fn errors yet */ assert(local_tret == TRITON_SUCCESS && remote_tret == TRITON_SUCCESS); return(local_tret); } +__remote __blocking triton_ret_t rosd_create( + struct rosd_create_req* req, + int32_t* out_nothing +) +{ + triton_ret_t tret; + int my_position; + triton_addr_t peer_addr; + + tret = get_placement_info(req->oid, req->replication_factor, + &my_position, &peer_addr); + /* TODO: rpc's can't propagate errors yet */ + assert(tret == TRITON_SUCCESS); + + /* this is a client request, so I better be the master. */ + /* TODO: need to handle this case; may have simply been a client with a + * stale node list + */ + assert(my_position == 0); + + tret = rosd_create_do_work( + req->oid, + req->flags, + req->replication_factor, + my_position, + peer_addr); + + /* TODO: rpc's can't propagate errors yet */ + assert(tret == TRITON_SUCCESS); + + return(tret); +} + + +__remote __blocking triton_ret_t rosd_s2s_create( + struct rosd_s2s_create_req* req, + int32_t* out_nothing +) +{ + triton_ret_t tret; + int my_position; + triton_addr_t peer_addr; + + tret = get_placement_info(req->oid, req->replication_factor, + &my_position, &peer_addr); + /* TODO: rpc's can't propagate errors yet */ + assert(tret == TRITON_SUCCESS); + + /* this is a server request, so I should _not_ be the master. */ + /* TODO: need to handle this case; may have simply been a client with a + * stale node list + */ + assert(my_position != 0); + + tret = rosd_create_do_work( + req->oid, + req->flags, + req->replication_factor, + my_position, + peer_addr); + + /* TODO: rpc's can't propagate errors yet */ + assert(tret == TRITON_SUCCESS); + + return(tret); +} + __remote __blocking triton_ret_t rosd_remove( struct rosd_remove_req* req, int32_t* out_nothing @@ -306,10 +397,12 @@ __remote __blocking triton_ret_t rosd_remove( /* TODO: remote code can't propigate fn errors yet */ assert(local_tret == TRITON_SUCCESS); +#if 0 /* this better be a server-to-server request if I'm not the master */ /* TODO: real handling; may have been a client with stale node list */ assert((my_position == 0 && !(req->flags & ROSD_FLAG_S2S)) || (my_position > 0 && (req->flags & ROSD_FLAG_S2S))); +#endif pwait { @@ -326,7 +419,9 @@ __remote __blocking triton_ret_t rosd_remove( { triton_uint128_to_string(oid_str, TRITON_UINT128_STRLEN, req->oid); triton_debug(rosd_dbg_mask, "ROSD forwarding remove of oid %s to %d'th server.\n", oid_str, my_position+1); +#if 0 req->flags |= ROSD_FLAG_S2S; +#endif peer_addr = closest[my_position+1]; aesop_hints_get("triton.remote.context", sizeof(rctx), &rctx); /* TODO: error check above; we are in trouble if hint not @@ -371,13 +466,14 @@ __blocking triton_ret_t rosd_write_local( uint64_t niid = 0; int value = 0; char* buffer_offsets[1]; + int64_t big_size = buffer.size; /* NOTE: a typical write is idempotent; no need for niid information * here */ buffer_offsets[0] = buffer.buffer; - tret = vosd_write(oid, fork, txn_number, buffer_offsets, &buffer.size, - 1, &offset, &buffer.size, 1, VOSD_FLAG_AUTO_TXN, 0); + tret = vosd_write(oid, fork, txn_number, buffer_offsets, &big_size, + 1, &offset, &big_size, 1, VOSD_FLAG_AUTO_TXN, 0); if(tret != TRITON_SUCCESS) { triton_log_error(NULL, tret, "vosd_write()"); @@ -446,10 +542,12 @@ __remote __blocking triton_ret_t rosd_write( /* TODO: remote code can't propigate fn errors yet */ assert(local_tret == TRITON_SUCCESS); +#if 0 /* this better be a server-to-server request if I'm not the master */ /* TODO: real handling; may have been a client with stale node list */ assert((my_position == 0 && !(req->flags & ROSD_FLAG_S2S)) || (my_position > 0 && (req->flags & ROSD_FLAG_S2S))); +#endif if(my_position == 0) { @@ -482,7 +580,9 @@ __remote __blocking triton_ret_t rosd_write( { triton_uint128_to_string(oid_str, TRITON_UINT128_STRLEN, req->oid); triton_debug(rosd_dbg_mask, "ROSD forwarding write of oid %s to %d'th server.\n", oid_str, my_position+1); +#if 0 req->flags |= ROSD_FLAG_S2S; +#endif peer_addr = closest[my_position+1]; aesop_hints_get("triton.remote.context", sizeof(rctx), &rctx); /* TODO: error check above; we are in trouble if hint not @@ -513,8 +613,6 @@ __remote __blocking triton_ret_t rosd_write( } - - /* * Local variables: * c-indent-level: 4 diff --git a/code/src/replicated-osd/replicated-osd.haer b/code/src/replicated-osd/replicated-osd.haer index c7a33cc..debffe7 100644 --- a/code/src/replicated-osd/replicated-osd.haer +++ b/code/src/replicated-osd/replicated-osd.haer @@ -18,16 +18,15 @@ #include "src/common/triton-error.h" #include "src/aesop/aesop.h" -/* TODO: refactor this API so that there are separate functions for - * client->server operations vs. server->server operations +/************************************************************ + * NOTE: this portion of the header contains the API that clients use to + * communicate with servers */ -/* for server to server requests */ -#define ROSD_FLAG_S2S 1 /* for requests that should be fanned out from the master for replication */ -#define ROSD_FLAG_FANOUT 2 +#define ROSD_FLAG_FANOUT 1 /* for requests that should be chained from the master for replication */ -#define ROSD_FLAG_CHAIN 4 +#define ROSD_FLAG_CHAIN 2 __remote struct rosd_create_req { @@ -80,6 +79,30 @@ __remote __blocking triton_ret_t rosd_write( ); +/************************************************************ + * NOTE: this portion of the header contains the API that servers use to + * communicate amongst themselves (for replication, etc.). Should _not_ be + * used by clients + */ + +__remote struct rosd_s2s_create_req +{ + uint128_t oid; + uint32_t flags; + uint32_t replication_factor; +}; + +/** + * Creates a new object (server to server) + */ +__remote __blocking triton_ret_t rosd_s2s_create( + struct rosd_s2s_create_req* req, + int32_t* out_nothing +); + + + + #endif /* __REPLICATED_OSD_HAE__ */ /* @} */ diff --git a/code/src/replicated-osd/tests/rosd-create-bench.aer b/code/src/replicated-osd/tests/rosd-create-bench.aer index 93bed90..987b271 100644 --- a/code/src/replicated-osd/tests/rosd-create-bench.aer +++ b/code/src/replicated-osd/tests/rosd-create-bench.aer @@ -44,7 +44,7 @@ static triton_mutex_t fakess_local_mutex = TRITON_MUTEX_INITIALIZER; static triton_sched_t fakess_local_sched; static triton_sched_id_t fakess_local_sched_id; -static __blocking void fakess_engine_stop(void) +static void fakess_engine_stop(void) { triton_mutex_lock(&fakess_local_mutex); /* set a flag and signal the fakess engine to stop running */ hooks/post-receive -- Triton Repository
participants (1)
-
noreply@mcs.anl.gov