public class FederatedQueryEngine extends QueryEngine
IBigdataFederation
aware QueryEngine
.Modifier and Type | Class and Description |
---|---|
static interface |
FederatedQueryEngine.Annotations
Annotations understood by the
QueryEngine . |
QueryEngine.IRunningQueryListener
counters, ERR_QUERY_NOT_RUNNING, geoSpatialCounters
Constructor and Description |
---|
FederatedQueryEngine(DataService dataService)
Constructor used on a
DataService (a query engine peer). |
FederatedQueryEngine(UUID thisService,
IBigdataFederation<?> fed,
IIndexManager indexManager,
ManagedResourceService resourceService)
Constructor used on a non-
DataService node to expose a query
controller. |
Modifier and Type | Method and Description |
---|---|
void |
bufferReady(IChunkMessage<IBindingSet> msg)
Notify a service that a buffer having data for some
BOp in some
running query is available. |
void |
cancelQuery(UUID queryId,
Throwable cause)
Overridden to cancel all running operators for the query on this node.
|
void |
declareQuery(IQueryDecl queryDecl)
Deprecated.
|
protected void |
didShutdown()
Hook is notified by
QueryEngine.shutdown() when all running queries have
terminated. |
IBigdataFederation<?> |
getFederation()
The
IBigdataFederation iff running in scale-out. |
IQueryClient |
getProxy()
Overridden to return an RMI proxy for this
FederatedQueryEngine . |
protected FederatedQueryEngineCounters |
getQueryEngineCounters()
The
QueryEngineCounters object for this QueryEngine . |
protected IQueryPeer |
getQueryPeer(UUID serviceUUID)
Resolve an
IQueryPeer . |
ManagedResourceService |
getResourceService()
The service used to expose
ByteBuffer s and managed index
resources for transfer to remote services in support of distributed query
evaluation. |
FederatedRunningQuery |
getRunningQuery(UUID queryId)
Overridden to strengthen the return type.
|
UUID |
getServiceUUID()
The
UUID of the service in which this QueryEngine is
running. |
void |
init()
Initialize the
QueryEngine . |
boolean |
isDataService()
Return
true iff the query engine instance is hosted by a
DataService . |
boolean |
isScaleOut()
Return
true iff running against an
IBigdataFederation . |
protected FederatedQueryEngineCounters |
newCounters()
Extension hook for new
QueryEngineCounters instances. |
protected FederatedRunningQuery |
newRunningQuery(UUID queryId,
boolean controller,
IQueryClient clientProxy,
UUID queryControllerId,
PipelineOp query,
IChunkMessage<IBindingSet> realSource)
Factory for
IRunningQuery s. |
void |
shutdownNow()
Do not accept new queries and halt any running binding set chunk tasks.
|
String |
toString() |
acceptChunk, addListener, addPendingCancel, assertRunning, eval, eval, eval, eval, eval, eval, eval, eval, execute, finalize, getClientConnectionManager, getConcurrencyManager, getCounters, getGeoSpatialCounters, getIndexManager, getQuery, getRunningQueries, halt, haltOp, isRunning, newGeoSpatialCounters, pendingCancel, putIfAbsent, removeListener, shutdown, startOp
public FederatedQueryEngine(DataService dataService)
DataService
(a query engine peer).dataService
- The data service.public FederatedQueryEngine(UUID thisService, IBigdataFederation<?> fed, IIndexManager indexManager, ManagedResourceService resourceService)
DataService
node to expose a query
controller. Since the query controller is not embedded within a data
service it needs to provide its own ResourceService
and local
IIndexManager
.fed
- indexManager
- resourceService
- public UUID getServiceUUID()
IQueryPeer
UUID
of the service in which this QueryEngine
is
running.getServiceUUID
in interface IQueryPeer
getServiceUUID
in class QueryEngine
UUID
of the service in which this QueryEngine
is running -or- a unique and distinct UUID if the
QueryEngine
is not running against an
IBigdataFederation.IService.getServiceUUID()
public IBigdataFederation<?> getFederation()
QueryEngine
IBigdataFederation
iff running in scale-out.
Note: The IBigdataFederation
is required in scale-out in order to
perform shard locator scans when mapping binding sets across the next
join in a query plan.
getFederation
in class QueryEngine
public ManagedResourceService getResourceService()
ByteBuffer
s and managed index
resources for transfer to remote services in support of distributed query
evaluation.public IQueryClient getProxy()
FederatedQueryEngine
.
The RMI proxy for this QueryEngine
when used as a query controller.
The default implementation returns this.
getProxy
in class QueryEngine
public final boolean isScaleOut()
QueryEngine
true
iff running against an
IBigdataFederation
.isScaleOut
in class QueryEngine
public final boolean isDataService()
true
iff the query engine instance is hosted by a
DataService
.public FederatedRunningQuery getRunningQuery(UUID queryId)
Return the AbstractRunningQuery
associated with that query
identifier.
getRunningQuery
in class QueryEngine
queryId
- The query identifier.AbstractRunningQuery
-or- null
if there
is no query associated with that query identifier.public void init()
QueryEngine
. It will accept binding set chunks and
run them against running queries until it is shutdown.
Extended to also initialize a thread which will materialize
IChunkMessage
for consumption by this node.
TODO The acceptTaskService
is not used right now since we are
always running the MaterializeMessageTask
in the caller's thread.
If it becomes used, then we should reconsider the pool size.
init
in class QueryEngine
protected void didShutdown()
QueryEngine.shutdown()
when all running queries have
terminated.
Extended to stop materializing chunks once all running queries are done.
didShutdown
in class QueryEngine
public void shutdownNow()
Extended to stop materializing chunks.
shutdownNow
in class QueryEngine
@Deprecated public void declareQuery(IQueryDecl queryDecl) throws RemoteException
IQueryPeer
declareQuery
in interface IQueryPeer
declareQuery
in class QueryEngine
queryDecl
- The query declaration.RemoteException
public void bufferReady(IChunkMessage<IBindingSet> msg)
BOp
in some
running query is available. The receiver may request the data when they
are ready. If the query is cancelled, then the sender will drop the
buffer.
TODO The timing and responsibility for materializing chunks needs to be
examined further when the data are being moved around using NIO rather
than ThickChunkMessage
. At stake is when the intermediate
solutions are materialized on the node where they will be consumed. We
can either do this synchronous or asynchronously when bufferReady() is
caller or we can defer the transfer until the target operator on this
node is ready to run.bufferReady
in interface IQueryPeer
bufferReady
in class QueryEngine
msg
- The message.public void cancelQuery(UUID queryId, Throwable cause)
Notify a service that the query has been terminated. The peer MUST NOT cancel the query synchronously as that can lead to a deadlock with the query controller. Instead, the peer should queue a task to cancel the query and then return.
The default implementation is a NOP.
cancelQuery
in interface IQueryPeer
cancelQuery
in class QueryEngine
queryId
- The query identifier.cause
- The cause. When null
, this is presumed to be
normal query termination.protected FederatedRunningQuery newRunningQuery(UUID queryId, boolean controller, IQueryClient clientProxy, UUID queryControllerId, PipelineOp query, IChunkMessage<IBindingSet> realSource)
IRunningQuery
s.
Overridden to always use a FederatedRunningQuery
.
newRunningQuery
in class QueryEngine
QueryEngine.Annotations.RUNNING_QUERY_CLASS
protected IQueryPeer getQueryPeer(UUID serviceUUID)
IQueryPeer
.
Note: This only resolves the peers running on the IDataService
s.
It will not resolve a query controller unless an IDataService
is
being used as the query controller.
serviceUUID
- The service UUID
.protected FederatedQueryEngineCounters newCounters()
QueryEngineCounters
instances.newCounters
in class QueryEngine
protected FederatedQueryEngineCounters getQueryEngineCounters()
getQueryEngineCounters
in class QueryEngine
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.