[ 
https://issues.apache.org/jira/browse/HIVE-23560?focusedWorklogId=459628&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-459628
 ]

ASF GitHub Bot logged work on HIVE-23560:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/Jul/20 03:38
            Start Date: 16/Jul/20 03:38
    Worklog Time Spent: 10m 
      Work Description: aasha commented on a change in pull request #1232:
URL: https://github.com/apache/hive/pull/1232#discussion_r455490444



##########
File path: 
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/BaseReplicationScenariosAcidTables.java
##########
@@ -336,18 +346,30 @@ void verifyInc2Load(String dbName, String lastReplId)
     return txns;
   }
 
-  void allocateWriteIdsForTables(String primaryDbName, Map<String, Long> 
tables,
-                                         TxnStore txnHandler,
-                                         List<Long> txns, HiveConf 
primaryConf) throws Throwable {
+  List<Long> allocateWriteIdsForTablesAndAquireLocks(String primaryDbName, 
Map<String, Long> tables,
+                                                     TxnStore txnHandler,
+                                                     List<Long> txns, HiveConf 
primaryConf) throws Throwable {
     AllocateTableWriteIdsRequest rqst = new AllocateTableWriteIdsRequest();
     rqst.setDbName(primaryDbName);
-
+    List<Long> lockIds = new ArrayList<>();
     for(Map.Entry<String, Long> entry : tables.entrySet()) {
       rqst.setTableName(entry.getKey());
       rqst.setTxnIds(txns);
       txnHandler.allocateTableWriteIds(rqst);
+      for (long txnId : txns) {
+        LockComponent comp = new LockComponent(LockType.SHARED_WRITE, 
LockLevel.TABLE,
+          primaryDbName);
+        comp.setTablename(entry.getKey());
+        comp.setOperationType(DataOperationType.UPDATE);
+        List<LockComponent> components = new ArrayList<LockComponent>(1);
+        components.add(comp);
+        LockRequest lockRequest = new LockRequest(components, "u1", 
"hostname");
+        lockRequest.setTxnid(txnId);
+        lockIds.add(txnHandler.lock(lockRequest).getLockid());

Review comment:
       because if you just do a open txn, it will not acquire a lock




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 459628)
    Time Spent: 1h 10m  (was: 1h)

> Optimize bootstrap dump to abort only write Transactions
> --------------------------------------------------------
>
>                 Key: HIVE-23560
>                 URL: https://issues.apache.org/jira/browse/HIVE-23560
>             Project: Hive
>          Issue Type: Task
>            Reporter: Aasha Medhi
>            Assignee: Aasha Medhi
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-23560.01.patch, HIVE-23560.02.patch, Optimize 
> bootstrap dump to avoid aborting all transactions.pdf
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Currently before doing a bootstrap dump, we abort all open transactions after 
> waiting for a configured time. We are proposing to abort only write 
> transactions for the db under replication and leave the read and repl created 
> transactions as is.
> This doc attached talks about it in detail



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to