From 605bee4ac291ef443322c25c3a062b667d371bfa Mon Sep 17 00:00:00 2001 From: prabatuty Date: Fri, 24 Jun 2011 14:22:31 +0000 Subject: [PATCH] code reorg --- src/storage/AggTableImpl.cxx | 11 +++++ src/storage/BucketList.cxx | 21 ++------- src/storage/CatalogTables.cxx | 20 +++++++- src/storage/Chunk.cxx | 5 ++ src/storage/Condition.cxx | 3 ++ src/storage/Connection.cxx | 3 ++ src/storage/Database.cxx | 26 +++++++++++ src/storage/DatabaseManagerImpl.cxx | 24 +++++++--- src/storage/DatabaseRecovery.cxx | 4 +- src/storage/DbMgrIndexImpl.cxx | 2 + src/storage/DbMgrTableImpl.cxx | 1 + src/storage/Expression.cxx | 12 +++-- src/storage/FieldList.cxx | 5 ++ src/storage/HashIndex.cxx | 92 ++++++++++++++++++++----------------- src/storage/JoinTableImpl.cxx | 14 ++++++ src/storage/LockManager.cxx | 6 +++ src/storage/OrderByTree.cxx | 3 ++ src/storage/OrderTableImpl.cxx | 16 +++++++ src/storage/PageInfo.cxx | 2 + src/storage/PredicateEvalImpl.cxx | 1 + src/storage/PredicateImpl.cxx | 19 ++++++++ src/storage/Process.cxx | 1 + src/storage/SessionImpl.cxx | 7 ++- src/storage/TableDef.cxx | 2 + src/storage/TableImpl.cxx | 11 +++++ src/storage/TableImplReadOp.cxx | 2 + src/storage/Transaction.cxx | 10 +++- src/storage/TreeIndex.cxx | 4 ++ src/storage/TreeIter.cxx | 2 + src/storage/TreeNode.cxx | 3 ++ src/storage/TrieIndex.cxx | 3 ++ src/storage/TupleIterator.cxx | 1 + 32 files changed, 261 insertions(+), 75 deletions(-) diff --git a/src/storage/AggTableImpl.cxx b/src/storage/AggTableImpl.cxx index ef063489..adfccf41 100644 --- a/src/storage/AggTableImpl.cxx +++ b/src/storage/AggTableImpl.cxx @@ -36,6 +36,7 @@ AggTableImpl::AggTableImpl() optGrpIntNoNull = false; grpBindBuf = NULL; } + AggTableImpl::~AggTableImpl() { //free memory allocated. make sure that field buffers are freed only once. @@ -63,6 +64,7 @@ AggTableImpl::~AggTableImpl() tableHdl = NULL; ::free(grpFldBuffer); } + void *AggTableImpl::getBindFldAddr(const char *name) { printError(ErrBadCall, "AggTableImpl getBindFldAdddr not implemented\n"); @@ -74,6 +76,7 @@ DbRetVal AggTableImpl::bindFld(const char *name, void *val, bool dummy) printError(ErrBadCall, "AggTableImpl bindFld not implemented\n"); return ErrBadCall; } + DbRetVal AggTableImpl::bindFld(const char *fldname, AggType aggType, void *val) { FieldInfo *info = new FieldInfo(); @@ -125,6 +128,7 @@ DbRetVal AggTableImpl::bindFld(const char *fldname, AggType aggType, void *val) delete info; return OK; } + DbRetVal AggTableImpl::setGroup(const char *fldname, void *val) { FieldInfo *info = new FieldInfo(); @@ -185,6 +189,7 @@ bool AggTableImpl::isFldPresentInGrp(char *fname) } return false; } + int AggTableImpl::getAggOffset(char *fname, AggType aggType) { ListIterator iter = fldList.getIterator(); @@ -237,6 +242,7 @@ DbRetVal AggTableImpl::copyValuesFromGrpBindBuf(char *buffer, char *fname) } return OK; } + DbRetVal AggTableImpl::optimize() { AggFldDef *grpFld=NULL; @@ -254,6 +260,7 @@ DbRetVal AggTableImpl::optimize() } return OK; } + DbRetVal AggTableImpl::execute() { ListIterator iter = fldList.getIterator(); @@ -401,6 +408,7 @@ void* AggTableImpl::getGroupValueBuffer() memcpy(offset, &grpNullInfo, sizeof(int)); return grpFldBuffer; } + void* AggTableImpl::insertOrGetAggNode() { char *element; @@ -486,6 +494,7 @@ void* AggTableImpl::fetch() return NULL; } + void* AggTableImpl::fetch(DbRetVal &rv) { rv = OK; @@ -554,6 +563,7 @@ long AggTableImpl::numTuples() { return aggNodes.size(); } + DbRetVal AggTableImpl::closeScan() { aggNodeIter.reset(); @@ -593,6 +603,7 @@ bool AggTableImpl::isFldNull(const char *name) } return isFldNull(colpos); } + void AggTableImpl::printPlan(int space) { char spaceBuf[IDENTIFIER_LENGTH]; diff --git a/src/storage/BucketList.cxx b/src/storage/BucketList.cxx index b4af334a..173b697c 100644 --- a/src/storage/BucketList.cxx +++ b/src/storage/BucketList.cxx @@ -21,22 +21,9 @@ DbRetVal BucketList::insert(Chunk *chunk, Database *db, void *key, void*tuple) { DbRetVal rv = OK; - IndexNode *newNode;// (IndexNode*) chunk->allocate(db, &rv); - int tries=0; - int totalTries = Conf::config.getMutexRetries(); - while (tries < totalTries) - { - rv = OK; - newNode= (IndexNode*) chunk->allocate(db, &rv); - if (newNode !=NULL) break; - if (rv != ErrLockTimeOut) - { - printError(rv, "Unable to allocate hash index node"); - return rv; - } - //printError (ErrWarning, "Hash Node Alloc: LockTimeOut Retry:%d", tries); - tries++; - } + IndexNode *newNode = NULL; + rv = OK; + newNode= (IndexNode*) chunk->tryAllocate(db, &rv); if (newNode == NULL){ printError(rv, "Unable to allocate hash index node after %d retry", Conf::config.getMutexRetries()); return rv; @@ -71,6 +58,7 @@ DbRetVal BucketList::insert(Chunk *chunk, Database *db, void *key, void*tuple) if (rv != OK) printError(ErrSysFatal, "rv is not OK %d\n", rv); return rv; } + void BucketList::print() { if (NULL == head) return ; @@ -82,6 +70,7 @@ void BucketList::print() } return; } + //Returns 2 if the head itself is removed. DbRetVal BucketList::remove(Chunk *chunk, Database *db, void *keyPtr) { diff --git a/src/storage/CatalogTables.cxx b/src/storage/CatalogTables.cxx index aedab398..76452c94 100644 --- a/src/storage/CatalogTables.cxx +++ b/src/storage/CatalogTables.cxx @@ -18,7 +18,25 @@ #include #include #include -char ChunkName[MAX_CHUNKS][CHUNK_NAME_LEN]={"UserChunkTableId","LockTableHashBucketId","LockTableMutexId","LockTableId","TransHasTableId","UndoLogTableId","","","","","DatabaseTableId","UserTableId","TableTableId","FieldTableId","AccessTableId","IndexTableId","IndexFieldTableId","ForeignKeyTableId","ForeignKeyFieldTableId"}; + +char ChunkName[MAX_CHUNKS][CHUNK_NAME_LEN]={ + "UserChunkTableId", + "LockTableHashBucketId", + "LockTableMutexId", + "LockTableId", + "TransHasTableId", + "UndoLogTableId", + "","","","", + "DatabaseTableId", + "UserTableId", + "TableTableId", + "FieldTableId", + "AccessTableId", + "IndexTableId", + "IndexFieldTableId", + "ForeignKeyTableId", + "ForeignKeyFieldTableId" + }; DbRetVal CatalogTableTABLE::insert(const char *name, int id, size_t size, diff --git a/src/storage/Chunk.cxx b/src/storage/Chunk.cxx index c5dbf13e..31673397 100644 --- a/src/storage/Chunk.cxx +++ b/src/storage/Chunk.cxx @@ -633,6 +633,7 @@ int Chunk::totalPages() } return totPages; } + int Chunk::totalDirtyPages() { PageInfo* pageInfo = ((PageInfo*)firstPage_); @@ -655,18 +656,22 @@ int Chunk::initMutex(int id) sprintf(mutName, "Chunk:%d",id); return chunkMutex_.init(mutName); } + int Chunk::getChunkMutex(int procSlot) { return chunkMutex_.getLock(procSlot); } + int Chunk::releaseChunkMutex(int procSlot) { return chunkMutex_.releaseLock(procSlot); } + int Chunk::destroyMutex() { return chunkMutex_.destroy(); } + void Chunk::setChunkNameForSystemDB(int id) { strcpy(chunkName,ChunkName[id]); diff --git a/src/storage/Condition.cxx b/src/storage/Condition.cxx index 5ce479f8..741b03ac 100644 --- a/src/storage/Condition.cxx +++ b/src/storage/Condition.cxx @@ -20,15 +20,18 @@ Condition::Condition() { pred = NULL; } + void Condition::reset() { //if (pred) {delete pred;} pred = NULL; } + Condition::~Condition() { reset(); } + void Condition::setTerm(const char* fName1, ComparisionOp op, const char *fName2) { diff --git a/src/storage/Connection.cxx b/src/storage/Connection.cxx index 9089b764..0a484951 100644 --- a/src/storage/Connection.cxx +++ b/src/storage/Connection.cxx @@ -29,10 +29,12 @@ Connection::~Connection() } Index::destroy(); } + char *Connection::getUserName() { return session->getUserName(); } + DbRetVal Connection::open(const char *username, const char *password) { os::umask(002); @@ -100,6 +102,7 @@ DbRetVal Connection::rollback() if (session == NULL) return ErrNoConnection; return session->rollback(); } + DbRetVal Connection::getExclusiveLock() { if (session == NULL) return ErrNoConnection; diff --git a/src/storage/Database.cxx b/src/storage/Database.cxx index 451686b9..479e66bf 100644 --- a/src/storage/Database.cxx +++ b/src/storage/Database.cxx @@ -43,20 +43,24 @@ long Database::getCurrentSize() return metaData_->curSize_; } + Page* Database::getCurrentPage() { return metaData_->curPage_; } + Page* Database::getFirstPage() { return metaData_->firstPage_; } + int Database::getNoOfChunks() { return metaData_->noOfChunks_; } + Chunk* Database::getHashIndexChunk() { return metaData_->hashIndexChunk_; @@ -66,31 +70,38 @@ void Database::setDatabaseID(int id) { metaData_->dbID_ = id; } + void Database::setName(const char *name) { strcpy(metaData_->dbName_ , name); } + void Database::setCurrentSize(long size) { metaData_->curSize_ = size; } + void Database::setCurrentPage(Page *page) { //metaData_->curPage_ = page; Mutex::CASL((long*)&metaData_->curPage_, (long)metaData_->curPage_, (long)page); } + void Database::setFirstPage(Page *page) { metaData_->firstPage_ = page; } + void Database::setMaxSize(long size) { metaData_->maxSize_ = size; } + void Database::setNoOfChunks(int chunks) { metaData_->noOfChunks_ = chunks; } + void Database::setHashIndexChunk(Chunk *ch) { metaData_->hashIndexChunk_ = ch; @@ -105,10 +116,12 @@ void Database::printDebugMutexInfo() metaData_->dbPrepareStmtMutex_.print(); metaData_->chunkUniqueID_.print(); } + int Database::initAllocDatabaseMutex() { return metaData_->dbAllocMutex_.init("allocdb"); } + DbRetVal Database::getAllocDatabaseMutex(bool procAccount) { struct timeval timeout, timeval; @@ -129,6 +142,7 @@ DbRetVal Database::getAllocDatabaseMutex(bool procAccount) if (tries >= totalTries) return ErrLockTimeOut; return OK; } + DbRetVal Database::releaseAllocDatabaseMutex(bool procAccount) { metaData_->dbAllocMutex_.releaseLock(procSlot, procAccount); @@ -139,6 +153,7 @@ int Database::initPrepareStmtMutex() { return metaData_->dbPrepareStmtMutex_.init("prepstmt"); } + DbRetVal Database::getPrepareStmtMutex(bool procAccount) { struct timeval timeout, timeval; @@ -160,6 +175,7 @@ DbRetVal Database::getPrepareStmtMutex(bool procAccount) return OK; } + DbRetVal Database::releasePrepareStmtMutex(bool procAccount) { metaData_->dbPrepareStmtMutex_.releaseLock(procSlot, procAccount); @@ -170,6 +186,7 @@ int Database::initTransTableMutex() { return metaData_->dbTransTableMutex_.init("transtable"); } + DbRetVal Database::getTransTableMutex() { struct timeval timeout, timeval; @@ -191,6 +208,7 @@ DbRetVal Database::getTransTableMutex() return OK; } + DbRetVal Database::releaseTransTableMutex() { metaData_->dbTransTableMutex_.releaseLock(procSlot); @@ -203,6 +221,7 @@ int Database::initProcessTableMutex() { return metaData_->dbProcTableMutex_.init("proctable"); } + DbRetVal Database::getProcessTableMutex(bool procAccount) { struct timeval timeout, timeval; @@ -224,6 +243,7 @@ DbRetVal Database::getProcessTableMutex(bool procAccount) return OK; } + DbRetVal Database::releaseProcessTableMutex(bool procAccount) { metaData_->dbProcTableMutex_.releaseLock(procSlot, procAccount); @@ -234,6 +254,7 @@ int Database::initCheckpointMutex() { return metaData_->ckptMutex_.init("checkpoint"); } + DbRetVal Database::getSCheckpointMutex(bool procAccount) { struct timeval timeout, timeval; @@ -255,6 +276,7 @@ DbRetVal Database::getSCheckpointMutex(bool procAccount) return OK; } + DbRetVal Database::getXCheckpointMutex(bool procAccount) { struct timeval timeout, timeval; @@ -276,6 +298,7 @@ DbRetVal Database::getXCheckpointMutex(bool procAccount) return OK; } + DbRetVal Database::releaseCheckpointMutex(bool procAccount) { metaData_->ckptMutex_.releaseShareLock(procSlot, procAccount); @@ -535,6 +558,7 @@ void Database::createAllCatalogTables() createSystemTables(); createMetaDataTables(); } + void Database::createSystemTables() { createSystemDatabaseChunk(FixedSizeAllocator, @@ -553,6 +577,7 @@ void Database::createSystemTables() createSystemDatabaseChunk(VariableSizeAllocator, 0, UndoLogTableID); } + void Database::createMetaDataTables() { createSystemDatabaseChunk(FixedSizeAllocator, @@ -620,6 +645,7 @@ Bucket* Database::getLockHashBuckets() ChunkIterator iter = tChunk->getIterator(); return (Bucket*)iter.nextElement(); } + void Database::setUniqueChunkID(int id) { (metaData_->chunkUniqueID_).setID(id); diff --git a/src/storage/DatabaseManagerImpl.cxx b/src/storage/DatabaseManagerImpl.cxx index 60294709..0ec122d1 100644 --- a/src/storage/DatabaseManagerImpl.cxx +++ b/src/storage/DatabaseManagerImpl.cxx @@ -49,11 +49,13 @@ void DatabaseManagerImpl::createTransactionManager() tMgr_->setFirstTrans(systemDatabase_->getSystemDatabaseTrans(0)); return; } + void DatabaseManagerImpl::setProcSlot() { systemDatabase_->setProcSlot(procSlot); db_->setProcSlot(procSlot); } + DbRetVal DatabaseManagerImpl::openSystemDatabase() { DbRetVal rv = openDatabase(SYSTEMDB); @@ -203,6 +205,7 @@ DbRetVal DatabaseManagerImpl::createDatabase(const char *name, size_t size) return OK; } + size_t DatabaseManagerImpl::computeSysDbOffset() { size_t offset = os::alignLong(sizeof (DatabaseMetaData)); @@ -211,6 +214,7 @@ size_t DatabaseManagerImpl::computeSysDbOffset() offset = offset + os::alignLong(Conf::config.getMaxProcs() * sizeof(ThreadInfo)); return offset; } + void DatabaseManagerImpl::initMutexes(Database *db_) { //TODO:for user database do not have transtable and processtable mutex @@ -230,13 +234,13 @@ DbRetVal DatabaseManagerImpl::deleteDatabase(const char *name) { shm_id = os::shm_open(Conf::config.getSysDbKey(), 100, 0660); os::shm_remove(shm_id); - delete systemDatabase_; - systemDatabase_ = NULL; + delete systemDatabase_; + systemDatabase_ = NULL; } else { shm_id = os::shm_open(Conf::config.getUserDbKey(), 100, 0660); os::shm_remove(shm_id); - delete db_; - db_ = NULL; + delete db_; + db_ = NULL; } return OK; } @@ -566,10 +570,12 @@ void DatabaseManagerImpl::printDebugTransInfo() { tMgr_->printDebugInfo(systemDatabase_); } + void DatabaseManagerImpl::printDebugProcInfo() { pMgr_->printDebugInfo(); } + void DatabaseManagerImpl::printDebugMutexInfo() { Database *db = sysDb(); @@ -609,6 +615,7 @@ void DatabaseManagerImpl::printDebugMutexInfo() printf("\n"); lMgr_->printMutexInfo(); } + void DatabaseManagerImpl::printDebugChunkInfo() { Database *db = sysDb(); @@ -652,6 +659,7 @@ void DatabaseManagerImpl::printDebugChunkInfo() printf("\n"); return; } + ChunkIterator DatabaseManagerImpl::getSystemTableIterator(CatalogTableID id) { Chunk *fChunk = systemDatabase_->getSystemDatabaseChunk(id); @@ -720,10 +728,14 @@ DbRetVal DatabaseManagerImpl::pasteRecords(char *tblName, void *buffer) } void DatabaseManagerImpl::setCanTakeCheckPoint(bool ctcp) -{ systemDatabase_->setCanTakeCheckPoint(ctcp); } +{ + systemDatabase_->setCanTakeCheckPoint(ctcp); +} bool DatabaseManagerImpl::getCanTakeCheckPoint() -{ return systemDatabase_->getCanTakeCheckPoint(); } +{ + return systemDatabase_->getCanTakeCheckPoint(); +} DbRetVal DatabaseManagerImpl::checkPoint() { diff --git a/src/storage/DatabaseRecovery.cxx b/src/storage/DatabaseRecovery.cxx index b3dda220..ccb0e9a7 100644 --- a/src/storage/DatabaseRecovery.cxx +++ b/src/storage/DatabaseRecovery.cxx @@ -162,6 +162,7 @@ DbRetVal Database::checkPoint() } return OK; } + DbRetVal Database::filterAndRemoveStmtLogs() { struct stat st; @@ -259,6 +260,7 @@ DbRetVal Database::filterAndRemoveStmtLogs() ret = system(cmd); return rv; } + int Database::getCheckpointID() { int id=0; @@ -270,6 +272,7 @@ int Database::getCheckpointID() fclose(fp); return id; } + void Database::setCheckpointID(int id) { char curCkptFile[MAX_FILE_LEN]; @@ -286,7 +289,6 @@ void Database::setCheckpointID(int id) return; } - //used only by the user database not the system database DbRetVal Database::recoverUserDB() { diff --git a/src/storage/DbMgrIndexImpl.cxx b/src/storage/DbMgrIndexImpl.cxx index 67950621..5f443c14 100644 --- a/src/storage/DbMgrIndexImpl.cxx +++ b/src/storage/DbMgrIndexImpl.cxx @@ -594,6 +594,7 @@ DbRetVal DatabaseManagerImpl::removeIndexCatalogTables(const char *name, void *& printDebug(DM_Database, "Removing from INDEXFIELD %s",name); return OK; } + DbRetVal DatabaseManagerImpl::removeIndexChunks(void* chunk, void* hchunk, IndexType iType) { DbRetVal rv = deleteUserChunk((Chunk*)chunk); @@ -714,6 +715,7 @@ DbRetVal DatabaseManagerImpl::printIndexDebugInfo(char *name) } + DbRetVal DatabaseManagerImpl::printIndexInfo(char *name) { CatalogTableINDEX cIndex(systemDatabase_); diff --git a/src/storage/DbMgrTableImpl.cxx b/src/storage/DbMgrTableImpl.cxx index 9ef62e75..6479936d 100644 --- a/src/storage/DbMgrTableImpl.cxx +++ b/src/storage/DbMgrTableImpl.cxx @@ -131,6 +131,7 @@ DbRetVal DatabaseManagerImpl::createTable(const char *name, TableDef &def) logFinest(Conf::logger, "Table Created %s" , name); return OK; } + DbRetVal DatabaseManagerImpl::renameTable(const char *oldName,const char *newName) { void *chunk = NULL; diff --git a/src/storage/Expression.cxx b/src/storage/Expression.cxx index f586f0c1..e909fff2 100644 --- a/src/storage/Expression.cxx +++ b/src/storage/Expression.cxx @@ -37,6 +37,7 @@ void Expression::setTuple(void *tpl) tuple = tpl; } + void Expression::setFunctionType(FunctionType type) { if(NULL!=lhs) @@ -45,6 +46,7 @@ void Expression::setFunctionType(FunctionType type) rhs->setFunctionType(type); fType = type; } + void Expression::setExpr(Expression* exp1, FunctionType type,Expression* exp2) { lhs = exp1; @@ -52,6 +54,7 @@ void Expression::setExpr(Expression* exp1, FunctionType type,Expression* exp2) setFunctionType(type); arOp=unKnownOperator; } + void Expression::setExpr(void *cVal,bool flag) { arOp=unKnownOperator; @@ -77,9 +80,9 @@ void Expression::setExpr(char const *name) void Expression::setExpr(Expression *exp1, ArithOperator op, Expression *exp2) { - lhs = exp1; - rhs = exp2; - arOp = op; + lhs = exp1; + rhs = exp2; + arOp = op; } void *Expression::evaluate(DataType type,bool &result) @@ -143,6 +146,7 @@ void *Expression::evaluate(DataType type,bool &result) solve(lhsResult, rhsResult, type, arOp); return lhsResult; } + return NULL; } @@ -604,6 +608,7 @@ bool Expression::isSingleTerm() if (NULL==lhs && NULL==rhs ) return true; else false; } + void Expression::memFree() { if(lhs!=NULL) @@ -628,6 +633,7 @@ void Expression::convertStrToVal(DataType type) } } + void Expression::freeVal() { if(lhs!=NULL) diff --git a/src/storage/FieldList.cxx b/src/storage/FieldList.cxx index be48f7d0..6fbd4672 100644 --- a/src/storage/FieldList.cxx +++ b/src/storage/FieldList.cxx @@ -102,6 +102,7 @@ int FieldList::size() } return size; } + //-1->if val is passed NULL //-2->if fld is not present DbRetVal FieldList::updateBindVal(const char *fldName, void *val, @@ -126,6 +127,7 @@ DbRetVal FieldList::updateBindVal(const char *fldName, void *val, printError(ErrNotFound, "Field not present in the list"); return ErrNotFound; } + void *FieldList::getBindField(const char *fldName) { FieldNode *iter = head; @@ -140,6 +142,7 @@ void *FieldList::getBindField(const char *fldName) printError(ErrNotFound, "Field not present in the list"); return NULL; } + void FieldList::fillFieldInfo(int fldpos, void *inp) { int pos=0; @@ -215,6 +218,7 @@ int FieldList::getFieldOffset(const char *fldName) } return -1; } + int FieldList::getFieldOffset(int fldpos) { if (fldpos < 1) return -1; @@ -318,6 +322,7 @@ DbRetVal FieldNameList::append(const char *name) it->next = newNode; return OK; } + //-1 -> if there is nothing in list //-2 -> if it is not present in list DbRetVal FieldNameList::remove(const char* name) diff --git a/src/storage/HashIndex.cxx b/src/storage/HashIndex.cxx index 232561e6..cc1f8168 100644 --- a/src/storage/HashIndex.cxx +++ b/src/storage/HashIndex.cxx @@ -112,51 +112,57 @@ bool HashIndex::checkForUniqueKey(IndexNode *head, HashIndexInfo *info, void *tu if (!head) return false; int offset = info->fldOffset; DataType type = info->type; - BucketList list(head); - BucketIter iter = list.getIterator(); - IndexNode *node; - void *bucketTuple; - printDebug(DM_HashIndex, "HashIndex insert Checking for unique"); - bool res = false; + BucketList list(head); + BucketIter iter = list.getIterator(); + IndexNode *node; + void *bucketTuple; + printDebug(DM_HashIndex, "HashIndex insert Checking for unique"); + bool res = false; - while((node = iter.next()) != NULL) - { - bucketTuple = node->ptrToTuple_; - if (type == typeComposite) { - FieldIterator fldIter = info->idxFldList.getIterator(); - int i = 0; - while (fldIter.hasElement()) { - FieldDef *def = fldIter.nextElement(); - if (def->type_ != typeVarchar) { - res = AllDataType::compareVal( - (char *)bucketTuple + def->offset_, - (char *)tuple + def->offset_, - OpEquals, def->type_, def->length_); - } else { - char *tvcptr = (char *) *(long *) - ((char *)tuple + def->offset_); - char *btvcptr = (char *) *(long *) - ((char *)bucketTuple + def->offset_); - res = AllDataType::compareVal(tvcptr, btvcptr, + while((node = iter.next()) != NULL) + { + bucketTuple = node->ptrToTuple_; + if (type == typeComposite) { + FieldIterator fldIter = info->idxFldList.getIterator(); + int i = 0; + while (fldIter.hasElement()) { + FieldDef *def = fldIter.nextElement(); + if (def->type_ != typeVarchar) { + res = AllDataType::compareVal( + (char *)bucketTuple + def->offset_, + (char *)tuple + def->offset_, + OpEquals, def->type_, def->length_); + } else { + char *tvcptr = (char *) *(long *) + ((char *)tuple + def->offset_); + char *btvcptr = (char *) *(long *) + ((char *)bucketTuple + def->offset_); + res = AllDataType::compareVal(tvcptr, btvcptr, OpEquals, def->type_, def->length_); - } - if (!res) break; - } - } - else { - if (type != typeVarchar) - res = AllDataType::compareVal((void*)((char*)bucketTuple +offset), (void*)((char*)tuple +offset), OpEquals,type, info->compLength); - else res = AllDataType::compareVal((void*)*(long *)((char*)bucketTuple +offset), (void*)*(long *)((char*)tuple +offset), OpEquals,type, info->compLength); - } - if (res) - { - if (type == typeLongLong) - printError(ErrUnique, "Unique key violation for id:%lld",*(long long*) ((char*)tuple +offset) ); - else - printError(ErrUnique, "Unique key violation"); - return true; - } - } + } + if (!res) break; + } + } + else { + if (type != typeVarchar) + res = AllDataType::compareVal((void*)((char*)bucketTuple +offset), + (void*)((char*)tuple +offset), OpEquals, + type, info->compLength); + else + res = AllDataType::compareVal((void*)*(long *)((char*)bucketTuple +offset), + (void*)*(long *)((char*)tuple +offset), + OpEquals,type, info->compLength); + } + if (res) + { + if (type == typeLongLong) + printError(ErrUnique, "Unique key violation for id:%lld", + *(long long*) ((char*)tuple +offset) ); + else + printError(ErrUnique, "Unique key violation"); + return true; + } + } return false; } diff --git a/src/storage/JoinTableImpl.cxx b/src/storage/JoinTableImpl.cxx index 339da284..34496e93 100644 --- a/src/storage/JoinTableImpl.cxx +++ b/src/storage/JoinTableImpl.cxx @@ -213,6 +213,7 @@ void JoinTableImpl::printPlan(int space) printf("%s \n", spaceBuf); printf("%s \n", spaceBuf); } + DbRetVal JoinTableImpl::execute() { //if (!leftTableHdl->getName()) printf("execute called with isFirstCall %d\n", isFirstCall); @@ -245,6 +246,7 @@ DbRetVal JoinTableImpl::execute() isFirstFetch = true; return OK; } + void* JoinTableImpl::fetch() { //if (!leftTableHdl->getName()) printf("fetch called\n"); @@ -264,6 +266,7 @@ void* JoinTableImpl::fetch() //if (!leftTableHdl->getName()) printf("rec value is %x\n", rec); return rec; } + void* JoinTableImpl::fetchInt() { PredicateImpl* predImpl = (PredicateImpl*) pred; @@ -340,6 +343,7 @@ void* JoinTableImpl::fetchRightFail() copyValuesToBindBuffer(NULL); return rec; } + void* JoinTableImpl::fetch(DbRetVal &rv) { rv = OK; @@ -372,6 +376,7 @@ DbRetVal JoinTableImpl::copyValuesToBindBuffer(void *elem) } return OK; } + DbRetVal JoinTableImpl::getFieldInfo(const char* fldname, FieldInfo *&info) { DbRetVal retCode = OK, retCode1 =OK; @@ -395,6 +400,7 @@ long JoinTableImpl::numTuples() { return 0; } + DbRetVal JoinTableImpl::closeScan() { //if (leftTableHdl && leftTableHdl->getName()) leftTableHdl->closeScan(); @@ -431,12 +437,14 @@ DbRetVal JoinTableImpl::close() delete this; return OK; } + void* JoinTableImpl::getBindFldAddr(const char *name) { void* bindAddr = leftTableHdl->getBindFldAddr(name); if (bindAddr) return bindAddr; return rightTableHdl->getBindFldAddr(name); } + List JoinTableImpl::getFieldNameList() { List fldNameList; @@ -460,6 +468,7 @@ List JoinTableImpl::getFieldNameList() rightList.reset(); return fldNameList; } + bool JoinTableImpl::isTableInvolved(char *tableName) { //printf("isTableInvolved called in join for %s\n", tableName); @@ -468,6 +477,7 @@ bool JoinTableImpl::isTableInvolved(char *tableName) isInvolved = rightTableHdl->isTableInvolved(tableName); return isInvolved; } + void* JoinTableImpl::getBindedBuf(char* tName, char* fName) { ListIterator iter = projList.getIterator(); @@ -483,6 +493,7 @@ void* JoinTableImpl::getBindedBuf(char* tName, char* fName) } return NULL; } + bool JoinTableImpl::pushPredicate(Predicate *pr) { //printf("PRABA::pushPredicate called\n"); @@ -576,6 +587,7 @@ bool JoinTableImpl::pushPredicate(Predicate *pr) } return pushed; } + void JoinTableImpl::setPredicate(Predicate *pr) { if (NULL == pred) { pred = pr; return; } @@ -587,6 +599,7 @@ void JoinTableImpl::setPredicate(Predicate *pr) pred = newPred; return; } + bool JoinTableImpl::isFldNull(const char *name) { bool ret = false; @@ -621,6 +634,7 @@ bool JoinTableImpl::isFldNull(const char *name) } return ret; } + //same as above expect it does not check for isRecordFound flag //as it is set only after predicate evaluate bool JoinTableImpl::isFldNullInt(const char *name) diff --git a/src/storage/LockManager.cxx b/src/storage/LockManager.cxx index 4ebd6e42..84a8443c 100644 --- a/src/storage/LockManager.cxx +++ b/src/storage/LockManager.cxx @@ -195,6 +195,7 @@ DbRetVal LockManager::retrySharedLock(Transaction **trans, LockHashNode *node ) (*trans)->removeWaitLock(); return ErrLockTimeOut; } + DbRetVal LockManager::getExclusiveLock(void *tuple, Transaction **trans) { if (trans == NULL) { @@ -238,6 +239,7 @@ DbRetVal LockManager::getExclusiveLock(void *tuple, Transaction **trans) lockTable.releaseBucketMutex(); return retryExclusiveLock(trans, node); } + bool LockManager::takeXLockOneReader(Transaction **trans, LockHashNode *node) { bool satisfy = false; @@ -252,6 +254,7 @@ bool LockManager::takeXLockOneReader(Transaction **trans, LockHashNode *node) } return satisfy; } + bool LockManager::takeXLockOneWriter(Transaction **trans, LockHashNode *node) { bool satisfy = false; @@ -264,6 +267,7 @@ bool LockManager::takeXLockOneWriter(Transaction **trans, LockHashNode *node) } return satisfy; } + DbRetVal LockManager::takeXLockNotInUse(Transaction **trans, LockHashNode *node) { (*trans)->insertIntoHasList(systemDatabase_, node); @@ -272,6 +276,7 @@ DbRetVal LockManager::takeXLockNotInUse(Transaction **trans, LockHashNode *node) (*trans)->removeWaitLock(); return OK; } + DbRetVal LockManager::retryExclusiveLock(Transaction **trans, LockHashNode *node ) { int tries = 0; @@ -323,6 +328,7 @@ DbRetVal LockManager::retryExclusiveLock(Transaction **trans, LockHashNode *nod printError(ErrLockTimeOut, "Unable to acquire lock for long time.Timed out"); return ErrLockTimeOut; } + DbRetVal LockManager::releaseLock(void *tuple) { printDebug(DM_Lock, "LockManager:releaseLock Start"); diff --git a/src/storage/OrderByTree.cxx b/src/storage/OrderByTree.cxx index cdbe9bc4..b443c843 100644 --- a/src/storage/OrderByTree.cxx +++ b/src/storage/OrderByTree.cxx @@ -107,12 +107,14 @@ DbRetVal OrderByTree::insertDataNode(void *data) projMap.insert(data); return OK; } + bool OrderByTree::find(void *data) { void *element = projMap.find(data); if (element) return true; return false; } + int OrderByTree::compare(void *element1,void *element2,int size) { return os::memcmp(element1,element2,size); @@ -122,6 +124,7 @@ ListIterator OrderByTree::getListIterator() { return dataNode.getIterator(); } + void OrderByTree::removeAll() { dataNode.reset(); diff --git a/src/storage/OrderTableImpl.cxx b/src/storage/OrderTableImpl.cxx index 580be321..b379b445 100644 --- a/src/storage/OrderTableImpl.cxx +++ b/src/storage/OrderTableImpl.cxx @@ -31,6 +31,7 @@ OrderTableImpl::OrderTableImpl() orderBuffer = NULL; isPlanCreated=false; } + OrderTableImpl::~OrderTableImpl() { //free memory allocated. make sure that field buffers are freed only once. @@ -51,6 +52,7 @@ OrderTableImpl::~OrderTableImpl() tableHdl = NULL; if (orderBuffer) ::free(orderBuffer); } + void *OrderTableImpl::getBindFldAddr(const char *name) { printError(ErrBadCall, "OrderTableImpl getBindFldAdddr not implemented\n"); @@ -62,6 +64,7 @@ DbRetVal OrderTableImpl::bindFld(const char *name, void *val, bool dummy) printError(ErrBadCall, "OrderTableImpl bindFld not implemented\n"); return ErrBadCall; } + DbRetVal OrderTableImpl::setOrderBy(const char *fldname, bool isDesc) { FieldInfo *info = new FieldInfo(); @@ -116,6 +119,7 @@ DbRetVal OrderTableImpl::setOrderBy(const char *fldname, bool isDesc) delete info; return OK; } + OrderByType OrderTableImpl::getOrderType() { ListIterator oiter = fldOrderByList.getIterator(); @@ -168,6 +172,7 @@ void OrderTableImpl::checkAndSetSortAlgorithm() } return; } + DbRetVal OrderTableImpl::execute() { nullValues = 0; @@ -189,6 +194,7 @@ DbRetVal OrderTableImpl::execute() sortIter = sortTree.getListIterator(); return OK; } + int OrderTableImpl::computeOrderBySize() { ListIterator oiter = fldOrderByList.getIterator(); @@ -201,6 +207,7 @@ int OrderTableImpl::computeOrderBySize() } return nodeOffset; } + DbRetVal OrderTableImpl::insertDistinct() { char *elem = orderBuffer; @@ -302,6 +309,7 @@ DbRetVal OrderTableImpl::insert() if (rv == ErrUnique) ::free (element); return OK; } + void* OrderTableImpl::fetch() { void *elem = sortIter.nextElement(); @@ -310,6 +318,7 @@ void* OrderTableImpl::fetch() return elem; } + void* OrderTableImpl::fetch(DbRetVal &rv) { rv = OK; @@ -329,6 +338,7 @@ void* OrderTableImpl::fetchNoBind(DbRetVal &rv) rv = OK; return fetchNoBind(); } + DbRetVal OrderTableImpl::setOrderByList(List oList) { ListIterator fIter = oList.getIterator(); @@ -340,6 +350,7 @@ DbRetVal OrderTableImpl::setOrderByList(List oList) } return OK; } + DbRetVal OrderTableImpl::copyValuesToBindBuffer(void *elem) { //Iterate through the bind list and copy the value here @@ -359,6 +370,7 @@ DbRetVal OrderTableImpl::copyValuesToBindBuffer(void *elem) } return OK; } + void OrderTableImpl::setNullableForProj() { ListIterator fIter = fldProjList.getIterator(); @@ -378,6 +390,7 @@ void OrderTableImpl::setNullableForProj() delete info; return; } + bool OrderTableImpl::isFldNull(const char *fldName) { int pos = 0; @@ -393,6 +406,7 @@ bool OrderTableImpl::isFldNull(const char *fldName) } return isFldNull(pos); } + bool OrderTableImpl::isFldNull(int projPos) { if (BITSET(nullValues, projPos)) return true; @@ -403,6 +417,7 @@ long OrderTableImpl::numTuples() { return tableHdl->numTuples(); } + DbRetVal OrderTableImpl::closeScan() { sortIter.reset(); @@ -424,6 +439,7 @@ DbRetVal OrderTableImpl::close() delete this; return OK; } + void OrderTableImpl::printPlan(int space) { char spaceBuf[IDENTIFIER_LENGTH]; diff --git a/src/storage/PageInfo.cxx b/src/storage/PageInfo.cxx index 9e16a669..fb1de22a 100644 --- a/src/storage/PageInfo.cxx +++ b/src/storage/PageInfo.cxx @@ -30,6 +30,7 @@ void PageInfo::setPageAsFree() if (ret != 0) printError(ErrSysFatal, "Fatal:CAS Failed"); return; } + void PageInfo::setPageAsUsed(size_t offset) { int ret = Mutex::CAS(&isUsed_, isUsed_,1); @@ -51,6 +52,7 @@ void PageInfo::setPageAsUsed(size_t offset) } return; } + void PageInfo::setFirstPageAsUsed() { int ret = Mutex::CASGen(&isUsed_, 0,1); diff --git a/src/storage/PredicateEvalImpl.cxx b/src/storage/PredicateEvalImpl.cxx index bcf7bd5f..a5685f3d 100644 --- a/src/storage/PredicateEvalImpl.cxx +++ b/src/storage/PredicateEvalImpl.cxx @@ -151,6 +151,7 @@ DbRetVal PredicateImpl::evaluateLogicalForTable(bool &result, char *tuple) } return OK; } + void PredicateImpl::evaluateForTable(bool &result, char *tuple) { if (!isNoLeftRight) { diff --git a/src/storage/PredicateImpl.cxx b/src/storage/PredicateImpl.cxx index ac3eeb91..0cac2a07 100644 --- a/src/storage/PredicateImpl.cxx +++ b/src/storage/PredicateImpl.cxx @@ -33,6 +33,7 @@ PredicateImpl::~PredicateImpl() // if (lhs) {delete lhs; lhs = NULL; } // if (rhs) { delete rhs; rhs = NULL; } } + void PredicateImpl::print(int space) { char spaceBuf[IDENTIFIER_LENGTH]; @@ -107,6 +108,7 @@ void PredicateImpl::setTerm(const char* fName1, ComparisionOp op, void *opnd) operand2 =NULL; operand2Ptr = NULL; } + void PredicateImpl::setTerm(Expression *exp, ComparisionOp op, void **opnd) { compOp = op; @@ -119,6 +121,7 @@ void PredicateImpl::setTerm(Expression *exp, ComparisionOp op, void **opnd) operand2Ptr = NULL; lExp = exp; } + void PredicateImpl::setTerm(Expression *exp1, ComparisionOp op, Expression *exp2) { compOp = op; @@ -132,6 +135,7 @@ void PredicateImpl::setTerm(Expression *exp1, ComparisionOp op, Expression *exp lExp = exp1; rExp = exp2; } + void PredicateImpl::setTerm(Expression *exp, ComparisionOp op, const char *fName2 ) { strcpy(fldName2, fName2); @@ -175,6 +179,7 @@ void PredicateImpl::setTerm(const char* fName1, ComparisionOp op, void **opnd) operand2 =NULL; operand2Ptr = NULL; } + void PredicateImpl::setTerm(const char* fName1, ComparisionOp op, void **opnd, AggType aType) { strcpy(fldName1, fName1); @@ -212,6 +217,7 @@ void PredicateImpl::setParent(PredicateImpl *pImpl) parent = pImpl; return; } + void PredicateImpl::setTerm(Predicate *p1, LogicalOp op, Predicate *p2 ) { if (p2 == NULL && op != OpNot || op == OpNot && p2 != NULL) @@ -237,6 +243,7 @@ void PredicateImpl::setTable(Table *tbl) rhs->setTable(tbl); table = tbl; } + void PredicateImpl::setIfNoLeftRight() { if (NULL != lhs) @@ -259,6 +266,7 @@ void PredicateImpl::setTuple(void *tpl) rhs->setTuple(tpl); tuple = tpl; } + void PredicateImpl::setProjectionList(List *lst) { if (NULL != lhs) @@ -268,6 +276,7 @@ void PredicateImpl::setProjectionList(List *lst) projList = lst; isBindBufSet = false; } + bool PredicateImpl::isSingleTerm() { if (NULL == lhs && NULL == rhs && comp2Op == OpInvalidComparisionOp) @@ -300,6 +309,7 @@ bool PredicateImpl::appendIfSameFld(char *fName, ComparisionOp op, void *buf) } return false; } + bool PredicateImpl::isIsNullInvolved() { bool lhsResult = true, rhsResult = true; @@ -318,6 +328,7 @@ bool PredicateImpl::isIsNullInvolved() } return false; } + bool PredicateImpl::isNotOrInvolved() { bool lhsResult = true, rhsResult = true; @@ -365,6 +376,7 @@ void* PredicateImpl::getValIfPointLookupOnInt(int &offset) } return val; } + void* PredicateImpl::getVal1IfBetweenOnInt(int &offset) { //perf opt if (NULL != lhs && NULL != rhs) return NULL; @@ -382,6 +394,7 @@ void* PredicateImpl::getVal1IfBetweenOnInt(int &offset) } return val; } + void* PredicateImpl::getVal2IfBetweenOnInt(int &offset) { //perf opt if (NULL != lhs && NULL != rhs) return NULL; @@ -669,6 +682,7 @@ void* PredicateImpl::valPtrForIndexField(const char *fname, bool isUnique) } return NULL; } + ComparisionOp PredicateImpl::opForIndexField(const char *fname) { ComparisionOp lhsRet= OpInvalidComparisionOp, rhsRet= OpInvalidComparisionOp; @@ -691,6 +705,7 @@ ComparisionOp PredicateImpl::opForIndexField(const char *fname) } return OpInvalidComparisionOp; } + PredicateImpl* PredicateImpl::getTablePredicate() { PredicateImpl *lhsRet = NULL, *rhsRet = NULL; @@ -721,6 +736,7 @@ PredicateImpl* PredicateImpl::getTablePredicate() } return NULL; } + PredicateImpl* PredicateImpl::getJoinPredicate() { PredicateImpl *lhsRet = NULL, *rhsRet = NULL; @@ -749,6 +765,7 @@ PredicateImpl* PredicateImpl::getJoinPredicate() } return NULL; } + void PredicateImpl::removeIfNotNecessary() { if (NULL != lhs) @@ -808,6 +825,7 @@ void PredicateImpl::removeIfNotNecessary() } return; } + bool PredicateImpl::isDummyPredicate() { if (NULL == lhs && NULL == rhs && NULL == parent @@ -817,6 +835,7 @@ bool PredicateImpl::isDummyPredicate() else return false; } + PredicateImpl* PredicateImpl::getIfOneSidedPredicate() { if (logicalOp != OpAnd) return NULL; diff --git a/src/storage/Process.cxx b/src/storage/Process.cxx index 0b499a9d..150f8977 100644 --- a/src/storage/Process.cxx +++ b/src/storage/Process.cxx @@ -106,6 +106,7 @@ DbRetVal ProcessManager::registerThread() systemDatabase->releaseProcessTableMutex(false); return OK; } + DbRetVal ProcessManager::deregisterThread(int procSlot) { //mutex.getLock(-1, false); diff --git a/src/storage/SessionImpl.cxx b/src/storage/SessionImpl.cxx index c67163b2..ff40df42 100644 --- a/src/storage/SessionImpl.cxx +++ b/src/storage/SessionImpl.cxx @@ -61,7 +61,6 @@ DbRetVal SessionImpl::initSystemDatabase() return rv; } - db->createAllCatalogTables(); //create the default dba user @@ -72,7 +71,6 @@ DbRetVal SessionImpl::initSystemDatabase() db->releaseCheckpointMutex(); return rv; } - rv = cUser.insert(DBAUSER, DBAPASS); if (OK != rv) { @@ -124,7 +122,7 @@ DbRetVal SessionImpl::open(const char *username, const char *password) { #if (defined MMDB) && (defined EMBED) openEmbeddedConnection(username, password); -# else +#else DbRetVal rv = OK; rv = readConfigFile(); if (rv != OK) @@ -213,6 +211,7 @@ DbRetVal SessionImpl::getExclusiveLock() isXTaken = true; return rv; } + DbRetVal SessionImpl::close() { # if (defined MMDB) && (defined EMBED) @@ -316,7 +315,6 @@ DbRetVal SessionImpl::commit() return OK; } - DbRetVal SessionImpl::rollback() { DbRetVal rv = OK; @@ -354,6 +352,7 @@ DbRetVal SessionImpl::readConfigFile() if (rv != 0) return ErrSysInit; return OK; } + Database* SessionImpl::getSystemDatabase() { return dbMgr->sysDb(); diff --git a/src/storage/TableDef.cxx b/src/storage/TableDef.cxx index b2f3e5fc..9fe48e21 100644 --- a/src/storage/TableDef.cxx +++ b/src/storage/TableDef.cxx @@ -22,11 +22,13 @@ TableDef::~TableDef() { reset(); } + void TableDef::reset() { fldList.removeAll(); fldCount = 0; } + int TableDef::addField(const char *name, DataType type, size_t length, const void *defaultValue, bool notNull, bool autoIn) { diff --git a/src/storage/TableImpl.cxx b/src/storage/TableImpl.cxx index 9c8e23eb..e43cb127 100644 --- a/src/storage/TableImpl.cxx +++ b/src/storage/TableImpl.cxx @@ -36,6 +36,7 @@ void Table::getFieldNameAlone(char *fname, char *name) { if (dotFound) strcpy(name, ++fullname); else strcpy(name, fname); } + void Table::getTableNameAlone(char *fname, char *name) { strcpy(name, fname); char *start = name; @@ -67,6 +68,7 @@ int TableImpl::getFldPos(char *name) { return fldList_.getFieldPosition(name); } + void TableImpl::setAliasName(char *name) { strcpy(aliasName, name); @@ -110,6 +112,7 @@ IndexType TableImpl::getIndexType(char *fName, int *pos) *(int*)pos = -1; return unknownIndex; } + void TableImpl::addPredicate(char *fName, ComparisionOp op, void *buf) { char fieldName[IDENTIFIER_LENGTH]; @@ -143,6 +146,7 @@ DbRetVal TableImpl::trySharedLock(void *curTuple, Transaction **trans) } return lockRet; } + DbRetVal TableImpl::tryExclusiveLock(void *curTuple, Transaction **trans) { DbRetVal lockRet = OK; @@ -453,6 +457,7 @@ List TableImpl::getFieldNameList() } return fldNameList; } + DbRetVal TableImpl::close() { if (iter) { iter->close(); delete iter; iter = NULL; } @@ -506,6 +511,7 @@ DbRetVal TableImpl::takeTableMutex() if (tries >= totalTries) return ErrLockTimeOut; return OK; } + DbRetVal TableImpl::releaseTableMutex() { sysDB_->releaseAllocDatabaseMutex(); @@ -532,6 +538,7 @@ DbRetVal TableImpl::lock(bool shared) */ return ret; } + DbRetVal TableImpl::unlock() { /* @@ -571,6 +578,7 @@ void *TableImpl::getBindFldAddr(const char *name) { return fldList_.getBindField(name); } + bool TableImpl::isTableInvolved(char *tblName) { //printf("Table isTableInvolved called for %s with %s\n", tblName, getName()); @@ -602,6 +610,7 @@ void TableImpl::setPredicate(Predicate *pred) pred_ = newPred; return; } + void TableImpl::printPlan(int space) { char spaceBuf[IDENTIFIER_LENGTH]; @@ -614,6 +623,7 @@ void TableImpl::printPlan(int space) if (pred) pred->print(space+2); printf("%s \n", spaceBuf); } + void TableImpl::printSQLForeignString() { DbRetVal rv=OK; @@ -669,6 +679,7 @@ void TableImpl::printSQLForeignString() } return; } + DbRetVal TableImpl::compact() { DbRetVal rv=OK; diff --git a/src/storage/TableImplReadOp.cxx b/src/storage/TableImplReadOp.cxx index 38eb6248..7060d423 100644 --- a/src/storage/TableImplReadOp.cxx +++ b/src/storage/TableImplReadOp.cxx @@ -187,6 +187,7 @@ void* TableImpl::fetch() copyValuesToBindBuffer(curTuple_); return curTuple_; } + void* TableImpl::fetch(DbRetVal &rv) { fetchNoBind(rv); @@ -318,6 +319,7 @@ void* TableImpl::fetchNoBind(DbRetVal &rv) } return curTuple_; } + DbRetVal TableImpl::fetchAgg(const char * fldName, AggType aType, void *buf, bool &noRec) { FieldInfo *info = new FieldInfo(); diff --git a/src/storage/Transaction.cxx b/src/storage/Transaction.cxx index 9242737f..60c1ab6f 100644 --- a/src/storage/Transaction.cxx +++ b/src/storage/Transaction.cxx @@ -51,6 +51,7 @@ DbRetVal Transaction::insertIntoHasList(Database *sysdb, LockHashNode *node) logFinest(Conf::logger, "Added locknode:%x to hasLockList", hasNode->node_); return OK; } + void Transaction::printTotalNodes() { TransHasNode *iter = hasLockList_; @@ -62,6 +63,7 @@ void Transaction::printTotalNodes() } //printf("TOTAL Lock Nodes %d\n", cnt); } + DbRetVal Transaction::removeFromHasList(Database *sysdb, void *tuple) { Chunk *chunk = sysdb->getSystemDatabaseChunk(TransHasTableId); @@ -118,6 +120,7 @@ DbRetVal Transaction::releaseAllLocks(LockManager *lockManager_) hasLockList_ = NULL; return OK; } + bool Transaction::findInHasList(Database *sysdb, LockHashNode *node) { TransHasNode *iter = hasLockList_; @@ -167,6 +170,7 @@ DbRetVal Transaction::appendLogicalHashUndoLog(Database *sysdb, OperationType ty printDebug(DM_Transaction, "creating logical undo log and append %x optype:%d", logInfo, type); return rv; } + DbRetVal Transaction::appendLogicalTreeUndoLog(Database *sysdb, OperationType type, void *data, size_t size) { DbRetVal rv = OK; @@ -178,6 +182,7 @@ DbRetVal Transaction::appendLogicalTreeUndoLog(Database *sysdb, OperationType ty printDebug(DM_Transaction, "creating logical undo log and append %x optype:%d", logInfo, type); return rv; } + DbRetVal Transaction::appendLogicalTrieUndoLog(Database *sysdb, OperationType type, void *data, size_t size) { DbRetVal rv = OK; @@ -254,6 +259,7 @@ int Transaction::noOfUndoLogs() } return count; } + void Transaction::printDebugInfo(Database *sysdb) { printf("\n"); @@ -295,6 +301,7 @@ void Transaction::printDebugInfo(Database *sysdb) printf("\n"); return ; } + DbRetVal Transaction::removeUndoLogs(Database *sysdb) { Chunk *chunk = sysdb->getSystemDatabaseChunk(UndoLogTableID); @@ -306,7 +313,6 @@ DbRetVal Transaction::removeUndoLogs(Database *sysdb) return OK; } - DbRetVal Transaction::applyUndoLogs(Database *sysdb) { Chunk *chunk = sysdb->getSystemDatabaseChunk(UndoLogTableID); @@ -401,6 +407,7 @@ DbRetVal Transaction::applyUndoLogs(Database *sysdb) } return OK; } + DbRetVal Transaction::handleVarcharUndoInsert(Database *sysdb, char *ptr) { // ptr will have following info encapsulated. @@ -459,6 +466,7 @@ DbRetVal Transaction::handleVarcharUndoDelete(Database *sysdb, char *ptr) } return rv; } + DbRetVal Transaction::handleVarcharUndoUpdate(Database *sysdb, char *ptr, void *ptrToTuple) { // logInfo->data_ will have following info encapsulated. diff --git a/src/storage/TreeIndex.cxx b/src/storage/TreeIndex.cxx index 140dfdc1..97e12cd8 100644 --- a/src/storage/TreeIndex.cxx +++ b/src/storage/TreeIndex.cxx @@ -73,6 +73,7 @@ DbRetVal TreeIndex::deleteLogicalUndoLog(Database *sysdb, void *data) delete info; return rv; } + DbRetVal TreeIndex::insertLogicalUndoLog(Database *sysdb, void *data) { DbRetVal rc = OK; @@ -157,6 +158,7 @@ DbRetVal TreeIndex::insertLogicalUndoLog(Database *sysdb, void *data) return rc; } + DbRetVal TreeIndex::insert(TableImpl *tbl, Transaction *tr, void *indexPtr, IndexInfo *indInfo, void *tuple, bool undoFlag) { HashIndexInfo *info = (HashIndexInfo*) indInfo; @@ -318,6 +320,7 @@ DbRetVal TreeIndex::remove(TableImpl *tbl, Transaction *tr, void *indexPtr, Inde } return rc; } + void TreeIndex::removeNode(Database *db,void *indexPtr,TreeNode *fltnode, TreeNode *node,int pos) { CINDEX *iptr = (CINDEX*)indexPtr; @@ -468,6 +471,7 @@ DbRetVal TreeIndex::getTreeNodeMutex(TreeNode *node, int procSlot, bool isX) return OK; } + DbRetVal TreeIndex::upgradeTreeNodeMutex(TreeNode *node, int procSlot) { struct timeval timeout, timeval; diff --git a/src/storage/TreeIter.cxx b/src/storage/TreeIter.cxx index cea11481..aea8be10 100644 --- a/src/storage/TreeIter.cxx +++ b/src/storage/TreeIter.cxx @@ -64,6 +64,7 @@ void* TreeIter::prev() rec = (char**)((char *)rec + ((nodeOffset) * sizeof(void **))); return *rec; } + void TreeIter::nextNode() { if (recordsOver) return ; @@ -197,6 +198,7 @@ void* TreeIter::next() } return NULL; } + void* TreeIter::locateNode() { TreeNode *tnode=NULL; diff --git a/src/storage/TreeNode.cxx b/src/storage/TreeNode.cxx index fd7740b8..32d598cc 100644 --- a/src/storage/TreeNode.cxx +++ b/src/storage/TreeNode.cxx @@ -39,6 +39,7 @@ long long TreeNode::getTotalElements() } return totalElement; } + void TreeNode::displayAll(int fldOffset) { DbRetVal rv=OK; @@ -70,6 +71,7 @@ void TreeNode::displayAll(int fldOffset) } printf("\n"); } + void TreeNode::displayAll() { DbRetVal rv=OK; @@ -771,6 +773,7 @@ TreeNode* TreeNode::locateNode(Database *db, TreeNode *iter, void *tuple, IndexI return iter; } + TreeNode *TreeNode::locateNodeFromFirstLevel(TreeNode *ftnode, IndexInfo *indInfo,void *tuple, int *pos) { HashIndexInfo *info = (HashIndexInfo*) indInfo; diff --git a/src/storage/TrieIndex.cxx b/src/storage/TrieIndex.cxx index 688f9a8d..127c1a97 100644 --- a/src/storage/TrieIndex.cxx +++ b/src/storage/TrieIndex.cxx @@ -165,6 +165,7 @@ DbRetVal TrieIndex::insert(TableImpl *tbl, Transaction *tr, void *indexPtr, Inde } return rv; } + DbRetVal TrieIndex::addToValueList(Database *db, void **ptr, Chunk *hIdxNodeChunk, IndexInfo *info, void *tuple, void *keyPtr) { @@ -365,6 +366,7 @@ DbRetVal TrieIndex::deleteLogicalUndoLog(Database *sysdb, void *data) } return OK; } + void TrieIndex::displayAll(TrieNode *start, int level) { printTrieNode(start, level); @@ -374,6 +376,7 @@ void TrieIndex::displayAll(TrieNode *start, int level) if (start->next_[i]) displayAll(start->next_[i], level); } } + void TrieIndex::printTrieNode(TrieNode *node, int level) { printf("Trie %x Level %d child:", node, level); diff --git a/src/storage/TupleIterator.cxx b/src/storage/TupleIterator.cxx index 3faec215..c3170ece 100644 --- a/src/storage/TupleIterator.cxx +++ b/src/storage/TupleIterator.cxx @@ -48,6 +48,7 @@ DbRetVal TupleIterator::setPlan() if(predImpl) predImpl->setIfNoLeftRight(); return OK; } + DbRetVal TupleIterator::open() { PredicateImpl *predImpl = (PredicateImpl*) pred_; -- 2.11.4.GIT