[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-04-11 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 11/Apr/22 10:12
Start Date: 11/Apr/22 10:12
Worklog Time Spent: 10m 
  Work Description: asinkovits merged PR #3157:
URL: https://github.com/apache/hive/pull/3157




Issue Time Tracking
---

Worklog Id: (was: 755170)
Time Spent: 2h 20m  (was: 2h 10m)

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-04-08 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 08/Apr/22 11:43
Start Date: 08/Apr/22 11:43
Worklog Time Spent: 10m 
  Work Description: deniskuzZ commented on PR #3157:
URL: https://github.com/apache/hive/pull/3157#issuecomment-1092774567

   pending tests




Issue Time Tracking
---

Worklog Id: (was: 754540)
Time Spent: 2h 10m  (was: 2h)

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-04-05 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 05/Apr/22 08:21
Start Date: 05/Apr/22 08:21
Worklog Time Spent: 10m 
  Work Description: deniskuzZ commented on code in PR #3157:
URL: https://github.com/apache/hive/pull/3157#discussion_r842506372


##
ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java:
##
@@ -1480,6 +1482,57 @@ private static ValidTxnList 
getValidTxnList(Configuration conf) {
 return validTxnList;
   }
 
+
+  /**
+   * In case of the cleaner, we don't need to go into file level, it is enough 
to collect base/delta/deletedelta directories.
+   *
+   * @param fs the filesystem used for the directory lookup
+   * @param path the path of the table or partition needs to be cleaned
+   * @return The listed directory snapshot needs to be checked for cleaning
+   * @throws IOException on filesystem errors
+   */
+  public static Map getHdfsDirSnapshotsForCleaner(final 
FileSystem fs, final Path path)
+  throws IOException {
+Map dirToSnapshots = new HashMap<>();
+// depth first search
+Deque> stack = new ArrayDeque<>();
+stack.push(fs.listStatusIterator(path));
+while (!stack.isEmpty()) {
+  RemoteIterator itr = stack.pop();
+  while (itr.hasNext()) {
+FileStatus fStatus = itr.next();
+Path fPath = fStatus.getPath();
+if (acidHiddenFileFilter.accept(fPath) && 
acidTempDirFilter.accept(fPath)) {

Review Comment:
   we could use hiddenFileFilter as we don't need to include METADATA_FILE & 
ACID_FORMAT





Issue Time Tracking
---

Worklog Id: (was: 752705)
Time Spent: 2h  (was: 1h 50m)

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 2h
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-04-01 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 01/Apr/22 16:21
Start Date: 01/Apr/22 16:21
Worklog Time Spent: 10m 
  Work Description: asinkovits commented on a change in pull request #3157:
URL: https://github.com/apache/hive/pull/3157#discussion_r840740888



##
File path: ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
##
@@ -1480,6 +1471,40 @@ private static ValidTxnList 
getValidTxnList(Configuration conf) {
 return validTxnList;
   }
 
+
+  /**
+   * In case of the cleaner, we don't need to go into file level, it is enough 
to collect base/delta/deletedelta directories.
+   *
+   * @param fs the filesystem used for the directory lookup
+   * @param path the path of the table or partition needs to be cleaned
+   * @return The listed directory snapshot needs to be checked for cleaning
+   * @throws IOException on filesystem errors
+   */
+  public static Map getHdfsDirSnapshotsForCleaner(final 
FileSystem fs, final Path path)
+  throws IOException {
+Map dirToSnapshots = new HashMap<>();
+// depth first search
+Deque> stack = new ArrayDeque<>();
+stack.push(fs.listStatusIterator(path));
+while (!stack.isEmpty()) {
+  RemoteIterator itr = stack.pop();
+  while (itr.hasNext()) {
+FileStatus fStatus = itr.next();
+Path fPath = fStatus.getPath();
+if (acidHiddenFileFilter.accept(fPath)) {
+  if (deltaFileFilter.accept(fPath) ||

Review comment:
   I've switched the order, although I think the other way around was more 
optimal solution, as its more likely that an item is a delta than a base.




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 751663)
Time Spent: 1h 50m  (was: 1h 40m)

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-04-01 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 01/Apr/22 16:19
Start Date: 01/Apr/22 16:19
Worklog Time Spent: 10m 
  Work Description: asinkovits commented on a change in pull request #3157:
URL: https://github.com/apache/hive/pull/3157#discussion_r840739714



##
File path: ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
##
@@ -1480,6 +1471,40 @@ private static ValidTxnList 
getValidTxnList(Configuration conf) {
 return validTxnList;
   }
 
+
+  /**
+   * In case of the cleaner, we don't need to go into file level, it is enough 
to collect base/delta/deletedelta directories.
+   *
+   * @param fs the filesystem used for the directory lookup
+   * @param path the path of the table or partition needs to be cleaned
+   * @return The listed directory snapshot needs to be checked for cleaning
+   * @throws IOException on filesystem errors
+   */
+  public static Map getHdfsDirSnapshotsForCleaner(final 
FileSystem fs, final Path path)
+  throws IOException {
+Map dirToSnapshots = new HashMap<>();
+// depth first search
+Deque> stack = new ArrayDeque<>();
+stack.push(fs.listStatusIterator(path));
+while (!stack.isEmpty()) {
+  RemoteIterator itr = stack.pop();
+  while (itr.hasNext()) {
+FileStatus fStatus = itr.next();
+Path fPath = fStatus.getPath();
+if (acidHiddenFileFilter.accept(fPath)) {
+  if (deltaFileFilter.accept(fPath) ||
+  baseFileFilter.accept(fPath) ||
+  deleteEventDeltaDirFilter.accept(fPath)) {
+dirToSnapshots.put(fPath, new HdfsDirSnapshotImpl(fPath));
+  } else {

Review comment:
   Yeah, I've reiterated this part as there were issues around nonacid-acid 
conversion.




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 751661)
Time Spent: 1h 40m  (was: 1.5h)

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-04-01 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 01/Apr/22 16:18
Start Date: 01/Apr/22 16:18
Worklog Time Spent: 10m 
  Work Description: asinkovits commented on a change in pull request #3157:
URL: https://github.com/apache/hive/pull/3157#discussion_r840738771



##
File path: ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
##
@@ -1480,6 +1471,40 @@ private static ValidTxnList 
getValidTxnList(Configuration conf) {
 return validTxnList;
   }
 
+
+  /**
+   * In case of the cleaner, we don't need to go into file level, it is enough 
to collect base/delta/deletedelta directories.
+   *
+   * @param fs the filesystem used for the directory lookup
+   * @param path the path of the table or partition needs to be cleaned
+   * @return The listed directory snapshot needs to be checked for cleaning
+   * @throws IOException on filesystem errors
+   */
+  public static Map getHdfsDirSnapshotsForCleaner(final 
FileSystem fs, final Path path)
+  throws IOException {
+Map dirToSnapshots = new HashMap<>();
+// depth first search
+Deque> stack = new ArrayDeque<>();
+stack.push(fs.listStatusIterator(path));
+while (!stack.isEmpty()) {
+  RemoteIterator itr = stack.pop();
+  while (itr.hasNext()) {
+FileStatus fStatus = itr.next();
+Path fPath = fStatus.getPath();
+if (acidHiddenFileFilter.accept(fPath)) {

Review comment:
   Added the filter.




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 751655)
Time Spent: 1.5h  (was: 1h 20m)

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-04-01 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 01/Apr/22 16:17
Start Date: 01/Apr/22 16:17
Worklog Time Spent: 10m 
  Work Description: asinkovits commented on a change in pull request #3157:
URL: https://github.com/apache/hive/pull/3157#discussion_r840737751



##
File path: 
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCrudCompactorOnTez.java
##
@@ -28,9 +28,7 @@
 
 import com.google.common.collect.Lists;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.PathFilter;
+import org.apache.hadoop.fs.*;

Review comment:
   Fixed.




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

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

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-04-01 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 01/Apr/22 16:17
Start Date: 01/Apr/22 16:17
Worklog Time Spent: 10m 
  Work Description: asinkovits commented on a change in pull request #3157:
URL: https://github.com/apache/hive/pull/3157#discussion_r840737839



##
File path: ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
##
@@ -28,16 +28,7 @@
 import java.io.Serializable;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
+import java.util.*;

Review comment:
   Fied.

##
File path: ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
##
@@ -28,16 +28,7 @@
 import java.io.Serializable;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
+import java.util.*;

Review comment:
   Fixed.




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

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

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-03-31 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 31/Mar/22 08:51
Start Date: 31/Mar/22 08:51
Worklog Time Spent: 10m 
  Work Description: deniskuzZ commented on a change in pull request #3157:
URL: https://github.com/apache/hive/pull/3157#discussion_r839344126



##
File path: ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
##
@@ -1480,6 +1471,40 @@ private static ValidTxnList 
getValidTxnList(Configuration conf) {
 return validTxnList;
   }
 
+
+  /**
+   * In case of the cleaner, we don't need to go into file level, it is enough 
to collect base/delta/deletedelta directories.
+   *
+   * @param fs the filesystem used for the directory lookup
+   * @param path the path of the table or partition needs to be cleaned
+   * @return The listed directory snapshot needs to be checked for cleaning
+   * @throws IOException on filesystem errors
+   */
+  public static Map getHdfsDirSnapshotsForCleaner(final 
FileSystem fs, final Path path)
+  throws IOException {
+Map dirToSnapshots = new HashMap<>();
+// depth first search
+Deque> stack = new ArrayDeque<>();
+stack.push(fs.listStatusIterator(path));
+while (!stack.isEmpty()) {
+  RemoteIterator itr = stack.pop();
+  while (itr.hasNext()) {
+FileStatus fStatus = itr.next();
+Path fPath = fStatus.getPath();
+if (acidHiddenFileFilter.accept(fPath)) {
+  if (deltaFileFilter.accept(fPath) ||
+  baseFileFilter.accept(fPath) ||
+  deleteEventDeltaDirFilter.accept(fPath)) {
+dirToSnapshots.put(fPath, new HdfsDirSnapshotImpl(fPath));
+  } else {

Review comment:
   we could check if fStatus.isDirectory() before listing again




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 750848)
Time Spent: 50m  (was: 40m)

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-03-31 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 31/Mar/22 08:51
Start Date: 31/Mar/22 08:51
Worklog Time Spent: 10m 
  Work Description: deniskuzZ commented on a change in pull request #3157:
URL: https://github.com/apache/hive/pull/3157#discussion_r839344900



##
File path: ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
##
@@ -1480,6 +1471,40 @@ private static ValidTxnList 
getValidTxnList(Configuration conf) {
 return validTxnList;
   }
 
+
+  /**
+   * In case of the cleaner, we don't need to go into file level, it is enough 
to collect base/delta/deletedelta directories.
+   *
+   * @param fs the filesystem used for the directory lookup
+   * @param path the path of the table or partition needs to be cleaned
+   * @return The listed directory snapshot needs to be checked for cleaning
+   * @throws IOException on filesystem errors
+   */
+  public static Map getHdfsDirSnapshotsForCleaner(final 
FileSystem fs, final Path path)
+  throws IOException {
+Map dirToSnapshots = new HashMap<>();
+// depth first search
+Deque> stack = new ArrayDeque<>();
+stack.push(fs.listStatusIterator(path));
+while (!stack.isEmpty()) {
+  RemoteIterator itr = stack.pop();
+  while (itr.hasNext()) {
+FileStatus fStatus = itr.next();
+Path fPath = fStatus.getPath();
+if (acidHiddenFileFilter.accept(fPath)) {
+  if (deltaFileFilter.accept(fPath) ||

Review comment:
   please put some order: base/delta/deleteDelta




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 750849)
Time Spent: 1h  (was: 50m)

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-03-31 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 31/Mar/22 08:49
Start Date: 31/Mar/22 08:49
Worklog Time Spent: 10m 
  Work Description: deniskuzZ commented on a change in pull request #3157:
URL: https://github.com/apache/hive/pull/3157#discussion_r839342668



##
File path: ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
##
@@ -1480,6 +1471,40 @@ private static ValidTxnList 
getValidTxnList(Configuration conf) {
 return validTxnList;
   }
 
+
+  /**
+   * In case of the cleaner, we don't need to go into file level, it is enough 
to collect base/delta/deletedelta directories.
+   *
+   * @param fs the filesystem used for the directory lookup
+   * @param path the path of the table or partition needs to be cleaned
+   * @return The listed directory snapshot needs to be checked for cleaning
+   * @throws IOException on filesystem errors
+   */
+  public static Map getHdfsDirSnapshotsForCleaner(final 
FileSystem fs, final Path path)
+  throws IOException {
+Map dirToSnapshots = new HashMap<>();
+// depth first search
+Deque> stack = new ArrayDeque<>();
+stack.push(fs.listStatusIterator(path));
+while (!stack.isEmpty()) {
+  RemoteIterator itr = stack.pop();
+  while (itr.hasNext()) {
+FileStatus fStatus = itr.next();
+Path fPath = fStatus.getPath();
+if (acidHiddenFileFilter.accept(fPath)) {

Review comment:
   Should we skip temp dirs as well - acidTempDirFilter?




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 750846)
Time Spent: 40m  (was: 0.5h)

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-03-31 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 31/Mar/22 08:06
Start Date: 31/Mar/22 08:06
Worklog Time Spent: 10m 
  Work Description: deniskuzZ commented on a change in pull request #3157:
URL: https://github.com/apache/hive/pull/3157#discussion_r839301416



##
File path: ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
##
@@ -28,16 +28,7 @@
 import java.io.Serializable;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
+import java.util.*;

Review comment:
   wildcard imports




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 750829)
Time Spent: 0.5h  (was: 20m)

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-03-31 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 31/Mar/22 08:05
Start Date: 31/Mar/22 08:05
Worklog Time Spent: 10m 
  Work Description: deniskuzZ commented on a change in pull request #3157:
URL: https://github.com/apache/hive/pull/3157#discussion_r839300569



##
File path: 
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/TestCrudCompactorOnTez.java
##
@@ -28,9 +28,7 @@
 
 import com.google.common.collect.Lists;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.PathFilter;
+import org.apache.hadoop.fs.*;

Review comment:
   wildcard imports




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 750828)
Time Spent: 20m  (was: 10m)

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Work logged] (HIVE-25492) Major query-based compaction is skipped if partition is empty

2022-03-30 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on HIVE-25492:
-

Author: ASF GitHub Bot
Created on: 30/Mar/22 17:23
Start Date: 30/Mar/22 17:23
Worklog Time Spent: 10m 
  Work Description: asinkovits opened a new pull request #3157:
URL: https://github.com/apache/hive/pull/3157


   
   
   ### What changes were proposed in this pull request?
   
   Do not remove empty base directories in the end of a major query based 
compaction.
   Change how the cleaner collects base/delta/delete delta directories, which 
are checked if they are eligible for cleaning. 
   
   ### Why are the changes needed?
   
   It fixes two issues.
   First if the result of a major query based compaction is empty, the output 
(empty base directory) was deleted, so you ended up with a NOOP.
   Second, the cleaner did not take into account empty directories. 
(base/delta/delete delta) So it did not removed old files, even when after the 
previous fix, the empty base was the latest. It also did not removed empty 
delta/delete delta directories.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No
   
   ### How was this patch tested?
   
   Manual + unit tests


-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
---

Worklog Id: (was: 750290)
Remaining Estimate: 0h
Time Spent: 10m

> Major query-based compaction is skipped if partition is empty
> -
>
> Key: HIVE-25492
> URL: https://issues.apache.org/jira/browse/HIVE-25492
> Project: Hive
>  Issue Type: Bug
>Reporter: Karen Coppage
>Assignee: Antal Sinkovits
>Priority: Major
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently if the result of query-based compaction is an empty base, delta, or 
> delete delta, the empty directory is deleted.
> This is because of minor compaction – if there are only deltas to compact, 
> then no compacted delete delta should be created (only a compacted delta). In 
> the same way, if there are only delete deltas to compact, then no compacted 
> delta should be created (only a compacted delete delta).
> There is an issue with major compaction. If all the data in the partition has 
> been deleted, then we should get an empty base directory after compaction. 
> Instead, the empty base directory is deleted because it's empty and 
> compaction claims to succeed but we end up with the same deltas/delete deltas 
> we started with – basically compaction does not run.
> Where to start? MajorQueryCompactor#commitCompaction



--
This message was sent by Atlassian Jira
(v8.20.1#820001)