Skip to content

Commit

Permalink
Handle buffered dwrf write exception to avoid server crash
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxmeng committed May 13, 2024
1 parent 49c3ebb commit 04d5bf2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions velox/dwio/dwrf/writer/DictionaryEncodingUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class DictionaryEncodingUtils {
uint32_t newIndex = 0;
auto dictLengthWriter =
createBufferedWriter<uint32_t>(pool, 64 * 1024, lengthFn);
auto errorGuard =
folly::makeGuard([&dictLengthWriter]() { dictLengthWriter.abort(); });
for (uint32_t i = 0; i != numKeys; ++i) {
auto origIndex = (sort ? sortedIndex[i] : i);
if (!dropInfrequentKeys || shouldWriteKey(dictEncoder, origIndex)) {
Expand Down
1 change: 1 addition & 0 deletions velox/dwio/dwrf/writer/IntegerDictionaryEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class IntegerDictionaryEncoder : public AbstractIntegerDictionaryEncoder {
uint32_t newIndex = 0;

auto dictWriter = createBufferedWriter<Integer>(writeBuffer, fn);
auto errorGuard = folly::makeGuard([&dictWriter]() { dictWriter.abort(); });
for (uint32_t i = 0; i != numKeys; ++i) {
auto origIndex = (sort ? sortedIndex[i] : i);
if (!dropInfrequentKeys || shouldWriteKey(dictEncoder, origIndex)) {
Expand Down

0 comments on commit 04d5bf2

Please sign in to comment.