ivandika3 commented on code in PR #11252:
URL: https://github.com/apache/ozone/pull/11252#discussion_r4141553773
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/GrpcOmTransport.java:
##########
@@ -206,20 +208,29 @@ public void start() throws IOException {
@Override
public OMResponse submitRequest(OMRequest payload) throws IOException {
- if (useFollowerRead && OmUtils.shouldSendToFollower(payload)) {
+ if (shouldUseFollowerRead(payload)) {
return submitRequestWithFollowerRead(payload);
}
return submitRequestToLeader(addReadConsistencyHint(payload,
leaderReadConsistency));
}
+ private boolean shouldUseFollowerRead(OMRequest payload) {
+ if (!omServiceSupportsFollowerRead ||
!OmUtils.shouldSendToFollower(payload)) {
+ return false;
+ }
+ return defaultFollowerReadEnabled || payload.hasReadConsistencyHint()
+ && ReadConsistency.fromProto(payload.getReadConsistencyHint()
+ .getReadConsistency()).allowFollowerRead();
+ }
+
private OMResponse submitRequestWithFollowerRead(OMRequest payload)
throws IOException {
OMRequest followerPayload = addReadConsistencyHint(payload,
followerReadConsistency);
int failedCount = 0;
- for (int i = 0; useFollowerRead &&
- i < omFailoverProxyProvider.getOMProxyMap().getNodeIds().size(); i++) {
+ for (int i = 0;
+ i < omFailoverProxyProvider.getOMProxyMap().getNodeIds().size(); i++)
{
String nodeId = getCurrentFollowerReadNodeId();
Review Comment:
Fixed in ab8272aabd5. For LOCAL_LEASE, GrpcOmTransport now advances past the
known leader before attempting a follower, matching the Hadoop RPC behavior. If
there is no follower it falls back to the normal leader path. Added
TestS3GrpcOmTransport coverage that verifies a local-lease request avoids the
known leader when another OM is available.
##########
hadoop-ozone/integration-test-s3/src/test/java/org/apache/hadoop/ozone/s3/awssdk/v2/AbstractS3SDKV2Tests.java:
##########
@@ -300,6 +306,48 @@ public void testPutObject() {
assertEquals("\"37b51d194a7513e45b56f6524f2d51f2\"",
getObjectResponse.eTag());
}
+ @ParameterizedTest
+ @ValueSource(strings = {"follower-stale", "follower-linearizable",
+ "leader-only"})
+ public void testGetObjectWithReadConsistencyHeader(String readConsistency) {
Review Comment:
Thanks. Addressed the authentication bootstrap in 14d3695df44: an
S3-authenticated GetS3VolumeContext request now explicitly uses
LINEARIZABLE_LEADER_ONLY, so the context lookup remains leader-directed. This
does not modify the thread-local request hint; the subsequent S3 read retains
its requested consistency and may use a follower. I added a translator
regression for S3 authentication plus a local-lease hint that asserts the
bootstrap request is leader-only. The test suite still lacks an end-to-end
secure-HA S3 Gateway fixture that can prove the subsequent read was served by a
follower, so that specific coverage is not included in this patch.
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/GrpcOmTransport.java:
##########
@@ -206,20 +208,29 @@ public void start() throws IOException {
@Override
public OMResponse submitRequest(OMRequest payload) throws IOException {
- if (useFollowerRead && OmUtils.shouldSendToFollower(payload)) {
+ if (shouldUseFollowerRead(payload)) {
return submitRequestWithFollowerRead(payload);
}
return submitRequestToLeader(addReadConsistencyHint(payload,
leaderReadConsistency));
}
+ private boolean shouldUseFollowerRead(OMRequest payload) {
+ if (!omServiceSupportsFollowerRead ||
!OmUtils.shouldSendToFollower(payload)) {
+ return false;
+ }
+ return defaultFollowerReadEnabled || payload.hasReadConsistencyHint()
Review Comment:
Thanks. Fixed in ab8272aabd5. OMFailoverProxyProviderBase now has the shared
shouldUseFollowerRead decision used by both gRPC and Hadoop RPC. For an
eligible read, an explicit consistency hint takes precedence over
defaultFollowerReadEnabled; otherwise the configured default is used. This
keeps leader-only leader-directed even when default follower reads are enabled.
Added TestS3GrpcOmTransport coverage for that case.
--
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]