[ 
https://issues.apache.org/jira/browse/HBASE-10854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13957378#comment-13957378
 ] 

ramkrishna.s.vasudevan commented on HBASE-10854:
------------------------------------------------

{code}
  @Test
  public void testMultipleVersions() throws Exception {
    TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
    HColumnDescriptor col = new HColumnDescriptor(fam);
    col.setMaxVersions(1);
    HTableDescriptor desc = new HTableDescriptor(tableName);
    desc.addFamily(col);
    TEST_UTIL.getHBaseAdmin().createTable(desc);
    List<Put> puts = new ArrayList<Put>();
    Put put = new Put(Bytes.toBytes("row1"));
    put.add(fam, qual, 3l, Bytes.toBytes("100"));
    put.setCellVisibility(new CellVisibility(SECRET));
    puts.add(put);
    put = new Put(Bytes.toBytes("row1"));
    put.add(fam, qual, 4l, Bytes.toBytes("101"));
    put.setCellVisibility(new CellVisibility(PRIVATE));
    puts.add(put);
    HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
    table.put(puts);
    //TEST_UTIL.getHBaseAdmin().flush(tableName.getNameAsString());
    Scan s = new Scan();
    s.setMaxVersions(1);
    s.setAuthorizations(new Authorizations(SECRET));
    ResultScanner scanner = table.getScanner(s);
    Result[] next = scanner.next(4);
    assertEquals(1, next.length);
  }
{code}
Now uncommenting the flush line will give you no result.  If for a CF max 
version is 1 can we have a behaviour in Visibility Filter like SCVF to always 
return only latest version unless and other wise specified otherwise by the 
user and carry that parameter to the Visibility filter?
That would make things atleast inline with the SCVF behaviour? 
And agree with Andy that we could document this behaviour as generally filters 
with versions is always a debatable point.  But considering Visibility is 
related to security this understanding makes it even more important.

> Multiple Row/VisibilityLabels visible while in the memstore
> -----------------------------------------------------------
>
>                 Key: HBASE-10854
>                 URL: https://issues.apache.org/jira/browse/HBASE-10854
>             Project: HBase
>          Issue Type: Bug
>          Components: security
>    Affects Versions: 0.98.1
>            Reporter: Matteo Bertozzi
>
> If we update the row multiple times with different visibility labels
> we are able to get the "old version" of the row until is flushed
> {code}
> $ sudo -u hbase hbase shell
> hbase> add_labels 'A'
> hbase> add_labels 'B'
> hbase> create 'tb', 'f1'
> hbase> put 'tb', 'row', 'f1:q', 'v1', {VISIBILITY=>'A'}
> hbase> put 'tb', 'row', 'f1:q', 'v1all'
> hbase> put 'tb', 'row', 'f1:q', 'v1aOrB', {VISIBILITY=>'A|B'}
> hbase> put 'tb', 'row', 'f1:q', 'v1aAndB', {VISIBILITY=>'A&B'}
> hbase> scan 'tb'
> row column=f1:q, timestamp=1395948168154, value=v1aAndB
> 1 row
> $ sudo -u testuser hbase shell
> hbase> scan 'tb'
> row column=f1:q, timestamp=1395948168102, value=v1all
> 1 row
> {code}
> When we flush the memstore we get a single row (the last one inserted)
> so the testuser get 0 rows now.
> {code}
> $ sudo -u hbase hbase shell
> hbase> flush 'tb'
> hbase> scan 'tb'
> row column=f1:q, timestamp=1395948168154, value=v1aAndB
> 1 row
> $ sudo -u testuser hbase shell
> hbase> scan 'tb'
> 0 row
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to