database inconsistency

Author Message

Mads Ovesen

Tuesday 10 June 2008 5:42:07 am

Hi,

I'm having problems with the consistency in the database:

select * from ezcontentobject_attribute where contentobject_id=559 and data_type_string='ezbinaryfile';

outputs
+-----------------------+--------------------------+
| attribute_original_id | contentclassattribute_id |
+-----------------------+--------------------------+
| 0 | 195 |
| 0 | 291 |
| 0 | 335 |
| 0 | 337 |
| 0 | 339 |
+-----------------------+--------------------------+
while

select * from ezcontentclass_attribute where contentclass_id=17 and data_type_string='ezbinaryfile';

outputs
+---------------+-----------------+
| can_translate | contentclass_id | ... | id |
+---------------+-----------------+
| 1 | 17 | ... | 339 |
| 1 | 17 | ... | 293 |
| 1 | 17 | ... | 335 |
| 1 | 17 | ... | 337 |
| 1 | 17 | ... | 291 |
| 1 | 17 | ... | 195 |
+---------------+-----------------+

It seems that the class has all the attributes while a created node only has some of them. It probably happend because I have changed the class setup after publishing the nodes. But how can this happen? And how do I solve the problem??

/m

Kristof Coomans

Tuesday 10 June 2008 6:22:43 am

Hi Mads

From the selects you did it is not really clear if there is any corruption or not. A content class can have multiple versions (final, draft) of which the attributes are all stored in the ezcontentclass_attribute table. To find any objects that are missing certain attributes, execute something like the following SQL:

SELECT o.id, v.version, a.identifier FROM ezcontentobject_version v, ezcontentobject o, ezcontentclass_attribute a
WHERE
  v.contentobject_id=o.id
  AND a.contentclass_id=o.contentclass_id
  AND a.version=0
  AND a.id NOT IN (SELECT contentclassattribute_id FROM ezcontentobject_attribute WHERE contentobject_id=o.id AND version=v.version)
ORDER BY o.id, v.version, a.placement;

Normally, when using a database with transactions enabled, it should not happen that your content object attributes get inconsistent with the content class definition because all changes are done in 1 transaction. Without transaction support though, inconsistencies might occur. Also see http://issues.ez.no/10203

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Mads Ovesen

Tuesday 17 June 2008 7:15:37 am

Hi Kristof,

You are probably right, that I can not put is as easy as I did in the original post. But, never the less, there is a problem:

I'm missing 3 attributes when I try to edit an existing object compared to the class definition. When I create new objects of this class, there seems to be no problem. Any idea of how this has happend and what I can do about it??

/m

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.