rpuch commented on code in PR #1599:
URL: https://github.com/apache/ignite-3/pull/1599#discussion_r1091736012
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -1952,50 +1952,56 @@ public void onError(Throwable e) {
metaStorageMgr.registerPrefixWatch(ByteArray.fromString(STABLE_ASSIGNMENTS_PREFIX),
new WatchListener() {
@Override
public void onUpdate(WatchEvent evt) {
- if (!busyLock.enterBusy()) {
- throw new IgniteInternalException(new
NodeStoppingException());
- }
-
- try {
- assert evt.single();
+ inBusyLock(busyLock, () -> {
+ assert evt.single() : evt;
Entry stableAssignmentsWatchEvent =
evt.entryEvent().newEntry();
if (stableAssignmentsWatchEvent.value() == null) {
return;
}
- int part =
extractPartitionNumber(stableAssignmentsWatchEvent.key());
- UUID tblId =
extractTableId(stableAssignmentsWatchEvent.key(), STABLE_ASSIGNMENTS_PREFIX);
+ int partitionId =
extractPartitionNumber(stableAssignmentsWatchEvent.key());
+ UUID tableId =
extractTableId(stableAssignmentsWatchEvent.key(), STABLE_ASSIGNMENTS_PREFIX);
- TablePartitionId replicaGrpId = new
TablePartitionId(tblId, part);
+ TablePartitionId replicaGrpId = new
TablePartitionId(tableId, partitionId);
Set<Assignment> stableAssignments =
ByteUtils.fromBytes(stableAssignmentsWatchEvent.value());
- byte[] pendingFromMetastorage =
metaStorageMgr.get(pendingPartAssignmentsKey(replicaGrpId),
-
stableAssignmentsWatchEvent.revision()).join().value();
+ byte[] pendingAssignmentsFromMetaStorage =
metaStorageMgr.get(
+ pendingPartAssignmentsKey(replicaGrpId),
+ stableAssignmentsWatchEvent.revision()
+ ).join().value();
- Set<Assignment> pendingAssignments =
pendingFromMetastorage == null
+ Set<Assignment> pendingAssignments =
pendingAssignmentsFromMetaStorage == null
? Set.of()
- : ByteUtils.fromBytes(pendingFromMetastorage);
+ :
ByteUtils.fromBytes(pendingAssignmentsFromMetaStorage);
String localMemberName =
clusterService.topologyService().localMember().name();
boolean shouldStopLocalServices =
Stream.concat(stableAssignments.stream(), pendingAssignments.stream())
.noneMatch(assignment ->
assignment.consistentId().equals(localMemberName));
if (shouldStopLocalServices) {
+ TableImpl table = tablesByIdVv.latest().get(tableId);
+
+ CompletableFuture<Void> destroyMvPartitionStorageFuture
+ =
table.internalTable().storage().destroyPartition(partitionId);
Review Comment:
I wonder why destruction is made under this Jira ticket: it's about closing
the storage, not destruction. I thought we had another ticket about destruction
of data of evicted partitions.
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java:
##########
@@ -416,12 +416,6 @@ public boolean onSnapshotLoad(Path path) {
@Override
public void onShutdown() {
- // TODO: IGNITE-17958 - probably, we should not close the storage here
as PartitionListener did not create the storage.
- try {
- storage.close();
Review Comment:
So the storage will be shut down either when the `TableStorage` is shutdown
(on node stop), or when the partition is evicted from the node (in which case
it will be not just shut down, but also destroyed)?
It would be great to have a test making sure that a non-evicted partition
storage is closed on node stop.
--
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]