Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INLONG-5219][Manager] Adjust the status update order of inlong group #5221

Merged
merged 4 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,13 @@
ext_params = #{extParams,jdbcType=LONGVARCHAR},
in_charges = #{inCharges,jdbcType=VARCHAR},
followers = #{followers,jdbcType=VARCHAR},
previous_status = status,
status = #{status,jdbcType=INTEGER},
previous_status = #{previous_status,jdbcType=INTEGER},
is_deleted = #{isDeleted,jdbcType=INTEGER},
creator = #{creator,jdbcType=VARCHAR},
modifier = #{modifier,jdbcType=VARCHAR},
version = #{version,jdbcType=INTEGER} + 1
where id = #{id,jdbcType=INTEGER}
and version = #{version,jdbcType=INTEGER}
and version = #{version,jdbcType=INTEGER}
</update>
<update id="updateByIdentifierSelective" parameterType="org.apache.inlong.manager.dao.entity.InlongGroupEntity">
update inlong_group
Expand Down Expand Up @@ -271,17 +270,14 @@
followers = #{followers,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
previous_status = status,
</if>
<if test="previousStatus != null">
previous_status = #{previousStatus,jdbcType=INTEGER},
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted,jdbcType=INTEGER},
</if>
<if test="creator != null">
creator = #{creator,jdbcType=VARCHAR},
</if>
<if test="modifier != null">
modifier = #{modifier,jdbcType=VARCHAR},
</if>
Expand All @@ -307,11 +303,11 @@
</delete>

<select id="selectAllGroups" resultType="org.apache.inlong.manager.common.pojo.sortstandalone.SortSourceGroupInfo">
select inlong_group_id as groupId,
select inlong_group_id as groupId,
inlong_cluster_tag as clusterTag,
mq_resource as topic,
ext_params as extParams,
mq_type as mqType
mq_resource as topic,
ext_params as extParams,
mq_type as mqType
from inlong_group
where is_deleted = 0
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
update stream_sink
set status = #{status,jdbcType=INTEGER},
previous_status = status,
operate_log = #{operateLog,jdbcType=VARCHAR},
operate_log = #{operateLog,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectAllTasks" resultType="org.apache.inlong.manager.common.pojo.sortstandalone.SortTaskInfo">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,7 @@ public Boolean bindTag(BindTagRequest request, String operator) {
Set<String> tagSet = Sets.newHashSet(entity.getClusterTags().split(InlongConstants.COMMA));
tagSet.add(clusterTag);
String updateTags = Joiner.on(",").join(tagSet);
InlongClusterEntity updateEntity = new InlongClusterEntity();
updateEntity.setId(id);
InlongClusterEntity updateEntity = clusterMapper.selectById(id);
updateEntity.setClusterTags(updateTags);
updateEntity.setModifier(operator);
int rowCount = clusterMapper.updateByIdSelective(updateEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,20 +372,20 @@ public void updateAfterApprove(InlongGroupApproveRequest approveRequest, String
throw new WorkflowListenerException("inlong group status is [wait_approval], not allowed to approve again");
}

// update status to [GROUP_APPROVE_PASSED]
this.updateStatus(groupId, GroupStatus.APPROVE_PASSED.getCode(), operator);

// update other info for inlong group after approve
// bind cluster tag and update status to [GROUP_APPROVE_PASSED]
if (StringUtils.isNotBlank(approveRequest.getInlongClusterTag())) {
entity.setInlongGroupId(approveRequest.getInlongGroupId());
entity.setInlongGroupId(groupId);
entity.setInlongClusterTag(approveRequest.getInlongClusterTag());
entity.setStatus(GroupStatus.APPROVE_PASSED.getCode());
entity.setModifier(operator);
int rowCount = groupMapper.updateByIdentifierSelective(entity);
if (rowCount != InlongConstants.AFFECTED_ONE_ROW) {
LOGGER.error("inlong group has already updated with group id={}, curVersion={}",
entity.getInlongGroupId(), entity.getVersion());
groupId, entity.getVersion());
throw new BusinessException(ErrorCodeEnum.CONFIG_EXPIRED);
}
} else {
this.updateStatus(groupId, GroupStatus.APPROVE_PASSED.getCode(), operator);
}

LOGGER.info("success to update inlong group status after approve for groupId={}", groupId);
Expand Down