You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by dShaman <ke...@dnagamesinc.com> on 2010/01/27 23:36:50 UTC

Data Nucleus and HBase - Problems during Update

I was able to get a Java based client up using Hbase which seems to work just
fine, but when I stuck a JDO layer on top via DataNucleus, I got some weird
behavior during update.  It seemed liked I could insert records, delete
records, and read records, but when I try to do an update, the record gets
removed!

Has anyone else had an issue like this?  My testing code was pretty
primitive so I'm wondering if it might be a configuration issue with
hbase/zookeeper or something else:

public void test() {
  File propsFile = new
File(AbstractPersistenceTest.DATA_NUCLEUS_PROPERTIES);
  PersistenceManagerFactory pmf =
JDOHelper.getPersistenceManagerFactory(propsFile);    
  PersistenceManager pm = pmf.getPersistenceManager();
	  
  Transaction tx = pm.currentTransaction();
  Fake entity = null;
  try {
    tx.begin();
    entity = createEntity();
    pm.makePersistent(entity);
    tx.commit();            
  } finally {
    if (tx.isActive()) {
      tx.rollback();
    }
  }
    
  String oldUUID = entity.getId();    
  String updatedName = "New Name";   
  tx = pm.currentTransaction();
  try {
    tx.begin();
    Fake readEntity = null;    
    readEntity = (Fake)pm.getObjectById(entity.getClass(), entity.getId());    
    readEntity.setName(updatedName);
    tx.commit();
  } finally {
    if (tx.isActive()) {
      tx.rollback();
    }
  }
    
  Fake updatedEntity = (Fake)pm.getObjectById(entity.getClass(), oldUUID);
// fails here.  can't find record
  assertEquals(updatedName, updatedEntity.getName());   
}
-- 
View this message in context: http://old.nabble.com/Data-Nucleus-and-HBase---Problems-during-Update-tp27348051p27348051.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: Data Nucleus and HBase - Problems during Update

Posted by dShaman <ke...@dnagamesinc.com>.

Al Lias wrote:
> 
> What can you see if you look at these entries using the hbase shell? Are
> the timestamps fine?
> 

It's hard to figure out the timestamps on the update since the record I try
to update disappears.  I can inspect the records on insert and it behaves as
expected with timestamps and all.  Here's the scan for an inserted record
with no update:

hbase(main):009:0* scan 'Fake'
10/02/01 09:24:59 DEBUG zookeeper.ZooKeeperWrapper: Read ZNode
/hbase/root-region-server got 192.168.1.145:64262
10/02/01 09:24:59 DEBUG client.HConnectionManager$TableServers: Found ROOT
at 192.168.1.145:64262
10/02/01 09:24:59 DEBUG client.HConnectionManager$TableServers: Cached
location address: 192.168.1.145:64262, regioninfo: REGION => {NAME =>
'.META.,,1', STARTKEY => '', ENDKEY => '', ENCODED => 1028785192, TABLE =>
{{NAME => '.META.', IS_META => 'true', MEMSTORE_FLUSHSIZE => '16384',
FAMILIES => [{NAME => 'historian', VERSIONS => '2147483647', COMPRESSION =>
'NONE', TTL => '604800', BLOCKSIZE => '8192', IN_MEMORY => 'false',
BLOCKCACHE => 'false'}, {NAME => 'info', VERSIONS=> '10', COMPRESSION =>
'NONE', TTL => '2147483647', BLOCKSIZE => '8192', IN_MEMORY => 'false',
BLOCKCACHE => 'false'}]}}
10/02/01 09:24:59 DEBUG client.HConnectionManager$TableServers: Cached
location address: 192.168.1.145:64262, regioninfo: REGION => {NAME =>
'Fake,,1265044620970', STARTKEY => '', ENDKEY => '', ENCODED => 1595275144,
TABLE => {{NAME => 'Fake', FAMILIES => [{NAME => 'Fake', VERSIONS => '3',
COMPRESSION => 'NONE', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY
=> 'false', BLOCKCACHE => 'true'}]}}
10/02/01 09:24:59 DEBUG client.HTable$ClientScanner: Creating scanner over
Fake starting at key ''
10/02/01 09:24:59 DEBUG client.HTable$ClientScanner: Advancing internal
scanner to startKey at ''
10/02/01 09:24:59 DEBUG client.HConnectionManager$TableServers: Cache hit
for row <> in tableName Fake: location server
192.168.1.145:64262, location region name Fake,,1265044620970
ROW                          COLUMN+CELL
 \254\355\000\005t\000 40288 column=Fake:id, timestamp=1265045090507,
value=\357\277\275\357\277\275\000\005t\ 111268a903001268a9030bb0000 000
40288111268a903001268a9030bb0000
 \254\355\000\005t\000 40288 column=Fake:name, timestamp=1265045090507,
value=\357\277\275\357\277\275\000\005 111268a903001268a9030bb0000
t\000(Name13c32a37-975a-4f5c-8770-f99034517b33
10/02/01 09:24:59 DEBUG client.HTable$ClientScanner: Finished with scanning
at REGION => {NAME => 'Fake,,1265044620970', STARTKEY => '', ENDKEY => '',
ENCODED => 1595275144, TABLE => {{NAME => 'Fake', FAMILIES => [{NAME =>
'Fake', VERSIONS=> '3', COMPRESSION => 'NONE', TTL => '2147483647',
BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}]}}

1 row(s) in 0.0370 seconds
hbase(main):010:0>


-- 
View this message in context: http://old.nabble.com/Data-Nucleus-and-HBase---Problems-during-Update-tp27348051p27408012.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: Data Nucleus and HBase - Problems during Update

Posted by Al Lias <al...@gmx.de>.
What can you see if you look at these entries using the hbase shell? Are
the timestamps fine?

--Al

Am 27.01.2010 23:36, schrieb dShaman:
> 
> I was able to get a Java based client up using Hbase which seems to work just
> fine, but when I stuck a JDO layer on top via DataNucleus, I got some weird
> behavior during update.  It seemed liked I could insert records, delete
> records, and read records, but when I try to do an update, the record gets
> removed!
> 
> Has anyone else had an issue like this?  My testing code was pretty
> primitive so I'm wondering if it might be a configuration issue with
> hbase/zookeeper or something else:
> 
> public void test() {
>   File propsFile = new
> File(AbstractPersistenceTest.DATA_NUCLEUS_PROPERTIES);
>   PersistenceManagerFactory pmf =
> JDOHelper.getPersistenceManagerFactory(propsFile);    
>   PersistenceManager pm = pmf.getPersistenceManager();
> 	  
>   Transaction tx = pm.currentTransaction();
>   Fake entity = null;
>   try {
>     tx.begin();
>     entity = createEntity();
>     pm.makePersistent(entity);
>     tx.commit();            
>   } finally {
>     if (tx.isActive()) {
>       tx.rollback();
>     }
>   }
>     
>   String oldUUID = entity.getId();    
>   String updatedName = "New Name";   
>   tx = pm.currentTransaction();
>   try {
>     tx.begin();
>     Fake readEntity = null;    
>     readEntity = (Fake)pm.getObjectById(entity.getClass(), entity.getId());    
>     readEntity.setName(updatedName);
>     tx.commit();
>   } finally {
>     if (tx.isActive()) {
>       tx.rollback();
>     }
>   }
>     
>   Fake updatedEntity = (Fake)pm.getObjectById(entity.getClass(), oldUUID);
> // fails here.  can't find record
>   assertEquals(updatedName, updatedEntity.getName());   
> }


Re: Data Nucleus and HBase - Problems during Update

Posted by Tatsuya Kawano <ta...@snowcocoa.info>.
Hello,

I just checked the latest source code of DataNucleus HBase plugin, and
it seems this is a bug of the plugin introduced at revision 7915.

Diff:
http://datanucleus.svn.sourceforge.net/viewvc/datanucleus/platform/store.hbase/trunk/src/java/org/datanucleus/store/hbase/HBasePersistenceHandler.java?r1=7898&r2=7915

Source code (r7915):
http://datanucleus.svn.sourceforge.net/viewvc/datanucleus/platform/store.hbase/trunk/src/java/org/datanucleus/store/hbase/HBasePersistenceHandler.java?revision=7915&view=markup


As you can see at the line 248 -- 251 of updateObject(), the plugin
does Delete() after Put(). I'd suggest you to file a JIRA issue at:
http://www.jpox.org/servlet/jira/browse/NUCHBASE

Thanks,

-- 
河野 達也
Tatsuya Kawano (Mr.)
Tokyo, Japan



On Thu, Jan 28, 2010 at 7:36 AM, dShaman <ke...@dnagamesinc.com> wrote:
>
> I was able to get a Java based client up using Hbase which seems to work just
> fine, but when I stuck a JDO layer on top via DataNucleus, I got some weird
> behavior during update.  It seemed liked I could insert records, delete
> records, and read records, but when I try to do an update, the record gets
> removed!
>
> Has anyone else had an issue like this?  My testing code was pretty
> primitive so I'm wondering if it might be a configuration issue with
> hbase/zookeeper or something else:
>
> public void test() {
>  File propsFile = new
> File(AbstractPersistenceTest.DATA_NUCLEUS_PROPERTIES);
>  PersistenceManagerFactory pmf =
> JDOHelper.getPersistenceManagerFactory(propsFile);
>  PersistenceManager pm = pmf.getPersistenceManager();
>
>  Transaction tx = pm.currentTransaction();
>  Fake entity = null;
>  try {
>    tx.begin();
>    entity = createEntity();
>    pm.makePersistent(entity);
>    tx.commit();
>  } finally {
>    if (tx.isActive()) {
>      tx.rollback();
>    }
>  }
>
>  String oldUUID = entity.getId();
>  String updatedName = "New Name";
>  tx = pm.currentTransaction();
>  try {
>    tx.begin();
>    Fake readEntity = null;
>    readEntity = (Fake)pm.getObjectById(entity.getClass(), entity.getId());
>    readEntity.setName(updatedName);
>    tx.commit();
>  } finally {
>    if (tx.isActive()) {
>      tx.rollback();
>    }
>  }
>
>  Fake updatedEntity = (Fake)pm.getObjectById(entity.getClass(), oldUUID);
> // fails here.  can't find record
>  assertEquals(updatedName, updatedEntity.getName());
> }

Re: Data Nucleus and HBase - Problems during Update

Posted by Al Lias <al...@gmx.de>.
Am 27.01.2010 23:36, schrieb dShaman:
> 
> I was able to get a Java based client up using Hbase which seems to work just
> fine, but when I stuck a JDO layer on top via DataNucleus, I got some weird
> behavior during update.  It seemed liked I could insert records, delete
> records, and read records, but when I try to do an update, the record gets
> removed!
> 
> Has anyone else had an issue like this?  My testing code was pretty
> primitive so I'm wondering if it might be a configuration issue with
> hbase/zookeeper or something else:
> 
> public void test() {
>   File propsFile = new
> File(AbstractPersistenceTest.DATA_NUCLEUS_PROPERTIES);
>   PersistenceManagerFactory pmf =
> JDOHelper.getPersistenceManagerFactory(propsFile);    
>   PersistenceManager pm = pmf.getPersistenceManager();
> 	  
>   Transaction tx = pm.currentTransaction();
>   Fake entity = null;
>   try {
>     tx.begin();
>     entity = createEntity();
>     pm.makePersistent(entity);
>     tx.commit();            
>   } finally {
>     if (tx.isActive()) {
>       tx.rollback();
>     }
>   }
>     
>   String oldUUID = entity.getId();    
>   String updatedName = "New Name";   
>   tx = pm.currentTransaction();
>   try {
>     tx.begin();
>     Fake readEntity = null;    
>     readEntity = (Fake)pm.getObjectById(entity.getClass(), entity.getId());    
>     readEntity.setName(updatedName);
>     tx.commit();
>   } finally {
>     if (tx.isActive()) {
>       tx.rollback();
>     }
>   }
>     
>   Fake updatedEntity = (Fake)pm.getObjectById(entity.getClass(), oldUUID);
> // fails here.  can't find record
>   assertEquals(updatedName, updatedEntity.getName());   
> }