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

Ted Yu edited comment on HBASE-21246 at 10/23/18 5:03 PM:
----------------------------------------------------------

bq. Why do we have a String constructor anyways?

One example usage for the ctor taking String is in {{refreshSources}} method of 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
 :
{code}
        for (SortedSet<String> walsByGroup : 
walsByIdRecoveredQueues.get(queueId).values()) {
          walsByGroup.forEach(wal -> 
src.enqueueLog(this.walProvider.createWALIdentity(wal)));
{code}
The {{wal}} variable above is the String representation of WAL.

In handling failed replication queue(s), for each queue Id, there are Set of 
WALs represented using String (persisted form on zookeeper).
In order to handle the String WAL name (from zookeeper), we would need 
{{walProvider.createWALIdentity}} which accepts String parameter.
So {{walProvider.createWALIdentity}} call is deserialization from String form 
of WAL name to WALIdentity.
Here is corresponding code from current master branch:
{code}
          walsByGroup.forEach(wal -> src.enqueueLog(new Path(wal)));
{code}
createWALIdentity() ends up calling FSWALIdentity ctor accepting String when 
WAL is backed by hdfs. For other WAL provider, different WALIdentity instance 
would be created.



was (Author: yuzhih...@gmail.com):
bq. Why do we have a String constructor anyways?

One example usage for the ctor taking String is in {{refreshSources}} method of 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
 :
{code}
        for (SortedSet<String> walsByGroup : 
walsByIdRecoveredQueues.get(queueId).values()) {
          walsByGroup.forEach(wal -> 
src.enqueueLog(this.walProvider.createWALIdentity(wal)));
{code}
The {{wal}} variable above is the String representation of WAL.

In handling failed replication queue(s), for each queue Id, there are Set of 
WALs represented using String (persisted form on zookeeper).
So {{walProvider.createWALIdentity}} call is deserialization from String form 
of WAL name to WALIdentity.
Here is corresponding code from current master branch:
{code}
          walsByGroup.forEach(wal -> src.enqueueLog(new Path(wal)));
{code}
createWALIdentity() ends up calling FSWALIdentity ctor accepting String when 
WAL is backed by hdfs. For other WAL provider, different WALIdentity instance 
would be created.


> Introduce WALIdentity interface
> -------------------------------
>
>                 Key: HBASE-21246
>                 URL: https://issues.apache.org/jira/browse/HBASE-21246
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: Ted Yu
>            Assignee: Ted Yu
>            Priority: Major
>             Fix For: HBASE-20952
>
>         Attachments: 21246.003.patch, 21246.HBASE-20952.001.patch, 
> 21246.HBASE-20952.002.patch, 21246.HBASE-20952.004.patch, 
> 21246.HBASE-20952.005.patch, 21246.HBASE-20952.007.patch, 
> 21246.HBASE-20952.008.patch
>
>
> We are introducing WALIdentity interface so that the WAL representation can 
> be decoupled from distributed filesystem.
> The interface provides getName method whose return value can represent 
> filename in distributed filesystem environment or, the name of the stream 
> when the WAL is backed by log stream.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to