public Object getFieldValue(_Fields field) { switch (field) { case TXN_TO_WRITE_IDS: return getTxnToWriteIds(); } throw new IllegalStateException(); }
private List<TxnToWriteId> allocateTableWriteIdsBatchIntr(AllocateTableWriteIdsRequest rqst) throws TException { return client.allocate_table_write_ids(rqst).getTxnToWriteIds(); }
private List<TxnToWriteId> allocateTableWriteIdsBatchIntr(AllocateTableWriteIdsRequest rqst) throws TException { return client.allocate_table_write_ids(rqst).getTxnToWriteIds(); }
@Override public AllocateTableWriteIdsResponse allocate_table_write_ids( AllocateTableWriteIdsRequest rqst) throws TException { AllocateTableWriteIdsResponse response = getTxnHandler().allocateTableWriteIds(rqst); if (listeners != null && !listeners.isEmpty()) { MetaStoreListenerNotifier.notifyEvent(listeners, EventType.ALLOC_WRITE_ID, new AllocWriteIdEvent(response.getTxnToWriteIds(), rqst.getDbName(), rqst.getTableName(), this)); } return response; }
protected long allocateWriteId(String dbName, String tblName, long txnid) throws MetaException, TxnAbortedException, NoSuchTxnException { AllocateTableWriteIdsRequest awiRqst = new AllocateTableWriteIdsRequest(dbName, tblName); awiRqst.setTxnIds(Collections.singletonList(txnid)); AllocateTableWriteIdsResponse awiResp = txnHandler.allocateTableWriteIds(awiRqst); return awiResp.getTxnToWriteIds().get(0).getWriteId(); }
allocMsg.setReplPolicy("destdb.*"); allocMsg.setSrcTxnToWriteIdList(srcTxnToWriteId); targetTxnToWriteId = txnHandler.allocateTableWriteIds(allocMsg).getTxnToWriteIds(); for (int idx = 0; idx < targetTxnList.size(); idx++) { assertEquals(targetTxnToWriteId.get(idx).getWriteId(), srcTxnToWriteId.get(idx).getWriteId()); targetTxnToWriteId = txnHandler.allocateTableWriteIds(allocMsg).getTxnToWriteIds(); for (int idx = 0; idx < targetTxnList.size(); idx++) { assertEquals(targetTxnToWriteId.get(idx).getWriteId(), srcTxnToWriteId.get(idx).getWriteId()); txnHandler.allocateTableWriteIds(allocMsg).getTxnToWriteIds(); } catch (IllegalStateException e) { failed = true; txnHandler.allocateTableWriteIds(allocMsg).getTxnToWriteIds(); } catch (RuntimeException e) { failed = true;
rqst.setTxnIds(openTxns.getTxn_ids()); AllocateTableWriteIdsResponse writeIds = txnHandler.allocateTableWriteIds(rqst); long writeId = writeIds.getTxnToWriteIds().get(0).getWriteId(); assertEquals(txnId, writeIds.getTxnToWriteIds().get(0).getTxnId()); assertEquals(1, writeId);
protected void burnThroughTransactions(String dbName, String tblName, int num, Set<Long> open, Set<Long> aborted) throws MetaException, NoSuchTxnException, TxnAbortedException { OpenTxnsResponse rsp = txnHandler.openTxns(new OpenTxnRequest(num, "me", "localhost")); AllocateTableWriteIdsRequest awiRqst = new AllocateTableWriteIdsRequest(dbName, tblName); awiRqst.setTxnIds(rsp.getTxn_ids()); AllocateTableWriteIdsResponse awiResp = txnHandler.allocateTableWriteIds(awiRqst); int i = 0; for (long tid : rsp.getTxn_ids()) { assert(awiResp.getTxnToWriteIds().get(i++).getTxnId() == tid); if (aborted != null && aborted.contains(tid)) { txnHandler.abortTxn(new AbortTxnRequest(tid)); } else if (open == null || (open != null && !open.contains(tid))) { txnHandler.commitTxn(new CommitTxnRequest(tid)); } } }
rqst.setTxnIds(Collections.singletonList(3L)); AllocateTableWriteIdsResponse writeIds = txnHandler.allocateTableWriteIds(rqst); long writeId = writeIds.getTxnToWriteIds().get(0).getWriteId(); assertEquals(3, writeIds.getTxnToWriteIds().get(0).getTxnId()); assertEquals(1, writeId);
rqst.setTxnIds(Collections.singletonList(txnId)); AllocateTableWriteIdsResponse writeIds = txnHandler.allocateTableWriteIds(rqst); Assert.assertEquals(txnId, writeIds.getTxnToWriteIds().get(0).getTxnId()); AddDynamicPartitions adp = new AddDynamicPartitions(txnId, writeIds.getTxnToWriteIds().get(0).getWriteId(), "default", "TAB_PART", Arrays.asList("p=blah"));
rqst.setTxnIds(Collections.singletonList(txnMgr2.getCurrentTxnId())); AllocateTableWriteIdsResponse writeIds = txnHandler.allocateTableWriteIds(rqst); Assert.assertEquals(txnMgr2.getCurrentTxnId(), writeIds.getTxnToWriteIds().get(0).getTxnId()); AddDynamicPartitions adp = new AddDynamicPartitions(txnMgr2.getCurrentTxnId(), writeIds.getTxnToWriteIds().get(0).getWriteId(), "default", "tab2", Collections.EMPTY_LIST); adp.setOperationType(DataOperationType.UPDATE); rqst.setTxnIds(Collections.singletonList(txnMgr2.getCurrentTxnId())); writeIds = txnHandler.allocateTableWriteIds(rqst); Assert.assertEquals(txnMgr2.getCurrentTxnId(), writeIds.getTxnToWriteIds().get(0).getTxnId()); adp = new AddDynamicPartitions(txnMgr2.getCurrentTxnId(), writeIds.getTxnToWriteIds().get(0).getWriteId(), "default", "tab2", Collections.singletonList("p=two")); adp.setOperationType(DataOperationType.UPDATE); rqst.setTxnIds(Collections.singletonList(txnMgr.getCurrentTxnId())); writeIds = txnHandler.allocateTableWriteIds(rqst); Assert.assertEquals(txnMgr.getCurrentTxnId(), writeIds.getTxnToWriteIds().get(0).getTxnId()); adp = new AddDynamicPartitions(txnMgr.getCurrentTxnId(), writeIds.getTxnToWriteIds().get(0).getWriteId(), "default", "tab2", Collections.EMPTY_LIST); adp.setOperationType(DataOperationType.UPDATE);
@Override public AllocateTableWriteIdsResponse allocate_table_write_ids( AllocateTableWriteIdsRequest rqst) throws TException { AllocateTableWriteIdsResponse response = getTxnHandler().allocateTableWriteIds(rqst); if (listeners != null && !listeners.isEmpty()) { MetaStoreListenerNotifier.notifyEvent(listeners, EventType.ALLOC_WRITE_ID, new AllocWriteIdEvent(response.getTxnToWriteIds(), rqst.getDbName(), rqst.getTableName(), this)); } return response; }