ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Crum <adrian.c...@sandglass-software.com>
Subject Re: Should we use some lock when update qoh of InventoryItem
Date Wed, 06 Aug 2014 05:41:25 GMT
This has been discussed on the dev mailing list, and there are differing 
opinions. I agree this is a bug and should be fixed, but others believe 
it is highly unlikely two people will be modifying the same invoice at 
the same time - so it is not a problem.

Adrian Crum
Sandglass Software

On 8/6/2014 3:01 AM, YaoCL wrote:
> Hi,
> When create a new InventoryItemDetail the InventoryItem will be updated by eeca. But
If two threads create InventoryItemDetails simultaneously. Because we use ReadCommitted Isolation
level, Neither will see InventoryItemDetails created by other threads before transaction commit.
> updateInventoryItemFromDetail service will get incorrect qoh, and InventoryItem will
be updated. Two threads will all be committed successfully.
> I can confirm the behavior by set a breakpoint in org.ofbiz.minilang.method.entityops.StoreValue.exec(MethodContext)
to emulate above process. The result can be checked by this SQL.
> select * from inventory_item t1 left join (
> select inventory_item_id, sum(quantity_on_hand_diff) as qoh, sum(available_to_promise_diff)
as atp from inventory_item_detail
> group by inventory_item_id) t2 on t1.inventory_item_id = t2.inventory_item_id
> where t1.quantity_on_hand_total <> t2.qoh;
> —
> YaoCL

View raw message