This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new a6cd3c28a8 [INLONG-8939][Manager] Add a switch to initiate the delete
data source task (#8940)
a6cd3c28a8 is described below
commit a6cd3c28a8e28a109d3188ed09ec5a88c3ea358a
Author: fuweng11 <[email protected]>
AuthorDate: Wed Sep 20 13:02:19 2023 +0800
[INLONG-8939][Manager] Add a switch to initiate the delete data source task
(#8940)
---
.../inlong/manager/service/task/DeleteStreamSourceTask.java | 12 ++++++++----
.../src/main/resources/application-dev.properties | 2 ++
.../src/main/resources/application-prod.properties | 2 ++
.../src/main/resources/application-test.properties | 2 ++
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/task/DeleteStreamSourceTask.java
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/task/DeleteStreamSourceTask.java
index f4def6697f..9d3a83dff9 100644
---
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/task/DeleteStreamSourceTask.java
+++
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/task/DeleteStreamSourceTask.java
@@ -54,6 +54,8 @@ public class DeleteStreamSourceTask extends TimerTask
implements InitializingBea
private static final int INITIAL_DELAY_MINUTES = 5;
private static final int INTERVAL_MINUTES = 60;
+ @Value("${group.deleted.enabled:false}")
+ private Boolean enabled;
@Value("${group.deleted.batchSize:100}")
private Integer batchSize;
@Value("${group.deleted.latest.hours:10}")
@@ -66,11 +68,13 @@ public class DeleteStreamSourceTask extends TimerTask
implements InitializingBea
@Override
public void afterPropertiesSet() {
- ThreadFactory threadFactory = new
ThreadFactoryBuilder().setNameFormat("inlong-group-delete-%s").build();
- ScheduledExecutorService executor = new ScheduledThreadPoolExecutor(1,
threadFactory, new AbortPolicy());
- executor.scheduleWithFixedDelay(this, INITIAL_DELAY_MINUTES,
INTERVAL_MINUTES, TimeUnit.MINUTES);
+ if (enabled) {
+ ThreadFactory threadFactory = new
ThreadFactoryBuilder().setNameFormat("inlong-group-delete-%s").build();
+ ScheduledExecutorService executor = new
ScheduledThreadPoolExecutor(1, threadFactory, new AbortPolicy());
+ executor.scheduleWithFixedDelay(this, INITIAL_DELAY_MINUTES,
INTERVAL_MINUTES, TimeUnit.MINUTES);
- log.info("success to start the delete stream source task");
+ log.info("success to start the delete stream source task");
+ }
}
@Override
diff --git
a/inlong-manager/manager-web/src/main/resources/application-dev.properties
b/inlong-manager/manager-web/src/main/resources/application-dev.properties
index 69d051a771..ff248053a4 100644
--- a/inlong-manager/manager-web/src/main/resources/application-dev.properties
+++ b/inlong-manager/manager-web/src/main/resources/application-dev.properties
@@ -105,3 +105,5 @@ source.cleansing.interval=600
group.deleted.latest.hours=10
# The maximum size when querying InlongGroupIds in batches, those
InlongGroupIds will be used to delete the related StreamSources.
group.deleted.batchSize=100
+# If turned on, the groups could be deleted periodically.
+group.deleted.enabled=false
diff --git
a/inlong-manager/manager-web/src/main/resources/application-prod.properties
b/inlong-manager/manager-web/src/main/resources/application-prod.properties
index 7e99baff71..69122ed272 100644
--- a/inlong-manager/manager-web/src/main/resources/application-prod.properties
+++ b/inlong-manager/manager-web/src/main/resources/application-prod.properties
@@ -104,3 +104,5 @@ source.cleansing.interval=600
group.deleted.latest.hours=10
# The maximum size when querying InlongGroupIds in batches, those
InlongGroupIds will be used to delete the related StreamSources.
group.deleted.batchSize=100
+# If turned on, the groups could be deleted periodically.
+group.deleted.enabled=false
diff --git
a/inlong-manager/manager-web/src/main/resources/application-test.properties
b/inlong-manager/manager-web/src/main/resources/application-test.properties
index 69d051a771..ff248053a4 100644
--- a/inlong-manager/manager-web/src/main/resources/application-test.properties
+++ b/inlong-manager/manager-web/src/main/resources/application-test.properties
@@ -105,3 +105,5 @@ source.cleansing.interval=600
group.deleted.latest.hours=10
# The maximum size when querying InlongGroupIds in batches, those
InlongGroupIds will be used to delete the related StreamSources.
group.deleted.batchSize=100
+# If turned on, the groups could be deleted periodically.
+group.deleted.enabled=false