duongkame commented on code in PR #1015:
URL: https://github.com/apache/ratis/pull/1015#discussion_r1457835647
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/TransactionManager.java:
##########
@@ -28,17 +29,17 @@
* Managing {@link TransactionContext}.
*/
class TransactionManager {
- private final ConcurrentMap<Long, Supplier<TransactionContext>> contexts =
new ConcurrentHashMap<>();
+ private final ConcurrentMap<TermIndex, Supplier<TransactionContext>>
contexts = new ConcurrentHashMap<>();
- TransactionContext get(long index) {
- return
Optional.ofNullable(contexts.get(index)).map(Supplier::get).orElse(null);
+ TransactionContext get(TermIndex termIndex) {
+ return
Optional.ofNullable(contexts.get(termIndex)).map(Supplier::get).orElse(null);
}
- TransactionContext computeIfAbsent(long index, Supplier<TransactionContext>
constructor) {
- return contexts.computeIfAbsent(index, i -> constructor).get();
+ TransactionContext computeIfAbsent(TermIndex termIndex,
Supplier<TransactionContext> constructor) {
+ return contexts.computeIfAbsent(termIndex, i -> constructor).get();
}
- void remove(long index) {
- contexts.remove(index);
+ void remove(TermIndex termIndex) {
Review Comment:
Thanks @szetszwo. I saw that, but I was wondering if that happens on
followers (after they apply the log entries). Or if a log entry on a follower
is not applied at all, e.g. when it is considered inconsistent and gets
discarded by a leader `updateUnconditionally`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]