hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chia-Ping Tsai (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HBASE-20119) Introduce a pojo class to carry coprocessor information in order to make TableDescriptorBuilder accept multiple cp at once
Date Thu, 15 Mar 2018 01:53:00 GMT

     [ https://issues.apache.org/jira/browse/HBASE-20119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Chia-Ping Tsai updated HBASE-20119:
-----------------------------------
    Release Note: 
1) Make all methods in TableDescriptorBuilder be setter pattern.
addCoprocessor -> setCoprocessor
addColumnFamily -> setColumnFamily
2) add CoprocessorDescriptor to carry cp information
3) add CoprocessorDescriptorBuilder to build CoprocessorDescriptor
4) TD disallow user to set negative priority to coprocessor since parsing the negative will
cause the exception 

  was:
1) Make all methods in TableDescriptorBuilder be setter pattern.
addCoprocessor -> setCoprocessor
addColumnFamily -> setColumnFamily
2) add CoprocessorDescriptor to carry cp information
3) add CoprocessorDescriptorBuilder to build CoprocessorDescriptor


> Introduce a pojo class to carry coprocessor information in order to make TableDescriptorBuilder
accept multiple cp at once
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-20119
>                 URL: https://issues.apache.org/jira/browse/HBASE-20119
>             Project: HBase
>          Issue Type: Task
>            Reporter: Chia-Ping Tsai
>            Assignee: Chia-Ping Tsai
>            Priority: Minor
>             Fix For: 2.0.0
>
>         Attachments: HBASE-20119.v0.patch.patch, HBASE-20119.v1.patch.patch, HBASE-20119.v2.patch,
HBASE-20119.v3.patch
>
>
> The way to add cp to TableDescriptorBuilder is shown below.
> {code:java}
> public TableDescriptorBuilder addCoprocessor(String className) throws IOException {
>   return addCoprocessor(className, null, Coprocessor.PRIORITY_USER, null);
> }
> public TableDescriptorBuilder addCoprocessor(String className, Path jarFilePath,
>         int priority, final Map<String, String> kvs) throws IOException {
>   desc.addCoprocessor(className, jarFilePath, priority, kvs);
>   return this;
> }
> public TableDescriptorBuilder addCoprocessorWithSpec(final String specStr) throws IOException
{
>   desc.addCoprocessorWithSpec(specStr);
>   return this;
> }{code}
> When loading our config to create table with multiple cps, we have to write the ugly
for-loop.
> {code:java}
> val builder = TableDescriptorBuilder.newBuilde(tableName)
>   .setAAA()
>   .setBBB()
> cps.map(toHBaseCp).foreach(builder.addCoprocessor)
> cfs.map(toHBaseCf).foreach(builder.addColumnFamily)
> admin.createTable(builder.build())
> {code}
> If we introduce a pojo to carry the cp data and add the method accepting multiple cps
and cfs, it is easier to exercise the fluent interface of TableDescriptorBuilder.
> {code:java}
> admin.createTable(TableDescriptorBuilder.newBuilde(tableName)
> .addCoprocessor(cps.map(toHBaseCp).asJavaCollection)
> .addColumnFamily(cf.map(toHBaseCf).asJavaCollection)
> .setAAA()
> .setBBB()
> .build){code}
>  
>  



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

Mime
View raw message