You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-dev@hadoop.apache.org by "Stamatis Zampetakis (Jira)" <ji...@apache.org> on 2021/11/17 16:02:00 UTC

[jira] [Created] (MAPREDUCE-7368) DBOutputFormat.DBRecordWriter#write must throw exception when it fails

Stamatis Zampetakis created MAPREDUCE-7368:
----------------------------------------------

             Summary: DBOutputFormat.DBRecordWriter#write must throw exception when it fails
                 Key: MAPREDUCE-7368
                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-7368
             Project: Hadoop Map/Reduce
          Issue Type: Bug
    Affects Versions: 3.3.1
            Reporter: Stamatis Zampetakis


When the [DBRecordWriter#write|https://github.com/apache/hadoop/blob/91af256a5b44925e5dfdf333293251a19685ba2a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/db/DBOutputFormat.java#L120] fails with an {{SQLException}} the problem is not propagated but printed in {{System.err}} instead. 

{code:java}
public void write(K key, V value) throws IOException {
      try {
        key.write(statement);
        statement.addBatch();
      } catch (SQLException e) {
        e.printStackTrace();
      }
    }
{code}

The consumer of this API has no way to tell that the write failed. Moreover, the exception is not present in the logs which makes the problem very hard debug and can easily lead to data corruption since clients can easily assume that everything went well.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: mapreduce-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: mapreduce-dev-help@hadoop.apache.org