Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Deleting old EPiServer.Commerce.Catalog.Provider.CatalogContentDraft items after migration to Commerce 9

Vote:
 

Hi, 
Is it safe to delete old CatalogContentDraft items after migration to 9, which uses diferent versioning system. 
They take alot of space.
I'd like to use this code:
DynamicDataStore jobDataStore = typeof(CatalogContentDraft).GetStore();
var items = jobDataStore.Items().Count();
jobDataStore.DeleteAll();

I don't see anything regarding this in the migration docs.

#178677
May 17, 2017 15:45
Vote:
 

Hi,

the data migration should remove the CatalogContentDraft instances when it creates the corresponding versions in the new version system. Not all the drafts are migrated during the upgrade (migration step) though. "Non-active" versions are migrated using a scheduled job (see http://world.episerver.com/documentation/upgrading/episerver-commerce/9/)

If for some reason you still have CatalogContentDraft instances in DDS after completing all the migration steps, those will not be used by Commerce and should be safe to delete like you suggest.

#178684
May 17, 2017 20:16
Vote:
 

Note that you can run DBCC SHRINKDATABASE after deleting the draft version. It can reduce your DB size quite significantly 

#178691
May 17, 2017 22:50
Vote:
 

Is there a way to somehow increase timepout for this deletion? I'm getting timeout because there are very many objects.

Regards,
Giedrius

#178695
May 18, 2017 7:26
Vote:
 

Does it time out on the Count() or the DeleteAll()? Skip the count if you don't need it, I suspect it will try to load all data into memory. If the DeleteAll times out, you can try increasing the deleteAllOperationTimeout setting of the episerver.dataStore/dataStore config section (see http://world.episerver.com/documentation/Class-library/?documentId=cms/9/CA8FBF5C)

Or try to loop the items and delete individually instead (it might help to select just the Identity property then maybe it won't load the entire object).

#178697
May 18, 2017 8:20
Vote:
 

Hi, 
It times out on deletion. I'll try to increase timeout

#178707
May 18, 2017 11:34
Vote:
 

It's generally bad practice to do something in SQL if you can do it in APIs, but in this case you can delete those old versions from tblBigTable (filter for StoreName). Remember to backup your databases first. And IISReset will be needed after that 

#178709
May 18, 2017 15:12
Vote:
 

In this case I would really try everything to avoid direct SQL. It risks leaving orphaned items of other types behind, items that were referenced by the drafts. It will also miss associated tblBigTableReference rows. Possibly it could be better to delete from the CatalogContentDraft SQL View, but I'm not sure that would take care of referenced items either.

#178717
May 18, 2017 20:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.