-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IGNITE-24384 Support write intent switches within colocation logic #5241
Conversation
modules/transactions/src/main/java/org/apache/ignite/internal/tx/TxManager.java
Outdated
Show resolved
Hide resolved
* @param commit {@code true} if a commit requested. | ||
* @param commitTimestamp Commit timestamp ({@code null} if it's an abort). | ||
* @param txId Transaction id. | ||
* @return Completable future of Void. | ||
*/ | ||
CompletableFuture<Void> cleanup( | ||
TablePartitionId commitPartitionId, | ||
Collection<ReplicationGroupId> enlistedPartitions, | ||
Collection<EnlistedPartitionGroup> enlistedPartitions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too many similar entities MutablePartitionEnlistment
, FinishingPartitionEnlistment
, EnlistedPartitionGroup
with some carelessness in javadocs:
- EnlistedPartitionGroup javadoc claims that it's
Partition enlistment together with partition group ID
, meaning tableIds = Partition enlistment. - MutablePartitionEnlistment is primaryNode + consistencyToken + tableIds
Do you have any ideas of how to make MutablePartitionEnlistment
, FinishingPartitionEnlistment
, EnlistedPartitionGroup
cleaner, probably decreasing the number of classes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 3 represent similar information ('partition enlistment information') at different times in different contexts. They all relate to some groupId (but in 2 cases groupId is stored externally, as map key, and in the last case it's stored inside) and they all have tableIds
(in first case it's mutable, in other cases it's not).
MutablePartitionEnlistment
(which I've just renamed toOngoingTxPartitionEnlistment
to make it more clear what it is) is used to track enlistment information for a partition (which groupId is stored externally) while the transaction is still running, before it is finished; so it needs to know its primary replica (in the form ofClusterNode
, not just name) and enlistment tokenFinishingPartitionEnlistment
represents the same information when the transaction is being finished and when tx cleanup happens. At this stage,tableIds
doesn't need to be mutable anymore, and token is not needed; the primary node is still needed but it can be represented as a name.EnlistedPartitionGroup
represents this 'thing' stored inTxMeta
(and in tx state storage). Primary information is not needed anymore, but groupId has to be stored explicitly. Even if we represented collections ofEnlistedPartitionGroup
as maps from groupIds to the remaining enlistment information, we wouldn't be able to reuseFinishingPartitionEnlistment
because we don't primary node name it contains. (Technically, we could, but it would be ugly). On the other hand, I don't look the idea to removeEnlistedPartitionGroup
and just use maps from groupIds to tableIds everywhere we use collections ofEnlistedPartitionGroup
(this would be hide an entity)
To sum up: I wasn't able to invent any way to remove any of these entities. I named them to make first and second look alike (as they are really close) and third to be a little different (as it's context is a bit different). If you have any ideas on how to improve this, please share them.
I also updated javadocs on the classes to decrease possible confusion.
...integrationTest/java/org/apache/ignite/internal/partition/replicator/ItZoneTxFinishTest.java
Show resolved
Hide resolved
...integrationTest/java/org/apache/ignite/internal/partition/replicator/ItZoneTxFinishTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[removed]
...in/java/org/apache/ignite/internal/partition/replicator/WriteIntentSwitchRequestHandler.java
Outdated
Show resolved
Hide resolved
...in/java/org/apache/ignite/internal/partition/replicator/WriteIntentSwitchRequestHandler.java
Outdated
Show resolved
Hide resolved
.../main/java/org/apache/ignite/internal/partition/replicator/ZonePartitionReplicaListener.java
Show resolved
Hide resolved
...va/org/apache/ignite/internal/partition/replicator/raft/WriteIntentSwitchCommandHandler.java
Outdated
Show resolved
Hide resolved
...table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java
Show resolved
Hide resolved
...n/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java
Outdated
Show resolved
Hide resolved
...le/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java
Show resolved
Hide resolved
…ts handling for per-table replicas
…possible for WriteIntentSwitch request handling; remove usage of clockService.now()
…logVersion() calls
https://issues.apache.org/jira/browse/IGNITE-24384