deniskuzZ commented on code in PR #6281:
URL: https://github.com/apache/hive/pull/6281#discussion_r2741818469


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/jdbc/queries/ReadyToCleanHandler.java:
##########
@@ -88,7 +88,7 @@ public String getParameterizedQueryString(DatabaseProduct 
databaseProduct) throw
               "ON \"cq1\".\"CQ_DATABASE\" = \"hwm\".\"MH_DATABASE\"" +
               "  AND \"cq1\".\"CQ_TABLE\" = \"hwm\".\"MH_TABLE\"";
 
-      whereClause += " AND (\"CQ_HIGHEST_WRITE_ID\" < \"MIN_OPEN_WRITE_ID\" OR 
\"MIN_OPEN_WRITE_ID\" IS NULL)";
+      whereClause += " AND (\"CQ_HIGHEST_WRITE_ID\" < \"MIN_OPEN_WRITE_ID\"-1 
OR \"MIN_OPEN_WRITE_ID\" IS NULL)";

Review Comment:
   sure.
   
   imagine the following situation
   1) we have multiple deltas with max writeId=50; 
   2) starts select (TXN_ID=100) and records minOpenWriteId = 50+1;
   3) compaction starts (TXN_ID=101) and produced new base_50;
   4) cleaner starts. it checks compactor HWM (50) < registered minOpenWriteId 
(50+1), so it will try do to the cleanup and would fail with (txnid:100 is open 
and <= hwm: 50)
   
   since compaction doesn't create new writeId, to make sure select sees the 
result of compaction we need to keep gap of 1 write 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to