hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anoop Sam John (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-12069) Finish making HFile.Writer Cell-centric; undo APIs that expect KV serializations.
Date Thu, 25 Sep 2014 11:17:33 GMT

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

Anoop Sam John commented on HBASE-12069:

Patch looks good.
Some minor comments are
+   * @param row
+   * @param value
+   * @return Cell with passed row but all other fields are arbitrary
+   */
+  public static Cell createCell(final byte [] row) {
Don't have value param for this method.

-      hfw.append(bytes, v);
+      hfw.append(CellUtil.createCell(bytes, v));
already this bytes is in form a KV key. May be we can avoid those steps above
  byte[] k = Bytes.toBytes(keyStr);
  System.out.println("RowKey: " + Bytes.toString(k));
  byte[] f = "f1".getBytes();
  byte[] q = "q1".getBytes();
  int keySize = (int) KeyValue.getKeyDataStructureSize(k.length, f.length, q.length);
  byte[] bytes = new byte[keySize];
  int pos = 0;
  pos = Bytes.putShort(bytes, pos, (short) (k.length & 0x0000ffff));
  pos = Bytes.putBytes(bytes, pos, k, 0, k.length);
  pos = Bytes.putByte(bytes, pos, (byte) f.length);
  pos = Bytes.putBytes(bytes, pos, f, 0, f.length);
  pos = Bytes.putBytes(bytes, pos, q, 0, q.length);
  pos = Bytes.putLong(bytes, pos, System.currentTimeMillis());
  pos = Bytes.putByte(bytes, pos, KeyValue.Type.Put.getCode());

We just need the 'k' byte[] and make cell from that.

Same with TestHFileBlockIndex
byte[] k = KeyValueUtil.createFirstOnRow(row, 0, row.length, row, 0, 0,
	  row, 0, 0).getKey();

  byte[] v = TestHFileWriterV2.randomValue(rand);
  writer.append(k, v, HConstants.EMPTY_BYTE_ARRAY);
We just need row byte[]

bq.You or ramkrishna.s.vasudevan have thoughts on what to do about the HFile.Reader Interface
and HFileScanner and how they both leak out 'keys' and 'values'... as byte arrays.
Will check abt this Stack.

> Finish making HFile.Writer Cell-centric; undo APIs that expect KV serializations.
> ---------------------------------------------------------------------------------
>                 Key: HBASE-12069
>                 URL: https://issues.apache.org/jira/browse/HBASE-12069
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: stack
>            Assignee: stack
>             Fix For: 0.99.1
>         Attachments: 12069.txt, 12069v2.txt, 12069v3.txt, 12069v3.txt
> See tail of parent task for discussion. Our HFile.Writer and HFile.Reader both have methods
that have the client serialize Cells in the old KeyValue way.  Purge these methods from these
private classes.

This message was sent by Atlassian JIRA

View raw message