Skip to content

PARQUET-246: File recovery and work-arounds - #235

Closed
rdblue wants to merge 5 commits into
apache:masterfrom
rdblue:PARQUET-246-recover-files
Closed

rdblue wants to merge 5 commits into
apache:masterfrom
rdblue:PARQUET-246-recover-files

Conversation

@rdblue

@rdblue rdblue commented Jul 3, 2015

Copy link
Copy Markdown
Contributor

This is another way to recover data written with the delta byte array problem in PARQUET-246. This builds on @isnotinvain's strategy for solving the problem by adding a method to the encoding to detect it. This version is more similar to the fix for PARQUET-251 and includes a CorruptDeltaByteArrays helper class that uses the writer version. Most of the file changes are to get the file writer version to Encoding and the ColumnReaderImpl.

This also repairs the problem by using a new interface, RequiresPreviousReader, to pass the previous ValuesReader, which is slightly cleaner because the reader doesn't need to expose getter and setter methods.

The problem affects pages written to different row groups, so it was necessary to detect the problem in parquet-hadoop and fail jobs that cannot reconstruct data. The work-around to recover is to set "parquet.split.files" to false so that files are read sequentially. This could be set automatically in isSplittable, but this would require reading all file footers before submitting jobs, which was recently fixed. I think it is a fair compromise to detect the error case and recommend a solution.

This also includes tests for the problem to verify the fix.

Replaces old pull requests: closes #217 closes #235

@rdblue

rdblue commented Jul 3, 2015

Copy link
Copy Markdown
Contributor Author

@tsdeng and @spena, could you review?

@rdblue
rdblue force-pushed the PARQUET-246-recover-files branch 2 times, most recently from e2b3cf7 to 47e03ef Compare July 3, 2015 17:46

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure if this interface/generalization is actually needed.
The actual problem is the DeltaByteArrayReader needs to reset the 'previous' member to fix the bug.
It needs the previous char array, the previous value, not the previous reader. This interface gives an impression the subclass could hold a reference of the previous reader.

How about:
remove this interface,
create a setPreviousValue method in DeltaByteArrayReader.
and call:
setPreviousValue(deltaByteArrayReader.previous)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Previous is internal state. This method avoids exposing that state to others, allowing access to all private members in the recipient ValuesReader.

rdblue added 4 commits July 8, 2015 15:00
To avoid parsing with more frequent checks, this adds a
hasSemanticVersion and getSemanticVersion methods to the parsed version.
Using this API, callers can cache the version object for a given
createdBy string and use it in multiple checks.
This adds RequriresPreviousReader, which allows ValuesReader
imlementations to use the previous reader for initialization. By
delegating to the reader implementation, this doesn't need to add getter
and setter methods to DeltaByteArrayReader.

This also adds a method to Encoding, requiresSequentialReads(version).
This allows the Encoding to determine whether pages can be skipped for a
given writer verison. This is used by ColumnReaderImpl to detect when to
call RequiresPreviousReader#setPreviousReader.

The logic to determine whether the delta byte array bug is present is in
CorruptDeltaByteArrays, which is based on CorruptStatistics. This class
is part of the public API.

The remaining changes pass the created-by string through the read path
to the ColumnReaderImpl.
This adds tests for the previous commit's delta byte array fix. It
verifies that it reproduces the failure condition and that it can
correctly read pages when they are managed by the ColumnReaderImpl.
This adds an option to turn off file splitting because the delta byte
array corruption problem spans row groups. The only way to correctly
read data is to read the file from beginning to end.

This catches the problem in ParquetRecordReader when the file footer is
available and throws an exception to stop the job. Catching the problem
in ParquetInputFormat#getSplits would prevent jobs from failing, but
would dramatically slow down all job submission. This also adds a check
in the ColumnReaderImpl that points users at PARQUET-246 when the
failure occurs.
@rdblue
rdblue force-pushed the PARQUET-246-recover-files branch 2 times, most recently from bceb5c9 to 4368207 Compare July 8, 2015 22:56
@rdblue
rdblue force-pushed the PARQUET-246-recover-files branch from 4368207 to 067d5ca Compare July 8, 2015 22:57
@tsdeng

tsdeng commented Jul 8, 2015

Copy link
Copy Markdown
Contributor

+1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @rdblue I'm trying to upgrade scalding to parquet 1.8.0 and I'm seeing an java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 here in a test that runs on a local mini-cluster.

Is it a valid assumption that this list always has a 0th element? In the case of task-side filtering, it is possible for a task to discover that there are 0 matching row groups right? I think this is a bug, but I want to make sure I'm not just missing something.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

easy fix:
#242

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.

3 participants