Skip to content

Commit

Permalink
[INLONG-6352][Manager] Add a global config for whether to use ZooKeep…
Browse files Browse the repository at this point in the history
…er to manage the Sort task (#6354)
  • Loading branch information
fuweng11 committed Nov 1, 2022
1 parent 3973ed9 commit ad2ecb4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
Expand Down Expand Up @@ -91,6 +92,9 @@ public class InlongGroupServiceImpl implements InlongGroupService {

private static final Logger LOGGER = LoggerFactory.getLogger(InlongGroupServiceImpl.class);

@Value("${sort.enable.zookeeper:false}")
private boolean enableZookeeper;

@Autowired
private InlongGroupEntityMapper groupMapper;
@Autowired
Expand Down Expand Up @@ -154,7 +158,7 @@ public String save(InlongGroupRequest request, String operator) {
LOGGER.error("groupId {} has already exists", groupId);
throw new BusinessException(ErrorCodeEnum.GROUP_DUPLICATE);
}

request.setEnableZookeeper(enableZookeeper ? InlongConstants.ENABLE_ZK : InlongConstants.DISABLE_ZK);
InlongGroupOperator instance = groupOperatorFactory.getInstance(request.getMqType());
groupId = instance.saveOpt(request, operator);

Expand Down Expand Up @@ -246,6 +250,7 @@ public String update(InlongGroupRequest request, String operator) {
// check whether the current status can be modified
checkGroupCanUpdate(entity, request, operator);

request.setEnableZookeeper(enableZookeeper ? InlongConstants.ENABLE_ZK : InlongConstants.DISABLE_ZK);
InlongGroupOperator instance = groupOperatorFactory.getInstance(request.getMqType());
instance.updateOpt(request, operator);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ data.cleansing.interval.seconds=1800
data.cleansing.before.days=10
# The maximum size of data to be deleted in batch, default is 100
data.cleansing.batchSize=100

# Whether to use ZooKeeper to manage the Sort task config, default is false, which means not using ZooKeeper
sort.enable.zookeeper=false
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ data.cleansing.interval.seconds=1800
data.cleansing.before.days=10
# The maximum size of data to be deleted in batch, default is 100
data.cleansing.batchSize=100

# Whether to use ZooKeeper to manage the Sort task config, default is false, which means not using ZooKeeper
sort.enable.zookeeper=false
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ data.cleansing.interval.seconds=1800
data.cleansing.before.days=10
# The maximum size of data to be deleted in batch, default is 100
data.cleansing.batchSize=100

# Whether to use ZooKeeper to manage the Sort task config, default is false, which means not using ZooKeeper
sort.enable.zookeeper=false

0 comments on commit ad2ecb4

Please sign in to comment.