FtrsTableWriter Class Reference

FtrsTableWriter performs inserts, updates, and deletes on the indexes making up a table. More...

#include <FtrsTableWriter.h>

Inheritance diagram for FtrsTableWriter:

LogicalTxnParticipant List of all members.

Public Member Functions

RecordNum execute (ExecStreamQuantum const &quantum, ExecStreamBufAccessor &bufAccessor, LogicalActionType actionType, SXMutex &actionMutex)
 Reads all tuples from a buffer and uses them as input to perform the requested action on the target table.
uint getIndexCount () const
void openIndexWriters ()
void closeIndexWriters ()
virtual LogicalTxnClassId getParticipantClassId () const
 
Returns:
the LogicalTxnClassId for this participant; this will be used during recovery to find the correct LogicalTxnParticipantFactory

virtual void describeParticipant (ByteOutputStream &logStream)
 Called by LogicalTxn the first time an action is logged for this participant.
virtual void undoLogicalAction (LogicalActionType actionType, ByteInputStream &logStream)
 Performs undo for one logical action during rollback or recovery.
virtual void redoLogicalAction (LogicalActionType actionType, ByteInputStream &logStream)
 Performs redo for one logical action during recovery.

Static Public Attributes

static const LogicalActionType ACTION_INSERT
 LogicalActionType for inserting a table tuple.
static const LogicalActionType ACTION_DELETE
 LogicalActionType for deleting a table tuple.
static const LogicalActionType ACTION_UPDATE
 LogicalActionType for updating a table tuple.
static const LogicalActionType ACTION_REVERSE_UPDATE
 LogicalActionType for reversing the update of a table tuple.

Protected Member Functions

LogicalTxngetLogicalTxn ()
 
Returns:
LogicalTxn being participated in, or null if no txn in progress; null is also returned during recovery

bool isLoggingEnabled () const
 
Returns:
true if actions should be logged; this is false during recovery


Private Types

typedef std::vector< FtrsTableIndexWriterIndexWriterVector

Private Member Functions

FtrsTableIndexWritercreateIndexWriter (FtrsTableIndexWriter &, FtrsTableIndexWriterParams const &)
void insertIntoIndex (FtrsTableIndexWriter &)
void deleteFromIndex (FtrsTableIndexWriter &)
void describeIndex (FtrsTableIndexWriter &, ByteOutputStream *pLogStream)
void executeUpdate (bool reverse)
void modifyAllIndexes (LogicalActionType)
void modifySomeIndexes (LogicalActionType, IndexWriterVector::iterator &, IndexWriterVector::iterator)
void executeTuple (LogicalActionType)
void copyNewValues ()
void copyOldValues ()
bool searchForIndexKey (FtrsTableIndexWriter &)
 FtrsTableWriter (FtrsTableWriterParams const &params)
PageOwnerId getTableId ()

Private Attributes

uint nAttrs
TupleAccessor tupleAccessor
IndexWriterVector indexWriters
FtrsTableIndexWriterpClusteredIndexWriter
TupleProjection updateProj
TupleData updateTupleData
TupleDatapTupleData
boost::scoped_array< FixedBufferlogBuf

Friends

class FtrsTableWriterFactory

Detailed Description

FtrsTableWriter performs inserts, updates, and deletes on the indexes making up a table.

Definition at line 81 of file FtrsTableWriter.h.


Member Typedef Documentation

typedef std::vector<FtrsTableIndexWriter> FtrsTableWriter::IndexWriterVector [private]

Definition at line 86 of file FtrsTableWriter.h.


Constructor & Destructor Documentation

FtrsTableWriter::FtrsTableWriter ( FtrsTableWriterParams const &  params  )  [explicit, private]

Definition at line 48 of file FtrsTableWriter.cpp.

References TupleData::compute(), TupleAccessor::compute(), createIndexWriter(), FixedBuffer, TupleAccessor::getMaxByteCount(), FtrsTableWriterParams::indexParams, indexWriters, logBuf, nAttrs, pClusteredIndexWriter, pTupleData, FtrsTableIndexWriter::pWriter, tupleAccessor, FtrsTableIndexWriter::tupleData, FtrsTableWriterParams::updateProj, updateProj, and updateTupleData.

00049 {
00050     updateProj = params.updateProj;
00051     pClusteredIndexWriter = NULL;
00052     indexWriters.resize(params.indexParams.size());
00053     std::transform(
00054         indexWriters.begin(),
00055         indexWriters.end(),
00056         params.indexParams.begin(),
00057         indexWriters.begin(),
00058         boost::bind(&FtrsTableWriter::createIndexWriter,this,_1,_2));
00059     assert(pClusteredIndexWriter);
00060 
00061     pTupleData = &(pClusteredIndexWriter->tupleData);
00062 
00063     if (!updateProj.empty()) {
00064         TupleDescriptor tupleDesc =
00065             pClusteredIndexWriter->pWriter->getTupleDescriptor();
00066         for (uint i = 0; i < updateProj.size(); ++i) {
00067             tupleDesc.push_back(tupleDesc[updateProj[i]]);
00068         }
00069         tupleAccessor.compute(tupleDesc);
00070         updateTupleData.compute(tupleDesc);
00071         pTupleData = &updateTupleData;
00072     }
00073 
00074     nAttrs = pClusteredIndexWriter->tupleData.size();
00075 
00076     logBuf.reset(new FixedBuffer[tupleAccessor.getMaxByteCount()]);
00077 }


Member Function Documentation

FtrsTableIndexWriter & FtrsTableWriter::createIndexWriter ( FtrsTableIndexWriter ,
FtrsTableIndexWriterParams const &   
) [private]

Definition at line 79 of file FtrsTableWriter.cpp.

References TupleAccessor::compute(), TupleData::compute(), BTreeInsertExecStreamParams::distinctness, FtrsTableIndexWriter::distinctness, FtrsTableIndexWriter::inputKeyProj, FtrsTableIndexWriterParams::inputProj, FtrsTableIndexWriter::inputProj, BTreeExecStream::newWriter(), pClusteredIndexWriter, BTreeParams::pRootMap, FtrsTableIndexWriter::pRootMap, FtrsTableIndexWriter::pWriter, tupleAccessor, FtrsTableIndexWriter::tupleData, FtrsTableIndexWriterParams::updateInPlace, and FtrsTableIndexWriter::updateInPlace.

Referenced by FtrsTableWriter().

00082 {
00083     indexWriter.pWriter = BTreeExecStream::newWriter(indexParams);
00084     indexWriter.distinctness = indexParams.distinctness;
00085     indexWriter.updateInPlace = indexParams.updateInPlace;
00086     indexWriter.inputProj = indexParams.inputProj;
00087     indexWriter.pRootMap = indexParams.pRootMap;
00088     if (indexWriter.inputProj.size()) {
00089         indexWriter.tupleData.compute(
00090             indexWriter.pWriter->getTupleDescriptor());
00091         // TODO:  TupleProjection folding util
00092         TupleProjection const &keyProj =
00093             indexWriter.pWriter->getKeyProjection();
00094         for (uint i = 0; i < keyProj.size(); ++i) {
00095             indexWriter.inputKeyProj.push_back(
00096                 indexWriter.inputProj[keyProj[i]]);
00097         }
00098     } else {
00099         // TODO:  tuple format?
00100 
00101         // this is the clustered index:  its tuple will drive the other indexes
00102         TupleDescriptor const &clusteredTupleDesc =
00103             indexWriter.pWriter->getTupleDescriptor();
00104         tupleAccessor.compute(clusteredTupleDesc);
00105         indexWriter.tupleData.compute(clusteredTupleDesc);
00106         assert(!pClusteredIndexWriter);
00107         pClusteredIndexWriter = &indexWriter;
00108 
00109         indexWriter.inputKeyProj =
00110             indexWriter.pWriter->getKeyProjection();
00111     }
00112     return indexWriter;
00113 }

void FtrsTableWriter::insertIntoIndex ( FtrsTableIndexWriter  )  [inline, private]

Definition at line 126 of file FtrsTableWriter.cpp.

References FtrsTableIndexWriter::distinctness, FtrsTableIndexWriter::inputProj, pClusteredIndexWriter, FtrsTableIndexWriter::pWriter, searchForIndexKey(), FtrsTableIndexWriter::tupleData, and FtrsTableIndexWriter::updateInPlace.

Referenced by modifySomeIndexes().

00128 {
00129     for (uint i = 0; i < indexWriter.inputProj.size(); ++i) {
00130         indexWriter.tupleData[i] =
00131             pClusteredIndexWriter->tupleData[indexWriter.inputProj[i]];
00132     }
00133     if (indexWriter.updateInPlace) {
00134         if (searchForIndexKey(indexWriter)) {
00135             if (indexWriter.pWriter->updateCurrent(indexWriter.tupleData)) {
00136                 indexWriter.pWriter->endSearch();
00137                 return;
00138             }
00139             // couldn't update in place:  treat as a deletion+insertion instead
00140             indexWriter.pWriter->deleteCurrent();
00141 
00142             // REVIEW jvs 26-Jun-2007:  doesn't insertTupleData below
00143             // assume that the writer is still positioned?
00144             // So why do we call endSearch here?
00145             indexWriter.pWriter->endSearch();
00146         } else {
00147             // REVIEW:  can this happen?  If so, should we insert?
00148             permAssert(false);
00149         }
00150     }
00151     indexWriter.pWriter->insertTupleData(
00152         indexWriter.tupleData,
00153         indexWriter.distinctness);
00154 }

void FtrsTableWriter::deleteFromIndex ( FtrsTableIndexWriter  )  [inline, private]

Definition at line 156 of file FtrsTableWriter.cpp.

References FtrsTableIndexWriter::pWriter, and searchForIndexKey().

Referenced by modifySomeIndexes().

00158 {
00159     if (searchForIndexKey(indexWriter)) {
00160         // REVIEW:  under what circumstances can we assert when the key doesn't
00161         // exist?
00162         indexWriter.pWriter->deleteCurrent();
00163     }
00164     indexWriter.pWriter->endSearch();
00165 }

void FtrsTableWriter::describeIndex ( FtrsTableIndexWriter ,
ByteOutputStream pLogStream 
) [private]

Definition at line 349 of file FtrsTableWriter.cpp.

References FtrsTableIndexWriter::distinctness, FtrsTableIndexWriter::inputProj, FtrsTableIndexWriter::pWriter, FtrsTableIndexWriter::updateInPlace, TupleProjection::writePersistent(), and ByteOutputStream::writeValue().

Referenced by describeParticipant().

00352 {
00353     pLogStream->writeValue(indexWriter.pWriter->getSegmentId());
00354     pLogStream->writeValue(indexWriter.pWriter->getPageOwnerId());
00355     pLogStream->writeValue(indexWriter.pWriter->getRootPageId());
00356     pLogStream->writeValue(indexWriter.distinctness);
00357     pLogStream->writeValue(indexWriter.updateInPlace);
00358     indexWriter.inputProj.writePersistent(*pLogStream);
00359     indexWriter.pWriter->getKeyProjection().writePersistent(
00360         *pLogStream);
00361 }

void FtrsTableWriter::executeUpdate ( bool  reverse  )  [private]

Definition at line 228 of file FtrsTableWriter.cpp.

References ACTION_DELETE, ACTION_INSERT, copyNewValues(), copyOldValues(), modifyAllIndexes(), nAttrs, pClusteredIndexWriter, pTupleData, and FtrsTableIndexWriter::tupleData.

Referenced by executeTuple().

00229 {
00230     // copy old values to be deleted
00231     std::copy(
00232         pTupleData->begin(),
00233         pTupleData->begin() + nAttrs,
00234         pClusteredIndexWriter->tupleData.begin());
00235 
00236     if (reverse) {
00237         // for reverse, overlay new values instead
00238         copyNewValues();
00239     }
00240 
00241     modifyAllIndexes(ACTION_DELETE);
00242 
00243     if (reverse) {
00244         // overlay old values to be inserted
00245         copyOldValues();
00246     } else {
00247         // overlay new values to be inserted
00248         copyNewValues();
00249     }
00250 
00251     try {
00252         modifyAllIndexes(ACTION_INSERT);
00253     } catch (...) {
00254         // In case of exception while inserting, put back original row.
00255         try {
00256             if (reverse) {
00257                 copyNewValues();
00258             } else {
00259                 copyOldValues();
00260             }
00261             modifyAllIndexes(ACTION_INSERT);
00262         } catch (...) {
00263             // If this rollback fails, don't allow exception to hide original
00264             // exception.  But TODO:  trace.
00265             permAssert(false);
00266         }
00267         throw;
00268     }
00269 }

void FtrsTableWriter::modifyAllIndexes ( LogicalActionType   )  [inline, private]

Definition at line 190 of file FtrsTableWriter.cpp.

References ACTION_DELETE, ACTION_INSERT, indexWriters, and modifySomeIndexes().

Referenced by executeTuple(), and executeUpdate().

00191 {
00192     IndexWriterVector::iterator first = indexWriters.begin();
00193     IndexWriterVector::iterator current = first;
00194     try {
00195         modifySomeIndexes(actionType,current,indexWriters.end());
00196     } catch (...) {
00197         // In case of exception, carefully roll back only those indexes which
00198         // were already modified.
00199         try {
00200             LogicalActionType compensatingActionType =
00201                 (actionType == ACTION_INSERT) ? ACTION_DELETE : ACTION_INSERT;
00202             modifySomeIndexes(compensatingActionType,first,current);
00203         } catch (...) {
00204             // If this rollback fails, don't allow exception to hide original
00205             // exception.  But TODO:  trace.
00206             permAssert(false);
00207         }
00208         throw;
00209     }
00210 }

void FtrsTableWriter::modifySomeIndexes ( LogicalActionType  ,
IndexWriterVector::iterator &  ,
IndexWriterVector::iterator   
) [inline, private]

Definition at line 167 of file FtrsTableWriter.cpp.

References ACTION_DELETE, ACTION_INSERT, deleteFromIndex(), and insertIntoIndex().

Referenced by modifyAllIndexes().

00171 {
00172     switch (actionType) {
00173     case ACTION_INSERT:
00174         for (; first != last; ++first) {
00175             insertIntoIndex(*first);
00176         }
00177         break;
00178     case ACTION_DELETE:
00179         for (; first != last; ++first) {
00180             if (!first->updateInPlace) {
00181                 deleteFromIndex(*first);
00182             }
00183         }
00184         break;
00185     default:
00186         permAssert(false);
00187     }
00188 }

void FtrsTableWriter::executeTuple ( LogicalActionType   )  [inline, private]

Definition at line 271 of file FtrsTableWriter.cpp.

References ACTION_DELETE, ACTION_INSERT, ACTION_REVERSE_UPDATE, ACTION_UPDATE, executeUpdate(), and modifyAllIndexes().

Referenced by execute(), and redoLogicalAction().

00272 {
00273     switch (actionType) {
00274     case ACTION_INSERT:
00275     case ACTION_DELETE:
00276         modifyAllIndexes(actionType);
00277         break;
00278     case ACTION_UPDATE:
00279         executeUpdate(false);
00280         break;
00281     case ACTION_REVERSE_UPDATE:
00282         executeUpdate(true);
00283         break;
00284     default:
00285         permAssert(false);
00286     }
00287 }

void FtrsTableWriter::copyNewValues (  )  [inline, private]

Definition at line 212 of file FtrsTableWriter.cpp.

References nAttrs, pClusteredIndexWriter, pTupleData, FtrsTableIndexWriter::tupleData, and updateProj.

Referenced by executeUpdate().

00213 {
00214     for (uint i = 0; i < updateProj.size(); ++i) {
00215         pClusteredIndexWriter->tupleData[updateProj[i]] =
00216             (*pTupleData)[nAttrs + i];
00217     }
00218 }

void FtrsTableWriter::copyOldValues (  )  [inline, private]

Definition at line 220 of file FtrsTableWriter.cpp.

References pClusteredIndexWriter, pTupleData, FtrsTableIndexWriter::tupleData, and updateProj.

Referenced by executeUpdate().

00221 {
00222     for (uint i = 0; i < updateProj.size(); ++i) {
00223         pClusteredIndexWriter->tupleData[updateProj[i]] =
00224             (*pTupleData)[updateProj[i]];
00225     }
00226 }

bool FtrsTableWriter::searchForIndexKey ( FtrsTableIndexWriter  )  [inline, private]

Definition at line 115 of file FtrsTableWriter.cpp.

References DUP_SEEK_ANY, FtrsTableIndexWriter::inputKeyProj, pClusteredIndexWriter, FtrsTableIndexWriter::pWriter, and FtrsTableIndexWriter::tupleData.

Referenced by deleteFromIndex(), and insertIntoIndex().

00117 {
00118     TupleData &keyData = indexWriter.pWriter->getSearchKeyForWrite();
00119     for (uint i = 0; i < indexWriter.inputKeyProj.size(); ++i) {
00120         keyData[i] =
00121             pClusteredIndexWriter->tupleData[indexWriter.inputKeyProj[i]];
00122     }
00123     return indexWriter.pWriter->searchForKey(keyData,DUP_SEEK_ANY);
00124 }

PageOwnerId FtrsTableWriter::getTableId (  )  [private]

Definition at line 401 of file FtrsTableWriter.cpp.

References pClusteredIndexWriter, and FtrsTableIndexWriter::pWriter.

00402 {
00403     return pClusteredIndexWriter->pWriter->getPageOwnerId();
00404 }

RecordNum FtrsTableWriter::execute ( ExecStreamQuantum const &  quantum,
ExecStreamBufAccessor bufAccessor,
LogicalActionType  actionType,
SXMutex actionMutex 
)

Reads all tuples from a buffer and uses them as input to perform the requested action on the target table.

Parameters:
quantum governs the amount of execution to perform
bufAccessor stream buffer from which to read
actionType what to to with tuples (ACTION_INSERT or ACTION_DELETE)
actionMutex SXMutex on which to take a shared lock while action is in progress
Returns:
number of tuples processed

Definition at line 289 of file FtrsTableWriter.cpp.

References LogicalTxn::beginLogicalAction(), ExecStreamBufAccessor::consumeTuple(), ExecStreamBufAccessor::demandData(), LogicalTxn::endLogicalAction(), executeTuple(), ExecStreamBufAccessor::getConsumptionTupleAccessor(), TupleAccessor::getCurrentByteCount(), TupleAccessor::getCurrentTupleBuf(), LogicalTxnParticipant::getLogicalTxn(), LogicalTxnParticipant::isLoggingEnabled(), ExecStreamQuantum::nTuplesMax, pTupleData, LogicalTxnParticipant::pTxn, tupleAccessor, ExecStreamBufAccessor::unmarshalTuple(), and ByteOutputStream::writeBytes().

00294 {
00295     // TODO:  assert bufAccessors's output tupledesc and format
00296     // match clustered index
00297 
00298     assert(isLoggingEnabled());
00299 
00300     RecordNum nTuples = 0;
00301     // TODO:  bulk logging?
00302 
00303     TupleAccessor &tupleAccessor = bufAccessor.getConsumptionTupleAccessor();
00304 
00305     do {
00306         if (!bufAccessor.demandData()) {
00307             break;
00308         }
00309         bufAccessor.unmarshalTuple(*pTupleData);
00310 
00311         // Block checkpoints for each atomic operation, including
00312         // execution and logging.  REVIEW:  if lock/unlock overhead is too
00313         // high per-action, could do it only every so many.
00314         SXMutexSharedGuard actionMutexGuard(actionMutex);
00315         executeTuple(actionType);
00316         uint cb = tupleAccessor.getCurrentByteCount();
00317         LogicalTxn *pTxn = getLogicalTxn();
00318         ByteOutputStream &logStream =
00319             pTxn->beginLogicalAction(*this,actionType);
00320         logStream.writeBytes(tupleAccessor.getCurrentTupleBuf(),cb);
00321         pTxn->endLogicalAction();
00322         bufAccessor.consumeTuple();
00323         ++nTuples;
00324     } while (nTuples < quantum.nTuplesMax);
00325 
00326     return nTuples;
00327 }

uint FtrsTableWriter::getIndexCount (  )  const

Definition at line 406 of file FtrsTableWriter.cpp.

References indexWriters.

00407 {
00408     return indexWriters.size();
00409 }

void FtrsTableWriter::openIndexWriters (  ) 

Definition at line 411 of file FtrsTableWriter.cpp.

References indexWriters.

00412 {
00413     for (uint i = 0; i < indexWriters.size(); ++i) {
00414         FtrsTableIndexWriter &indexWriter = indexWriters[i];
00415         if (!indexWriter.pRootMap) {
00416             continue;
00417         }
00418         PageId rootPageId = indexWriter.pRootMap->getRoot(
00419             indexWriter.pWriter->getPageOwnerId());
00420         indexWriter.pWriter->setRootPageId(rootPageId);
00421     }
00422 }

void FtrsTableWriter::closeIndexWriters (  ) 

Definition at line 424 of file FtrsTableWriter.cpp.

References indexWriters, and NULL_PAGE_ID.

00425 {
00426     for (uint i = 0; i < indexWriters.size(); ++i) {
00427         FtrsTableIndexWriter &indexWriter = indexWriters[i];
00428         indexWriter.pWriter->releaseScratchBuffers();
00429         // REVIEW: since this FtrsTableWriter may be reused by rollback, we
00430         // can't fully close it.  But we should find a way to do so at end of
00431         // transaction.
00432 #if 0
00433         if (indexWriter.pRootMap) {
00434             indexWriter.pWriter->setRootPageId(NULL_PAGE_ID);
00435         }
00436 #endif
00437     }
00438 }

LogicalTxnClassId FtrsTableWriter::getParticipantClassId (  )  const [virtual]

Returns:
the LogicalTxnClassId for this participant; this will be used during recovery to find the correct LogicalTxnParticipantFactory

Implements LogicalTxnParticipant.

Definition at line 329 of file FtrsTableWriter.cpp.

References FtrsTableWriterFactory::getParticipantClassId().

00330 {
00331     return FtrsTableWriterFactory::getParticipantClassId();
00332 }

void FtrsTableWriter::describeParticipant ( ByteOutputStream logStream  )  [virtual]

Called by LogicalTxn the first time an action is logged for this participant.

The participant must implement this by writing a description of itself to the given output stream. This information must be sufficient for reconstructing the participant during recovery.

Parameters:
logStream stream to which the participant description should be written

Implements LogicalTxnParticipant.

Definition at line 334 of file FtrsTableWriter.cpp.

References describeIndex(), indexWriters, pClusteredIndexWriter, FtrsTableIndexWriter::pWriter, updateProj, TupleProjection::writePersistent(), TupleDescriptor::writePersistent(), and ByteOutputStream::writeValue().

00336 {
00337     TupleDescriptor const &clusteredTupleDesc =
00338         pClusteredIndexWriter->pWriter->getTupleDescriptor();
00339     clusteredTupleDesc.writePersistent(logStream);
00340     uint nIndexes = indexWriters.size();
00341     logStream.writeValue(nIndexes);
00342     std::for_each(
00343         indexWriters.begin(),
00344         indexWriters.end(),
00345         boost::bind(&FtrsTableWriter::describeIndex,this,_1,&logStream));
00346     updateProj.writePersistent(logStream);
00347 }

void FtrsTableWriter::undoLogicalAction ( LogicalActionType  actionType,
ByteInputStream logStream 
) [virtual]

Performs undo for one logical action during rollback or recovery.

The implementation must consume ALL log data for this action, even if some of it turns out to be unneeded.

Parameters:
actionType the type of action to undo; the rest of the action parameters should be read from the LogicalTxn's input stream
logStream stream from which to read action data

Implements LogicalTxnParticipant.

Definition at line 363 of file FtrsTableWriter.cpp.

References ACTION_DELETE, ACTION_INSERT, ACTION_REVERSE_UPDATE, ACTION_UPDATE, and redoLogicalAction().

00366 {
00367     switch (actionType) {
00368     case ACTION_INSERT:
00369         redoLogicalAction(ACTION_DELETE,logStream);
00370         break;
00371     case ACTION_DELETE:
00372         redoLogicalAction(ACTION_INSERT,logStream);
00373         break;
00374     case ACTION_UPDATE:
00375         redoLogicalAction(ACTION_REVERSE_UPDATE,logStream);
00376         break;
00377     default:
00378         permAssert(false);
00379     }
00380 }

void FtrsTableWriter::redoLogicalAction ( LogicalActionType  actionType,
ByteInputStream logStream 
) [virtual]

Performs redo for one logical action during recovery.

The implementation must consume ALL log data for this action, even if some of it turns out to be unneeded.

Parameters:
actionType the type of action to redo; the rest of the action parameters should be read from the LogicalTxn's input stream
logStream stream from which to read action data

Implements LogicalTxnParticipant.

Definition at line 382 of file FtrsTableWriter.cpp.

References executeTuple(), TupleAccessor::getCurrentByteCount(), TupleAccessor::getMinByteCount(), logBuf, pTupleData, ByteInputStream::readBytes(), TupleAccessor::setCurrentTupleBuf(), tupleAccessor, and TupleAccessor::unmarshal().

Referenced by undoLogicalAction().

00385 {
00386     uint cbMin = tupleAccessor.getMinByteCount();
00387     uint cbActual = logStream.readBytes(logBuf.get(), cbMin);
00388     assert(cbMin == cbActual);
00389     tupleAccessor.setCurrentTupleBuf(logBuf.get());
00390     uint cb = tupleAccessor.getCurrentByteCount();
00391     uint cbRemainder = cb - cbMin;
00392     if (cbRemainder) {
00393       cbActual = logStream.readBytes(logBuf.get() + cbMin, cbRemainder);
00394       assert(cbActual == cbRemainder);
00395     }
00396     // TODO:  for delete, only need to unmarshal union of keys
00397     tupleAccessor.unmarshal(*pTupleData);
00398     executeTuple(actionType);
00399 }

LogicalTxn * LogicalTxnParticipant::getLogicalTxn (  )  [inline, protected, inherited]

Returns:
LogicalTxn being participated in, or null if no txn in progress; null is also returned during recovery

Definition at line 111 of file LogicalTxnParticipant.h.

References LogicalTxnParticipant::pTxn.

Referenced by LogicalTxnTest::commit(), BTreeWriter::deleteCurrent(), execute(), DatabaseTest::executeIncrementAction(), BTreeWriter::insertTupleFromBuffer(), LogicalTxnTest::rollbackFull(), LogicalTxnTest::testActions(), LogicalTxnTest::testCheckpointCommitSavepoint(), LogicalTxnTest::testRollbackSavepoint(), LogicalTxnTest::testTxn(), and LogicalTxnTest::testTxnIdSequence().

00112 {
00113     return pTxn;
00114 }

bool LogicalTxnParticipant::isLoggingEnabled (  )  const [inline, protected, inherited]

Returns:
true if actions should be logged; this is false during recovery

Definition at line 116 of file LogicalTxnParticipant.h.

References LogicalTxnParticipant::loggingEnabled.

Referenced by BTreeWriter::deleteCurrent(), execute(), BTreeWriter::insertTupleFromBuffer(), and BTreeWriter::updateCurrent().

00117 {
00118     return loggingEnabled;
00119 }


Friends And Related Function Documentation

friend class FtrsTableWriterFactory [friend]

Definition at line 84 of file FtrsTableWriter.h.


Member Data Documentation

uint FtrsTableWriter::nAttrs [private]

Definition at line 88 of file FtrsTableWriter.h.

Referenced by copyNewValues(), executeUpdate(), and FtrsTableWriter().

TupleAccessor FtrsTableWriter::tupleAccessor [private]

Definition at line 89 of file FtrsTableWriter.h.

Referenced by createIndexWriter(), execute(), FtrsTableWriter(), and redoLogicalAction().

IndexWriterVector FtrsTableWriter::indexWriters [private]

Definition at line 90 of file FtrsTableWriter.h.

Referenced by closeIndexWriters(), describeParticipant(), FtrsTableWriter(), getIndexCount(), modifyAllIndexes(), and openIndexWriters().

FtrsTableIndexWriter* FtrsTableWriter::pClusteredIndexWriter [private]

Definition at line 91 of file FtrsTableWriter.h.

Referenced by copyNewValues(), copyOldValues(), createIndexWriter(), describeParticipant(), executeUpdate(), FtrsTableWriter(), getTableId(), insertIntoIndex(), and searchForIndexKey().

TupleProjection FtrsTableWriter::updateProj [private]

Definition at line 92 of file FtrsTableWriter.h.

Referenced by copyNewValues(), copyOldValues(), describeParticipant(), and FtrsTableWriter().

TupleData FtrsTableWriter::updateTupleData [private]

Definition at line 93 of file FtrsTableWriter.h.

Referenced by FtrsTableWriter().

TupleData* FtrsTableWriter::pTupleData [private]

Definition at line 94 of file FtrsTableWriter.h.

Referenced by copyNewValues(), copyOldValues(), execute(), executeUpdate(), FtrsTableWriter(), and redoLogicalAction().

boost::scoped_array<FixedBuffer> FtrsTableWriter::logBuf [private]

Definition at line 95 of file FtrsTableWriter.h.

Referenced by FtrsTableWriter(), and redoLogicalAction().

const LogicalActionType FtrsTableWriter::ACTION_INSERT [static]

LogicalActionType for inserting a table tuple.

Definition at line 121 of file FtrsTableWriter.h.

Referenced by executeTuple(), executeUpdate(), modifyAllIndexes(), modifySomeIndexes(), undoLogicalAction(), and ExecStreamFactory::visit().

const LogicalActionType FtrsTableWriter::ACTION_DELETE [static]

LogicalActionType for deleting a table tuple.

Definition at line 126 of file FtrsTableWriter.h.

Referenced by executeTuple(), executeUpdate(), modifyAllIndexes(), modifySomeIndexes(), undoLogicalAction(), and ExecStreamFactory::visit().

const LogicalActionType FtrsTableWriter::ACTION_UPDATE [static]

LogicalActionType for updating a table tuple.

Definition at line 131 of file FtrsTableWriter.h.

Referenced by executeTuple(), undoLogicalAction(), and ExecStreamFactory::visit().

const LogicalActionType FtrsTableWriter::ACTION_REVERSE_UPDATE [static]

LogicalActionType for reversing the update of a table tuple.

Definition at line 136 of file FtrsTableWriter.h.

Referenced by executeTuple(), and undoLogicalAction().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:32 2009 for Fennel by  doxygen 1.5.1