private TempTableSynchronization getSynchronization(CommandContext context) throws TeiidProcessingException { TempTableSynchronization synch = null; if (context == null || transactionMode == TransactionMode.NONE) { return null; } TransactionContext tc = context.getTransactionContext(); if (tc == null || tc.getTransactionType() == Scope.NONE) { return null; } String transactionId = tc.getTransactionId(); synch = synchronizations.get(transactionId); if (synch == null) { boolean success = false; try { synch = new TempTableSynchronization(transactionId); synchronizations.put(transactionId, synch); tc.getTransaction().registerSynchronization(synch); success = true; } catch (RollbackException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30223, e); } catch (SystemException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30224, e); } finally { if (!success) { synchronizations.remove(transactionId); } } } return synch; }
private TempTableSynchronization getSynchronization(CommandContext context) throws TeiidProcessingException { TempTableSynchronization synch = null; if (context == null || transactionMode == TransactionMode.NONE) { return null; } TransactionContext tc = context.getTransactionContext(); if (tc == null || tc.getTransactionType() == Scope.NONE) { return null; } String transactionId = tc.getTransactionId(); synch = synchronizations.get(transactionId); if (synch == null) { boolean success = false; try { synch = new TempTableSynchronization(transactionId); synchronizations.put(transactionId, synch); tc.getTransaction().registerSynchronization(synch); success = true; } catch (RollbackException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30223, e); } catch (SystemException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30224, e); } finally { if (!success) { synchronizations.remove(transactionId); } } } return synch; }
private TempTableSynchronization getSynchronization(CommandContext context) throws TeiidProcessingException { TempTableSynchronization synch = null; if (context == null || transactionMode == TransactionMode.NONE) { return null; } TransactionContext tc = context.getTransactionContext(); if (tc == null || tc.getTransactionType() == Scope.NONE) { return null; } String transactionId = tc.getTransactionId(); synch = synchronizations.get(transactionId); if (synch == null) { boolean success = false; try { synch = new TempTableSynchronization(transactionId); synchronizations.put(transactionId, synch); tc.getTransaction().registerSynchronization(synch); success = true; } catch (RollbackException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30223, e); } catch (SystemException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30224, e); } finally { if (!success) { synchronizations.remove(transactionId); } } } return synch; }
TransactionContext tc = context.getTransactionContext(); if (tc != null) { TempTableSynchronization synch = getSynchronization(context); TransactionContext tc = context.getTransactionContext(); if (tc != null && tc.getIsolationLevel() > Connection.TRANSACTION_READ_COMMITTED) { TempTableSynchronization synch = getSynchronization(context);
TransactionContext tc = context.getTransactionContext(); if (tc != null) { TempTableSynchronization synch = getSynchronization(context); TransactionContext tc = context.getTransactionContext(); if (tc != null && tc.getIsolationLevel() > Connection.TRANSACTION_READ_COMMITTED) { TempTableSynchronization synch = getSynchronization(context);
TransactionContext tc = context.getTransactionContext(); if (tc != null) { TempTableSynchronization synch = getSynchronization(context); TransactionContext tc = context.getTransactionContext(); if (tc != null && tc.getIsolationLevel() > Connection.TRANSACTION_READ_COMMITTED) { TempTableSynchronization synch = getSynchronization(context);
private void openPlan() throws TeiidComponentException, TeiidProcessingException { //reset prior to updating the context updatePlans[planIndex].reset(); if (this.contexts != null && !this.contexts.isEmpty()) { CommandContext context = updatePlans[planIndex].getContext(); VariableContext vc = context.getVariableContext(); //ensure that we're dealing with the global context //this is just a safe guard against the plan not correctly resetting the context while (vc.getParentContext() != null) { vc = vc.getParentContext(); } vc.clear(); VariableContext currentValues = this.contexts.get(planIndex); vc.putAll(currentValues); } TransactionContext tc = this.getContext().getTransactionContext(); if (startTxn[planIndex] && tc != null && tc.getTransactionType() == Scope.NONE) { this.getContext().getTransactionServer().begin(tc); this.planContexts[planIndex] = tc; } updatePlans[planIndex].open(); planOpened[planIndex] = true; }
@Override public void open() throws TeiidComponentException, TeiidProcessingException { TransactionContext tc = this.getContext().getTransactionContext(); if (tc != null && tc.getTransactionType() == Scope.NONE && queryPlan != null && !Boolean.FALSE.equals(queryPlan.requiresTransaction(false))) { //start a transaction - if not each of the row plans will //be executed in it's own transaction, which is bad for performance //TODO: should probably allow non-atomic row plans //the parser accepts a trigger block without atomic //but the spec mandates it - and we treat it as atomic //either way //TODO: for non-transactional environments this will //trigger an error this.getContext().getTransactionServer().begin(tc); this.planContext = tc; } if (queryPlan != null) { queryProcessor = new QueryProcessor(queryPlan, getContext().clone(), this.bufferMgr, this.dataMgr); batchCollector = queryProcessor.createBatchCollector(); } }
@Override public void open() throws TeiidComponentException, TeiidProcessingException { TransactionContext tc = this.getContext().getTransactionContext(); if (tc != null && tc.getTransactionType() == Scope.NONE && queryPlan != null && !Boolean.FALSE.equals(queryPlan.requiresTransaction(false))) { //start a transaction - if not each of the row plans will //be executed in it's own transaction, which is bad for performance //TODO: should probably allow non-atomic row plans //the parser accepts a trigger block without atomic //but the spec mandates it - and we treat it as atomic //either way //TODO: for non-transactional environments this will //trigger an error this.getContext().getTransactionServer().begin(tc); this.planContext = tc; } if (queryPlan != null) { queryProcessor = new QueryProcessor(queryPlan, getContext().clone(), this.bufferMgr, this.dataMgr); tupleSource = new BatchCollector.BatchProducerTupleSource(queryProcessor); } }
@Override public void open() throws TeiidComponentException, TeiidProcessingException { TransactionContext tc = this.getContext().getTransactionContext(); if (tc != null && tc.getTransactionType() == Scope.NONE && queryPlan != null && !Boolean.FALSE.equals(queryPlan.requiresTransaction(false))) { //start a transaction - if not each of the row plans will //be executed in it's own transaction, which is bad for performance //TODO: should probably allow non-atomic row plans //the parser accepts a trigger block without atomic //but the spec mandates it - and we treat it as atomic //either way //TODO: for non-transactional environments this will //trigger an error this.getContext().getTransactionServer().begin(tc); this.planContext = tc; } if (queryPlan != null) { queryProcessor = new QueryProcessor(queryPlan, getContext().clone(), this.bufferMgr, this.dataMgr); batchCollector = queryProcessor.createBatchCollector(); } }
private void openPlan() throws TeiidComponentException, TeiidProcessingException { //reset prior to updating the context updatePlans[planIndex].reset(); if (this.contexts != null && !this.contexts.isEmpty()) { CommandContext context = updatePlans[planIndex].getContext(); VariableContext vc = context.getVariableContext(); //ensure that we're dealing with the global context //this is just a safe guard against the plan not correctly resetting the context while (vc.getParentContext() != null) { vc = vc.getParentContext(); } vc.clear(); VariableContext currentValues = this.contexts.get(planIndex); vc.putAll(currentValues); } TransactionContext tc = this.getContext().getTransactionContext(); if (startTxn[planIndex] && tc != null && tc.getTransactionType() == Scope.NONE) { this.getContext().getTransactionServer().begin(tc); this.planContexts[planIndex] = tc; } updatePlans[planIndex].open(); planOpened[planIndex] = true; }
private void openPlan() throws TeiidComponentException, TeiidProcessingException { //reset prior to updating the context updatePlans[planIndex].reset(); if (this.contexts != null && !this.contexts.isEmpty()) { CommandContext context = updatePlans[planIndex].getContext(); VariableContext vc = context.getVariableContext(); //ensure that we're dealing with the global context //this is just a safe guard against the plan not correctly resetting the context while (vc.getParentContext() != null) { vc = vc.getParentContext(); } vc.clear(); VariableContext currentValues = this.contexts.get(planIndex); vc.putAll(currentValues); } TransactionContext tc = this.getContext().getTransactionContext(); if (startTxn[planIndex] && tc != null && tc.getTransactionType() == Scope.NONE) { this.getContext().getTransactionServer().begin(tc); this.planContexts[planIndex] = tc; } updatePlans[planIndex].open(); planOpened[planIndex] = true; }
TransactionContext tc = this.getContext().getTransactionContext(); if (this.planContext == null && tc != null && tc.getTransactionType() == Scope.NONE) { Boolean txnRequired = rowProcedure.requiresTransaction(false);
public void push(Program program) throws XATransactionException { this.evaluator.close(); program.reset(this.getContext().getConnectionId()); program.setTrappingExceptions(program.getExceptionGroup() != null || (!this.programs.isEmpty() && this.programs.peek().isTrappingExceptions())); TempTableStore tts = getTempTableStore(); getContext().setTempTableStore(program.getTempTableStore()); program.getTempTableStore().setParentTempTableStore(tts); this.programs.push(program); VariableContext context = new VariableContext(true); context.setParentContext(this.currentVarContext); this.currentVarContext = context; VariableContext cc = new VariableContext(true); cc.setParentContext(this.cursorStates); this.cursorStates = cc; if (program.isAtomic() && this.blockContext == null) { TransactionContext tc = this.getContext().getTransactionContext(); if (tc != null && tc.getTransactionType() == Scope.NONE && Boolean.TRUE.equals(program.instructionsRequireTransaction(false))) { //start a transaction this.getContext().getTransactionServer().begin(tc); this.blockContext = tc; program.setStartedTxn(true); } } }
TransactionContext tc = this.getContext().getTransactionContext(); if (this.planContext == null && tc != null && tc.getTransactionType() == Scope.NONE) { Boolean txnRequired = rowProcedure.requiresTransaction(false);
TransactionContext tc = this.getContext().getTransactionContext(); if (this.planContext == null && tc != null && tc.getTransactionType() == Scope.NONE) { Boolean txnRequired = rowProcedure.requiresTransaction(false);
TransactionContext tc = this.getContext().getTransactionContext(); if (tc != null && tc.getTransactionType() == Scope.NONE) {
TransactionContext tc = this.getContext().getTransactionContext(); if (tc != null && tc.getTransactionType() == Scope.NONE) {
@Test public void testCommandContext() throws Exception { QueryMetadataInterface metadata = RealMetadataFactory.example1Cached(); //Try before plan is cached. //If this doesn't throw an exception, assume it was successful. RequestMessage message = new RequestMessage(QUERY); DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, RealMetadataFactory.example1VDB()); Request request = helpProcessMessage(message, null, workContext); assertEquals("1", request.context.getConnectionId()); //$NON-NLS-1$ assertNotNull(request.context.getTransactionContext()); }
this.pop(false); //allow the current program to go out of scope if (atomic) { TransactionContext tc = this.getContext().getTransactionContext(); if (tc != null && tc.getTransactionType() != Scope.NONE) {