You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by Vladimir Rodionov <vr...@carrieriq.com> on 2013/07/23 01:17:55 UTC

does append delete all cell versions except the last one?

I am doing some tests of append operation (HTable.append(Append append)) and it seems that
if cell being appended has multiple versions , all except the last one get deleted. Is it correct behavior or I am doing something wrong in my tests?

The test is simple. I have a row with 3 CF and 3 qualifiers in each CF and 10 versions (total # KVs stored for row is 90). I test append on the row
(for each CF:Qualifier combination)

public void testAppend()
{
                int index = 2;

                LOG.error("Test append started. Testing "+index+" row");

                byte[] row = data.get(index).get(0).getRow();
                byte[] toAppend = "APPEND".getBytes();
                LOG.error(" Append row: "+ new String(row));

                // Get all data for the row
                Get get = createGet(row, null, null, null);
                get.setMaxVersions(Integer.MAX_VALUE);
                Result result = tableA.get(get);
                List<KeyValue> ll = result.list();
               // Correct list size is 3 (total families)*3 (total columns) *10 (# versions)    = 90

               assertEquals( 90, ll.size() );

               // Do append to All 3 * 3 = 9 cells in a row
                Append append = createAppend(row, Arrays.asList(FAMILIES), Arrays.asList(COLUMNS), toAppend);
                Result r = tableA.append(append);

                ll = r.list();
                assertEquals( 9, ll.size() );

                // Check row again
                get = createGet(row, null, null, null);
                get.setMaxVersions(Integer.MAX_VALUE);

                result = tableA.get(get);

                assertEquals (90, result.size()); // This assertion FAILS: actual size is 9

}

Best regards,
Vladimir Rodionov
Principal Platform Engineer
Carrier IQ, www.carrieriq.com
e-mail: vrodionov@carrieriq.com


Confidentiality Notice:  The information contained in this message, including any attachments hereto, may be confidential and is intended to be read only by the individual or entity to whom this message is addressed. If the reader of this message is not the intended recipient or an agent or designee of the intended recipient, please note that any review, use, disclosure or distribution of this message or its attachments, in any form, is strictly prohibited.  If you have received this message in error, please immediately notify the sender and/or Notifications@carrieriq.com and delete or destroy any copy of this message and its attachments.

RE: does append delete all cell versions except the last one?

Posted by Vladimir Rodionov <vr...@carrieriq.com>.
Here it is:
//---------------------------------------------------

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import junit.framework.TestCase;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.MiniHBaseCluster;
import org.apache.hadoop.hbase.client.Append;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;


public class HBaseAppendTest extends TestCase{


        static final Log LOG = LogFactory.getLog(CoprocessorBaseTest.class);
        private static HBaseTestingUtility UTIL = new HBaseTestingUtility();
        protected byte[] TABLE_A = "TABLE_A".getBytes();
        protected byte[][] FAMILIES = new byte[][]
            {"fam_a".getBytes(), "fam_b".getBytes(), "fam_c".getBytes()};
        protected  byte[][] COLUMNS =
                {"col_a".getBytes(), "col_b".getBytes(),  "col_c".getBytes()};
        int VERSIONS = 10;

        /** The cluster. */
        MiniHBaseCluster cluster;
        HTableDescriptor tableDesc;
        HTable table;

        /* (non-Javadoc)
         * @see junit.framework.TestCase#setUp()
         */
        @Override
        public void setUp() throws Exception {
                ConsoleAppender console = new ConsoleAppender(); // create appender
                // configure the appender
                String PATTERN = "%d [%p|%c|%C{1}] %m%n";
                console.setLayout(new PatternLayout(PATTERN));
                console.setThreshold(Level.ERROR);

                console.activateOptions();
                // add appender to any Logger (here is root)
                Logger.getRootLogger().removeAllAppenders();
                Logger.getRootLogger().addAppender(console);
                Configuration conf = UTIL.getConfiguration();
                conf.set("hbase.zookeeper.useMulti", "false");
                UTIL.startMiniCluster(1);
                cluster = UTIL.getMiniHBaseCluster();
            createHBaseTable();

        }

        /**
         * Creates the HBase table.
         *
         * @throws IOException Signals that an I/O exception has occurred.
         */
        protected void createHBaseTable() throws IOException {

                LOG.error("Create HBase table and put data");
                HColumnDescriptor famA = new HColumnDescriptor(FAMILIES[0]);
                famA.setMaxVersions(VERSIONS);

                HColumnDescriptor famB = new HColumnDescriptor(FAMILIES[1]);
                famB.setMaxVersions(VERSIONS);

                HColumnDescriptor famC = new HColumnDescriptor(FAMILIES[2]);

                famC.setMaxVersions(VERSIONS);

                tableDesc = new HTableDescriptor(TABLE_A);
                tableDesc.addFamily(famA);
                tableDesc.addFamily(famB);
                tableDesc.addFamily(famC);

                Configuration cfg = cluster.getConf();
                HBaseAdmin admin = new HBaseAdmin(cfg);
                if( admin.tableExists(tableDesc.getName()) == false){
                        admin.createTable(tableDesc);
                        LOG.error("Created table "+tableDesc);
                }

                table = new HTable(cfg, TABLE_A);
                // Create row
                List<KeyValue> rowData = generateRowData();
                Put put = createPut(rowData);
                // Put data
                table.put(put);
                LOG.error("Finished.");

        }

        protected Put createPut(List<KeyValue> values)
        {
                Put put = new Put(values.get(0).getRow());
                for(KeyValue kv: values)
                {
                        put.add(kv.getFamily(), kv.getQualifier(), kv.getTimestamp(), kv.getValue());
                }
                return put;
        }

        List<KeyValue> generateRowData(){
                byte[] row = "row".getBytes();
                byte[] value = "value".getBytes();
                long startTime = System.currentTimeMillis();
                ArrayList<KeyValue> list = new ArrayList<KeyValue>();
                int count = 0;
                for(byte[] f: FAMILIES){
                        for(byte[] c: COLUMNS){
                                count = 0;
                                for(; count < VERSIONS; count++){
                                        KeyValue kv = new KeyValue(row, f, c, startTime - 1000*(count),  value);
                                        list.add(kv);
                                }
                        }
                }
                Collections.sort(list, KeyValue.COMPARATOR);
                return list;
        }
        protected Append createAppend(byte[] row, List<byte[]> families, List<byte[]> columns, byte[] value){

                Append op = new Append(row);

                for(byte[] f: families){
                        for(byte[] c: columns){
                                op.add(f, c, value);
                        }
                }
                return op;
        }

        public void testAppend() throws IOException
        {
                LOG.error("Test append started. Testing row: 'row'");

                byte[] row ="row".getBytes();
                byte[] toAppend = "_appended".getBytes();

                Get get = new Get(row);
                get.setMaxVersions(Integer.MAX_VALUE);
                Result result = table.get(get);
                assertEquals(90, result.size() );

                Append append = createAppend(row, Arrays.asList(FAMILIES), Arrays.asList(COLUMNS), toAppend);
                Result r = table.append(append);
                assertEquals(9, r.size());

                get = new Get(row);
                get.setMaxVersions(Integer.MAX_VALUE);
                result = table.get(get);
                assertEquals (90, result.size());
                LOG.error("Test append finished.");
        }
}
// -------------------------------------------------------------------------

Let me know your findings.

________________________________________
From: Ted Yu [yuzhihong@gmail.com]
Sent: Monday, July 22, 2013 4:32 PM
To: dev@hbase.apache.org
Subject: Re: does append delete all cell versions except the last one?

Can you formulate the code below as a unit test so that other people can
try it out ?

I pasted the code into a unit test but there were a few unresolved method
calls such as createGet().

Cheers


Confidentiality Notice:  The information contained in this message, including any attachments hereto, may be confidential and is intended to be read only by the individual or entity to whom this message is addressed. If the reader of this message is not the intended recipient or an agent or designee of the intended recipient, please note that any review, use, disclosure or distribution of this message or its attachments, in any form, is strictly prohibited.  If you have received this message in error, please immediately notify the sender and/or Notifications@carrieriq.com and delete or destroy any copy of this message and its attachments.

Re: does append delete all cell versions except the last one?

Posted by Ted Yu <yu...@gmail.com>.
Can you formulate the code below as a unit test so that other people can
try it out ?

I pasted the code into a unit test but there were a few unresolved method
calls such as createGet().

Cheers

On Mon, Jul 22, 2013 at 4:20 PM, Vladimir Rodionov
<vr...@carrieriq.com>wrote:

> Forgot to mention: 0.94.6.1 (CDH 4.3)
>
> Best regards,
> Vladimir Rodionov
> Principal Platform Engineer
> Carrier IQ, www.carrieriq.com
> e-mail: vrodionov@carrieriq.com
>
> ________________________________________
> From: Vladimir Rodionov
> Sent: Monday, July 22, 2013 4:17 PM
> To: dev@hbase.apache.org; lars hofhansl
> Subject: does append delete all cell versions except the last one?
>
> I am doing some tests of append operation (HTable.append(Append append))
> and it seems that
> if cell being appended has multiple versions , all except the last one get
> deleted. Is it correct behavior or I am doing something wrong in my tests?
>
> The test is simple. I have a row with 3 CF and 3 qualifiers in each CF and
> 10 versions (total # KVs stored for row is 90). I test append on the row
> (for each CF:Qualifier combination)
>
> public void testAppend()
> {
>                 int index = 2;
>
>                 LOG.error("Test append started. Testing "+index+" row");
>
>                 byte[] row = data.get(index).get(0).getRow();
>                 byte[] toAppend = "APPEND".getBytes();
>                 LOG.error(" Append row: "+ new String(row));
>
>                 // Get all data for the row
>                 Get get = createGet(row, null, null, null);
>                 get.setMaxVersions(Integer.MAX_VALUE);
>                 Result result = tableA.get(get);
>                 List<KeyValue> ll = result.list();
>                // Correct list size is 3 (total families)*3 (total
> columns) *10 (# versions)    = 90
>
>                assertEquals( 90, ll.size() );
>
>                // Do append to All 3 * 3 = 9 cells in a row
>                 Append append = createAppend(row, Arrays.asList(FAMILIES),
> Arrays.asList(COLUMNS), toAppend);
>                 Result r = tableA.append(append);
>
>                 ll = r.list();
>                 assertEquals( 9, ll.size() );
>
>                 // Check row again
>                 get = createGet(row, null, null, null);
>                 get.setMaxVersions(Integer.MAX_VALUE);
>
>                 result = tableA.get(get);
>
>                 assertEquals (90, result.size()); // This assertion FAILS:
> actual size is 9
>
> }
>
> Best regards,
> Vladimir Rodionov
> Principal Platform Engineer
> Carrier IQ, www.carrieriq.com
> e-mail: vrodionov@carrieriq.com
>
>
> Confidentiality Notice:  The information contained in this message,
> including any attachments hereto, may be confidential and is intended to be
> read only by the individual or entity to whom this message is addressed. If
> the reader of this message is not the intended recipient or an agent or
> designee of the intended recipient, please note that any review, use,
> disclosure or distribution of this message or its attachments, in any form,
> is strictly prohibited.  If you have received this message in error, please
> immediately notify the sender and/or Notifications@carrieriq.com and
> delete or destroy any copy of this message and its attachments.
>

RE: does append delete all cell versions except the last one?

Posted by Vladimir Rodionov <vr...@carrieriq.com>.
Thanks, this is what I thought.

Best regards,
Vladimir Rodionov
Principal Platform Engineer
Carrier IQ, www.carrieriq.com
e-mail: vrodionov@carrieriq.com

________________________________________
From: Ted Yu [yuzhihong@gmail.com]
Sent: Monday, July 22, 2013 8:07 PM
To: dev@hbase.apache.org
Subject: Re: does append delete all cell versions except the last one?

In 0.94, from HRegion#append():

        // Actually write to Memstore now
        for (Map.Entry<Store, List<KeyValue>> entry :
tempMemstore.entrySet()) {
          Store store = entry.getKey();
          size += store.upsert(entry.getValue());
          allKVs.addAll(entry.getValue());
        }

Looking at MemStore.upsert():

   * Inserts the specified KeyValue into MemStore and deletes any existing

   * versions of the same row/family/qualifier as the specified KeyValue.
I would say that for 0.94, the behavior is expected.

For 0.95 / trunk, there is more freedom:

upsert behavior is kept if VERSIONS for this CF == 1
Otherwise the older versions are kept around.

Cheers

On Mon, Jul 22, 2013 at 5:47 PM, Vladimir Rodionov
<vr...@carrieriq.com>wrote:

> Ted, It is not still clear to me. What I am observing in my tests can be
> explained only if on each Append
> we read the latest version of a cell, then put delete marker then put new
> version.
>
> The question still remains: expected behavior or a bug?
>
> Best regards,
> Vladimir Rodionov
> Principal Platform Engineer
> Carrier IQ, www.carrieriq.com
> e-mail: vrodionov@carrieriq.com
>
> ________________________________________
> From: Ted Yu [yuzhihong@gmail.com]
> Sent: Monday, July 22, 2013 4:54 PM
> To: dev@hbase.apache.org
> Subject: Re: does append delete all cell versions except the last one?
>
> Take a look at the release notes for:
> https://issues.apache.org/jira/browse/HBASE-4583
>
> The fix went to 0.95.0
>
> Cheers
>
> On Mon, Jul 22, 2013 at 4:20 PM, Vladimir Rodionov
> <vr...@carrieriq.com>wrote:
>
> > Forgot to mention: 0.94.6.1 (CDH 4.3)
> >
> > Best regards,
> > Vladimir Rodionov
> > Principal Platform Engineer
> > Carrier IQ, www.carrieriq.com
> > e-mail: vrodionov@carrieriq.com
> >
> > ________________________________________
> > From: Vladimir Rodionov
> > Sent: Monday, July 22, 2013 4:17 PM
> > To: dev@hbase.apache.org; lars hofhansl
> > Subject: does append delete all cell versions except the last one?
> >
> > I am doing some tests of append operation (HTable.append(Append append))
> > and it seems that
> > if cell being appended has multiple versions , all except the last one
> get
> > deleted. Is it correct behavior or I am doing something wrong in my
> tests?
> >
> > The test is simple. I have a row with 3 CF and 3 qualifiers in each CF
> and
> > 10 versions (total # KVs stored for row is 90). I test append on the row
> > (for each CF:Qualifier combination)
> >
> > public void testAppend()
> > {
> >                 int index = 2;
> >
> >                 LOG.error("Test append started. Testing "+index+" row");
> >
> >                 byte[] row = data.get(index).get(0).getRow();
> >                 byte[] toAppend = "APPEND".getBytes();
> >                 LOG.error(" Append row: "+ new String(row));
> >
> >                 // Get all data for the row
> >                 Get get = createGet(row, null, null, null);
> >                 get.setMaxVersions(Integer.MAX_VALUE);
> >                 Result result = tableA.get(get);
> >                 List<KeyValue> ll = result.list();
> >                // Correct list size is 3 (total families)*3 (total
> > columns) *10 (# versions)    = 90
> >
> >                assertEquals( 90, ll.size() );
> >
> >                // Do append to All 3 * 3 = 9 cells in a row
> >                 Append append = createAppend(row,
> Arrays.asList(FAMILIES),
> > Arrays.asList(COLUMNS), toAppend);
> >                 Result r = tableA.append(append);
> >
> >                 ll = r.list();
> >                 assertEquals( 9, ll.size() );
> >
> >                 // Check row again
> >                 get = createGet(row, null, null, null);
> >                 get.setMaxVersions(Integer.MAX_VALUE);
> >
> >                 result = tableA.get(get);
> >
> >                 assertEquals (90, result.size()); // This assertion
> FAILS:
> > actual size is 9
> >
> > }
> >
> > Best regards,
> > Vladimir Rodionov
> > Principal Platform Engineer
> > Carrier IQ, www.carrieriq.com
> > e-mail: vrodionov@carrieriq.com
> >
> >
> > Confidentiality Notice:  The information contained in this message,
> > including any attachments hereto, may be confidential and is intended to
> be
> > read only by the individual or entity to whom this message is addressed.
> If
> > the reader of this message is not the intended recipient or an agent or
> > designee of the intended recipient, please note that any review, use,
> > disclosure or distribution of this message or its attachments, in any
> form,
> > is strictly prohibited.  If you have received this message in error,
> please
> > immediately notify the sender and/or Notifications@carrieriq.com and
> > delete or destroy any copy of this message and its attachments.
> >
>
> Confidentiality Notice:  The information contained in this message,
> including any attachments hereto, may be confidential and is intended to be
> read only by the individual or entity to whom this message is addressed. If
> the reader of this message is not the intended recipient or an agent or
> designee of the intended recipient, please note that any review, use,
> disclosure or distribution of this message or its attachments, in any form,
> is strictly prohibited.  If you have received this message in error, please
> immediately notify the sender and/or Notifications@carrieriq.com and
> delete or destroy any copy of this message and its attachments.
>

Confidentiality Notice:  The information contained in this message, including any attachments hereto, may be confidential and is intended to be read only by the individual or entity to whom this message is addressed. If the reader of this message is not the intended recipient or an agent or designee of the intended recipient, please note that any review, use, disclosure or distribution of this message or its attachments, in any form, is strictly prohibited.  If you have received this message in error, please immediately notify the sender and/or Notifications@carrieriq.com and delete or destroy any copy of this message and its attachments.

Re: does append delete all cell versions except the last one?

Posted by Ted Yu <yu...@gmail.com>.
In 0.94, from HRegion#append():

        // Actually write to Memstore now
        for (Map.Entry<Store, List<KeyValue>> entry :
tempMemstore.entrySet()) {
          Store store = entry.getKey();
          size += store.upsert(entry.getValue());
          allKVs.addAll(entry.getValue());
        }

Looking at MemStore.upsert():

   * Inserts the specified KeyValue into MemStore and deletes any existing

   * versions of the same row/family/qualifier as the specified KeyValue.
I would say that for 0.94, the behavior is expected.

For 0.95 / trunk, there is more freedom:

upsert behavior is kept if VERSIONS for this CF == 1
Otherwise the older versions are kept around.

Cheers

On Mon, Jul 22, 2013 at 5:47 PM, Vladimir Rodionov
<vr...@carrieriq.com>wrote:

> Ted, It is not still clear to me. What I am observing in my tests can be
> explained only if on each Append
> we read the latest version of a cell, then put delete marker then put new
> version.
>
> The question still remains: expected behavior or a bug?
>
> Best regards,
> Vladimir Rodionov
> Principal Platform Engineer
> Carrier IQ, www.carrieriq.com
> e-mail: vrodionov@carrieriq.com
>
> ________________________________________
> From: Ted Yu [yuzhihong@gmail.com]
> Sent: Monday, July 22, 2013 4:54 PM
> To: dev@hbase.apache.org
> Subject: Re: does append delete all cell versions except the last one?
>
> Take a look at the release notes for:
> https://issues.apache.org/jira/browse/HBASE-4583
>
> The fix went to 0.95.0
>
> Cheers
>
> On Mon, Jul 22, 2013 at 4:20 PM, Vladimir Rodionov
> <vr...@carrieriq.com>wrote:
>
> > Forgot to mention: 0.94.6.1 (CDH 4.3)
> >
> > Best regards,
> > Vladimir Rodionov
> > Principal Platform Engineer
> > Carrier IQ, www.carrieriq.com
> > e-mail: vrodionov@carrieriq.com
> >
> > ________________________________________
> > From: Vladimir Rodionov
> > Sent: Monday, July 22, 2013 4:17 PM
> > To: dev@hbase.apache.org; lars hofhansl
> > Subject: does append delete all cell versions except the last one?
> >
> > I am doing some tests of append operation (HTable.append(Append append))
> > and it seems that
> > if cell being appended has multiple versions , all except the last one
> get
> > deleted. Is it correct behavior or I am doing something wrong in my
> tests?
> >
> > The test is simple. I have a row with 3 CF and 3 qualifiers in each CF
> and
> > 10 versions (total # KVs stored for row is 90). I test append on the row
> > (for each CF:Qualifier combination)
> >
> > public void testAppend()
> > {
> >                 int index = 2;
> >
> >                 LOG.error("Test append started. Testing "+index+" row");
> >
> >                 byte[] row = data.get(index).get(0).getRow();
> >                 byte[] toAppend = "APPEND".getBytes();
> >                 LOG.error(" Append row: "+ new String(row));
> >
> >                 // Get all data for the row
> >                 Get get = createGet(row, null, null, null);
> >                 get.setMaxVersions(Integer.MAX_VALUE);
> >                 Result result = tableA.get(get);
> >                 List<KeyValue> ll = result.list();
> >                // Correct list size is 3 (total families)*3 (total
> > columns) *10 (# versions)    = 90
> >
> >                assertEquals( 90, ll.size() );
> >
> >                // Do append to All 3 * 3 = 9 cells in a row
> >                 Append append = createAppend(row,
> Arrays.asList(FAMILIES),
> > Arrays.asList(COLUMNS), toAppend);
> >                 Result r = tableA.append(append);
> >
> >                 ll = r.list();
> >                 assertEquals( 9, ll.size() );
> >
> >                 // Check row again
> >                 get = createGet(row, null, null, null);
> >                 get.setMaxVersions(Integer.MAX_VALUE);
> >
> >                 result = tableA.get(get);
> >
> >                 assertEquals (90, result.size()); // This assertion
> FAILS:
> > actual size is 9
> >
> > }
> >
> > Best regards,
> > Vladimir Rodionov
> > Principal Platform Engineer
> > Carrier IQ, www.carrieriq.com
> > e-mail: vrodionov@carrieriq.com
> >
> >
> > Confidentiality Notice:  The information contained in this message,
> > including any attachments hereto, may be confidential and is intended to
> be
> > read only by the individual or entity to whom this message is addressed.
> If
> > the reader of this message is not the intended recipient or an agent or
> > designee of the intended recipient, please note that any review, use,
> > disclosure or distribution of this message or its attachments, in any
> form,
> > is strictly prohibited.  If you have received this message in error,
> please
> > immediately notify the sender and/or Notifications@carrieriq.com and
> > delete or destroy any copy of this message and its attachments.
> >
>
> Confidentiality Notice:  The information contained in this message,
> including any attachments hereto, may be confidential and is intended to be
> read only by the individual or entity to whom this message is addressed. If
> the reader of this message is not the intended recipient or an agent or
> designee of the intended recipient, please note that any review, use,
> disclosure or distribution of this message or its attachments, in any form,
> is strictly prohibited.  If you have received this message in error, please
> immediately notify the sender and/or Notifications@carrieriq.com and
> delete or destroy any copy of this message and its attachments.
>

RE: does append delete all cell versions except the last one?

Posted by Vladimir Rodionov <vr...@carrieriq.com>.
Ted, It is not still clear to me. What I am observing in my tests can be explained only if on each Append
we read the latest version of a cell, then put delete marker then put new version.

The question still remains: expected behavior or a bug?

Best regards,
Vladimir Rodionov
Principal Platform Engineer
Carrier IQ, www.carrieriq.com
e-mail: vrodionov@carrieriq.com

________________________________________
From: Ted Yu [yuzhihong@gmail.com]
Sent: Monday, July 22, 2013 4:54 PM
To: dev@hbase.apache.org
Subject: Re: does append delete all cell versions except the last one?

Take a look at the release notes for:
https://issues.apache.org/jira/browse/HBASE-4583

The fix went to 0.95.0

Cheers

On Mon, Jul 22, 2013 at 4:20 PM, Vladimir Rodionov
<vr...@carrieriq.com>wrote:

> Forgot to mention: 0.94.6.1 (CDH 4.3)
>
> Best regards,
> Vladimir Rodionov
> Principal Platform Engineer
> Carrier IQ, www.carrieriq.com
> e-mail: vrodionov@carrieriq.com
>
> ________________________________________
> From: Vladimir Rodionov
> Sent: Monday, July 22, 2013 4:17 PM
> To: dev@hbase.apache.org; lars hofhansl
> Subject: does append delete all cell versions except the last one?
>
> I am doing some tests of append operation (HTable.append(Append append))
> and it seems that
> if cell being appended has multiple versions , all except the last one get
> deleted. Is it correct behavior or I am doing something wrong in my tests?
>
> The test is simple. I have a row with 3 CF and 3 qualifiers in each CF and
> 10 versions (total # KVs stored for row is 90). I test append on the row
> (for each CF:Qualifier combination)
>
> public void testAppend()
> {
>                 int index = 2;
>
>                 LOG.error("Test append started. Testing "+index+" row");
>
>                 byte[] row = data.get(index).get(0).getRow();
>                 byte[] toAppend = "APPEND".getBytes();
>                 LOG.error(" Append row: "+ new String(row));
>
>                 // Get all data for the row
>                 Get get = createGet(row, null, null, null);
>                 get.setMaxVersions(Integer.MAX_VALUE);
>                 Result result = tableA.get(get);
>                 List<KeyValue> ll = result.list();
>                // Correct list size is 3 (total families)*3 (total
> columns) *10 (# versions)    = 90
>
>                assertEquals( 90, ll.size() );
>
>                // Do append to All 3 * 3 = 9 cells in a row
>                 Append append = createAppend(row, Arrays.asList(FAMILIES),
> Arrays.asList(COLUMNS), toAppend);
>                 Result r = tableA.append(append);
>
>                 ll = r.list();
>                 assertEquals( 9, ll.size() );
>
>                 // Check row again
>                 get = createGet(row, null, null, null);
>                 get.setMaxVersions(Integer.MAX_VALUE);
>
>                 result = tableA.get(get);
>
>                 assertEquals (90, result.size()); // This assertion FAILS:
> actual size is 9
>
> }
>
> Best regards,
> Vladimir Rodionov
> Principal Platform Engineer
> Carrier IQ, www.carrieriq.com
> e-mail: vrodionov@carrieriq.com
>
>
> Confidentiality Notice:  The information contained in this message,
> including any attachments hereto, may be confidential and is intended to be
> read only by the individual or entity to whom this message is addressed. If
> the reader of this message is not the intended recipient or an agent or
> designee of the intended recipient, please note that any review, use,
> disclosure or distribution of this message or its attachments, in any form,
> is strictly prohibited.  If you have received this message in error, please
> immediately notify the sender and/or Notifications@carrieriq.com and
> delete or destroy any copy of this message and its attachments.
>

Confidentiality Notice:  The information contained in this message, including any attachments hereto, may be confidential and is intended to be read only by the individual or entity to whom this message is addressed. If the reader of this message is not the intended recipient or an agent or designee of the intended recipient, please note that any review, use, disclosure or distribution of this message or its attachments, in any form, is strictly prohibited.  If you have received this message in error, please immediately notify the sender and/or Notifications@carrieriq.com and delete or destroy any copy of this message and its attachments.

Re: does append delete all cell versions except the last one?

Posted by Ted Yu <yu...@gmail.com>.
Take a look at the release notes for:
https://issues.apache.org/jira/browse/HBASE-4583

The fix went to 0.95.0

Cheers

On Mon, Jul 22, 2013 at 4:20 PM, Vladimir Rodionov
<vr...@carrieriq.com>wrote:

> Forgot to mention: 0.94.6.1 (CDH 4.3)
>
> Best regards,
> Vladimir Rodionov
> Principal Platform Engineer
> Carrier IQ, www.carrieriq.com
> e-mail: vrodionov@carrieriq.com
>
> ________________________________________
> From: Vladimir Rodionov
> Sent: Monday, July 22, 2013 4:17 PM
> To: dev@hbase.apache.org; lars hofhansl
> Subject: does append delete all cell versions except the last one?
>
> I am doing some tests of append operation (HTable.append(Append append))
> and it seems that
> if cell being appended has multiple versions , all except the last one get
> deleted. Is it correct behavior or I am doing something wrong in my tests?
>
> The test is simple. I have a row with 3 CF and 3 qualifiers in each CF and
> 10 versions (total # KVs stored for row is 90). I test append on the row
> (for each CF:Qualifier combination)
>
> public void testAppend()
> {
>                 int index = 2;
>
>                 LOG.error("Test append started. Testing "+index+" row");
>
>                 byte[] row = data.get(index).get(0).getRow();
>                 byte[] toAppend = "APPEND".getBytes();
>                 LOG.error(" Append row: "+ new String(row));
>
>                 // Get all data for the row
>                 Get get = createGet(row, null, null, null);
>                 get.setMaxVersions(Integer.MAX_VALUE);
>                 Result result = tableA.get(get);
>                 List<KeyValue> ll = result.list();
>                // Correct list size is 3 (total families)*3 (total
> columns) *10 (# versions)    = 90
>
>                assertEquals( 90, ll.size() );
>
>                // Do append to All 3 * 3 = 9 cells in a row
>                 Append append = createAppend(row, Arrays.asList(FAMILIES),
> Arrays.asList(COLUMNS), toAppend);
>                 Result r = tableA.append(append);
>
>                 ll = r.list();
>                 assertEquals( 9, ll.size() );
>
>                 // Check row again
>                 get = createGet(row, null, null, null);
>                 get.setMaxVersions(Integer.MAX_VALUE);
>
>                 result = tableA.get(get);
>
>                 assertEquals (90, result.size()); // This assertion FAILS:
> actual size is 9
>
> }
>
> Best regards,
> Vladimir Rodionov
> Principal Platform Engineer
> Carrier IQ, www.carrieriq.com
> e-mail: vrodionov@carrieriq.com
>
>
> Confidentiality Notice:  The information contained in this message,
> including any attachments hereto, may be confidential and is intended to be
> read only by the individual or entity to whom this message is addressed. If
> the reader of this message is not the intended recipient or an agent or
> designee of the intended recipient, please note that any review, use,
> disclosure or distribution of this message or its attachments, in any form,
> is strictly prohibited.  If you have received this message in error, please
> immediately notify the sender and/or Notifications@carrieriq.com and
> delete or destroy any copy of this message and its attachments.
>

RE: does append delete all cell versions except the last one?

Posted by Vladimir Rodionov <vr...@carrieriq.com>.
Forgot to mention: 0.94.6.1 (CDH 4.3)

Best regards,
Vladimir Rodionov
Principal Platform Engineer
Carrier IQ, www.carrieriq.com
e-mail: vrodionov@carrieriq.com

________________________________________
From: Vladimir Rodionov
Sent: Monday, July 22, 2013 4:17 PM
To: dev@hbase.apache.org; lars hofhansl
Subject: does append delete all cell versions except the last one?

I am doing some tests of append operation (HTable.append(Append append)) and it seems that
if cell being appended has multiple versions , all except the last one get deleted. Is it correct behavior or I am doing something wrong in my tests?

The test is simple. I have a row with 3 CF and 3 qualifiers in each CF and 10 versions (total # KVs stored for row is 90). I test append on the row
(for each CF:Qualifier combination)

public void testAppend()
{
                int index = 2;

                LOG.error("Test append started. Testing "+index+" row");

                byte[] row = data.get(index).get(0).getRow();
                byte[] toAppend = "APPEND".getBytes();
                LOG.error(" Append row: "+ new String(row));

                // Get all data for the row
                Get get = createGet(row, null, null, null);
                get.setMaxVersions(Integer.MAX_VALUE);
                Result result = tableA.get(get);
                List<KeyValue> ll = result.list();
               // Correct list size is 3 (total families)*3 (total columns) *10 (# versions)    = 90

               assertEquals( 90, ll.size() );

               // Do append to All 3 * 3 = 9 cells in a row
                Append append = createAppend(row, Arrays.asList(FAMILIES), Arrays.asList(COLUMNS), toAppend);
                Result r = tableA.append(append);

                ll = r.list();
                assertEquals( 9, ll.size() );

                // Check row again
                get = createGet(row, null, null, null);
                get.setMaxVersions(Integer.MAX_VALUE);

                result = tableA.get(get);

                assertEquals (90, result.size()); // This assertion FAILS: actual size is 9

}

Best regards,
Vladimir Rodionov
Principal Platform Engineer
Carrier IQ, www.carrieriq.com
e-mail: vrodionov@carrieriq.com


Confidentiality Notice:  The information contained in this message, including any attachments hereto, may be confidential and is intended to be read only by the individual or entity to whom this message is addressed. If the reader of this message is not the intended recipient or an agent or designee of the intended recipient, please note that any review, use, disclosure or distribution of this message or its attachments, in any form, is strictly prohibited.  If you have received this message in error, please immediately notify the sender and/or Notifications@carrieriq.com and delete or destroy any copy of this message and its attachments.