public boolean blockOnOutputBuffer(RequestWorkItem item) { synchronized (waitingPlans) { if (!waitingPlans.isEmpty()) { return false; } if (item.useCallingThread || item.getDqpWorkContext().getSession().isEmbedded()) { return false; } } return true; }
public boolean blockOnOutputBuffer(RequestWorkItem item) { synchronized (waitingPlans) { if (!waitingPlans.isEmpty()) { return false; } if (item.useCallingThread || item.getDqpWorkContext().getSession().isEmbedded()) { return false; } } return true; }
public boolean blockOnOutputBuffer(RequestWorkItem item) { synchronized (waitingPlans) { if (!waitingPlans.isEmpty()) { return false; } if (item.useCallingThread || item.getDqpWorkContext().getSession().isEmbedded()) { return false; } } return true; }
void removeRequest(final RequestWorkItem workItem) { finishProcessing(workItem); this.requests.remove(workItem.requestID); ClientState state = getClientState(workItem.getDqpWorkContext().getSessionId(), false); if (state != null) { state.removeRequest(workItem.requestID); } }
void removeRequest(final RequestWorkItem workItem) { finishProcessing(workItem); this.requests.remove(workItem.requestID); ClientState state = getClientState(workItem.getDqpWorkContext().getSessionId(), false); if (state != null) { state.removeRequest(workItem.requestID); } }
void removeRequest(final RequestWorkItem workItem) { finishProcessing(workItem); this.requests.remove(workItem.requestID); ClientState state = getClientState(workItem.getDqpWorkContext().getSessionId(), false); if (state != null) { state.removeRequest(workItem.requestID); } }
private AtomicRequestMessage createRequest(RequestWorkItem workItem, Command command, String modelName, String connectorBindingId, int nodeID) throws TeiidComponentException { RequestMessage request = workItem.requestMsg; // build the atomic request based on original request + context info AtomicRequestMessage aqr = new AtomicRequestMessage(request, workItem.getDqpWorkContext(), nodeID); aqr.setCommand(command); aqr.setModelName(modelName); aqr.setMaxResultRows(requestMgr.getMaxSourceRows()); aqr.setExceptionOnMaxRows(requestMgr.isExceptionOnMaxSourceRows()); aqr.setPartialResults(request.supportsPartialResults()); aqr.setSerial(requestMgr.getUserRequestSourceConcurrency() == 1); aqr.setTransactionContext(workItem.getTransactionContext()); aqr.setBufferManager(this.getBufferManager()); if (connectorBindingId == null) { VDBMetaData vdb = workItem.getDqpWorkContext().getVDB(); ModelMetaData model = vdb.getModel(modelName); List<String> bindings = model.getSourceNames(); if (bindings == null || bindings.size() != 1) { // this should not happen, but it did occur when setting up the SystemAdmin models throw new TeiidComponentException(QueryPlugin.Event.TEIID30554, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30554, modelName, workItem.getDqpWorkContext().getVdbName(), workItem.getDqpWorkContext().getVdbVersion())); } connectorBindingId = bindings.get(0); Assertion.isNotNull(connectorBindingId, "could not obtain connector id"); //$NON-NLS-1$ } aqr.setConnectorName(connectorBindingId); return aqr; }
private AtomicRequestMessage createRequest(RequestWorkItem workItem, Command command, String modelName, String connectorBindingId, int nodeID) throws TeiidComponentException { RequestMessage request = workItem.requestMsg; // build the atomic request based on original request + context info AtomicRequestMessage aqr = new AtomicRequestMessage(request, workItem.getDqpWorkContext(), nodeID); aqr.setCommand(command); aqr.setModelName(modelName); aqr.setMaxResultRows(requestMgr.getMaxSourceRows()); aqr.setExceptionOnMaxRows(requestMgr.isExceptionOnMaxSourceRows()); aqr.setPartialResults(request.supportsPartialResults()); aqr.setSerial(requestMgr.getUserRequestSourceConcurrency() == 1); aqr.setTransactionContext(workItem.getTransactionContext()); aqr.setBufferManager(this.getBufferManager()); if (connectorBindingId == null) { VDBMetaData vdb = workItem.getDqpWorkContext().getVDB(); ModelMetaData model = vdb.getModel(modelName); List<String> bindings = model.getSourceNames(); if (bindings == null || bindings.size() != 1) { // this should not happen, but it did occur when setting up the SystemAdmin models throw new TeiidComponentException(QueryPlugin.Event.TEIID30554, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30554, modelName, workItem.getDqpWorkContext().getVdbName(), workItem.getDqpWorkContext().getVdbVersion())); } connectorBindingId = bindings.get(0); Assertion.isNotNull(connectorBindingId, "could not obtain connector id"); //$NON-NLS-1$ } aqr.setConnectorName(connectorBindingId); return aqr; }
private void checkForUpdates(AtomicResultsMessage results, Command command, EventDistributor distributor, int commandIndex, long ts) { if (!RelationalNodeUtil.isUpdate(command) || !(command instanceof ProcedureContainer)) { return; } ProcedureContainer pc = (ProcedureContainer)command; GroupSymbol gs = pc.getGroup(); Integer zero = Integer.valueOf(0); if (results.getResults().length <= commandIndex || zero.equals(results.getResults()[commandIndex].get(0))) { return; } Object metadataId = gs.getMetadataID(); if (metadataId == null) { return; } if (!(metadataId instanceof Table)) { if (metadataId instanceof TempMetadataID) { TempMetadataID tid = (TempMetadataID)metadataId; if (tid.getTableData().getModel() != null) { tid.getTableData().dataModified((Integer)results.getResults()[commandIndex].get(0)); } } return; } Table t = (Table)metadataId; t.setLastDataModification(ts); if (distributor != null) { distributor.dataModification(this.workItem.getDqpWorkContext().getVdbName(), this.workItem.getDqpWorkContext().getVdbVersion(), t.getParent().getName(), t.getName()); } }
private void checkForUpdates(AtomicResultsMessage results, Command command, EventDistributor distributor, int commandIndex, long ts) { if (!RelationalNodeUtil.isUpdate(command) || !(command instanceof ProcedureContainer)) { return; } ProcedureContainer pc = (ProcedureContainer)command; GroupSymbol gs = pc.getGroup(); Integer zero = Integer.valueOf(0); if (results.getResults().length <= commandIndex || zero.equals(results.getResults()[commandIndex].get(0))) { return; } Object metadataId = gs.getMetadataID(); if (metadataId == null) { return; } if (!(metadataId instanceof Table)) { if (metadataId instanceof TempMetadataID) { TempMetadataID tid = (TempMetadataID)metadataId; if (tid.getTableData().getModel() != null) { tid.getTableData().dataModified((Integer)results.getResults()[commandIndex].get(0)); } } return; } Table t = (Table)metadataId; t.setLastDataModification(ts); if (distributor != null) { distributor.dataModification(this.workItem.getDqpWorkContext().getVdbName(), this.workItem.getDqpWorkContext().getVdbVersion(), t.getParent().getName(), t.getName()); } }
private void checkForUpdates(AtomicResultsMessage results, Command command, EventDistributor distributor, int commandIndex, long ts) { if (!RelationalNodeUtil.isUpdate(command) || !(command instanceof ProcedureContainer)) { return; } ProcedureContainer pc = (ProcedureContainer)command; GroupSymbol gs = pc.getGroup(); Integer zero = Integer.valueOf(0); if (results.getResults().length <= commandIndex || zero.equals(results.getResults()[commandIndex].get(0))) { return; } Object metadataId = gs.getMetadataID(); if (metadataId == null) { return; } if (!(metadataId instanceof Table)) { if (metadataId instanceof TempMetadataID) { TempMetadataID tid = (TempMetadataID)metadataId; if (tid.getTableData().getModel() != null) { tid.getTableData().dataModified((Integer)results.getResults()[commandIndex].get(0)); } } return; } Table t = (Table)metadataId; t.setLastDataModification(ts); if (distributor != null) { distributor.dataModification(this.workItem.getDqpWorkContext().getVdbName(), this.workItem.getDqpWorkContext().getVdbVersion(), t.getParent().getName(), t.getName()); } }
private AtomicRequestMessage createRequest(RequestWorkItem workItem, Command command, String modelName, String connectorBindingId, int nodeID) throws TeiidComponentException { RequestMessage request = workItem.requestMsg; // build the atomic request based on original request + context info AtomicRequestMessage aqr = new AtomicRequestMessage(request, workItem.getDqpWorkContext(), nodeID); aqr.setCommand(command); aqr.setModelName(modelName); aqr.setMaxResultRows(requestMgr.getMaxSourceRows()); aqr.setExceptionOnMaxRows(requestMgr.isExceptionOnMaxSourceRows()); aqr.setPartialResults(request.supportsPartialResults()); aqr.setSerial(requestMgr.getUserRequestSourceConcurrency() == 1); aqr.setTransactionContext(workItem.getTransactionContext()); aqr.setBufferManager(this.getBufferManager()); if (connectorBindingId == null) { VDBMetaData vdb = workItem.getDqpWorkContext().getVDB(); ModelMetaData model = vdb.getModel(modelName); List<String> bindings = model.getSourceNames(); if (bindings == null || bindings.size() != 1) { // this should not happen, but it did occur when setting up the SystemAdmin models throw new TeiidComponentException(QueryPlugin.Event.TEIID30554, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30554, modelName, workItem.getDqpWorkContext().getVdbName(), workItem.getDqpWorkContext().getVdbVersion())); } connectorBindingId = bindings.get(0); Assertion.isNotNull(connectorBindingId, "could not obtain connector id"); //$NON-NLS-1$ } aqr.setConnectorName(connectorBindingId); return aqr; }
public void testGetConnectorInfo() { DQPCore rm = new DQPCore(); rm.setTransactionService(new FakeTransactionService()); RequestMessage r0 = new RequestMessage("foo"); //$NON-NLS-1$ RequestID requestID = new RequestID(SESSION_STRING, 1); RequestWorkItem workItem = addRequest(rm, r0, requestID, null, null); AtomicRequestMessage atomicReq = new AtomicRequestMessage(workItem.requestMsg, workItem.getDqpWorkContext(), 1); DataTierTupleSource info = Mockito.mock(DataTierTupleSource.class); workItem.addConnectorRequest(atomicReq.getAtomicRequestID(), info); DataTierTupleSource arInfo = workItem.getConnectorRequest(atomicReq.getAtomicRequestID()); assertTrue(arInfo == info); }
public void testRemoveConnectorInfo() { DQPCore rm = new DQPCore(); rm.setTransactionService(new FakeTransactionService()); RequestMessage r0 = new RequestMessage("foo"); //$NON-NLS-1$ RequestID requestID = new RequestID(SESSION_STRING, 1); RequestWorkItem workItem = addRequest(rm, r0, requestID, null, null); AtomicRequestMessage atomicReq = new AtomicRequestMessage(workItem.requestMsg, workItem.getDqpWorkContext(), 1); DataTierTupleSource info = Mockito.mock(DataTierTupleSource.class); workItem.addConnectorRequest(atomicReq.getAtomicRequestID(), info); workItem.closeAtomicRequest(atomicReq.getAtomicRequestID()); DataTierTupleSource arInfo = workItem.getConnectorRequest(atomicReq.getAtomicRequestID()); assertNull(arInfo); } }
Assertion.isNotNull(workItem); if(CoreConstants.SYSTEM_MODEL.equals(modelName) || CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName)) { return processSystemQuery(context, command, workItem.getDqpWorkContext()); ConnectorManagerRepository cmr = workItem.getDqpWorkContext().getVDB().getAttachment(ConnectorManagerRepository.class); ConnectorManager connectorManager = cmr.getConnectorManager(aqr.getConnectorName()); if (connectorManager == null) { String cmdString = command.toString(); if (cmdString.length() < 100000) { //TODO: this check won't be needed if keys aren't exclusively held in memory cid = new CacheID(workItem.getDqpWorkContext(), ParseInfo.DEFAULT_INSTANCE, cmdString); cid.setParameters(cv.parameters); if (cd.getInvalidation() == null || cd.getInvalidation() == Invalidation.NONE) {
Assertion.isNotNull(workItem); if(CoreConstants.SYSTEM_MODEL.equals(modelName) || CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName)) { return processSystemQuery(context, command, workItem.getDqpWorkContext()); ConnectorManagerRepository cmr = workItem.getDqpWorkContext().getVDB().getAttachment(ConnectorManagerRepository.class); ConnectorManager connectorManager = cmr.getConnectorManager(aqr.getConnectorName()); if (connectorManager == null) { String cmdString = command.toString(); if (cmdString.length() < 100000) { //TODO: this check won't be needed if keys aren't exclusively held in memory cid = new CacheID(workItem.getDqpWorkContext(), ParseInfo.DEFAULT_INSTANCE, cmdString); cid.setParameters(cv.parameters); if (cd.getInvalidation() == null || cd.getInvalidation() == Invalidation.NONE) {
Assertion.isNotNull(workItem); if(CoreConstants.SYSTEM_MODEL.equals(modelName) || CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName)) { return processSystemQuery(context, command, workItem.getDqpWorkContext()); ConnectorManagerRepository cmr = workItem.getDqpWorkContext().getVDB().getAttachment(ConnectorManagerRepository.class); ConnectorManager connectorManager = cmr.getConnectorManager(aqr.getConnectorName()); if (connectorManager == null) { String cmdString = command.toString(); if (cmdString.length() < 100000) { //TODO: this check won't be needed if keys aren't exclusively held in memory cid = new CacheID(workItem.getDqpWorkContext(), ParseInfo.DEFAULT_INSTANCE, cmdString); cid.setParameters(cv.parameters); if (cd.getInvalidation() == null || cd.getInvalidation() == Invalidation.NONE) {