Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-21822][SQL]When insert Hive Table is finished, it is better to clean out the tmpLocation dir #19035

Closed
wants to merge 1 commit into from

Conversation

figo77
Copy link
Contributor

@figo77 figo77 commented Aug 24, 2017

What changes were proposed in this pull request?

When insert Hive Table is finished, it is better to clean out the tmpLocation dir(the temp directories like ".hive-staging_hive_2017-08-19_10-56-01_540_5448395226195533570-9/-ext-10000" or "/tmp/hive/..." for an old spark version).
Otherwise, when lots of spark job are executed, millions of temporary directories are left in HDFS. And these temporary directories can only be deleted by the maintainer through the shell script.

How was this patch tested?

@figo77 figo77 changed the title [SPARK-21822][SQL]When insert Hive Table is finished, it is better to clean out the tmpLocation dir [MINOR][SQL]When insert Hive Table is finished, it is better to clean out the tmpLocation dir Aug 25, 2017
@figo77 figo77 changed the title [MINOR][SQL]When insert Hive Table is finished, it is better to clean out the tmpLocation dir [SPARK-21822][SQL]When insert Hive Table is finished, it is better to clean out the tmpLocation dir Aug 25, 2017
@BiyuHuang
Copy link

I think this change is very useful, auto-delete tmp location dir like : .hive-staging_xxxxxx could make everyone only see the target table's partition dir.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@@ -435,6 +435,18 @@ case class InsertIntoHiveTable(
logWarning(s"Unable to delete staging directory: $stagingDir.\n" + e)
}

//delete the tmpLocation dir
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint-scala gives error for this line: Insert a space after the start of the comment.

}
} catch {
case NonFatal(e) =>
logWarning(s"Unable to delete tmpLocation directory:" + tmpLocation.toString + "\n" + e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be compressed a bit:

logWarning(s"Unable to delete tmpLocation directory: $tmpLocation\n$e")

@gatorsmile
Copy link
Member

I think the problem is gone, right? Could you see the latest file version:

https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/InsertIntoHiveTable.scala

@gatorsmile
Copy link
Member

@figo77 Could you close it?

srowen added a commit to srowen/spark that referenced this pull request Dec 31, 2017
@srowen srowen mentioned this pull request Dec 31, 2017
@asfgit asfgit closed this in f5b7714 Jan 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants