Hi Jared,

I am not very familiar with this part of the code, but I think you might be
right. Because if we are updating a Map, we should first delete it the
contents and then add it, not the other way around. I also don't understand
why there are three table deletes.
Maybe you could play around with a specific test like

https://github.com/apache/gora/blob/master/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java#L535

And maybe we can detect this wrong behaviour. But I do agree with you that
there is something strange in those code lines.
Hope you can take the time to help us debug this one Jared.


Best,

Renato M.

2015-09-29 20:08 GMT+02:00 Lewis John Mcgibbney <lewis.mcgibb...@gmail.com>:

> Hi Jared,
> I briefly had a look into this and I am still trying to properly
> understand it.
> Do you have some suggestion(s) as to answering your own questions if
> you've maybe thought about it a bit more?
> Lewis
>
> On Sun, Sep 27, 2015 at 1:53 AM, Jared Wong <jw...@pinterest.com> wrote:
>
>> Hi,
>>
>> Why does gora process the deletes after the puts? Could this cause a
>> potential problem when processing MAP types because MAP types have their
>> column or column family deleted while adding new content?
>>
>> In put:
>> if (put.size() > 0) {
>>   table.put(put);
>> }
>> if (delete.size() > 0) {
>>   table.delete(delete);
>>   table.delete(delete);
>>   table.delete(delete); // HBase sometimes does not delete arbitrarily
>> }
>>
>> In addPutsAndDeletes:
>> case MAP:
>>   // if it's a map that has been modified, then the content should be
>> replaced by the new one
>>   // This is because we don't know if the content has changed or not.
>>   if (qualifier == null) {
>>     delete.deleteFamily(hcol.getFamily());
>>   } else {
>>     delete.deleteColumn(hcol.getFamily(), qualifier);
>>   }
>>   @SuppressWarnings({ "rawtypes", "unchecked" })
>>   Set<Entry> set = ((Map) o).entrySet();
>>   for (@SuppressWarnings("rawtypes") Entry entry : set) {
>>     byte[] qual = toBytes(entry.getKey());
>>     addPutsAndDeletes(put, delete, entry.getValue(), schema.getValueType()
>>         .getType(), schema.getValueType(), hcol, qual);
>>   }
>>   break;
>>
>>
>> https://github.com/apache/gora/blob/master/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L253
>>
>> Best,
>> Jared
>>
>
>
>
> --
> *Lewis*
>

Reply via email to