Slave server not getting deletes

#1

I have a Master and Slave Server and the slave server is getting the persists, but when I do a delete query, the records don't get deleted

"delete from TestTable t "

When I insert a record, then delete it, then re-insert it again, the slave server will give this error because the record did not get deleted.  It got deleted on the master so master has no issue.

com.objectdb.o.UserException: Attempt to reuse an existing primary key value (com.xx.xx.model.ActionMessage:('11',123))
        at com.objectdb.o.MSG.a(MSG.java:64)
        at com.objectdb.o.PPW.ad(PPW.java:209)
        at com.objectdb.o.PGW.ak(PGW.java:212)
        at com.objectdb.o.UPT.u(UPT.java:135)
        at com.objectdb.o.URT.g(URT.java:173)
        at com.objectdb.o.TSK.b(TSK.java:146)
        at com.objectdb.o.TSK.c(TSK.java:96)
        at com.objectdb.o.TSM.a(TSM.java:88)
        at com.objectdb.o.UTT.r(UTT.java:377)
        at com.objectdb.o.UTT.g(UTT.java:210)
        at com.objectdb.o.TSK.b(TSK.java:146)
        at com.objectdb.o.TSK.c(TSK.java:96)
        at com.objectdb.o.TSM.a(TSM.java:88)
        at com.objectdb.o.MST.Y4(MST.java:1437)
        at com.objectdb.o.WRA.Y4(WRA.java:398)
        at com.objectdb.o.WSM.Y4(WSM.java:186)
        at com.objectdb.o.WRA.Y4(WRA.java:398)
        at com.objectdb.o.WSN.Y4(WSN.java:664)
        at com.objectdb.o.STC.e(STC.java:533)
        at com.objectdb.o.STC.a(STC.java:263)
        at com.objectdb.o.STC.u(STC.java:157)
        at com.objectdb.o.RPR.run(RPR.java:206)
        at java.lang.Thread.run(Thread.java:748)
#2

This is an interesting report. Have you tried a normal remove. i.e. not using a delete query?

Update and delete queries bypass the persistence context and therefore may cause various cache issues.

If you could provide a small runnable program that demonstrates exactly this issue it would help.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Hi.  Just add 5 records and the delete using query.  Then add the same 5 records again.

#4

This might not be related to replication but to cache in general.

DELETE and UPDATE queries bypass the persistence context and the cache, and therefore, an extra caution is needed if used to clear all cache, e.g. to open a new EntityManager after such query operations and disable the L2 data cache.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#5

What about calling em.flush(); em.clear(); after executing UPDATE/DELETE queries?

#6

You may try. According to the documentation:

Removing entity objects from the database using a DELETE query may be slightly more efficient than retrieving entity objects and then removing them, but it should be used cautiously because bypassing the EntityManager may break its synchronization with the database. For example, the EntityManager may not be aware that a cached entity object in its persistence context has been removed from the database by a DELETE query. Therefore, it is a good practice to use a separate EntityManager for DELETE queries.

If deleting the objects using the remove method instead of a DELETE query works - you may want to consider it as a solution.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#7

Thanks.  I have done some test cases, and doing a em.flush(); em.clear(); after the query within the transaction seems to work.  


Post Reply

To post a reply and/or subscribe to update notifications - please login