message = ((Constant)proc.getParameter(4).getExpression()).getValue(); int msgLevel = getLevel(level); boolean logged = false; if (LogManager.isMessageToBeRecorded(logContext, msgLevel)) { final AbstractMetadataRecord target = getByUuid(metadata, uuid); if (target == null) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30549, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30549, uuid)); throw new TeiidProcessingException(QueryPlugin.Event.TEIID31098, QueryPlugin.Util.getString("ValidationVisitor.invalid_alter", uuid)); //$NON-NLS-1$ if (getMetadataRepository(target, vdb) != null) { getMetadataRepository(target, vdb).setProperty(vdbName, vdbVersion, target, key, strVal); columnStats.setMaximumValue(max); columnStats.setMinimumValue(min); if (getMetadataRepository(table, vdb) != null) { getMetadataRepository(table, vdb).setColumnStats(vdbName, vdbVersion, c, columnStats); TableStats tableStats = new TableStats(); tableStats.setCardinality(cardinality); if (getMetadataRepository(table, vdb) != null) { getMetadataRepository(table, vdb).setTableStats(vdbName, vdbVersion, table, tableStats);
if (index == 0 && this.dtm.detectChangeEvents()) { Command command = aqr.getCommand(); int commandIndex = 0; if (RelationalNodeUtil.isUpdate(command)) { long ts = System.currentTimeMillis(); checkForUpdates(results, command, dtm.getEventDistributor(), commandIndex, ts); } else if (command instanceof BatchedUpdateCommand) { long ts = System.currentTimeMillis(); BatchedUpdateCommand bac = (BatchedUpdateCommand)command; for (Command uc : bac.getUpdateCommands()) { checkForUpdates(results, uc, dtm.getEventDistributor(), commandIndex++, ts);
TransformationMetadata tm = new TransformationMetadata(null, new CompositeMetadataStore(ms), null, null, null); String name = SystemTables.SCHEMAS.name(); List<ElementSymbol> columns = getColumns(tm, name); systemTables.put(SystemTables.SCHEMAS, new RecordExtractionTable<Schema>(new SchemaRecordTable(1, columns), columns) { columns = getColumns(tm, name); systemTables.put(SystemTables.TABLES, new RecordExtractionTable<Table>(new TableSystemTable(1, 2, columns), columns) { columns = getColumns(tm, name); systemAdminTables.put(SystemAdminTables.MATVIEWS, new RecordExtractionTable<Table>(new TableSystemTable(1, 2, columns) { @Override columns = getColumns(tm, name); systemAdminTables.put(SystemAdminTables.VDBRESOURCES, new BaseExtractionTable<String>(columns) { columns = getColumns(tm, name); systemTables.put(SystemTables.PROCEDURES, new RecordExtractionTable<Procedure>(new ProcedureSystemTable(1, 2, columns), columns) { columns = getColumns(tm, name); systemTables.put(SystemTables.FUNCTIONS, new RecordExtractionTable<FunctionMethod>(new FunctionSystemTable(1, 4, columns), columns) { columns = getColumns(tm, name); systemTables.put(SystemTables.DATATYPES, new RecordExtractionTable<Datatype>(new RecordTable<Datatype>(new int[] {0}, columns.subList(0, 1)) { columns = getColumns(tm, name); systemTables.put(SystemTables.VIRTUALDATABASES, new BaseExtractionTable<VDBMetaData>(columns) { @Override columns = getColumns(tm, name);
Assertion.isNotNull(workItem); if(CoreConstants.SYSTEM_MODEL.equals(modelName) || CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName)) { return processSystemQuery(context, command, workItem.getDqpWorkContext()); AtomicRequestMessage aqr = createRequest(workItem, command, modelName, parameterObject.connectorBindingId, parameterObject.nodeID); aqr.setCommandContext(context); if (parameterObject.fetchSize > 0) { TupleBuffer tb = null; if (cid != null) { tb = getBufferManager().createTupleBuffer(aqr.getCommand().getProjectedSymbols(), aqr.getCommandContext().getConnectionId(), TupleSourceType.PROCESSOR); result = new CachingTupleSource(this, tb, (DataTierTupleSource)result, cid, parameterObject, cd, accessedGroups, workItem); result = handleThreadBound(workItem, aqr, work, cid, result, dtts, tb); } else if (!aqr.isSerial()) { dtts.addWork();
DataTierManagerImpl processorDataManager = new DataTierManagerImpl(this, this.bufferManager, this.config.isDetectingChangeEvents()); processorDataManager.setEventDistributor(eventDistributor); dataTierMgr = new TempTableDataManager(processorDataManager, this.bufferManager, this.rsCache); dataTierMgr.setExecutor(new TempTableDataManager.RequestExecutor() {
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; }
@Override public void setProperty(String vdbName, String vdbVersion, String uuid, String name, String value) { VDBMetaData vdb = getVdbRepository().getLiveVDB(vdbName, vdbVersion); if (vdb == null) { return; } TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class); if (tm == null) { return; } AbstractMetadataRecord record = DataTierManagerImpl.getByUuid(tm.getMetadataStore(), uuid); if (record != null) { DdlPlan.setProperty(vdb, record, name, value); } }
private void helpSetupDataTierManager() { FakeBufferService bs = new FakeBufferService(); rm = new DQPCore(); rm.setTransactionService(new FakeTransactionService()); rm.setBufferManager(bs.getBufferManager()); CacheConfiguration config = new CacheConfiguration(); config.setMaxAgeInSeconds(-1); rm.setResultsetCache(new SessionAwareCache<CachedResults>("resultset", new DefaultCacheFactory(config), SessionAwareCache.Type.RESULTSET, 0)); rm.setPreparedPlanCache(new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(config), SessionAwareCache.Type.PREPAREDPLAN, 0)); rm.start(new DQPConfiguration()); ConnectorManagerRepository repo = Mockito.mock(ConnectorManagerRepository.class); Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(connectorManager); vdb.addAttchment(ConnectorManagerRepository.class, repo); dtm = new DataTierManagerImpl(rm,bs.getBufferManager(), true); }
Assertion.isNotNull(workItem); if(CoreConstants.SYSTEM_MODEL.equals(modelName) || CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName)) { return processSystemQuery(context, command, workItem.getDqpWorkContext()); AtomicRequestMessage aqr = createRequest(workItem, command, modelName, parameterObject.connectorBindingId, parameterObject.nodeID); aqr.setCommandContext(context); if (parameterObject.fetchSize > 0) { TupleBuffer tb = null; if (cid != null) { tb = getBufferManager().createTupleBuffer(aqr.getCommand().getProjectedSymbols(), aqr.getCommandContext().getConnectionId(), TupleSourceType.PROCESSOR); result = new CachingTupleSource(this, tb, (DataTierTupleSource)result, cid, parameterObject, cd, accessedGroups, workItem); result = handleThreadBound(workItem, aqr, work, cid, result, dtts, tb); } else if (!aqr.isSerial()) { dtts.addWork();
DataTierManagerImpl processorDataManager = new DataTierManagerImpl(this, this.bufferManager, this.config.isDetectingChangeEvents()); processorDataManager.setEventDistributor(eventDistributor); dataTierMgr = new TempTableDataManager(processorDataManager, this.bufferManager, this.rsCache); dataTierMgr.setExecutor(new TempTableDataManager.RequestExecutor() {
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; }
Assertion.isNotNull(workItem); if(CoreConstants.SYSTEM_MODEL.equals(modelName) || CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName)) { return processSystemQuery(context, command, workItem.getDqpWorkContext()); AtomicRequestMessage aqr = createRequest(workItem, command, modelName, parameterObject.connectorBindingId, parameterObject.nodeID); aqr.setCommandContext(context); if (parameterObject.fetchSize > 0) { TupleBuffer tb = null; if (cid != null) { tb = getBufferManager().createTupleBuffer(aqr.getCommand().getProjectedSymbols(), aqr.getCommandContext().getConnectionId(), TupleSourceType.PROCESSOR); result = new CachingTupleSource(this, tb, (DataTierTupleSource)result, cid, parameterObject, cd, accessedGroups, workItem); result = handleThreadBound(workItem, aqr, work, cid, result, dtts, tb); } else if (!aqr.isSerial()) { dtts.addWork();
message = ((Constant)proc.getParameter(4).getExpression()).getValue(); int msgLevel = getLevel(level); boolean logged = false; if (LogManager.isMessageToBeRecorded(logContext, msgLevel)) { final AbstractMetadataRecord target = getByUuid(metadata, uuid); if (target == null) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30549, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30549, uuid)); throw new TeiidProcessingException(QueryPlugin.Event.TEIID31098, QueryPlugin.Util.getString("ValidationVisitor.invalid_alter", uuid)); //$NON-NLS-1$ if (getMetadataRepository(target, vdb) != null) { getMetadataRepository(target, vdb).setProperty(vdbName, vdbVersion, target, key, strVal); columnStats.setMaximumValue(max); columnStats.setMinimumValue(min); if (getMetadataRepository(table, vdb) != null) { getMetadataRepository(table, vdb).setColumnStats(vdbName, vdbVersion, c, columnStats); TableStats tableStats = new TableStats(); tableStats.setCardinality(cardinality); if (getMetadataRepository(table, vdb) != null) { getMetadataRepository(table, vdb).setTableStats(vdbName, vdbVersion, table, tableStats);
DataTierManagerImpl processorDataManager = new DataTierManagerImpl(this, this.bufferManager, this.config.isDetectingChangeEvents()); processorDataManager.setEventDistributor(eventDistributor); dataTierMgr = new TempTableDataManager(processorDataManager, this.bufferManager, this.rsCache); dataTierMgr.setExecutor(new TempTableDataManager.RequestExecutor() {
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; }
if (index == 0 && this.dtm.detectChangeEvents()) { Command command = aqr.getCommand(); int commandIndex = 0; if (RelationalNodeUtil.isUpdate(command)) { long ts = System.currentTimeMillis(); checkForUpdates(results, command, dtm.getEventDistributor(), commandIndex, ts); } else if (command instanceof BatchedUpdateCommand) { long ts = System.currentTimeMillis(); BatchedUpdateCommand bac = (BatchedUpdateCommand)command; for (Command uc : bac.getUpdateCommands()) { checkForUpdates(results, uc, dtm.getEventDistributor(), commandIndex++, ts);
TransformationMetadata tm = new TransformationMetadata(null, new CompositeMetadataStore(ms), null, null, null); String name = SystemTables.SCHEMAS.name(); List<ElementSymbol> columns = getColumns(tm, name); systemTables.put(SystemTables.SCHEMAS, new RecordExtractionTable<Schema>(new SchemaRecordTable(1, columns), columns) { columns = getColumns(tm, CoreConstants.SYSTEM_MODEL + "." +name); //$NON-NLS-1$ systemTables.put(SystemTables.TABLES, new RecordExtractionTable<Table>(new TableSystemTable(1, 2, columns), columns) { columns = getColumns(tm, name); systemAdminTables.put(SystemAdminTables.MATVIEWS, new RecordExtractionTable<Table>(new TableSystemTable(1, 2, columns) { @Override columns = getColumns(tm, name); systemAdminTables.put(SystemAdminTables.VDBRESOURCES, new BaseExtractionTable<String>(columns) { columns = getColumns(tm, name); systemTables.put(SystemTables.PROCEDURES, new RecordExtractionTable<Procedure>(new ProcedureSystemTable(1, 2, columns), columns) { columns = getColumns(tm, name); systemTables.put(SystemTables.FUNCTIONS, new RecordExtractionTable<FunctionMethod>(new FunctionSystemTable(1, 4, columns), columns) { columns = getColumns(tm, name); systemTables.put(SystemTables.DATATYPES, new RecordExtractionTable<Datatype>(new RecordTable<Datatype>(new int[] {0}, columns.subList(0, 1)) { columns = getColumns(tm, name); systemTables.put(SystemTables.VIRTUALDATABASES, new BaseExtractionTable<VDBMetaData>(columns) { @Override columns = getColumns(tm, name);
message = ((Constant)proc.getParameter(4).getExpression()).getValue(); int msgLevel = getLevel(level); boolean logged = false; if (LogManager.isMessageToBeRecorded(logContext, msgLevel)) { final AbstractMetadataRecord target = getByUuid(metadata, uuid); if (target == null) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30549, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30549, uuid)); throw new TeiidProcessingException(QueryPlugin.Event.TEIID31098, QueryPlugin.Util.getString("ValidationVisitor.invalid_alter", uuid)); //$NON-NLS-1$ if (getMetadataRepository(target, vdb) != null) { getMetadataRepository(target, vdb).setProperty(vdbName, vdbVersion, target, key, strVal); columnStats.setMaximumValue(max); columnStats.setMinimumValue(min); if (getMetadataRepository(table, vdb) != null) { getMetadataRepository(table, vdb).setColumnStats(vdbName, vdbVersion, c, columnStats); TableStats tableStats = new TableStats(); tableStats.setCardinality(cardinality); if (getMetadataRepository(table, vdb) != null) { getMetadataRepository(table, vdb).setTableStats(vdbName, vdbVersion, table, tableStats);
tb = getBufferManager().createTupleBuffer(aqr.getCommand().getProjectedSymbols(), aqr.getCommandContext().getConnectionId(), TupleSourceType.PROCESSOR);
if (index == 0 && this.dtm.detectChangeEvents()) { Command command = aqr.getCommand(); int commandIndex = 0; if (RelationalNodeUtil.isUpdate(command)) { long ts = System.currentTimeMillis(); checkForUpdates(results, command, dtm.getEventDistributor(), commandIndex, ts); } else if (command instanceof BatchedUpdateCommand) { long ts = System.currentTimeMillis(); BatchedUpdateCommand bac = (BatchedUpdateCommand)command; for (Command uc : bac.getUpdateCommands()) { checkForUpdates(results, uc, dtm.getEventDistributor(), commandIndex++, ts);