You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Mahdi Negahi <ne...@hotmail.com> on 2012/04/25 06:05:24 UTC

Problem to Insert the row that i was deleted




I delete a row and I want to add the same row ( with same Timestamp ) to HBase but it is not added to the table. I know if I changed the timestamp it will added but it is necessary to add it with the same timestamp. 

please advice me where is my problem ?

regard
mahdi

 		 	   		  

Re: Problem to Insert the row that i was deleted

Posted by Michel Segel <mi...@hotmail.com>.
Uhm... Not exactly Lars...
Just my $0.02 ...

While I don't disagree w Lars, I think the question you have to ask is why is the time stamp important?
Is it an element of the data or is it an artifact?
This kind of gets in to your Schema design and taking short cuts. You may want to instead create a data element or column containing the time stamp rather than rely on an HBase internal time stamp. 

Or you could increase the existing time stamp by 1 ns... ;-)
(Blame it on clock drift in your cluster? Of course we don't know the significance of the time stamp ... Or how often the row is un/re deleted... 1000 times and you'd be off by a whole second.)

-Just saying... :-)


Sent from a remote device. Please excuse any typos...

Mike Segel

On Apr 25, 2012, at 1:14 AM, lars hofhansl <lh...@yahoo.com> wrote:

> Your only chance is to run a major compaction on your table - that will get rid of the delete marker. Then you can re-add the Put with the same TS.
> 
> -- Lars
> 
> ps. Rereading my email below... At some point I will learn to proof-read my emails before I send them full of grammatical errors.
> 
> 
> ----- Original Message -----
> From: Mahdi Negahi <ne...@hotmail.com>
> To: Hbase <us...@hbase.apache.org>
> Cc: 
> Sent: Tuesday, April 24, 2012 10:46 PM
> Subject: RE: Problem to Insert the row that i was deleted
> 
> 
> 
> thanks for ur sharing 
> 
> so there is no solution for return back the row ( or cells/columns) ?
> 
> 
>> Date: Tue, 24 Apr 2012 22:39:49 -0700
>> From: lhofhansl@yahoo.com
>> Subject: Re: Problem to Insert the row that i was deleted
>> To: user@hbase.apache.org
>> 
>> Rows (or rather cells/columns) are not actually deleted. Instead they are marked for deletion by a delete marker. The deleted cells are collected during the next major or minor comaction.
>> 
>> As long as the marker exist new Put (with thje same timestamp as the existing Put will affected by the delete marker.
>> The delete marker itself will exist until the next major compaction.
>> 
>> This might seems strange, but is actually an important feature of HBase as it allows operations to be executed in any order with the same end result.
>> 
>> -- Lars
>> 
>> ________________________________
>> From: Mahdi Negahi <ne...@hotmail.com>
>> To: Hbase <us...@hbase.apache.org> 
>> Sent: Tuesday, April 24, 2012 9:05 PM
>> Subject: Problem to Insert the row that i was deleted
>> 
>> 
>> 
>> 
>> 
>> I delete a row and I want to add the same row ( with same Timestamp ) to HBase but it is not added to the table. I know if I changed the timestamp it will added but it is necessary to add it with the same timestamp. 
>> 
>> please advice me where is my problem ?
>> 
>> regard
>> mahdi
> 

Re: Problem to Insert the row that i was deleted

Posted by lars hofhansl <lh...@yahoo.com>.
Thanks yonghu.


That is HBASE-4241.

One small point: The deleted rows are not deleted from the memstore, but rather not included when the memstore is flushed to disk.


-- Lars


----- Original Message -----
From: yonghu <yo...@gmail.com>
To: user@hbase.apache.org; lars hofhansl <lh...@yahoo.com>
Cc: 
Sent: Wednesday, April 25, 2012 1:10 AM
Subject: Re: Problem to Insert the row that i was deleted

As Lars mentioned, the row is not physically deleted. The way which
Hbase uses is to insert a cell called "tombstone" which is used to
mask the deleted value, but value is still there (if the deleted value
is in the same memstore with tombstone, it will be deleted in the
memstore, so you will not find tombstone and deleted value in the same
HFile.) This is new in hbase 0.92.0. In the previous 0.90.*, both
tombstone and deleted value are in HFile.  If you want to read your
deleted data, you can read the HFile which exists in server side which
is supported by 0.90.* version. If you just read the table content at
client side, I am afraid you have to first run the major compaction,
and then reinsert your deleted data.

Reagards!

Yong

On Wed, Apr 25, 2012 at 8:14 AM, lars hofhansl <lh...@yahoo.com> wrote:
> Your only chance is to run a major compaction on your table - that will get rid of the delete marker. Then you can re-add the Put with the same TS.
>
> -- Lars
>
> ps. Rereading my email below... At some point I will learn to proof-read my emails before I send them full of grammatical errors.
>
>
> ----- Original Message -----
> From: Mahdi Negahi <ne...@hotmail.com>
> To: Hbase <us...@hbase.apache.org>
> Cc:
> Sent: Tuesday, April 24, 2012 10:46 PM
> Subject: RE: Problem to Insert the row that i was deleted
>
>
>
> thanks for ur sharing
>
> so there is no solution for return back the row ( or cells/columns) ?
>
>
>> Date: Tue, 24 Apr 2012 22:39:49 -0700
>> From: lhofhansl@yahoo.com
>> Subject: Re: Problem to Insert the row that i was deleted
>> To: user@hbase.apache.org
>>
>> Rows (or rather cells/columns) are not actually deleted. Instead they are marked for deletion by a delete marker. The deleted cells are collected during the next major or minor comaction.
>>
>> As long as the marker exist new Put (with thje same timestamp as the existing Put will affected by the delete marker.
>> The delete marker itself will exist until the next major compaction.
>>
>> This might seems strange, but is actually an important feature of HBase as it allows operations to be executed in any order with the same end result.
>>
>> -- Lars
>>
>> ________________________________
>> From: Mahdi Negahi <ne...@hotmail.com>
>> To: Hbase <us...@hbase.apache.org>
>> Sent: Tuesday, April 24, 2012 9:05 PM
>> Subject: Problem to Insert the row that i was deleted
>>
>>
>>
>>
>>
>> I delete a row and I want to add the same row ( with same Timestamp ) to HBase but it is not added to the table. I know if I changed the timestamp it will added but it is necessary to add it with the same timestamp.
>>
>> please advice me where is my problem ?
>>
>> regard
>> mahdi


Re: Problem to Insert the row that i was deleted

Posted by yonghu <yo...@gmail.com>.
As Lars mentioned, the row is not physically deleted. The way which
Hbase uses is to insert a cell called "tombstone" which is used to
mask the deleted value, but value is still there (if the deleted value
is in the same memstore with tombstone, it will be deleted in the
memstore, so you will not find tombstone and deleted value in the same
HFile.) This is new in hbase 0.92.0. In the previous 0.90.*, both
tombstone and deleted value are in HFile.  If you want to read your
deleted data, you can read the HFile which exists in server side which
is supported by 0.90.* version. If you just read the table content at
client side, I am afraid you have to first run the major compaction,
and then reinsert your deleted data.

Reagards!

Yong

On Wed, Apr 25, 2012 at 8:14 AM, lars hofhansl <lh...@yahoo.com> wrote:
> Your only chance is to run a major compaction on your table - that will get rid of the delete marker. Then you can re-add the Put with the same TS.
>
> -- Lars
>
> ps. Rereading my email below... At some point I will learn to proof-read my emails before I send them full of grammatical errors.
>
>
> ----- Original Message -----
> From: Mahdi Negahi <ne...@hotmail.com>
> To: Hbase <us...@hbase.apache.org>
> Cc:
> Sent: Tuesday, April 24, 2012 10:46 PM
> Subject: RE: Problem to Insert the row that i was deleted
>
>
>
> thanks for ur sharing
>
> so there is no solution for return back the row ( or cells/columns) ?
>
>
>> Date: Tue, 24 Apr 2012 22:39:49 -0700
>> From: lhofhansl@yahoo.com
>> Subject: Re: Problem to Insert the row that i was deleted
>> To: user@hbase.apache.org
>>
>> Rows (or rather cells/columns) are not actually deleted. Instead they are marked for deletion by a delete marker. The deleted cells are collected during the next major or minor comaction.
>>
>> As long as the marker exist new Put (with thje same timestamp as the existing Put will affected by the delete marker.
>> The delete marker itself will exist until the next major compaction.
>>
>> This might seems strange, but is actually an important feature of HBase as it allows operations to be executed in any order with the same end result.
>>
>> -- Lars
>>
>> ________________________________
>> From: Mahdi Negahi <ne...@hotmail.com>
>> To: Hbase <us...@hbase.apache.org>
>> Sent: Tuesday, April 24, 2012 9:05 PM
>> Subject: Problem to Insert the row that i was deleted
>>
>>
>>
>>
>>
>> I delete a row and I want to add the same row ( with same Timestamp ) to HBase but it is not added to the table. I know if I changed the timestamp it will added but it is necessary to add it with the same timestamp.
>>
>> please advice me where is my problem ?
>>
>> regard
>> mahdi

Re: Problem to Insert the row that i was deleted

Posted by lars hofhansl <lh...@yahoo.com>.
Your only chance is to run a major compaction on your table - that will get rid of the delete marker. Then you can re-add the Put with the same TS.

-- Lars

ps. Rereading my email below... At some point I will learn to proof-read my emails before I send them full of grammatical errors.


----- Original Message -----
From: Mahdi Negahi <ne...@hotmail.com>
To: Hbase <us...@hbase.apache.org>
Cc: 
Sent: Tuesday, April 24, 2012 10:46 PM
Subject: RE: Problem to Insert the row that i was deleted



thanks for ur sharing 

so there is no solution for return back the row ( or cells/columns) ?


> Date: Tue, 24 Apr 2012 22:39:49 -0700
> From: lhofhansl@yahoo.com
> Subject: Re: Problem to Insert the row that i was deleted
> To: user@hbase.apache.org
> 
> Rows (or rather cells/columns) are not actually deleted. Instead they are marked for deletion by a delete marker. The deleted cells are collected during the next major or minor comaction.
> 
> As long as the marker exist new Put (with thje same timestamp as the existing Put will affected by the delete marker.
> The delete marker itself will exist until the next major compaction.
> 
> This might seems strange, but is actually an important feature of HBase as it allows operations to be executed in any order with the same end result.
> 
> -- Lars
> 
> ________________________________
> From: Mahdi Negahi <ne...@hotmail.com>
> To: Hbase <us...@hbase.apache.org> 
> Sent: Tuesday, April 24, 2012 9:05 PM
> Subject: Problem to Insert the row that i was deleted
> 
> 
> 
> 
> 
> I delete a row and I want to add the same row ( with same Timestamp ) to HBase but it is not added to the table. I know if I changed the timestamp it will added but it is necessary to add it with the same timestamp. 
> 
> please advice me where is my problem ?
> 
> regard
> mahdi

RE: Problem to Insert the row that i was deleted

Posted by Mahdi Negahi <ne...@hotmail.com>.

thanks for ur sharing 

so there is no solution for return back the row ( or cells/columns) ?


> Date: Tue, 24 Apr 2012 22:39:49 -0700
> From: lhofhansl@yahoo.com
> Subject: Re: Problem to Insert the row that i was deleted
> To: user@hbase.apache.org
> 
> Rows (or rather cells/columns) are not actually deleted. Instead they are marked for deletion by a delete marker. The deleted cells are collected during the next major or minor comaction.
> 
> As long as the marker exist new Put (with thje same timestamp as the existing Put will affected by the delete marker.
> The delete marker itself will exist until the next major compaction.
> 
> This might seems strange, but is actually an important feature of HBase as it allows operations to be executed in any order with the same end result.
> 
> -- Lars
> 
> ________________________________
> From: Mahdi Negahi <ne...@hotmail.com>
> To: Hbase <us...@hbase.apache.org> 
> Sent: Tuesday, April 24, 2012 9:05 PM
> Subject: Problem to Insert the row that i was deleted
> 
> 
> 
> 
> 
> I delete a row and I want to add the same row ( with same Timestamp ) to HBase but it is not added to the table. I know if I changed the timestamp it will added but it is necessary to add it with the same timestamp. 
> 
> please advice me where is my problem ?
> 
> regard
> mahdi
 		 	   		  

Re: Problem to Insert the row that i was deleted

Posted by lars hofhansl <lh...@yahoo.com>.
Rows (or rather cells/columns) are not actually deleted. Instead they are marked for deletion by a delete marker. The deleted cells are collected during the next major or minor comaction.

As long as the marker exist new Put (with thje same timestamp as the existing Put will affected by the delete marker.
The delete marker itself will exist until the next major compaction.

This might seems strange, but is actually an important feature of HBase as it allows operations to be executed in any order with the same end result.

-- Lars

________________________________
From: Mahdi Negahi <ne...@hotmail.com>
To: Hbase <us...@hbase.apache.org> 
Sent: Tuesday, April 24, 2012 9:05 PM
Subject: Problem to Insert the row that i was deleted





I delete a row and I want to add the same row ( with same Timestamp ) to HBase but it is not added to the table. I know if I changed the timestamp it will added but it is necessary to add it with the same timestamp. 

please advice me where is my problem ?

regard
mahdi