ClRcT clNodeCacheLeaderIocSend(ClIocNodeAddressT currentLeader, ClIocAddressT *dstAddr) { ClRcT rc = CL_OK; ClIocSendOptionT sendOption = {CL_IOC_HIGH_PRIORITY,0,0,CL_IOC_PERSISTENT_MSG,200 }; ClIocPhysicalAddressT compAddr = { CL_IOC_BROADCAST_ADDRESS, CL_IOC_CPM_PORT }; ClTimerTimeOutT delay = { 0, 200 }; ClUint32T i = 0; ClBufferHandleT message = 0; ClEoExecutionObjT *eoObj = NULL; ClIocNotificationT notification; memset(¬ification,0,sizeof(ClIocNotificationT)); notification.protoVersion = htonl(CL_IOC_NOTIFICATION_VERSION); notification.id = (ClIocNotificationIdT) htonl(CL_IOC_NODE_ARRIVAL_NOTIFICATION); notification.nodeAddress.iocPhyAddress.nodeAddress = htonl(clIocLocalAddressGet()); notification.nodeAddress.iocPhyAddress.portId = htonl(CL_IOC_GMS_PORT); clEoMyEoObjectGet(&eoObj); while(!eoObj && i++ <= 3) { clEoMyEoObjectGet(&eoObj); clOsalTaskDelay(delay); } if(!eoObj) { clLogWarning("CAP", "ARP", "Could not send current leader update since EO still uninitialized."); return CL_ERR_NOT_INITIALIZED; } clBufferCreate(&message); currentLeader = htonl(currentLeader); rc = clBufferNBytesWrite(message, (ClUint8T *)¬ification, sizeof(ClIocNotificationT)); rc |= clBufferNBytesWrite(message, (ClUint8T*)¤tLeader, sizeof(currentLeader)); if (rc != CL_OK) { clLogError("CAP", "ARP", "clBufferNBytesWrite failed with rc = %#x", rc); clBufferDelete(&message); return rc; } rc = clIocSend(eoObj->commObj, message, CL_IOC_PORT_NOTIFICATION_PROTO, dstAddr, &sendOption); clBufferDelete(&message); return rc; }
static ClRcT clLogSvrDsIdMapRecreate(ClUint32T dsId, ClAddrT pBuffer, ClUint32T buffSize, ClPtrT pCookie) { ClRcT rc = CL_OK; ClLogSvrEoDataT *pSvrEoEntry = NULL; ClBufferHandleT inMsg = CL_HANDLE_INVALID_VALUE; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == pBuffer), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((CL_LOG_DSID_START != dsId), CL_LOG_RC(CL_ERR_INVALID_PARAMETER)); rc = clLogSvrEoEntryGet(&pSvrEoEntry, NULL); if( CL_OK != rc ) { return rc; } rc = clBufferCreate(&inMsg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(inMsg, (ClUint8T *) pBuffer, buffSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); return rc; } rc = clXdrUnmarshallClUint32T(inMsg, &pSvrEoEntry->nextDsId); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrUnmarshallClUint32T(): rc[0x %x]\n", rc)); CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); return rc; } CL_LOG_DEBUG_VERBOSE(("DsIdCnt: %d", pSvrEoEntry->nextDsId)); rc = clLogBitmapUnpack(inMsg, pSvrEoEntry->hDsIdMap); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogBitmapUnpack(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); return rc; } CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clCpmEventPayLoadExtract(ClEventHandleT eventHandle, ClSizeT eventDataSize, ClCpmEventTypeT cpmEventType, void *payLoad) { ClRcT rc = CL_OK; ClBufferHandleT payLoadMsg = 0; void *eventData = NULL; eventData = clHeapAllocate(eventDataSize); if (eventData == NULL) { clLogWrite(CL_LOG_HANDLE_APP, CL_LOG_SEV_DEBUG, CL_CPM_CLIENT_LIB, CL_LOG_MESSAGE_0_MEMORY_ALLOCATION_FAILED); CPM_CLIENT_CHECK(CL_LOG_SEV_ERROR, ("Unable to malloc \n"), CL_CPM_RC(CL_ERR_NO_MEMORY)); } rc = clEventDataGet (eventHandle, eventData, &eventDataSize); if (rc != CL_OK) { clOsalPrintf("Event Data Get failed. rc=[0x%x]\n", rc); goto failure; } rc = clBufferCreate(&payLoadMsg); CL_CPM_CHECK_1(CL_LOG_SEV_ERROR, CL_CPM_LOG_1_BUF_CREATE_ERR, rc, rc, CL_LOG_HANDLE_APP); rc = clBufferNBytesWrite(payLoadMsg, (ClUint8T *)eventData, eventDataSize); CL_CPM_CHECK_1(CL_LOG_SEV_ERROR, CL_CPM_LOG_1_BUF_WRITE_ERR, rc, rc, CL_LOG_HANDLE_APP); switch(cpmEventType) { case CL_CPM_COMP_EVENT: rc = VDECL_VER(clXdrUnmarshallClCpmEventPayLoadT, 4, 0, 0)(payLoadMsg, payLoad); CL_CPM_CHECK_0(CL_LOG_SEV_ERROR, CL_LOG_MESSAGE_0_INVALID_BUFFER, rc, CL_LOG_HANDLE_APP); break; case CL_CPM_NODE_EVENT: rc = VDECL_VER(clXdrUnmarshallClCpmEventNodePayLoadT, 4, 0, 0)(payLoadMsg, payLoad); CL_CPM_CHECK_0(CL_LOG_SEV_ERROR, CL_LOG_MESSAGE_0_INVALID_BUFFER, rc, CL_LOG_HANDLE_APP); break; default: clOsalPrintf("Invalid event type received.\n"); goto failure; break; } failure: clBufferDelete(&payLoadMsg); clHeapFree(eventData); return rc; }
ClRcT clCorAmfMoIdGet(const ClCharT *name, ClAmsEntityTypeT type, ClCorMOIdT *pMoId) { ClAmsEntityT entity = {0}; ClBufferHandleT msg = 0; ClRcT rc = CL_OK; ClVersionT version = {'B', 0x1, 0x1}; ClCharT *data = NULL; ClUint32T dataLen = 0; ClCorObjectHandleT objHandle; if(!name || !pMoId) return CL_COR_SET_RC(CL_ERR_INVALID_PARAMETER); if(!mgmtHandle) { rc = clAmsMgmtInitialize(&mgmtHandle, NULL, &version); if(rc != CL_OK) return rc; } entity.type = type; clNameSet(&entity.name, name); ++entity.name.length; rc = clAmsMgmtEntityUserDataGetKey(mgmtHandle, &entity, &entity.name, &data, &dataLen); if(rc != CL_OK) { clLogError("FLT", "REPAIR", "Entity data get for [%s] returned [%#x]", entity.name.value, rc); goto out_free; } rc = clBufferCreate(&msg); CL_ASSERT(rc == CL_OK); rc = clBufferNBytesWrite(msg, (ClUint8T*)data, dataLen); CL_ASSERT(rc == CL_OK); rc = VDECL_VER(clXdrUnmarshallClCorMOIdT, 4, 0, 0)(msg, pMoId); CL_ASSERT(rc == CL_OK); clBufferDelete(&msg); clLogNotice("COR", "AMF", "MOID for faulty entity [%s] ", entity.name.value); clCorMoIdShow(pMoId); /* * Validating moid */ rc = clCorObjectHandleGet(pMoId, &objHandle); CL_ASSERT(rc == CL_OK); out_free: if(msg) clBufferDelete(&msg); if(data) clHeapFree(data); return rc; }
static ClRcT clLogMasterFileEntryRecover(ClLogMasterEoDataT *pMasterEoEntry, ClCkptIOVectorElementT *pIoVector, ClUint32T *pErrIndex) { ClRcT rc = CL_OK; ClBufferHandleT hFileEntryBuf = CL_HANDLE_INVALID_VALUE; ClVersionT version = {0}; CL_LOG_DEBUG_TRACE(("Enter: size %lld", pIoVector->readSize)); rc = clBufferCreate(&hFileEntryBuf); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(hFileEntryBuf, (ClUint8T*) pIoVector->dataBuffer, pIoVector->readSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&hFileEntryBuf), CL_OK); return rc; } rc = clXdrUnmarshallClVersionT(hFileEntryBuf, &version); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrUnmarshallClVersionT(): rc[%#x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&hFileEntryBuf), CL_OK); return rc; } switch(CL_VERSION_CODE(version.releaseCode, version.majorVersion, version.minorVersion)) { case CL_VERSION_CODE(CL_RELEASE_VERSION, CL_MAJOR_VERSION, CL_MINOR_VERSION): { rc = fileEntryRecoverBaseVersion(pMasterEoEntry, hFileEntryBuf); } break; default: rc = CL_LOG_RC(CL_ERR_VERSION_MISMATCH); clLogError("FILE", "RECOVER", "Version [%d.%d.%d] unsupported", version.releaseCode, version.majorVersion, version.minorVersion); break; } CL_LOG_CLEANUP(clBufferDelete(&hFileEntryBuf), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT VDECL(_corObjectGetNextOp) (ClUint32T cData, ClBufferHandleT inMsgHandle, ClBufferHandleT outMsgHandle) { ClRcT rc = CL_OK; corObjGetNextInfo_t* pData = NULL; CL_FUNC_ENTER(); if(gCorInitStage == CL_COR_INIT_INCOMPLETE) { clLogError("OBN", "EXP", "The COR server Initialization is in progress...."); return CL_COR_SET_RC(CL_COR_ERR_TRY_AGAIN); } pData = clHeapAllocate(sizeof(corObjGetNextInfo_t)); if(pData == NULL) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ( "NULL input parameter") ); return CL_COR_SET_RC(CL_COR_ERR_NULL_PTR); } if((rc = clXdrUnmarshallcorObjGetNextInfo_t(inMsgHandle, (void *)pData)) != CL_OK) { clHeapFree(pData); CL_DEBUG_PRINT(CL_DEBUG_ERROR,("Failed to Unmarshall corObjGetNextInfo_t")); return rc; } clCorClientToServerVersionValidate(version, rc); if(rc != CL_OK) { clHeapFree(pData); return CL_COR_SET_RC(CL_COR_ERR_VERSION_UNSUPPORTED); } switch(pData->operation) { case COR_OBJ_OP_NEXTMO_GET: { ClCorObjectHandleT nxtOH; rc = _clCorNextMOGet(pData->objHdl, pData->classId, pData->svcId, &nxtOH); /* Write to the message*/ clBufferNBytesWrite (outMsgHandle, (ClUint8T *)&nxtOH, sizeof(ClCorObjectHandleT)); } break; default: CL_DEBUG_PRINT(CL_DEBUG_ERROR, ( "INVALID OPERATION, rc = %x", rc) ); rc = CL_COR_SET_RC(CL_COR_ERR_INVALID_PARAM); break; } CL_FUNC_EXIT(); clHeapFree(pData); return rc; }
ClRcT clLogSODsIdMapRecreate(ClUint32T dsId, ClAddrT pBuffer, ClUint32T size, ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT msg = CL_HANDLE_INVALID_VALUE; ClLogSOEoDataT *pSoEoEntry = NULL; ClLogSvrCommonEoDataT *pCommonEoData = NULL; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((CL_LOG_SO_DSID_START != dsId), CL_LOG_RC(CL_ERR_INVALID_PARAMETER)); CL_LOG_PARAM_CHK((NULL == pBuffer), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clLogStreamOwnerEoEntryGet(&pSoEoEntry, &pCommonEoData); if( CL_OK != rc ) { return rc; } rc = clBufferCreate(&msg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(msg, (ClUint8T *) pBuffer, size); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesRead(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } rc = clXdrUnmarshallClUint32T(msg, &pSoEoEntry->dsIdCnt); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrUnmarshallClUint32T(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } CL_LOG_DEBUG_VERBOSE(("dsIdCnt : %d", pSoEoEntry->dsIdCnt)); rc = clLogBitmapUnpack(msg, pSoEoEntry->hDsIdMap); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit: rc[0x %x]", rc)); return rc; }
ClRcT clNameContextCkptDeserializer(ClUint32T dsId, ClAddrT pBuffer, ClUint32T size, ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT inMsg = 0; CL_NAME_DEBUG_TRACE(("Enter")); if( CL_NAME_CONTEXT_GBL_DSID != dsId ) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("dsId is not proper\n")); return CL_NS_RC(CL_ERR_INVALID_PARAMETER); } if( NULL == pBuffer ) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Passed Value is NULL")); return CL_NS_RC(CL_ERR_NULL_POINTER); } rc = clBufferCreate(&inMsg); if( CL_OK != rc ) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("clBufferCreate() : rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(inMsg, (ClUint8T *)pBuffer, size); if( CL_OK != rc ) { clBufferDelete(&inMsg); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("clBufferNBytesWrite(): rc[0x %x]", rc)); return rc; } rc = clNameContextCkptNameUnpack(inMsg); if( CL_OK != rc ) { clBufferDelete(&inMsg); return rc; } if( CL_OK != (rc = clBufferDelete(&inMsg)) ) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("clBufferDelete(): rc[0x %x]", rc)); } CL_NAME_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogMasterCompTableStateRecover(ClLogMasterEoDataT *pMasterEoEntry, ClUint8T *pBuffer, ClUint32T dataSize) { ClRcT rc = CL_OK; ClBufferHandleT msg = CL_HANDLE_INVALID_VALUE; ClUint32T versionCode = 0; CL_LOG_DEBUG_TRACE(("Enter")); rc = clBufferCreate(&msg); if(CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(msg, pBuffer, dataSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } rc = clXdrUnmarshallClUint32T(msg, &versionCode); if( CL_OK != rc) { CL_LOG_DEBUG_ERROR(("clXdrUnmarshallClUint32T(): rc[%#x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } switch(versionCode) { case CL_VERSION_CODE(CL_RELEASE_VERSION, CL_MAJOR_VERSION, CL_MINOR_VERSION): { rc = compTableStateRecoverBaseVersion(msg); } break; default: clLogError("COMP", "TBL-RECOVER", "Version [%d.%d.%d] is not supported", CL_VERSION_RELEASE(versionCode), CL_VERSION_MAJOR(versionCode), CL_VERSION_MINOR(versionCode)); rc = CL_LOG_RC(CL_ERR_VERSION_MISMATCH); } clBufferDelete(&msg); return rc; }
/** * Internal function to unpack saved state of a transaction * from checkpoint */ static ClRcT _clTxnServiceCkptTxnUnpack( CL_IN ClUint32T dataSetId, CL_IN ClAddrT pData, CL_IN ClUint32T dataLen, CL_IN ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT txnStateBuf; ClTxnDefnT *pTxnDefn; CL_FUNC_ENTER(); CL_DEBUG_PRINT(CL_DEBUG_TRACE, ("To unpack data-set 0x%x\n", dataSetId)); rc = clBufferCreate(&txnStateBuf); if (CL_OK == rc) { rc = clBufferNBytesWrite(txnStateBuf, (ClUint8T *)pData, dataLen); if (CL_OK == rc) { rc = clTxnStreamTxnCfgInfoUnpack(txnStateBuf, &pTxnDefn); } if ( (CL_OK == rc) && ((pTxnDefn->serverTxnId.txnId + CL_TXN_CKPT_TXN_DATA_SET_ID_OFFSET) == dataSetId) ) { /* Add this definition into txnDefnDb */ rc = clTxnRecoverySessionUpdate (pTxnDefn); } else { if (CL_OK == rc) rc = CL_ERR_INVALID_PARAMETER; } rc = clBufferDelete(&txnStateBuf); } if (CL_OK != rc) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Failed to extract transaction definition from data-set[0x%x], rc:0x%x", dataSetId, rc)); rc = CL_GET_ERROR_CODE(rc); } CL_FUNC_EXIT(); return (rc); }
ClRcT clDebugPrint(ClDebugPrintHandleT handle, const char* fmtStr, ...) { char buf[CL_DEBUG_MAX_PRINT]; char *space = buf; va_list args; ClRcT rc = CL_OK; ClBufferHandleT msg = (ClBufferHandleT)handle; ClInt32T c = 0, bytes = 0; /* * Estimate the space required for the buffer */ va_start(args, fmtStr); bytes = vsnprintf((ClCharT*)&c, 1, fmtStr, args); va_end(args); if(!bytes) goto failure; if(bytes >= sizeof(buf)) { space = clHeapCalloc(1, bytes + 1); CL_ASSERT(space != NULL); } va_start(args, fmtStr); vsnprintf(space, bytes+1, fmtStr, args); va_end(args); if (0 != msg) { rc = clBufferNBytesWrite(msg, (ClUint8T*)space, bytes); if (CL_OK != rc) { goto failure; } } else { rc = CL_DEBUG_RC(CL_ERR_INVALID_PARAMETER); goto failure; } failure: if(space != buf) clHeapFree(space); return rc; }
static ClRcT clLogSvrStreamEntryRecreate(ClUint32T dsId, ClAddrT pBuffer, ClUint32T buffSize, ClPtrT cookie) { ClRcT rc = CL_OK; ClLogSvrEoDataT *pSvrEoEntry = NULL; ClBufferHandleT inMsg = CL_HANDLE_INVALID_VALUE; ClLogSvrCommonEoDataT *pSvrCommonEoEntry = NULL; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == pBuffer), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clLogSvrEoEntryGet(&pSvrEoEntry, &pSvrCommonEoEntry); if( CL_OK != rc ) { return rc; } rc = clBufferCreate(&inMsg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(inMsg, (ClUint8T *) pBuffer, buffSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); return rc; } rc = clLogSvrStreamEntryUnpackNAdd(pSvrEoEntry, pSvrCommonEoEntry, inMsg, dsId); if( CL_OK != rc ) { CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); return rc; } CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogClntStreamListUnpack(ClUint32T numStreams, ClUint32T buffLen, ClUint8T *pBuffer, ClLogStreamInfoT **ppLogStreams) { ClRcT rc = CL_OK; ClBufferHandleT msg = CL_HANDLE_INVALID_VALUE; CL_LOG_DEBUG_TRACE(("Enter")); *ppLogStreams = clHeapCalloc(numStreams, sizeof(ClLogStreamInfoT)); if( NULL == *ppLogStreams ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); return CL_LOG_RC(CL_ERR_NO_MEMORY); } rc = clBufferCreate(&msg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); clHeapFree(*ppLogStreams); return rc; } rc = clBufferNBytesWrite(msg, pBuffer, buffLen); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); clHeapFree(*ppLogStreams); return rc; } rc = clLogClntStreamListGet(msg, *ppLogStreams); if( CL_OK != rc ) { CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); clHeapFree(*ppLogStreams); return rc; } CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
/** * Internal Function - extracts transaction-service state from checkpoint data-set */ static ClRcT _clTxnServiceCkptAppStateUnpack( CL_IN ClUint32T dataSetId, CL_IN ClAddrT pData, CL_IN ClUint32T dataLen, CL_IN ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT txnStateMsgBuf; ClUint32T txnIdCounter; CL_FUNC_ENTER(); CL_DEBUG_PRINT(CL_DEBUG_TRACE, ("To restore state of transaction-service\n")); rc = clBufferCreate(&txnStateMsgBuf); if (CL_OK == rc) { rc = clBufferNBytesWrite(txnStateMsgBuf, (ClUint8T *) pData, dataLen); if (CL_OK == rc) { rc = clXdrUnmarshallClUint32T(txnStateMsgBuf, &txnIdCounter); } if (CL_OK == rc) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Updating txnId Counter to 0x%x", txnIdCounter)); clTxnServiceCfg->txnIdCounter = txnIdCounter; } if (CL_OK != rc) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Failed to restore transaction service state. Could result in inconsistent operation. rc:0x%x", rc)); rc = CL_GET_ERROR_CODE(rc); } rc = clBufferDelete(&txnStateMsgBuf); } CL_FUNC_EXIT(); return (rc); }
ClRcT clLogSOStreamEntryRecreate(ClUint32T dsId, ClAddrT pBuffer, ClUint32T size, ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT msg = CL_HANDLE_INVALID_VALUE; ClLogSvrCommonEoDataT *pCommonEoData = NULL; CL_LOG_DEBUG_TRACE(("Enter")); rc = clLogStreamOwnerEoEntryGet(NULL, &pCommonEoData); if( CL_OK != rc ) { return rc; } rc = clBufferCreate(&msg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate()")); return rc; } rc = clBufferNBytesWrite(msg, (ClUint8T *) pBuffer, size); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); clBufferDelete(&msg); return rc; } rc = clLogSOStreamEntryUnpackNAdd(pCommonEoData, msg); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); if(CL_GET_ERROR_CODE(rc) == CL_ERR_DUPLICATE) rc = CL_OK; CL_LOG_DEBUG_TRACE(("Exit: rc[0x %x]", rc)); return rc; }
/** * Deserializer function for transaction state */ static ClRcT _clTxnServiceCkptTxnStateUnpack( CL_IN ClUint32T dataSetId, CL_IN ClAddrT pData, CL_IN ClUint32T dataLen, CL_IN ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT msgHandle; CL_FUNC_ENTER(); /* - If, from the restored txn-log, the txn is in intermediate state, add it to pending-recovery-list else, discard */ rc = clBufferCreate (&msgHandle); if (CL_OK == rc) { rc = clBufferNBytesWrite(msgHandle, (ClUint8T *)pData, dataLen); if (CL_OK == rc) { rc = clTxnRecoveryLogUnpack(msgHandle); } } if (CL_OK != rc) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Failed to extract transaction logs from ckpt. rc:0x%x", rc)); } CL_FUNC_EXIT(); return (rc); }
ClRcT _cpmClusterConfigList(ClInt32T argc, ClCharT **retStr) { ClCpmLT *cpmL = NULL; ClRcT rc = CL_OK; ClCntNodeHandleT hNode = 0; ClUint32T cpmLCount = 0; ClCharT tempStr[256]; ClCharT *tmpStr = NULL; ClBufferHandleT message; rc = clBufferCreate(&message); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to create message \n"), rc); if (argc != ONE_ARGUMENT) { sprintf(tempStr, "Usage: clusterList"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to write message %x\n", rc), rc); goto done; } /* * Print the local stuff first */ sprintf(tempStr, "%s\n", "nodeName | status | iocAddress | iocPort "); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); sprintf(tempStr, "%s\n", "-----------------------------------------------------------------------"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); /* * Now even the CPM/G information is stored in the list. * So no need of printing the above information. */ #if 0 if (gpClCpm->pCpmLocalInfo->status == CL_CPM_EO_DEAD) sprintf(tempStr, "%10s | DEAD | %8d | 0x%x\n", gpClCpm->pCpmLocalInfo->nodeName, gpClCpm->pCpmLocalInfo->cpmAddress.nodeAddress, gpClCpm->pCpmLocalInfo->cpmAddress.portId); else sprintf(tempStr, "%10s | ALIVE | %8d | 0x%x\n", gpClCpm->pCpmLocalInfo->nodeName, gpClCpm->pCpmLocalInfo->cpmAddress.nodeAddress, gpClCpm->pCpmLocalInfo->cpmAddress.portId); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); #endif /*_cpmListAllSU();*/ /* * Get all the CPMs one by one and delete the stuff. */ rc = clCntFirstNodeGet(gpClCpm->cpmTable, &hNode); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to get first cpmTable Node %x\n", rc), rc); rc = clCntNodeUserDataGet(gpClCpm->cpmTable, hNode, (ClCntDataHandleT *) &cpmL); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to get container Node data %x\n", rc), rc); cpmLCount = gpClCpm->noOfCpm; while (cpmLCount) { if (cpmL->pCpmLocalInfo != NULL) { if (cpmL->pCpmLocalInfo->status == CL_CPM_EO_DEAD) { sprintf(tempStr, "%10s | DEAD | %8d | 0x%x\n", cpmL->nodeName, cpmL->pCpmLocalInfo->cpmAddress.nodeAddress, cpmL->pCpmLocalInfo->cpmAddress.portId); } else { sprintf(tempStr, "%10s | ALIVE | %8d | 0x%x\n", cpmL->nodeName, cpmL->pCpmLocalInfo->cpmAddress.nodeAddress, cpmL->pCpmLocalInfo->cpmAddress.portId); } rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); } else { sprintf(tempStr, "%10s \n", cpmL->nodeName); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); } #if 0 rc = clCntFirstNodeGet(cpmL->suTable, &hSU); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to get first su Node in cpmL %x\n", rc), rc); if (cpmL->pCpmLocalInfo != NULL) clOsalPrintf("%10s | %8d | %8d | 0x%8x| 0x%8x \n", cpmL->pCpmLocalInfo->nodeName, cpmL->pCpmLocalInfo->status, cpmL->pCpmLocalInfo->nodeId, cpmL->pCpmLocalInfo->cpmAddress.nodeAddress, cpmL->pCpmLocalInfo->cpmAddress.portId); else clOsalPrintf("%10s \n", cpmL->nodeName); suCount = cpmL->noOfsu; while (suCount) { rc = clCntNodeUserDataGet(cpmL->suTable, hSU, (ClCntDataHandleT *) &su); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to get first container su Node data %x\n", rc), rc); clOsalPrintf("\t %10s |%15s |%11s |%16s \n", su->suName, _cpmPresenceStateNameGet(su->suPresenceState), _cpmOperStateNameGet(su->suOperState), _cpmReadinessStateNameGet(su->suReadinessState)); tempCompRef = su->suCompList; while (tempCompRef != NULL) { clOsalPrintf ("-----------------------------------------------------------------------\n"); clOsalPrintf("\t\t%10s %14d |%15s |%11s |%16s \n", tempCompRef->ref->compConfig->compName, tempCompRef->ref->compRestartCount, _cpmPresenceStateNameGet(tempCompRef->ref-> compPresenceState), _cpmOperStateNameGet(tempCompRef->ref-> compOperState), _cpmReadinessStateNameGet(tempCompRef->ref-> compReadinessState)); tempCompRef = tempCompRef->pNext; } suCount--; if (suCount) { rc = clCntNextNodeGet(cpmL->suTable, hSU, &hSU); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get Node Data \n"), rc); } } #endif sprintf(tempStr, "%s", "-----------------------------------------------------------------------\n"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); cpmLCount--; if (cpmLCount) { rc = clCntNextNodeGet(gpClCpm->cpmTable, hNode, &hNode); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get Node Data \n"), rc); rc = clCntNodeUserDataGet(gpClCpm->cpmTable, hNode, (ClCntDataHandleT *) &cpmL); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to get container Node data %d\n", rc), rc); } } /* * Bug 4986 : * Moved the code to NULL terminate the string * below the done: label, so that the usage string * written to the buffer is also NULL terminated. */ done: /* * NULL terminate the string */ sprintf(tempStr, "%s", "\0"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, 1); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); rc = clBufferFlatten(message, (ClUint8T **) &tmpStr); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to flatten message \n"), rc); *retStr = tmpStr; clBufferDelete(&message); return rc; failure: clBufferDelete(&message); return rc; }
ClRcT _clCpmComponentListAll(ClInt32T argc, ClCharT **retStr) { ClCntNodeHandleT hNode = 0; ClCpmComponentT *comp = NULL; ClUint32T rc = CL_OK, count; ClCpmEOListNodeT *eoList = NULL; ClCharT state[10] = "\0"; ClCharT status[10] = "\0"; ClCharT tempStr[256]; ClCharT *tmpStr = NULL; ClBufferHandleT message; ClCharT cpmCompName[CL_MAX_NAME_LENGTH] = {0}; rc = clBufferCreate(&message); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to create message %x\n", rc), rc); if (argc != ONE_ARGUMENT) { rc = clBufferNBytesWrite(message, (ClUint8T *) STR_AND_SIZE("Usage: compList")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to write message %x\n", rc), rc); rc = CL_CPM_RC(CL_ERR_INVALID_PARAMETER); goto done; } count = gpClCpm->noOfComponent; snprintf(cpmCompName, CL_MAX_NAME_LENGTH-1, "%s_%s", CL_CPM_COMPONENT_NAME, gpClCpm->pCpmLocalInfo->nodeName); rc = clCntFirstNodeGet(gpClCpm->compTable, &hNode); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get First component \n"), rc); rc = clBufferNBytesWrite(message, (ClUint8T *) STR_AND_SIZE("################### List Of Components ########################\n")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); rc = clCntNodeUserDataGet(gpClCpm->compTable, hNode,(ClCntDataHandleT *) &comp); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get Node Data \n"), rc); rc = clBufferNBytesWrite(message, STR_AND_SIZE(" CompName | compId | eoPort | PID | RestartCount | PresenceState\n")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); rc = clBufferNBytesWrite(message, STR_AND_SIZE("\t\t ID | Port | Name | Health |Recv Threads \n")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); rc = clBufferNBytesWrite(message, STR_AND_SIZE("========================================================================================\n")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); while (count) { if (strcmp(comp->compConfig->compName, cpmCompName)!=0) /* Skip if it is the CPM component */ { eoList = comp->eoHandle; int len = sprintf(tempStr, "%30s| 0x%x | 0x%x |%8d |%14d |%15s\n", comp->compConfig->compName, comp->compId, comp->eoPort, comp->processId, comp->compRestartCount, _cpmPresenceStateNameGet(comp->compPresenceState)); if (comp->compConfig->compProperty != CL_AMS_COMP_PROPERTY_SA_AWARE) { if(!eoList || !eoList->eoptr) { len += snprintf(tempStr + len, sizeof(tempStr) - len, "\t\t 0x%x | 0x%x |%10s |%10s |%04d \n", 0, 0, "-", "-", 0); } } rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr,len); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); while (eoList != NULL && eoList->eoptr != NULL) { compMgrStateStatusGet(eoList->status, eoList->eoptr->state, status, sizeof(status), state, sizeof(state)); int noOfThreads = (eoList->eoptr->appType == CL_EO_USE_THREAD_FOR_RECV) ? eoList->eoptr->noOfThreads + 1: eoList->eoptr->noOfThreads; int len = sprintf(tempStr, "\t\t 0x%llx | 0x%x |%10s |%10s |%04d \n", eoList->eoptr->eoID, eoList->eoptr->eoPort, eoList->eoptr->name, status, noOfThreads); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, len); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); eoList = eoList->pNext; } rc = clBufferNBytesWrite(message, STR_AND_SIZE("-----------------------------------------------------------------------------------------\n")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); } count--; if (count) { rc = clCntNextNodeGet(gpClCpm->compTable, hNode, &hNode); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to Get Node Data %x\n", rc), rc); rc = clCntNodeUserDataGet(gpClCpm->compTable, hNode, (ClCntDataHandleT *) &comp); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to Get Node user Data %x\n", rc), rc); } } /* * Bug 4986 : * Moved the code to NULL terminate the string * below the done: label, so that the usage string * written to the buffer is also NULL terminated. */ done: /* * NULL terminate the string */ rc = clBufferNBytesWrite(message, (ClUint8T *) "\0", 1); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); rc = clBufferFlatten(message, (ClUint8T **) &tmpStr); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to flatten the message \n"), rc); *retStr = tmpStr; clBufferDelete(&message); return rc; failure: clBufferDelete(&message); return rc; }
ClRcT clCpmExecutionObjectListShow(ClInt32T argc, ClIocNodeAddressT compAddr, ClUint32T flag, ClEoIdT eoId, ClCharT **retStr) { /* * ClCpmEOListNodeT* ptr = gpClCpm->eoList; */ ClCpmEOListNodeT *ptr = NULL; ClCharT name[32] = "\0"; ClCharT state[10] = "\0"; ClCharT status[10] = "\0"; ClUint32T compCount = 0; ClCntNodeHandleT hNode = 0; ClCpmComponentT *comp = NULL; ClRcT rc = CL_OK; ClCharT tempStr[256]; ClCharT *tmpStr = NULL; ClBufferHandleT message = 0; rc = clBufferCreate(&message); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to create message %x\n", rc), rc); if (argc != ONE_ARGUMENT) { sprintf(tempStr, "Usage: EOShow"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to write message %x\n", rc), rc); goto done; } sprintf(tempStr, "\n ID | Port | Name | Health | EO State | Recv Threads "); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to write message %x\n", rc), rc); sprintf(tempStr, "\n ===================================================================== "); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to write message %x\n", rc), rc); /* * take the semaphore */ if ((rc = clOsalMutexLock(gpClCpm->eoListMutex)) != CL_OK) CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Could not get Lock successfully------\n")); rc = clCntFirstNodeGet(gpClCpm->compTable, &hNode); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("Unable to Get First component \n"), rc); rc = clCntNodeUserDataGet(gpClCpm->compTable, hNode, (ClCntDataHandleT *) &comp); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("Unable to Get Node Data \n"), rc); compCount = gpClCpm->noOfComponent; while (compCount != 0) { ptr = comp->eoHandle; if (flag == 0) { while (ptr != NULL && ptr->eoptr != NULL) { strcpy(name, ptr->eoptr->name); /* * Obtain the state and status in string format */ compMgrStateStatusGet(ptr->status, ptr->eoptr->state, status, sizeof(status), state, sizeof(state)); if (ptr->eoptr->appType == CL_EO_USE_THREAD_FOR_RECV) sprintf(tempStr, "\n 0x%llx| 0x%x | %10s | %10s | %10s | %04d ", ptr->eoptr->eoID, ptr->eoptr->eoPort, name, status, state, (ptr->eoptr->noOfThreads + 1)); else sprintf(tempStr, "\n 0x%llx| 0x%x | %10s | %10s | %10s | %04d ", ptr->eoptr->eoID, ptr->eoptr->eoPort, name, status, state, ptr->eoptr->noOfThreads); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); ptr = ptr->pNext; } } else { while (ptr != NULL && ptr->eoptr != NULL) { if (ptr->eoptr->eoID == eoId) { /* * obtain the state and status in string format */ compMgrStateStatusGet(ptr->status, ptr->eoptr->state, status, sizeof(status), state, sizeof(state)); strcpy(name, ptr->eoptr->name); if (ptr->eoptr->appType == CL_EO_USE_THREAD_FOR_RECV) sprintf(tempStr, "\n 0x%llx| 0x%x | %10s | %10s | %10s | %04d | ", ptr->eoptr->eoID, ptr->eoptr->eoPort, name, status, state, ptr->eoptr->noOfThreads + 1); else sprintf(tempStr, "\n 0x%llx| 0x%x | %10s | %10s | %10s | %04d | ", ptr->eoptr->eoID, ptr->eoptr->eoPort, name, status, state, ptr->eoptr->noOfThreads); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); break; } ptr = ptr->pNext; } #if 0 if (ptr == NULL) CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("EOID not found\n")); #endif } compCount--; if (compCount) { rc = clCntNextNodeGet(gpClCpm->compTable, hNode, &hNode); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get Node Data \n"), rc); rc = clCntNodeUserDataGet(gpClCpm->compTable, hNode, (ClCntDataHandleT *) &comp); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get Node Data \n"), rc); } } /* * Release the semaphore */ rc = clOsalMutexUnlock(gpClCpm->eoListMutex); CL_CPM_CHECK(CL_DEBUG_ERROR, ("COMP_MGR: Could not UnLock successfully------\n"), rc); /* * Bug 4986 : * Moved the code to NULL terminate the string * below the done: label, so that the usage string * written to the buffer is also NULL terminated. */ done: /* * NULL terminate the string */ sprintf(tempStr, "%s", "\0"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, 1); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); /* * Construct the return buffer */ rc = clBufferFlatten(message, (ClUint8T **) &tmpStr); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to flatten the message \n"), rc); *retStr = tmpStr; clBufferDelete(&message); return (CL_OK); withlock: /* * Release the semaphore */ rc = clOsalMutexUnlock(gpClCpm->eoListMutex); CL_CPM_CHECK(CL_DEBUG_ERROR, ("COMP_MGR: Could not UnLock successfully------\n"), rc); failure: clBufferDelete(&message); return rc; }
static void gms_exec_message_handler ( void *message, unsigned int nodeid) { mar_req_header_t header = {0}; struct VDECL(req_exec_gms_nodejoin) req_exec_gms_nodejoin = {{0}}; ClGmsViewNodeT *node = NULL; ClRcT rc = CL_OK; ClGmsClusterMemberT thisGmsClusterNode = {0}; char nodeIp[256 * INTERFACE_MAX] = ""; int isLocalMsg = 0; int verCode = 0; ClBufferHandleT bufferHandle = NULL; /* Get the ip address string for the given nodeId */ strncpy(nodeIp, get_node_ip(nodeid), (256 * INTERFACE_MAX)-1); if (strcmp(nodeIp, totemip_print(this_ip)) == 0) { isLocalMsg = 1; } /* Unmarshall the incoming message */ rc = clBufferCreate(&bufferHandle); if (rc != CL_OK) { clLogError(OPN,AIS, "Failed to create buffer while unmarshalling the received message. rc 0x%x",rc); return; } memcpy(&header, message, sizeof(mar_req_header_t)); rc = clBufferNBytesWrite(bufferHandle, (ClUint8T *)message+sizeof(mar_req_header_t), header.size-sizeof(mar_req_header_t)); if (rc != CL_OK) { clLogError(OPN,AIS, "Failed to retrieve data from buffer. rc 0x%x",rc); goto out_delete; } rc = unmarshallReqExecGmsNodeJoin(bufferHandle, &req_exec_gms_nodejoin); if (rc != CL_OK) { clLogError(OPN,AIS,"Failed to unmarshall the data. rc 0x%x",rc); goto out_delete; } verCode = CL_VERSION_CODE(req_exec_gms_nodejoin.version.releaseCode, req_exec_gms_nodejoin.version.majorVersion, req_exec_gms_nodejoin.version.minorVersion); clLog(DBG,OPN,AIS, "Received a %d message from version [%d.%d.%d].",req_exec_gms_nodejoin.gmsMessageType, req_exec_gms_nodejoin.version.releaseCode, req_exec_gms_nodejoin.version.majorVersion, req_exec_gms_nodejoin.version.minorVersion); /* Verify version */ if (verCode > CL_VERSION_CODE(curVer.releaseCode, curVer.majorVersion, curVer.minorVersion)) { /* I received a message from higher version and it dont know * how to decode it. So it discarding it. */ clLog(NOTICE,OPN,AIS, "Version mismatch detected. Discarding the message "); goto out_delete; } // message type & message data clLog(DBG,OPN,AIS,"message type %d from groupId %d!\n", req_exec_gms_nodejoin.gmsMessageType, req_exec_gms_nodejoin.gmsGroupId); /* This message is from same version. So processing it */ switch (req_exec_gms_nodejoin.gmsMessageType) { case CL_GMS_CLUSTER_JOIN_MSG: { ClUint32T minVersion = CL_VERSION_CODE(5, 0, 0); clLog(DBG,OPN,AIS, "Received multicast message for cluster join from ioc node [%#x:%#x]", req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeAddress.iocPhyAddress.nodeAddress, req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeAddress.iocPhyAddress.portId); clNodeCacheMinVersionGet(NULL, &minVersion); if(minVersion >= CL_VERSION_CODE(5, 0, 0) && gAspNativeLeaderElection) { clLog(DBG, OPN, AIS, "Skipping multicast join since node cache view is used to form the cluster ring"); goto out_delete; } node = (ClGmsViewNodeT *) clHeapAllocate(sizeof(ClGmsViewNodeT)); if (node == NULL) { clLog (ERROR,OPN,AIS, "clHeapAllocate failed"); goto out_delete; } else { rc = clVersionVerify( &(gmsGlobalInfo.config.versionsSupported), &(req_exec_gms_nodejoin.specificMessage.gmsClusterNode.gmsVersion) ); ringVersion.releaseCode = req_exec_gms_nodejoin.specificMessage.gmsClusterNode.gmsVersion.releaseCode; ringVersion.majorVersion= req_exec_gms_nodejoin.specificMessage.gmsClusterNode.gmsVersion.majorVersion; ringVersion.minorVersion= req_exec_gms_nodejoin.specificMessage.gmsClusterNode.gmsVersion.minorVersion; if(rc != CL_OK) { ringVersionCheckPassed = CL_FALSE; /* copy the ring version */ clGmsCsLeave( &joinCs ); clLog (ERROR,OPN,AIS, "Server Version Mismatch detected for this join message"); break; } _clGmsGetThisNodeInfo(&thisGmsClusterNode); if( thisGmsClusterNode.nodeId != req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeId) { /* TODO This will never happen... */ clGmsCsLeave( &joinCs ); } node->viewMember.clusterMember = req_exec_gms_nodejoin.specificMessage.gmsClusterNode; /* If this is local join, then update the IP address */ if (thisGmsClusterNode.nodeId == req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeId) { memcpy(&node->viewMember.clusterMember.nodeIpAddress, &myAddress, sizeof(ClGmsNodeAddressT)); } rc = _clGmsEngineClusterJoin(req_exec_gms_nodejoin.gmsGroupId, req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeId, node); } } break; case CL_GMS_CLUSTER_EJECT_MSG: clLog (DBG,OPN,AIS, "Received cluster eject multicast message from ioc node [%#x:%#x]", req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeAddress.iocPhyAddress.nodeAddress, req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeAddress.iocPhyAddress.portId); /* inform the member about the eject by invoking the ejection * callback registered with the reason UKNOWN */ /* The below logic is same for the leave as well so we just * fall through the case */ _clGmsGetThisNodeInfo(&thisGmsClusterNode); if( req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeId == thisGmsClusterNode.nodeId) { rc = _clGmsCallClusterMemberEjectCallBack( req_exec_gms_nodejoin.ejectReason); if( rc != CL_OK ) { clLog(ERROR,OPN,AIS,"_clGmsCallEjectCallBack failed with" "rc:0x%x",rc); } } case CL_GMS_CLUSTER_LEAVE_MSG: clLog(DBG,OPN,AIS, "Received cluster leave multicast message from ioc node [%#x:%#x]", req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeAddress.iocPhyAddress.nodeAddress, req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeAddress.iocPhyAddress.portId); rc = _clGmsEngineClusterLeave(req_exec_gms_nodejoin.gmsGroupId, req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeId); break; case CL_GMS_GROUP_CREATE_MSG: clLog(DBG,OPN,AIS, "Received group create multicast message from ioc node [%#x:%#x]", req_exec_gms_nodejoin.specificMessage.groupMessage.gmsGroupNode.memberAddress.iocPhyAddress.nodeAddress, req_exec_gms_nodejoin.specificMessage.groupMessage.gmsGroupNode.memberAddress.iocPhyAddress.portId); rc = _clGmsEngineGroupCreate(req_exec_gms_nodejoin.specificMessage.groupMessage.groupData.groupName, req_exec_gms_nodejoin.specificMessage.groupMessage.groupData.groupParams, req_exec_gms_nodejoin.contextHandle, isLocalMsg); break; case CL_GMS_GROUP_DESTROY_MSG: clLog(DBG,OPN,AIS, "Received group destroy multicast message from ioc node [%#x:%#x]", req_exec_gms_nodejoin.specificMessage.groupMessage.gmsGroupNode.memberAddress.iocPhyAddress.nodeAddress, req_exec_gms_nodejoin.specificMessage.groupMessage.gmsGroupNode.memberAddress.iocPhyAddress.portId); rc = _clGmsEngineGroupDestroy(req_exec_gms_nodejoin.specificMessage.groupMessage.groupData.groupId, req_exec_gms_nodejoin.specificMessage.groupMessage.groupData.groupName, req_exec_gms_nodejoin.contextHandle, isLocalMsg); break; case CL_GMS_GROUP_JOIN_MSG: clLog(DBG,OPN,AIS, "Received group join multicast message from ioc node [%#x:%#x]", req_exec_gms_nodejoin.specificMessage.groupMessage.gmsGroupNode.memberAddress.iocPhyAddress.nodeAddress, req_exec_gms_nodejoin.specificMessage.groupMessage.gmsGroupNode.memberAddress.iocPhyAddress.portId); node = (ClGmsViewNodeT *) clHeapAllocate(sizeof(ClGmsViewNodeT)); if (!node) { log_printf (LOG_LEVEL_NOTICE, "clHeapAllocate failed"); goto out_delete; } else { /* FIXME: Need to verify version */ memcpy(&node->viewMember.groupMember,&req_exec_gms_nodejoin.specificMessage.groupMessage.gmsGroupNode, sizeof(ClGmsGroupMemberT)); memcpy(&node->viewMember.groupData, &req_exec_gms_nodejoin.specificMessage.groupMessage.groupData, sizeof(ClGmsGroupInfoT)); rc = _clGmsEngineGroupJoin(req_exec_gms_nodejoin.specificMessage.groupMessage.groupData.groupId, node, req_exec_gms_nodejoin.contextHandle, isLocalMsg); } break; case CL_GMS_GROUP_LEAVE_MSG: clLog(DBG,OPN,AIS, "Received group leave multicast message from ioc node [%#x:%#x]", req_exec_gms_nodejoin.specificMessage.groupMessage.gmsGroupNode.memberAddress.iocPhyAddress.nodeAddress, req_exec_gms_nodejoin.specificMessage.groupMessage.gmsGroupNode.memberAddress.iocPhyAddress.portId); rc = _clGmsEngineGroupLeave(req_exec_gms_nodejoin.specificMessage.groupMessage.groupData.groupId, req_exec_gms_nodejoin.specificMessage.groupMessage.gmsGroupNode.memberId, req_exec_gms_nodejoin.contextHandle, isLocalMsg); break; case CL_GMS_COMP_DEATH: clLog(DBG,OPN,AIS, "Received comp death multicast message"); rc = _clGmsRemoveMemberOnCompDeath(req_exec_gms_nodejoin.specificMessage.groupMessage.gmsGroupNode.memberId); break; case CL_GMS_LEADER_ELECT_MSG: clLog(DBG,OPN,AIS, "Received leader elect multicast message from ioc node [%#x:%#x]", req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeAddress.iocPhyAddress.nodeAddress, req_exec_gms_nodejoin.specificMessage.gmsClusterNode.nodeAddress.iocPhyAddress.portId); rc = _clGmsEnginePreferredLeaderElect(req_exec_gms_nodejoin.specificMessage.gmsClusterNode, req_exec_gms_nodejoin.contextHandle, isLocalMsg); break; case CL_GMS_SYNC_MESSAGE: clLog(DBG,OPN,AIS, "Received gms synch multicast message"); rc = _clGmsEngineGroupInfoSync((ClGmsGroupSyncNotificationT *)(req_exec_gms_nodejoin.dataPtr)); clHeapFree(((ClGmsGroupSyncNotificationT *)req_exec_gms_nodejoin.dataPtr)->groupInfoList); clHeapFree(((ClGmsGroupSyncNotificationT *)req_exec_gms_nodejoin.dataPtr)->groupMemberList); clHeapFree(req_exec_gms_nodejoin.dataPtr); break; case CL_GMS_GROUP_MCAST_MSG: _clGmsEngineMcastMessageHandler( &(req_exec_gms_nodejoin.specificMessage.mcastMessage.groupInfo.gmsGroupNode), &(req_exec_gms_nodejoin.specificMessage.mcastMessage.groupInfo.groupData), req_exec_gms_nodejoin.specificMessage.mcastMessage.userDataSize, req_exec_gms_nodejoin.dataPtr); break; default: clLogMultiline(ERROR,OPN,AIS, "Openais GMS wrapper received Message wih invalid [MsgType=%x]. \n" "This could be because of multicast port clashes.", req_exec_gms_nodejoin.gmsMessageType); goto out_delete; } clLog(TRACE,OPN,AIS, "Processed the received message. Returning"); out_delete: clBufferDelete(&bufferHandle); }
ClRcT VDECL(_corObjectWalkOp) (ClEoDataT cData, ClBufferHandleT inMsgHandle, ClBufferHandleT outMsgHandle) { ClRcT rc = CL_OK; corObjFlagNWalkInfoT* pData = NULL; CL_FUNC_ENTER(); if(gCorInitStage == CL_COR_INIT_INCOMPLETE) { clLogError("OBW", "EOF", "The COR server Initialization is in progress...."); return CL_COR_SET_RC(CL_COR_ERR_TRY_AGAIN); } pData = clHeapAllocate(sizeof(corObjFlagNWalkInfoT)); if(!pData) { clLogWrite(CL_LOG_HANDLE_APP, CL_LOG_DEBUG, gCorClientLibName, CL_LOG_MESSAGE_0_MEMORY_ALLOCATION_FAILED); CL_DEBUG_PRINT(CL_DEBUG_ERROR,(CL_COR_ERR_STR(CL_COR_ERR_NO_MEM))); return (CL_COR_SET_RC(CL_COR_ERR_NO_MEM)); } if((rc = VDECL_VER(clXdrUnmarshallcorObjFlagNWalkInfoT, 4, 0, 0)(inMsgHandle, (void *)pData)) != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Failed to Unmarshall corObjFlagNWalkInfoT")); clHeapFree(pData); return rc; } clCorClientToServerVersionValidate(pData->version, rc); if(rc != CL_OK) { clHeapFree(pData); return CL_COR_SET_RC(CL_COR_ERR_VERSION_UNSUPPORTED); } switch(pData->operation) { case COR_OBJ_WALK_DATA_GET: clOsalMutexLock(gCorMutexes.gCorServerMutex); #if 0 objHdlCount = 0; rc = _corObjectCountGet(&iCount); pObjHdlList = (char *) clHeapAllocate(iCount*sizeof(ClCorObjectHandleT)); if(pObjHdlList == NULL) { clHeapFree(pData); clOsalMutexUnlock(gCorMutexes.gCorServerMutex); clLogWrite(CL_LOG_HANDLE_APP, CL_LOG_DEBUG, NULL, CL_LOG_MESSAGE_0_MEMORY_ALLOCATION_FAILED); CL_DEBUG_PRINT(CL_DEBUG_ERROR,(CL_COR_ERR_STR(CL_COR_ERR_NO_MEM))); return CL_COR_SET_RC(CL_COR_ERR_NO_MEM); } clLogTrace("OBW", "EFN", "Going for the object walk now"); #endif rc = _clCorObjectWalk(&pData->moId, &pData->moIdWithWC, _corObjHdlListGet, pData->flags, outMsgHandle); if (CL_OK != rc) { clLogError("OBW", "EFN", "Failed to do the object walk on server. rc[0x%x]", rc); } #if 0 else { rc = clBufferNBytesWrite(outMsgHandle, (ClUint8T *)pObjHdlList, (ClUint32T)objHdlCount * sizeof(ClCorObjectHandleT)); if (CL_OK != rc) clLogError("OBW", "EFN", "Failed to write the object walk information into the out buffer. rc[0x%x]", rc); } clLogTrace("OBW", "EFN", "Done with the object walk"); clHeapFree(pObjHdlList); #endif clOsalMutexUnlock(gCorMutexes.gCorServerMutex); break; case COR_OBJ_SUBTREE_DELETE: clOsalMutexLock(gCorMutexes.gCorServerMutex); rc = _clCorSubTreeDelete(pData->moId); clOsalMutexUnlock(gCorMutexes.gCorServerMutex); break; default: CL_DEBUG_PRINT(CL_DEBUG_ERROR, ( "INVALID OPERATION, rc = %x", rc) ); rc = CL_COR_SET_RC(CL_COR_ERR_INVALID_PARAM); break; } CL_FUNC_EXIT(); clHeapFree(pData); return rc; }