beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré (JIRA) <>
Subject [jira] [Created] (BEAM-793) JdbcIO can create a deadlock when parallelism is greater than 1
Date Fri, 21 Oct 2016 04:23:58 GMT
Jean-Baptiste Onofré created BEAM-793:

             Summary: JdbcIO can create a deadlock when parallelism is greater than 1
                 Key: BEAM-793
             Project: Beam
          Issue Type: Bug
          Components: sdk-java-extensions
            Reporter: Jean-Baptiste Onofré
            Assignee: Jean-Baptiste Onofré

With the following JdbcIO configuration, if the parallelism is greater than 1, we can have
a {{Deadlock found when trying to get lock; try restarting transaction}}.

        MysqlDataSource dbCfg = new MysqlDataSource();

                .apply(JdbcIO.<Tuple5<Integer, Integer, ByteString, Long, Long>>write()
                        .withStatement("INSERT INTO smth(loc,event_type,hash,begin_date,end_date)
VALUES(?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE event_type=VALUES(event_type),end_date=VALUES(end_date)")
                        .withPreparedStatementSetter(new JdbcIO.PreparedStatementSetter<Tuple5<Integer,
Integer, ByteString, Long, Long>>() {
                            public void setParameters(Tuple5<Integer, Integer, ByteString,
Long, Long> element, PreparedStatement statement)
                                    throws Exception {
                                statement.setInt(1, element.f0);
                                statement.setInt(2, element.f1);
                                statement.setBytes(3, element.f2.toByteArray());
                                statement.setLong(4, element.f3);
                                statement.setLong(5, element.f4);

This can happen due to the {{autocommit}}. I'm going to investigate.

This message was sent by Atlassian JIRA

View raw message