-
Notifications
You must be signed in to change notification settings - Fork 1.5k
GH-3350: Avoid flushing data to cloud when exception is thrown #3351
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
Changes from 3 commits
a51bcae
52a7a41
d4b1efa
f233318
897f96a
3a8e343
fa193d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,8 +140,9 @@ public void close() throws IOException, InterruptedException { | |
| } | ||
| finalMetadata.putAll(finalWriteContext.getExtraMetaData()); | ||
| parquetFileWriter.end(finalMetadata); | ||
| AutoCloseables.uncheckedClose(parquetFileWriter); | ||
| } finally { | ||
| AutoCloseables.uncheckedClose(columnStore, pageStore, bloomFilterWriteStore, parquetFileWriter); | ||
| AutoCloseables.uncheckedClose(columnStore, pageStore, bloomFilterWriteStore); | ||
|
||
| closed = true; | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,7 +113,7 @@ public class ParquetFileWriter implements AutoCloseable { | |
| public static final byte[] EFMAGIC = EF_MAGIC_STR.getBytes(StandardCharsets.US_ASCII); | ||
| public static final String PARQUET_COMMON_METADATA_FILE = "_common_metadata"; | ||
| public static final int CURRENT_VERSION = 1; | ||
|
|
||
| // File creation modes | ||
| public static enum Mode { | ||
| CREATE, | ||
|
|
@@ -173,6 +173,7 @@ public static enum Mode { | |
|
|
||
| // set when end is called | ||
| private ParquetMetadata footer = null; | ||
| private boolean aborted; | ||
| private boolean closed; | ||
|
|
||
| private final CRC32 crc; | ||
|
|
@@ -1812,6 +1813,8 @@ public void end(Map<String, String> extraMetaData) throws IOException { | |
| LOG.debug("{}: end", out.getPos()); | ||
| this.footer = new ParquetMetadata(new FileMetaData(schema, extraMetaData, Version.FULL_VERSION), blocks); | ||
| serializeFooter(footer, out, fileEncryptor, metadataConverter); | ||
| } catch (Exception e) { | ||
| aborted = true; | ||
|
||
| } finally { | ||
| close(); | ||
| } | ||
|
|
@@ -1823,7 +1826,7 @@ public void close() throws IOException { | |
| return; | ||
| } | ||
| try (PositionOutputStream temp = out) { | ||
| temp.flush(); | ||
| if (!aborted) temp.flush(); | ||
| if (crcAllocator != null) { | ||
| crcAllocator.close(); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.