diff --git a/prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/util/daemon/queueProcessor/service/grid/PartitionedService.java b/prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/util/daemon/queueProcessor/service/grid/PartitionedService.java index f0863fa84355..0cf7cd315492 100644 --- a/prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/util/daemon/queueProcessor/service/grid/PartitionedService.java +++ b/prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/util/daemon/queueProcessor/service/grid/PartitionedService.java @@ -2292,7 +2292,8 @@ public boolean enterPartition(int nPartition, long cWait) int nLockType = ctrlPartition.getLockType(); if (nLockType == PartitionedService.PartitionControl.LOCK_BACKUP_XFER_OUT || nLockType == PartitionedService.PartitionControl.LOCK_NONE || - nLockType == PartitionedService.PartitionControl.LOCK_PERSISTENCE) + nLockType == PartitionedService.PartitionControl.LOCK_PERSISTENCE || + nLockType == PartitionedService.PartitionControl.LOCK_PERSISTENCE_SNAPSHOT) { ctrlPartition.enter(-1L); return true; @@ -20996,13 +20997,20 @@ public static abstract class PartitionControl * * Lock is pending. */ - public static final int LOCK_PENDING = 8; - + public static final int LOCK_PENDING = 16; + /** - * Property LOCK_PERSISTENCE + * Property LOCK_PERSISTENCE_SNAPSHOT * * Lock for partition persistence snapshot. */ + public static final int LOCK_PERSISTENCE_SNAPSHOT = 8; + + /** + * Property LOCK_PERSISTENCE + * + * Lock for partition persistence recovery. + */ public static final int LOCK_PERSISTENCE = 4; /** @@ -21162,7 +21170,7 @@ public static abstract class PartitionControl * * 0x0F (bits 1-3) */ - public static final int STATE_MASK_LOCK = 15; + public static final int STATE_MASK_LOCK = 31; /** * Property STATE_MASK_PIN @@ -27743,7 +27751,7 @@ protected boolean lock(int iPart) PartitionedService.PartitionControl ctrlPart = service.getPartitionControl(iPart); long cMillis = service.getDistributionContendMillis(); boolean fLocked = ctrlPart != null && // a once owned partition may no longer be owned - ctrlPart.lock(cMillis, PartitionedService.PartitionControl.LOCK_PERSISTENCE); + ctrlPart.lock(cMillis, PartitionedService.PartitionControl.LOCK_PERSISTENCE_SNAPSHOT); AtomicInteger atomicTasks = ctrlPart.getPersistenceTasks(); if (fLocked && atomicTasks.get() > 0) @@ -28090,7 +28098,7 @@ protected void snapshotStore(int iPart) else { PersistentStore storeFrom = service.getPartitionControl(iPart).getPersistentStore(); - + store = mgrSnapshot.open(sGUID = storeFrom.getId(), storeFrom); removeTransientCaches(store); diff --git a/prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/util/daemon/queueProcessor/service/grid/partitionedService/partitionedCache/Storage.java b/prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/util/daemon/queueProcessor/service/grid/partitionedService/partitionedCache/Storage.java index 188ef1319a70..9e7fb67a9f86 100644 --- a/prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/util/daemon/queueProcessor/service/grid/partitionedService/partitionedCache/Storage.java +++ b/prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/util/daemon/queueProcessor/service/grid/partitionedService/partitionedCache/Storage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at * https://oss.oracle.com/licenses/upl. @@ -6591,6 +6591,7 @@ public void onBackingMapEvent(com.tangosol.util.MapEvent evt) // state is changing; try again. break; + case PartitionedCache.PartitionControl.LOCK_PERSISTENCE_SNAPSHOT: case PartitionedCache.PartitionControl.LOCK_PERSISTENCE: case PartitionedCache.PartitionControl.LOCK_PRIMARY_XFER_IN: case PartitionedCache.PartitionControl.LOCK_BACKUP_XFER_OUT: diff --git a/prj/coherence-core/src/main/java/com/tangosol/persistence/AbstractPersistenceManager.java b/prj/coherence-core/src/main/java/com/tangosol/persistence/AbstractPersistenceManager.java index a764ece813d9..e154e8d18ae1 100644 --- a/prj/coherence-core/src/main/java/com/tangosol/persistence/AbstractPersistenceManager.java +++ b/prj/coherence-core/src/main/java/com/tangosol/persistence/AbstractPersistenceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at * https://oss.oracle.com/licenses/upl. @@ -274,7 +274,7 @@ public PersistentStoreInfo[] listStoreInfo() return new PersistentStoreInfo[0]; } - List listInfo = new ArrayList(); + List listInfo = new ArrayList<>(); for (File fileEnv : aFiles) { @@ -1375,7 +1375,12 @@ public void store(long lExtentId, ReadBuffer bufKey, ReadBuffer bufValue, Object lockRead(); try { - validateExtentId(lExtentId); + if (!validateExtentId(lExtentId)) + { + // ignore normal cases such as concurrent cache deletes, abnormal ones + // are handled using an exception. + return; + } if (oToken instanceof AbstractPersistenceManager.AbstractPersistentStore.BatchTask) { @@ -1435,7 +1440,12 @@ public void erase(long lExtentId, ReadBuffer bufKey, Object oToken) lockRead(); try { - validateExtentId(lExtentId); + if (!validateExtentId(lExtentId)) + { + // ignore normal cases such as concurrent cache deletes, abnormal ones + // are handled using an exception. + return; + } if (oToken instanceof AbstractPersistenceManager.AbstractPersistentStore.BatchTask) { @@ -2048,15 +2058,24 @@ protected final void unlockWrite() * * @param lExtentId the extent identifier */ - protected void validateExtentId(long lExtentId) + protected boolean validateExtentId(long lExtentId) { Long LId = Long.valueOf(lExtentId); // validate that the given extent identifier is known if (!f_setExtentIds.contains(LId)) { - throw new IllegalArgumentException("unknown extent identifier: " + lExtentId + " for store: " + getId()); + if (f_setDeletedIds.contains(LId)) + { + Logger.warn("extent identifier " + LId + " has been concurrently deleted for store: " + getId()); + return false; + } + else + { + throw new IllegalArgumentException("unknown extent identifier: " + lExtentId + " for store: " + getId()); + } } + return true; } /**