Skip to content

Conversation

@Ngone51
Copy link
Member

@Ngone51 Ngone51 commented Mar 16, 2020

What changes were proposed in this pull request?

This fix #26956
Wrap try-catch on fs.getFileStatus(path) within acl/permission in case of the path doesn't exist.

Why are the changes needed?

truncate table may fail to re-create path in case of interruption or something else. As a result, next time we truncate table on the same table with acl/permission, it will fail due to FileNotFoundException. And it also brings behavior change compares to previous Spark version, which could still truncate table successfully even if the path doesn't exist.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Added UT.

@Ngone51
Copy link
Member Author

Ngone51 commented Mar 16, 2020

cc @viirya @cloud-fan @dongjoon-hyun

@SparkQA
Copy link

SparkQA commented Mar 16, 2020

Test build #119836 has finished for PR 27923 at commit cd84627.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

assert(!path.exists())
// execute without java.io.FileNotFoundException
sql("TRUNCATE TABLE tab1")
// partition path should be re-created
Copy link
Contributor

Choose a reason for hiding this comment

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

this only affects partition path, or table path as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Both, but can be more likely to happen on partition path since there's much more than table path.

@cloud-fan
Copy link
Contributor

retest this please

Copy link
Member

@viirya viirya left a comment

Choose a reason for hiding this comment

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

Thanks for catching this!

@SparkQA
Copy link

SparkQA commented Mar 16, 2020

Test build #119849 has finished for PR 27923 at commit cd84627.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM. Thank you, @Ngone51 , @cloud-fan , @viirya , @HyukjinKwon .
Merged to master/3.0/2.4.

dongjoon-hyun pushed a commit that referenced this pull request Mar 16, 2020
…ndle non-existed path

### What changes were proposed in this pull request?

This fix #26956
Wrap try-catch on `fs.getFileStatus(path)` within acl/permission in case of the path doesn't exist.

### Why are the changes needed?

`truncate table` may fail to re-create path in case of interruption or something else. As a result, next time we `truncate table` on the same table with acl/permission, it will fail due to `FileNotFoundException`. And it also brings behavior change compares to previous Spark version, which could still `truncate table` successfully even if the path doesn't exist.

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?

Added UT.

Closes #27923 from Ngone51/fix_truncate.

Authored-by: yi.wu <yi.wu@databricks.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit cb26f63)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun pushed a commit that referenced this pull request Mar 16, 2020
…ndle non-existed path

### What changes were proposed in this pull request?

This fix #26956
Wrap try-catch on `fs.getFileStatus(path)` within acl/permission in case of the path doesn't exist.

### Why are the changes needed?

`truncate table` may fail to re-create path in case of interruption or something else. As a result, next time we `truncate table` on the same table with acl/permission, it will fail due to `FileNotFoundException`. And it also brings behavior change compares to previous Spark version, which could still `truncate table` successfully even if the path doesn't exist.

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?

Added UT.

Closes #27923 from Ngone51/fix_truncate.

Authored-by: yi.wu <yi.wu@databricks.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit cb26f63)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
@Ngone51
Copy link
Member Author

Ngone51 commented Mar 17, 2020

thanks all!

@gatorsmile gatorsmile changed the title [SPARK-31163][SQL] TruncateTableCommand with acl/permission should handle non-existed path [SPARK-31163][SQL] TruncateTableCommand with acl/permission should handle non-existent path Mar 22, 2020
sjincho pushed a commit to sjincho/spark that referenced this pull request Apr 15, 2020
…ndle non-existed path

### What changes were proposed in this pull request?

This fix apache#26956
Wrap try-catch on `fs.getFileStatus(path)` within acl/permission in case of the path doesn't exist.

### Why are the changes needed?

`truncate table` may fail to re-create path in case of interruption or something else. As a result, next time we `truncate table` on the same table with acl/permission, it will fail due to `FileNotFoundException`. And it also brings behavior change compares to previous Spark version, which could still `truncate table` successfully even if the path doesn't exist.

### Does this PR introduce any user-facing change?

No.

### How was this patch tested?

Added UT.

Closes apache#27923 from Ngone51/fix_truncate.

Authored-by: yi.wu <yi.wu@databricks.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants