You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@accumulo.apache.org by Bo...@l-3com.com on 2012/05/29 15:38:54 UTC

VersioningIterator - Latest version

Has anyone developed an iterator that returns the latest version of each
RowID when the maxVersions is greater than one?  

Bob Thorman
Engineering Fellow
L-3 Communications, ComCept
1700 Science Place
Rockwall, TX 75032
(972) 772-7501 work
Bob.Thorman@ncct.af.smil.mil
rdthorm@nsa.ic.gov



Re: VersioningIterator - Latest version

Posted by Billie J Rinaldi <bi...@ugov.gov>.
On Tuesday, May 29, 2012 10:02:53 AM, "Bob Thorman" <Bo...@l-3com.com> wrote:
> So my table has maxversions set to 99999 for the table so that rows
> are kept for every instance of a KVP update. And during some scan
> operations (not all) the user would like to see the latest version of
> each row. So the answer to your question, "Are you trying to keep more
> than one version stored, but only see one version when scanning?" is
> yes. Are you suggesting that in the case where I want a scanner to
> return only one instance of each RowID I can set that scanner to
> maxVersion=1 and get that result?
> 
> An example rowset of a table that has maxVersion=99999:
> 
> BOB person:father [public] 1234567892 Hello world!
> BOB person:father [public] 1234567891 Hello world!
> BOB person:father [public] 1234567890 Hello world!
> BOB person:uncle [public] 1234567892 Hello world!
> BOB person:uncle [public] 1234567891 Hello world!
> BOB person:uncle [public] 1234567890 Hello world!
> BOB person:brother [public] 1234567892 Hello world!
> BOB person:brother [public] 1234567891 Hello world!
> BOB person:brother [public] 1234567890 Hello world!
> 
> Scanner with maxVersion=1 results in:
> 
> BOB person:father [public] 1234567892 Hello world!
> BOB person:uncle [public] 1234567892 Hello world!
> BOB person:brother [public] 1234567892 Hello world!
> 
> Is it possible to set a scanner with a VersioningIterator that has
> maxVersions=1?

If you're looking to keep all versions, I would just remove the versioning iterator from the table:
    connector.tableOperations().removeIterator(tableName, "vers", EnumSet.allOf(IteratorScope.class));
or in the shell:
    deleteiter -t tableName -n vers -minc -majc -scan

Then you can add the versioning iterator back in for a particular scan:
    IteratorSetting setting = new IteratorSetting(20, "vers", VersioningIterator.class);
    VersioningIterator.setMaxVersions(setting, 1);
    scanner.addScanIterator(setting);

Billie


> -----Original Message-----
> From: Billie J Rinaldi [mailto:billie.j.rinaldi@ugov.gov]
> Sent: Tuesday, May 29, 2012 08:49
> To: user@accumulo.apache.org
> Subject: Re: VersioningIterator - Latest version
> 
> On Tuesday, May 29, 2012 9:38:54 AM, "Bob Thorman"
> <Bo...@l-3com.com> wrote:
> > Has anyone developed an iterator that returns the latest version of
> > each RowID when the maxVersions is greater than one?
> 
> Could you give me an example of what you'd like to do? The versioning
> iterator gives you the latest version of each key when maxVersions is
> set to 1. Are you trying to keep more than one version stored, but
> only see one version when scanning? If that's the case, you could set
> maxVersions to 1 for the scan scope but set it higher for the other
> scopes.
> 
> Billie

RE: VersioningIterator - Latest version

Posted by Bo...@l-3com.com.
So my table has maxversions set to 99999 for the table so that rows are kept for every instance of a KVP update.  And during some scan operations (not all) the user would like to see the latest version of each row.  So the answer to your question, "Are you trying to keep more than one version stored, but only see one version when scanning?" is yes.  Are you suggesting that in the case where I want a scanner to return only one instance of each RowID I can set that scanner to maxVersion=1 and get that result?  

An example rowset of a table that has maxVersion=99999:

BOB person:father [public] 1234567892 Hello world!
BOB person:father [public] 1234567891 Hello world!
BOB person:father [public] 1234567890 Hello world!
BOB person:uncle [public] 1234567892 Hello world!
BOB person:uncle [public] 1234567891 Hello world!
BOB person:uncle [public] 1234567890 Hello world!
BOB person:brother [public] 1234567892 Hello world!
BOB person:brother [public] 1234567891 Hello world!
BOB person:brother [public] 1234567890 Hello world!

Scanner with maxVersion=1 results in:

BOB person:father [public] 1234567892 Hello world!
BOB person:uncle [public] 1234567892 Hello world!
BOB person:brother [public] 1234567892 Hello world!

Is it possible to set a scanner with a VersioningIterator that has maxVersions=1?

-----Original Message-----
From: Billie J Rinaldi [mailto:billie.j.rinaldi@ugov.gov] 
Sent: Tuesday, May 29, 2012 08:49
To: user@accumulo.apache.org
Subject: Re: VersioningIterator - Latest version

On Tuesday, May 29, 2012 9:38:54 AM, "Bob Thorman" <Bo...@l-3com.com> wrote:
> Has anyone developed an iterator that returns the latest version of 
> each RowID when the maxVersions is greater than one?

Could you give me an example of what you'd like to do?  The versioning iterator gives you the latest version of each key when maxVersions is set to 1.  Are you trying to keep more than one version stored, but only see one version when scanning?  If that's the case, you could set maxVersions to 1 for the scan scope but set it higher for the other scopes.

Billie

Re: VersioningIterator - Latest version

Posted by Billie J Rinaldi <bi...@ugov.gov>.
On Tuesday, May 29, 2012 9:38:54 AM, "Bob Thorman" <Bo...@l-3com.com> wrote:
> Has anyone developed an iterator that returns the latest version of
> each
> RowID when the maxVersions is greater than one?

Could you give me an example of what you'd like to do?  The versioning iterator gives you the latest version of each key when maxVersions is set to 1.  Are you trying to keep more than one version stored, but only see one version when scanning?  If that's the case, you could set maxVersions to 1 for the scan scope but set it higher for the other scopes.

Billie