STATUS DriveMonitorIsm::DM_Create_InstBSAVD(void *pClientContext, STATUS status) { DM_CR_CONTEXT* pCC = (DM_CR_CONTEXT *)pClientContext; TRACE_ENTRY(DM_Create_InstBSAVD); if ((status != ercKeyNotFound) && (status != ercEOF) && (status != OK)) return DM_Create_Bsa_End(pCC, status); TRACE_STRING(TRACE_L8, "\n\rDM_Create_InstBSAVD: Creating VDT entry"); RqOsVirtualMasterLoadVirtualDevice *pCreateBsaVDMsg; // Our failover partner's slot number TySlot MyFOP; if(config.flags & DM_FLAGS_REDUNDANT) MyFOP = Address::GetFopForIop(Address::iSlotMe); // DID of secondary DDM. else MyFOP = SLOTNULL; // There is no DID of secondary DDM. // Alloocate and construct a VirtualMasterLoadVirtualDevice message. // Mark the VD with the rowID of the DiskDescriptor that is creating it. // TODO: try to find our failover partner's slot number pCreateBsaVDMsg = new RqOsVirtualMasterLoadVirtualDevice( "HDM_BSA", // Class Name of VD. Address::iSlotMe, // Primary Slot. MyFOP, // Secondary Slot false, // fAutoStart RowId(m_BSAConfigRec.rid), // rid of VD's Config Record RowId(pCC->pDMState->ridDD) // Owner unique ID rid ); // Check the pointer and... if (!pCreateBsaVDMsg) // Set an error if null. status = CTS_OUT_OF_MEMORY; else // Send the message off to the Virtual Master. status = Send( pCreateBsaVDMsg, pCC, // void* pContext REPLYCALLBACK(DriveMonitorIsm, DM_Create_InstBSAVDReply) ); // Cleanup in the event of any error. if (status != OK) { CheckFreeAndClear(pCreateBsaVDMsg); status = DM_Create_Bsa_End(pCC, status); } return status; } // DM_Create_InstBSAVD
//************************************************************************ // LoadVirtualDevice // // Load Virtual Device // //************************************************************************ STATUS HelperServices ::LoadVirtualDevice( void *_pHelperContext, STATUS status) { HELPER_CONTEXT *pHelperContext = (HELPER_CONTEXT *)_pHelperContext; VirtualDeviceRecord *pVDRecord = (VirtualDeviceRecord *)pHelperContext->pData1; RqOsVirtualMasterLoadVirtualDevice *pCreateVDMsg = NULL; #ifdef WIN32 // just fake the vd create and return a dummy vd number status = CleanVDCreate(pHelperContext,status); return status; #else // If we could not find our VD in the VDT, then load the VD. if (status != OK) { // Alloocate and construct a VirtualMasterLoadVirtualDevice message. // Mark the VD with the rowID of the DiskDescriptor that is creating it. pCreateVDMsg = new RqOsVirtualMasterLoadVirtualDevice( pVDRecord->szClassName, // Class Name of VD. pVDRecord->slotPrimary, // Primary Slot. pVDRecord->slotSecondary, // Secondary Slot true, // fAutoStart RowId(pVDRecord->ridDdmCfgRec), // rid of VD's Config Record RowId(pVDRecord->ridVDOwnerUse) // Owner unique ID rid ); // Check the pointer and... if (!pCreateVDMsg) // Set an error if null. status = CTS_OUT_OF_MEMORY; else // Send the message off to the Virtual Master. status = Send(pCreateVDMsg, pHelperContext, REPLYCALLBACK(HelperServices, LoadVirtualDeviceReply) ); } // If the VD already exists, or we couldn't allocate msg, or // send returned a bad status, we are done with creation. if (status != OK) { CheckFreeAndClear(pCreateVDMsg); CleanVDCreate(pHelperContext,status); } return status; #endif }
StorageCollectionSparePool::StorageCollectionSparePool( ListenManager *pListenManager, DesignatorId hostId, ObjectManager *pManager ) :StorageCollection( pListenManager, SSAPI_OBJECT_CLASS_TYPE_STORAGE_COLL_SPARE_POOL, pManager){ m_id = DesignatorId( RowId(), SSAPI_OBJECT_CLASS_TYPE_STORAGE_COLL_SPARE_POOL, hostId.GetRowId().LoPart ); m_dedicatedHostId = hostId; m_isUsed = true; }
//************************************************************************ // // ReadStorageElementNameSRCReadReply // //************************************************************************ STATUS HelperServices:: ReadStorageElementNameSRCReadReply(void *_pContext, STATUS status) { HELPER_CONTEXT *pReadNameContext = (HELPER_CONTEXT *)_pContext; void *pOriginalContext = pReadNameContext->pParentContext; pTSCallback_t cb = pReadNameContext->pCallback; if (status != OS_DETAIL_STATUS_SUCCESS){ pReadNameContext->pData1 = NULL; // make sure we dont delete users mem pReadNameContext->pData2 = NULL; // make sure we dont delete users mem delete pReadNameContext; (m_pParentDdm->*cb)(pOriginalContext,OK); return status; } StorageRollCallRecord *pSRCRecord = (StorageRollCallRecord *)pReadNameContext->pData; UnicodeString *pUnicodeString = (UnicodeString *)pReadNameContext->pData1; // try to read the rid in the SRC Record status = m_pStringResourceManager->ReadString( pUnicodeString, RowId(pSRCRecord->ridName), cb, pOriginalContext); if (status == false){ HELPER_CONTEXT *pDiskDescriptorContext = NULL; // no name exists, so we better make sure that this is // a disk and get its unique identifier and fill it in the // our context switch(pSRCRecord->storageclass){ case SRCTypeFCDisk: case SRCTypeSSD: case SRCTypeRamDisk: pDiskDescriptorContext = new HELPER_CONTEXT; pDiskDescriptorContext->pParentContext = pOriginalContext; pDiskDescriptorContext->pCallback = cb; pDiskDescriptorContext->pData = new DiskDescriptor; pDiskDescriptorContext->pData1 = pReadNameContext->pData2; status = m_pTableServices->TableServiceReadRow( DISK_DESC_TABLE, &pSRCRecord->ridDescriptorRecord, pDiskDescriptorContext->pData, sizeof(DiskDescriptor), TSCALLBACK(HelperServices,ReadStorageElementNameDiskDescriptorReadReply), pDiskDescriptorContext); break; default: (m_pParentDdm->*cb)(pOriginalContext,OK); } } pReadNameContext->pData1 = NULL; // make sure we dont delete users mem pReadNameContext->pData2 = NULL; // make sure we dont delete users mem delete pReadNameContext; return status; }
void Sheet::insertRow(const RowId& newRowId /*= RowId()*/, const RowId& rowId /*= RowId()*/) { const RowId theIdForTheNewRow = newRowId.isNull() ? RowId(QUuid::createUuid()) : newRowId; Q_ASSERT(!theIdForTheNewRow.isNull()); const int index = rowId == RowId() ? m_rows.size() : findRow(rowId); Q_ASSERT(index >= 0); if (index >= 0) { m_rows.insert(index, theIdForTheNewRow); //initialize row Column* pColumn = NULL; foreach(pColumn, m_columns) pColumn->insertRow(theIdForTheNewRow, index); } }
UserManager::UserManager( ListenManager *pListenManager, DdmServices *pParent ) :ObjectManager( pListenManager, DesignatorId( RowId(), SSAPI_MANAGER_CLASS_TYPE_USER_MANAGER ), pParent ) { m_pUserTable = new ShadowTable( USER_ACCESS_TABLE_NAME, this, (ShadowTable::SHADOW_LISTEN_CALLBACK)METHOD_ADDRESS( UserManager, RowInsertedEventHandler ), (ShadowTable::SHADOW_LISTEN_CALLBACK)METHOD_ADDRESS( UserManager, RowDeletedEventHandler ), (ShadowTable::SHADOW_LISTEN_CALLBACK)METHOD_ADDRESS( UserManager, RowModifiedEventHandler ), sizeof(UserAccessTableEntry)); m_isIniting = true; m_shouldReinit = false; SetIsReadyToServiceRequests( false ); SSAPI_TRACE( TRACE_L2, "\nUserManager: Initializing....." ); DefineTable(); }
void StorageElementArray:: BuildYourselfFromPtsRow( RAID_ARRAY_DESCRIPTOR *pRow, ObjectManager *pManager ){ m_memberCapacity = pRow->memberCapacity * BLOCK_SIZE; m_dataBlockSize = pRow->dataBlockSize * BLOCK_SIZE; m_parityBlockSize = pRow->parityBlockSize * BLOCK_SIZE; m_peckingOrder = pRow->peckingOrder; m_isInited = pRow->initStatus == RAID_INIT_COMPLETE? true : false; m_serialNumber = pRow->serialNumber; m_creationTime = pRow->creationDate; m_hostSparePoolId = DesignatorId( RowId(pRow->hostForSparePool), SSAPI_OBJECT_CLASS_TYPE_HOST ); m_numberOfUtilsRunning = pRow->numberUtilities; m_numberOfMembers = pRow->numberMembers; m_numberOfSpares = pRow->numberSpares; memcpy( &m_members, &pRow->members, sizeof(rowID) * MAX_ARRAY_MEMBERS ); memcpy( &m_spares, &pRow->spares, sizeof(rowID) * MAX_ARRAY_SPARES ); m_status = pRow->health; m_arrayRid = pRow->thisRID; }
bool User::BuildYourselfFromPtsRow( UserAccessTableEntry *pRow ){ m_userName = UnicodeString( (char *)&pRow->userName ); m_password = UnicodeString( (char *)&pRow->password ); m_firstName = UnicodeString( (char *)&pRow->firstName ); m_lastName = UnicodeString( (char *)&pRow->lastName ); m_description = UnicodeString( (char *)&pRow->description ); m_email = UnicodeString( (char *)&pRow->email ); m_phoneNumber1 = UnicodeString( (char *)&pRow->phoneNumber1 ); m_phoneNumber2 = UnicodeString( (char *)&pRow->phoneNumber2 ); m_department = UnicodeString( (char *)&pRow->department ); m_id = DesignatorId( RowId(pRow->rid), (U16)GetClassType() ); m_language = pRow->language; m_securityPolicy= pRow->securityPolicy; m_numberOfInvalidLogins = pRow->numberOfInvalidLogins; return true; }
//************************************************************************ // // DeleteStorageElementNameSRCReadReply // //************************************************************************ STATUS HelperServices:: DeleteStorageElementNameSRCReadReply(void *_pContext, STATUS status) { HELPER_CONTEXT *pDeleteNameContext = (HELPER_CONTEXT *)_pContext; void *pOriginalContext = pDeleteNameContext->pParentContext; pTSCallback_t cb = pDeleteNameContext->pCallback; if (status != OS_DETAIL_STATUS_SUCCESS){ delete pDeleteNameContext; (m_pParentDdm->*cb)(pOriginalContext,OK); return status; } StorageRollCallRecord *pSRCRecord = (StorageRollCallRecord *)pDeleteNameContext->pData; // try to read the rid in the SRC Record status = m_pStringResourceManager->DeleteString( RowId(pSRCRecord->ridName), cb, pOriginalContext); delete pDeleteNameContext; return status; }
// pContext - the validation context // status - the message status // // Validation State Machine: // Read SRC1 // SRC1->fUsed? // Get PDT1 // Read SRC2 // if SRC2 // SRC2->fUsed? // Get PDT2 // else // CleanUp (handle failover happened after deleting SRC2) // partitions are contiguous? // PDT1's nextRowId != PDT2's nextRowId (handle failover happend after changing // pointers and before deleting any records from table //************************************************************************ STATUS DdmPartitionMstr:: ProcessMergePartitionValidationReply(void *_pContext, STATUS status) { PARTITION_CONTEXT *pValidationContext = NULL; PMSTR_MERGE_PARTITION_INFO *pMergePartitionInfo = NULL; PMSTR_CMND_INFO *pCmdInfo = NULL; PMSTR_CMND_PARAMETERS *pCmdParams = NULL; STATUS rc; StorageRollCallRecord *pSRCRecord1 = NULL; StorageRollCallRecord *pSRCRecord2 = NULL; PARTITION_DESCRIPTOR *pPDTRecord1 = NULL; PARTITION_DESCRIPTOR *pPDTRecord2 = NULL; PARTITION_DESCRIPTOR *pTempPDTRecord = NULL; BOOL validationComplete = false; rc = PMSTR_SUCCESS; pValidationContext = (PARTITION_CONTEXT *)_pContext; // pValidationContext->pData = cmdInfo // pData1 = SRC Record // pData2 = Partition record (maybe) // pData3 = NULL pCmdInfo = (PMSTR_CMND_INFO *)pValidationContext->pData; pCmdParams = &pCmdInfo->cmdParams; pMergePartitionInfo = (PMSTR_MERGE_PARTITION_INFO *)&pCmdParams->mergePartitionInfo; pSRCRecord1 = (StorageRollCallRecord *)pValidationContext->pData1; pSRCRecord2 = (StorageRollCallRecord *)pValidationContext->pData2; if ((status != ercKeyNotFound) && (status != OS_DETAIL_STATUS_SUCCESS)) { rc = PMSTR_ERR_INVALID_COMMAND; validationComplete = true; } else { switch(pValidationContext->state) { case MERGE_PARTITION_VALIDATION_SRCT1_RECORD_READ: if(RowId(pSRCRecord1->rid) != 0) { if (pSRCRecord1->fUsed) { rc = PMSTR_ERR_STORAGE_ELEMENT_USED; } else { // Get the PDT associated with the SRC's m_pDataQueue->Get( PMSTR_PARTITION, &pSRCRecord1->ridDescriptorRecord, (void **)&pTempPDTRecord, sizeof(PARTITION_DESCRIPTOR)); if (pTempPDTRecord) { pValidationContext->pData3 = new (tZERO) PARTITION_DESCRIPTOR; memcpy( pValidationContext->pData3, pTempPDTRecord, sizeof(PARTITION_DESCRIPTOR)); } else { rc = PMSTR_ERR_INVALID_COMMAND; } } } else { rc = PMSTR_ERR_INVALID_COMMAND; } pValidationContext->state = MERGE_PARTITION_VALIDATION_SRCT2_RECORD_READ; pValidationContext->pData2 = new(tZERO) StorageRollCallRecord; // read SRC2 Record status = m_pTableServices->TableServiceReadRow( STORAGE_ROLL_CALL_TABLE, &pMergePartitionInfo->srcPartitionRowId2, pValidationContext->pData2, sizeof(StorageRollCallRecord), TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionValidationReply), pValidationContext); break; case MERGE_PARTITION_VALIDATION_SRCT2_RECORD_READ: if (RowId(pSRCRecord2->rid) != 0) { if (pSRCRecord2->fUsed) { rc = PMSTR_ERR_STORAGE_ELEMENT_USED; } else { // Get PDT2 pTempPDTRecord = NULL; m_pDataQueue->Get( PMSTR_PARTITION, &pSRCRecord2->ridDescriptorRecord, (void **)&pTempPDTRecord, sizeof(PARTITION_DESCRIPTOR)); if (pTempPDTRecord) { pValidationContext->pData4 = new (tZERO) PARTITION_DESCRIPTOR; memcpy( pValidationContext->pData4, pTempPDTRecord, sizeof(PARTITION_DESCRIPTOR)); } else { // we will still try to update ptrs on // the first partition (possibly failover) ; } } } // Handle failover happend after deleting SRC2 // If SRC2 does not exist, if the cmd is same as the previous one, // Call CleanUp to delete SRC1 and PDT1 only. PDT2 deleted in Initialization // already since SRC2 could not be found. else { if(memcmp(&((PARTITION_DESCRIPTOR *)(pValidationContext->pData2))->stateIdentifier.cmdRowId,(rowID *)pValidationContext->cmdHandle, sizeof(rowID))) { // Resolve: Get SRC2 and PDT2 records from a Table and pass to CleanUp // In CleanUp, use these records to report event to SSAPI. // If can not find SRC2 from that Table, reject this cmd. How can // we report delete SRC2 event? pValidationContext->state = MERGE_PARTITION_SRC2_RECORD_DELETED; status = CleanUpReply(pValidationContext,OK); return status; } else { rc = PMSTR_ERR_INVALID_COMMAND; } } if (rc == PMSTR_SUCCESS) { pPDTRecord1 = (PARTITION_DESCRIPTOR *)pValidationContext->pData3; pPDTRecord2 = (PARTITION_DESCRIPTOR *)pValidationContext->pData4; // if both records are there, then only validate // else we try to at least update pointers if (pPDTRecord1 && pPDTRecord2) { // check if the partitions supplied are contiguous // Handle failover happened after changing pointers and before // deleting any records from table. if (RowId(pPDTRecord1->nextRowId) != RowId(pPDTRecord2->SRCTRID)&&RowId(pPDTRecord1->nextRowId) != RowId(pPDTRecord2->nextRowId)) { if (RowId(pPDTRecord2->previousRowId) != RowId(pPDTRecord1->SRCTRID)) { if (RowId(pPDTRecord1->previousRowId) != RowId(pPDTRecord2->SRCTRID)) { if (RowId(pPDTRecord2->nextRowId) != RowId(pPDTRecord1->SRCTRID)&&RowId(pPDTRecord2->nextRowId) != RowId(pPDTRecord1->nextRowId)) { rc = PMSTR_ERR_INVALID_COMMAND; } } } } } } if (rc == PMSTR_SUCCESS) { // all error checking is done, issue the create partition cmd MergePartition( pValidationContext->cmdHandle, pCmdInfo, pSRCRecord1, pSRCRecord2, pPDTRecord1, pPDTRecord2); } validationComplete = true; break; default: rc = PMSTR_ERR_INVALID_COMMAND; validationComplete = true; break; } } if (validationComplete) { if(rc) { // Report error to CmdSender m_pCmdServer->csrvReportCmdStatus( pValidationContext->cmdHandle, // handle rc, // completion code NULL, // result Data (void *)pCmdInfo); // pCmdInfo StopCommandProcessing(true, pValidationContext->cmdHandle); } if (pValidationContext) { delete pValidationContext; pValidationContext = NULL; } } return status; }
////////////////////////////////////////////////////////////////////// // // Change Array Name Reply Handler // ////////////////////////////////////////////////////////////////////// STATUS DdmRAIDMstr:: ProcessChangeArrayNameReply(void *_pCmdContext, STATUS status) { RMSTR_CHANGE_ARRAY_NAME_INFO *pChangeArrayNameInfo = NULL; RMSTR_CMND_INFO *pCmdInfo = NULL; RMSTR_CMND_PARAMETERS *pCmdParams = NULL; STATUS rc = RMSTR_SUCCESS; BOOL cmdComplete = false; CONTEXT *pCmdContext = NULL; RAID_ARRAY_DESCRIPTOR *pADTRecord = NULL; RMSTR_EVT_ARRAY_NAME_CHANGED_STATUS *pEvtArrayNameChanged = NULL; UnicodeString ucNewArrayName; pCmdContext = (CONTEXT *)_pCmdContext; pCmdInfo = (RMSTR_CMND_INFO *)pCmdContext->pData; pCmdParams = &pCmdInfo->cmdParams; pChangeArrayNameInfo = (RMSTR_CHANGE_ARRAY_NAME_INFO *)&pCmdParams->changeArrayNameInfo; pADTRecord = (RAID_ARRAY_DESCRIPTOR *)pCmdContext->pData1; if (status != OS_DETAIL_STATUS_SUCCESS){ rc = RMSTR_ERR_INVALID_COMMAND; cmdComplete = true; } else { switch(pCmdContext->state){ case CHANGE_NAME_ARRAY_NAME_READ: // old array name is read into m_ucArrayName // Delete the old name from the table pCmdContext->state = CHANGE_NAME_OLD_NAME_DELETED; m_pStringResourceManager->DeleteString( RowId(pADTRecord->arrayNameRID), (pTSCallback_t)&DdmRAIDMstr::ProcessChangeArrayNameReply, pCmdContext); break; case CHANGE_NAME_OLD_NAME_DELETED: // Now write the new array name into the table ucNewArrayName = UnicodeString( pChangeArrayNameInfo->newName); pCmdContext->state = CHANGE_NAME_NEW_NAME_WRITTEN; m_pStringResourceManager->WriteString( ucNewArrayName, &pADTRecord->arrayNameRID, (pTSCallback_t)&DdmRAIDMstr::ProcessChangeArrayNameReply, pCmdContext); break; case CHANGE_NAME_NEW_NAME_WRITTEN: pCmdContext->state = CHANGE_NAME_ADT_RECORD_UPDATED; status = m_pTableServices->TableServiceModifyRow( RAID_ARRAY_DESCRIPTOR_TABLE, &pADTRecord->thisRID, // row id to modify pADTRecord, sizeof(RAID_ARRAY_DESCRIPTOR), &pADTRecord->thisRID, (pTSCallback_t)&DdmRAIDMstr::ProcessChangeArrayNameReply, pCmdContext); break; case CHANGE_NAME_ADT_RECORD_UPDATED: // cmd is complete, report the status and generate event ModifyRmstrData( RAID_ARRAY, &pADTRecord->thisRID, pADTRecord); cmdComplete = true; break; default: break; } } if (cmdComplete){ // Report the status of the change array name m_pCmdServer->csrvReportCmdStatus( pCmdContext->cmdHandle, // handle rc, // completion code NULL, // result Data (void *)pCmdInfo); // Orig cmd info if (rc == RMSTR_SUCCESS){ // Generate event for Array Name Changed pEvtArrayNameChanged = new RMSTR_EVT_ARRAY_NAME_CHANGED_STATUS; memset(pEvtArrayNameChanged,0,sizeof(RMSTR_EVT_ARRAY_NAME_CHANGED_STATUS)); pEvtArrayNameChanged->arrayRowId = pChangeArrayNameInfo->arrayRowId; // Copy the old and new name back to the event // Copy the Array Name back in the event m_ucArrayName.CString( pEvtArrayNameChanged->oldName, sizeof(UnicodeString32)); UnicodeString ucNewArrayName = UnicodeString( pChangeArrayNameInfo->newName); ucNewArrayName.CString( pEvtArrayNameChanged->newName, sizeof(UnicodeString32)); m_pCmdServer->csrvReportEvent( RMSTR_EVT_ARRAY_NAME_CHANGED, // completion code pEvtArrayNameChanged); // event Data delete pEvtArrayNameChanged; pEvtArrayNameChanged = NULL; } StopCommandProcessing(true, pCmdContext->cmdHandle); delete pCmdContext; } return status; }
User::User( ListenManager *pListenManager ) :ManagedObject( pListenManager, SSAPI_OBJECT_CLASS_TYPE_USER ){ // m_pOpenSessions = new SList; m_manager = DesignatorId( RowId(), SSAPI_MANAGER_CLASS_TYPE_USER_MANAGER ); }
STATUS ShadowTable::InitializeReplyHandler( void *pContext_, STATUS rc ) { CONTEXT *pContext = (CONTEXT *)pContext_; switch( pContext->state ) { case READ_TABLE_DEF: // collect data and do clean-up if( rc != OK ) { Trace( (StringClass)"GetTableDef failed", ST_CRITICAL ); (m_pParentDdm->*(pContext->pCallback))( pContext->pCallersContext, rc ); delete pContext->pNumOfCols; delete pContext->pBytesPerRow; delete pContext->pNumOfRows; delete pContext->pFieldDef; delete pContext->pFieldDefSize; delete pContext; LogFailure( "ReadTableDef", rc ); break; } m_numberOfCols = *pContext->pNumOfCols; delete pContext->pNumOfCols; m_bytesPerRow = *pContext->pBytesPerRow; delete pContext->pBytesPerRow; m_numberOfRows = *pContext->pNumOfRows; delete pContext->pNumOfRows; m_pFieldDef = new fieldDef[ m_numberOfCols ]; memcpy( m_pFieldDef, pContext->pFieldDef, *pContext->pFieldDefSize ); delete pContext->pFieldDef; delete pContext->pFieldDefSize; // callback to report the GOOOOOOD news :-) m_isInited = true; (m_pParentDdm->*(pContext->pCallback))( pContext->pCallersContext, OK ); delete pContext; break; case INIT_LISTENERS: if( !m_areListenersInited ) { // report status if( rc != OK ) { Trace( (StringClass)"Register listeners failed", ST_CRITICAL ); (m_pParentDdm->*(pContext->pCallback))( pContext->pCallersContext, rc ); delete pContext; LogFailure("RegisterListener", rc ); break; } // do final clean-up m_areListenersInited = true; break; } else ; default: // PTS listen reply // TBDGAI: // this whole thing should be redone on real system. // make sure the memory is allocated by the transport, not me // and calculate the number of rows affected, now it's hardcoded to 1. if( *m_pListenTypeRet & ListenOnInsertRow ) { if( m_isInited ) m_numberOfRows++; (m_pParentDdm->*m_insertRowCallback)( m_pModifiedRecord, 1, this); } else if( *m_pListenTypeRet & ListenOnDeleteAnyRow ) { if( m_isInited ) m_numberOfRows--; (m_pParentDdm->*m_deleteRowCallback)( m_pModifiedRecord, 1, this); } else if( *m_pListenTypeRet & ListenOnModifyAnyRowAnyField ) { m_numberOfRows = m_numberOfRows; #if 0 // find the new rows by the row ids of the old ones and return them\ // TBDGAI: 1 is a hack now! But NOT the 1 when we do callback, this one is correct, // we do one at a time on this listen type rowID *pOldId = (rowID *)m_pModifiedRecord, *pNewId; for( U32 ridNum = 0; ridNum < 1; ridNum++, pOldId = (rowID *)((char *)pOldId + m_bytesPerRow ) ) { pNewId = (rowID *)m_pTableDataRet; for( U32 i = 0; i < m_sizeOfTableDataRet / m_bytesPerRow; i++, pNewId = (rowID *)( (char *)pNewId + m_bytesPerRow ) ) { if( RowId(*pNewId) == RowId(*pOldId) ) } } #else (m_pParentDdm->*m_modifyRowCallback)( (void *)m_pModifiedRecord, 1, this); #endif #ifndef WIN32 // I had problems with this....it seems that there some overlap // between this memory and memory allocated for objects elsewhere... // let's see if this is present on the eval or...if I van survive without using it. delete m_pTableDataRet; #endif } break; }
TestEnvironment() { // For this test, RowConfigurations will be indexed by the Term::Hash // values which we expect will be presented to the TermTableBuilder // in increasing order from 1000 to 1006 (the hashes start at 1000, // rather than 0 to ensure they are well above the hashes reserved // for system rows and facts). // We add one RowConfigurations() for each term hash. Each // RowConfiguration will be used once. // // Construct DocumentFrequencyTable // m_documentFrequencyTable.reset(new DocumentFrequencyTable()); std::unordered_map<Term::Hash, Term::IdfX10> hashToIdf; // Start hash at 1000 to be well above the hashes reserved for system rows and facts. const Term::Hash c_firstHash = 1000ull; Term::Hash hash = c_firstHash; // Expect Rank:0, RowIndex: 0 hashToIdf[hash] = Term::ComputeIdfX10(0.9, Term::c_maxIdfX10Value); m_documentFrequencyTable->AddEntry(DocumentFrequencyTable::Entry(Term(hash++, 1, 1), 0.9)); // Expect Rank:0, RowIndex: 1 hashToIdf[hash] = Term::ComputeIdfX10(0.7, Term::c_maxIdfX10Value); m_documentFrequencyTable->AddEntry(DocumentFrequencyTable::Entry(Term(hash++, 1, 1), 0.7)); // Expect Rank:0, RowIndex: 2 hashToIdf[hash] = Term::ComputeIdfX10(0.07, Term::c_maxIdfX10Value); m_documentFrequencyTable->AddEntry(DocumentFrequencyTable::Entry(Term(hash++, 1, 1), 0.07)); // Expect Rank:0, RowIndex: 3 hashToIdf[hash] = Term::ComputeIdfX10(0.05, Term::c_maxIdfX10Value); m_documentFrequencyTable->AddEntry(DocumentFrequencyTable::Entry(Term(hash++, 1, 1), 0.05)); // Expect Rank:0, RowIndex: 2 hashToIdf[hash] = Term::ComputeIdfX10(0.02, Term::c_maxIdfX10Value); m_documentFrequencyTable->AddEntry(DocumentFrequencyTable::Entry(Term(hash++, 1, 1), 0.02)); // Expect Rank:0, RowIndex: 2 and Rank: 0, RowIndex: 3 hashToIdf[hash] = Term::ComputeIdfX10(0.015, Term::c_maxIdfX10Value); m_documentFrequencyTable->AddEntry(DocumentFrequencyTable::Entry(Term(hash++, 1, 1), 0.015)); // Expect Rank:0, RowIndex: 3 and Rank: 4, RowIndex: 0 hashToIdf[hash] = Term::ComputeIdfX10(0.012, Term::c_maxIdfX10Value); m_documentFrequencyTable->AddEntry(DocumentFrequencyTable::Entry(Term(hash++, 1, 1), 0.012)); // // Construct TermTreatment and TermTable. // std::vector<RowIndex> rows; for (Rank r = 0; r <= c_maxRankValue; ++r) { if (r == 0) { rows.push_back(ITermTable::SystemTerm::Count); } else { rows.push_back(0); } } // Restart hash at 1000 to be well above the hashes reserved for system rows and facts. hash = c_firstHash; // First term configured as private rank 0 so it should go in its // own row. m_termTreatment.OpenConfiguration(); m_termTreatment.AddEntry(0, 1); m_termTreatment.CloseConfiguration(hashToIdf[hash]); m_termTable.OpenTerm(); m_termTable.AddRowId(RowId(0, rows[0]++)); m_termTable.CloseTerm(hash++); // Second term is configurated as a single shared rank 0 row, but // will be placed in its own row because of its high density of 0.7. m_termTreatment.OpenConfiguration(); m_termTreatment.AddEntry(0, 1); m_termTreatment.CloseConfiguration(hashToIdf[hash]); m_termTable.OpenTerm(); m_termTable.AddRowId(RowId(0, rows[0]++)); m_termTable.CloseTerm(hash++); // Third row is configured as a single shared rank 0 row. It's // density of 0.07 is low enough that it will share with the fifth // row. m_termTreatment.OpenConfiguration(); m_termTreatment.AddEntry(0, 1); m_termTreatment.CloseConfiguration(hashToIdf[hash]); RowIndex third = rows[0]; m_termTable.OpenTerm(); m_termTable.AddRowId(RowId(0, rows[0]++)); m_termTable.CloseTerm(hash++); // Fourth row is configured as a single shared rank 0 row. It's // density of 0.05 is low enough that it will share with the sixth // and seventh rows. m_termTreatment.OpenConfiguration(); m_termTreatment.AddEntry(0, 1); m_termTreatment.CloseConfiguration(hashToIdf[hash]); RowIndex fourth = rows[0]; m_termTable.OpenTerm(); m_termTable.AddRowId(RowId(0, rows[0]++)); m_termTable.CloseTerm(hash++); // Fifth row is configured as a single shared rank 0 row. It's // density of 0.02 is low enough that it will share with the // third row. m_termTreatment.OpenConfiguration(); m_termTreatment.AddEntry(0, 1); m_termTreatment.CloseConfiguration(hashToIdf[hash]); m_termTable.OpenTerm(); m_termTable.AddRowId(RowId(0, third)); m_termTable.CloseTerm(hash++); // Sixth row is configured as a pair of shared rank 0 rows. It's // density of 0.015 is low enough that it will share with the fourth // and fifth rows. m_termTreatment.OpenConfiguration(); m_termTreatment.AddEntry(0, 2); m_termTreatment.CloseConfiguration(hashToIdf[hash]); m_termTable.OpenTerm(); m_termTable.AddRowId(RowId(0, fourth)); m_termTable.AddRowId(RowId(0, rows[0]++)); m_termTable.CloseTerm(hash++); // Seventh row is configured two shared rows, one rank 0 and one // rank 4. Seventh row's frequency of 0.012 is great enough to // require a private row at rank 4. m_termTreatment.OpenConfiguration(); m_termTreatment.AddEntry(4, 1); m_termTreatment.AddEntry(0, 1); m_termTreatment.CloseConfiguration(hashToIdf[hash]); m_termTable.OpenTerm(); m_termTable.AddRowId(RowId(0, fourth)); m_termTable.AddRowId(RowId(4, rows[4]++)); m_termTable.CloseTerm(hash++); const size_t adhocRowCount = TermTableBuilder::GetMinAdhocRowCount(); m_termTable.SetRowCounts(0, 5 + ITermTable::SystemTerm::Count, adhocRowCount); m_termTable.SetRowCounts(4, 1, adhocRowCount); m_termTable.SetFactCount(0); m_termTable.Seal(); }
ConfigIdManager::ConfigIdManager( ListenManager *pListenManager, DdmServices *pParent ) :ObjectManager( pListenManager, DesignatorId( RowId(), SSAPI_MANAGER_CLASS_TYPE_CONFIG_ID_MANAGER ), pParent ){ m_pConfigId = ConfigId::Ctor( pListenManager ); SetIsReadyToServiceRequests( true ); }
//************************************************************************ // MergePartition // Prepare and insert the partition descriptor // //************************************************************************ STATUS DdmPartitionMstr:: MergePartition( HANDLE handle, PMSTR_CMND_INFO *_pCmdInfo, StorageRollCallRecord *_pSRCRecord1, StorageRollCallRecord *_pSRCRecord2, PARTITION_DESCRIPTOR *_pPDTRecord1, PARTITION_DESCRIPTOR *_pPDTRecord2) { STATUS status = 0; PARTITION_CONTEXT *pCmdContext = NULL; PMSTR_MERGE_PARTITION_INFO *pMergePartitionInfo = NULL; PMSTR_CMND_INFO *pCmdInfo = NULL; PMSTR_CMND_PARAMETERS *pCmdParams = NULL; StorageRollCallRecord *pSRCRecord1 = NULL; StorageRollCallRecord *pSRCRecord2 = NULL; PARTITION_DESCRIPTOR *pPDTRecord1 = NULL; PARTITION_DESCRIPTOR *pPDTRecord2 = NULL; pCmdContext = new PARTITION_CONTEXT; pCmdContext->cmdHandle = handle; // save the info into our context pCmdContext->pData = new PMSTR_CMND_INFO; memcpy(pCmdContext->pData, _pCmdInfo, sizeof(PMSTR_CMND_INFO)); pCmdInfo = (PMSTR_CMND_INFO *)pCmdContext->pData; pCmdParams = &pCmdInfo->cmdParams; pMergePartitionInfo = (PMSTR_MERGE_PARTITION_INFO *)&pCmdParams->mergePartitionInfo; pCmdContext->pData1 = new(tZERO) StorageRollCallRecord; memcpy(pCmdContext->pData1, _pSRCRecord1, sizeof(StorageRollCallRecord)); pSRCRecord1 = (StorageRollCallRecord *) pCmdContext->pData1; pCmdContext->pData2 = new(tZERO) StorageRollCallRecord; memcpy(pCmdContext->pData2, _pSRCRecord2, sizeof(StorageRollCallRecord)); pSRCRecord2 = (StorageRollCallRecord *) pCmdContext->pData2; pCmdContext->pData3 = new(tZERO) PARTITION_DESCRIPTOR; if (_pPDTRecord1) memcpy(pCmdContext->pData3, _pPDTRecord1, sizeof(PARTITION_DESCRIPTOR)); pPDTRecord1 = (PARTITION_DESCRIPTOR *) pCmdContext->pData3; pCmdContext->pData4 = new(tZERO) PARTITION_DESCRIPTOR; if (_pPDTRecord2) memcpy(pCmdContext->pData4, _pPDTRecord2, sizeof(PARTITION_DESCRIPTOR)); pPDTRecord2 = (PARTITION_DESCRIPTOR *) pCmdContext->pData4; // update PDT record 1 size and start LBA // update SRC record 1 Capacity // update pointers,(for merged partition and either the next // or previous partitions depending on the order) // if last partition, delete PDT/SRC record 1 // delete SRC record 2 // delete PDT record 2 // update the partition size of the PDT record 1 if (RowId(pPDTRecord1->rid) && RowId(pPDTRecord2->rid)) { pPDTRecord1->partitionSize += pPDTRecord2->partitionSize; if (pPDTRecord1->nextRowId == pPDTRecord2->SRCTRID) { pPDTRecord1->nextRowId = pPDTRecord2->nextRowId; pCmdContext->value1 = true; } if (pPDTRecord1->previousRowId == pPDTRecord2->SRCTRID) { pPDTRecord1->startLBA = pPDTRecord2->startLBA; pPDTRecord1->previousRowId = pPDTRecord2->previousRowId; pCmdContext->value2 = true; } m_pDataQueue->SetStateIdentifier( &pPDTRecord1->stateIdentifier, pCmdInfo->opcode, (rowID *)pCmdContext->cmdHandle, MERGE_PARTITION_PDT1_SIZE_MODIFIED, pCmdContext->numProcessed); pCmdContext->state = MERGE_PARTITION_PDT1_SIZE_MODIFIED; status = m_pDataQueue->CheckAndModifyRow( PMSTR_PARTITION, &pPDTRecord1->stateIdentifier, PARTITION_DESCRIPTOR_TABLE, &pPDTRecord1->rid, pPDTRecord1, sizeof(PARTITION_DESCRIPTOR), &pPDTRecord1->rid, TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); } else { // just try to update pointers, since we can assume that // pPDT2 is deleted pCmdContext->state = MERGE_PARTITION_PDT2_RECORD_DELETED; ProcessMergePartitionReply(pCmdContext, status); } return status; }
//************************************************************************ // ProcessMergePartitionReply // Process the different states for create partition // Insert Partition Descriptor // // pContext - our context data for create array messages // status - status of the message // // MergePartition State Machine: // Modify PDT1's size // Modify SRC1's capacity // Update PDT pointers // if no remaining // Mark SRC's parent as FREE // Delete SRC2 // Delete SRC1 // Delete PDT1 and PDT2 together // else // Delete SRC2 // Delete PDT2 //************************************************************************ STATUS DdmPartitionMstr:: ProcessMergePartitionReply(void *_pContext, STATUS status) { PARTITION_CONTEXT *pCmdContext = (PARTITION_CONTEXT *)_pContext; STATUS rc = PMSTR_SUCCESS; PMSTR_MERGE_PARTITION_INFO *pMergePartitionInfo = NULL; BOOL cmdComplete = false; PMSTR_CMND_INFO *pCmdInfo = NULL; PMSTR_CMND_PARAMETERS *pCmdParams = NULL; StorageRollCallRecord *pSRCRecord1 = NULL; StorageRollCallRecord *pSRCRecord2 = NULL; PARTITION_DESCRIPTOR *pPDTRecord1 = NULL; PARTITION_DESCRIPTOR *pPDTRecord2 = NULL; // PDTNext is the next ptr of the merged partition, // PDTNext's previous ptr will have to be updated to point // to the merged partition StorageRollCallRecord *pSRCNext = NULL; StorageRollCallRecord *pSRCPrev = NULL; BOOL changeNext = false; BOOL changePrev = false; U32 numberOfContiguousPartitionsRemaining = 0; PARTITION_DESCRIPTOR *pTempPDTRecord = NULL; pCmdInfo = (PMSTR_CMND_INFO *)pCmdContext->pData; pCmdParams = &pCmdInfo->cmdParams; pMergePartitionInfo = (PMSTR_MERGE_PARTITION_INFO *)&pCmdParams->mergePartitionInfo; pSRCRecord1 = (StorageRollCallRecord *) pCmdContext->pData1; pSRCRecord2 = (StorageRollCallRecord *) pCmdContext->pData2; pPDTRecord1 = (PARTITION_DESCRIPTOR *) pCmdContext->pData3; pPDTRecord2 = (PARTITION_DESCRIPTOR *) pCmdContext->pData4; pSRCNext = (StorageRollCallRecord *) pCmdContext->pData5; pSRCPrev = (StorageRollCallRecord *) pCmdContext->pData6; changeNext = pCmdContext->value1; changePrev = pCmdContext->value2; numberOfContiguousPartitionsRemaining = pCmdContext->value; if (status != OS_DETAIL_STATUS_SUCCESS) { rc = PMSTR_ERR_INVALID_COMMAND; cmdComplete = true; } else { switch(pCmdContext->state) { case MERGE_PARTITION_PDT1_SIZE_MODIFIED: m_pDataQueue->Modify( PMSTR_PARTITION, &pPDTRecord1->rid, &pPDTRecord1->stateIdentifier, pPDTRecord1, pPDTRecord1->size); // now modify the SRC1's capacity pCmdContext->state = MERGE_PARTITION_SRC1_CAPACITY_MODIFIED; pSRCRecord1->Capacity = pPDTRecord1->partitionSize; status = m_pTableServices->TableServiceModifyField( STORAGE_ROLL_CALL_TABLE, &pSRCRecord1->rid, // SRC row id fdSRC_CAPACITY, // field name of field to be modifiied &pSRCRecord1->Capacity, sizeof(pSRCRecord1->Capacity), TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); break; case MERGE_PARTITION_SRC1_CAPACITY_MODIFIED: pCmdContext->state = MERGE_PARTITION_PDT_POINTERS_UPDATED; // the return value is the remaining number of partitions // of the same parent // if this count is 0 we will have to delete the last // partition pCmdContext->value = UpdatePartitionPointers( &pPDTRecord1->parentSRCTRID, pPDTRecord1, TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); break; case MERGE_PARTITION_PDT_POINTERS_UPDATED: if (numberOfContiguousPartitionsRemaining == PMSTR_NONE_MODIFIED) { // now mark our parent SRC as free and delete PDT1 and SRC1 pCmdContext->state = MERGE_PARTITION_PARENT_SRC_UNCLAIMED; m_SRCIsUsed = SRC_FREE; status = m_pTableServices->TableServiceModifyField( STORAGE_ROLL_CALL_TABLE, &pPDTRecord1->parentSRCTRID, // SRC row id fdSRC_FUSED, // field name of field to be modifiied &m_SRCIsUsed, // set to true sizeof(U32), TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); } else { if (numberOfContiguousPartitionsRemaining & PMSTR_NEXT_PARTITION_MODIFIED) { pCmdContext->state = MERGE_PARTITION_NEXT_SRC_RECORD_READ; pCmdContext->pData5 = new (tZERO) StorageRollCallRecord; status = m_pTableServices->TableServiceReadRow( STORAGE_ROLL_CALL_TABLE, &pPDTRecord1->nextRowId, pCmdContext->pData5, sizeof(StorageRollCallRecord), TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); } else { if (numberOfContiguousPartitionsRemaining & PMSTR_PREV_PARTITION_MODIFIED) { // if there is a previous partition // we need to modify the next ptr of the previous partition // to point it to the merged partition pCmdContext->state = MERGE_PARTITION_PREV_SRC_RECORD_READ; pCmdContext->pData6 = new (tZERO) StorageRollCallRecord; status = m_pTableServices->TableServiceReadRow( STORAGE_ROLL_CALL_TABLE, &pPDTRecord1->previousRowId, pCmdContext->pData6, sizeof(StorageRollCallRecord), TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); } } } break; case MERGE_PARTITION_PARENT_SRC_UNCLAIMED: // if (SimulateFailover(pCmdContext)){ // return status; // } // Resolve: Still need find way to report the delete event to SSAPI, // If SSAPI can not recognize the crash, we may need save SRC2 and // PDT2 record to a Table before delete SRC2 in MergePartionReply. // Now delete the SRC2 record pCmdContext->state = MERGE_PARTITION_SRC2_RECORD_DELETED1; if (RowId(pSRCRecord2->rid)) { status = m_pTableServices->TableServiceDeleteRow( STORAGE_ROLL_CALL_TABLE, &pSRCRecord2->rid, TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); } else { ProcessMergePartitionReply(pCmdContext, OK); } break; case MERGE_PARTITION_SRC2_RECORD_DELETED1: // if (SimulateFailover(pCmdContext)){ // return status; // } pCmdContext->state = MERGE_PARTITION_SRC1_RECORD_DELETED; status = m_pTableServices->TableServiceDeleteRow( STORAGE_ROLL_CALL_TABLE, &pSRCRecord1->rid, TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); break; case MERGE_PARTITION_SRC1_RECORD_DELETED: // If we have a failover at this point then the repeat cmd after // failover will be rejected by validation (since SRCs) is deleted. // So PDTs will remain in the system, so we need to do some table // data consistency check at initialization - which should deleted // PDT entries with no associated SRC entries // This failover can not be simulated by software. // Now delete PDT1 and PDT2 in one operation pCmdContext->state = MERGE_PARTITION_PDT1_PDT2_RECORD_DELETED; status = m_pTableServices->TableServiceDeleteAllMatchedRows( PARTITION_DESCRIPTOR_TABLE, fdPARENT_RID, &pPDTRecord1->parentSRCTRID,// pdt row id TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); break; case MERGE_PARTITION_PDT1_PDT2_RECORD_DELETED: // this state is reached only if this was the last // remaining partition m_pDataQueue->Remove( PMSTR_PARTITION, &pPDTRecord2->rid); m_pDataQueue->Remove( PMSTR_PARTITION, &pPDTRecord1->rid); cmdComplete = true; break; case MERGE_PARTITION_NEXT_SRC_RECORD_READ: changeNext = pCmdContext->value1 = true; pCmdContext->state = MERGE_PARTITION_PREV_SRC_RECORD_READ; if (numberOfContiguousPartitionsRemaining & PMSTR_PREV_PARTITION_MODIFIED) { pCmdContext->pData6 = new (tZERO) StorageRollCallRecord; status = m_pTableServices->TableServiceReadRow( STORAGE_ROLL_CALL_TABLE, &pPDTRecord1->previousRowId, pCmdContext->pData6, sizeof(StorageRollCallRecord), TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); } else { ProcessMergePartitionReply(pCmdContext, OK); } break; case MERGE_PARTITION_PREV_SRC_RECORD_READ: // if (SimulateFailover(pCmdContext)){ // return status; // } // Now delete the SRC2 changePrev = pCmdContext->value2 = true; pCmdContext->state = MERGE_PARTITION_SRC2_RECORD_DELETED2; if (RowId(pSRCRecord2->rid)) { status = m_pTableServices->TableServiceDeleteRow( STORAGE_ROLL_CALL_TABLE, &pSRCRecord2->rid, TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); } else { ProcessMergePartitionReply(pCmdContext, OK); } break; case MERGE_PARTITION_SRC2_RECORD_DELETED2: // Failover is OK here, since we don't need delete SRC1 and PDT1 for this // case and deleting PDT2 will be handled in Initialization. // Resolve: We need find way (if can not get SRC2 records from that Table, // since we did not save them before failover for this case)to reject this // cmd, since it passed validation for SRC1 and SRC2 and does not neet to // call CleanUp. // Now delete the PDT2 record pCmdContext->state = MERGE_PARTITION_PDT2_RECORD_DELETED; if (pPDTRecord2) { status = m_pTableServices->TableServiceDeleteRow( PARTITION_DESCRIPTOR_TABLE, &pPDTRecord2->rid, // pdt row id TSCALLBACK(DdmPartitionMstr,ProcessMergePartitionReply), pCmdContext); } else { ProcessMergePartitionReply(pCmdContext, OK); } break; case MERGE_PARTITION_PDT2_RECORD_DELETED: if (RowId(pPDTRecord2->rid)) { m_pDataQueue->Remove( PMSTR_PARTITION, &pPDTRecord2->rid); } cmdComplete = true; break; default: break; } } if (cmdComplete) { #if 0 if (SimulateFailover(pCmdContext)) { return status; } #endif // Report the status of the merge partition back m_pCmdServer->csrvReportCmdStatus( pCmdContext->cmdHandle, // handle rc, // completion code NULL, // result Data (void *)pCmdInfo); // Orig cmd info StopCommandProcessing( true, pCmdContext->cmdHandle); // if no error then report the event if (rc == PMSTR_SUCCESS) { // first generate a partition deleted event if (RowId(pSRCRecord2->rid) && RowId(pPDTRecord2->rid)) { PMSTR_EVT_PARTITION_DELETED_STATUS *pEvtPartitionDeleted = new (tZERO) PMSTR_EVT_PARTITION_DELETED_STATUS; pEvtPartitionDeleted->SRCData = *pSRCRecord2; //pEvtPartitionDeleted->partitionData = *pPDTRecord2; m_pCmdServer->csrvReportEvent( PMSTR_EVT_PARTITION_DELETED, // completion code pEvtPartitionDeleted); // event Data delete pEvtPartitionDeleted; } // first generate a partition deleted event if (RowId(pSRCRecord2->rid) && RowId(pPDTRecord2->rid)) { PMSTR_EVT_PARTITION_DELETED_STATUS *pEvtPartitionDeleted = new (tZERO) PMSTR_EVT_PARTITION_DELETED_STATUS; pEvtPartitionDeleted->SRCData = *pSRCRecord2; pEvtPartitionDeleted->partitionData = *pPDTRecord2; m_pCmdServer->csrvReportEvent( PMSTR_EVT_PARTITION_DELETED, // completion code pEvtPartitionDeleted); // event Data delete pEvtPartitionDeleted; } // Now generate event for partition modified PMSTR_EVT_PARTITION_MODIFIED_STATUS *pEvtPartitionModified = new (tZERO) PMSTR_EVT_PARTITION_MODIFIED_STATUS; pEvtPartitionModified->SRCData = *pSRCRecord1; pEvtPartitionModified->partitionData = *pPDTRecord1; m_pCmdServer->csrvReportEvent( PMSTR_EVT_PARTITION_MODIFIED, // completion code pEvtPartitionModified); // event Data // if this was the last partition, then report deleted event if (numberOfContiguousPartitionsRemaining == 0) { m_pCmdServer->csrvReportEvent( PMSTR_EVT_PARTITION_DELETED, // completion code pEvtPartitionModified); // event Data } else { if (changeNext) { if ((RowId(pPDTRecord1->nextRowId) != 0)) { // generate event for modify of the next partition // whose prev ptr is set to the newly merged partition pEvtPartitionModified->SRCData = *pSRCNext; m_pDataQueue->Get( PMSTR_PARTITION, &pSRCNext->ridDescriptorRecord, (void **)&pTempPDTRecord, sizeof(PARTITION_DESCRIPTOR)); pEvtPartitionModified->partitionData = *pTempPDTRecord; m_pCmdServer->csrvReportEvent( PMSTR_EVT_PARTITION_MODIFIED, // completion code pEvtPartitionModified); // event Data } } if (changePrev) { if ((RowId(pPDTRecord1->previousRowId) != 0)) { // generate event for modify of the next partition // whose prev ptr is set to the newly merged partition pEvtPartitionModified->SRCData = *pSRCPrev; m_pDataQueue->Get( PMSTR_PARTITION, &pSRCPrev->ridDescriptorRecord, (void **)&pTempPDTRecord, sizeof(PARTITION_DESCRIPTOR)); pEvtPartitionModified->partitionData = *pTempPDTRecord; m_pCmdServer->csrvReportEvent( PMSTR_EVT_PARTITION_MODIFIED, // completion code pEvtPartitionModified); // event Data } } } delete pEvtPartitionModified; } if (pCmdContext) { delete pCmdContext; pCmdContext = NULL; } } return status; }
LogMessage::LogMessage( ListenManager *pListenManager, Event *pEvent ) :ManagedObject( pListenManager, SSAPI_OBJECT_CLASS_TYPE_LOG_MESSAGE ){ U32 i, u32, paramCount; U8 u8; S8 s8; U16 u16; S16 s16; S32 s32; I64 s64; U64 u64; UnicodeString us; U32 cb = sizeof(Event); m_sequenceNumber = pEvent->GetSequenceNum(); m_timeStamp = pEvent->GetTimestamp(); m_ec = pEvent->GetEventCode(); m_slot = pEvent->GetSlot(); m_did = pEvent->GetDID(); m_vdn = pEvent->GetVDN(); m_pParmVector = new ValueSet; m_id = DesignatorId( RowId(), GetClassType(), m_sequenceNumber ); m_severity = pEvent->GetSeverity(); m_facility = pEvent->GetFacility(); paramCount = pEvent->GetParameterCount(); for( i = 0; i < pEvent->GetParameterCount(); i++ ){ switch( pEvent->GetParameterType(i) ){ case Event::CHAR_PARM: case Event::U8_PARM: memcpy( &u8, pEvent->GetPParameter(i), sizeof(u8) ); m_pParmVector->AddU8( u8, i ); break; case Event::S8_PARM: memcpy( &s8, pEvent->GetPParameter(i), pEvent->GetParameterSize(i) ); m_pParmVector->AddInt8( s8, i ); break; case Event::S16_PARM: memcpy( &s16, pEvent->GetPParameter(i), pEvent->GetParameterSize(i) ); m_pParmVector->AddInt16( s16, i ); break; case Event::U16_PARM: memcpy( &u16, pEvent->GetPParameter(i), pEvent->GetParameterSize(i) ); m_pParmVector->AddU16( u16, i ); break; case Event::S32_PARM: memcpy( &s32, pEvent->GetPParameter(i), pEvent->GetParameterSize(i) ); m_pParmVector->AddInt( s32, i ); break; case Event::U32_PARM: memcpy( &u32, pEvent->GetPParameter(i), pEvent->GetParameterSize(i) ); m_pParmVector->AddU32( u32, i ); break; case Event::S64_PARM: memcpy( &s64, pEvent->GetPParameter(i), pEvent->GetParameterSize(i) ); m_pParmVector->AddInt64( s64, i ); break; case Event::U64_PARM: memcpy( &u64, pEvent->GetPParameter(i), pEvent->GetParameterSize(i) ); m_pParmVector->AddU64( u64, i ); break; case Event::HEX_PARM: m_pParmVector->AddGenericValue( (char *)pEvent->GetPParameter(i), pEvent->GetParameterSize(i), i ); break; case Event::STR_PARM: us = StringClass( (char *)pEvent->GetPParameter(i) ); m_pParmVector->AddString( &us, i ); break; case Event::USTR_PARM: us = UnicodeString( (void *)pEvent->GetPParameter(i) ); m_pParmVector->AddString( &us, i ); break; default: ASSERT(0); break; } } }