Skip to content

Commit

Permalink
Bug 37393928 - [37181866->22.06.11] RFA: Snapshot creation failed dis…
Browse files Browse the repository at this point in the history
…abling active persistence with IllegalArgumentException: unknown extent identifier

[git-p4: depot-paths = "//dev/coherence-ce/release/coherence-ce-v22.06/": change = 113585]
  • Loading branch information
mgamanho committed Jan 16, 2025
1 parent 79448ec commit 3cee0d2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,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 @@ -20860,13 +20861,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 @@ -21026,7 +21034,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 @@ -27366,7 +27374,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 @@ -27706,7 +27714,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 @@ -6551,6 +6551,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 @@ -1297,7 +1297,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 @@ -1357,7 +1362,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 @@ -1956,16 +1966,25 @@ 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))
{
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;
}

/**
* Validate the metadata
Expand Down

0 comments on commit 3cee0d2

Please sign in to comment.