Fennel: FtrsTableWriter Class Reference (original) (raw)

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

#include <[FtrsTableWriter.h](FtrsTableWriter%5F8h-source.html)>

Inheritance diagram for FtrsTableWriter:

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
LogicalTxn * getLogicalTxn ()
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< FtrsTableIndexWriter > IndexWriterVector
Private Member Functions
FtrsTableIndexWriter & createIndexWriter (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
FtrsTableIndexWriter * pClusteredIndexWriter
TupleProjection updateProj
TupleData updateTupleData
TupleData * pTupleData
boost::scoped_array< FixedBuffer > logBuf
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


Constructor & Destructor Documentation

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.


Member Function Documentation

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().

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

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

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

| PageOwnerId FtrsTableWriter::getTableId | ( | | ) | [private] | | --------------------------------------- | - | | - | ----------- |

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().

| uint FtrsTableWriter::getIndexCount | ( | | ) | const | | ------------------------------------------------------------------------------------------------ | - | | - | ----- |

| 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 | ( | | ) | | --------------------------------------- | - | | - |

| LogicalTxnClassId FtrsTableWriter::getParticipantClassId | ( | | ) | const [virtual] | | -------------------------------------------------------- | - | | - | ----------------- |

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

| 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] | | -------------------------------------------- | - | | - | -------------------------------------- |



Member Data Documentation


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