Skip to content

Commit

Permalink
Enhancement Request 37422327 - Undo //dev/coherence-ce/release/cohere…
Browse files Browse the repository at this point in the history
…nce-ce-v22.06/prj/... changelist 112453

[git-p4: depot-paths = "//dev/coherence-ce/release/coherence-ce-v22.06/": change = 113136]
  • Loading branch information
lsho committed Jan 2, 2025
1 parent 0c2f4d2 commit 821a24a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 704 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27867,19 +27867,6 @@ public static class SnapshotController
*/
private volatile long __m_SnapshotNamesExpire;

/**
* A cache of failed snapshot names held for at most SNAPSHOT_NAMES_EXPIRE
* millis after a SnapshotListRequest.
*/
private String[] __m_SnapshotFailures;

/**
* An absolute time when SnapshotFailures should no longer be used.
*
* @volatile
*/
private volatile long __m_SnapshotFailuresExpire;

/**
* Property State
*
Expand Down Expand Up @@ -28478,26 +28465,6 @@ protected long getSnapshotNamesExpire()
return __m_SnapshotNamesExpire;
}

/**
* Getter for property SnapshotFailures.<p>
* A cache of snapshot names held for at most SNAPSHOT_NAMES_EXPIRE
* millis after a SnapshotListRequest.
*/
protected String[] getSnapshotFailures()
{
return __m_SnapshotFailures;
}

/**
* An absolute time when SnapshotFailures should no longer be used.
*
* @volatile
*/
protected long getSnapshotFailuresExpire()
{
return __m_SnapshotFailuresExpire;
}

// From interface: com.tangosol.persistence.PersistenceManagerMBean
/**
* Return a list of snapshots that are available for recovery.
Expand Down Expand Up @@ -28537,41 +28504,6 @@ public String[] getSnapshots()
return asNames;
}

/**
* Return the list of failed snapshots.
*
* @return the list of failed snapshots
*/
public String[] listFailedSnapshots()
{
PartitionedService service = getService();
if (service == null || !service.isRunning())
{
return null;
}

if (Base.getSafeTimeMillis() < getSnapshotFailuresExpire() ||
Thread.currentThread() == service.getThread())
{
// use the cached value if within the allowed staleness or if being asked
// on the service thread, as it requires a poll to all storage-enabled members.
// This question could only be asked meaningfully on the Management thread
// but could be called during serialization of the model for initial
// registration - see Registry.registerLocalModel()
return getSnapshotFailures();
}

PartitionedService.SnapshotListRequest msgRequest = (PartitionedService.SnapshotListRequest)
service.instantiateMessage("SnapshotListRequest");
msgRequest.setToMemberSet(service.getOwnershipMemberSet());
msgRequest.setSnapshotName(null);
msgRequest.setFailed(true); // this ensures we get list of failed snapshots

String[] asNames = (String[]) service.poll(msgRequest);
setSnapshotFailures(asNames);
return asNames;
}

/**
* Return a Map<Integer, String[]> where the key is the member id
* and the value is the list of stores that are known by all members
Expand Down Expand Up @@ -28854,21 +28786,17 @@ public void onRecoveryCompleted(String sSnapshot, com.tangosol.net.partition.Par

String sMessage, sUserData;

PersistenceEnvironment env = SafePersistenceWrappers.unwrap(
getService().getPersistenceControl().getPersistenceEnvironment());
if (partsFailed == null || partsFailed.isEmpty())
{
sMessage = "Successfully recovered snapshot \"" + sSnapshot + '"';
sUserData = "";
_trace(sMessage, 3);
CachePersistenceHelper.recordRecoveryStatus(env, sSnapshot, true, null);
}
else
{
sMessage = "Failed to recover snapshot \"" + sSnapshot + '"';
sUserData = "failed partitions " + partsFailed;
_trace(sMessage + " because of " + sUserData, 2);
CachePersistenceHelper.recordRecoveryStatus(env, sSnapshot, false, sUserData);
}

// resume the service if it was previously suspended
Expand Down Expand Up @@ -29121,48 +29049,6 @@ public void removeSnapshot(String sSnapshot)
addNotification(PersistenceManagerMBean.REMOVE_SNAPSHOT_BEGIN, getOperationStatus(), "");
}

/**
* Return snapshot status.
*
* @param sName the snapshot name
*
* @return the snapshot status, or null if it is not possible
* to obtain the status.
*/
public synchronized String getSnapshotStatus(String sName)
{
String currentSnapshotName = getSnapshotName();
if (sName.equals(currentSnapshotName))
{
return getOperationStatus();
}

return CachePersistenceHelper.getSnapshotStatus(
SafePersistenceWrappers.unwrap(getService().getPersistenceControl().getPersistenceEnvironment()),
sName);
}

/**
* Return snapshot recovery status.
*
* @param sName the snapshot name
*
* @return the snapshot recovery status, or null if it is not
* possible to obtain the status.
*/
public synchronized String getSnapshotRecoveryStatus(String sName)
{
String currentSnapshotName = getSnapshotName();
if (sName.equals(currentSnapshotName))
{
return getOperationStatus();
}

return CachePersistenceHelper.getSnapshotRecoveryStatus(
SafePersistenceWrappers.unwrap(getService().getPersistenceControl().getPersistenceEnvironment()),
sName);
}

/**
* Reset the state of the SnapshotController after an operation has
* completed.
Expand Down Expand Up @@ -29358,32 +29244,6 @@ protected void setSnapshotNamesExpire(long ldtExpire)
{
__m_SnapshotNamesExpire = ldtExpire;
}

// Accessor for the property "SnapshotFailures"
/**
* Setter for property SnapshotFailures.<p>
* A cache of snapshot names held for at most SNAPSHOT_NAMES_EXPIRE
* millis after a SnapshotListRequest.
*/
public void setSnapshotFailures(String[] asNames)
{
// import com.tangosol.util.Base;

__m_SnapshotFailures = asNames;

setSnapshotFailuresExpire(asNames == null
? 0L : Base.getSafeTimeMillis() + SNAPSHOT_NAMES_EXPIRE);
}

/**
* An absolute time when SnapshotFailures should no longer be used.
*
* @volatile
*/
protected void setSnapshotFailuresExpire(long ldtExpire)
{
__m_SnapshotFailuresExpire = ldtExpire;
}

// Accessor for the property "State"
/**
Expand Down Expand Up @@ -30576,26 +30436,15 @@ public static class SnapshotListRequest
*/
public static final String RESPONSE_STORES = "2";

/**
* This value indicates the response was for a list of failed snapshots.
*/
public static final String RESPONSE_FAILED_SNAPSHOTS = "3";

/**
* Property SnapshotName
*
* If Snapshot is null this means that SnapshotListRequest should
* retrieve the snapshots for the service (or failed snapshots if
* __m_failed is set to true) otherwise the stores for the
* retrieve the snapshots for the service otherwise the stores for the
* snapshot specified by SnapshotName should be returned.
*/
private String __m_SnapshotName;
private static com.tangosol.util.ListMap __mapChildren;

/**
* If true request should retrieve list of failed snapshots.
*/
private boolean __m_failed;

// Static initializer
static
Expand Down Expand Up @@ -30726,15 +30575,6 @@ public String getSnapshotName()
return __m_SnapshotName;
}

/**
* Returns true if SnapshotListRequest should retrieve list
* of failed snapshots.
*/
public boolean getFailed()
{
return __m_failed;
}

// Declared at the super level
protected com.tangosol.coherence.component.net.Poll instantiatePoll()
{
Expand Down Expand Up @@ -30786,16 +30626,8 @@ public void onReceived()

if (sSnapshotName == null)
{
if (getFailed())
{
String[] asFailedSnapshots = CachePersistenceHelper.getFailedSnapshots(env);
msgResponse.setValue (new Object[] {RESPONSE_FAILED_SNAPSHOTS, asFailedSnapshots});
}
else
{
// respond with list of snapshots
msgResponse.setValue (new Object[] {RESPONSE_SNAPSHOTS, env.listSnapshots()});
}
// respond with list of snapshots
msgResponse.setValue (new Object[] {RESPONSE_SNAPSHOTS, env.listSnapshots()});
}
else
{
Expand Down Expand Up @@ -30836,7 +30668,6 @@ public void read(com.tangosol.io.ReadBuffer.BufferInput input)

boolean fNull = input.readBoolean();
setSnapshotName(fNull ? null : input.readUTF());
setFailed(fNull && input.readBoolean());
}

// Accessor for the property "SnapshotName"
Expand All @@ -30851,15 +30682,6 @@ public void setSnapshotName(String sSnapshotName)
__m_SnapshotName = sSnapshotName;
}

/**
* Set to true if SnapshotListRequest should retrieve list
* of failed snapshots.
*/
public void setFailed(boolean bFailed)
{
__m_failed = bFailed;
}

// Declared at the super level
public void write(com.tangosol.io.WriteBuffer.BufferOutput output)
throws java.io.IOException
Expand All @@ -30872,10 +30694,6 @@ public void write(com.tangosol.io.WriteBuffer.BufferOutput output)
{
output.writeUTF(getSnapshotName());
}
if (fNull)
{
output.writeBoolean(getFailed());
}
}

// ---- class: com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService$SnapshotListRequest$Poll
Expand Down Expand Up @@ -30904,10 +30722,6 @@ public static class Poll
*/
private transient java.util.Set __m_Snapshots;

/**
* The set of failed snapshot names returned by the SnapshotListRequests.
*/
private transient java.util.Set __m_FailedSnapshots;
/**
* Property Stores
*
Expand Down Expand Up @@ -31007,15 +30821,6 @@ public java.util.Set getSnapshots()
return __m_Snapshots;
}

/**
* The set of names of failed snapshots
* returned by the SnapshotListRequests.
*/
public java.util.Set getFailedSnapshots()
{
return __m_FailedSnapshots;
}

// Accessor for the property "Stores"
/**
* Getter for property Stores.<p>
Expand All @@ -31040,18 +30845,13 @@ protected void onCompletion()
// import java.util.Map;
// import java.util.Set;

Set setSnapshots = getSnapshots();
Set setFailedSnapshots = getFailedSnapshots();
Map mapStores = getStores();
Set setSnapshots = getSnapshots();
Map mapStores = getStores();

if (setSnapshots != null)
{
setResult(setSnapshots.toArray(new String[setSnapshots.size()]));
}
else if (setFailedSnapshots != null)
{
setResult(setFailedSnapshots.toArray(new String[setFailedSnapshots.size()]));
}
else
{
setResult(mapStores);
Expand Down Expand Up @@ -31096,25 +30896,6 @@ public void onResponse(com.tangosol.coherence.component.net.Message msg)
setSnapshots.add(asSnapshots[i]);
}
}
else if (PartitionedService.SnapshotListRequest.RESPONSE_FAILED_SNAPSHOTS.equals(oResult[0]))
{
// list of snapshots was asked for
Set setFailedSnapshots = getFailedSnapshots();
if (setFailedSnapshots == null)
{
setFailedSnapshots = new TreeSet();
setFailedSnapshots(setFailedSnapshots);
}

Object[] asFailedSnapshots = (Object[]) oResult[1]; // logically String[] but POF widens it
if (asFailedSnapshots != null)
{
for (int i = 0, c = asFailedSnapshots.length; i < c; i++)
{
setFailedSnapshots.add(asFailedSnapshots[i]);
}
}
}
else
{
// list of stores per snapshot was asked for from each member.
Expand Down Expand Up @@ -31152,14 +30933,6 @@ public void setSnapshots(java.util.Set setSnapshots)
{
__m_Snapshots = setSnapshots;
}

/**
* Set the names of failed snapshots returned by the SnapshotListRequests.
*/
public void setFailedSnapshots(java.util.Set setFailedSnapshots)
{
__m_FailedSnapshots = setFailedSnapshots;
}

// Accessor for the property "Stores"
/**
Expand Down
Loading

0 comments on commit 821a24a

Please sign in to comment.