On Tuesday, May 29, 2012 10:02:53 AM, "Bob Thorman" <[email protected]>
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:[email protected]]
> Sent: Tuesday, May 29, 2012 08:49
> To: [email protected]
> Subject: Re: VersioningIterator - Latest version
>
> On Tuesday, May 29, 2012 9:38:54 AM, "Bob Thorman"
> <[email protected]> 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