skv_status_t Init( it_pz_handle_t aPZ_Hdl, size_t aDataAreaSize, size_t aDataChunkSize, size_t aAlignment=sizeof(uintptr_t) ) { StrongAssertLogLine( aDataAreaSize % aAlignment == 0 ) << "skv_local_kv_rdma_data_buffer_t::Init(): Area size has to be multiple of Alignment" << " size=" << aDataAreaSize << " align=" << aAlignment << EndLogLine; mAlignment = aAlignment; size_t pad = sizeof( skv_lmr_wait_queue_t) - (sizeof( skv_lmr_wait_queue_t ) % aAlignment); if( pad==aAlignment ) pad = 0; mHeadSpace = sizeof( skv_lmr_wait_queue_t) + pad; mDataArea = new char[ aDataAreaSize ]; StrongAssertLogLine( mDataArea != NULL ) << "skv_local_kv_rdma_data_buffer_t::Init(): Failed to allocate data area of size: " << aDataAreaSize << EndLogLine; mChunkSize = aDataChunkSize; it_mem_priv_t privs = (it_mem_priv_t) ( IT_PRIV_LOCAL | IT_PRIV_REMOTE ); it_lmr_flag_t lmr_flags = IT_LMR_FLAG_NON_SHAREABLE; it_lmr_handle_t lmr; it_rmr_context_t rmr; it_status_t itstatus = it_lmr_create( aPZ_Hdl, mDataArea, NULL, aDataAreaSize, IT_ADDR_MODE_ABSOLUTE, privs, lmr_flags, 0, & lmr, & rmr ); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_tree_based_container_t::Init:: ERROR:: itstatus == IT_SUCCESS " << " itstatus: " << itstatus << EndLogLine; mLMR.InitAbs( lmr, mDataArea, aDataAreaSize ); mRMR.Init( rmr, mDataArea, aDataAreaSize ); mFirstFree.Init( mDataArea, aDataAreaSize, mAlignment ); mLastBusy.Init( mDataArea, aDataAreaSize, mAlignment ); BegLogLine( SKV_LOCAL_KV_RDMA_DATA_BUFFER_LOG ) << "skv_local_kv_rdma_data_buffer_t: FF[" << (uintptr_t)mFirstFree.GetPtr() << "]" << " LB[" << (uintptr_t)mLastBusy.GetPtr() << "]" << " mHeadSpace=" << mHeadSpace << " mAlignment=" << mAlignment << EndLogLine; return SKV_SUCCESS; }
void Init( const char* aName, long long Low, long long High, int aBucketCount ) { if( HistOnFlag ) { mBucketCount = aBucketCount; mName = aName; mLow = Low; mHigh = High; mRange = mHigh - mLow; mBucketReciprocal = 1.0 * mBucketCount / mRange; int BinsSize = sizeof( unsigned long long ) * mBucketCount; mCountBins = (unsigned long long *) malloc( BinsSize ); StrongAssertLogLine( mCountBins ) << "histrogram_t::Init(): ERROR: Not enough memory for" << " BinsSize: " << BinsSize << EndLogLine; mValueBins = (unsigned long long *) malloc( BinsSize ); StrongAssertLogLine( mValueBins ) << "histrogram_t::Init(): ERROR: Not enough memory for" << " BinsSize: " << BinsSize << EndLogLine; Reset(); } }
static const char* skv_command_type_to_string( skv_command_type_t aCommandType ) { switch( aCommandType ) { case SKV_COMMAND_NONE: { return "SKV_COMMAND_NONE"; } case SKV_COMMAND_INSERT: { return "SKV_COMMAND_INSERT"; } case SKV_COMMAND_BULK_INSERT: { return "SKV_COMMAND_BULK_INSERT"; } case SKV_COMMAND_RETRIEVE: { return "SKV_COMMAND_RETRIEVE"; } case SKV_COMMAND_RETRIEVE_N_KEYS: { return "SKV_COMMAND_RETRIEVE_N_KEYS"; } case SKV_COMMAND_RETRIEVE_DIST: { return "SKV_COMMAND_RETRIEVE_DIST"; } case SKV_COMMAND_UPDATE: { return "SKV_COMMAND_UPDATE"; } case SKV_COMMAND_REMOVE: { return "SKV_COMMAND_REMOVE"; } case SKV_COMMAND_CLOSE: { return "SKV_COMMAND_CLOSE"; } case SKV_COMMAND_OPEN: { return "SKV_COMMAND_OPEN"; } case SKV_COMMAND_CONN_EST: { return "SKV_COMMAND_CONN_EST"; } case SKV_COMMAND_ACTIVE_BCAST: { return "SKV_COMMAND_ACTIVE_BCAST"; } case SKV_COMMAND_CURSOR_PREFETCH: { return "SKV_COMMAND_CURSOR_PREFETCH"; } case SKV_COMMAND_PDSCNTL: { return "SKV_COMMAND_PDSCNTL"; } default: { StrongAssertLogLine( 0 ) << "skv_command_type_to_string:: ERROR:: Unrecognized type: " << " aCommandType: " << aCommandType << EndLogLine; return "SKV_COMMAND_UNKNOWN"; } } }
skv_status_t skv_local_kv_inmem::Init( int aRank, int aNodeCount, skv_server_internal_event_manager_if_t *aInternalEventMgr, it_pz_handle_t aPZ, char* aCheckpointPath ) { skv_status_t status; mMyRank = aRank; /************************************************************ * Initialize the local partition dataset manager ***********************************************************/ BegLogLine( SKV_LOCAL_KV_BACKEND_LOG ) << "skv_local_kv_inmem::Init(): Entering..." << EndLogLine; status = mPDSManager.Init( aRank, aNodeCount, aInternalEventMgr, aPZ, aCheckpointPath ); StrongAssertLogLine( status == SKV_SUCCESS ) << "skv_local_kv_inmem::Init():: ERROR:: mPDSManager.Init() failed. " << " status: " << skv_status_to_string( status ) << " Rank: " << aRank << " PartitionSize: " << aNodeCount << EndLogLine; /***********************************************************/ return status; }
skv_status_t AcquireDataAreaPtr( size_t aSize, char** aPointer ) { skv_lmr_triplet_t lmr; skv_status_t status = AcquireDataArea( aSize, &lmr ); StrongAssertLogLine( status == SKV_SUCCESS ) << "skv_local_kv_rdma_data_buffer_t: error while allocating data buffer. status: " << skv_status_to_string( status ) << EndLogLine; *aPointer = (char*)lmr.GetAddr(); StrongAssertLogLine( ((uintptr_t)*aPointer >= mLMR.GetAddr()) && ((uintptr_t)*aPointer< mLMR.GetAddr()+mLMR.GetLen()-mHeadSpace) ) << "skv_local_kv_rdma_data_buffer_t: BUG in AcquireDataArea! Acquired buffer out of range " << (uintptr_t)*aPointer << " < " << mLMR.GetAddr() << EndLogLine; return status; }
/*** * skv_server_t::InitNewStateForEP:: * Desc: Initiates the state for a new EP * input: * returns: SKV_SUCCESS or SKV_ERR_NO_EVENT ***/ skv_status_t skv_server_network_event_manager_if_t:: FinalizeEPState( skv_server_epstate_map_t *aEPStateMap, it_ep_handle_t aEP, skv_server_ep_state_t* aStateForEP ) { AssertLogLine( aStateForEP != NULL ) << "skv_server_t::FinalizeEPState(): ERROR: " << " aEP: " << (void *) aEP << EndLogLine; aStateForEP->Closing(); skv_server_finalizable_associated_ep_state_list_t::iterator iter = aStateForEP->mAssociatedStateList->begin(); skv_server_finalizable_associated_ep_state_list_t::iterator end = aStateForEP->mAssociatedStateList->end(); for( ; iter != end; iter++ ) { switch( iter->mStateType ) { case SKV_SERVER_FINALIZABLE_ASSOCIATED_EP_STATE_CREATE_CURSOR_TYPE: { skv_server_cursor_hdl_t ServCursorHdl = (skv_server_cursor_hdl_t) iter->mState; ServCursorHdl->Finalize(); free( ServCursorHdl ); break; } default: StrongAssertLogLine( 0 ) << "FinalizeEPState(): ERROR:: " << " iter->mStateType: " << iter->mStateType << EndLogLine; } } aEPStateMap->erase( aEP ); aStateForEP->Finalize(); BegLogLine(SKV_SERVER_CLEANUP_LOG) << "free(aStateForEP= " << (void *) aStateForEP << " )" << EndLogLine ; bzero( aStateForEP, sizeof( skv_server_ep_state_t ) ); delete aStateForEP; it_ep_free( aEP ); BegLogLine( SKV_SERVER_CLEANUP_LOG ) << "skv_server::FinalizeEPState(): completed " << EndLogLine; return SKV_SUCCESS; }
void Init( const char *aBase=NULL, size_t aSize=0, size_t aGranularity=sizeof(uintptr_t) ) { StrongAssertLogLine( ((uintptr_t)aBase % aGranularity == 0) && (aSize % aGranularity == 0) ) << "skv_ringbuffer_ptr(): unaligned memory base pointer: " << (void*)aBase << " requested granularity: " << aGranularity << EndLogLine; mGranularity = aGranularity; mBase = (char*)aBase; mPtr = mBase; mSize = aSize; mWrapped = false; }
skv_ringbuffer_ptr& operator-( const skv_ringbuffer_ptr &aSub ) { StrongAssertLogLine( ( aSub.mPtr - aSub.mBase ) % mGranularity == 0 ) << "skv_ringbuffer_ptr:operator-(): unaligned ptr in operand (maybe incompatible ringbuffer pointers with different granularity) " << " offset: " << aSub.mPtr - aSub.mBase << " gran: " << mGranularity << EndLogLine; bool towrap = ( (mPtr - mBase) < (aSub.mPtr - aSub.mBase) ); mWrapped = ( mWrapped != towrap ); mPtr = mBase + ( mPtr + mSize - aSub.mPtr ) % mSize; return (*this); }
skv_status_t ReleaseDataAreaPtr( size_t aSize, char* aPointer ) { skv_lmr_triplet_t lmr; skv_lmr_wait_queue_t *entry = (skv_lmr_wait_queue_t*)(aPointer - mHeadSpace); StrongAssertLogLine( ((uintptr_t)entry >= mLMR.GetAddr()) && ((uintptr_t)entry < mLMR.GetAddr()+mLMR.GetLen()-mHeadSpace) ) << "skv_local_kv_rdma_data_buffer_t: Release attempt out of range " << (uintptr_t)entry << " < " << mLMR.GetAddr() << EndLogLine; lmr.InitAbs( mLMR.GetLMRHandle(), aPointer, aSize ); return ReleaseDataArea( &lmr ); }
void InitCursorHdl( it_pz_handle_t aPZ_Hdl, int aNodeId, skv_pds_id_t* aPdsId, skv_client_cursor_handle_t* aCursorHdl ) { *aCursorHdl = (skv_client_cursor_handle_t) malloc( sizeof( skv_client_cursor_control_block_t ) ); StrongAssertLogLine( *aCursorHdl != NULL ) << "skv_client_cursor_manager_if::InitCursorId():: ERROR:: " << " *aCursorHdl != NULL" << EndLogLine; skv_client_cursor_control_block_t* CursorCCB = *aCursorHdl; CursorCCB->Init( aPZ_Hdl, aNodeId, aPdsId ); }
void Finalize() { BegLogLine( SKV_CLIENT_CURSOR_LOG ) << "skv_client_cursor_control_block_t::Finalize():: Entering..." << " mKeysDataLMRHdl: " << (void *) mKeysDataLMRHdl << EndLogLine; it_status_t status = it_lmr_free( mKeysDataLMRHdl ); StrongAssertLogLine( status == IT_SUCCESS ) << "skv_client_cursor_control_block_t::Finalize():: ERROR:: " << " status: " << status << EndLogLine; BegLogLine( SKV_CLIENT_CURSOR_LOG ) << "skv_client_cursor_control_block_t::Finalize():: Leaving..." << EndLogLine; }
void Init( it_pz_handle_t aPZ_Hdl, int aNodeId, skv_pds_id_t* aPdsId ) { SetNodeId( aNodeId ); mPdsId = *aPdsId; mCachedKeysCount = 0; mCurrentCachedKeyIdx = 0; mCurrentCachedKey = & mCachedKeys[ 0 ]; it_mem_priv_t privs = (it_mem_priv_t) ( IT_PRIV_LOCAL | IT_PRIV_REMOTE ); it_lmr_flag_t lmr_flags = IT_LMR_FLAG_NON_SHAREABLE; int SizeOfKeyDataBuffer = sizeof( char ) * SKV_CACHED_KEYS_BUFFER_SIZE; it_status_t status = it_lmr_create( aPZ_Hdl, & mCachedKeys[ 0 ], NULL, SizeOfKeyDataBuffer, IT_ADDR_MODE_ABSOLUTE, privs, lmr_flags, 0, & mKeysDataLMRHdl, & mKeysDataRMRHdl ); BegLogLine( SKV_CLIENT_CURSOR_LOG ) << "skv_client_cursor_control_block_t::Init():: Leaving..." << " & mCachedKeys[ 0 ]: " << (void *) & mCachedKeys[ 0 ] << " mKeysDataLMRHdl: " << (void *) mKeysDataLMRHdl << "mKeysDataRMRHdl=" << (void *) mKeysDataRMRHdl << EndLogLine; StrongAssertLogLine( status == IT_SUCCESS ) << "skv_client_cursor_control_block_t::Init():: ERROR:: " << " status: " << status << EndLogLine; }
void Add( long long aValue ) { if( HistOnFlag ) { if(( aValue - mLow ) < 0 ) { mOutOfRangeLowCBin++; mOutOfRangeLowVBin += aValue; mDataPointCount++; mDataPointValueCount += aValue; return; } int BinIndex = (int)( (aValue-mLow) * mBucketReciprocal); if( BinIndex >= 0 && BinIndex < mBucketCount ) { mCountBins[ BinIndex ]++; mValueBins[ BinIndex ] += aValue; } else if( BinIndex >= mBucketCount ) { mOutOfRangeHighCBin++; mOutOfRangeHighVBin += aValue; } else StrongAssertLogLine( 0 ) << "histrogram_t::Add(): " << " BinIndex: " << BinIndex << " mBucketReciprocal: " << mBucketReciprocal << " aValue: " << aValue << " mLow: " << mLow << " mDataPointCount: " << mDataPointCount << " mDataPointValueCount: " << mDataPointValueCount << EndLogLine; mDataPointCount++; mDataPointValueCount += aValue; } }
int WaitForEvents( int aMaxEventCount ) { AssertLogLine( aMaxEventCount >= SKV_SERVER_AEVD_EVENTS_MAX_COUNT ) << "ERROR: " << " aMaxEventCount: " << aMaxEventCount << " SKV_SERVER_AEVD_EVENTS_MAX_COUNT: " << SKV_SERVER_AEVD_EVENTS_MAX_COUNT << EndLogLine; size_t itEventCount = 0; // \todo this is not the right place because we're in the event source here, not in the sink it_status_t istatus = itx_aevd_wait( mAevd_Hdl, 0, SKV_SERVER_AEVD_EVENTS_MAX_COUNT, mAevdEvents, &itEventCount ); StrongAssertLogLine( istatus == IT_SUCCESS ) << "ERROR: " << " istatus: " << istatus << EndLogLine; return itEventCount; }
static const char* skv_poll_type_to_string( skv_poll_type_t aType ) { switch( aType ) { case SKV_POLL_UNAFF_EVD: { return "SKV_POLL_UNAFF_EVD"; } case SKV_POLL_AFF_EVD: { return "SKV_POLL_AFF_EVD"; } case SKV_POLL_CMR_EVD: { return "SKV_POLL_CMR_EVD"; } case SKV_POLL_CMM_EVD: { return "SKV_POLL_CMM_EVD"; } case SKV_POLL_RQ_EVD: { return "SKV_POLL_RQ_EVD"; } case SKV_POLL_SQ_EVD: { return "SKV_POLL_SQ_EVD"; } case SKV_POLL_SEQ_EVD: { return "SKV_POLL_SEQ_EVD"; } default: { StrongAssertLogLine( 0 ) << "skv_poll_type_to_string():: ERROR:: " << " aType: " << aType << " Not supported" << EndLogLine; return "SKV_POLL_TYPE_UNKNOWN"; } } }
static skv_status_t Execute( skv_client_server_conn_t* aConn, skv_client_ccb_t* aCCB ) { char* RecvBuff = aCCB->GetRecvBuff(); skv_server_to_client_cmd_hdr_t* Hdr = (skv_server_to_client_cmd_hdr_t *) RecvBuff; skv_client_command_state_t State = aCCB->GetState(); skv_client_event_t Event = Hdr->mEvent; switch( State ) { case SKV_CLIENT_COMMAND_STATE_IDLE: case SKV_CLIENT_COMMAND_STATE_DONE: { StrongAssertLogLine( 0 ) << "skv_client_retrieve_dist_command_sm:: ERROR:: Invalid State: " << " State: " << State << EndLogLine; break; } case SKV_CLIENT_COMMAND_STATE_PENDING: { switch( Event ) { case SKV_CLIENT_EVENT_CMD_COMPLETE: { // Return the status and set the PDSId skv_cmd_retrieve_dist_resp_t* Resp = (skv_cmd_retrieve_dist_resp_t *) RecvBuff; Resp->EndianConvert(); BegLogLine( SKV_CLIENT_RETRIEVE_DIST_LOG ) << "Retrieved: " << Resp->mDist << " status=" << Resp->mStatus << EndLogLine; aCCB->mStatus = Resp->mStatus; memcpy( (void *) aCCB->mCommand.mCommandBundle.mCommandRetrieveDist.mDist, (void *) & (Resp->mDist), sizeof( skv_distribution_t )); // Command is completed, release resources int CommandOrd = Resp->mHdr.mCmdOrd; aConn->ReleaseCmdOrdinal( CommandOrd ); aCCB->mCCBMgrIF->AddToDoneCCBQueue( aCCB ); aCCB->Transit( SKV_CLIENT_COMMAND_STATE_DONE ); break; } default: { StrongAssertLogLine( 0 ) << "skv_client_retrieve_dist_command_sm:: ERROR:: Invalid Event: " << " State: " << State << " Event: " << Event << EndLogLine; break; } } break; } default: { StrongAssertLogLine( 0 ) << "skv_client_retrieve_dist_command_sm:: ERROR:: Invalid State: " << " State: " << State << EndLogLine; break; } } return SKV_SUCCESS; }
/*** * skv_client_internal_t::GetNextLocalElement:: * Desc: Get the next element in the cursor pointed to a node id * returns: SKV_SUCCESS on success or error code ***/ skv_status_t skv_client_internal_t:: GetNextLocalElement( skv_client_cursor_handle_t aCursorHdl, char* aRetrievedKeyBuffer, int* aRetrievedKeySize, int aRetrievedKeyMaxSize, char* aRetrievedValueBuffer, int* aRetrievedValueSize, int aRetrievedValueMaxSize, skv_cursor_flags_t aFlags ) { BegLogLine( SKV_CLIENT_CURSOR_LOG ) << "skv_client_internal_t::GetNextLocalElement():: Entering..." << EndLogLine; StrongAssertLogLine( mState = SKV_CLIENT_STATE_CONNECTED ) << "skv_client_internal_t::GetNextLocalElement():: ERROR:: " << " mState: " << mState << EndLogLine; AssertLogLine( aCursorHdl->mCachedKeysCount > 0 ) << "skv_client_internal_t::GetNextLocalElement():: ERROR:: aCursorHdl->mCachedKeysCount > 0 " << " aCursorHdl->mCachedKeysCount: " << aCursorHdl->mCachedKeysCount << EndLogLine; if( aCursorHdl->mCurrentCachedKeyIdx == aCursorHdl->mCachedKeysCount ) { // Reached the end of the cached records char* StartingKeyBuffer = aCursorHdl->mPrevCachedKey + sizeof(int); int StartingKeyBufferSize = *((int *) aCursorHdl->mPrevCachedKey); BegLogLine( SKV_CLIENT_CURSOR_LOG ) << "Endian-converting StartingKeyBufferSize=" << StartingKeyBufferSize << EndLogLine ; StartingKeyBufferSize=ntohl(StartingKeyBufferSize) ; skv_status_t status = RetrieveNKeys( aCursorHdl, StartingKeyBuffer, StartingKeyBufferSize, aFlags ); if( status != SKV_SUCCESS ) return status; } skv_status_t status = RetrieveNextCachedKey( aCursorHdl, aRetrievedKeyBuffer, aRetrievedKeySize, aRetrievedKeyMaxSize, aRetrievedValueBuffer, aRetrievedValueSize, aRetrievedValueMaxSize, aFlags ); BegLogLine( SKV_CLIENT_CURSOR_LOG ) << "skv_client_internal_t::GetNextLocalElement():: Leaving..." << EndLogLine; return status; }
/*** * skv_client_internal_t::GetFirstLocalElement:: * Desc: Get the first element in the cursor * returns: SKV_SUCCESS on success or error code ***/ skv_status_t skv_client_internal_t:: GetFirstLocalElement( skv_client_cursor_handle_t aCursorHdl, char* aRetrievedKeyBuffer, int* aRetrievedKeySize, int aRetrievedKeyMaxSize, char* aRetrievedValueBuffer, int* aRetrievedValueSize, int aRetrievedValueMaxSize, skv_cursor_flags_t aFlags ) { BegLogLine( SKV_CLIENT_RETRIEVE_N_KEYS_DIST_LOG ) << "skv_client_internal_t::GetFirstLocalElement():: Entering..." << EndLogLine; StrongAssertLogLine( mState = SKV_CLIENT_STATE_CONNECTED ) << "skv_client_internal_t::GetFirstLocalElement():: ERROR:: " << " mState: " << mState << EndLogLine; int StartSizeToRetrieve = 0; char* StartToRetrive = NULL; if( aFlags & SKV_CURSOR_WITH_STARTING_KEY_FLAG ) { StartToRetrive = aRetrievedKeyBuffer; StartSizeToRetrieve = *aRetrievedKeySize; } BegLogLine( SKV_CLIENT_CURSOR_LOG ) << "Endian-converting StartSizeToRetrieve=" << StartSizeToRetrieve << EndLogLine ; StartSizeToRetrieve=ntohl(StartSizeToRetrieve) ; skv_status_t status = RetrieveNKeys( aCursorHdl, StartToRetrive, StartSizeToRetrieve, (skv_cursor_flags_t) ( (int)aFlags | SKV_CURSOR_RETRIEVE_FIRST_ELEMENT_FLAG )); // return only if there were no keys retrieved. if( ( aCursorHdl->mCurrentCachedKeyIdx == aCursorHdl->mCachedKeysCount ) && ( status != SKV_SUCCESS ) ) return status; AssertLogLine( aCursorHdl->mCachedKeysCount > 0 ) << "skv_client_internal_t::GetFirstLocalElement():: ERROR:: " << " aCursorHdl->mCachedKeysCount: " << aCursorHdl->mCachedKeysCount << EndLogLine; status = RetrieveNextCachedKey( aCursorHdl, aRetrievedKeyBuffer, aRetrievedKeySize, aRetrievedKeyMaxSize, aRetrievedValueBuffer, aRetrievedValueSize, aRetrievedValueMaxSize, aFlags ); BegLogLine( SKV_CLIENT_CURSOR_LOG ) << "skv_client_internal_t::GetFirstLocalElement():: Leaving..." << EndLogLine; return status; }
/*** * skv_client_internal_t::RetrieveNKeys:: * returns: SKV_SUCCESS on success or error code ***/ skv_status_t skv_client_internal_t:: RetrieveNKeys( skv_client_cursor_handle_t aCursorHdl, char* aStartingKeyBuffer, int aStartingKeyBufferSize, skv_cursor_flags_t aFlags ) { BegLogLine( SKV_CLIENT_RETRIEVE_N_KEYS_DIST_LOG ) << "skv_client_internal_t::RetrieveNKeys():: Entering..." << EndLogLine; StrongAssertLogLine( mState = SKV_CLIENT_STATE_CONNECTED ) << "skv_client_internal_t::RetrieveNKeys()::" << " aFlags: " << aFlags << " mState: " << mState << EndLogLine; /************************************************** * Check limits *************************************************/ BegLogLine(SKV_CLIENT_RETRIEVE_N_KEYS_DIST_LOG) << "aStartingKeyBufferSize=" << aStartingKeyBufferSize << " SKV_KEY_LIMIT=" << SKV_KEY_LIMIT << EndLogLine ; if( aStartingKeyBufferSize > SKV_KEY_LIMIT ) { BegLogLine(SKV_CLIENT_RETRIEVE_N_KEYS_DIST_LOG) << "Returning SKV_ERRNO_KEY_TOO_LARGE" << EndLogLine ; return SKV_ERRNO_KEY_TOO_LARGE; } // Starting a new command, get a command control block skv_client_ccb_t* CmdCtrlBlk; skv_status_t rsrv_status = mCommandMgrIF.Reserve( & CmdCtrlBlk ); if( rsrv_status != SKV_SUCCESS ) return rsrv_status; /*************************************************/ /************************************************** * Init cursor state *************************************************/ aCursorHdl->ResetCurrentCachedState(); /*************************************************/ /****************************************************** * Set the client-server protocol send ctrl msg buffer *****************************************************/ char* SendCtrlMsgBuff = CmdCtrlBlk->GetSendBuff(); int RoomForData = SKV_CONTROL_MESSAGE_SIZE - sizeof( skv_cmd_retrieve_n_keys_req_t ) - SKV_CHECKSUM_BYTES; AssertLogLine( RoomForData >= 0 ) << "skv_client_internal_t::RetrieveNKeys():: ERROR:: " << " RoomForData: " << RoomForData << " sizeof( skv_cmd_retrieve_n_keys_KeyFitsInMsg_req_t ): " << sizeof( skv_cmd_retrieve_n_keys_req_t ) << " SKV_CONTROL_MESSAGE_SIZE: " << SKV_CONTROL_MESSAGE_SIZE << EndLogLine; int KeyFitsInCtrlMsg = (aStartingKeyBufferSize <= RoomForData); skv_cmd_retrieve_n_keys_req_t* Req = (skv_cmd_retrieve_n_keys_req_t *) SendCtrlMsgBuff; // If the key fits into the control message it's safe to // send the list of buffers to cached keys Req->Init( aCursorHdl->mCurrentNodeId, & mConnMgrIF, aCursorHdl->mPdsId, SKV_COMMAND_RETRIEVE_N_KEYS, SKV_SERVER_EVENT_TYPE_IT_DTO_RETRIEVE_N_KEYS_CMD, CmdCtrlBlk, aFlags, aStartingKeyBuffer, aStartingKeyBufferSize, KeyFitsInCtrlMsg, aCursorHdl->mKeysDataLMRHdl, aCursorHdl->mKeysDataRMRHdl, aCursorHdl->mCachedKeys, SKV_CLIENT_MAX_CURSOR_KEYS_TO_CACHE ); /*****************************************************/ Req->EndianConvert() ; BegLogLine(SKV_CLIENT_RETRIEVE_N_KEYS_DIST_LOG) << "mEventType=" << Req->mHdr.mEventType << EndLogLine ; BegLogLine( SKV_CLIENT_RETRIEVE_N_KEYS_DIST_LOG ) << "skv_client_internal_t: Created RetrieveN request:" << " KeyDataAddr: " << (uint64_t)aCursorHdl->mCachedKeys << EndLogLine; /****************************************************** * Transit the CCB to an appropriate state *****************************************************/ CmdCtrlBlk->Transit( SKV_CLIENT_COMMAND_STATE_WAITING_FOR_VALUE_TX_ACK ); /*****************************************************/ /****************************************************** * Set the local client state used on response *****************************************************/ CmdCtrlBlk->mCommand.mType = SKV_COMMAND_RETRIEVE_N_KEYS; CmdCtrlBlk->mCommand.mCommandBundle.mCommandRetrieveNKeys.mCachedKeysCountPtr = & aCursorHdl->mCachedKeysCount; CmdCtrlBlk->mCommand.mCommandBundle.mCommandRetrieveNKeys.mCachedKeysCountMax = SKV_CLIENT_MAX_CURSOR_KEYS_TO_CACHE; /*****************************************************/ BegLogLine(SKV_CLIENT_RETRIEVE_N_KEYS_DIST_LOG) << "mEventType=" << Req->mHdr.mEventType << EndLogLine ; skv_status_t status = mConnMgrIF.Dispatch( aCursorHdl->mCurrentNodeId, CmdCtrlBlk ); AssertLogLine( status == SKV_SUCCESS ) << "skv_client_internal_t::RetrieveNKeys():: " << " status: " << skv_status_to_string( status ) << EndLogLine; BegLogLine(SKV_CLIENT_RETRIEVE_N_KEYS_DIST_LOG) << "mEventType=" << Req->mHdr.mEventType << EndLogLine ; status = Wait( CmdCtrlBlk ); status=(skv_status_t) ntohl(status) ; BegLogLine(SKV_CLIENT_RETRIEVE_N_KEYS_DIST_LOG) << "mEventType=" << Req->mHdr.mEventType << EndLogLine ; BegLogLine( SKV_CLIENT_RETRIEVE_N_KEYS_DIST_LOG ) << "skv_client_internal_t::RetrieveNKeys():: Leaving..." << " status: " << skv_status_to_string( status ) << EndLogLine; return status; }
/*** * skv_server_t::InitNewStateForEP:: * Desc: Initiates the state for a new EP * input: * returns: SKV_SUCCESS or SKV_ERR_NO_EVENT ***/ skv_status_t skv_server_network_event_manager_if_t:: InitNewStateForEP( skv_server_epstate_map_t* aEPStateMap, skv_server_ep_state_t** aStateForEP ) { it_ep_attributes_t ep_attr; it_ep_rc_creation_flags_t ep_flags; ep_flags = IT_EP_NO_FLAG; ep_attr.max_dto_payload_size = 8192; ep_attr.max_request_dtos = (SKV_MAX_COMMANDS_PER_EP + 5 ) * MULT_FACTOR; ep_attr.max_recv_dtos = (SKV_MAX_COMMANDS_PER_EP + 5 ) * MULT_FACTOR; ep_attr.max_send_segments = SKV_MAX_SGE; ep_attr.max_recv_segments = SKV_MAX_SGE; ep_attr.srv.rc.rdma_read_enable = IT_TRUE; ep_attr.srv.rc.rdma_write_enable = IT_TRUE; ep_attr.srv.rc.max_rdma_read_segments = SKV_SERVER_MAX_RDMA_WRITE_SEGMENTS; // * MULT_FACTOR_2; //ep_attr.srv.rc.max_rdma_write_segments = 4 * MULT_FACTOR_2; //ep_attr.srv.rc.max_rdma_write_segments = 24; ep_attr.srv.rc.max_rdma_write_segments = SKV_SERVER_MAX_RDMA_WRITE_SEGMENTS; // * MULT_FACTOR_2; ep_attr.srv.rc.rdma_read_ird = SKV_MAX_COMMANDS_PER_EP; // * MULT_FACTOR_2; ep_attr.srv.rc.rdma_read_ord = SKV_MAX_COMMANDS_PER_EP; // * MULT_FACTOR_2; ep_attr.srv.rc.srq = (it_srq_handle_t) IT_NULL_HANDLE; ep_attr.srv.rc.soft_hi_watermark = 0; ep_attr.srv.rc.hard_hi_watermark = 0; ep_attr.srv.rc.atomics_enable = IT_FALSE; ep_attr.priv_ops_enable = IT_FALSE; it_ep_handle_t ep_hdl; it_status_t status = it_ep_rc_create( mPZ_Hdl, mEvd_Sq_Hdl, mEvd_Rq_Hdl, mEvd_Cmm_Hdl, ep_flags, & ep_attr, & ep_hdl ); StrongAssertLogLine( status == IT_SUCCESS ) << "skv_server_t::InitNewStateForEP()::ERROR after it_ep_rc_create() " << " status: " << status << EndLogLine; *aStateForEP = new skv_server_ep_state_t; BegLogLine(SKV_SERVER_NETWORK_EVENT_MANAGER_LOG) << "malloc *aStateForEP -> " << (void *) *aStateForEP << EndLogLine ; StrongAssertLogLine( *aStateForEP != NULL ) << "skv_server_t::InitNewStateForEP()::ERROR not enough memory for " << " sizeof( skv_server_ep_state_t ): " << sizeof( skv_server_ep_state_t ) << EndLogLine; (*aStateForEP)->Init( ep_hdl, mPZ_Hdl ); skv_status_t rc = aEPStateMap->insert( ep_hdl, *aStateForEP ); StrongAssertLogLine( rc == SKV_SUCCESS ) << "skv_server_t::InitNewStateForEP():: ERROR on insert to aEPStateMap" << EndLogLine; BegLogLine( SKV_SERVER_NETWORK_EVENT_MANAGER_LOG ) << "skv_server_t::InitNewStateForEP():: " << " ep_hdl: " << (void *) ep_hdl << " *aStateForEP: " << (void *) *aStateForEP << EndLogLine; return SKV_SUCCESS; }
skv_status_t ReleaseDataArea( skv_lmr_triplet_t *aLMR ) { if( ( IsEmpty() ) || ( aLMR == NULL ) ) return SKV_ERRNO_ELEM_NOT_FOUND; bool released; skv_lmr_wait_queue_t *lmrState = (skv_lmr_wait_queue_t*)(aLMR->GetAddr() - mHeadSpace); BegLogLine( SKV_LOCAL_KV_RDMA_DATA_BUFFER_LOG ) << "ReleaseDataArea: About to release: [" << aLMR->GetAddr()-mHeadSpace << ":" << aLMR->GetLen() << "]" << " NIL[" << (uintptr_t)mLastBusy.GetPtr() << ":" << ((skv_lmr_wait_queue_t*)mLastBusy.GetPtr())->mSize << "]" << EndLogLine; StrongAssertLogLine( ((lmrState->mSize == aLMR->GetLen()) || (lmrState->mState == SKV_LMR_STATE_BUSY)) ) << "skv_local_kv_rdma_data_buffer_t::ReleaseDataArea(): Protocol mismatch. LMR.len (" << aLMR->GetLen() << ") doesn't match stored buffer len (" << lmrState->mSize << "). entry@" << (uintptr_t)lmrState << " state: " << lmrState->mState << " != " << SKV_LMR_STATE_BUSY << " NIL[" << (uintptr_t)mLastBusy.GetPtr() << ":" << ((skv_lmr_wait_queue_t*)mLastBusy.GetPtr())->mSize << "]" << EndLogLine; // if LMR matches the oldest data buffer entry, release it, otherwise push it to the wait queue released = (( (char*)lmrState == mLastBusy.GetPtr() ) || ( ((skv_lmr_wait_queue_t*)mLastBusy.GetPtr())->mState != SKV_LMR_STATE_BUSY )); if( !released ) { BegLogLine( SKV_LOCAL_KV_RDMA_DATA_BUFFER_LOG ) << "ReleaseDataArea: deferring release of LMR[" << aLMR->GetAddr() << ":" << aLMR->GetLen() << "]" << " NIL[" << (uintptr_t)mLastBusy.GetPtr() << ":" << ((skv_lmr_wait_queue_t*)mLastBusy.GetPtr())->mSize << "]" << EndLogLine; } lmrState->mState = SKV_LMR_STATE_TORELEASE; while( released ) { skv_lmr_wait_queue_t *lmrToRelease = (skv_lmr_wait_queue_t*)mLastBusy.GetPtr(); released = (( lmrToRelease->mState == SKV_LMR_STATE_TORELEASE )); if( released ) { BegLogLine( 0 ) << "PONG [ " << mFirstFree.GetOffset() << " : " << mLastBusy.GetOffset() << " ]" << EndLogLine; BegLogLine(SKV_LOCAL_KV_RDMA_DATA_BUFFER_LOG ) << "ReleaseDataArea: oldEntry[" << (uintptr_t)lmrToRelease << ":" << lmrToRelease->mSize << "]" << " NIL[" << (uintptr_t)mLastBusy.GetPtr() << ":" << ((skv_lmr_wait_queue_t*)mLastBusy.GetPtr())->mSize << "]" << " mod_align:" << (lmrToRelease->mSize + mHeadSpace)%mAlignment << EndLogLine; mLastBusy = mLastBusy + (lmrToRelease->mSize + mHeadSpace); BegLogLine(SKV_LOCAL_KV_RDMA_DATA_BUFFER_LOG ) << "ReleaseDataArea: inc:" << (lmrToRelease->mSize + mHeadSpace) << "; newLast[" << (uintptr_t)mLastBusy.GetPtr()+mHeadSpace << ":" << ((skv_lmr_wait_queue_t*)mLastBusy.GetPtr())->mSize << "]" << EndLogLine; lmrToRelease->mState = SKV_LMR_STATE_FREE; lmrToRelease->mSize = 6666; } // else // BegLogLine( SKV_LOCAL_KV_RDMA_DATA_BUFFER_LOG ) // << "ReleaseDataArea: LB.state:" << lmrToRelease->mState // << " oldEntry[" << (uintptr_t)lmrToRelease+mHeadSpace << ":" << lmrToRelease->mSize << "]" // << " NIL[" << (uintptr_t)mLastBusy.GetPtr() << ":" << ((skv_lmr_wait_queue_t*)mLastBusy.GetPtr())->mSize << "]" // << " mod_align:" << (lmrToRelease->mSize + mHeadSpace)%mAlignment // << EndLogLine; } return SKV_SUCCESS; }
skv_status_t skv_server_network_event_manager_if_t:: Init( int aPartitionSize, int aRank ) { mMyRank = aRank; mPartitionSize = aPartitionSize; skv_configuration_t *SKVConfig = skv_configuration_t::GetSKVConfiguration(); /************************************************************ * Initialize the interface adapter ***********************************************************/ it_status_t itstatus = it_ia_create( VP_NAME, 2, 0, & mIA_Hdl ); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_server_t::Init():: ERROR:: Failed in it_ia_create() " << " VP_NAME: " << VP_NAME << " itstatus: " << itstatus << EndLogLine; itx_init_tracing( "skv_server", aRank ); /***********************************************************/ /************************************************************ * Initialize the protection zone ***********************************************************/ itstatus = it_pz_create( mIA_Hdl, & mPZ_Hdl); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_server_t::Init():: ERROR:: Failed in it_pz_create()" << " itstatus: " << itstatus << EndLogLine; /***********************************************************/ /************************************************************ * Initialize the Event Dispatchers (evds) ***********************************************************/ mAevd_Hdl = (it_evd_handle_t) IT_NULL_HANDLE; it_evd_flags_t evd_flags = (it_evd_flags_t) 0; #ifdef SKV_SERVER_USE_AGGREGATE_EVD BegLogLine(SKV_SERVER_NETWORK_EVENT_MANAGER_LOG) << "Creating aggregate event queue" << EndLogLine ; itstatus = it_evd_create( mIA_Hdl, IT_AEVD_NOTIFICATION_EVENT_STREAM, evd_flags, SKV_EVD_SEVD_QUEUE_SIZE, 1, NULL, & mAevd_Hdl, NULL ); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_server_t::Init():: ERROR:: Failed in it_evd_create()" << " itstatus: " << itstatus << EndLogLine; int itEventSize = sizeof( it_event_t ) * SKV_SERVER_AEVD_EVENTS_MAX_COUNT; mAevdEvents = (it_event_t *) malloc( itEventSize ); StrongAssertLogLine( mAevdEvents != NULL ) << "ERROR: " << " itEventSize: " << itEventSize << EndLogLine; #endif BegLogLine(SKV_SERVER_NETWORK_EVENT_MANAGER_LOG) << "Creating unaffiliated event queue" << EndLogLine ; itstatus = it_evd_create( mIA_Hdl, IT_ASYNC_UNAFF_EVENT_STREAM, evd_flags, SKV_EVD_SEVD_QUEUE_SIZE, 1, mAevd_Hdl, & mEvd_Unaff_Hdl, NULL ); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_server_t::Init():: ERROR:: Failed in it_evd_create()" << " itstatus: " << itstatus << EndLogLine; BegLogLine(SKV_SERVER_NETWORK_EVENT_MANAGER_LOG) << "Creating affiliated event queue" << EndLogLine ; itstatus = it_evd_create( mIA_Hdl, IT_ASYNC_AFF_EVENT_STREAM, evd_flags, SKV_EVD_SEVD_QUEUE_SIZE, 1, mAevd_Hdl, & mEvd_Aff_Hdl, NULL ); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_server_t::Init():: ERROR:: Failed in it_evd_create()" << " itstatus: " << itstatus << EndLogLine; // The EVD size here should depend int cmr_sevd_queue_size = aPartitionSize; BegLogLine(SKV_SERVER_NETWORK_EVENT_MANAGER_LOG) << "Creating mEvd_Cmr_Hdl event queue" << EndLogLine ; itstatus = it_evd_create( mIA_Hdl, IT_CM_REQ_EVENT_STREAM, evd_flags, cmr_sevd_queue_size, 1, mAevd_Hdl, & mEvd_Cmr_Hdl, NULL ); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_server_t::Init():: ERROR:: Failed in it_evd_create()" << " itstatus: " << itstatus << EndLogLine; int cmm_sevd_queue_size = aPartitionSize; BegLogLine(SKV_SERVER_NETWORK_EVENT_MANAGER_LOG) << "Creating mEvd_Cmm_Hdl event queue" << EndLogLine ; itstatus = it_evd_create( mIA_Hdl, IT_CM_MSG_EVENT_STREAM, evd_flags, cmm_sevd_queue_size, 1, mAevd_Hdl, & mEvd_Cmm_Hdl, NULL ); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_server_t::Init():: ERROR:: Failed in it_evd_create()" << " itstatus: " << itstatus << EndLogLine; #ifdef SKV_SERVER_USE_SINGLE_SEND_RECV_QUEUE int rq_sevd_queue_size = 3 * SKV_MAX_COMMANDS_PER_EP * aPartitionSize; #else int rq_sevd_queue_size = 2 * SKV_MAX_COMMANDS_PER_EP * aPartitionSize; #endif BegLogLine(SKV_SERVER_NETWORK_EVENT_MANAGER_LOG) << "Creating mEvd_Rq_Hdl event queue" << EndLogLine ; itstatus = it_evd_create( mIA_Hdl, IT_DTO_EVENT_STREAM, evd_flags, rq_sevd_queue_size, 1, mAevd_Hdl, & mEvd_Rq_Hdl, NULL ); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_server_t::Init():: ERROR:: Failed in it_evd_create()" << " itstatus: " << itstatus << EndLogLine; #ifdef SKV_SERVER_USE_SINGLE_SEND_RECV_QUEUE int sq_sevd_queue_size = rq_sevd_queue_size; mEvd_Sq_Hdl = mEvd_Rq_Hdl; #else int sq_sevd_queue_size = ( SKV_SERVER_SENDQUEUE_SIZE ) * aPartitionSize; BegLogLine( SKV_SERVER_NETWORK_EVENT_MANAGER_LOG ) << "skv_server_t::Init():: " << " PartitionSize: " << aPartitionSize << " sq_sevd_queue_size: " << sq_sevd_queue_size << EndLogLine; BegLogLine(SKV_SERVER_NETWORK_EVENT_MANAGER_LOG) << "Creating mEvd_Sq_Hdl event queue" << EndLogLine ; itstatus = it_evd_create( mIA_Hdl, IT_DTO_EVENT_STREAM, evd_flags, sq_sevd_queue_size, 1, mAevd_Hdl, & mEvd_Sq_Hdl, NULL ); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_server_t::Init():: ERROR:: Failed in it_evd_create()" << " itstatus: " << itstatus << EndLogLine; BegLogLine(SKV_SERVER_NETWORK_EVENT_MANAGER_LOG) << "Creating mEvd_Seq_Hdl event queue" << EndLogLine ; itstatus = it_evd_create( mIA_Hdl, IT_SOFTWARE_EVENT_STREAM, evd_flags, SKV_EVD_SEVD_QUEUE_SIZE, 1, mAevd_Hdl, & mEvd_Seq_Hdl, NULL ); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_server_t::Init():: ERROR:: Failed in it_evd_create()" << " itstatus: " << itstatus << EndLogLine; #endif BegLogLine( SKV_SERVER_NETWORK_EVENT_MANAGER_LOG ) << "skv_server_t::Init():: " << " mEvd_Unaff_Hdl: " << mEvd_Unaff_Hdl << " mEvd_Aff_Hdl: " << mEvd_Aff_Hdl << " mEvd_Cmr_Hdl: " << mEvd_Cmr_Hdl << " mEvd_Cmm_Hdl: " << mEvd_Cmm_Hdl << " mEvd_Rq_Hdl: " << mEvd_Rq_Hdl << " mEvd_Sq_Hdl: " << mEvd_Sq_Hdl << EndLogLine; /***********************************************************/ /************************************************************ * Initialize the listener ***********************************************************/ it_listen_flags_t lp_flags = IT_LISTEN_CONN_QUAL_INPUT; /* * TODO: it_listen_create() should be extended to allow binding * not only to a local port, but also to a local address. */ it_conn_qual_t conn_qual; conn_qual.type = IT_IANA_LR_PORT; conn_qual.conn_qual.lr_port.remote = 0; /* Irrelevant (not "any port")*/ #ifdef SKV_RUNNING_LOCAL int listen_attempts = aRank; #else int listen_attempts = 0; #endif do { conn_qual.conn_qual.lr_port.local = htons( (uint16_t)SKVConfig->GetSKVServerPort() + listen_attempts ); BegLogLine( SKV_SERVER_NETWORK_EVENT_MANAGER_LOG ) << "skv_server_t::Init(): attempting to listen:" << " aRank: " << aRank << " conn_qual.conn_qual.lr_port.local: " << conn_qual.conn_qual.lr_port.local << " config.port: " << SKVConfig->GetSKVServerPort() << EndLogLine; itstatus = it_listen_create( mIA_Hdl, 0 /* spigot_id */, mEvd_Cmr_Hdl, lp_flags, &conn_qual, &mLP_Hdl ); listen_attempts++; } while( (itstatus != IT_SUCCESS) && (listen_attempts < SKV_MAX_SERVER_PER_NODE) ); StrongAssertLogLine( itstatus == IT_SUCCESS ) << "skv_server_t::Init(): ERROR:: Failed in it_listen_create()" << " itstatus: " << itstatus << EndLogLine; // have to update the skv server in the config in case it has changed during listen attempts SKVConfig->SetSKVServerPort( ntohs(conn_qual.conn_qual.lr_port.local) ); /***********************************************************/ if( itstatus == IT_SUCCESS ) return SKV_SUCCESS; return SKV_ERRNO_UNSPECIFIED_ERROR; }
iWARPEM_Status_t InsertMessageVector( const iWARPEM_StreamId_t aClientId, struct iovec *aIOV, int aIOV_Count, int *aLen, bool aFirstIsHeader = true ) { iWARPEM_Status_t status = IWARPEM_SUCCESS; int i=0; *aLen = 0; // only create the msg header for the first vector iWARPEM_Message_Hdr_t *hdr = NULL; if( aFirstIsHeader ) { hdr = (iWARPEM_Message_Hdr_t*)aIOV[ 0 ].iov_base; *aLen += sizeof( iWARPEM_Message_Hdr_t ); i++; } int send_size = aIOV[ i ].iov_len; if( GetSendSpace() < send_size ) { status = FlushSendBuffer(); BegLogLine( FXLOG_IT_API_O_SOCKETS_MULTIPLEX_LOG ) << "Remaining space is too small. Sending existing data first.." << " req_size: " << send_size << " rem_space: " << GetSendSpace() << EndLogLine; } status = InsertMessage( aClientId, hdr, (char*)(aIOV[ i ].iov_base), aIOV[ i ].iov_len, true ); if( status == IWARPEM_SUCCESS ) *aLen += send_size; pthread_spin_lock( &mAccessLock ); i++; for( ; (i < aIOV_Count ) && ( status == IWARPEM_SUCCESS ); i++ ) { send_size = aIOV[ i ].iov_len; StrongAssertLogLine( send_size < GetSendSpace() ) << "Message vector entry " << i << " doesn't fit into send buffer. Space: " << GetSendSpace() << " requested: " << send_size << " already inserted: " << *aLen << EndLogLine; mSendBuffer->AddDataContigous( (const char*)aIOV[ i ].iov_base, aIOV[ i ].iov_len ); *aLen += send_size; } pthread_spin_unlock( &mAccessLock ); BegLogLine( FXLOG_IT_API_O_SOCKETS_MULTIPLEX_LOG ) << "Inserted Message Vector to send buffer: " << " ClientId: " << aClientId << " entries: " << aIOV_Count << " msg_size: " << *aLen << " bytes in buffer: " << mSendBuffer->GetDataLen() << EndLogLine; // initiate a send of data once we've filled up the buffer beyond a threshold if( mSendBuffer->FlushRecommended() ) status = FlushSendBuffer(); return status; }
static skv_status_t Execute( skv_client_conn_manager_if_t * aConnMgrIF, skv_client_server_conn_t* aConn, skv_client_ccb_t* aCCB ) { char* RecvBuff = aCCB->GetRecvBuff(); skv_server_to_client_cmd_hdr_t* Hdr = (skv_server_to_client_cmd_hdr_t *) RecvBuff; skv_client_command_state_t State = aCCB->mState; skv_client_event_t Event = Hdr->mEvent; BegLogLine( SKV_CLIENT_ACTIVE_BCAST_COMMAND_SM_LOG ) << " skv_client_active_bcast_command_sm::Execute(): Entering... " << " State: " << skv_client_command_state_to_string( State ) << " Event: " << skv_client_event_to_string( Event ) << EndLogLine; skv_status_t status = SKV_SUCCESS; switch( State ) { case SKV_CLIENT_COMMAND_STATE_IDLE: case SKV_CLIENT_COMMAND_STATE_DONE: { StrongAssertLogLine( 0 ) << "skv_client_active_bcast_command_sm::Execute(): ERROR: Invalid State: " << " State: " << skv_client_command_state_to_string( State ) << EndLogLine; break; } case SKV_CLIENT_COMMAND_STATE_WAITING_FOR_CMPL: { switch( Event ) { case SKV_CLIENT_EVENT_CMD_COMPLETE: { skv_cmd_active_bcast_resp_t* Resp = (skv_cmd_active_bcast_resp_t *) RecvBuff; skv_c2s_active_broadcast_func_type_t FuncType = aCCB->mCommand.mCommandBundle.mCommandActiveBcast.mFuncType; int NodeId = aCCB->mCommand.mCommandBundle.mCommandActiveBcast.mNodeId; // Extract the handle to the appropriate index/cursor // manager switch( FuncType ) { case SKV_ACTIVE_BCAST_DUMP_PERSISTENCE_IMAGE_FUNC_TYPE: { break; } default: { StrongAssertLogLine( 0 ) << "skv_client_active_bcast_command_sm::Execute(): ERROR: Invalid FuncType: " << " FuncType: " << FuncType << EndLogLine; break; } } BegLogLine( SKV_CLIENT_ACTIVE_BCAST_COMMAND_SM_LOG ) << " skv_client_active_bcast_command_sm::Execute(): " << " NodeId: " << NodeId << " Resp->mServerCursorHandle: " << (void *) Resp->mServerHandle << EndLogLine; aCCB->mStatus = Resp->mStatus; BegLogLine( SKV_CLIENT_ACTIVE_BCAST_COMMAND_SM_LOG ) << "skv_client_active_bcast_command_sm::Execute(): In final action block" << " status: " << skv_status_to_string( aCCB->mStatus ) << EndLogLine; Release( aConn, aCCB ); aCCB->Transit( SKV_CLIENT_COMMAND_STATE_DONE ); break; } case SKV_CLIENT_EVENT_ERROR: { // Server returned an error. skv_cmd_err_resp_t* ErrResp = (skv_cmd_err_resp_t *) RecvBuff; ErrResp->EndianConvert(); BegLogLine( SKV_CLIENT_ACTIVE_BCAST_COMMAND_SM_LOG ) << "skv_client_active_bcast_command_sm::Execute(): ERROR: response from server: " << " status: " << skv_status_to_string( ErrResp->mStatus ) << EndLogLine; aCCB->mStatus = ErrResp->mStatus; // Command is completed, release resources int CommandOrd = aCCB->GetCmdOrd(); aConn->ReleaseCmdOrdinal( CommandOrd ); aCCB->Transit( SKV_CLIENT_COMMAND_STATE_DONE ); break; } default: { StrongAssertLogLine( 0 ) << "skv_client_active_bcast_command_sm::Execute(): ERROR: Invalid Event: " << " Event: " << skv_client_event_to_string( Event ) << EndLogLine; break; } } break; } default: { StrongAssertLogLine( 0 ) << "skv_client_active_bcast_command_sm::Execute(): ERROR: Invalid State: " << " State: " << skv_client_command_state_to_string( State ) << EndLogLine; break; } } BegLogLine( SKV_CLIENT_ACTIVE_BCAST_COMMAND_SM_LOG ) << "skv_client_active_bcast_command_sm::Execute(): Leaving... " << EndLogLine; return status; }
static skv_status_t Execute( skv_client_conn_manager_if_t * aConnMgrIF, skv_client_server_conn_t* aConn, skv_client_ccb_t* aCCB ) { char* RecvBuff = aCCB->GetRecvBuff(); skv_server_to_client_cmd_hdr_t* Hdr = (skv_server_to_client_cmd_hdr_t *) RecvBuff; skv_client_command_state_t State = aCCB->mState; skv_client_event_t Event = Hdr->mEvent; BegLogLine( SKV_CLIENT_RETRIEVE_COMMAND_SM_LOG ) << "skv_client_retrieve_command_sm::Execute:: Entering... " << " State: " << skv_client_command_state_to_string( State ) << " Event: " << skv_client_event_to_string( Event ) << EndLogLine; skv_status_t status = SKV_SUCCESS; switch( State ) { case SKV_CLIENT_COMMAND_STATE_IDLE: case SKV_CLIENT_COMMAND_STATE_DONE: { StrongAssertLogLine( 0 ) << "skv_client_retrieve_command_sm::Execute:: ERROR:: Invalid State: " << " State: " << skv_client_command_state_to_string( State ) << EndLogLine; break; } case SKV_CLIENT_COMMAND_STATE_WAITING_FOR_VALUE_TX_ACK: { switch( Event ) { case SKV_CLIENT_EVENT_RDMA_WRITE_VALUE_ACK: { // Operation has completed. skv_cmd_retrieve_value_rdma_write_ack_t* Ack = (skv_cmd_retrieve_value_rdma_write_ack_t *) RecvBuff; int retrievedSize = Ack->mValue.mValueSize; // if the server indicates that there's more data, then only get the amount that fits into user buffer! if( Ack->mStatus == SKV_ERRNO_VALUE_TOO_LARGE ) { retrievedSize = aCCB->mCommand.mCommandBundle.mCommandRetrieve.mValueRequestedSize; // Ack->mStatus = SKV_SUCCESS; } // get value data out of response if flags indicate that it fit if( aCCB->mCommand.mCommandBundle.mCommandRetrieve.mFlags & SKV_COMMAND_RIU_RETRIEVE_VALUE_FIT_IN_CTL_MSG ) { void* valueBuffer = aCCB->mCommand.mCommandBundle.mCommandRetrieve.mValueBufferRef.mValueAddr; BegLogLine( SKV_CLIENT_RETRIEVE_COMMAND_SM_LOG ) << "skv_client_retrieve_command_sm::Execute(): about to copy retrieved data" << " uBuf: " << (void*)valueBuffer << " rBuf: " << (void*)Ack->mValue.mData << " size: " << retrievedSize << " CCB: " << (void*)aCCB << " value: " << (void*)(*(uint64_t*)(Ack->mValue.mData)) #ifdef SKV_DEBUG_MSG_MARKER << " msg: " << Ack->mHdr.mMarker #endif << EndLogLine; memcpy( valueBuffer, Ack->mValue.mData, retrievedSize ); } aCCB->mStatus = Ack->mStatus; // user wanted to know the actual retrieved size if( aCCB->mCommand.mCommandBundle.mCommandRetrieve.mValueRetrievedSize != NULL ) *aCCB->mCommand.mCommandBundle.mCommandRetrieve.mValueRetrievedSize = Ack->mValue.mValueSize; status = Release( aConn, aCCB ); AssertLogLine( status == SKV_SUCCESS ) << "skv_client_retrieve_command_sm::Execute():: ERROR:: Release failed: " << " status: " << status << EndLogLine; aCCB->Transit( SKV_CLIENT_COMMAND_STATE_DONE ); break; } case SKV_CLIENT_EVENT_ERROR: { // Server returned an error. skv_cmd_err_resp_t* ErrResp = (skv_cmd_err_resp_t *) RecvBuff; BegLogLine( SKV_CLIENT_RETRIEVE_COMMAND_SM_LOG ) << "skv_client_retrieve_command_sm::Execute:: ERROR response from server: " << " status: " << ErrResp->mStatus << EndLogLine; aCCB->mStatus = ErrResp->mStatus; status = Release( aConn, aCCB ); AssertLogLine( status == SKV_SUCCESS ) << "skv_client_retrieve_command_sm::Execute():: ERROR:: Release failed: " << " status: " << status << EndLogLine; aCCB->Transit( SKV_CLIENT_COMMAND_STATE_DONE ); break; } default: { StrongAssertLogLine( 0 ) << "skv_client_retrieve_command_sm::Execute:: ERROR:: Invalid State: " << " State: " << skv_client_command_state_to_string( State ) << " Event: " << skv_client_event_to_string( Event ) << EndLogLine; break; } } break; } default: { StrongAssertLogLine( 0 ) << "skv_client_retrieve_command_sm::ProcessCCB:: ERROR:: Invalid State: " << " State: " << skv_client_command_state_to_string( State ) << EndLogLine; break; } } BegLogLine( SKV_CLIENT_RETRIEVE_COMMAND_SM_LOG ) << "skv_client_retrieve_command_sm::Execute:: Leaving... " << EndLogLine; return status; }
static void AsyncProcessing( skv_local_kv_asyncmem *aBackEnd ) { BegLogLine( SKV_LOCAL_KV_ASYNCMEM_PROCESSING_LOG ) << "AsyncProcessing: Entering thread" << EndLogLine; double last_ts = MPI_Wtime(); skv_local_kv_request_queue_t* RequestQueue = aBackEnd->GetRequestQueue(); while( aBackEnd->KeepProcessing() ) { skv_status_t status; skv_local_kv_request_t *nextRequest = RequestQueue->GetRequest(); if( nextRequest ) { BegLogLine( SKV_LOCAL_KV_ASYNCMEM_PROCESSING_LOG ) << "Fetched LocalKV request: " << skv_local_kv_request_type_to_string( nextRequest->mType ) << EndLogLine; switch( nextRequest->mType ) { case SKV_LOCAL_KV_REQUEST_TYPE_OPEN: status = aBackEnd->PerformOpen( nextRequest ); break; case SKV_LOCAL_KV_REQUEST_TYPE_INFO: status = aBackEnd->PerformStat( nextRequest ); break; case SKV_LOCAL_KV_REQUEST_TYPE_CLOSE: status = aBackEnd->PerformClose( nextRequest ); break; case SKV_LOCAL_KV_REQUEST_TYPE_GET_DISTRIBUTION: status = aBackEnd->PerformGetDistribution( nextRequest ); break; case SKV_LOCAL_KV_REQUEST_TYPE_INSERT: status = aBackEnd->PerformInsert( nextRequest ); break; case SKV_LOCAL_KV_REQUEST_TYPE_LOOKUP: status = aBackEnd->PerformLookup( nextRequest ); break; case SKV_LOCAL_KV_REQUEST_TYPE_RETRIEVE: status = aBackEnd->PerformRetrieve( nextRequest ); break; case SKV_LOCAL_KV_REQUEST_TYPE_REMOVE: status = aBackEnd->PerformRemove( nextRequest ); break; case SKV_LOCAL_KV_REQUEST_TYPE_BULK_INSERT: status = aBackEnd->PerformBulkInsert( nextRequest ); break; case SKV_LOCAL_KV_REQUEST_TYPE_RETRIEVE_N: status = aBackEnd->PerformRetrieveNKeys( nextRequest ); break; case SKV_LOCAL_KV_REQUEST_TYPE_UNKNOWN: default: StrongAssertLogLine( 1 ) << "skv_local_kv_asyncmem:AsyncProcessing(): ERROR, unknown/unexpected Request type: " << (int)nextRequest->mType << EndLogLine; } RequestQueue->AckRequest( nextRequest ); } else { double current_ts = MPI_Wtime(); if( current_ts - last_ts > 0.2 ) { usleep(10000); last_ts = MPI_Wtime(); } } } BegLogLine( SKV_LOCAL_KV_ASYNCMEM_PROCESSING_LOG ) << "AsyncProcessing: Exiting thread" << EndLogLine; }
static skv_status_t Execute( skv_server_internal_event_manager_if_t* aEventQueueManager, skv_local_kv_t *aLocalKV, skv_server_ep_state_t *aEPState, int aCommandOrdinal, skv_server_event_t *aEvent, int *aSeqNo ) { skv_server_ccb_t* Command = aEPState->GetCommandForOrdinal( aCommandOrdinal ); skv_server_command_state_t State = Command->mState; // skv_server_event_type_t EventType = aEvent->mEventType; skv_server_event_type_t EventType = aEvent->mCmdEventType; BegLogLine( SKV_SERVER_RETRIEVE_DIST_LOG ) << "skv_server_retrieve_dist_command_sm::Execute:: " << " State: " << State << " EventType: " << EventType << " Command: " << (void *) Command << EndLogLine; switch( State ) { case SKV_SERVER_COMMAND_STATE_LOCAL_KV_INDEX_OP: { switch( EventType ) { case SKV_SERVER_EVENT_TYPE_LOCAL_KV_ERROR: case SKV_SERVER_EVENT_TYPE_LOCAL_KV_CMPL: { BegLogLine( SKV_SERVER_RETRIEVE_DIST_LOG ) << "skv_server_retrieve_dist_command_sm::Execute():: returned from async" << " PDSId: " << Command->mLocalKVData.mPDSOpen.mPDSId << EndLogLine; skv_status_t status = dist_post_response( aEPState, Command, aCommandOrdinal, aSeqNo, Command->mLocalKVrc, Command->mLocalKVData.mDistribution.mDist ); Command->Transit( SKV_SERVER_COMMAND_STATE_INIT ); break; } default: { StrongAssertLogLine( 0 ) << "skv_server_retrieve_dist_command_sm:: Execute():: ERROR: Event not recognized" << " CommandState: " << Command->mState << " EventType: " << EventType << EndLogLine; break; } } break; } case SKV_SERVER_COMMAND_STATE_INIT: { switch( EventType ) { case SKV_SERVER_EVENT_TYPE_IT_DTO_RETRIEVE_DIST_CMD: { AssertLogLine( sizeof(skv_cmd_retrieve_dist_resp_t) <= SKV_CONTROL_MESSAGE_SIZE ) << "skv_server_retrieve_dist_command_sm::Execute():: ERROR: " << " sizeof( skv_cmd_retrieve_dist_resp_t ): " << sizeof( skv_cmd_retrieve_dist_resp_t ) << " SKV_CONTROL_MESSAGE_SIZE: " << SKV_CONTROL_MESSAGE_SIZE << EndLogLine; skv_distribution_t *dist; skv_local_kv_cookie_t *cookie = &Command->mLocalKVCookie; cookie->Set( aCommandOrdinal, aEPState ); skv_status_t status = aLocalKV->GetDistribution( &dist, cookie ); switch( status ) { case SKV_ERRNO_LOCAL_KV_EVENT: create_multi_stage( aEPState, aLocalKV, Command, aCommandOrdinal ); Command->Transit( SKV_SERVER_COMMAND_STATE_LOCAL_KV_INDEX_OP ); break; case SKV_ERRNO_COMMAND_LIMIT_REACHED: create_multi_stage( aEPState, aLocalKV, Command, aCommandOrdinal ); aEventQueueManager->Enqueue( aEvent ); break; default: dist_post_response( aEPState, Command, aCommandOrdinal, aSeqNo, status, dist ); Command->Transit( SKV_SERVER_COMMAND_STATE_INIT ); } break; } default: { StrongAssertLogLine( 0 ) << "skv_server_retrieve_dist_command_sm:: Execute():: ERROR: Event not recognized" << " CommandState: " << Command->mState << " EventType: " << EventType << EndLogLine; break; } } break; } default: { StrongAssertLogLine( 0 ) << "skv_server_retrieve_dist_command_sm:: Execute():: ERROR: State not recognized" << " CommandState: " << Command->mState << EndLogLine; break; } } return SKV_SUCCESS; }
static skv_status_t Execute( skv_server_internal_event_manager_if_t* aEventQueueManager, skv_local_kv_t *aLocalKV, skv_server_ep_state_t* aEPState, int aCommandOrdinal, skv_server_event_t* aEvent, int* aSeqNo, int aMyRank ) { skv_server_ccb_t* Command = aEPState->GetCommandForOrdinal( aCommandOrdinal ); skv_server_command_state_t State = Command->mState; skv_server_event_type_t EventType = aEvent->mCmdEventType; BegLogLine( SKV_SERVER_INSERT_LOG ) << "skv_server_insert_command_sm::Execute():: Entering " << " Command: " << (void *) Command << " State: " << skv_server_command_state_to_string( State ) << " Event: " << skv_server_event_type_to_string( EventType ) << " Hdr: " << (void*) Command->GetSendBuff() << " Ord: " << aCommandOrdinal << EndLogLine; skv_status_t rc_status = SKV_SUCCESS; skv_status_t status; switch( State ) { case SKV_SERVER_COMMAND_STATE_INIT: { gSKVServerInsertEnter.HitOE( SKV_SERVER_INSERT_TRACE, "SKVServerInsertEnter", aMyRank, gSKVServerInsertEnter ); switch( EventType ) { case SKV_SERVER_EVENT_TYPE_IT_DTO_INSERT_CMD: { BegLogLine( SKV_SERVER_INSERT_LOG ) << "skv_server_insert_command_sm::Execute():: Entering action block for " << " State: " << skv_server_command_state_to_string( State ) << " Event: " << skv_server_event_type_to_string( EventType ) << " Ord: " << aCommandOrdinal << EndLogLine; skv_lmr_triplet_t ValueRepInStore; skv_local_kv_cookie_t *cookie = &Command->mLocalKVCookie; cookie->Set( aCommandOrdinal, aEPState ); skv_cmd_RIU_req_t *Req; status = insert_lookup_sequence( aLocalKV, Command, &Req, cookie, &ValueRepInStore ); BegLogLine( SKV_SERVER_INSERT_LOG ) << "skv_server_insert_command_sm::Lookup return status=" << skv_status_to_string( status ) << EndLogLine; switch( status ) { case SKV_ERRNO_RECORD_IS_LOCKED: case SKV_ERRNO_COMMAND_LIMIT_REACHED: status = insert_create_multi_stage( aEPState, aLocalKV, Command, aCommandOrdinal, Req ); aEventQueueManager->Enqueue( aEvent ); return status; case SKV_ERRNO_LOCAL_KV_EVENT: status = insert_create_multi_stage( aEPState, aLocalKV, Command, aCommandOrdinal, Req ); Command->Transit( SKV_SERVER_COMMAND_STATE_LOCAL_KV_INDEX_OP ); return status; case SKV_SUCCESS: case SKV_ERRNO_RECORD_ALREADY_EXISTS: case SKV_ERRNO_ELEM_NOT_FOUND: break; default: return status; } status = insert_sequence( aLocalKV, aEPState, Command, aCommandOrdinal, Req, status, aSeqNo, aMyRank, &ValueRepInStore ); switch ( status ) { case SKV_SUCCESS: /******************************************************************* * Command complete, ready to dispatch response to client ******************************************************************/ status = insert_command_completion( aLocalKV, status, aEPState, Req, Command, aCommandOrdinal, aSeqNo ); Command->Transit( SKV_SERVER_COMMAND_STATE_INIT ); break; case SKV_ERRNO_NEED_DATA_TRANSFER: /******************************************************************* * Issue an rdma read from the client ******************************************************************/ status = insert_create_multi_stage( aEPState, aLocalKV, Command, aCommandOrdinal, Req ); insert_post_rdma( aEPState, aLocalKV, aCommandOrdinal, Req, &ValueRepInStore, aSeqNo, aMyRank ); Command->Transit( SKV_SERVER_COMMAND_STATE_WAITING_RDMA_READ_CMPL ); break; case SKV_ERRNO_LOCAL_KV_EVENT: // insert requires multiple stages including going through async storage steps status = insert_create_multi_stage( aEPState, aLocalKV, Command, aCommandOrdinal, Req ); Command->Transit( SKV_SERVER_COMMAND_STATE_LOCAL_KV_DATA_OP ); break; case SKV_ERRNO_RECORD_ALREADY_EXISTS: // if record exists, we don't need to crash-exit, just return error to client status = insert_command_completion( aLocalKV, status, aEPState, Req, Command, aCommandOrdinal, aSeqNo ); Command->Transit( SKV_SERVER_COMMAND_STATE_INIT ); break; case SKV_ERRNO_COMMAND_LIMIT_REACHED: // insert requires multiple stages including going through async storage steps status = insert_create_multi_stage( aEPState, aLocalKV, Command, aCommandOrdinal, Req ); status = aEventQueueManager->Enqueue( aEvent ); break; default: BegLogLine( SKV_SERVER_INSERT_LOG ) << "skv_server_insert_command_sm::Execute()::ERROR in local insert" << " status: " << skv_status_to_string( status ) << EndLogLine; status = insert_command_completion( aLocalKV, status, aEPState, Req, Command, aCommandOrdinal, aSeqNo ); Command->Transit( SKV_SERVER_COMMAND_STATE_INIT ); } break; } default: { StrongAssertLogLine( 0 ) << "skv_server_insert_command_sm:: Execute():: ERROR: State not recognized" << " State: " << State << " EventType: " << EventType << EndLogLine; break; } } break; } case SKV_SERVER_COMMAND_STATE_LOCAL_KV_INDEX_OP: { switch( EventType ) { case SKV_SERVER_EVENT_TYPE_LOCAL_KV_CMPL: { BegLogLine( SKV_SERVER_INSERT_LOG ) << "skv_server_insert_command_sm::Execute():: Entering action block for " << " State: " << skv_server_command_state_to_string( State ) << " Event: " << skv_server_event_type_to_string( EventType ) << " Ord: " << aCommandOrdinal << EndLogLine; skv_cmd_RIU_req_t *Req = (skv_cmd_RIU_req_t *) Command->GetSendBuff(); status = insert_sequence( aLocalKV, aEPState, Command, aCommandOrdinal, Req, Command->mLocalKVrc, aSeqNo, aMyRank, &Command->mLocalKVData.mLookup.mValueRepInStore ); switch ( status ) { case SKV_SUCCESS: /******************************************************************* * Command complete, ready to dispatch response to client ******************************************************************/ status = insert_command_completion( aLocalKV, status, aEPState, Req, Command, aCommandOrdinal, aSeqNo ); Command->Transit( SKV_SERVER_COMMAND_STATE_INIT ); break; case SKV_ERRNO_NEED_DATA_TRANSFER: /******************************************************************* * Issue an rdma read from the client ******************************************************************/ insert_post_rdma( aEPState, aLocalKV, aCommandOrdinal, Req, &Command->mLocalKVData.mLookup.mValueRepInStore, aSeqNo, aMyRank ); Command->Transit( SKV_SERVER_COMMAND_STATE_WAITING_RDMA_READ_CMPL ); break; case SKV_ERRNO_LOCAL_KV_EVENT: Command->Transit( SKV_SERVER_COMMAND_STATE_LOCAL_KV_DATA_OP ); break; case SKV_ERRNO_RECORD_ALREADY_EXISTS: // if record exists, we don't need to crash-exit, just return error to client status = insert_command_completion( aLocalKV, status, aEPState, Req, Command, aCommandOrdinal, aSeqNo ); Command->Transit( SKV_SERVER_COMMAND_STATE_INIT ); break; case SKV_ERRNO_COMMAND_LIMIT_REACHED: status = aEventQueueManager->Enqueue( aEvent ); break; default: BegLogLine( SKV_SERVER_INSERT_LOG ) << "skv_server_insert_command_sm::Execute()::ERROR in local insert" << " status: " << skv_status_to_string( status ) << EndLogLine; status = insert_command_completion( aLocalKV, status, aEPState, Req, Command, aCommandOrdinal, aSeqNo ); Command->Transit( SKV_SERVER_COMMAND_STATE_INIT ); } break; } default: StrongAssertLogLine( 0 ) << "skv_server_insert_command_sm::Execute(): ERROR:: EventType not recognized. " << " EventType: " << EventType << EndLogLine; } break; } case SKV_SERVER_COMMAND_STATE_LOCAL_KV_DATA_OP: { switch( EventType ) { case SKV_SERVER_EVENT_TYPE_LOCAL_KV_CMPL: BegLogLine( SKV_SERVER_INSERT_LOG ) << "skv_server_insert_command_sm::Execute():: Entering action block for " << " State: " << skv_server_command_state_to_string( State ) << " Event: " << skv_server_event_type_to_string( EventType ) << " Ord: " << aCommandOrdinal << EndLogLine; if( Command->mLocalKVrc == SKV_ERRNO_NEED_DATA_TRANSFER ) { insert_post_rdma( aEPState, aLocalKV, aCommandOrdinal, (skv_cmd_RIU_req_t*)Command->GetSendBuff(), &Command->mLocalKVData.mRDMA.mValueRDMADest, aSeqNo, aMyRank ); Command->Transit( SKV_SERVER_COMMAND_STATE_WAITING_RDMA_READ_CMPL ); return SKV_SUCCESS; } gSKVServerInsertSendingRDMAReadAck.HitOE( SKV_SERVER_INSERT_TRACE, "SKVServerInsertRdmaRead", aMyRank, gSKVServerInsertSendingRDMAReadAck ); insert_command_completion( aLocalKV, Command->mLocalKVrc, aEPState, (skv_cmd_RIU_req_t *) Command->GetSendBuff(), Command, aCommandOrdinal, aSeqNo ); Command->Transit( SKV_SERVER_COMMAND_STATE_INIT ); break; default: StrongAssertLogLine( 0 ) << "skv_server_insert_command_sm::Execute(): ERROR:: EventType not recognized. " << " EventType: " << EventType << EndLogLine; } break; } case SKV_SERVER_COMMAND_STATE_WAITING_RDMA_READ_CMPL: { switch( EventType ) { case SKV_SERVER_EVENT_TYPE_IT_DTO_RDMA_READ_CMPL: { BegLogLine( SKV_SERVER_INSERT_LOG ) << "skv_server_insert_command_sm::Execute():: Entering action block for " << " State: " << skv_server_command_state_to_string( State ) << " Event: " << skv_server_event_type_to_string( EventType ) << " Ord: " << aCommandOrdinal << EndLogLine; skv_local_kv_cookie_t *cookie = &Command->mLocalKVCookie; cookie->Set( aCommandOrdinal, aEPState ); status = aLocalKV->InsertPostProcess( Command->mLocalKVData.mRDMA.mReqCtx, &(Command->mLocalKVData.mRDMA.mValueRDMADest), cookie ); if( status == SKV_ERRNO_LOCAL_KV_EVENT ) { Command->Transit(SKV_SERVER_COMMAND_STATE_LOCAL_KV_READY); return SKV_SUCCESS; } gSKVServerInsertSendingRDMAReadAck.HitOE( SKV_SERVER_INSERT_TRACE, "SKVServerInsertRdmaRead", aMyRank, gSKVServerInsertSendingRDMAReadAck ); insert_command_completion( aLocalKV, status, aEPState, (skv_cmd_RIU_req_t *) Command->GetSendBuff(), Command, aCommandOrdinal, aSeqNo ); Command->Transit( SKV_SERVER_COMMAND_STATE_INIT ); break; } default: { StrongAssertLogLine( 0 ) << "skv_server_insert_command_sm::Execute(): ERROR:: EventType not recognized. " << " EventType: " << EventType << EndLogLine; } } break; } case SKV_SERVER_COMMAND_STATE_LOCAL_KV_READY: { switch( EventType ) { case SKV_SERVER_EVENT_TYPE_LOCAL_KV_CMPL: BegLogLine( SKV_SERVER_INSERT_LOG ) << "skv_server_insert_command_sm::Execute():: Entering action block for " << " State: " << skv_server_command_state_to_string( State ) << " Event: " << skv_server_event_type_to_string( EventType ) << " Ord: " << aCommandOrdinal << EndLogLine; gSKVServerInsertSendingRDMAReadAck.HitOE( SKV_SERVER_INSERT_TRACE, "SKVServerInsertRdmaRead", aMyRank, gSKVServerInsertSendingRDMAReadAck ); insert_command_completion( aLocalKV, Command->mLocalKVrc, aEPState, (skv_cmd_RIU_req_t *) Command->GetSendBuff(), Command, aCommandOrdinal, aSeqNo ); Command->Transit( SKV_SERVER_COMMAND_STATE_INIT ); break; default: StrongAssertLogLine( 0 ) << "skv_server_insert_command_sm::Execute(): ERROR:: EventType not recognized. " << " EventType: " << EventType << EndLogLine; } break; } default: { StrongAssertLogLine( 0 ) << "skv_server_insert_command_sm:: Execute():: ERROR: State not recognized" << " State: " << State << EndLogLine; break; } } BegLogLine( SKV_SERVER_INSERT_LOG ) << "skv_server_insert_command_sm::Execute(): Exiting. Status: " << skv_status_to_string(rc_status) << EndLogLine; return rc_status; }