You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by Stephen Jiang <sy...@gmail.com> on 2016/06/14 05:40:41 UTC

RegionCoprocessorHost.preClose() execute multiple times

In RSRpcServices#closeRegion(), it calls RegionCoprocessorHost#preClose()
first, then calls HRegionServer#closeRegion().

In HRegionServer#closeRegion(), the RegionCoprocessorHost#preClose() is
called again.

I just wonder whether the RegionCoprocessorHost#preClose() call
in RSRpcServices#closeRegion() is unnecessary.  Anyone has idea?  The code
seems there forever.

I think we should be able to remove the call in RSRpcServices#closeRegion()
and rely on HRegionServer#closeRegion() call for this CP.

{code}

  @Override

  @QosPriority(priority=HConstants.ADMIN_QOS)

  public CloseRegionResponse closeRegion(final RpcController controller,

      final CloseRegionRequest request) throws ServiceException {

   ...

      // Can be null if we're calling close on a region that's not online

      final Region region = regionServer.getFromOnlineRegions(
encodedRegionName);

      if ((region  != null) && (region .getCoprocessorHost() != null)) {

        region.getCoprocessorHost().preClose(false);

      }

      ...

      boolean closed = regionServer.closeRegion(encodedRegionName, false, sn
);

{code}

Re: RegionCoprocessorHost.preClose() execute multiple times

Posted by Stephen Jiang <sy...@gmail.com>.
thanks, Matteo.  I am surprised that this ancient JIRA is still OPEN.  I
put my comment in the JIRA and proposed a patch.

Thanks
Stephen

On Mon, Jun 13, 2016 at 11:21 PM, Matteo Bertozzi <th...@gmail.com>
wrote:

> HBASE-8075
>
> Matteo
>
>
> On Tue, Jun 14, 2016 at 7:40 AM, Stephen Jiang <sy...@gmail.com>
> wrote:
>
> > In RSRpcServices#closeRegion(), it calls RegionCoprocessorHost#preClose()
> > first, then calls HRegionServer#closeRegion().
> >
> > In HRegionServer#closeRegion(), the RegionCoprocessorHost#preClose() is
> > called again.
> >
> > I just wonder whether the RegionCoprocessorHost#preClose() call
> > in RSRpcServices#closeRegion() is unnecessary.  Anyone has idea?  The
> code
> > seems there forever.
> >
> > I think we should be able to remove the call in
> RSRpcServices#closeRegion()
> > and rely on HRegionServer#closeRegion() call for this CP.
> >
> > {code}
> >
> >   @Override
> >
> >   @QosPriority(priority=HConstants.ADMIN_QOS)
> >
> >   public CloseRegionResponse closeRegion(final RpcController controller,
> >
> >       final CloseRegionRequest request) throws ServiceException {
> >
> >    ...
> >
> >       // Can be null if we're calling close on a region that's not online
> >
> >       final Region region = regionServer.getFromOnlineRegions(
> > encodedRegionName);
> >
> >       if ((region  != null) && (region .getCoprocessorHost() != null)) {
> >
> >         region.getCoprocessorHost().preClose(false);
> >
> >       }
> >
> >       ...
> >
> >       boolean closed = regionServer.closeRegion(encodedRegionName, false,
> > sn
> > );
> >
> > {code}
> >
>

Re: RegionCoprocessorHost.preClose() execute multiple times

Posted by Matteo Bertozzi <th...@gmail.com>.
HBASE-8075

Matteo


On Tue, Jun 14, 2016 at 7:40 AM, Stephen Jiang <sy...@gmail.com>
wrote:

> In RSRpcServices#closeRegion(), it calls RegionCoprocessorHost#preClose()
> first, then calls HRegionServer#closeRegion().
>
> In HRegionServer#closeRegion(), the RegionCoprocessorHost#preClose() is
> called again.
>
> I just wonder whether the RegionCoprocessorHost#preClose() call
> in RSRpcServices#closeRegion() is unnecessary.  Anyone has idea?  The code
> seems there forever.
>
> I think we should be able to remove the call in RSRpcServices#closeRegion()
> and rely on HRegionServer#closeRegion() call for this CP.
>
> {code}
>
>   @Override
>
>   @QosPriority(priority=HConstants.ADMIN_QOS)
>
>   public CloseRegionResponse closeRegion(final RpcController controller,
>
>       final CloseRegionRequest request) throws ServiceException {
>
>    ...
>
>       // Can be null if we're calling close on a region that's not online
>
>       final Region region = regionServer.getFromOnlineRegions(
> encodedRegionName);
>
>       if ((region  != null) && (region .getCoprocessorHost() != null)) {
>
>         region.getCoprocessorHost().preClose(false);
>
>       }
>
>       ...
>
>       boolean closed = regionServer.closeRegion(encodedRegionName, false,
> sn
> );
>
> {code}
>