You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by "Mesika, Asaf" <as...@gmail.com> on 2013/01/29 14:23:45 UTC
Getting the scan type at preCompact
Hi,
In the RegionObserver.preCompactScannerOpen() method, one of the parameters is scanType which enables me to know if the compaction is major or minor.
In the preCompact() method I don't have that parameter.
In a region observer I wrote, I'm basically wrapping the InternalScanner with my own Scanner.
My scanner should behave differently when its a a major or minor compaction.
Due to this restriction I'm forced to use preCompactScannerOpen() and create the StoreScanner, copy pasting the code that creates it in Store.compactStore() (marked in green):
if (getHRegion().getCoprocessorHost() != null) {
scanner = getHRegion()
.getCoprocessorHost()
.preCompactScannerOpen(this, scanners,
majorCompaction ? ScanType.MAJOR_COMPACT : ScanType.MINOR_COMPACT, earliestPutTs);
}
if (scanner == null) {
Scan scan = new Scan();
scan.setMaxVersions(getFamily().getMaxVersions());
/* Include deletes, unless we are doing a major compaction */
scanner = new StoreScanner(this, getScanInfo(), scan, scanners,
majorCompaction? ScanType.MAJOR_COMPACT : ScanType.MINOR_COMPACT,
smallestReadPoint, earliestPutTs);
}
if (getHRegion().getCoprocessorHost() != null) {
InternalScanner cpScanner =
getHRegion().getCoprocessorHost().preCompact(this, scanner);
// NULL scanner returned from coprocessor hooks means skip normal processing
if (cpScanner == null) {
return null;
}
scanner = cpScanner;
}
Can I file a JIRA to add the Scan Type to the preCompact method?
Thanks,
Asaf
Re: Getting the scan type at preCompact
Posted by Ted Yu <yu...@gmail.com>.
Asaf:
I guess you're suggesting that we pass ScanType into preCompact() similar
to what we pass into preCompactScannerOpen():
.preCompactScannerOpen(store, scanners,
majorCompaction ? ScanType.MAJOR_COMPACT : ScanType.
MINOR_COMPACT, earliestPutTs);
Mind filing a JIRA ?
Thanks
On Tue, Jan 29, 2013 at 10:21 AM, Asaf Mesika <as...@gmail.com> wrote:
> But my scanner is a wrapper to the scanner passed on to me in preCompact.
> This scanner is created in the Store object (StoreScanner) with arguments I
> don't have at preCompactScannerOpen(). So I can't create it. I want the
> vanilla scanner hbase uses is preCompact so I can wrap it with my behavior
> but also I need to know whether its minor or major.
> Currently I hacked my region observer so that in preCompactScannerOpen I
> save the ScanType in my instance as a field variable (ThreadLocal to be on
> the safe side) and in preCompact I read it and use it to build my wrapped
> scanner.
>
> Sent from my iPhone
>
> On 29 בינו 2013, at 16:46, ramkrishna vasudevan <
> ramkrishna.s.vasudevan@gmail.com> wrote:
>
> You can do the same with preCompactScannerOpen() hook right.
> If the scanType is minor send a wrapped internalScanner say
> MinorCompactionScanner.
>
> If the scanType is major send a wrapped interanlScanner say
> MajorCompactionScanner.
>
> Does that solve your purpose? Because if preCompactScannerOpen returns a
> scanner only that will be used inside preCompact also.
>
> Regards
> Ram
>
> On Tue, Jan 29, 2013 at 6:53 PM, Mesika, Asaf <as...@gmail.com>
> wrote:
>
> Hi,
>
>
> In the RegionObserver.preCompactScannerOpen() method, one of the
>
> parameters is scanType which enables me to know if the compaction is major
>
> or minor.
>
> In the preCompact() method I don't have that parameter.
>
>
> In a region observer I wrote, I'm basically wrapping the InternalScanner
>
> with my own Scanner.
>
> My scanner should behave differently when its a a major or minor
>
> compaction.
>
>
> Due to this restriction I'm forced to use preCompactScannerOpen() and
>
> create the StoreScanner, copy pasting the code that creates it in
>
> Store.compactStore() (marked in green):
>
>
> if (getHRegion().getCoprocessorHost() != null) {
>
> scanner = getHRegion()
>
> .getCoprocessorHost()
>
> .preCompactScannerOpen(this, scanners,
>
> majorCompaction ? ScanType.MAJOR_COMPACT :
>
> ScanType.MINOR_COMPACT, earliestPutTs);
>
> }
>
> if (scanner == null) {
>
> Scan scan = new Scan();
>
> scan.setMaxVersions(getFamily().getMaxVersions());
>
> /* Include deletes, unless we are doing a major compaction */
>
> scanner = new StoreScanner(this, getScanInfo(), scan, scanners,
>
> majorCompaction? ScanType.MAJOR_COMPACT :
>
> ScanType.MINOR_COMPACT,
>
> smallestReadPoint, earliestPutTs);
>
> }
>
> if (getHRegion().getCoprocessorHost() != null) {
>
> InternalScanner cpScanner =
>
> getHRegion().getCoprocessorHost().preCompact(this, scanner);
>
> // NULL scanner returned from coprocessor hooks means skip
>
> normal processing
>
> if (cpScanner == null) {
>
> return null;
>
> }
>
> scanner = cpScanner;
>
> }
>
>
>
> Can I file a JIRA to add the Scan Type to the preCompact method?
>
>
> Thanks,
>
>
> Asaf
>
Re: Getting the scan type at preCompact
Posted by Asaf Mesika <as...@gmail.com>.
But my scanner is a wrapper to the scanner passed on to me in preCompact.
This scanner is created in the Store object (StoreScanner) with arguments I
don't have at preCompactScannerOpen(). So I can't create it. I want the
vanilla scanner hbase uses is preCompact so I can wrap it with my behavior
but also I need to know whether its minor or major.
Currently I hacked my region observer so that in preCompactScannerOpen I
save the ScanType in my instance as a field variable (ThreadLocal to be on
the safe side) and in preCompact I read it and use it to build my wrapped
scanner.
Sent from my iPhone
On 29 בינו 2013, at 16:46, ramkrishna vasudevan <
ramkrishna.s.vasudevan@gmail.com> wrote:
You can do the same with preCompactScannerOpen() hook right.
If the scanType is minor send a wrapped internalScanner say
MinorCompactionScanner.
If the scanType is major send a wrapped interanlScanner say
MajorCompactionScanner.
Does that solve your purpose? Because if preCompactScannerOpen returns a
scanner only that will be used inside preCompact also.
Regards
Ram
On Tue, Jan 29, 2013 at 6:53 PM, Mesika, Asaf <as...@gmail.com> wrote:
Hi,
In the RegionObserver.preCompactScannerOpen() method, one of the
parameters is scanType which enables me to know if the compaction is major
or minor.
In the preCompact() method I don't have that parameter.
In a region observer I wrote, I'm basically wrapping the InternalScanner
with my own Scanner.
My scanner should behave differently when its a a major or minor
compaction.
Due to this restriction I'm forced to use preCompactScannerOpen() and
create the StoreScanner, copy pasting the code that creates it in
Store.compactStore() (marked in green):
if (getHRegion().getCoprocessorHost() != null) {
scanner = getHRegion()
.getCoprocessorHost()
.preCompactScannerOpen(this, scanners,
majorCompaction ? ScanType.MAJOR_COMPACT :
ScanType.MINOR_COMPACT, earliestPutTs);
}
if (scanner == null) {
Scan scan = new Scan();
scan.setMaxVersions(getFamily().getMaxVersions());
/* Include deletes, unless we are doing a major compaction */
scanner = new StoreScanner(this, getScanInfo(), scan, scanners,
majorCompaction? ScanType.MAJOR_COMPACT :
ScanType.MINOR_COMPACT,
smallestReadPoint, earliestPutTs);
}
if (getHRegion().getCoprocessorHost() != null) {
InternalScanner cpScanner =
getHRegion().getCoprocessorHost().preCompact(this, scanner);
// NULL scanner returned from coprocessor hooks means skip
normal processing
if (cpScanner == null) {
return null;
}
scanner = cpScanner;
}
Can I file a JIRA to add the Scan Type to the preCompact method?
Thanks,
Asaf
Re: Getting the scan type at preCompact
Posted by ramkrishna vasudevan <ra...@gmail.com>.
You can do the same with preCompactScannerOpen() hook right.
If the scanType is minor send a wrapped internalScanner say
MinorCompactionScanner.
If the scanType is major send a wrapped interanlScanner say
MajorCompactionScanner.
Does that solve your purpose? Because if preCompactScannerOpen returns a
scanner only that will be used inside preCompact also.
Regards
Ram
On Tue, Jan 29, 2013 at 6:53 PM, Mesika, Asaf <as...@gmail.com> wrote:
> Hi,
>
> In the RegionObserver.preCompactScannerOpen() method, one of the
> parameters is scanType which enables me to know if the compaction is major
> or minor.
> In the preCompact() method I don't have that parameter.
>
> In a region observer I wrote, I'm basically wrapping the InternalScanner
> with my own Scanner.
> My scanner should behave differently when its a a major or minor
> compaction.
>
> Due to this restriction I'm forced to use preCompactScannerOpen() and
> create the StoreScanner, copy pasting the code that creates it in
> Store.compactStore() (marked in green):
>
> if (getHRegion().getCoprocessorHost() != null) {
> scanner = getHRegion()
> .getCoprocessorHost()
> .preCompactScannerOpen(this, scanners,
> majorCompaction ? ScanType.MAJOR_COMPACT :
> ScanType.MINOR_COMPACT, earliestPutTs);
> }
> if (scanner == null) {
> Scan scan = new Scan();
> scan.setMaxVersions(getFamily().getMaxVersions());
> /* Include deletes, unless we are doing a major compaction */
> scanner = new StoreScanner(this, getScanInfo(), scan, scanners,
> majorCompaction? ScanType.MAJOR_COMPACT :
> ScanType.MINOR_COMPACT,
> smallestReadPoint, earliestPutTs);
> }
> if (getHRegion().getCoprocessorHost() != null) {
> InternalScanner cpScanner =
> getHRegion().getCoprocessorHost().preCompact(this, scanner);
> // NULL scanner returned from coprocessor hooks means skip
> normal processing
> if (cpScanner == null) {
> return null;
> }
> scanner = cpScanner;
> }
>
>
> Can I file a JIRA to add the Scan Type to the preCompact method?
>
> Thanks,
>
> Asaf
Re: Getting the scan type at preCompact
Posted by ramkrishna vasudevan <ra...@gmail.com>.
Ok Ted. I agree it should be available in 0.96. I too was suggesting a
work around in my mail similar to what Lars said.
Thanks Ted.
Regards
Ram
On Wed, Jan 30, 2013 at 8:23 AM, Ted Yu <yu...@gmail.com> wrote:
> I have checked in the following into trunk:
> HBASE-7712 Pass ScanType into preCompact()
>
> Since I didn't find a clean way of introducing ScanType into 0.94 without
> requiring recompilation / redeployment of coprocessor jar, the above change
> is only in 0.96
>
> Cheers
>
> On Tue, Jan 29, 2013 at 12:33 PM, Ted Yu <yu...@gmail.com> wrote:
>
> > I have logged HBASE-7712
> >
> > Patch coming soon.
> >
> >
> > On Tue, Jan 29, 2013 at 11:58 AM, lars hofhansl <la...@apache.org>
> wrote:
> >
> >> Oh yeah, wasn't disagreeing with that, just that until we have a patch
> >> there's a workaround.
> >>
> >> ------------------------------
> >> *From:* Ted Yu <yu...@gmail.com>
> >> *To:* user@hbase.apache.org; lars hofhansl <la...@apache.org>
> >> *Sent:* Tuesday, January 29, 2013 11:29 AM
> >> *Subject:* Re: Getting the scan type at preCompact
> >>
> >> Since preCompact() is given the scanner returned
> >> from preCompactScannerOpen(), I think for users it is more convenient to
> >> wrap this scanner in preCompact().
> >>
> >> Cheers
> >>
> >> On Tue, Jan 29, 2013 at 10:55 AM, lars hofhansl <la...@apache.org>
> wrote:
> >>
> >> I added the preCompactScannerOpen() to RegionObserver and didn't go back
> >> and also changes preCompact.
> >> In lieu of a fix you could create the scanner in preCompactScannerOpen()
> >> (take a look at Compactor.compact() to see how the scanner would be
> >> created).
> >>
> >> -- Lars
> >>
> >>
> >>
> >> ________________________________
> >> From: "Mesika, Asaf" <as...@gmail.com>
> >> To: user@hbase.apache.org
> >> Sent: Tuesday, January 29, 2013 5:23 AM
> >> Subject: Getting the scan type at preCompact
> >>
> >> Hi,
> >>
> >> In the RegionObserver.preCompactScannerOpen() method, one of the
> >> parameters is scanType which enables me to know if the compaction is
> major
> >> or minor.
> >> In the preCompact() method I don't have that parameter.
> >>
> >> In a region observer I wrote, I'm basically wrapping the InternalScanner
> >> with my own Scanner.
> >> My scanner should behave differently when its a a major or minor
> >> compaction.
> >>
> >> Due to this restriction I'm forced to use preCompactScannerOpen() and
> >> create the StoreScanner, copy pasting the code that creates it in
> >> Store.compactStore() (marked in green):
> >>
> >> if (getHRegion().getCoprocessorHost() != null) {
> >> scanner = getHRegion()
> >> .getCoprocessorHost()
> >> .preCompactScannerOpen(this, scanners,
> >> majorCompaction ? ScanType.MAJOR_COMPACT :
> >> ScanType.MINOR_COMPACT, earliestPutTs);
> >> }
> >> if (scanner == null) {
> >> Scan scan = new Scan();
> >> scan.setMaxVersions(getFamily().getMaxVersions());
> >> /* Include deletes, unless we are doing a major compaction */
> >> scanner = new StoreScanner(this, getScanInfo(), scan,
> scanners,
> >> majorCompaction? ScanType.MAJOR_COMPACT :
> >> ScanType.MINOR_COMPACT,
> >> smallestReadPoint, earliestPutTs);
> >> }
> >> if (getHRegion().getCoprocessorHost() != null) {
> >> InternalScanner cpScanner =
> >> getHRegion().getCoprocessorHost().preCompact(this, scanner);
> >> // NULL scanner returned from coprocessor hooks means skip
> >> normal processing
> >> if (cpScanner == null) {
> >> return null;
> >> }
> >> scanner = cpScanner;
> >> }
> >>
> >>
> >> Can I file a JIRA to add the Scan Type to the preCompact method?
> >>
> >> Thanks,
> >>
> >> Asaf
> >>
> >>
> >>
> >>
> >>
> >
>
Re: Getting the scan type at preCompact
Posted by Ted Yu <yu...@gmail.com>.
I have checked in the following into trunk:
HBASE-7712 Pass ScanType into preCompact()
Since I didn't find a clean way of introducing ScanType into 0.94 without
requiring recompilation / redeployment of coprocessor jar, the above change
is only in 0.96
Cheers
On Tue, Jan 29, 2013 at 12:33 PM, Ted Yu <yu...@gmail.com> wrote:
> I have logged HBASE-7712
>
> Patch coming soon.
>
>
> On Tue, Jan 29, 2013 at 11:58 AM, lars hofhansl <la...@apache.org> wrote:
>
>> Oh yeah, wasn't disagreeing with that, just that until we have a patch
>> there's a workaround.
>>
>> ------------------------------
>> *From:* Ted Yu <yu...@gmail.com>
>> *To:* user@hbase.apache.org; lars hofhansl <la...@apache.org>
>> *Sent:* Tuesday, January 29, 2013 11:29 AM
>> *Subject:* Re: Getting the scan type at preCompact
>>
>> Since preCompact() is given the scanner returned
>> from preCompactScannerOpen(), I think for users it is more convenient to
>> wrap this scanner in preCompact().
>>
>> Cheers
>>
>> On Tue, Jan 29, 2013 at 10:55 AM, lars hofhansl <la...@apache.org> wrote:
>>
>> I added the preCompactScannerOpen() to RegionObserver and didn't go back
>> and also changes preCompact.
>> In lieu of a fix you could create the scanner in preCompactScannerOpen()
>> (take a look at Compactor.compact() to see how the scanner would be
>> created).
>>
>> -- Lars
>>
>>
>>
>> ________________________________
>> From: "Mesika, Asaf" <as...@gmail.com>
>> To: user@hbase.apache.org
>> Sent: Tuesday, January 29, 2013 5:23 AM
>> Subject: Getting the scan type at preCompact
>>
>> Hi,
>>
>> In the RegionObserver.preCompactScannerOpen() method, one of the
>> parameters is scanType which enables me to know if the compaction is major
>> or minor.
>> In the preCompact() method I don't have that parameter.
>>
>> In a region observer I wrote, I'm basically wrapping the InternalScanner
>> with my own Scanner.
>> My scanner should behave differently when its a a major or minor
>> compaction.
>>
>> Due to this restriction I'm forced to use preCompactScannerOpen() and
>> create the StoreScanner, copy pasting the code that creates it in
>> Store.compactStore() (marked in green):
>>
>> if (getHRegion().getCoprocessorHost() != null) {
>> scanner = getHRegion()
>> .getCoprocessorHost()
>> .preCompactScannerOpen(this, scanners,
>> majorCompaction ? ScanType.MAJOR_COMPACT :
>> ScanType.MINOR_COMPACT, earliestPutTs);
>> }
>> if (scanner == null) {
>> Scan scan = new Scan();
>> scan.setMaxVersions(getFamily().getMaxVersions());
>> /* Include deletes, unless we are doing a major compaction */
>> scanner = new StoreScanner(this, getScanInfo(), scan, scanners,
>> majorCompaction? ScanType.MAJOR_COMPACT :
>> ScanType.MINOR_COMPACT,
>> smallestReadPoint, earliestPutTs);
>> }
>> if (getHRegion().getCoprocessorHost() != null) {
>> InternalScanner cpScanner =
>> getHRegion().getCoprocessorHost().preCompact(this, scanner);
>> // NULL scanner returned from coprocessor hooks means skip
>> normal processing
>> if (cpScanner == null) {
>> return null;
>> }
>> scanner = cpScanner;
>> }
>>
>>
>> Can I file a JIRA to add the Scan Type to the preCompact method?
>>
>> Thanks,
>>
>> Asaf
>>
>>
>>
>>
>>
>
Re: Getting the scan type at preCompact
Posted by Ted Yu <yu...@gmail.com>.
I have logged HBASE-7712
Patch coming soon.
On Tue, Jan 29, 2013 at 11:58 AM, lars hofhansl <la...@apache.org> wrote:
> Oh yeah, wasn't disagreeing with that, just that until we have a patch
> there's a workaround.
>
> ------------------------------
> *From:* Ted Yu <yu...@gmail.com>
> *To:* user@hbase.apache.org; lars hofhansl <la...@apache.org>
> *Sent:* Tuesday, January 29, 2013 11:29 AM
> *Subject:* Re: Getting the scan type at preCompact
>
> Since preCompact() is given the scanner returned
> from preCompactScannerOpen(), I think for users it is more convenient to
> wrap this scanner in preCompact().
>
> Cheers
>
> On Tue, Jan 29, 2013 at 10:55 AM, lars hofhansl <la...@apache.org> wrote:
>
> I added the preCompactScannerOpen() to RegionObserver and didn't go back
> and also changes preCompact.
> In lieu of a fix you could create the scanner in preCompactScannerOpen()
> (take a look at Compactor.compact() to see how the scanner would be
> created).
>
> -- Lars
>
>
>
> ________________________________
> From: "Mesika, Asaf" <as...@gmail.com>
> To: user@hbase.apache.org
> Sent: Tuesday, January 29, 2013 5:23 AM
> Subject: Getting the scan type at preCompact
>
> Hi,
>
> In the RegionObserver.preCompactScannerOpen() method, one of the
> parameters is scanType which enables me to know if the compaction is major
> or minor.
> In the preCompact() method I don't have that parameter.
>
> In a region observer I wrote, I'm basically wrapping the InternalScanner
> with my own Scanner.
> My scanner should behave differently when its a a major or minor
> compaction.
>
> Due to this restriction I'm forced to use preCompactScannerOpen() and
> create the StoreScanner, copy pasting the code that creates it in
> Store.compactStore() (marked in green):
>
> if (getHRegion().getCoprocessorHost() != null) {
> scanner = getHRegion()
> .getCoprocessorHost()
> .preCompactScannerOpen(this, scanners,
> majorCompaction ? ScanType.MAJOR_COMPACT :
> ScanType.MINOR_COMPACT, earliestPutTs);
> }
> if (scanner == null) {
> Scan scan = new Scan();
> scan.setMaxVersions(getFamily().getMaxVersions());
> /* Include deletes, unless we are doing a major compaction */
> scanner = new StoreScanner(this, getScanInfo(), scan, scanners,
> majorCompaction? ScanType.MAJOR_COMPACT :
> ScanType.MINOR_COMPACT,
> smallestReadPoint, earliestPutTs);
> }
> if (getHRegion().getCoprocessorHost() != null) {
> InternalScanner cpScanner =
> getHRegion().getCoprocessorHost().preCompact(this, scanner);
> // NULL scanner returned from coprocessor hooks means skip
> normal processing
> if (cpScanner == null) {
> return null;
> }
> scanner = cpScanner;
> }
>
>
> Can I file a JIRA to add the Scan Type to the preCompact method?
>
> Thanks,
>
> Asaf
>
>
>
>
>
Re: Getting the scan type at preCompact
Posted by lars hofhansl <la...@apache.org>.
Oh yeah, wasn't disagreeing with that, just that until we have a patch there's a workaround.
________________________________
From: Ted Yu <yu...@gmail.com>
To: user@hbase.apache.org; lars hofhansl <la...@apache.org>
Sent: Tuesday, January 29, 2013 11:29 AM
Subject: Re: Getting the scan type at preCompact
Since preCompact() is given the scanner returned from preCompactScannerOpen(), I think for users it is more convenient to wrap this scanner in preCompact().
Cheers
On Tue, Jan 29, 2013 at 10:55 AM, lars hofhansl <la...@apache.org> wrote:
I added the preCompactScannerOpen() to RegionObserver and didn't go back and also changes preCompact.
>In lieu of a fix you could create the scanner in preCompactScannerOpen() (take a look at Compactor.compact() to see how the scanner would be created).
>
>-- Lars
>
>
>
>________________________________
> From: "Mesika, Asaf" <as...@gmail.com>
>To: user@hbase.apache.org
>Sent: Tuesday, January 29, 2013 5:23 AM
>Subject: Getting the scan type at preCompact
>
>
>Hi,
>
>In the RegionObserver.preCompactScannerOpen() method, one of the parameters is scanType which enables me to know if the compaction is major or minor.
>In the preCompact() method I don't have that parameter.
>
>In a region observer I wrote, I'm basically wrapping the InternalScanner with my own Scanner.
>My scanner should behave differently when its a a major or minor compaction.
>
>Due to this restriction I'm forced to use preCompactScannerOpen() and create the StoreScanner, copy pasting the code that creates it in Store.compactStore() (marked in green):
>
> if (getHRegion().getCoprocessorHost() != null) {
> scanner = getHRegion()
> .getCoprocessorHost()
> .preCompactScannerOpen(this, scanners,
> majorCompaction ? ScanType.MAJOR_COMPACT : ScanType.MINOR_COMPACT, earliestPutTs);
> }
> if (scanner == null) {
> Scan scan = new Scan();
> scan.setMaxVersions(getFamily().getMaxVersions());
> /* Include deletes, unless we are doing a major compaction */
> scanner = new StoreScanner(this, getScanInfo(), scan, scanners,
> majorCompaction? ScanType.MAJOR_COMPACT : ScanType.MINOR_COMPACT,
> smallestReadPoint, earliestPutTs);
> }
> if (getHRegion().getCoprocessorHost() != null) {
> InternalScanner cpScanner =
> getHRegion().getCoprocessorHost().preCompact(this, scanner);
> // NULL scanner returned from coprocessor hooks means skip normal processing
> if (cpScanner == null) {
> return null;
> }
> scanner = cpScanner;
> }
>
>
>Can I file a JIRA to add the Scan Type to the preCompact method?
>
>Thanks,
>
>Asaf
Re: Getting the scan type at preCompact
Posted by Ted Yu <yu...@gmail.com>.
Since preCompact() is given the scanner returned
from preCompactScannerOpen(), I think for users it is more convenient to
wrap this scanner in preCompact().
Cheers
On Tue, Jan 29, 2013 at 10:55 AM, lars hofhansl <la...@apache.org> wrote:
> I added the preCompactScannerOpen() to RegionObserver and didn't go back
> and also changes preCompact.
> In lieu of a fix you could create the scanner in preCompactScannerOpen()
> (take a look at Compactor.compact() to see how the scanner would be
> created).
>
> -- Lars
>
>
>
> ________________________________
> From: "Mesika, Asaf" <as...@gmail.com>
> To: user@hbase.apache.org
> Sent: Tuesday, January 29, 2013 5:23 AM
> Subject: Getting the scan type at preCompact
>
> Hi,
>
> In the RegionObserver.preCompactScannerOpen() method, one of the
> parameters is scanType which enables me to know if the compaction is major
> or minor.
> In the preCompact() method I don't have that parameter.
>
> In a region observer I wrote, I'm basically wrapping the InternalScanner
> with my own Scanner.
> My scanner should behave differently when its a a major or minor
> compaction.
>
> Due to this restriction I'm forced to use preCompactScannerOpen() and
> create the StoreScanner, copy pasting the code that creates it in
> Store.compactStore() (marked in green):
>
> if (getHRegion().getCoprocessorHost() != null) {
> scanner = getHRegion()
> .getCoprocessorHost()
> .preCompactScannerOpen(this, scanners,
> majorCompaction ? ScanType.MAJOR_COMPACT :
> ScanType.MINOR_COMPACT, earliestPutTs);
> }
> if (scanner == null) {
> Scan scan = new Scan();
> scan.setMaxVersions(getFamily().getMaxVersions());
> /* Include deletes, unless we are doing a major compaction */
> scanner = new StoreScanner(this, getScanInfo(), scan, scanners,
> majorCompaction? ScanType.MAJOR_COMPACT :
> ScanType.MINOR_COMPACT,
> smallestReadPoint, earliestPutTs);
> }
> if (getHRegion().getCoprocessorHost() != null) {
> InternalScanner cpScanner =
> getHRegion().getCoprocessorHost().preCompact(this, scanner);
> // NULL scanner returned from coprocessor hooks means skip
> normal processing
> if (cpScanner == null) {
> return null;
> }
> scanner = cpScanner;
> }
>
>
> Can I file a JIRA to add the Scan Type to the preCompact method?
>
> Thanks,
>
> Asaf
>
Re: Getting the scan type at preCompact
Posted by lars hofhansl <la...@apache.org>.
I added the preCompactScannerOpen() to RegionObserver and didn't go back and also changes preCompact.
In lieu of a fix you could create the scanner in preCompactScannerOpen() (take a look at Compactor.compact() to see how the scanner would be created).
-- Lars
________________________________
From: "Mesika, Asaf" <as...@gmail.com>
To: user@hbase.apache.org
Sent: Tuesday, January 29, 2013 5:23 AM
Subject: Getting the scan type at preCompact
Hi,
In the RegionObserver.preCompactScannerOpen() method, one of the parameters is scanType which enables me to know if the compaction is major or minor.
In the preCompact() method I don't have that parameter.
In a region observer I wrote, I'm basically wrapping the InternalScanner with my own Scanner.
My scanner should behave differently when its a a major or minor compaction.
Due to this restriction I'm forced to use preCompactScannerOpen() and create the StoreScanner, copy pasting the code that creates it in Store.compactStore() (marked in green):
if (getHRegion().getCoprocessorHost() != null) {
scanner = getHRegion()
.getCoprocessorHost()
.preCompactScannerOpen(this, scanners,
majorCompaction ? ScanType.MAJOR_COMPACT : ScanType.MINOR_COMPACT, earliestPutTs);
}
if (scanner == null) {
Scan scan = new Scan();
scan.setMaxVersions(getFamily().getMaxVersions());
/* Include deletes, unless we are doing a major compaction */
scanner = new StoreScanner(this, getScanInfo(), scan, scanners,
majorCompaction? ScanType.MAJOR_COMPACT : ScanType.MINOR_COMPACT,
smallestReadPoint, earliestPutTs);
}
if (getHRegion().getCoprocessorHost() != null) {
InternalScanner cpScanner =
getHRegion().getCoprocessorHost().preCompact(this, scanner);
// NULL scanner returned from coprocessor hooks means skip normal processing
if (cpScanner == null) {
return null;
}
scanner = cpScanner;
}
Can I file a JIRA to add the Scan Type to the preCompact method?
Thanks,
Asaf