[ 
https://issues.apache.org/jira/browse/RATIS-13?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15868893#comment-15868893
 ] 

Tsz Wo Nicholas Sze commented on RATIS-13:
------------------------------------------

The patch looks good.  Some minor comments:
# Use ByteBuffer.getLong in ClientId(byte[] data).
# In RaftPeerId, use StandardCharsets.UTF_8.
# In RaftClient, we should keep Builder.setClientId(..) and remove 
newBuilder(ClientId clientId).  In more details, Builder.clientId should not be 
final. Initialize it with null.  User may set it by setClientId(..).  In 
build(), generate a random id if it is null.
# Change RaftUtils.next to generic and replace "string" with "element" in the 
javadoc, i.e.
{code}
  /**
   *  @return the next element in the iteration right after the given element;
   *          if the given element is not in the iteration, return the first 
element.
   */
  public static <T> T next(final T given, final Iterable<T> iteration) {
    Preconditions.checkNotNull(given);
    Preconditions.checkNotNull(iteration);
    final Iterator<T> i = iteration.iterator();
    Preconditions.checkArgument(i.hasNext());

    final T first = i.next();
    for(T current = first; i.hasNext(); ) {
      final T next = i.next();
      if (given.equals(current)) {
        return next;
      }
      current = next;
    }
    return first;
  }
{code}
# Remove the RaftPeerId import from both RaftUtils and StringUtils.
# In CodeInjectionForTesting, change all the localId/remoteId parameters to 
Object so that we don't need to call toString(), which is expensive for UUID.

> Add global unique ID for Raft Client
> ------------------------------------
>
>                 Key: RATIS-13
>                 URL: https://issues.apache.org/jira/browse/RATIS-13
>             Project: Ratis
>          Issue Type: Sub-task
>            Reporter: Jing Zhao
>            Assignee: Jing Zhao
>         Attachments: RATIS-13.000.patch
>
>
> Similar idea as HADOOP-9688. But since we need to support various RPC 
> engines, the client id is not added in the RPC layer but in the raft protocol 
> layer.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to