Skip to content
Merged
3 changes: 2 additions & 1 deletion .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ github:
del_branch_on_merge: true
#labels:
enabled_merge_buttons:
merge: false
# TODO: disable it after common merged
merge: true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems we don't need to change in this commit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems we don't need to change in this commit

Since another PR is blocked now

rebase: true
squash: true
protected_branches:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static class RaftOptions {
/**
* The maximum number of entries in AppendEntriesRequest
*/
private final int maxEntriesSize = 256;
private int maxEntriesSize = 256;
/**
* Raft cluster data backlog occurs, rate limiting wait time in milliseconds.
**/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ public class Raft {
private int maxSegmentFileSize;
@Value("${raft.maxReplicatorInflightMsgs:256}")
private int maxReplicatorInflightMsgs;
@Value("${raft.maxEntriesSize:256}")
private int maxEntriesSize;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public void init() {
.isUseRocksDBSegmentLogStorage());
setMaxSegmentFileSize(appConfig.getRaft().getMaxSegmentFileSize());
setMaxReplicatorInflightMsgs(appConfig.getRaft().getMaxReplicatorInflightMsgs());
setMaxEntriesSize(appConfig.getRaft().getMaxEntriesSize());
}});
setFakePdOptions(new FakePdOptions() {{
setStoreList(appConfig.getFakePdConfig().getStoreList());
Expand All @@ -125,9 +126,9 @@ public List<Integer> getGraphLeaderPartitionIds(String graphName) {
}

/**
* 添加raft 任务,转发数据给raft
* Add raft task, forward data to raft
*
* @return true 表示数据已被提交,false表示未提交,用于单副本入库减少批次拆分
* @return true means the data has been submitted, false means not submitted, used to reduce batch splitting for single-replica storage
*/
public <Req extends com.google.protobuf.GeneratedMessageV3>
void addRaftTask(byte methodId, String graphName, Integer partitionId, Req req,
Expand All @@ -140,14 +141,14 @@ void addRaftTask(byte methodId, String graphName, Integer partitionId, Req req,
}
//
try {
// 序列化,
// Serialization
final byte[] buffer = new byte[req.getSerializedSize() + 1];
final CodedOutputStream output = CodedOutputStream.newInstance(buffer);
output.write(methodId);
req.writeTo(output);
output.checkNoSpaceLeft();
output.flush();
// 传送给raft
// Add raft task
storeEngine.addRaftTask(graphName, partitionId,
RaftOperation.create(methodId, buffer, req), closure);

Expand All @@ -159,7 +160,7 @@ void addRaftTask(byte methodId, String graphName, Integer partitionId, Req req,
}

/**
* 来自日志的任务,一般是follower 或者 日志回滚的任务
* Tasks from logs, generally tasks from followers or log rollbacks
*/
@Override
public boolean invoke(int partId, byte[] request, RaftClosure response) throws
Expand Down Expand Up @@ -190,7 +191,7 @@ public boolean invoke(int partId, byte[] request, RaftClosure response) throws
}

/**
* 处理raft传送过来的数据
* Process the data sent by raft
*/
@Override
public boolean invoke(int partId, byte methodId, Object req, RaftClosure response) throws
Expand Down