hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zhihong Yu (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HBASE-6047) Put.has() can't determine result correctly
Date Fri, 18 May 2012 16:17:06 GMT

     [ https://issues.apache.org/jira/browse/HBASE-6047?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Zhihong Yu updated HBASE-6047:
------------------------------

    Description: 
the public method 'has(byte [] family, byte [] qualifier)' internally invoked the private
method 'has(byte [] family, byte [] qualifier, long ts, byte [] value, boolean ignoreTS, boolean
ignoreValue)' with 'value=new byte[0], ignoreTS=true, ignoreValue=true', but there's a logical
error in the body, it'll enter the block
{code}
else if (ignoreValue) {
      for (KeyValue kv: list) {
        if (Arrays.equals(kv.getFamily(), family) && Arrays.equals(kv.getQualifier(),
qualifier)
            && kv.getTimestamp() == ts) {
          return true;
        }
      }
    }
{code}
the expression 'kv.getTimestamp() == ts' in the if conditions should only exist when 'ignoreTS=false',
otherwise, the following code will return false!
{code}
Put put = new Put(Bytes.toBytes("row-01"));
put.add(Bytes.toBytes("family-01"), Bytes.toBytes("qualifier-01"),
				1234567L, Bytes.toBytes("value-01"));
System.out.println(put.has(Bytes.toBytes("family-01"),
				Bytes.toBytes("qualifier-01")));
{code}

  was:
the public method 'has(byte [] family, byte [] qualifier)' internally invoked the private
method 'has(byte [] family, byte [] qualifier, long ts, byte [] value, boolean ignoreTS, boolean
ignoreValue)' with 'value=new byte[0], ignoreTS=true, ignoreValue=true', but there's a logical
error in the body, it'll enter the block
else if (ignoreValue) {
      for (KeyValue kv: list) {
        if (Arrays.equals(kv.getFamily(), family) && Arrays.equals(kv.getQualifier(),
qualifier)
            && kv.getTimestamp() == ts) {
          return true;
        }
      }
    }
the expression 'kv.getTimestamp() == ts' in the if conditions should only exist when 'ignoreTS=false',
otherwise, the following code will return false!

Put put = new Put(Bytes.toBytes("row-01"));
put.add(Bytes.toBytes("family-01"), Bytes.toBytes("qualifier-01"),
				1234567L, Bytes.toBytes("value-01"));
System.out.println(put.has(Bytes.toBytes("family-01"),
				Bytes.toBytes("qualifier-01")));

    
> Put.has() can't determine result correctly
> ------------------------------------------
>
>                 Key: HBASE-6047
>                 URL: https://issues.apache.org/jira/browse/HBASE-6047
>             Project: HBase
>          Issue Type: Bug
>          Components: client
>    Affects Versions: 0.92.1
>            Reporter: Wang Qiang
>
> the public method 'has(byte [] family, byte [] qualifier)' internally invoked the private
method 'has(byte [] family, byte [] qualifier, long ts, byte [] value, boolean ignoreTS, boolean
ignoreValue)' with 'value=new byte[0], ignoreTS=true, ignoreValue=true', but there's a logical
error in the body, it'll enter the block
> {code}
> else if (ignoreValue) {
>       for (KeyValue kv: list) {
>         if (Arrays.equals(kv.getFamily(), family) && Arrays.equals(kv.getQualifier(),
qualifier)
>             && kv.getTimestamp() == ts) {
>           return true;
>         }
>       }
>     }
> {code}
> the expression 'kv.getTimestamp() == ts' in the if conditions should only exist when
'ignoreTS=false', otherwise, the following code will return false!
> {code}
> Put put = new Put(Bytes.toBytes("row-01"));
> put.add(Bytes.toBytes("family-01"), Bytes.toBytes("qualifier-01"),
> 				1234567L, Bytes.toBytes("value-01"));
> System.out.println(put.has(Bytes.toBytes("family-01"),
> 				Bytes.toBytes("qualifier-01")));
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message