Comments (2)
bTW the conversation referenced is in #29
from copycat.
Actually, the description above is somewhat wrong...
Entries where index <= majorIndex
(i.e. globalIndex
) are returned as null
if cleaned. But normal entries where index > majorIndex
can be null
as well if they index <= minorIndex
and they were removed from disk. So, I think that condition above should actually be:
// For non-null entries, we determine whether the entry should be exposed to the Raft algorithm
// based on the type of entry and whether it has been cleaned.
if (entry != null) {
// If the entry has not been cleaned by the state machine, return it. Note that the call to isClean()
// on the segment will be done in O(1) time since the search was already done in the get() call.
if (!segment.isClean(index)) {
return entry;
}
// For tombstone entries, if the entry index is greater than the majorIndex, return the entry. This ensures that entries
// are replicated until persisted on all available servers.
else if (entry.isTombstone()) {
if (index > compactor.majorIndex()) {
return entry;
}
}
// If the entry is not a tombstone, return the entry if the index is greater than minorIndex. If the entry is less than minorIndex,
// that indicates that it has been committed and events have been received for the entry, so we can safely stop replicating it.
else {
if (index > compactor.minorIndex()) {
return entry;
}
}
}
This hides entries for which events have been received and tombstones that have been stored on all servers as necessary. But an additional condition needs to be added to handle the case of the last committed entry:
if (index >= segments.commitIndex()) {
return entry;
}
The last case will ensure that AppendRequest
consistency checks can be completed on a non-null entry. The last committed entry will always remain visible in the log. I'll have to double check log compaction to ensure this guarantee still holds there as well.
from copycat.
Related Issues (20)
- Support concurrent access of logs
- Remove indexing in logs
- Relax threading model in transports
- Remove serialization
- Create state machine test framework
- Support relaxed client consistency models
- Use unique node identifiers HOT 2
- Catch up joining nodes in the PASSIVE state before promotion to ACTIVE HOT 1
- question for performance HOT 4
- Join request from leader is proxied back to itself
- Leader election sends LEADER state change event twice
- New leader triggers onLeave event
- Use trace log level for requests/responses
- Don't submit unnecessary keep-alives
- Nodes can't communicate over the internet HOT 1
- copycat 1.2.4 server fails build test HOT 2
- question about pessimistic case HOT 1
- Allow KeepAliveRequest to manage multiple sessions HOT 2
- Under certain disconnection circumstances, the copycat-client-io thread takes 100% CPU HOT 3
- ServerCommit GC Warning
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from copycat.