This is an automated email from the ASF dual-hosted git repository.

aloyszhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new af77a17  [INLONG-2944][Manager] Should not change the modify_time when 
updating the source snapshot (#2949)
af77a17 is described below

commit af77a17f72f55c3ce07ab6172df5302457d9df45
Author: healchow <[email protected]>
AuthorDate: Sun Mar 6 20:20:08 2022 +0800

    [INLONG-2944][Manager] Should not change the modify_time when updating the 
source snapshot (#2949)
---
 .../manager/dao/mapper/StreamSourceEntityMapper.java |  2 +-
 .../resources/mappers/StreamSourceEntityMapper.xml   | 20 +++++++++++++-------
 .../web/controller/openapi/AgentController.java      |  2 +-
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git 
a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/StreamSourceEntityMapper.java
 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/StreamSourceEntityMapper.java
index a3cd507..f1a9797 100644
--- 
a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/StreamSourceEntityMapper.java
+++ 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/StreamSourceEntityMapper.java
@@ -71,7 +71,7 @@ public interface StreamSourceEntityMapper {
             @Param("sourceType") String sourceType);
 
     /**
-     * Query the source list by the given agent ip and agent uuid.
+     * Query the sources with status 20x by the given agent IP and agent UUID.
      */
     List<StreamSourceEntity> selectByIpAndUuid(@Param("agentIp") String 
agentIp, @Param("uuid") String uuid);
 
diff --git 
a/inlong-manager/manager-dao/src/main/resources/mappers/StreamSourceEntityMapper.xml
 
b/inlong-manager/manager-dao/src/main/resources/mappers/StreamSourceEntityMapper.xml
index 2cd81b9..c8909f7 100644
--- 
a/inlong-manager/manager-dao/src/main/resources/mappers/StreamSourceEntityMapper.xml
+++ 
b/inlong-manager/manager-dao/src/main/resources/mappers/StreamSourceEntityMapper.xml
@@ -283,6 +283,7 @@
         from stream_source
         <where>
             is_deleted = 0
+            and status >= 200 and status &lt; 300
             and agent_ip = #{agentIp, jdbcType=VARCHAR}
             <if test="uuid != null and uuid != ''">
                 and uuid = #{uuid, jdbcType=VARCHAR}
@@ -401,22 +402,27 @@
     <update id="updateStatus">
         update stream_source
         set previous_status = status,
-            status          = #{nextStatus, jdbcType=INTEGER}
+            status          = #{nextStatus, jdbcType=INTEGER},
+            modify_time     = modify_time
         where id = #{id, jdbcType=INTEGER}
     </update>
     <update id="updateStatusByRelatedId">
         update stream_source
         set previous_status = status,
-        status = #{nextStatus, jdbcType=INTEGER}
-        where inlong_group_id = #{groupId, jdbcType=VARCHAR}
-        <if test="streamId != null">
-            and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
-        </if>
+        status = #{nextStatus, jdbcType=INTEGER},
+        modify_time = modify_time
+        <where>
+            inlong_group_id = #{groupId, jdbcType=VARCHAR}
+            <if test="streamId != null">
+                and inlong_stream_id = #{streamId, jdbcType=VARCHAR}
+            </if>
+        </where>
     </update>
     <update id="updateSnapshot" 
parameterType="org.apache.inlong.manager.dao.entity.StreamSourceEntity">
         update stream_source
         set snapshot    = #{snapshot,jdbcType=LONGVARCHAR},
-            report_time = #{reportTime,jdbcType=TIMESTAMP}
+            report_time = #{reportTime,jdbcType=TIMESTAMP},
+            modify_time = modify_time
         where id = #{id,jdbcType=INTEGER}
     </update>
 
diff --git 
a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/AgentController.java
 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/AgentController.java
index f619713..3599da6 100644
--- 
a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/AgentController.java
+++ 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/AgentController.java
@@ -66,7 +66,7 @@ public class AgentController {
 
     @PostMapping("/reportSnapshot")
     @ApiOperation(value = "Report source task snapshot")
-    public Response<Boolean> reportSnapshot(TaskSnapshotRequest request) {
+    public Response<Boolean> reportSnapshot(@RequestBody TaskSnapshotRequest 
request) {
         return Response.success(agentService.reportSnapshot(request));
     }
 

Reply via email to