hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ryan rawson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-11025) Infrastructure for pluggable consensus service
Date Sat, 19 Apr 2014 21:01:16 GMT

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

ryan rawson commented on HBASE-11025:
-------------------------------------

I'm specifically talking about this line of code:

+      consensus = ConsensusProviderFactory.getConsensusProvider(conf);

Here you are referencing a global (ConsensusProviderFactory).  The idea is instead of calling
it here, you'd augment the constructor with:

public HRegionServer(/* stuff */,
                                   ConsensusProviderFactory consensusProviderFactory);

then later on:

      consensus = consensusProviderFactory.getConsensusProvider(conf);

the implementation of the factory then checks the conf, as the code currently does, to figure
out how to build a ConsenusProvider.

This helps Unit tests because we can provide a mocked ConsensusProviderFactory (right now
it's a class, it would become an Interface, and there'd be a 'ConfigSwitchedConsensusProviderFactory'
concrete class that'd be provided at the production points of HRS construction.  

While seemingly a complication, I think the provision for easier testability and less reliance
on global factory methods is a big plus.  For a reference, check out "Clean Code" Chapter
11.

> Infrastructure for pluggable consensus service
> ----------------------------------------------
>
>                 Key: HBASE-11025
>                 URL: https://issues.apache.org/jira/browse/HBASE-11025
>             Project: HBase
>          Issue Type: Sub-task
>          Components: Zookeeper
>            Reporter: Mikhail Antonov
>            Assignee: Mikhail Antonov
>         Attachments: HBASE-11025.patch
>
>
> Related to HBASE-10915.
> In this jira I will extract the changed for property changes, factory and consensus provider
interface (+ZK implementation), as it's going to be required by other subtasks of HBASE-10909.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message