mychaow commented on a change in pull request #3191:
URL: https://github.com/apache/iotdb/pull/3191#discussion_r646238962
##########
File path:
cluster/src/main/java/org/apache/iotdb/cluster/log/applier/MetaLogApplier.java
##########
@@ -48,22 +47,44 @@ public void apply(Log log) {
try {
logger.debug("MetaMember [{}] starts applying Log {}",
metaGroupMember.getName(), log);
if (log instanceof AddNodeLog) {
- AddNodeLog addNodeLog = (AddNodeLog) log;
- Node newNode = addNodeLog.getNewNode();
- member.applyAddNode(newNode);
+ applyAddNodeLog((AddNodeLog) log);
} else if (log instanceof PhysicalPlanLog) {
applyPhysicalPlan(((PhysicalPlanLog) log).getPlan(), null);
} else if (log instanceof RemoveNodeLog) {
- RemoveNodeLog removeNodeLog = ((RemoveNodeLog) log);
- member.applyRemoveNode(removeNodeLog.getRemovedNode());
+ applyRemoveNodeLog((RemoveNodeLog) log);
+ } else if (log instanceof EmptyContentLog) {
+ // Do nothing
} else {
logger.error("Unsupported log: {} {}", log.getClass().getName(), log);
}
- } catch (StorageEngineException | StorageGroupNotSetException |
QueryProcessException e) {
+ } catch (Exception e) {
logger.debug("Exception occurred when executing {}", log, e);
log.setException(e);
} finally {
log.setApplied(true);
}
}
+
+ private void applyAddNodeLog(AddNodeLog log) throws
ChangeMembershipException {
+ if
(!metaGroupMember.getPartitionTable().deserialize(log.getPartitionTable())) {
+ logger.info("Ignore previous change membership log");
+ // ignore previous change membership log
+ return;
+ }
+ if (metaGroupMember.getCharacter() == NodeCharacter.LEADER) {
+ metaGroupMember.sendLogToAllDataGroups(log);
+ }
+ member.applyAddNode(log);
Review comment:
If a slot is owned by B datagroup, it will be moved to a datagroup in
the new partition table. If a datagroup performs this step first, it will start
a new datagroupmember to receive new writes. However, B datagroup still has a
follower that has not been implemented to this step. If a write request is sent
to it, it will route to the leader of the raft group, and the leader will
execute it directly. When a datagroup pulls a slot later, it may lose some data?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]