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

Aravindan Vijayan updated HDDS-3983:
------------------------------------
    Description: 
While investigating HDDS-3965 with [~nanda619], it was found that there is 
discrepancy in the implementation of the next(), key() and value() methods in 
the RDBStoreIterator wrapper class. 

*next()* returns the current rocksdb entry and moves ahead to the next entry. 
*key()* returns current rocksdb entry's key.
*value()* returns current rocksdb entry's value.

This means that during iteration next() returns the current value, and 
subsequent calls to key() / value() after next() will return the next value. To 
solve this, we can remove those 2 APIs from the iterator class, and have the 
usages follow this pattern.

{code}
Iterator iter = rdbTable.iterator();
while (iter.haxNext()) {
   Entry<Key,Value> entry = iter.next();
   // Use only entry.getKey(), entry.getValue().
}
{code}

  was:
While investigating HDDS-3965 with [~nanda619], it was found that there is 
discrepancy in the implementation of the next(), key() and value() methods in 
the RDBStoreIterator wrapper class. 

next() returns the current rocksdb entry and moves ahead to the next entry. 
key() returns current rocksdb entry's key.
value() returns current rocksdb entry's value.

This means that during iteration next() returns the current value, and 
subsequent calls to key() / value() after next() will return the next value. To 
solve this, we can remove those 2 APIs from the iterator class, and have the 
usages follow this pattern.

{code}
Iterator iter = rdbTable.iterator();
while (iter.haxNext()) {
   Entry<Key,Value> entry = iter.next();
   // Use only entry.getKey(), entry.getValue().
}
{code}


> Ozone RocksDB Iterator wrapper should not expose key() and value() API.
> -----------------------------------------------------------------------
>
>                 Key: HDDS-3983
>                 URL: https://issues.apache.org/jira/browse/HDDS-3983
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>    Affects Versions: 0.6.0
>            Reporter: Aravindan Vijayan
>            Priority: Major
>
> While investigating HDDS-3965 with [~nanda619], it was found that there is 
> discrepancy in the implementation of the next(), key() and value() methods in 
> the RDBStoreIterator wrapper class. 
> *next()* returns the current rocksdb entry and moves ahead to the next entry. 
> *key()* returns current rocksdb entry's key.
> *value()* returns current rocksdb entry's value.
> This means that during iteration next() returns the current value, and 
> subsequent calls to key() / value() after next() will return the next value. 
> To solve this, we can remove those 2 APIs from the iterator class, and have 
> the usages follow this pattern.
> {code}
> Iterator iter = rdbTable.iterator();
> while (iter.haxNext()) {
>    Entry<Key,Value> entry = iter.next();
>    // Use only entry.getKey(), entry.getValue().
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to