This is an automated email from the ASF dual-hosted git repository.
hemant pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new d02fcf7218 HDDS-9685. Handle IllegalStateException in
OMSnapshotCreateRequest (#5598)
d02fcf7218 is described below
commit d02fcf7218709fa46877923e375c73330c901052
Author: Hemant Kumar <[email protected]>
AuthorDate: Mon Nov 13 18:34:59 2023 -0800
HDDS-9685. Handle IllegalStateException in OMSnapshotCreateRequest (#5598)
---
.../request/snapshot/OMSnapshotCreateRequest.java | 25 +++++++++++-----------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotCreateRequest.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotCreateRequest.java
index 0dcce3cf11..4e706e9b90 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotCreateRequest.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotCreateRequest.java
@@ -191,7 +191,7 @@ public class OMSnapshotCreateRequest extends
OMClientRequest {
.setSnapshotInfo(snapshotInfo.getProtobuf()));
omClientResponse = new OMSnapshotCreateResponse(
omResponse.build(), snapshotInfo);
- } catch (IOException | InvalidPathException ex) {
+ } catch (IOException | InvalidPathException | IllegalStateException ex) {
exception = ex;
omClientResponse = new OMSnapshotCreateResponse(
createErrorOMResponse(omResponse, exception));
@@ -243,7 +243,9 @@ public class OMSnapshotCreateRequest extends
OMClientRequest {
* it was removed at T-5.
*/
private void addSnapshotInfoToSnapshotChainAndCache(
- OmMetadataManagerImpl omMetadataManager, long transactionLogIndex) {
+ OmMetadataManagerImpl omMetadataManager,
+ long transactionLogIndex
+ ) throws IOException {
// It is synchronized on SnapshotChainManager object so that this block is
// synchronized with OMSnapshotPurgeResponse#cleanupSnapshotChain and only
// one of these two operation gets executed at a time otherwise we could be
@@ -252,21 +254,20 @@ public class OMSnapshotCreateRequest extends
OMClientRequest {
SnapshotChainManager snapshotChainManager =
omMetadataManager.getSnapshotChainManager();
- try {
- UUID latestPathSnapshot =
- snapshotChainManager.getLatestPathSnapshotId(snapshotPath);
- UUID latestGlobalSnapshot =
- snapshotChainManager.getLatestGlobalSnapshotId();
+ UUID latestPathSnapshot =
+ snapshotChainManager.getLatestPathSnapshotId(snapshotPath);
+ UUID latestGlobalSnapshot =
+ snapshotChainManager.getLatestGlobalSnapshotId();
- snapshotInfo.setPathPreviousSnapshotId(latestPathSnapshot);
- snapshotInfo.setGlobalPreviousSnapshotId(latestGlobalSnapshot);
+ snapshotInfo.setPathPreviousSnapshotId(latestPathSnapshot);
+ snapshotInfo.setGlobalPreviousSnapshotId(latestGlobalSnapshot);
+ try {
snapshotChainManager.addSnapshot(snapshotInfo);
-
omMetadataManager.getSnapshotInfoTable()
.addCacheEntry(new CacheKey<>(snapshotInfo.getTableKey()),
CacheValue.get(transactionLogIndex, snapshotInfo));
- } catch (IllegalStateException illegalStateException) {
+ } catch (Exception exception) {
// Remove snapshot from the SnapshotChainManager in case of any
failure.
// It is possible that createSnapshot request fails after snapshot gets
// added to snapshot chain manager because couldn't add it to cache/DB.
@@ -279,7 +280,7 @@ public class OMSnapshotCreateRequest extends
OMClientRequest {
// added to the SnapshotInfo table.
removeSnapshotInfoFromSnapshotChainManager(snapshotChainManager,
snapshotInfo);
- throw illegalStateException;
+ throw new IOException(exception.getMessage(), exception);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]