Skip to content

Commit

Permalink
Bug 37393929 - [37181866->24.09.1] RFA: Snapshot creation failed disa…
Browse files Browse the repository at this point in the history
…bling active persistence with IllegalArgumentException: unknown extent identifier

[git-p4: depot-paths = "//dev/coherence-ce/release/coherence-ce-v24.09/": change = 113584]
  • Loading branch information
mgamanho committed Jan 16, 2025
1 parent 42e4329 commit bf6e4c8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -274,7 +274,7 @@ public PersistentStoreInfo[] listStoreInfo()
return new PersistentStoreInfo[0];
}

List<PersistentStoreInfo> listInfo = new ArrayList<PersistentStoreInfo>();
List<PersistentStoreInfo> listInfo = new ArrayList<>();

for (File fileEnv : aFiles)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit bf6e4c8

Please sign in to comment.