Skip to content

Commit

Permalink
Revert "修复偶尔写坏数据问题"
Browse files Browse the repository at this point in the history
This reverts commit 7df7bc1
  • Loading branch information
liyue2008 committed Jul 7, 2020
1 parent 7df7bc1 commit e4a4296
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;

import static io.journalkeeper.core.api.RaftJournal.INTERNAL_PARTITION;
import static io.journalkeeper.core.server.MetricNames.METRIC_APPEND_ENTRIES_RPC;
import static io.journalkeeper.core.server.ThreadNames.FLUSH_JOURNAL_THREAD;
import static io.journalkeeper.core.server.ThreadNames.LEADER_APPEND_ENTRY_THREAD;
Expand Down Expand Up @@ -539,13 +540,15 @@ protected void doStart() {

private void appendLeaderAnnouncementEntry() {
// Leader announcement
byte[] payload = InternalEntriesSerializeSupport.serialize(new LeaderAnnouncementEntry(currentTerm, serverUri));
updateClusterState(
new UpdateClusterStateRequest(
new UpdateRequest(payload, RaftJournal.INTERNAL_PARTITION, 1
)
)
);
try {
byte[] payload = InternalEntriesSerializeSupport.serialize(new LeaderAnnouncementEntry(currentTerm, serverUri));
JournalEntry journalEntry = journalEntryParser.createJournalEntry(payload);
journalEntry.setTerm(currentTerm);
journalEntry.setPartition(INTERNAL_PARTITION);
appendAndCallback(Collections.singletonList(journalEntry), null, null);
} catch (InterruptedException e) {
logger.warn("Exception: ", e);
}
}

private void takeSnapshotPeriodically() {
Expand Down

0 comments on commit e4a4296

Please sign in to comment.