flowers-59f commented on PR #12105:
URL: https://github.com/apache/inlong/pull/12105#issuecomment-4096235068

   > > > The status check is essential and cannot be removed, as the deletion 
process involves asynchronous operations that interact with the Agent and sort. 
If the deletion command is executed repeatedly during this process, due to 
asynchronous operations, the Agent or sort task may make incorrect judgments. 
For instance, if a deletion is performed immediately after the Agent has just 
been issued a collection task, the requests received by the Agent may originate 
from different managers, temporarily causing data inconsistency. At this time, 
the order in which the Agent receives task deletion or addition commands may be 
inconsistent, leading to task anomalies.
   > > 
   > > 
   > > Then, when executing these deletion functions, can we check the current 
status and skip the status validation if it's already 
"GroupStatus.CONFIG_DELETING"? Or is there a better solution?
   > 
   > Given that the following code is only referenced by group.delete, you can 
add "GroupStatus.CONFIG_DELETING" to this status check, or it is better to 
modify the group status to "GroupStatus.CONFIG_DELETED" before performing this 
status check `if 
(GroupStatus.allowedDeleteSubInfos(GroupStatus.forCode(entity.getStatus()))) { 
streamService.logicDeleteAll(groupId, operator); }`
   
   I think it would be a good approach to change the status of the group to 
"GroupStatus.CONFIG_DELETED" in advance. Issues caused by the status check 
during streamService.logicDeleteAll(...) will also be resolved. But which of 
the following two positions is better for updating this status?
   UpdateGroupCompleteListener.listen(...)
   ```java
   case DELETE:  
       // delete process completed, then delete the group info  
       // first position
       groupService.delete(groupId, operator);  
       break;
   ```
   Because there are no transactions, if the status is changed in the first 
position, problems may arise if an exception occurs during the subsequent 
execution process.
   
   InlongGroupServiceImpl.delete(...)
   ```java
   // second position
   // before deleting an inlong group, delete all inlong streams, sources, 
sinks, and other info under it  
   if 
(GroupStatus.allowedDeleteSubInfos(GroupStatus.forCode(entity.getStatus()))) {  
       streamService.logicDeleteAll(groupId, operator);  
   }
   ```
   I think it would be better to make the group status change at the second 
position. However, in this case, the subsequent judgment would lose its 
significance.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to