Skip to content

Commit

Permalink
MAPREDUCE-7368. DBOutputFormat.DBRecordWriter#write must throw except…
Browse files Browse the repository at this point in the history
…ion when it fails

When the exception is caught and printed (instead of propagated) the consumer has no
way to tell write failed. This hides the failure and leads to problems which are
difficult to debug and at the same time can cause data corruption.
  • Loading branch information
zabetak committed Nov 17, 2021
1 parent 91af256 commit 4ad4bbe
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void write(K key, V value) throws IOException {
key.write(statement);
statement.addBatch();
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException("Failed to execute SQL statement for key " + key, e);
}
}
}
Expand Down

0 comments on commit 4ad4bbe

Please sign in to comment.