(Solved) Failed to upgrade CMS

Hi gang,
I'm using Daz Studio 4.9.2.70 and started to notice a warning message in the splash screen stating "Upgrading CMS", it appears every time I start the program. I got curious and checked the logs where I found this:
2016-46-26 22:46:29.896 Connected to CMS: PostgreSQL 9.3.4, compiled by Visual C++ build 1600, 32-bit2016-46-26 22:46:30.699 WARNING: dzpostgresqlobjectdatabase.cpp(37): db insert error: ERROR: duplicate key value violates unique constraint "tblRootCategories_pkey"DETAIL: Key ("RecID")=(249) already exists.2016-46-26 22:46:30.700 db insert error: ERROR: duplicate key value violates unique constraint "tblRootCategories_pkey"DETAIL: Key ("RecID")=(249) already exists.2016-46-26 22:46:31.252 Upgrading CMS2016-46-26 22:46:31.310 WARNING: cloud\dzcloudtasknotifier.cpp(178): Upgrading database from version: 392016-46-26 22:46:55.084 WARNING: cloud\dzcloudtasknotifier.cpp(178): Query (INSERT INTO category_content(content_id, category_id, is_vendor) VALUES (42762,212,'f'),(75751,212,'f'),(76622,878,'f'),(76632,880,'f'),(81296,258,'f'),(81292,992,'f'),(76629,880,'f'),(81294,258,'f'),(81290,992,'f'),(46616,795,'f'),(76558,877,'f'),(76624,880,'f'),(76573,877,'f'),(81271,148,'f'),(76564,879,'f'),(76561,876,'f'),(76556,877,'f'),(76569,879,'f'),(76575,877,'f'),(46622,795,'f'),(76630,880,'f'),(76618,878,'f'),(81280,148,'f'),(82196,334,'f'),(10240,729,'f'),(76615,878,'f'),(76566,879,'f'),(76570,879,'f'),(76559,877,'f'),(82671,258,'f'),(76577,877,'f'),(82672,258,'f'),(76565,879,'f'),(76623,880,'f'),(76572,876,'f'),(76620,878,'f'),(76560,877,'f'),(76619,878,'f'),(76567,879,'f'),(82670,992,'f'),(82198,336,'f'),(76627,880,'f'),(46626,795,'f'),(76555,877,'f'),(76574,877,'f'),(76625,880,'f'),(76631,880,'f'),(76568,879,'f'),(76628,880,'f'),(76557,877,'f'),(82663,310,'f'),(82663,337,'f'),(46630,795,'f'),(46628,795,'f'),(46624,795,'f'),(76617,878,'f'),(76571,879,'f'),(82669,992,'f'),(46620,795,'f'),(76576,877,'f'),(76562,474,'f'),(76626,880,'f'),(76616,878,'f'),(76621,878,'f'),(81275,148,'f'),(76563,474,'f'),(80932,136,'f')) failed with exception: ERROR: duplicate key value violates unique constraint "category_content_content_id_category_id_key"DETAIL: Key (content_id, category_id)=(81296, 258) already exists.2016-46-26 22:46:55.086 WARNING: cloud\dzcloudtasknotifier.cpp(178): Unexpected exception in upgradeDb: ERROR: duplicate key value violates unique constraint "category_content_content_id_category_id_key"DETAIL: Key (content_id, category_id)=(81296, 258) already exists.2016-46-26 22:46:55.258 WARNING: cloud\dzcloudmgr.cpp(126): Failed to upgrade database2016-46-26 22:46:55.258 Creating Authentication Manager...2016-46-26 22:46:55.260 *** Scene Cleared ***
Obvious question: how serious should I take this? It seems as if its trying to apply changes which don't make sense in the first place (duplicate key errors look like a design flaw to me).
Everything is still working normally, I can still customize my CMS easily, it's just that I always get this warnign which also delays the startup times.
Post edited by ShelLuser on
Comments
Following thread considers this issue.
http://www.daz3d.com/forums/discussion/89536/4-9-2-updating-cms-takes-too-long-to-load#latest
Daz have written a script which does not always work. Key indicator.
2016-46-26 22:46:55.086 WARNING: cloud\dzcloudtasknotifier.cpp(178): Unexpected exception in upgradeDb: ERROR: duplicate key value violates unique constraint "category_content_content_id_category_id_key"
DETAIL: Key (content_id, category_id)=(81296, 258) already exists.
I submitted a help request but programming is above the helpers pay grade so never got a satisfactory fix.
The solution is whilst still in DS 4.9.1 to go to Content Library - click on menu top right - Content DB Maintenance - Export User Data
Keep back-ups of your content library just in case then Reset Database
With a reset/cleared database 4.9.2 will work OK because script has nothing to work on.
Then install 4.9.2 and reimport metadata.
Now does not work for me but might work for you. I have a very large content library which forces me to break into chunks and do this in many steps.
Takes hours but Daz are not bothered, Already Did this for 4.8 and 4.9.1 so cant be bothered for 4.9.2.
I'm furious with Daz that 4.8 worked ok and then their 4.9 messes things up and all for a change in content management that the customer did not want.
I have seen the software team put in a good number of fixes in the 4.9.3 release for these db upgrade problems.
If you have not yet given the latest public beta of Daz Studio a try, I would say give it a shot because it will likely fix it up for you.
I loaded Public build 4.9.3.25 and the characteristics in respect of this error are exactly the same. 5 minutes to load and error message in log.txt the same.
That was a month or so ago so maybe a later beta will fix it.
Sorry to revive an old thread, but I never shared the route I took to solve this mess and I think it might be useful for other viewers if they run into the same issues. I ended up following up on a tip from namffuak in another thread.
So basically I simply exported all my data (I also made a manual database backup using the pg_dump utility "just in case"), then stopped the CMS and trashed the entire (physical) directory: C:\Users\Peter\AppData\Roaming\DAZ 3D\cms\ContentCluster. Started the CMS, waited while it rebuild the whole thing and then re-imported all my metadata again using a right mouse click on the Content Library pane, selecting "Content DB maintenance" and then using "Re-Import metadata...".
There were a few minor tweaks which I needed to sort out (for example: I don't like having a root category called "People" or "Animals", I grouped those under "Figures"). So I had to edit the categories of a few entries in order to remove their default assigned categories.After that everything was back to normal and the delay is now also gone.
Thanks for your comments above!