Home » Modeling » EMF » [CDO] cleaning corrupt entries in a CDOResource getContents()
[CDO] cleaning corrupt entries in a CDOResource getContents() [message #1067938] |
Thu, 11 July 2013 07:06  |
Eclipse User |
|
|
|
Hi,
Our DB is corrupt, likely happened with some of the recent bugs i logged.
Now I am trying to fix the DB.
I am trying to delete entries from a Resource which do not have
corresponding objects. (So are basically marked as Stale).
For this I need the feature for Resource.getContents. I am however not
finding the corresponding feature in ECorePackage.Literals.
so the attempt will be this. Can this work?
CDOResource cdoRes = ...
for (EObject eo : cdoRes.getContents()) {
CDOObject cdoObject = CDOUtil.getCDOObject(eo);
int indexOf = cdoRes.getContents().indexOf(eo);
if (CDOUtil.isStaleObject(eo)) {
System.out.println(cdoObject + " is a stale object");
CDOUtil.cleanStaleReference(cdoRes, [EStructuralFeature], indexOf);
}
}
thanks Christophe
|
|
| |
Re: [CDO] cleaning corrupt entries in a CDOResource getContents() [message #1067941 is a reply to message #1067939] |
Thu, 11 July 2013 07:19   |
Eclipse User |
|
|
|
On 11-07-13 13:09, Eike Stepper wrote:
> Am 11.07.2013 13:06, schrieb Christophe Bouhier:
>> Hi,
>>
>> Our DB is corrupt,
> What does that mean exactly?
this is perhaps a strong word, maybe simply stale references.
what I see is that one of the entries the table eresource_CDOResource
has a count 1000.
the table eresource_CDOResource_contents_list has 1000 entries,
of these 1000, only a fraction actual point to valid CDOObjects in other
tables.
The effect, is an ObjectNotFoundException. Is this a valid case of a
stale reference, or can I use the term 'corrupt'?
I found the feature I was looking for. it's this I believe:
EresourcePackage.Literals.CDO_RESOURCE__CONTENTS
rgds Christophe
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>> likely happened with some of the recent bugs i logged.
>>
>>
>> Now I am trying to fix the DB.
>>
>> I am trying to delete entries from a Resource which do not have
>> corresponding objects. (So are basically marked as Stale).
>>
>> For this I need the feature for Resource.getContents. I am however not
>> finding the corresponding feature in ECorePackage.Literals.
>>
>> so the attempt will be this. Can this work?
>>
>> CDOResource cdoRes = ...
>>
>> for (EObject eo : cdoRes.getContents()) {
>> CDOObject cdoObject = CDOUtil.getCDOObject(eo);
>> int indexOf = cdoRes.getContents().indexOf(eo);
>>
>> if (CDOUtil.isStaleObject(eo)) {
>> System.out.println(cdoObject + " is a stale
>> object"); CDOUtil.cleanStaleReference(cdoRes,
>> [EStructuralFeature], indexOf);
>>
>> }
>> }
>>
>> thanks Christophe
>>
>
|
|
|
Re: [CDO] cleaning corrupt entries in a CDOResource getContents() [message #1067952 is a reply to message #1067941] |
Thu, 11 July 2013 08:11   |
Eclipse User |
|
|
|
Am 11.07.2013 13:19, schrieb Christophe Bouhier:
> On 11-07-13 13:09, Eike Stepper wrote:
>> Am 11.07.2013 13:06, schrieb Christophe Bouhier:
>>> Hi,
>>>
>>> Our DB is corrupt,
>> What does that mean exactly?
>
> this is perhaps a strong word, maybe simply stale references.
>
> what I see is that one of the entries the table eresource_CDOResource has a count 1000.
> the table eresource_CDOResource_contents_list has 1000 entries,
> of these 1000, only a fraction actual point to valid CDOObjects in other tables.
>
> The effect, is an ObjectNotFoundException. Is this a valid case of a stale reference, or can I use the term 'corrupt'?
That can only be considered corrupt if you enabled referential integrity checking (all the time). Otherwise it's normal
stale references.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
> I found the feature I was looking for. it's this I believe:
> EresourcePackage.Literals.CDO_RESOURCE__CONTENTS
>
> rgds Christophe
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>> likely happened with some of the recent bugs i logged.
>>>
>>>
>>> Now I am trying to fix the DB.
>>>
>>> I am trying to delete entries from a Resource which do not have
>>> corresponding objects. (So are basically marked as Stale).
>>>
>>> For this I need the feature for Resource.getContents. I am however not
>>> finding the corresponding feature in ECorePackage.Literals.
>>>
>>> so the attempt will be this. Can this work?
>>>
>>> CDOResource cdoRes = ...
>>>
>>> for (EObject eo : cdoRes.getContents()) {
>>> CDOObject cdoObject = CDOUtil.getCDOObject(eo);
>>> int indexOf = cdoRes.getContents().indexOf(eo);
>>>
>>> if (CDOUtil.isStaleObject(eo)) {
>>> System.out.println(cdoObject + " is a stale
>>> object"); CDOUtil.cleanStaleReference(cdoRes,
>>> [EStructuralFeature], indexOf);
>>>
>>> }
>>> }
>>>
>>> thanks Christophe
>>>
>>
>
|
|
|
Re: [CDO] cleaning corrupt entries in a CDOResource getContents() [message #1067955 is a reply to message #1067952] |
Thu, 11 July 2013 08:22   |
Eclipse User |
|
|
|
On 11-07-13 14:11, Eike Stepper wrote:
> Am 11.07.2013 13:19, schrieb Christophe Bouhier:
>> On 11-07-13 13:09, Eike Stepper wrote:
>>> Am 11.07.2013 13:06, schrieb Christophe Bouhier:
>>>> Hi,
>>>>
>>>> Our DB is corrupt,
>>> What does that mean exactly?
>>
>> this is perhaps a strong word, maybe simply stale references.
>>
>> what I see is that one of the entries the table eresource_CDOResource
>> has a count 1000.
>> the table eresource_CDOResource_contents_list has 1000 entries,
>> of these 1000, only a fraction actual point to valid CDOObjects in
>> other tables.
>>
>> The effect, is an ObjectNotFoundException. Is this a valid case of a
>> stale reference, or can I use the term 'corrupt'?
> That can only be considered corrupt if you enabled referential integrity
> checking (all the time). Otherwise it's normal stale references.
>
Ok, well referential integrity is not on. I do wonder how this can
happen with a contained object. Isn't the reference removed /unset
automatically? Or in other words, how can I do get in such a state
programmaticly? If I do this cdoRes.getContents().remove(i); then I
would assume the reference is also removed right? Sorry, maybe I am
missing out on something here.
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>>
>> I found the feature I was looking for. it's this I believe:
>> EresourcePackage.Literals.CDO_RESOURCE__CONTENTS
>>
>> rgds Christophe
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>> likely happened with some of the recent bugs i logged.
>>>>
>>>>
>>>> Now I am trying to fix the DB.
>>>>
>>>> I am trying to delete entries from a Resource which do not have
>>>> corresponding objects. (So are basically marked as Stale).
>>>>
>>>> For this I need the feature for Resource.getContents. I am however not
>>>> finding the corresponding feature in ECorePackage.Literals.
>>>>
>>>> so the attempt will be this. Can this work?
>>>>
>>>> CDOResource cdoRes = ...
>>>>
>>>> for (EObject eo : cdoRes.getContents()) {
>>>> CDOObject cdoObject = CDOUtil.getCDOObject(eo);
>>>> int indexOf = cdoRes.getContents().indexOf(eo);
>>>>
>>>> if (CDOUtil.isStaleObject(eo)) {
>>>> System.out.println(cdoObject + " is a stale
>>>> object"); CDOUtil.cleanStaleReference(cdoRes,
>>>> [EStructuralFeature], indexOf);
>>>>
>>>> }
>>>> }
>>>>
>>>> thanks Christophe
>>>>
>>>
>>
>
|
|
| |
Re: [CDO] cleaning corrupt entries in a CDOResource getContents() [message #1067962 is a reply to message #1067955] |
Thu, 11 July 2013 08:52   |
Eclipse User |
|
|
|
Am 11.07.2013 14:22, schrieb Christophe Bouhier:
> On 11-07-13 14:11, Eike Stepper wrote:
>> Am 11.07.2013 13:19, schrieb Christophe Bouhier:
>>> On 11-07-13 13:09, Eike Stepper wrote:
>>>> Am 11.07.2013 13:06, schrieb Christophe Bouhier:
>>>>> Hi,
>>>>>
>>>>> Our DB is corrupt,
>>>> What does that mean exactly?
>>>
>>> this is perhaps a strong word, maybe simply stale references.
>>>
>>> what I see is that one of the entries the table eresource_CDOResource
>>> has a count 1000.
>>> the table eresource_CDOResource_contents_list has 1000 entries,
>>> of these 1000, only a fraction actual point to valid CDOObjects in
>>> other tables.
>>>
>>> The effect, is an ObjectNotFoundException. Is this a valid case of a
>>> stale reference, or can I use the term 'corrupt'?
>> That can only be considered corrupt if you enabled referential integrity
>> checking (all the time). Otherwise it's normal stale references.
>>
> Ok, well referential integrity is not on. I do wonder how this can happen with a contained object. Isn't the reference
> removed /unset automatically? Or in other words, how can I do get in such a state programmaticly? If I do this
> cdoRes.getContents().remove(i); then I would assume the reference is also removed right? Sorry, maybe I am missing out
> on something here.
Oops, I missed the point that EresourcePackage.Literals.CDO_RESOURCE__CONTENTS is in fact a containment reference. Are
you sure you're not executing manual SQL queries that delete stuff?
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] cleaning corrupt entries in a CDOResource getContents() [message #1067964 is a reply to message #1067962] |
Thu, 11 July 2013 08:56  |
Eclipse User |
|
|
|
On 11-07-13 14:52, Eike Stepper wrote:
> Am 11.07.2013 14:22, schrieb Christophe Bouhier:
>> On 11-07-13 14:11, Eike Stepper wrote:
>>> Am 11.07.2013 13:19, schrieb Christophe Bouhier:
>>>> On 11-07-13 13:09, Eike Stepper wrote:
>>>>> Am 11.07.2013 13:06, schrieb Christophe Bouhier:
>>>>>> Hi,
>>>>>>
>>>>>> Our DB is corrupt,
>>>>> What does that mean exactly?
>>>>
>>>> this is perhaps a strong word, maybe simply stale references.
>>>>
>>>> what I see is that one of the entries the table eresource_CDOResource
>>>> has a count 1000.
>>>> the table eresource_CDOResource_contents_list has 1000 entries,
>>>> of these 1000, only a fraction actual point to valid CDOObjects in
>>>> other tables.
>>>>
>>>> The effect, is an ObjectNotFoundException. Is this a valid case of a
>>>> stale reference, or can I use the term 'corrupt'?
>>> That can only be considered corrupt if you enabled referential integrity
>>> checking (all the time). Otherwise it's normal stale references.
>>>
>> Ok, well referential integrity is not on. I do wonder how this can
>> happen with a contained object. Isn't the reference removed /unset
>> automatically? Or in other words, how can I do get in such a state
>> programmaticly? If I do this cdoRes.getContents().remove(i); then I
>> would assume the reference is also removed right? Sorry, maybe I am
>> missing out on something here.
> Oops, I missed the point that
> EresourcePackage.Literals.CDO_RESOURCE__CONTENTS is in fact a
> containment reference. Are you sure you're not executing manual SQL
> queries that delete stuff?
>
200% sure. But if you recall this one
https://bugs.eclipse.org/bugs/show_bug.cgi?id=396743
, and some other recent bugs, it could be the reason..
We are still on the an older CDO version, as because of this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=412520
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
|
|
|
Goto Forum:
Current Time: Wed Jul 30 18:15:35 EDT 2025
Powered by FUDForum. Page generated in 0.04038 seconds
|