[
https://issues.apache.org/jira/browse/HDFS-17111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17745246#comment-17745246
]
ASF GitHub Bot commented on HDFS-17111:
---------------------------------------
simbadzina commented on code in PR #5860:
URL: https://github.com/apache/hadoop/pull/5860#discussion_r1269883206
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcClient.java:
##########
@@ -1783,16 +1783,26 @@ && isNamespaceStateIdFresh(nsId)
}
private boolean isObserverReadEligible(String nsId, Method method) {
- boolean isReadEnabledForNamespace =
- observerReadEnabledDefault !=
observerReadEnabledOverrides.contains(nsId);
- return isReadEnabledForNamespace && isReadCall(method);
+ return isReadCall(method) && isNamespaceObserverReadEligible(nsId);
+ }
+
+ /**
+ * Check if a namespace is eligible for observer reads.
+ * @param nsId namespaceID
+ * @return whether the 'namespace' has observer reads enabled.
+ */
+ boolean isNamespaceObserverReadEligible(String nsId) {
+ return observerReadEnabledDefault !=
observerReadEnabledOverrides.contains(nsId);
}
/**
* Check if a method is read-only.
* @return whether the 'method' is a read-only operation.
*/
private static boolean isReadCall(Method method) {
+ if (method == null) {
Review Comment:
This is to fix a unit test here:
https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouter.java#L200
The ideal fix is mocking Method.class there so that
`RemoteMethod.getMethod()` does not return null and mocking
`Method.isAnnotationPresent()`. However that required updating the version of
Mockito, in order to mock a final class.
> RBF: Optimize msync to only call nameservices that have observer reads
> enabled.
> -------------------------------------------------------------------------------
>
> Key: HDFS-17111
> URL: https://issues.apache.org/jira/browse/HDFS-17111
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: Simbarashe Dzinamarira
> Assignee: Simbarashe Dzinamarira
> Priority: Major
> Labels: pull-request-available
>
> Right now when a client MSYNCs to the router, the call is fanned out to all
> nameservices. We only need to proxy the msync to nameservices that have
> observer reads configured.
> We can do this either by adding a new config for the admin to specify which
> nameservices have CRS configured, or we can try to automatically detect these.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]