hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: Coprocessor prePut
Date Tue, 23 Jan 2018 05:01:37 GMT
Your prePut would write to a different column in the table, right ?
Otherwise do you prevent normal writes from getting into the same column(s)
?

If your prePut writes to dedicated column(s), you can check the presence of
such column(s) so that the call is not infinite.

Cheers

On Mon, Jan 22, 2018 at 8:56 PM, Yang Zhang <zhang.yang.dm@gmail.com> wrote:

> Yes, It is the same table.
>
> 2018-01-23 1:46 GMT+08:00 Ted Yu <yuzhihong@gmail.com>:
>
> > Can you clarify your use case ?
> >
> > bq. put a data into table
> >
> > Does your coprocessor write to the same table which receives user data ?
> >
> > Cheers
> >
> > On Mon, Jan 22, 2018 at 4:24 AM, Yang Zhang <zhang.yang.dm@gmail.com>
> > wrote:
> >
> > > Hello Everyone
> > >
> > >         I am using the coprocessor and want to put another data when
> > > someone put a data into table. So I try prePut(), but when you call
> > > HRegion.put(), this will call my coprocessor's prePut function again,
> and
> > > it will cause an dead loop.
> > >
> > >         My code looks like below, If anyone know how to make HBase
> call
> > my
> > > coprocessor just for the first time?
> > >
> > > @Override
> > >     public void prePut(ObserverContext<RegionCoprocessorEnvironment>
> > > context, Put put, WALEdit edit,
> > >                        Durability durability) throws IOException {
> > >         logger.info("==== Coprocessor shouldComplete :
> > > "+context.shouldComplete()+"====");
> > >         context.bypass();
> > >
> > >         Put myPut = new Put(new RowKey(1).toBytes());
> > >
> > >         //this call will caused an dead loop
> > >         context.getEnvironment().getRegion().put(put);
> > >
> > >     }
> > >
> > > Thanks anyway
> > >
> >
>

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