You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2022/08/07 15:39:06 UTC
[GitHub] [ratis] JoeCqupt opened a new pull request, #708: RATIS-1665. RaftLog avoid converting list
JoeCqupt opened a new pull request, #708:
URL: https://github.com/apache/ratis/pull/708
## What changes were proposed in this pull request?
https://github.com/apache/ratis/blob/master/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java#L1280
this is a TODO comment about avoid converting list . i want to implement it .
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-1665
## How was this patch tested?
ci
--
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: issues-unsubscribe@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ratis] szetszwo merged pull request #708: RATIS-1665. RaftLog avoid converting list
Posted by GitBox <gi...@apache.org>.
szetszwo merged PR #708:
URL: https://github.com/apache/ratis/pull/708
--
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: issues-unsubscribe@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ratis] JoeCqupt commented on pull request #708: RATIS-1665. RaftLog avoid converting list
Posted by GitBox <gi...@apache.org>.
JoeCqupt commented on PR #708:
URL: https://github.com/apache/ratis/pull/708#issuecomment-1207440036
wip
--
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: issues-unsubscribe@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ratis] JoeCqupt commented on pull request #708: RATIS-1665. RaftLog avoid converting list
Posted by GitBox <gi...@apache.org>.
JoeCqupt commented on PR #708:
URL: https://github.com/apache/ratis/pull/708#issuecomment-1208310173
@szetszwo PTAL
--
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: issues-unsubscribe@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ratis] szetszwo commented on a diff in pull request #708: RATIS-1665. RaftLog avoid converting list
Posted by GitBox <gi...@apache.org>.
szetszwo commented on code in PR #708:
URL: https://github.com/apache/ratis/pull/708#discussion_r940476588
##########
ratis-server-api/src/main/java/org/apache/ratis/server/raftlog/RaftLogSequentialOps.java:
##########
@@ -127,7 +127,7 @@ <OUTPUT, THROWABLE extends Throwable> OUTPUT runSequentially(
* If an existing entry conflicts with a new one (same index but different terms),
* delete the existing entry and all entries that follow it (§5.3).
*/
- List<CompletableFuture<Long>> append(LogEntryProto... entries);
+ List<CompletableFuture<Long>> append(List<LogEntryProto> entries);
Review Comment:
Since this is in ratis-server-api, we need to deprecate the old method and add the new method. The old method can be removed later.
```
/**
* Append asynchronously all the given log entries.
* Used by the followers.
*
* If an existing entry conflicts with a new one (same index but different terms),
* delete the existing entry and all entries that follow it (§5.3).
*/
List<CompletableFuture<Long>> append(List<LogEntryProto> entries);
/**
* The same as append(Arrays.asList(entries)).
*
* @deprecated use {@link #append(List)}
*/
@Deprecated
default List<CompletableFuture<Long>> append(LogEntryProto... entries) {
return append(Arrays.asList(entries));
}
```
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java:
##########
@@ -1342,8 +1341,8 @@ private CommitInfoProto updateCommitInfoCache() {
@SuppressWarnings("checkstyle:parameternumber")
private CompletableFuture<AppendEntriesReplyProto> appendEntriesAsync(
RaftPeerId leaderId, long leaderTerm, TermIndex previous, long leaderCommit, long callId, boolean initializing,
- List<CommitInfoProto> commitInfos, LogEntryProto... entries) throws IOException {
- final boolean isHeartbeat = entries.length == 0;
+ List<CommitInfoProto> commitInfos, List<LogEntryProto> entries) throws IOException {
+ final boolean isHeartbeat = entries.size() == 0;
Review Comment:
Use `entries.isEmpty()` for `entries.size() == 0` and `!entries.isEmpty()` for `entries.size() > 0`.
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderStateImpl.java:
##########
@@ -310,7 +311,7 @@ LogEntryProto start() {
server.getRaftConf(), server.getState().getCurrentTerm(), raftLog.getNextIndex());
CodeInjectionForTesting.execute(APPEND_PLACEHOLDER,
server.getId().toString(), null);
- raftLog.append(placeHolder);
+ raftLog.append(Lists.newArrayList(placeHolder));
Review Comment:
Use Collections.singletonList.
```
raftLog.append(Collections.singletonList(placeHolder));
```
--
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: issues-unsubscribe@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org