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

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

                Author: ASF GitHub Bot
            Created on: 01/Apr/19 20:54
            Start Date: 01/Apr/19 20:54
    Worklog Time Spent: 10m 
      Work Description: jdere commented on pull request #582: Hive 21386: 
Extend the fetch task enhancement done in HIVE-21279 to make it work with query 
result cache
URL: https://github.com/apache/hive/pull/582#discussion_r270973907
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/Context.java
 ##########
 @@ -625,17 +637,43 @@ private Path getExternalScratchDir(URI extURI) {
     return getStagingDir(new Path(extURI.getScheme(), extURI.getAuthority(), 
extURI.getPath()), !isExplainSkipExecution());
   }
 
+  /**
+   * Remove any created scratch directories.
+   */
+  public void removeResultCacheDir() {
+    if(this.fsResultCacheDirs != null) {
+      try {
+        Path p = this.fsResultCacheDirs;
+        FileSystem fs = p.getFileSystem(conf);
+        LOG.debug("Deleting result cache dir: {}", p);
+        fs.delete(p, true);
+        fs.cancelDeleteOnExit(p);
+      } catch (Exception e) {
+        LOG.warn("Error Removing result cache dir: "
+                     + StringUtils.stringifyException(e));
+      }
+    }
+  }
+
   /**
    * Remove any created scratch directories.
    */
   public void removeScratchDir() {
+    String resultCacheDir = null;
+    if(this.fsResultCacheDirs != null) {
+      resultCacheDir = this.fsResultCacheDirs.toUri().getPath();
+    }
     for (Map.Entry<String, Path> entry : fsScratchDirs.entrySet()) {
       try {
         Path p = entry.getValue();
+        if(resultCacheDir == null || 
!p.toUri().getPath().contains(resultCacheDir)) {
 
 Review comment:
   One example which I believe I have seen:
   
   fsScratchDirs = [ /base/scratchdir/path ]
   resultCacheDir = [ /base/scratchdir/path/with/resultcache/ ]
   
   The result of this logic change will be that /base/scratchdir/path/ goes 
undeleted. With resultCacheDir eventually being deleted later. One question, is 
there any additional data in /base/scratchdir/path/ besides just the final 
query result, such as other temporary data generated by the query? If so, this 
additional data, in addition to the /base/scratchdir/path/ directory itself 
(empty or not) will be left around.
 
----------------------------------------------------------------
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: 221473)
    Time Spent: 1h 20m  (was: 1h 10m)

> Avoid moving/rename operation in FileSink op for SELECT queries
> ---------------------------------------------------------------
>
>                 Key: HIVE-21279
>                 URL: https://issues.apache.org/jira/browse/HIVE-21279
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Planning
>            Reporter: Vineet Garg
>            Assignee: Vineet Garg
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>         Attachments: HIVE-21279.1.patch, HIVE-21279.10.patch, 
> HIVE-21279.11.patch, HIVE-21279.12.patch, HIVE-21279.13.patch, 
> HIVE-21279.2.patch, HIVE-21279.3.patch, HIVE-21279.4.patch, 
> HIVE-21279.5.patch, HIVE-21279.6.patch, HIVE-21279.7.patch, 
> HIVE-21279.8.patch, HIVE-21279.9.patch
>
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Currently at the end of a job FileSink operator moves/rename temp directory 
> to another directory from which FetchTask fetches result. This is done to 
> avoid fetching potential partial/invalid files by failed/runway tasks. This 
> operation is expensive for cloud storage. It could be avoided if FetchTask is 
> passed on set of files to read from instead of whole directory.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to