This is an automated email from the ASF dual-hosted git repository.
devmadhuu pushed a commit to branch HDDS-11233
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/HDDS-11233 by this push:
new e9f780f0b15 HDDS-17374. Handle old clients not passing StoragePolicy
in allocateBlock (#11716)
e9f780f0b15 is described below
commit e9f780f0b156ce414e1f2a905cd7fa487b81f382
Author: Anurag Parvatikar <[email protected]>
AuthorDate: Thu Nov 19 14:37:07 2026 +0530
HDDS-17374. Handle old clients not passing StoragePolicy in allocateBlock
(#11716)
---
.../ozone/client/rpc/TestOzoneStoragePolicy.java | 61 +++++++++++
.../om/request/key/OMAllocateBlockRequest.java | 53 ++++++++--
.../ozone/om/request/OMRequestTestUtils.java | 13 +++
.../om/request/key/TestOMAllocateBlockRequest.java | 111 +++++++++++++++++++--
.../key/TestOMAllocateBlockRequestWithFSO.java | 4 +-
5 files changed, 225 insertions(+), 17 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneStoragePolicy.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneStoragePolicy.java
index bfeb41ec65d..8803b63902c 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneStoragePolicy.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneStoragePolicy.java
@@ -27,6 +27,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -55,6 +56,7 @@
import org.apache.hadoop.hdds.scm.container.ContainerInfo;
import org.apache.hadoop.hdds.scm.container.ContainerManager;
import org.apache.hadoop.hdds.scm.container.ContainerReplicaInfo;
+import org.apache.hadoop.hdds.scm.container.common.helpers.ExcludeList;
import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
import org.apache.hadoop.hdds.scm.pipeline.PipelineManager;
import org.apache.hadoop.hdds.scm.storage.ContainerProtocolCalls;
@@ -83,6 +85,8 @@
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo;
import org.apache.hadoop.ozone.om.helpers.OmMultipartInfo;
+import org.apache.hadoop.ozone.om.helpers.OpenKeySession;
+import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol;
import org.apache.ozone.test.GenericTestUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
@@ -482,6 +486,63 @@ private void waitForReplicaReports(ScmClient scmClient,
OzoneKeyDetails keyDetai
}
}
+ /**
+ * An older client does not send the storage policy in allocateBlock. If the
bucket policy changes
+ * while such a client writes a key, the next blocks must stay on the tier
of the key's policy.
+ *
+ * <p>The current client always sends the policy, so this test calls the OM
protocol directly and
+ * leaves the policy out of {@link OmKeyArgs}, as an older client does. The
key opens while the
+ * bucket policy is HOT. The bucket policy then changes to COLD. If OM
resolved the policy from
+ * the bucket, the next block would go to the ARCHIVE tier instead of the
SSD tier.
+ */
+ @Test
+ public void testOldClientAllocateBlockKeepsKeyPolicyWhenBucketPolicyChanges()
+ throws Exception {
+ startCluster(allTierTopology(RATIS_THREE.getRequiredNodes()));
+
+ OzoneBucket bucket =
+ createBucket(OzoneStoragePolicy.HOT, BucketLayout.OBJECT_STORE);
+ OzoneManagerProtocol omClient =
store.getClientProxy().getOzoneManagerClient();
+ OmKeyArgs oldClientKeyArgs = new OmKeyArgs.Builder()
+ .setVolumeName(bucket.getVolumeName())
+ .setBucketName(bucket.getName())
+ .setKeyName(UUID.randomUUID().toString())
+ .setReplicationConfig(RATIS_THREE)
+ .setDataSize(1)
+ .setAcls(new ArrayList<>())
+ .setOwnerName("ownerName")
+ .build();
+
+ // The older client opens the key. The size is not 0, so OM pre-allocates
the first block.
+ OpenKeySession session = omClient.openKey(oldClientKeyArgs);
+
assertThat(session.getKeyInfo().getStoragePolicy()).isEqualTo(OzoneStoragePolicy.HOT);
+ List<OmKeyLocationInfo> initialBlocks =
+
session.getKeyInfo().getLatestVersionLocations().getBlocksLatestVersionOnly();
+ assertThat(initialBlocks).hasSize(1);
+ assertBlockOnTier(initialBlocks.get(0),
OzoneStoragePolicy.HOT.getCreationTier());
+
+ // The bucket policy changes while the key is still open.
+ bucket.setStoragePolicy(OzoneStoragePolicy.COLD);
+
assertThat(store.getVolume(bucket.getVolumeName()).getBucket(bucket.getName()).getStoragePolicy())
+ .isEqualTo(OzoneStoragePolicy.COLD);
+
+ // The older client asks for the next block, again without a policy.
+ OmKeyLocationInfo nextBlock =
+ omClient.allocateBlock(oldClientKeyArgs, session.getId(), new
ExcludeList());
+
+ // The block must follow the key's policy (HOT), not the new bucket policy
(COLD).
+ assertBlockOnTier(nextBlock, OzoneStoragePolicy.HOT.getCreationTier());
+ }
+
+ private void assertBlockOnTier(OmKeyLocationInfo block, StorageTier
expectedTier)
+ throws IOException {
+ ContainerInfo containerInfo = containerManager.getContainer(
+ ContainerID.valueOf(block.getContainerID()));
+ assertThat(containerInfo.getStorageTier().getUniformStorageType())
+ .as("Mismatch in storage tier of container %s, which holds the block",
block.getContainerID())
+ .isEqualTo(expectedTier.getUniformStorageType());
+ }
+
/**
* Checks every block of a key landed on a container of the expected tier.
The
* {@code assertDatanodeContainerAndBlock} helper only inspects the first
block, which cannot
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMAllocateBlockRequest.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMAllocateBlockRequest.java
index 740365a696f..913da9a175c 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMAllocateBlockRequest.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMAllocateBlockRequest.java
@@ -28,7 +28,9 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import org.apache.hadoop.hdds.client.OzoneStoragePolicy;
import org.apache.hadoop.hdds.client.ReplicationConfig;
+import org.apache.hadoop.hdds.client.StoragePolicy;
import org.apache.hadoop.hdds.scm.container.common.helpers.ExcludeList;
import org.apache.hadoop.hdds.utils.db.cache.CacheKey;
import org.apache.hadoop.hdds.utils.db.cache.CacheValue;
@@ -97,6 +99,8 @@ public OMRequest preExecute(OzoneManager ozoneManager) throws
IOException {
// TODO: Here we are allocating block with out any check for key exist in
// open table or not and also with out any authorization checks.
+ // When the request doesn't carry a storage policy, key existence in the
+ // open table is verified.
// Assumption here is that allocateBlocks with out openKey will be less.
// There is a chance some one can misuse this api to flood allocateBlock
// calls. But currently allocateBlock is internally called from
@@ -106,14 +110,8 @@ public OMRequest preExecute(OzoneManager ozoneManager)
throws IOException {
UserInfo userInfo = getUserIfNotExists(ozoneManager);
ReplicationConfig repConfig =
ReplicationConfig.fromProto(keyArgs.getType(),
keyArgs.getFactor(), keyArgs.getEcReplicationConfig());
- // To allocate atleast one block passing requested size and scmBlockSize
- // as same value. When allocating block requested size is same as
- // scmBlockSize.
final OmBucketInfo bucketInfo = ozoneManager
.getBucketInfo(keyArgs.getVolumeName(), keyArgs.getBucketName());
- final List<OmKeyLocationInfo> omKeyLocationInfoList =
allocateBlock(repConfig, excludeList,
- ozoneManager.getScmBlockSize(), keyArgs.getSortDatanodes(), userInfo,
ozoneManager,
- getStoragePolicy(bucketInfo, keyArgs),
getAllowFallbackStoragePolicy(bucketInfo));
// Set modification time and normalize key if required.
KeyArgs.Builder newKeyArgs =
@@ -123,6 +121,23 @@ public OMRequest preExecute(OzoneManager ozoneManager)
throws IOException {
resolveBucketAndCheckOpenKeyAcls(newKeyArgs.build(), ozoneManager,
ACLType.WRITE, allocateBlockRequest.getClientID());
+ // Older clients do not send the storage policy in allocateBlock. Use the
policy stored on the open key so that
+ // a bucket policy change during the write does not move later blocks to
another tier.
+ // Example: the bucket policy is HOT when an older client opens the key,
so the first blocks go to the SSD tier.
+ // The bucket policy then changes to COLD. The next allocateBlock request
has no policy, so OM would use COLD
+ // and put the next blocks of the same key on the ARCHIVE tier.
+ // To prevent this, use the policy stored on the open key.
+ // A newer client will always send the storage policy resolved by the OM.
+ final StoragePolicy storagePolicy = resolveStoragePolicy(ozoneManager,
bucketInfo, resolvedKeyArgs,
+ allocateBlockRequest.getClientID());
+
+ // To allocate atleast one block passing requested size and scmBlockSize
+ // as same value. When allocating block requested size is same as
+ // scmBlockSize.
+ final List<OmKeyLocationInfo> omKeyLocationInfoList =
allocateBlock(repConfig, excludeList,
+ ozoneManager.getScmBlockSize(), keyArgs.getSortDatanodes(), userInfo,
ozoneManager,
+ storagePolicy, getAllowFallbackStoragePolicy(bucketInfo));
+
AllocateBlockRequest.Builder newAllocatedBlockRequest =
AllocateBlockRequest.newBuilder()
.setClientID(allocateBlockRequest.getClientID())
@@ -143,6 +158,32 @@ public OMRequest preExecute(OzoneManager ozoneManager)
throws IOException {
}
+ /**
+ * Picks the storage policy for the block: the one sent by the client, else
the one stored on the open key, else
+ * the bucket policy, else the default policy.
+ */
+ private StoragePolicy resolveStoragePolicy(OzoneManager ozoneManager,
OmBucketInfo bucketInfo,
+ KeyArgs resolvedKeyArgs, long clientID) throws IOException {
+ if (resolvedKeyArgs.hasStoragePolicy()) {
+ return OzoneStoragePolicy.fromProto(resolvedKeyArgs.getStoragePolicy());
+ }
+ // The client did not send the policy back (older client, or the key was
opened without one). Use the policy
+ // stored on the open key, so the bucket policy changing in the meantime
does not move the next block to
+ // another tier.
+ final OMMetadataManager omMetadataManager =
ozoneManager.getMetadataManager();
+ final String openKeyName = getOpenKeyName(resolvedKeyArgs.getVolumeName(),
resolvedKeyArgs.getBucketName(),
+ resolvedKeyArgs.getKeyName(), clientID, omMetadataManager);
+ final OmKeyInfo openKeyInfo = getOpenKeyInfo(omMetadataManager,
openKeyName, resolvedKeyArgs.getKeyName());
+ if (openKeyInfo == null) {
+ throw new OMException("Open Key not found " + openKeyName,
KEY_NOT_FOUND);
+ }
+ if (openKeyInfo.getStoragePolicy() != null) {
+ return openKeyInfo.getStoragePolicy();
+ }
+ // The key was opened before storage policy support was finalized and has
no policy.
+ return getStoragePolicy(bucketInfo, resolvedKeyArgs);
+ }
+
@Override
public final OMClientResponse validateAndUpdateCache(OzoneManager
ozoneManager, ExecutionContext context) {
final long trxnLogIndex = context.getIndex();
diff --git
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/OMRequestTestUtils.java
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/OMRequestTestUtils.java
index 894a0253d8b..0b0ae1a1dc7 100644
---
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/OMRequestTestUtils.java
+++
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/OMRequestTestUtils.java
@@ -157,6 +157,19 @@ public static void addVolumeAndBucketToDB(
addBucketToDB(omMetadataManager, builder);
}
+ /** Adds the volume (if missing) and a bucket with the given storage policy
and fallback flag to the OM DB. */
+ public static OmBucketInfo addVolumeAndBucketToDB(String volumeName, String
bucketName,
+ OMMetadataManager omMetadataManager, BucketLayout bucketLayout,
StoragePolicy storagePolicy,
+ boolean allowFallbackStoragePolicy) throws Exception {
+ if
(!omMetadataManager.getVolumeTable().isExist(omMetadataManager.getVolumeKey(volumeName)))
{
+ addVolumeToDB(volumeName, omMetadataManager);
+ }
+ return addBucketToDB(omMetadataManager,
+
OmBucketInfo.newBuilder().setVolumeName(volumeName).setBucketName(bucketName)
+ .setBucketLayout(bucketLayout)
+
.setStoragePolicy(storagePolicy).setAllowFallbackStoragePolicy(allowFallbackStoragePolicy));
+ }
+
@SuppressWarnings("parameterNumber")
public static void addKeyToTableAndCache(String volumeName, String
bucketName,
String keyName, long clientID, ReplicationConfig replicationConfig, long
trxnLogIndex,
diff --git
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMAllocateBlockRequest.java
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMAllocateBlockRequest.java
index fa57c68000d..93d40a58017 100644
---
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMAllocateBlockRequest.java
+++
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMAllocateBlockRequest.java
@@ -18,6 +18,7 @@
package org.apache.hadoop.ozone.om.request.key;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -58,7 +59,9 @@
import org.apache.hadoop.ipc_.Server;
import org.apache.hadoop.ozone.OzoneConsts;
import org.apache.hadoop.ozone.om.KeyManager;
+import org.apache.hadoop.ozone.om.exceptions.OMException;
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
+import org.apache.hadoop.ozone.om.helpers.OmBucketInfo;
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo;
import org.apache.hadoop.ozone.om.request.OMRequestTestUtils;
@@ -81,7 +84,7 @@ public class TestOMAllocateBlockRequest extends
OMKeyRequestTests {
@Test
public void testPreExecute() throws Exception {
- doPreExecute(createAllocateBlockRequest());
+
doPreExecute(createAllocateBlockRequest(OzoneStoragePolicy.getDefaultPolicy()));
}
@@ -158,7 +161,7 @@ protected OMAllocateBlockRequest getOmAllocateBlockRequest(
public void testValidateAndUpdateCacheWithVolumeNotFound() throws Exception {
OMRequest modifiedOmRequest =
- doPreExecute(createAllocateBlockRequest());
+
doPreExecute(createAllocateBlockRequest(OzoneStoragePolicy.getDefaultPolicy()));
OMAllocateBlockRequest omAllocateBlockRequest =
getOmAllocateBlockRequest(modifiedOmRequest);
@@ -176,7 +179,7 @@ public void testValidateAndUpdateCacheWithVolumeNotFound()
throws Exception {
public void testValidateAndUpdateCacheWithBucketNotFound() throws Exception {
OMRequest modifiedOmRequest =
- doPreExecute(createAllocateBlockRequest());
+
doPreExecute(createAllocateBlockRequest(OzoneStoragePolicy.getDefaultPolicy()));
OMAllocateBlockRequest omAllocateBlockRequest =
getOmAllocateBlockRequest(modifiedOmRequest);
@@ -198,7 +201,7 @@ public void testValidateAndUpdateCacheWithBucketNotFound()
throws Exception {
public void testValidateAndUpdateCacheWithKeyNotFound() throws Exception {
OMRequest modifiedOmRequest =
- doPreExecute(createAllocateBlockRequest());
+
doPreExecute(createAllocateBlockRequest(OzoneStoragePolicy.getDefaultPolicy()));
OMAllocateBlockRequest omAllocateBlockRequest =
getOmAllocateBlockRequest(modifiedOmRequest);
@@ -216,6 +219,62 @@ public void testValidateAndUpdateCacheWithKeyNotFound()
throws Exception {
}
+ @Test
+ public void testPreExecuteUsesPolicyStoredOnOpenKey() throws Exception {
+ // The bucket policy changed to HOT after the key was opened with COLD.
+ addVolumeAndBucketWithPolicy(OzoneStoragePolicy.HOT, false);
+ addKeyToOpenKeyTable(volumeName, bucketName, OzoneStoragePolicy.COLD);
+
+ // The client does not send the policy back.
+ doPreExecute(createAllocateBlockRequest());
+
+ verifyPolicySentToScm(OzoneStoragePolicy.COLD, false);
+ }
+
+ @Test
+ public void testPreExecuteUsesBucketPolicyWhenOpenKeyHasNoPolicy() throws
Exception {
+ // The key was opened before storage policy support was finalized, so it
has no policy. The bucket policy applies.
+ addVolumeAndBucketWithPolicy(OzoneStoragePolicy.COLD, false);
+ addKeyToOpenKeyTable(volumeName, bucketName, null);
+
+ doPreExecute(createAllocateBlockRequest());
+
+ verifyPolicySentToScm(OzoneStoragePolicy.COLD, false);
+ }
+
+ @Test
+ public void
testPreExecuteUsesDefaultPolicyWhenOpenKeyAndBucketHaveNoPolicy() throws
Exception {
+ addVolumeAndBucketWithPolicy(null, true);
+ addKeyToOpenKeyTable(volumeName, bucketName, null);
+
+ doPreExecute(createAllocateBlockRequest());
+
+ verifyPolicySentToScm(OzoneStoragePolicy.getDefaultPolicy(), true);
+ }
+
+ @Test
+ public void testPreExecuteWithKeyNotFound() throws Exception {
+ addVolumeAndBucketWithPolicy(OzoneStoragePolicy.HOT, true);
+
+ OMAllocateBlockRequest request =
getOmAllocateBlockRequest(createAllocateBlockRequest());
+
+ assertThatThrownBy(() -> request.preExecute(ozoneManager))
+ .isInstanceOfSatisfying(OMException.class,
+ e ->
assertThat(e.getResult()).isEqualTo(OMException.ResultCodes.KEY_NOT_FOUND));
+ verify(scmBlockLocationProtocol, never()).allocateBlock(anyLong(),
anyInt(), any(), any(), any(), any(),
+ any(StoragePolicy.class), anyBoolean());
+ }
+
+ @Test
+ public void testPreExecuteUsesPolicySentByClient() throws Exception {
+ // No open key is needed when the client sends the policy; the fallback
flag still comes from the bucket.
+ addVolumeAndBucketWithPolicy(OzoneStoragePolicy.HOT, false);
+
+ doPreExecute(createAllocateBlockRequest(OzoneStoragePolicy.COLD));
+
+ verifyPolicySentToScm(OzoneStoragePolicy.COLD, false);
+ }
+
/**
* This method calls preExecute and verify the modified request.
* @param originalOMRequest
@@ -488,6 +547,7 @@ private OMRequest createAllocateBlockRequestWithSort() {
.setVolumeName(volumeName).setBucketName(bucketName).setKeyName(keyName)
.setFactor(((RatisReplicationConfig)
replicationConfig).getReplicationFactor())
.setType(replicationConfig.getReplicationType())
+
.setStoragePolicy(OzoneStoragePolicy.toProto(OzoneStoragePolicy.getDefaultPolicy()))
.setSortDatanodes(true)
.build();
AllocateBlockRequest allocateBlockRequest =
AllocateBlockRequest.newBuilder()
@@ -510,14 +570,38 @@ private void preExecuteWithClient(OMAllocateBlockRequest
request, String clientA
}
}
+ private void addVolumeAndBucketWithPolicy(StoragePolicy storagePolicy,
boolean allowFallback) throws Exception {
+ final OmBucketInfo bucket =
OMRequestTestUtils.addVolumeAndBucketToDB(volumeName, bucketName,
omMetadataManager,
+ getBucketLayout(), storagePolicy, allowFallback);
+ // OMKeyRequestTests stubs OzoneManager#getBucketInfo with an empty
bucket, which preExecute reads.
+ when(ozoneManager.getBucketInfo(volumeName,
bucketName)).thenReturn(bucket);
+ }
+
+ private void verifyPolicySentToScm(StoragePolicy expectedPolicy, boolean
expectedAllowFallback) throws Exception {
+ ArgumentCaptor<StoragePolicy> policy =
ArgumentCaptor.forClass(StoragePolicy.class);
+ ArgumentCaptor<Boolean> allowFallback =
ArgumentCaptor.forClass(Boolean.class);
+ verify(scmBlockLocationProtocol).allocateBlock(anyLong(), anyInt(), any(),
any(), any(), any(),
+ policy.capture(), allowFallback.capture());
+ assertThat(policy.getValue()).isEqualTo(expectedPolicy);
+ assertThat(allowFallback.getValue()).isEqualTo(expectedAllowFallback);
+ }
+
protected OMRequest createAllocateBlockRequest() {
+ return createAllocateBlockRequest(null);
+ }
- KeyArgs keyArgs = KeyArgs.newBuilder()
+ /** Creates the request the way a client sends it: without a policy when
{@code storagePolicy} is null. */
+ protected OMRequest createAllocateBlockRequest(StoragePolicy storagePolicy) {
+
+ KeyArgs.Builder keyArgsBuilder = KeyArgs.newBuilder()
.setVolumeName(volumeName).setBucketName(bucketName)
.setKeyName(keyName)
.setFactor(((RatisReplicationConfig)
replicationConfig).getReplicationFactor())
- .setType(replicationConfig.getReplicationType())
- .build();
+ .setType(replicationConfig.getReplicationType());
+ if (storagePolicy != null) {
+
keyArgsBuilder.setStoragePolicy(OzoneStoragePolicy.toProto(storagePolicy));
+ }
+ KeyArgs keyArgs = keyArgsBuilder.build();
AllocateBlockRequest allocateBlockRequest =
AllocateBlockRequest.newBuilder().setClientID(clientID)
@@ -532,9 +616,16 @@ protected OMRequest createAllocateBlockRequest() {
protected String addKeyToOpenKeyTable(String volumeName, String bucketName)
throws Exception {
- OMRequestTestUtils.addKeyToTable(true, volumeName, bucketName,
- keyName, clientID, replicationConfig,
- omMetadataManager);
+ return addKeyToOpenKeyTable(volumeName, bucketName, null);
+ }
+
+ /** Adds the open key with the given stored policy; null leaves it unset, as
for a key opened before the upgrade. */
+ protected String addKeyToOpenKeyTable(String volumeName, String bucketName,
StoragePolicy storagePolicy)
+ throws Exception {
+ OmKeyInfo omKeyInfo = OMRequestTestUtils.createOmKeyInfo(volumeName,
bucketName, keyName, replicationConfig)
+ .setStoragePolicy(storagePolicy)
+ .build();
+ OMRequestTestUtils.addKeyToTable(true, false, omKeyInfo, clientID, 0L,
omMetadataManager);
return "";
}
}
diff --git
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMAllocateBlockRequestWithFSO.java
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMAllocateBlockRequestWithFSO.java
index 77bb8d1af49..05e064df878 100644
---
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMAllocateBlockRequestWithFSO.java
+++
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMAllocateBlockRequestWithFSO.java
@@ -23,6 +23,7 @@
import jakarta.annotation.Nonnull;
import org.apache.hadoop.hdds.client.RatisReplicationConfig;
+import org.apache.hadoop.hdds.client.StoragePolicy;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.ozone.OzoneConsts;
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
@@ -49,7 +50,7 @@ protected OzoneConfiguration getOzoneConfiguration() {
}
@Override
- protected String addKeyToOpenKeyTable(String volumeName, String bucketName)
+ protected String addKeyToOpenKeyTable(String volumeName, String bucketName,
StoragePolicy storagePolicy)
throws Exception {
// need to initialize parentID
String parentDir = keyName;
@@ -67,6 +68,7 @@ protected String addKeyToOpenKeyTable(String volumeName,
String bucketName)
.setObjectID(objectId)
.setParentObjectID(parentID)
.setUpdateID(txnId)
+ .setStoragePolicy(storagePolicy)
.build();
// add key to openFileTable
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]