chrajeshbabu commented on a change in pull request #1374: URL: https://github.com/apache/phoenix/pull/1374#discussion_r796136425
########## File path: phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionProvider.java ########## @@ -120,84 +101,20 @@ public void close() throws IOException {} return commitTableClient; } - @Override - public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connectionInfo, int port) throws SQLException{ - TSOServerConfig tsoConfig = new TSOServerConfig(); - TSOServer tso; - - tsoConfig.setPort(port); - tsoConfig.setConflictMapSize(config.getInt(OMID_TSO_CONFLICT_MAP_SIZE, DEFAULT_OMID_TSO_CONFLICT_MAP_SIZE)); - tsoConfig.setTimestampType(config.get(OMID_TSO_TIMESTAMP_TYPE, DEFAULT_OMID_TSO_TIMESTAMP_TYPE)); - tsoConfig.setWaitStrategy(WAIT_STRATEGY.LOW_CPU.toString()); - - Injector injector = Guice.createInjector(new TSOMockModule(tsoConfig)); - tso = injector.getInstance(TSOServer.class); - tso.startAsync(); - tso.awaitRunning(); - - OmidClientConfiguration clientConfig = new OmidClientConfiguration(); - clientConfig.setConnectionString("localhost:" + port); - clientConfig.setConflictAnalysisLevel(OmidClientConfiguration.ConflictDetectionLevel.ROW); - - InMemoryCommitTable commitTable = (InMemoryCommitTable) injector.getInstance(CommitTable.class); - - try { - // Create the associated Handler - TSOClient client = TSOClient.newInstance(clientConfig); - - HBaseOmidClientConfiguration clientConf = new HBaseOmidClientConfiguration(); - clientConf.setConnectionString("localhost:" + port); - clientConf.setConflictAnalysisLevel(OmidClientConfiguration.ConflictDetectionLevel.ROW); - clientConf.setHBaseConfiguration(config); - commitTableClient = commitTable.getClient(); - commitTableWriter = commitTable.getWriter(); - transactionManager = HBaseTransactionManager.builder(clientConf) - .commitTableClient(commitTableClient) - .commitTableWriter(commitTableWriter) - .tsoClient(client).build(); - } catch (IOException | InterruptedException e) { - throw new SQLExceptionInfo.Builder( - SQLExceptionCode.TRANSACTION_FAILED) - .setMessage(e.getMessage()).setRootCause(e).build() - .buildException(); - } - - return new OmidTransactionService(tso, transactionManager); - } - - static class OmidTransactionService implements PhoenixTransactionService { - private final HBaseTransactionManager transactionManager; - private TSOServer tso; - - public OmidTransactionService(TSOServer tso, HBaseTransactionManager transactionManager) { - this.tso = tso; - this.transactionManager = transactionManager; - } - - public void start() { - - } - - @Override - public void close() throws IOException { - if (transactionManager != null) { - transactionManager.close(); - } - if (tso != null) { - tso.stopAsync(); - tso.awaitTerminated(); - } - } + // For testing only + public void injectTestService(HBaseTransactionManager transactionManager, CommitTable.Client commitTableClient) { + this.transactionManager = transactionManager; + this.commitTableClient = commitTableClient; } @Override - public Class<? extends RegionObserver> getCoprocessor() { - return OmidTransactionalProcessor.class; Review comment: Any reason to use static string to specify the coprocessor class name? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@phoenix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org