phet commented on code in PR #3715:
URL: https://github.com/apache/gobblin/pull/3715#discussion_r1266033992
##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/MysqlMultiActiveLeaseArbiter.java:
##########
@@ -100,8 +100,9 @@ protected interface CheckedFunction<T, R> {
+ "PRIMARY KEY (flow_group,flow_name,flow_execution_id,flow_action))";
private static final String CREATE_CONSTANTS_TABLE_STATEMENT = "CREATE TABLE
IF NOT EXISTS %s "
+ "(epsilon INT, linger INT, PRIMARY KEY (epsilon, linger))";
- private static final String GET_ROW_COUNT_STATEMENT = "SELECT COUNT(*) FROM
%s";
- private static final String INSERT_IN_CONSTANTS_TABLE_STATEMENT = "INSERT
INTO %s (epsilon, linger) VALUES (?,?)";
+ // Only insert epsilon and linger values from config if this table does not
contain a pre-existing values already.
+ private static final String INSERT_IN_CONSTANTS_TABLE_STATEMENT = "INSERT
INTO %s (epsilon, linger) SELECT ?, ? "
+ + "WHERE NOT EXISTS (SELECT 1 FROM %s)";
Review Comment:
don't we need to overwrite in case the pre-existing values are out-of-date?
that's why I suggested `INSERT INTO... ON DUPLICATE KEY UPDATE`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]