laserninja opened a new pull request, #11617: URL: https://github.com/apache/gravitino/pull/11617
### What changes were proposed in this pull request? Add ETag / If-None-Match conditional loading support to the Iceberg REST loadView, createView, and replaceView endpoints, extending the existing ETag pattern from loadTable to views. **Changes:** - **loadView**: Generate ETag from view metadata file location, accept `If-None-Match` header, return `304 Not Modified` when ETag matches - **createView / replaceView**: Return `ETag` header in response - **IcebergRESTUtils**: Add `buildViewResponseWithETag()` helpers and extract `etagMatches()` as a shared public utility (previously private in `IcebergTableOperations`) - **IcebergTableOperations**: Refactored private `etagMatches()` to delegate to `IcebergRESTUtils.etagMatches()` ### Why are the changes needed? The loadTable endpoint already supports ETag-based conditional loading (returning 304 Not Modified), but the loadView endpoint does not. This causes unnecessary data transfer when clients poll view metadata that has not changed. Fix: #11582 ### Does this PR introduce _any_ user-facing change? Yes. The loadView endpoint now: - Returns an `ETag` header derived from the view metadata file location - Accepts `If-None-Match` header and returns `304 Not Modified` when the ETag matches The createView and replaceView endpoints also now return `ETag` headers in their responses. ### How was this patch tested? Added 8 new parameterized test methods to `TestIcebergViewOperations`: - `testLoadViewReturnsETag` — verifies ETag header is present on load - `testLoadViewReturns304WhenETagMatches` — verifies 304 with matching If-None-Match - `testLoadViewReturns200WhenETagDoesNotMatch` — verifies 200 with non-matching ETag - `testLoadViewETagConsistency` — verifies same ETag on repeated loads - `testLoadViewETagChangesAfterReplace` — verifies ETag changes after view replace - `testCreateViewReturnsETag` — verifies ETag on create response - `testCreateViewETagMatchesLoadViewETag` — verifies create and load ETags match - `testReplaceViewReturnsETag` — verifies ETag on replace response All 36 tests pass (0 failures, 0 errors, 0 skipped). Verified with: ``` ./gradlew :iceberg:iceberg-rest-server:test --tests "org.apache.gravitino.iceberg.service.rest.TestIcebergViewOperations" -PskipITs ``` -- 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]
