Skip to content

Commit

Permalink
(release) v1.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
fengjiachun committed Apr 1, 2019
2 parents be760dc + 09fb200 commit f6d2e80
Show file tree
Hide file tree
Showing 42 changed files with 964 additions and 661 deletions.
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/ask-question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Ask Question
about: Ask a question about usage or feature
title: ''
labels: ''
assignees: ''

---

### Your question

Describe your question clearly

### Your scenes

Describe your use scenes (why need this feature)

### Your advice

Describe the advice or solution you'd like

### Environment

- SOFAJRaft version:
- JVM version (e.g. `java -version`):
- OS version (e.g. `uname -a`):
- Maven version:
- IDE version:
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Bug Report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

### Describe the bug

A clear and concise description of what the bug is.

### Expected behavior

### Actual behavior

### Steps to reproduce

### Minimal yet complete reproducer code (or GitHub URL to code)

### Environment

- SOFAJRaft version:
- JVM version (e.g. `java -version`):
- OS version (e.g. `uname -a`):
- Maven version:
- IDE version:
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Motivation:

Explain the context, and why you're making that change.
To make others understand what is the problem you're trying to solve.

### Modification:

Describe the idea and modifications you've done.

### Result:

Fixes #<GitHub issue number>.

If there is no issue then describe the changes introduced by this PR.
279 changes: 0 additions & 279 deletions .middleware-common/AlipayFormatter120.xml

This file was deleted.

Binary file removed .middleware-common/jmockit-coverage-1.14.jar
Binary file not shown.
14 changes: 0 additions & 14 deletions .middleware-common/print_jmockit_result.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install:
- mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true -B -V

script:
- sh ./.middleware-common/check_format.sh
- sh ./tools/check_format.sh

after_success:
- travis_retry mvn --projects $TESTFOLDER clean test
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Contributing to SOFAJRaft

SOFAJRaft is released under the Apache 2.0 license, and follows a very
standard Github development process, using Github tracker for issues and
merging pull requests into master. If you would like to contribute something,
or simply want to hack on the code this document should help you get started.

### Sign the Contributor License Agreement
Before we accept a non-trivial patch or pull request we will need you to
sign the Contributor License Agreement. Signing the contributor’s agreement
does not grant anyone commit rights to the main repository, but it does mean
that we can accept your contributions, and you will get an author credit if
we do. Active contributors might be asked to join the core team, and given
the ability to merge pull requests.

### Code Conventions
None of these is essential for a pull request, but they will all help.

1. we provided a [code formatter file](./tools/codestyle/formatter.xml), it
will formatting automatically your project when during process of building.

2. Make sure all new `.java` files to have a simple Javadoc class comment
with at least an `@author` tag identifying you, and preferably at least a
paragraph on what the class is for.

3. Add the ASF license header comment to all new `.java` files (copy from
existing files in the project)

4. Add yourself as an `@author` to the `.java` files that you modify
substantially (more than cosmetic changes).

5. Add some Javadocs.

6. A few unit tests would help a lot as well — someone has to do it.

7. When writing a commit message please follow [these conventions](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
if you are fixing an existing issue please add Fixes gh-XXXX at the end of the commit message (where XXXX is the issue number).
13 changes: 1 addition & 12 deletions jraft-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
<parent>
<artifactId>jraft-parent</artifactId>
<groupId>com.alipay.sofa</groupId>
<version>1.2.4</version>
<version>1.2.5</version>
</parent>
<artifactId>jraft-core</artifactId>
<packaging>jar</packaging>
<name>jraft-core ${project.version}</name>

<dependencies>

<!-- junit -->
<dependency>
<groupId>junit</groupId>
Expand All @@ -24,18 +23,15 @@
<artifactId>junit-dep</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</dependency>

<!-- rocksdb-->
<dependency>
<groupId>org.rocksdb</groupId>
<artifactId>rocksdbjni</artifactId>
</dependency>

<!-- mock -->
<dependency>
<groupId>org.mockito</groupId>
Expand All @@ -47,13 +43,11 @@
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<scope>test</scope>
</dependency>

<!-- log -->
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -75,7 +69,6 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
</dependency>

<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
Expand All @@ -84,7 +77,6 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>

<!-- commons -->
<dependency>
<groupId>commons-io</groupId>
Expand All @@ -94,7 +86,6 @@
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>

<!-- bolt -->
<dependency>
<groupId>com.alipay.sofa</groupId>
Expand All @@ -104,13 +95,11 @@
<groupId>com.alipay.sofa</groupId>
<artifactId>hessian</artifactId>
</dependency>

<!-- metrics -->
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>

<!-- benchmark -->
<dependency>
<groupId>org.openjdk.jmh</groupId>
Expand Down
24 changes: 11 additions & 13 deletions jraft-core/src/main/java/com/alipay/sofa/jraft/core/BallotBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.alipay.sofa.jraft.entity.Ballot;
import com.alipay.sofa.jraft.entity.PeerId;
import com.alipay.sofa.jraft.option.BallotBoxOptions;
import com.alipay.sofa.jraft.util.ArrayDequeue;
import com.alipay.sofa.jraft.util.ArrayDeque;
import com.alipay.sofa.jraft.util.OnlyForTest;
import com.alipay.sofa.jraft.util.Requires;

Expand All @@ -44,22 +44,22 @@
@ThreadSafe
public class BallotBox implements Lifecycle<BallotBoxOptions> {

private static final Logger LOG = LoggerFactory.getLogger(BallotBox.class);
private static final Logger LOG = LoggerFactory.getLogger(BallotBox.class);

private FSMCaller waiter;
private ClosureQueue closureQueue;
private final StampedLock stampedLock = new StampedLock();
private long lastCommittedIndex = 0;
private long pendingIndex;
private final ArrayDequeue<Ballot> pendingMetaQueue = new ArrayDequeue<>();
private FSMCaller waiter;
private ClosureQueue closureQueue;
private final StampedLock stampedLock = new StampedLock();
private long lastCommittedIndex = 0;
private long pendingIndex;
private final ArrayDeque<Ballot> pendingMetaQueue = new ArrayDeque<>();

@OnlyForTest
long getPendingIndex() {
return this.pendingIndex;
}

@OnlyForTest
ArrayDequeue<Ballot> getPendingMetaQueue() {
ArrayDeque<Ballot> getPendingMetaQueue() {
return this.pendingMetaQueue;
}

Expand Down Expand Up @@ -126,10 +126,8 @@ public boolean commitAt(long firstLogIndex, long lastLogIndex, PeerId peer) {
// logs, since we use the new configuration to deal the quorum of the
// removal request, we think it's safe to commit all the uncommitted
// previous logs, which is not well proved right now
for (long index = pendingIndex; index <= lastCommittedIndex; index++) {
pendingMetaQueue.pollFirst();
LOG.debug("Committed log index={}", index);
}
pendingMetaQueue.removeRange(0, (int) (lastCommittedIndex - pendingIndex) + 1);
LOG.debug("Committed log fromIndex={}, toIndex={}.", pendingIndex, lastCommittedIndex);
pendingIndex = lastCommittedIndex + 1;
this.lastCommittedIndex = lastCommittedIndex;
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1070,15 +1070,15 @@ private void executeApplyingTasks(List<LogEntryAndClosure> tasks) {
}
continue;
}
// set task entry info before adding to list.
task.entry.getId().setTerm(currTerm);
task.entry.setType(EnumOutter.EntryType.ENTRY_TYPE_DATA);
entries.add(task.entry);
if (!this.ballotBox.appendPendingTask(this.conf.getConf(), conf.isStable() ? null : conf.getOldConf(),
task.done)) {
Utils.runClosureInThread(task.done, new Status(RaftError.EINTERNAL, "Fail to append task."));
return;
continue;
}
// set task entry info before adding to list.
task.entry.getId().setTerm(currTerm);
task.entry.setType(EnumOutter.EntryType.ENTRY_TYPE_DATA);
entries.add(task.entry);
}
this.logManager.appendEntries(entries, new LeaderStableClosure(entries));
// update conf.first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ private static boolean onAppendEntriesReturned(ThreadId id, Inflight inflight, S
r.notifyOnCaughtUp(RaftError.EPERM.getNumber(), true);
r.destroy();
node.increaseTermTo(response.getTerm(), new Status(RaftError.EHIGHERTERMRESPONSE,
"Leader receives higher term hearbeat_response from peer:%s", r.options.getPeerId()));
"Leader receives higher term heartbeat_response from peer:%s", r.options.getPeerId()));
return false;
}
if (isLogDebugEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ public class RpcOptions {
*/
private int rpcDefaultTimeout = 5000;

/**
* Install snapshot RPC request default timeout in milliseconds
* Default: 5 * 60 * 1000(5min)
*/
private int rpcInstallSnapshotTimeout = 5 * 60 * 1000;

/**
* Rpc process thread pool size
* Default: 80
Expand Down Expand Up @@ -75,10 +81,19 @@ public void setRpcDefaultTimeout(int rpcDefaultTimeout) {
this.rpcDefaultTimeout = rpcDefaultTimeout;
}

public int getRpcInstallSnapshotTimeout() {
return rpcInstallSnapshotTimeout;
}

public void setRpcInstallSnapshotTimeout(int rpcInstallSnapshotTimeout) {
this.rpcInstallSnapshotTimeout = rpcInstallSnapshotTimeout;
}

@Override
public String toString() {
return "RpcOptions{" + "rpcConnectTimeoutMs=" + rpcConnectTimeoutMs + ", rpcDefaultTimeout="
+ rpcDefaultTimeout + ", rpcProcessorThreadPoolSize=" + rpcProcessorThreadPoolSize + ", metricRegistry="
+ metricRegistry + '}';
+ rpcDefaultTimeout + ", rpcInstallSnapshotTimeout=" + rpcInstallSnapshotTimeout
+ ", rpcProcessorThreadPoolSize=" + rpcProcessorThreadPoolSize + ", metricRegistry=" + metricRegistry
+ '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public Future<Message> getFile(Endpoint endpoint, GetFileRequest request, int ti
@Override
public Future<Message> installSnapshot(Endpoint endpoint, InstallSnapshotRequest request,
RpcResponseClosure<InstallSnapshotResponse> done) {
return invokeWithDone(endpoint, request, done, rpcOptions.getRpcDefaultTimeout());
return invokeWithDone(endpoint, request, done, rpcOptions.getRpcInstallSnapshotTimeout());
}

@Override
Expand Down
Loading

0 comments on commit f6d2e80

Please sign in to comment.