xalestar opened a new pull request, #11782: URL: https://github.com/apache/ozone/pull/11782
## What changes were proposed in this pull request? The DB key of openKeyTable and openFileTable ends with a suffix after the last `/`: the client ID, or the upload ID for the open key of a multipart upload. `OmMetadataManagerImpl` parses this suffix by hand in three places, each in a different way: `listOpenFiles` calls `OMMultipartUploadUtils.getUploadIdFromDbKey` and then `OMMetadataManager.getClientIDFromOpenKeyDBKey`, `isOpenMultipartKey` calls `getUploadIdFromDbKey`, and `getExpiredOpenKeys` uses its own `lastIndexOf(OM_KEY_PREFIX)`. As suggested in the review of #11739, this change adds `OpenKeyDBKey`, which parses the DB key once and exposes `getKeyTableDBKey()`, `isUpload()`, `getUploadId()` and `getClientId()`. The three call sites use it, and `getClientIDFromOpenKeyDBKey` and `getUploadIdFromDbKey`, which have no other callers, are removed. `getClientId()` on the open key of an upload throws `IllegalStateException` instead of a `NumberFormatException`. This is a refactor only, with no change to the RocksDB layout or RPC. `isUpload()` only reads the key format, so `isOpenMultipartKey` still checks the `isMultipartKey` flag and multipartInfoTable for open keys written before HDDS-9017. The class is in `interface-storage`, next to `OMMetadataManager`, where `getClientIDFromOpenKeyDBKey` was. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-17464 ## How was this patch tested? Added `TestOpenKeyDBKey`, covering a client ID key whose key name contains `/`, upload keys in both the openKeyTable and openFileTable formats, and a DB key without `/`. - `mvn test -pl :ozone-interface-storage -Dtest=TestOpenKeyDBKey`: 3 tests pass. - `mvn test -pl :ozone-manager -Dtest=TestOmMetadataManager,TestOpenKeyCleanupService`: 33 and 14 tests pass. They cover `listOpenFiles` with multipart uploads and `getExpiredOpenKeys`, including multipart upload keys with and without the `isMultipartKey` flag. - `checkstyle.sh`: clean. - Fork CI: https://github.com/xalestar/ozone/actions/runs/40213361038 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
