Conversation
Co-authored-by: @ xichen01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Keys now carry a storage policy end to end, so a key's data lands on the storage tier its policy asks for.
Before this change, OM resolved every key's placement to the cluster default.
OMKeyRequest.allocateBlockhardcoded it:This patch resolves all three
TODOs. The chain is now:KeyArgs.storagePolicy / KeyInfo.storagePolicyadded toOmClientProtocol.proto(fields 25 and 23).OmKeyArgsandOmKeyInfocarry a StoragePolicy, round-tripped through protobuf.OMKeyRequest.getStoragePolicy(bucketInfo, keyArgs)resolves it — key-level policy wins, then the bucket's, then the cluster default — andallocateBlockpasses the resolved policy andallowFallbackStoragePolicyto SCM. Applied at all three call sites:OMKeyCreateRequest,OMKeyCreateRequestWithFSO,OMFileCreateRequest,OMAllocateBlockRequest.BlockOutputStreamEntryPoolderives aStorageTypefromOmKeyLocationInfo.getStorageTier(), which threads throughBlockOutputStreamEntry→RatisBlockOutputStream→BlockOutputStream, populatingDatanodeBlockID.storageTypeIDand thewriteChunkAsyncstorage type.OzoneBucket.createKey(key, size, replicationConfig, metadata, tags, storagePolicy), and the policy is readable back viaOzoneKey.getStoragePolicy().What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16665
How was this patch tested?
New integration test
TestOzoneStoragePolicy(6 tests): explicit key policy honoured, bucket inheritance and key-level override, cluster-default fallback, policy visible to the client on read, FSO bucket path, and empty-key policy recording.Its datanode assertion checks physical placement, not just metadata:
Co-authored-by: @xichen01