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 7b4081e796790..72a2182aef65c 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 @@ -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 * @@ -28478,26 +28465,6 @@ protected long getSnapshotNamesExpire() return __m_SnapshotNamesExpire; } - /** - * Getter for property SnapshotFailures.

- * 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. @@ -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 where the key is the member id * and the value is the list of stores that are known by all members @@ -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 @@ -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. @@ -29358,32 +29244,6 @@ protected void setSnapshotNamesExpire(long ldtExpire) { __m_SnapshotNamesExpire = ldtExpire; } - - // Accessor for the property "SnapshotFailures" - /** - * Setter for property SnapshotFailures.

- * 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" /** @@ -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 @@ -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() { @@ -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 { @@ -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" @@ -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 @@ -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 @@ -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 * @@ -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.

@@ -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); @@ -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. @@ -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" /** diff --git a/prj/coherence-core/src/main/java/com/tangosol/internal/management/resources/PersistenceResource.java b/prj/coherence-core/src/main/java/com/tangosol/internal/management/resources/PersistenceResource.java index 01046abc17572..fcf0e9f7d9b69 100644 --- a/prj/coherence-core/src/main/java/com/tangosol/internal/management/resources/PersistenceResource.java +++ b/prj/coherence-core/src/main/java/com/tangosol/internal/management/resources/PersistenceResource.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. @@ -38,9 +38,6 @@ public void addRoutes(RequestRouter router, String sPathRoot) { router.addGet(sPathRoot, this::get); router.addGet(sPathRoot + "/snapshots", this::getSnapshots); - router.addGet(sPathRoot + "/snapshots/{" + SNAPSHOT_NAME + "}/status", this::getSnapshotStatus); - router.addGet(sPathRoot + "/snapshots/{" + SNAPSHOT_NAME + "}/recover/status", this::getSnapshotRecoveryStatus); - router.addGet(sPathRoot + "/failedSnapshots", this::getFailedSnapshots); router.addGet(sPathRoot + "/archives", this::getArchives); router.addGet(sPathRoot + "/archiveStores/{" + SNAPSHOT_NAME + "}", this::getArchiveStores); @@ -80,17 +77,6 @@ public Response getSnapshots(HttpRequest request) filterAttributes, getLinksFilter(request))); } - /** - * Return list of failed snapshots for a service. - * - * @return the response object - */ - public Response getFailedSnapshots(HttpRequest request) - { - return response(getResponseFromMBeanOperation(request, getQuery(request), - "items", "listFailedSnapshots", null, null)); - } - /** * Return list of archived snapshots of a service. * @@ -117,34 +103,6 @@ public Response getArchiveStores(HttpRequest request) "archiveStores", "listArchivedSnapshotStores", aoArguments, asSignature)); } - /** - * Return the status of the specific snapshot. - * - * @return the response object - */ - public Response getSnapshotStatus(HttpRequest request) - { - String sSnapshotName = request.getFirstPathParameter(SNAPSHOT_NAME); - String[] asSignature = {String.class.getName()}; - Object[] aoArguments = {sSnapshotName}; - return response(getResponseFromMBeanOperation(request, getQuery(request), - "status" , "getSnapshotStatus", aoArguments, asSignature)); - } - - /** - * Return the recovery status of the specific snapshot. - * - * @return the response object - */ - public Response getSnapshotRecoveryStatus(HttpRequest request) - { - String sSnapshotName = request.getFirstPathParameter(SNAPSHOT_NAME); - String[] asSignature = {String.class.getName()}; - Object[] aoArguments = {sSnapshotName}; - return response(getResponseFromMBeanOperation(request, getQuery(request), - "status" , "getSnapshotRecoveryStatus", aoArguments, asSignature)); - } - // ----- Post API ------------------------------------------------------- /** diff --git a/prj/coherence-core/src/main/java/com/tangosol/persistence/CachePersistenceHelper.java b/prj/coherence-core/src/main/java/com/tangosol/persistence/CachePersistenceHelper.java index 5fa68ac0736db..80f1bbb55fdfa 100644 --- a/prj/coherence-core/src/main/java/com/tangosol/persistence/CachePersistenceHelper.java +++ b/prj/coherence-core/src/main/java/com/tangosol/persistence/CachePersistenceHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. + * Copyright (c) 2000, 2022, Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at * https://oss.oracle.com/licenses/upl. @@ -9,7 +9,6 @@ import com.oracle.coherence.common.base.Logger; import com.oracle.coherence.persistence.FatalAccessException; -import com.oracle.coherence.persistence.PersistenceEnvironment; import com.oracle.coherence.persistence.PersistenceException; import com.oracle.coherence.persistence.PersistentStore; @@ -47,7 +46,6 @@ import com.tangosol.net.partition.PartitionSet; import com.tangosol.net.partition.VersionAwareMapListener; -import com.tangosol.persistence.bdb.BerkeleyDBEnvironment; import com.tangosol.persistence.bdb.BerkeleyDBManager; import com.tangosol.util.Base; @@ -66,16 +64,9 @@ import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.FileWriter; import java.io.IOException; -import java.io.Reader; -import java.io.Writer; -import java.util.ArrayList; -import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -1518,145 +1509,6 @@ public ReadBuffer visitFromKey() }; } - public static void recordRecoveryStatus(PersistenceEnvironment env, String sSnapshot, boolean bRecoverySuccess, String sReason) - { - if (!(env instanceof BerkeleyDBEnvironment)) - { - return; - } - - File dirSnapshots = ((BerkeleyDBEnvironment) env).getPersistenceSnapshotDirectory(); - Properties props = new Properties(); - props.setProperty(RECOVERY_META_VERSION, "0"); - props.setProperty(RECOVERY_META_STATUS_PROPERTY, - bRecoverySuccess - ? RECOVERY_STATUS_SUCCESS - : String.format("%s: %s", RECOVERY_STATUS_FAILURE, sReason)); - Writer writer = null; - try - { - File propsFile = dirSnapshots.toPath().resolve(sSnapshot).resolve(RECOVERY_META_FILENAME).toFile(); - writer = new FileWriter(propsFile); - props.store(writer, RECOVERY_META_HEADER); - } - catch (IOException e) - { - Logger.fine(String.format("Cannot write properties file %s for snapshot '%s'", RECOVERY_META_FILENAME, sSnapshot)); - } - finally - { - if (writer != null) - { - try - { - writer.close(); - } - catch (IOException ignored) - { - } - } - } - } - - /** - * Return snapshot status. - * - * @param env the {@link PersistenceEnvironment} to query - * @param sName the snapshot name - * - * @return the snapshot status, or null if it is not possible - * to obtain the status. - */ - public static String getSnapshotStatus(PersistenceEnvironment env, String sName) - { - if (!(env instanceof BerkeleyDBEnvironment)) - { - return null; - } - - File dirSnapshot = new File(((BerkeleyDBEnvironment) env).getPersistenceSnapshotDirectory(), sName); - if (!dirSnapshot.isDirectory() || !dirSnapshot.canRead() || !dirSnapshot.canExecute()) - { - return SNAPSHOT_STATUS_NOT_FOUND; - } - - try - { - getSnapshotPersistenceTools(dirSnapshot).validate(); - } - catch (RuntimeException e) - { - Throwable cause = e.getCause(); - return String.format("%s: %s", RECOVERY_STATUS_FAILURE, cause == null ? e.getMessage() : cause.getMessage()); - } - return SNAPSHOT_STATUS_COMPLETED; - } - - /** - * Return recovery status for the given snapshot. - * - * @param env the {@link PersistenceEnvironment} to query - * @param sName the snapshot name - * - * @return the snapshot recovery status, or null if it is not - * possible to obtain the status. - */ - public static String getSnapshotRecoveryStatus(PersistenceEnvironment env, String sName) - { - if (!(env instanceof BerkeleyDBEnvironment)) - { - return null; - } - - File dirSnapshot = new File(((BerkeleyDBEnvironment) env).getPersistenceSnapshotDirectory(), sName); - if (!dirSnapshot.isDirectory() || !dirSnapshot.canRead() || !dirSnapshot.canExecute()) - { - return SNAPSHOT_STATUS_NOT_FOUND; - } - - try (Reader reader = new FileReader(new File(dirSnapshot, RECOVERY_META_FILENAME))) - { - Properties props = new Properties(); - props.load(reader); - return props.getProperty(RECOVERY_META_STATUS_PROPERTY); - } - catch (FileNotFoundException e) - { - return SNAPSHOT_STATUS_NOT_FOUND; - } - catch (IOException | RuntimeException e) - { - return String.format("%s: %s", RECOVERY_STATUS_FAILURE, e.getMessage()); - } - } - - public static String[] getFailedSnapshots(PersistenceEnvironment env) - { - PersistenceEnvironment persistEnv = SafePersistenceWrappers.unwrap(env); - if (!(persistEnv instanceof BerkeleyDBEnvironment)) - { - return null; - } - - // respond with list of failed snapshots - File dirSnapshots = ((BerkeleyDBEnvironment) persistEnv).getPersistenceSnapshotDirectory(); - String[] asSnapshots = persistEnv.listSnapshots(); - - List asFailedSnapshots = new ArrayList<>(); - for (String sName : asSnapshots) - { - File dirSnapshot = new File(dirSnapshots, sName); - try - { - getSnapshotPersistenceTools(dirSnapshot).validate(); - } - catch (RuntimeException e) - { - asFailedSnapshots.add(sName); - } - } - return asFailedSnapshots.toArray(FAILED_SNAPSHOTS); - } // ----- inner interface: Visitor ------------------------------------- @@ -1897,49 +1749,4 @@ public static interface Visitor * The marker Binary to represent a "false" binary value. */ private static final Binary BINARY_FALSE = new Binary(new byte[] { 0x0 }); - - /** - * Avoid allocating immutable array of strings. - */ - private static final String[] FAILED_SNAPSHOTS = new String[0]; - - /** - * The status to represent completed snapshot. - */ - static final String SNAPSHOT_STATUS_COMPLETED = "Completed"; - - /** - * The status to represent missing snapshot. - */ - static final String SNAPSHOT_STATUS_NOT_FOUND = "Not found"; - - /** - * Snapshot recovery status metadata filename. - */ - static final String RECOVERY_META_FILENAME = "recovery.properties"; - - /** - * Snapshot recovery status metadata property: implementation version. - */ - static final String RECOVERY_META_VERSION = "implementation.version"; - - /** - * Snapshot recovery status metadata property: header. - */ - static final String RECOVERY_META_HEADER = "Recovery status"; - - /** - * Snapshot recovery status metadata property: recovery status. - */ - static final String RECOVERY_META_STATUS_PROPERTY = "recovery"; - - /** - * Snapshot recovery status: success. - */ - static final String RECOVERY_STATUS_SUCCESS = "Succeeded"; - - /** - * Snapshot recovery status: failure. - */ - static final String RECOVERY_STATUS_FAILURE = "Failed"; } diff --git a/prj/coherence-core/src/main/java/com/tangosol/persistence/PersistenceManagerMBean.java b/prj/coherence-core/src/main/java/com/tangosol/persistence/PersistenceManagerMBean.java index 8e7c026e4e582..e287a3a1710b3 100644 --- a/prj/coherence-core/src/main/java/com/tangosol/persistence/PersistenceManagerMBean.java +++ b/prj/coherence-core/src/main/java/com/tangosol/persistence/PersistenceManagerMBean.java @@ -6,6 +6,8 @@ */ package com.tangosol.persistence; +import com.tangosol.net.management.Registry; + import com.tangosol.net.management.annotation.Description; import com.tangosol.net.management.annotation.Notification; @@ -74,14 +76,6 @@ public interface PersistenceManagerMBean @Description("The list of snapshot identifiers that are available to recover from.") public String[] getSnapshots(); - /** - * Return a list of failed snapshots. - * - * @return a list of failed snapshots - */ - @Description("The list of failed snapshot identifiers.") - public String[] listFailedSnapshots(); - // ----- snapshot operations -------------------------------------------- /** @@ -114,22 +108,6 @@ public interface PersistenceManagerMBean "Subscribe to JMX notifications to see the status of the operation.") public void removeSnapshot(@Description("sName") String sName); - /** - * Return the status of the specific snapshot. - * - * @return the status of the specific snapshot - */ - @Description("The status of the specific snapshot.") - public String getSnapshotStatus(@Description("sName") String sName); - - /** - * Return the recovery status of the specific snapshot. - * - * @return the recovery status of the specific snapshot - */ - @Description("The recovery status of the specific snapshot.") - public String getSnapshotRecoveryStatus(@Description("sName") String sName); - // ----- archive operations --------------------------------------------- /** diff --git a/prj/coherence-core/src/main/resources/management-swagger.json b/prj/coherence-core/src/main/resources/management-swagger.json index 49aea1acdbce7..6e5704ae0fc2f 100644 --- a/prj/coherence-core/src/main/resources/management-swagger.json +++ b/prj/coherence-core/src/main/resources/management-swagger.json @@ -3467,108 +3467,6 @@ } } }, - "/management/coherence/cluster/services/{serviceName}/persistence/snapshots/{snapshotName}/status": { - "get": { - "tags": [ - "Persistence" - ], - "summary": "View Snapshot Status", - "description": "Use this endpoint to view a snapshot status.", - "operationId": "/management/coherence/cluster/services/{serviceName}/persistence/snapshots/{snapshotName}/status GET", - "produces": [ - "application/json" - ], - "parameters": [ - { - "$ref": "#/parameters/serviceName" - }, - { - "$ref": "#/parameters/snapshotName" - } - ], - "responses": { - "200": { - "description": "A snapshot status", - "schema": { - "type": "object", - "properties": { - "status": { - "type": "string" - } - } - } - } - } - } - }, - "/management/coherence/cluster/services/{serviceName}/persistence/snapshots/{snapshotName}/recover/status": { - "get": { - "tags": [ - "Persistence" - ], - "summary": "View Snapshot Recovery Status", - "description": "Use this endpoint to view a snapshot recovery status.", - "operationId": "/management/coherence/cluster/services/{serviceName}/persistence/snapshots/{snapshotName}/recover/status GET", - "produces": [ - "application/json" - ], - "parameters": [ - { - "$ref": "#/parameters/serviceName" - }, - { - "$ref": "#/parameters/snapshotName" - } - ], - "responses": { - "200": { - "description": "A snapshot recovery status", - "schema": { - "type": "object", - "properties": { - "status": { - "type": "string" - } - } - } - } - } - } - }, - "/management/coherence/cluster/services/{serviceName}/persistence/failedSnapshots": { - "get": { - "tags": [ - "Persistence" - ], - "summary": "View Failed Snapshots", - "description": "Use this endpoint to view a list of identifiers of failed snapshots.", - "operationId": "/management/coherence/cluster/services/{serviceName}/persistence/failedSnapshots GET", - "produces": [ - "application/json" - ], - "parameters": [ - { - "$ref": "#/parameters/serviceName" - } - ], - "responses": { - "200": { - "description": "A successful request that returns a list of failed snapshots", - "schema": { - "type": "object", - "properties": { - "snapshots": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - }, "/management/coherence/cluster/services/{serviceName}/persistence/snapshots/{snapshotName}": { "post": { "tags": [ @@ -6690,7 +6588,7 @@ "member": { "type": "string", "description": "Name of the cluster member" - }, + }, "autoStart": { "type": "boolean", "description": "True when the Reporter starts automatically with the node.", diff --git a/prj/test/functional/management/src/main/java/management/BaseManagementInfoResourceTests.java b/prj/test/functional/management/src/main/java/management/BaseManagementInfoResourceTests.java index f96f7385126c8..b214676ddfe99 100644 --- a/prj/test/functional/management/src/main/java/management/BaseManagementInfoResourceTests.java +++ b/prj/test/functional/management/src/main/java/management/BaseManagementInfoResourceTests.java @@ -74,7 +74,6 @@ import com.oracle.coherence.testing.AbstractTestInfrastructure; import java.math.BigDecimal; -import java.nio.file.Paths; import org.hamcrest.CoreMatchers; import org.hamcrest.Description; @@ -111,7 +110,6 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.io.RandomAccessFile; import java.io.UnsupportedEncodingException; import java.lang.management.GarbageCollectorMXBean; @@ -179,7 +177,6 @@ import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.anyOf; -import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThanOrEqualTo; @@ -3196,109 +3193,10 @@ public void testPersistence() return null; }); - // add some data - f_inClusterInvoker.accept(f_sClusterName, null, () -> - { - NamedCache cache = CacheFactory.getCache(sCacheName); - for (int i = 0; i < 10; i++) - { - cache.put(i, i); - } - assertThat(cache.size(), greaterThan(00)); - return null; - }); - - // create an damaged snapshot - createSnapshot("damaged"); - ensureServiceStatusIdle(); - - // assert the snapshot exists - Eventually.assertDeferred(() -> assertSnapshotExists("damaged", SNAPSHOTS), is(true)); - Thread.sleep(5000); - - // assert the snapshot status - WebTarget target = getBaseTarget().path(SERVICES).path(getScopedServiceName(ACTIVE_SERVICE)).path(PERSISTENCE).path(SNAPSHOTS).path("damaged").path("status"); - response = target.request(MediaType.APPLICATION_JSON_TYPE).get(); - Map mapResponse = readEntity(target, response); - assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode())); - assertThat(mapResponse.get("status"), is("Completed")); - response.close(); - ensureServiceStatusIdle(); - - // recovery not attempted - target = getBaseTarget().path(SERVICES).path(getScopedServiceName(ACTIVE_SERVICE)).path(PERSISTENCE).path(SNAPSHOTS).path("damaged").path("recover").path("status"); - response = target.request(MediaType.APPLICATION_JSON_TYPE).get(); - mapResponse = readEntity(target, response); - assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode())); - assertThat(mapResponse.get("status"), is("Not found")); - response.close(); - ensureServiceStatusIdle(); - - // recover snapshot - response = getBaseTarget().path(SERVICES).path(getScopedServiceName(ACTIVE_SERVICE)).path(PERSISTENCE).path(SNAPSHOTS).path("damaged").path("recover") - .request().post(null); - assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode())); - response.close(); - ensureServiceStatusIdle(); - - // assert recovery status - target = getBaseTarget().path(SERVICES).path(getScopedServiceName(ACTIVE_SERVICE)).path(PERSISTENCE).path(SNAPSHOTS).path("damaged").path("recover").path("status"); - response = target.request(MediaType.APPLICATION_JSON_TYPE).get(); - mapResponse = readEntity(target, response); - assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode())); - assertThat(mapResponse.get("status"), is("Succeeded")); - response.close(); - ensureServiceStatusIdle(); - - // assert failed snapshots - target = getBaseTarget().path(SERVICES).path(getScopedServiceName(ACTIVE_SERVICE)).path(PERSISTENCE).path(FAILED_SNAPSHOTS); - response = target.request(MediaType.APPLICATION_JSON_TYPE).get(); - mapResponse = readEntity(target, response); - assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode())); - - assertThat((List) mapResponse.get("items"), not(contains("damaged"))); - response.close(); - ensureServiceStatusIdle(); - - // damage snapshot - List subfolders = Arrays.stream(Paths.get(m_dirSnapshot.getAbsolutePath(), CLUSTER_NAME, FileHelper.toFilename(getScopedServiceName(ACTIVE_SERVICE)), "damaged").toFile() - .listFiles(file -> file.isDirectory() && !file.getName().startsWith("."))).collect(Collectors.toList()); - int i = 0; - for(File subfolder : subfolders) - { - if (i++ % 3 == 0) - { - File jdbFile = new File(subfolder,"00000000.jdb"); - if (jdbFile.exists()) - { - try(RandomAccessFile writer = new RandomAccessFile(jdbFile, "rw")) - { - writer.seek(300); - writer.writeBytes(" "); - } - } - } - } - - // assert failed snapshots - target = getBaseTarget().path(SERVICES).path(getScopedServiceName(ACTIVE_SERVICE)).path(PERSISTENCE).path(FAILED_SNAPSHOTS); - response = target.request(MediaType.APPLICATION_JSON_TYPE).get(); - mapResponse = readEntity(target, response); - assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode())); - - assertThat((List) mapResponse.get("items"), hasItem("damaged")); - response.close(); - ensureServiceStatusIdle(); - - // now delete the 3 snapshots + // now delete the 2 snapshots deleteSnapshot("2-entries"); deleteSnapshot("empty"); - deleteSnapshot("damaged"); - } - catch (InterruptedException | IOException e) - { - throw new RuntimeException(e); } finally { @@ -5031,11 +4929,6 @@ protected static boolean isReadOnly() */ protected static final String SNAPSHOTS = "snapshots"; - /** - * The failed snapshots path. - */ - protected static final String FAILED_SNAPSHOTS = "failedSnapshots"; - /** * The archives path. */