qiong-zhou commented on code in PR #18275:
URL: 
https://github.com/apache/dolphinscheduler/pull/18275#discussion_r3278442675


##########
dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/mapper/JdbcRegistryClientHeartbeatMapper.java:
##########
@@ -30,4 +31,10 @@ public interface JdbcRegistryClientHeartbeatMapper extends 
BaseMapper<JdbcRegist
     @Select("select * from t_ds_jdbc_registry_client_heartbeat")
     List<JdbcRegistryClientHeartbeat> selectAll();
 
+    @Insert("INSERT INTO t_ds_jdbc_registry_client_heartbeat(id, client_name, 
last_heartbeat_time, connection_config, create_time) "
+            +
+            "VALUES(#{id}, #{clientName}, #{lastHeartbeatTime}, 
#{connectionConfig}, NOW()) " +
+            "ON DUPLICATE KEY UPDATE " +
+            "last_heartbeat_time = #{lastHeartbeatTime}")

Review Comment:
   > Only mysql supports this syntax, and other databases do not.
   
   I will change the implementation to 
   trying update first, if the update effected row equals 0 then insert instead.
   
   This implementation will be compatible with various databases. And 99% of 
the time the client will 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]

Reply via email to