[
https://issues.apache.org/jira/browse/HBASE-880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12635492#action_12635492
]
Jim Kellerman commented on HBASE-880:
-------------------------------------
Overall, I think the patch is moving in the right direction, but I think that
the current patch is not much less complicated than the current implementation.
I would change it as follows:
RowOperation becomes a concrete class
- remove the timestamp as timestamps are associated with columns and not rows
(for getRow and deleteAll see below)
- change the constuctor so it takes a row lock and not a timestamp
- add new member that is List<ColumnOperation> (see below).
Add a new base class for columns:
{code}
public class ColumnOperation implements Writable, Comparable<ColumnOperation> {
// An empty column family means all columns in row.
protected byte[] columnFamily = HConstants.EMPTY_BYTE_ARRAY;
// An empty member means all members in the column.
protected byte[] familyMember = HConstants.EMPTY_BYTE_ARRAY;
protected long timestamp = HConstants.LATEST_TIMESTAMP;
protected int numVersions = 1;
public ColumnOperation(){} // for serialization
protected ColumnOperation(byte[] family, byte[] member, long timestamp, int
numVersions) {
...
}
...
}
{code}
The class above can be used to replace get and getRow.
get(RowOperation) assumes that the List<ColumnOperation> is a list of
ColumnOperation.
Deprecate both BatchOperation and BatchUpdate.
Add a new class that replaces BatchOperation:
{code}
public class ColumnMutation extends ColumnOperation {
// An empty value means delete the specified column.
protected byte[] value = HConstants.EMPTY_BYTE_ARRAY;
public ColumnMutation() {} // for serialization
// For updates (put)
public ColumnMutation(byte[] family, byte[] member, byte[] value, long
timestamp) {
...
}
// For deletes
public ColumnMutation(byte[] family, byte[] member, long timestamp) {
...
}
}
{code}
HTable.commit is used for both updates and deletes. It assumes that the
List<ColumnOperation> is a list of ColumnMutation.
deleteAll becomes a commit of a RowOperation with one or more ColumnMutations:
- A single ColumnMutation with empty value, empty family, member, and default
timestamp deletes all values for that row. With a timestamp, all the entries in
the row that correspond to timestamp.
- A single ColumnMutation with empty value, non-empty family corresponds to
deleteFamily (with or without timestamp as above)
- A single ColumnMutation with empty value, non-empty family and non-empty
member corresponds to current batchUpdate delete behavior
- Multiple ColumnMutations with empty value can delete multiple families or
multiple members.
Thus commit replaces current commit, deleteAll and deleteFamily.
> Improve the current client API by creating new container classes
> ----------------------------------------------------------------
>
> Key: HBASE-880
> URL: https://issues.apache.org/jira/browse/HBASE-880
> Project: Hadoop HBase
> Issue Type: Improvement
> Components: client
> Reporter: Jean-Daniel Cryans
> Assignee: Jean-Daniel Cryans
> Fix For: 0.19.0
>
> Attachments: hbase-880-v1.patch, hbase-880-v2.patch
>
>
> The current API does not scale very well. For each new feature, we have to
> add many methods to take care of all the overloads. Also, the need to batch
> row operations (gets, inserts, deletes) implies that we have to manage some
> "entities" like we are able to do with BatchUpdate but not with the other
> operations. The RowLock should be an attribute of such an entity.
> The scope of this jira is only to replace current API with another
> feature-compatible one, other methods will be added in other issues.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.