hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: why don't design a API to check namespace exist like #tableExists
Date Wed, 21 Dec 2016 16:14:54 GMT
You're welcome.

Call me Ted.

On Wed, Dec 21, 2016 at 8:08 AM, 小展 <qger@qq.com> wrote:

> Thanks Yu!  Got it.
>
> > 在 2016年12月21日,下午11:19,Ted Yu <yuzhihong@gmail.com> 写道:
> >
> > From NamespacesInstanceResource :
> >
> >  private boolean doesNamespaceExist(Admin admin, String namespaceName)
> > throws IOException{
> >    NamespaceDescriptor[] nd = admin.listNamespaceDescriptors();
> >    for(int i = 0; i < nd.length; i++){
> >      if(nd[i].getName().equals(namespaceName)){
> >        return true;
> >      }
> >    }
> >    return false;
> >  }
> >
> > You can use the above code without triggering exception.
> >
> > FYI
> >
> > On Wed, Dec 21, 2016 at 7:15 AM, 小展 <qger@qq.com> wrote:
> >
> >> Hi, guys
> >>        In Admin class , we still  haven’t a  api to check  the namespace
> >> exist . Now ,  when I  want to check a namespace exist in my cluster , I
> >> use  #getNamespaceDescriptor。 If catch NamespaceNotFoundException than
> >> return false,otherwise return true . I don’t think that’s a good  way
.
> And
> >> I also find in   TableNamespceManager class we used
> >> doesNamespaceExist(final String namespaceName) to check  namespace
> exist .
> >>
> >> I don’t know is there I miss something .
> >>
> >> If you have better way Or we should add a api ? Please tell me .
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message