include/Debug.h File Reference

#include <ErrorType.h>
#include <Mutex.h>

Include dependency graph for Debug.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  Logger

Defines

#define DEBUG   1
#define printError(a,)   printError1(a, __FILE__, __LINE__, __VA_ARGS__)
#define printDebug(a,)   printDebug1(a, __FILE__, __LINE__, __VA_ARGS__)
#define MAX_TRACE_LOG_LENGTH   1024
#define logFinest(logger,)
#define logFiner(logger,)
#define logFine(logger,)

Enumerations

enum  DebugModule {
  DM_Alloc = 0, DM_VarAlloc, DM_Lock, DM_Transaction,
  DM_UndoLog, DM_RedoLog, DM_Index, DM_HashIndex,
  DM_SystemDatabase, DM_Database, DM_Table, DM_Predicate,
  DM_Iterator, DM_Process, DM_Network, DM_Gateway,
  DM_Adapter, DM_SqlLog
}
enum  LogLevel { LogOff = 0, LogFine, LogFiner, LogFinest }

Functions

int printError1 (DbRetVal val, char *fname, int lno, char *format,...)
int printDebug1 (int module, char *fname, int lineno, char *format,...)

Variables

int DebugDM_Alloc
int DebugDM_VarAlloc
int DebugDM_Lock
int DebugDM_Transaction
int DebugDM_UndoLog
int DebugDM_RedoLog
int DebugDM_Index
int DebugDM_HashIndex
int DebugDM_SystemDatabase
int DebugDM_Database
int DebugDM_Table
int DebugDM_Predicate
int DebugDM_Iterator
int DebugDM_Process
int DebugDM_Network
int DebugDM_Gateway
int DebugDM_Adapter
int DebugDM_SqlLog
static char moduleNames [][20]
static char levelNames [][10]
static Logger logger


Define Documentation

#define DEBUG   1

Definition at line 19 of file Debug.h.

#define logFine ( logger   ) 

Value:

{\
  (logger).log(LogFine, __FILE__, __LINE__, __VA_ARGS__);\
};

Definition at line 123 of file Debug.h.

Referenced by logActiveProcs(), main(), and releaseAllResources().

#define logFiner ( logger   ) 

Value:

{\
  (logger).log(LogFiner, __FILE__, __LINE__, __VA_ARGS__);\
};

Definition at line 118 of file Debug.h.

#define logFinest ( logger   ) 

Value:

{\
  (logger).log(LogFinest, __FILE__, __LINE__, __VA_ARGS__);\
};

Definition at line 113 of file Debug.h.

Referenced by Connection::close(), DatabaseManagerImpl::closeDatabase(), DatabaseManagerImpl::closeTable(), DatabaseManagerImpl::createDatabase(), DatabaseManagerImpl::createTable(), DatabaseManagerImpl::deleteDatabase(), DatabaseManagerImpl::dropTable(), Connection::open(), DatabaseManagerImpl::openDatabase(), and DatabaseManagerImpl::openTable().

#define MAX_TRACE_LOG_LENGTH   1024

Definition at line 83 of file Debug.h.

Referenced by Logger::createLogRecord(), and Logger::log().

#define printDebug (  )     printDebug1(a, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 76 of file Debug.h.

Referenced by ProcessManager::addMutex(), Chunk::allocate(), Transaction::appendLogicalUndoLog(), Transaction::appendUndoLog(), DatabaseManagerImpl::closeDatabase(), DatabaseManagerImpl::closeTable(), TransactionManager::commit(), Chunk::compact(), DatabaseManagerImpl::createDatabase(), Database::createSystemDatabaseChunk(), DatabaseManagerImpl::createTable(), DatabaseManagerImpl::dropTable(), PredicateImpl::evaluate(), LockManager::getExclusiveLock(), Database::getFreePage(), LockManager::getSharedLock(), ProcessManager::getThreadTransaction(), ProcessManager::getThreadTransAddr(), HashIndex::insert(), CatalogTableINDEXFIELD::insert(), CatalogTableINDEX::insert(), CatalogTableFIELD::insert(), CatalogTableTABLE::insert(), BucketList::insert(), Transaction::insertIntoHasList(), LockManager::isExclusiveLocked(), CacheTableLoader::load(), PacketPrepare::marshall(), TupleIterator::next(), BucketIter::next(), ChunkIterator::nextElement(), TupleIterator::open(), DatabaseManagerImpl::openDatabase(), DatabaseManagerImpl::openTable(), SqlGwStatement::prepare(), Database::printStatistics(), SqlNetworkHandler::processCommit(), SqlNetworkHandler::processPrepare(), NetworkTable::readNetworkConfig(), CacheTableLoader::recoverAllCachedTables(), ProcessManager::registerThread(), DatabaseManagerImpl::registerThread(), Transaction::releaseAllLocks(), LockManager::releaseLock(), HashIndex::remove(), CatalogTableINDEXFIELD::remove(), CatalogTableINDEX::remove(), CatalogTableFIELD::remove(), CatalogTableTABLE::remove(), ProcessManager::removeMutex(), TransactionManager::rollback(), ProcessManager::setThreadTransaction(), TransactionManager::startTransaction(), PacketPrepare::unmarshall(), and HashIndex::update().

#define printError (  )     printError1(a, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 42 of file Debug.h.

Referenced by TableDef::addField(), CacheTableLoader::addToCacheTableFile(), Chunk::allocate(), Database::allocLockHashBuckets(), SqlOdbcStatement::bindField(), TableImpl::bindFld(), SqlLogStatement::bindParam(), SqlGwStatement::bindParam(), SqlOdbcStatement::bindParam(), CatalogTableUSER::changePass(), UserManagerImpl::changePassword(), cleanupDeadProcs(), TableImpl::clearFldNull(), TableImpl::close(), TransactionManager::commit(), SessionImpl::commit(), UDPClient::connect(), TCPClient::connect(), NetworkTable::connect(), SqlOdbcConnection::connect(), DatabaseManagerImpl::createDatabase(), DatabaseManagerImpl::createIndex(), Database::createSystemDatabaseChunk(), DatabaseManagerImpl::createTable(), UserManagerImpl::createUser(), TableImpl::deleteTuple(), UserManagerImpl::deleteUser(), TableImpl::deleteWhere(), ProcessManager::deregisterThread(), TCPClient::disconnect(), DatabaseManagerImpl::dropTable(), SqlStatement::execute(), TableImpl::execute(), SqlStatement::fetch(), SelStatement::fetch(), SqlStatement::fetchAndPrint(), TableImpl::fetchNoBind(), Chunk::free(), CatalogTableINDEX::get(), DatabaseManagerImpl::getAllTableNames(), SessionImpl::getDatabaseManager(), LockManager::getExclusiveLock(), SelStatement::getFieldName(), CatalogTableINDEXFIELD::getFieldNameAndType(), CatalogTableFIELD::getFieldPtrs(), Database::getFreePage(), UpdStatement::getParamFldInfo(), SelStatement::getParamFldInfo(), InsStatement::getParamFldInfo(), DelStatement::getParamFldInfo(), SelStatement::getProjFldInfo(), getRecordsFromTargetDb(), LockManager::getSharedLock(), SessionImpl::getUserManager(), UDPServer::handleClient(), TCPServer::handleClient(), SessionImpl::initSystemDatabase(), insert(), HashIndex::insert(), CatalogTableUSER::insert(), CatalogTableINDEXFIELD::insert(), CatalogTableINDEX::insert(), CatalogTableFIELD::insert(), CatalogTableTABLE::insert(), BucketList::insert(), Transaction::insertIntoHasList(), TableImpl::insertTuple(), isCached(), LockManager::isExclusiveLocked(), TableImpl::isFldNull(), SqlLogConnection::isTableCached(), CacheTableLoader::load(), Logger::log(), logActiveProcs(), main(), TableImpl::markFldNull(), ChunkIterator::nextElement(), TupleIterator::open(), SessionImpl::open(), Connection::open(), DatabaseManagerImpl::openDatabase(), DatabaseManagerImpl::openTable(), SqlStatement::prepare(), SqlGwStatement::prepare(), SqlNetworkHandler::processCommit(), SqlNetworkHandler::processPrepare(), Config::readAllValues(), SessionImpl::readConfigFile(), NetworkTable::readNetworkConfig(), UDPClient::receive(), TCPClient::receive(), CacheTableLoader::recoverAllCachedTables(), ProcessManager::registerThread(), DatabaseManagerImpl::registerThread(), LockManager::releaseLock(), HashIndex::remove(), FieldNameList::remove(), FieldList::remove(), CatalogTableUSER::remove(), CatalogTableINDEX::remove(), CatalogTableTABLE::remove(), BucketList::remove(), List::remove(), CacheTableLoader::removeFromCacheTableFile(), Transaction::removeFromHasList(), SqlLogConnection::removePreparePacket(), UpdStatement::resolve(), SelStatement::resolve(), InsStatement::resolve(), DelStatement::resolve(), CreateTblStatement::resolve(), UpdStatement::resolveForAssignment(), DelStatement::resolveForCondition(), TransactionManager::rollback(), SessionImpl::rollback(), UDPClient::send(), TCPClient::send(), UpdStatement::setByteIntParam(), SelStatement::setByteIntParam(), InsStatement::setByteIntParam(), DelStatement::setByteIntParam(), UpdStatement::setDateParam(), SelStatement::setDateParam(), InsStatement::setDateParam(), DelStatement::setDateParam(), UpdStatement::setDoubleParam(), SelStatement::setDoubleParam(), InsStatement::setDoubleParam(), DelStatement::setDoubleParam(), PacketCommit::setExecPackets(), UpdStatement::setFloatParam(), SelStatement::setFloatParam(), InsStatement::setFloatParam(), DelStatement::setFloatParam(), UpdStatement::setIntParam(), SelStatement::setIntParam(), InsStatement::setIntParam(), DelStatement::setIntParam(), UpdStatement::setLongLongParam(), SelStatement::setLongLongParam(), InsStatement::setLongLongParam(), DelStatement::setLongLongParam(), UpdStatement::setLongParam(), SelStatement::setLongParam(), InsStatement::setLongParam(), DelStatement::setLongParam(), UpdStatement::setShortParam(), SelStatement::setShortParam(), InsStatement::setShortParam(), DelStatement::setShortParam(), UpdStatement::setStringParam(), SelStatement::setStringParam(), InsStatement::setStringParam(), DelStatement::setStringParam(), ProcessManager::setThreadTransaction(), UpdStatement::setTimeParam(), SelStatement::setTimeParam(), InsStatement::setTimeParam(), DelStatement::setTimeParam(), UpdStatement::setTimeStampParam(), SelStatement::setTimeStampParam(), InsStatement::setTimeStampParam(), DelStatement::setTimeStampParam(), UDPServer::start(), TCPServer::start(), Logger::startLogger(), TransactionManager::startTransaction(), SessionImpl::startTransaction(), Mutex::tryLock(), CacheTableLoader::unload(), HashIndex::update(), FieldList::updateBindVal(), TableImpl::updateTuple(), verifyCount(), and verifyPrimKeyFldVal().


Enumeration Type Documentation

enum DebugModule

Enumerator:
DM_Alloc 
DM_VarAlloc 
DM_Lock 
DM_Transaction 
DM_UndoLog 
DM_RedoLog 
DM_Index 
DM_HashIndex 
DM_SystemDatabase 
DM_Database 
DM_Table 
DM_Predicate 
DM_Iterator 
DM_Process 
DM_Network 
DM_Gateway 
DM_Adapter 
DM_SqlLog 

Definition at line 44 of file Debug.h.

00045 {
00046     DM_Alloc = 0,
00047     DM_VarAlloc,
00048     DM_Lock,
00049     DM_Transaction,
00050     DM_UndoLog,
00051     DM_RedoLog,
00052     DM_Index,
00053     DM_HashIndex,
00054     DM_SystemDatabase,
00055     DM_Database,
00056     DM_Table,
00057     DM_Predicate,
00058     DM_Iterator,
00059     DM_Process,
00060     DM_Network,
00061     DM_Gateway,
00062     DM_Adapter,
00063     DM_SqlLog
00064 };

enum LogLevel

Enumerator:
LogOff 
LogFine 
LogFiner 
LogFinest 

Definition at line 85 of file Debug.h.

00086 {
00087     LogOff = 0,
00088     LogFine,
00089     LogFiner,
00090     LogFinest
00091 };


Function Documentation

int printDebug1 ( int  module,
char *  fname,
int  lineno,
char *  format,
  ... 
)

Definition at line 61 of file Debug.cxx.

References DebugDM_Adapter, DebugDM_Alloc, DebugDM_Database, DebugDM_Gateway, DebugDM_HashIndex, DebugDM_Lock, DebugDM_Network, DebugDM_Predicate, DebugDM_Process, DebugDM_RedoLog, DebugDM_SqlLog, DebugDM_SystemDatabase, DebugDM_Table, DebugDM_TableIterator, DebugDM_Transaction, DebugDM_UndoLog, DebugDM_VarAlloc, DM_Adapter, DM_Alloc, DM_Database, DM_Gateway, DM_HashIndex, DM_Iterator, DM_Lock, DM_Network, DM_Predicate, DM_Process, DM_RedoLog, DM_SqlLog, DM_SystemDatabase, DM_Table, DM_Transaction, DM_UndoLog, DM_VarAlloc, os::getpid(), os::getthrid(), moduleNames, and os::write().

00062 {
00063   switch(module) {
00064      case DM_Alloc: { if (!DebugDM_Alloc) return 1; break; }
00065      case DM_VarAlloc: { if (!DebugDM_VarAlloc) return 1; break; }
00066      case DM_Lock: { if (!DebugDM_Lock) return 1; break; }
00067      case DM_Transaction: { if (!DebugDM_Transaction) return 1; break; }
00068      case DM_UndoLog: { if (!DebugDM_UndoLog) return 1; break; }
00069      case DM_RedoLog: { if (!DebugDM_RedoLog) return 1; break; }
00070      case DM_HashIndex: { if (!DebugDM_HashIndex) return 1; break; }
00071      case DM_SystemDatabase: { if (!DebugDM_SystemDatabase) return 1; break; }
00072      case DM_Database: { if (!DebugDM_Database) return 1; break; }
00073      case DM_Table: { if (!DebugDM_Table) return 1; break; }
00074      case DM_Iterator: { if (!DebugDM_TableIterator) return 1; break; }
00075      case DM_Predicate: { if (!DebugDM_Predicate) return 1; break; }
00076      case DM_Process: { if (!DebugDM_Process) return 1; break; }
00077      case DM_Network: { if (!DebugDM_Network) return 1; break; }
00078      case DM_Gateway: { if (!DebugDM_Gateway) return 1; break; }
00079      case DM_Adapter: { if (!DebugDM_Adapter) return 1; break; }
00080      case DM_SqlLog: { if (!DebugDM_SqlLog) return 1; break; }
00081 
00082   }
00083 
00084   va_list ap;
00085   char mesgBuf[1024];
00086 
00087   sprintf(mesgBuf, "D:%s:%d:%lu:%s:%d:", moduleNames[module],
00088            os::getpid(), os::getthrid(), fname, lno);
00089   os::write(1, mesgBuf, strlen(mesgBuf));
00090 
00091   va_start(ap, format);
00092 
00093   int err = ::vsnprintf(mesgBuf, sizeof(mesgBuf), format,ap);
00094   if(err < 0) {
00095       return err;
00096   }
00097   os::write(1, mesgBuf, strlen(mesgBuf));
00098   strcpy(mesgBuf,"\n");
00099   os::write(1, mesgBuf, strlen(mesgBuf));
00100    //1->stdout
00101   return 0;
00102 }

Here is the call graph for this function:

int printError1 ( DbRetVal  val,
char *  fname,
int  lno,
char *  format,
  ... 
)

Definition at line 37 of file Debug.cxx.

References os::getpid(), os::getthrid(), and os::write().

00038 {
00039   va_list ap;
00040   char mesgBuf[1024];
00041 
00042   sprintf(mesgBuf, "%d:%lu:%s:%d:",
00043            os::getpid(), os::getthrid(), fname, lno);
00044   os::write(2, mesgBuf, strlen(mesgBuf));
00045 
00046   va_start(ap, format);
00047 
00048   int err = ::vsnprintf(mesgBuf, sizeof(mesgBuf), format,ap);
00049   if(err < 0) {
00050       return err;
00051   }
00052   os::write(2, mesgBuf, strlen(mesgBuf));
00053   strcpy(mesgBuf,"\n");
00054   os::write(2, mesgBuf, strlen(mesgBuf));
00055    //2->stderr
00056   return 0;
00057 }

Here is the call graph for this function:


Variable Documentation

int DebugDM_Adapter

Definition at line 34 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_Alloc

Definition at line 18 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_Database

Definition at line 27 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_Gateway

Definition at line 33 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_HashIndex

Definition at line 25 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_Index

Definition at line 24 of file Debug.cxx.

int DebugDM_Iterator

int DebugDM_Lock

Definition at line 20 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_Network

Definition at line 32 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_Predicate

Definition at line 29 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_Process

Definition at line 31 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_RedoLog

Definition at line 23 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_SqlLog

Definition at line 35 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_SystemDatabase

Definition at line 26 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_Table

Definition at line 28 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_Transaction

Definition at line 21 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_UndoLog

Definition at line 22 of file Debug.cxx.

Referenced by printDebug1().

int DebugDM_VarAlloc

Definition at line 19 of file Debug.cxx.

Referenced by printDebug1().

char levelNames[][10] [static]

Initial value:

{
     "OFF", "FINE", "FINER", "FINEST"
}

Definition at line 93 of file Debug.h.

Referenced by Logger::createLogRecord().

Logger logger [static]

Definition at line 111 of file Debug.h.

Referenced by Connection::close(), DatabaseManagerImpl::closeDatabase(), DatabaseManagerImpl::closeTable(), DatabaseManagerImpl::createDatabase(), DatabaseManagerImpl::createTable(), DatabaseManagerImpl::deleteDatabase(), DatabaseManagerImpl::dropTable(), logActiveProcs(), main(), Connection::open(), DatabaseManagerImpl::openDatabase(), DatabaseManagerImpl::openTable(), and releaseAllResources().

char moduleNames[][20] [static]

Initial value:

{
    "Alloc", "VariableAlloc", "Lock", "Trans", "UndoLog", "RedoLog", "Index",
    "HashIndex", "SysDb", "Db", "Table", "Predicate", "Iter", "Procmgmt",
    "Network", "Gateway", "Adapter", "SqlLog"
}

Definition at line 65 of file Debug.h.

Referenced by printDebug1().


Generated on Mon Jun 9 22:37:48 2008 for csql by  doxygen 1.4.7