umustafi commented on code in PR #3721:
URL: https://github.com/apache/gobblin/pull/3721#discussion_r1271149926


##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/MysqlMultiActiveLeaseArbiter.java:
##########
@@ -122,7 +122,8 @@ protected interface CheckedFunction<T, R> {
   // Need to define three separate statements to handle cases where row does 
not exist or has null values to check
   protected static final String 
CONDITIONALLY_ACQUIRE_LEASE_IF_NEW_ROW_STATEMENT = "INSERT INTO %s (flow_group, 
"
       + "flow_name, flow_execution_id, flow_action, event_timestamp, 
lease_acquisition_timestamp) "
-      + "VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)";
+      + "SELECT ?, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP WHERE NOT 
EXISTS (SELECT * FROM %s "
+      + WHERE_CLAUSE_TO_MATCH_KEY + ")";

Review Comment:
   I am not sure if our DB settings for MySQL will throw an error if insert 
fails or UPSERT by default or ignore the insert if PK already exists so i 
wanted to use a statement that I can predict the behavior from



-- 
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]

Reply via email to