Skip to content

[SPARK-19306][Core] Fix inconsistent state in DiskBlockObject when expection occurred #16657

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

Closed
wants to merge 2 commits into from

Conversation

jerryshao
Copy link
Contributor

What changes were proposed in this pull request?

In DiskBlockObjectWriter, when some errors happened during writing, it will call revertPartialWritesAndClose, if this method again failed due to some issues like out of disk, it will throw exception without resetting the state of this writer, also skipping the revert. So here propose to fix this issue to offer user a chance to recover from such issue.

How was this patch tested?

Existing test.

Change-Id: I837b5135dd67034d74a9832133dc29800c88f089
@jerryshao
Copy link
Contributor Author

CC @mridulm please help to review, thanks a lot.

@SparkQA
Copy link

SparkQA commented Jan 20, 2017

Test build #71712 has finished for PR 16657 at commit f9819d5.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@jerryshao
Copy link
Contributor Author

Jenkins, retest this please.

} catch {
case e: Exception =>
logError("Uncaught exception while reverting partial writes to file " + file, e)
file
} finally {
truncateStream.close()
Copy link
Contributor

Choose a reason for hiding this comment

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

Another option is to use Utils.tryWithSafeFinally and do the if block with closeResources in the block with truncate in the finally block

Copy link
Contributor

Choose a reason for hiding this comment

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

You actually can't call close() here without a null check.

I'd also move the file return out of the try/catch block altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry about it. I will fix it.

@SparkQA
Copy link

SparkQA commented Jan 20, 2017

Test build #71716 has finished for PR 16657 at commit f9819d5.

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

Change-Id: I6f88a75cf6467508c77cbfc28c25e4fc7c172373
@SparkQA
Copy link

SparkQA commented Jan 22, 2017

Test build #71800 has started for PR 16657 at commit b0fe795.

@mridulm
Copy link
Contributor

mridulm commented Jan 22, 2017

LGTM, will wait for @vanzin's comments too.

@jerryshao
Copy link
Contributor Author

Jenkins, retest this please.

@SparkQA
Copy link

SparkQA commented Jan 22, 2017

Test build #71801 has finished for PR 16657 at commit b0fe795.

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

@vanzin
Copy link
Contributor

vanzin commented Jan 23, 2017

LGTM. Merging to master / 2.1.

asfgit pushed a commit that referenced this pull request Jan 23, 2017
…pection occurred

## What changes were proposed in this pull request?

In `DiskBlockObjectWriter`, when some errors happened during writing, it will call `revertPartialWritesAndClose`, if this method again failed due to some issues like out of disk, it will throw exception without resetting the state of this writer, also skipping the revert. So here propose to fix this issue to offer user a chance to recover from such issue.

## How was this patch tested?

Existing test.

Author: jerryshao <sshao@hortonworks.com>

Closes #16657 from jerryshao/SPARK-19306.

(cherry picked from commit e497472)
Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com>
@asfgit asfgit closed this in e497472 Jan 23, 2017
uzadude pushed a commit to uzadude/spark that referenced this pull request Jan 27, 2017
…pection occurred

## What changes were proposed in this pull request?

In `DiskBlockObjectWriter`, when some errors happened during writing, it will call `revertPartialWritesAndClose`, if this method again failed due to some issues like out of disk, it will throw exception without resetting the state of this writer, also skipping the revert. So here propose to fix this issue to offer user a chance to recover from such issue.

## How was this patch tested?

Existing test.

Author: jerryshao <sshao@hortonworks.com>

Closes apache#16657 from jerryshao/SPARK-19306.
cmonkey pushed a commit to cmonkey/spark that referenced this pull request Feb 15, 2017
…pection occurred

## What changes were proposed in this pull request?

In `DiskBlockObjectWriter`, when some errors happened during writing, it will call `revertPartialWritesAndClose`, if this method again failed due to some issues like out of disk, it will throw exception without resetting the state of this writer, also skipping the revert. So here propose to fix this issue to offer user a chance to recover from such issue.

## How was this patch tested?

Existing test.

Author: jerryshao <sshao@hortonworks.com>

Closes apache#16657 from jerryshao/SPARK-19306.
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.

4 participants