You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/10/13 07:50:57 UTC

[GitHub] [inlong] woofyzhao opened a new pull request, #6168: [Manager][INLONG-6151] Add optional data cleansing to control storage size

woofyzhao opened a new pull request, #6168:
URL: https://github.com/apache/inlong/pull/6168

   
   - Fixes #6151
   
   ### Motivation
   
   By default inlong manager only performs logical delete.
   In cases where there are huge amount of offline period tasks it may be required to clean logically deleted group data to reduce storage size. This pr provides an optional periodic task to do the data purging so that external scripts and configuration deployment work could be saved hopefully. 
   


-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #6168: [INLONG-6151][Manager] Add optional data cleansing task to control storage size, optimize query indexes

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6168:
URL: https://github.com/apache/inlong/pull/6168#discussion_r997644841


##########
inlong-manager/manager-web/sql/apache_inlong_manager.sql:
##########
@@ -338,7 +344,7 @@ CREATE TABLE IF NOT EXISTS `inlong_stream_field`
     `rank_num`            smallint(6)  DEFAULT '0' COMMENT 'Field order (front-end display field order)',
     `is_deleted`          int(11)      DEFAULT '0' COMMENT 'Whether to delete, 0: not deleted, > 0: deleted',
     PRIMARY KEY (`id`),
-    KEY `field_stream_id_index` (`inlong_stream_id`)
+    KEY `group_field_index` (`inlong_group_id`, `inlong_stream_id`)

Review Comment:
   Suggest changing the `KEY` to `INDEX`, because some DBMS will not add an index for KEY.



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow merged pull request #6168: [INLONG-6151][Manager] Add data cleansing task and optimize query indexes

Posted by GitBox <gi...@apache.org>.
healchow merged PR #6168:
URL: https://github.com/apache/inlong/pull/6168


-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #6168: [INLONG-6151][Manager] Add optional data cleansing task to control storage size, optimize query indexes

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6168:
URL: https://github.com/apache/inlong/pull/6168#discussion_r997646215


##########
inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongGroupEntityMapper.java:
##########
@@ -53,6 +54,14 @@ public interface InlongGroupEntityMapper {
      */
     List<SortSourceGroupInfo> selectAllGroups();
 
+    /**
+     * Select all groups which are logical deleted before some last modify time
+     * @param lastModifyTime
+     * @return
+     */
+    List<String> selectLogicalDeletedGroupIds(@Param("lastModifyTime") Date lastModifyTime,

Review Comment:
   -> `selectDeletedGroupIds`



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #6168: [INLONG-6151][Manager] Add optional data cleansing task to control storage size, optimize query indexes

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6168:
URL: https://github.com/apache/inlong/pull/6168#discussion_r997646073


##########
inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongGroupEntityMapper.java:
##########
@@ -53,6 +54,14 @@ public interface InlongGroupEntityMapper {
      */
     List<SortSourceGroupInfo> selectAllGroups();
 
+    /**
+     * Select all groups which are logical deleted before some last modify time
+     * @param lastModifyTime

Review Comment:
   Add more info for `@param` and `@return`.



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] woofyzhao commented on a diff in pull request #6168: [INLONG-6151][Manager] Add data cleansing task and optimize query indexes

Posted by GitBox <gi...@apache.org>.
woofyzhao commented on code in PR #6168:
URL: https://github.com/apache/inlong/pull/6168#discussion_r999029700


##########
inlong-manager/manager-dao/src/main/resources/mappers/InlongGroupEntityMapper.xml:
##########
@@ -211,9 +211,8 @@
     <select id="selectDeletedGroupIds" resultType="java.lang.String">
         select inlong_group_id
         from inlong_group
-        where modify_time &lt;= #{lastModifyTime,jdbcType=TIMESTAMP}
-        group by inlong_group_id
-        having min(is_deleted) > 0
+        where is_deleted > 0

Review Comment:
   It could be possible that there are two groups of the same inlong_group_id and one of them is deleted but the other one is not, in which case the non-deleted one will also be selected and incorrectly cleansed.



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #6168: [INLONG-6151][Manager] Add optional data cleansing task to control storage size, optimize query indexes

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6168:
URL: https://github.com/apache/inlong/pull/6168#discussion_r997645764


##########
inlong-manager/manager-web/src/main/resources/application.properties:
##########
@@ -64,3 +64,11 @@ openapi.auth.enabled=false
 # audit view by role, see audit id definitions: https://inlong.apache.org/docs/modules/audit/overview#audit-id
 audit.admin.ids=3,4,5,6,7,8
 audit.user.ids=3,4,5,6,7,8
+
+# data cleansing
+# if turned on, logically deleted group data will be collected and permanently deleted periodically
+group.purge.enabled=false

Review Comment:
   This deletion operation is not limited to the inlong group, but also inlong stream, source, sink, etc.
   
   Therefore, the names of the config params should be common.



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #6168: [INLONG-6151][Manager] Add optional data cleansing task to control storage size, optimize query indexes

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6168:
URL: https://github.com/apache/inlong/pull/6168#discussion_r997649306


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/timertask/GroupPurgeTask.java:
##########
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.service.timertask;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.inlong.manager.dao.mapper.InlongGroupEntityMapper;
+import org.apache.inlong.manager.dao.mapper.InlongGroupExtEntityMapper;
+import org.apache.inlong.manager.dao.mapper.InlongStreamEntityMapper;
+import org.apache.inlong.manager.dao.mapper.InlongStreamExtEntityMapper;
+import org.apache.inlong.manager.dao.mapper.InlongStreamFieldEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamSinkEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamSinkFieldEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamSourceEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamSourceFieldEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamTransformEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamTransformFieldEntityMapper;
+import org.apache.inlong.manager.dao.mapper.WorkflowEventLogEntityMapper;
+import org.apache.inlong.manager.dao.mapper.WorkflowProcessEntityMapper;
+import org.apache.inlong.manager.dao.mapper.WorkflowTaskEntityMapper;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+import java.util.TimerTask;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+@Slf4j
+@Service
+public class GroupPurgeTask extends TimerTask implements InitializingBean {

Review Comment:
   Maybe `DataCleansingTask` is more readable.



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #6168: [INLONG-6151][Manager] Add optional data cleansing task to control storage size, optimize query indexes

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6168:
URL: https://github.com/apache/inlong/pull/6168#discussion_r997649590


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/timertask/GroupPurgeTask.java:
##########
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.manager.service.timertask;

Review Comment:
   Suggest changing `timertask` to `task`, then we can add other tasks into this package.



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #6168: [INLONG-6151][Manager] Add data cleansing task and optimize query indexes

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6168:
URL: https://github.com/apache/inlong/pull/6168#discussion_r999034835


##########
inlong-manager/manager-dao/src/main/resources/mappers/InlongGroupEntityMapper.xml:
##########
@@ -211,9 +211,8 @@
     <select id="selectDeletedGroupIds" resultType="java.lang.String">
         select inlong_group_id
         from inlong_group
-        where modify_time &lt;= #{lastModifyTime,jdbcType=TIMESTAMP}
-        group by inlong_group_id
-        having min(is_deleted) > 0
+        where is_deleted > 0

Review Comment:
   Oh, I didn't think this case. I will add it back.



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org