You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Amita Vadhavkar <am...@gmail.com> on 2007/10/02 14:32:13 UTC

[SDO+DAS] order of changed data objects in change summary

Hi,

Question in SDO -
ChangeSummary changeSummary = root.getDataGraph().getChangeSummary();
List changedDOs =  commonj.sdo.ChangeSummary.getChangedDataObjects();

is changedDOs an ordered list with order based on time of the change (i.e.
if a user does a particular sequence of create, delete etc.
is the sequence preserved in the changedDOs?)

Question in DAS -
when das.applyChanges(root) happens with multiple changes, in
Changes.execute() - DAS uses buckets of 1) insert, 2)update, 3) delete to
fire the SQL statements in
that order. Thus DAS does not attempt to preserve the order from changedDOs.
As a result, even if a user has done delete(customer.id=1) and then create(
customer.id=1), DAS
attempts INSERT first and then DELETE and give SQL Integrity exception.

If SDO change summary is preserving the order of changes, will it be better
to propagate the same order in Changes.execute()?

{Please refer to JIRA-1815 for some history.}

Regards,
Ammita

Re: [SDO+DAS] order of changed data objects in change summary

Posted by Amita Vadhavkar <am...@gmail.com>.
I am trying to see if the below is a potential problem or a rare case.
Please give your comments.

Let us take an example - customer doing bulk purchase.

When DAS does query to Customer+Order it gets back -
Customer1->Order1...Order50
(DAS starts ChangeSummary logging after query is transformed into DataGraph)

At first time,

Customer deletes Order1...Order10
He then modifies Order11....Order20
He then creates Order1...Order10 (say there is no auto-gen keys etc. and
Customer
just preserves the deleted Orders' IDs in the new ones.)

Customer finally wants to push the changes to DB thru SDO+DAS

DAS has a DataGraph which says - 10 delete, 10 updates and 10 inserts

As DAS has no way to know in which sequence to fire DB statements as per
current code DAS buckets all deletes first, then all inserts and then all
updates - form required DB statements and all goes well.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
at another time,

Customer creates 10 new orders - Order51...Order60
updates same - Order51...Order60
and then due to some reason (say no funds :)), deletes some from those
Order51...Order55

Customer finally wants to push the changes to DB thru SDO+DAS

DAS again has a DataGraph which says - 5 deletes, 10 updates and 10 inserts.

DAS has no way to know that now inserts should happen first, then updates
and then deletes as there is no time tracked. So DAS follows the previous
logic -
1> delete Order51...Order55, 2>insert Order51...Order60, 3> Update
Order51...Order60

So now, as 1> is trying to operate on data which is not there in DB yet,
there is SQL Exception and further operation will not complete
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Regards,
Amita

On 10/2/07, kelvin goodson <ke...@gmail.com> wrote:
>
> Comments inline ...
> Kelvin.
>
> On 02/10/2007, Amita Vadhavkar <am...@gmail.com> wrote:
> > Hi,
> >
> > Question in SDO -
> > ChangeSummary changeSummary = root.getDataGraph().getChangeSummary();
> > List changedDOs =  commonj.sdo.ChangeSummary.getChangedDataObjects();
> >
> > is changedDOs an ordered list with order based on time of the change (
> i.e.
> > if a user does a particular sequence of create, delete etc.
> > is the sequence preserved in the changedDOs?)
>
> A change summary describes the net effect of changes on the data
> objects in the scope of the change summary since the point that
> logging began.  It doesn't reveal a full temporally sequenced change
> history.
>
> >
> > Question in DAS -
> > when das.applyChanges(root) happens with multiple changes, in
> > Changes.execute() - DAS uses buckets of 1) insert, 2)update, 3) delete
> to
> > fire the SQL statements in
> > that order. Thus DAS does not attempt to preserve the order from
> changedDOs.
> > As a result, even if a user has done delete(customer.id=1) and then
> create(
> > customer.id=1), DAS
> > attempts INSERT first and then DELETE and give SQL Integrity exception.
> >
> > If SDO change summary is preserving the order of changes, will it be
> better
> > to propagate the same order in Changes.execute()?
> >
> > {Please refer to JIRA-1815 for some history.}
> >
> > Regards,
> > Ammita
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>

Re: [SDO+DAS] order of changed data objects in change summary

Posted by kelvin goodson <ke...@gmail.com>.
Comments inline ...
Kelvin.

On 02/10/2007, Amita Vadhavkar <am...@gmail.com> wrote:
> Hi,
>
> Question in SDO -
> ChangeSummary changeSummary = root.getDataGraph().getChangeSummary();
> List changedDOs =  commonj.sdo.ChangeSummary.getChangedDataObjects();
>
> is changedDOs an ordered list with order based on time of the change (i.e.
> if a user does a particular sequence of create, delete etc.
> is the sequence preserved in the changedDOs?)

A change summary describes the net effect of changes on the data
objects in the scope of the change summary since the point that
logging began.  It doesn't reveal a full temporally sequenced change
history.

>
> Question in DAS -
> when das.applyChanges(root) happens with multiple changes, in
> Changes.execute() - DAS uses buckets of 1) insert, 2)update, 3) delete to
> fire the SQL statements in
> that order. Thus DAS does not attempt to preserve the order from changedDOs.
> As a result, even if a user has done delete(customer.id=1) and then create(
> customer.id=1), DAS
> attempts INSERT first and then DELETE and give SQL Integrity exception.
>
> If SDO change summary is preserving the order of changes, will it be better
> to propagate the same order in Changes.execute()?
>
> {Please refer to JIRA-1815 for some history.}
>
> Regards,
> Ammita
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org