#include <ExecStreamGraph.h>
Inheritance diagram for ExecStreamGraph:
Public Member Functions | |
virtual | ~ExecStreamGraph () |
ExecStreamScheduler * | getScheduler () const |
| |
SharedDynamicParamManager | getDynamicParamManager () |
| |
virtual void | setTxn (SharedLogicalTxn pTxn)=0 |
Sets the transaction within which this graph should execute. | |
virtual void | setErrorTarget (SharedErrorTarget pErrorTarget)=0 |
Sets the ErrorTarget to which this graph's streams should send row errors. | |
virtual void | setScratchSegment (SharedSegment pScratchSegment)=0 |
Sets the ScratchSegment from which this graph's streams should allocate memory buffers. | |
virtual void | setResourceGovernor (SharedExecStreamGovernor pResourceGovernor)=0 |
Sets the global exec stream governor. | |
virtual SharedLogicalTxn | getTxn ()=0 |
| |
virtual TxnId | getTxnId ()=0 |
| |
virtual void | enableDummyTxnId (bool enabled)=0 |
Controls whether it is OK to call getTxnId without first calling setTxn. | |
virtual SharedExecStreamGovernor | getResourceGovernor ()=0 |
| |
virtual void | addStream (SharedExecStream pStream)=0 |
Adds a stream to this graph. | |
virtual void | removeStream (ExecStreamId)=0 |
Removes a stream from the graph: deletes the edges, and puts the vertex on a free list to be reallocated. | |
virtual void | addDataflow (ExecStreamId producerId, ExecStreamId consumerId, bool isImplicit=false)=0 |
Defines a dataflow relationship between two streams in this graph. | |
virtual void | addOutputDataflow (ExecStreamId producerId)=0 |
Defines a dataflow representing external output produced by this graph. | |
virtual void | addInputDataflow (ExecStreamId consumerId)=0 |
Defines a dataflow representing external input consumed by this graph. | |
virtual void | mergeFrom (ExecStreamGraph &src)=0 |
Adds all the vertices and edges from another graph. | |
virtual void | mergeFrom (ExecStreamGraph &src, std::vector< ExecStreamId > const &nodes)=0 |
Adds a subgraph, taken (removed) from another graph. | |
virtual SharedExecStream | findStream (std::string name)=0 |
Finds a stream by name. | |
virtual SharedExecStream | findLastStream (std::string name, uint iOutput)=0 |
Finds last stream known for name. | |
virtual void | interposeStream (std::string name, uint iOutput, ExecStreamId interposedId)=0 |
Interposes an adapter stream. | |
virtual void | prepare (ExecStreamScheduler &scheduler)=0 |
Prepares this graph for execution. | |
virtual void | open ()=0 |
Opens execution on this graph. | |
virtual SharedExecStream | getStream (ExecStreamId id)=0 |
Translates a stream ID to a stream pointer. | |
virtual uint | getInputCount (ExecStreamId streamId)=0 |
Determines number of explicit input flows consumed by a stream. | |
virtual uint | getOutputCount (ExecStreamId streamId)=0 |
Determines number of explicit output flows produced by a stream. | |
virtual SharedExecStream | getStreamInput (ExecStreamId streamId, uint iInput)=0 |
Accesses a stream's input. | |
virtual SharedExecStreamBufAccessor | getStreamInputAccessor (ExecStreamId streamId, uint iInput)=0 |
Accesses a stream's input accessor. | |
virtual SharedExecStream | getStreamOutput (ExecStreamId streamId, uint iOutput)=0 |
Accesses a stream's output. | |
virtual SharedExecStreamBufAccessor | getStreamOutputAccessor (ExecStreamId streamId, uint iOutput)=0 |
Accesses a stream's output accessor. | |
virtual std::vector< SharedExecStream > | getSortedStreams ()=0 |
Gets streams, sorted topologically. | |
virtual int | getStreamCount ()=0 |
| |
virtual int | getDataflowCount ()=0 |
| |
virtual void | renderGraphviz (std::ostream &dotStream)=0 |
Renders the graph in the .dot format defined by Graphviz. | |
virtual bool | isAcyclic ()=0 |
| |
virtual void | closeProducers (ExecStreamId streamId)=0 |
Closes the producers of a stream with a given id. | |
virtual void | declareDynamicParamWriter (ExecStreamId streamId, DynamicParamId dynamicParamId)=0 |
Declares that a given stream writes a given dynamic parameter. | |
virtual void | declareDynamicParamReader (ExecStreamId streamId, DynamicParamId dynamicParamId)=0 |
Declares that a given stream reads a given dynamic parameter. | |
virtual const std::vector< ExecStreamId > & | getDynamicParamWriters (DynamicParamId dynamicParamId)=0 |
Returns a list of stream ids that write a given dynamic parameter. | |
virtual const std::vector< ExecStreamId > & | getDynamicParamReaders (DynamicParamId dynamicParamId)=0 |
Returns a list of stream ids that read a given dynamic parameter. | |
bool | isClosed () const |
| |
void | close () |
Closes this object, releasing any unallocated resources. | |
Static Public Member Functions | |
static SharedExecStreamGraph | newExecStreamGraph () |
Constructs a new ExecStreamGraph. | |
Protected Member Functions | |
ExecStreamGraph () | |
virtual void | closeImpl ()=0 |
Must be implemented by derived class to release any resources. | |
Protected Attributes | |
ExecStreamScheduler * | pScheduler |
A Scheduler responsible for executing streams in this graph. | |
SharedDynamicParamManager | pDynamicParamManager |
Manager that handles dynamic parameters for this graph. | |
bool | needsClose |
Friends | |
class | ExecStreamScheduler |
For more information, see ExecStreamDesign.
A stream is always a node is a stream graph, but over its lifetime it may be moved from one graph to another. Specifically, it may be prepared in one graph (see ExecStreamGraphEmbro), executed in another, and finally closed & deleted in a third graph.
A stream has a permanent, unique name. These names are used later to find the streams. When a stream is added to a graph it is assigned an ExecStreamId. This identifier is later used to work with the stream. If the stream is moved to another graph, it obtains a new ExecStreamId.
Definition at line 59 of file ExecStreamGraph.h.
ExecStreamGraph::ExecStreamGraph | ( | ) | [explicit, protected] |
Definition at line 50 of file ExecStreamGraph.cpp.
00051 : pScheduler(NULL), 00052 pDynamicParamManager(new DynamicParamManager()) 00053 { 00054 }
ExecStreamGraph::~ExecStreamGraph | ( | ) | [virtual] |
SharedExecStreamGraph ExecStreamGraph::newExecStreamGraph | ( | ) | [static] |
Constructs a new ExecStreamGraph.
Definition at line 43 of file ExecStreamGraph.cpp.
Referenced by ExecStreamTestBase::newStreamGraph(), and CmdInterpreter::visit().
00044 { 00045 return SharedExecStreamGraph( 00046 new ExecStreamGraphImpl(), 00047 ClosableObjectDestructor()); 00048 }
ExecStreamScheduler * ExecStreamGraph::getScheduler | ( | ) | const [inline] |
Definition at line 444 of file ExecStreamGraph.h.
References pScheduler.
Referenced by ExecStream::checkAbort(), JavaSinkExecStream::execute(), CorrelationJoinExecStream::execute(), Java_net_sf_farrago_fennel_FennelStorage_tupleStreamFetch(), MergeExecStream::open(), CorrelationJoinExecStream::open(), and JavaSinkExecStream::stuffByteBuffer().
00445 { 00446 return pScheduler; 00447 }
SharedDynamicParamManager ExecStreamGraph::getDynamicParamManager | ( | ) | [inline] |
Definition at line 449 of file ExecStreamGraph.h.
References pDynamicParamManager.
Referenced by ExecStream::prepare().
00450 { 00451 return pDynamicParamManager; 00452 }
virtual void ExecStreamGraph::setTxn | ( | SharedLogicalTxn | pTxn | ) | [pure virtual] |
Sets the transaction within which this graph should execute.
The transaction is reset whenever the graph is closed.
pTxn | transaction |
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::setErrorTarget | ( | SharedErrorTarget | pErrorTarget | ) | [pure virtual] |
Sets the ErrorTarget to which this graph's streams should send row errors.
pErrorTarget | error target |
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::setScratchSegment | ( | SharedSegment | pScratchSegment | ) | [pure virtual] |
Sets the ScratchSegment from which this graph's streams should allocate memory buffers.
pScratchSegment | scratch segment |
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::setResourceGovernor | ( | SharedExecStreamGovernor | pResourceGovernor | ) | [pure virtual] |
Sets the global exec stream governor.
pResourceGovernor | exec stream governor |
Implemented in ExecStreamGraphImpl.
virtual SharedLogicalTxn ExecStreamGraph::getTxn | ( | ) | [pure virtual] |
Implemented in ExecStreamGraphImpl.
Referenced by ExecStream::open().
virtual TxnId ExecStreamGraph::getTxnId | ( | ) | [pure virtual] |
Implemented in ExecStreamGraphImpl.
Referenced by ExecStream::open().
virtual void ExecStreamGraph::enableDummyTxnId | ( | bool | enabled | ) | [pure virtual] |
Controls whether it is OK to call getTxnId without first calling setTxn.
Normally, this is a bad idea (since in that case getTxnId will return FIRST_TXN_ID as a dummy, which could lead to concurrency problems), but for non-transactional unit tests, this can be useful. Default is disabled.
enabled | whether dummy txn ID's are enabled |
Implemented in ExecStreamGraphImpl.
virtual SharedExecStreamGovernor ExecStreamGraph::getResourceGovernor | ( | ) | [pure virtual] |
virtual void ExecStreamGraph::addStream | ( | SharedExecStream | pStream | ) | [pure virtual] |
virtual void ExecStreamGraph::removeStream | ( | ExecStreamId | ) | [pure virtual] |
Removes a stream from the graph: deletes the edges, and puts the vertex on a free list to be reallocated.
Does not free the ExecStream or its ExecStreamBufAccessors.
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::addDataflow | ( | ExecStreamId | producerId, | |
ExecStreamId | consumerId, | |||
bool | isImplicit = false | |||
) | [pure virtual] |
Defines a dataflow relationship between two streams in this graph.
producerId | ID of producer stream in this graph | |
consumerId | ID of consumer stream in this graph | |
isImplicit | false (the default) if the edge represents direct dataflow; true if the edge represents an implicit dataflow dependency |
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::addOutputDataflow | ( | ExecStreamId | producerId | ) | [pure virtual] |
Defines a dataflow representing external output produced by this graph.
producerId | ID of producer stream in this graph |
Implemented in ExecStreamGraphImpl.
Referenced by ExecStreamBuilder::buildStreamGraph().
virtual void ExecStreamGraph::addInputDataflow | ( | ExecStreamId | consumerId | ) | [pure virtual] |
Defines a dataflow representing external input consumed by this graph.
consumerId | ID of consumer stream in this graph |
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::mergeFrom | ( | ExecStreamGraph & | src | ) | [pure virtual] |
Adds all the vertices and edges from another graph.
Assumes the graphs are disjoint, and that both have been prepared. The two graphs are both open, or else both closed.
src | the other graph, which is left empty. |
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::mergeFrom | ( | ExecStreamGraph & | src, | |
std::vector< ExecStreamId > const & | nodes | |||
) | [pure virtual] |
Adds a subgraph, taken (removed) from another graph.
(Slower than mergeFrom(ExecStreamGraph&), which merges its entire source). Assumes the graphs are disjoint, and that both have been prepared. The two graphs are both open, or else both closed.
src | the source graph | |
nodes | identifies source nodes. |
Implemented in ExecStreamGraphImpl.
virtual SharedExecStream ExecStreamGraph::findStream | ( | std::string | name | ) | [pure virtual] |
Finds a stream by name.
name | name of stream to find |
Implemented in ExecStreamGraphImpl.
virtual SharedExecStream ExecStreamGraph::findLastStream | ( | std::string | name, | |
uint | iOutput | |||
) | [pure virtual] |
Finds last stream known for name.
May be original stream or an adapter.
name | name of stream to find | |
iOutput | ordinal of output arc |
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::interposeStream | ( | std::string | name, | |
uint | iOutput, | |||
ExecStreamId | interposedId | |||
) | [pure virtual] |
Interposes an adapter stream.
In the process, creates a dataflow from last stream associated with name to the adapter stream.
name | name of stream to adapt | |
iOutput | ordinal of output of stream | |
interposedId | ID of adapter stream within this graph |
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::prepare | ( | ExecStreamScheduler & | scheduler | ) | [pure virtual] |
Prepares this graph for execution.
Only called once (before first open) after all streams and dataflows have been defined.
scheduler | ExecStreamScheduler which will execute this graph |
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::open | ( | ) | [pure virtual] |
Opens execution on this graph.
A graph may be repeatedly closed and then reopened.
Implemented in ExecStreamGraphImpl.
virtual SharedExecStream ExecStreamGraph::getStream | ( | ExecStreamId | id | ) | [pure virtual] |
Translates a stream ID to a stream pointer.
id | ID of a stream in this graph |
Implemented in ExecStreamGraphImpl.
Referenced by CorrelationJoinExecStream::execute(), and CorrelationJoinExecStream::open().
virtual uint ExecStreamGraph::getInputCount | ( | ExecStreamId | streamId | ) | [pure virtual] |
Determines number of explicit input flows consumed by a stream.
streamId | ID of stream |
Implemented in ExecStreamGraphImpl.
virtual uint ExecStreamGraph::getOutputCount | ( | ExecStreamId | streamId | ) | [pure virtual] |
Determines number of explicit output flows produced by a stream.
streamId | ID of stream |
Implemented in ExecStreamGraphImpl.
virtual SharedExecStream ExecStreamGraph::getStreamInput | ( | ExecStreamId | streamId, | |
uint | iInput | |||
) | [pure virtual] |
Accesses a stream's input.
streamId | ID of stream | |
iInput | 0-based input explicit flow ordinal |
Implemented in ExecStreamGraphImpl.
Referenced by CorrelationJoinExecStream::execute(), JavaTransformExecStream::open(), SingleInputExecStream::open(), ConfluenceExecStream::open(), CartesianJoinExecStream::prepare(), and LbmMinusExecStream::restartSubtrahends().
virtual SharedExecStreamBufAccessor ExecStreamGraph::getStreamInputAccessor | ( | ExecStreamId | streamId, | |
uint | iInput | |||
) | [pure virtual] |
Accesses a stream's input accessor.
streamId | ID of stream | |
iInput | 0-based input explicit flow ordinal |
Implemented in ExecStreamGraphImpl.
Referenced by Java_net_sf_farrago_fennel_FennelStorage_tupleStreamTransformFetch().
virtual SharedExecStream ExecStreamGraph::getStreamOutput | ( | ExecStreamId | streamId, | |
uint | iOutput | |||
) | [pure virtual] |
Accesses a stream's output.
streamId | ID of stream | |
iOutput | 0-based output explicit flow ordinal |
Implemented in ExecStreamGraphImpl.
virtual SharedExecStreamBufAccessor ExecStreamGraph::getStreamOutputAccessor | ( | ExecStreamId | streamId, | |
uint | iOutput | |||
) | [pure virtual] |
Accesses a stream's output accessor.
streamId | ID of stream | |
iOutput | 0-based output explicit flow ordinal |
Implemented in ExecStreamGraphImpl.
virtual std::vector<SharedExecStream> ExecStreamGraph::getSortedStreams | ( | ) | [pure virtual] |
Gets streams, sorted topologically.
Can only be called after prepare.
Implemented in ExecStreamGraphImpl.
Referenced by SimpleExecStreamGovernor::requestResources().
virtual int ExecStreamGraph::getStreamCount | ( | ) | [pure virtual] |
Implemented in ExecStreamGraphImpl.
virtual int ExecStreamGraph::getDataflowCount | ( | ) | [pure virtual] |
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::renderGraphviz | ( | std::ostream & | dotStream | ) | [pure virtual] |
Renders the graph in the .dot format defined by Graphviz.
dotStream | ostream on which to write .dot representation |
Implemented in ExecStreamGraphImpl.
virtual bool ExecStreamGraph::isAcyclic | ( | ) | [pure virtual] |
virtual void ExecStreamGraph::closeProducers | ( | ExecStreamId | streamId | ) | [pure virtual] |
Closes the producers of a stream with a given id.
streamId | stream id of the stream whose producers will be closed |
Implemented in ExecStreamGraphImpl.
virtual void ExecStreamGraph::declareDynamicParamWriter | ( | ExecStreamId | streamId, | |
DynamicParamId | dynamicParamId | |||
) | [pure virtual] |
Declares that a given stream writes a given dynamic parameter.
streamId | Stream id | |
dynamicParamId | Dynamic parameter id |
Implemented in ExecStreamGraphImpl.
Referenced by ExecStreamBuilder::buildStream().
virtual void ExecStreamGraph::declareDynamicParamReader | ( | ExecStreamId | streamId, | |
DynamicParamId | dynamicParamId | |||
) | [pure virtual] |
Declares that a given stream reads a given dynamic parameter.
streamId | Stream id | |
dynamicParamId | Dynamic parameter id |
Implemented in ExecStreamGraphImpl.
Referenced by ExecStreamBuilder::buildStream().
virtual const std::vector<ExecStreamId>& ExecStreamGraph::getDynamicParamWriters | ( | DynamicParamId | dynamicParamId | ) | [pure virtual] |
Returns a list of stream ids that write a given dynamic parameter.
dynamicParamId | Dynamic parameter id |
Implemented in ExecStreamGraphImpl.
virtual const std::vector<ExecStreamId>& ExecStreamGraph::getDynamicParamReaders | ( | DynamicParamId | dynamicParamId | ) | [pure virtual] |
Returns a list of stream ids that read a given dynamic parameter.
dynamicParamId | Dynamic parameter id |
Implemented in ExecStreamGraphImpl.
Referenced by CorrelationJoinExecStream::execute(), and CorrelationJoinExecStream::open().
virtual void ClosableObject::closeImpl | ( | ) | [protected, pure virtual, inherited] |
Must be implemented by derived class to release any resources.
Implemented in CacheImpl< PageT, VictimPolicyT >, ByteArrayInputStream, ByteArrayOutputStream, ByteOutputStream, CheckpointThread, Database, BarrierExecStream, DoubleBufferExecStream, ExecStream, ExecStreamGraphImpl, MockResourceExecStream, ReshapeExecStream, ScratchBufferExecStream, SegBufferExecStream, SegBufferReader, SegBufferReaderExecStream, SegBufferWriter, SegBufferWriterExecStream, JavaSinkExecStream, JavaTransformExecStream, FlatFileBuffer, FlatFileExecStreamImpl, BTreeExecStream, BTreeInsertExecStream, BTreePrefetchSearchExecStream, BTreeReadExecStream, BTreeSearchExecStream, FtrsTableWriterExecStream, LhxAggExecStream, LhxJoinExecStream, LbmBitOpExecStream, LbmChopperExecStream, LbmGeneratorExecStream, LbmIntersectExecStream, LbmMinusExecStream, LbmSplicerExecStream, LbmUnionExecStream, LcsClusterAppendExecStream, LcsRowScanBaseExecStream, LcsRowScanExecStream, DelegatingSegment, DynamicDelegatingSegment, ScratchSegment, SegInputStream, Segment, SegOutputStream, SegPageBackupRestoreDevice, SegStream, SegStreamAllocation, SpillOutputStream, and ExternalSortExecStreamImpl.
Referenced by ClosableObject::close().
bool ClosableObject::isClosed | ( | ) | const [inline, inherited] |
Definition at line 58 of file ClosableObject.h.
00059 { 00060 return !needsClose; 00061 }
void ClosableObject::close | ( | ) | [inherited] |
Closes this object, releasing any unallocated resources.
Reimplemented in CollectExecStream, CorrelationJoinExecStream, LcsClusterAppendExecStream, and LcsClusterReplaceExecStream.
Definition at line 39 of file ClosableObject.cpp.
References ClosableObject::closeImpl(), and ClosableObject::needsClose.
Referenced by CacheImpl< PageT, VictimPolicyT >::allocatePages(), LcsRowScanBaseExecStream::closeImpl(), ExecStreamGraphImpl::closeImpl(), FlatFileBuffer::open(), ClosableObjectDestructor::operator()(), and Segment::~Segment().
00040 { 00041 if (!needsClose) { 00042 return; 00043 } 00044 needsClose = false; 00045 closeImpl(); 00046 }
friend class ExecStreamScheduler [friend] |
Definition at line 63 of file ExecStreamGraph.h.
ExecStreamScheduler* ExecStreamGraph::pScheduler [protected] |
A Scheduler responsible for executing streams in this graph.
(Can be null if the current graph is only building streams, not executing them.) Note that we don't use a weak_ptr for this because it needs to be accessed frequently during execution, and the extra locking overhead would be frivolous.
Definition at line 73 of file ExecStreamGraph.h.
Referenced by getScheduler().
Manager that handles dynamic parameters for this graph.
Definition at line 78 of file ExecStreamGraph.h.
Referenced by ExecStreamGraphImpl::closeImpl(), and getDynamicParamManager().
bool ClosableObject::needsClose [protected, inherited] |
Definition at line 44 of file ClosableObject.h.
Referenced by SegStreamAllocation::beginWrite(), ExecStreamGraphImpl::clear(), ClosableObject::ClosableObject(), ClosableObject::close(), FlatFileBuffer::open(), ExecStreamGraphImpl::open(), ExecStream::open(), and ClosableObject::~ClosableObject().