Migration command timeout

Vote:
 

Hi,

When upgrading Commerce from 9.2.1 to 9.13.0 the migration script fails at "Migrates promotion information" with a sql command timeout.

The promotionInformation table have about 35,000 records.  Is there a way to override the sql command timeout in Commerce?

We've tried setting SqlContext.Current.CommandTimeout in the initializationmodule, but it always timeouts at 30 seconds.

Thanks

#149950
Jun 09, 2016 18:57
Vote:
 

Hi,

EDIT: This will not work as the migration step uses SqlHelper which does not call SqlDataProvider internally. Sorry for the confusion

You should be able to add commandTimeout attribute to SqlDataProvider to override the command time out, like this

        <add name="SqlDataProvider" type="Mediachase.Data.Provider.SqlDataProvider, Mediachase.SqlDataProvider" connectionStringName="EcfSqlConnection" applicationName="ECApplication" commandTimeout = "120"/>


#149980
Edited, Jun 10, 2016 13:06
Vote:
 

How much record you have in ApplicationLog table?

Reagrds
/K

#150181
Jun 13, 2016 13:35
Vote:
 

I hope you did resolve this issue by a workaround.

For future visitors: We filed a bug for this and it will be resolved by upcoming releases (9.20 or so) - if you run into problem with Migrates promotion information, adjust the commandTimeout as above post.

Regards,

/Q

#150451
Jun 18, 2016 9:53
Vote:
 

Hi,

I've found a work-around. In the end I've copied the migration step code into an aspx file and set the timeout in the file.  After running the script on the server, I executed the following:

update tblBigTable set Boolean01 = 1 where string01 = 'EPiServer.Commerce.Internal.Migration.Steps.MigratePromotionInformationStep' and StoreName = 'EPiServer.Commerce.Internal.Migration.MigrationStepInfo'

thanks

#150453
Jun 18, 2016 15:59
Vote:
 

@Quan:

Make sure you check all your migration steps. RemoveOrphanedMetaKeysStep don't appear to offer a way to modify the command timeout. If you have a solution to that step, please let me know asap.

#150941
Jul 04, 2016 14:33
Vote:
 

How many rows do you have if you run this query? Any duplicated rows?

SELECT K.MetaKey
FROM MetaKey K
LEFT OUTER JOIN
(SELECT P.Number FROM CatalogContentProperty P
INNER JOIN MetaField F ON P.MetaFieldId = F.MetaFieldId
INNER JOIN MetaDataType T ON F.DataTypeId = T.DataTypeId
WHERE T.Name IN ('DictionaryMultiValue', 'EnumMultiValue', 'File', 'ImageFile', 'StringDictionary', 'MetaObject')) U
ON K.MetaKey = U.Number
WHERE K.WorkId IS NULL AND U.Number IS NULL
ORDER BY MetaKey

#150942
Jul 04, 2016 14:51
Vote:
 

@Quan

Sorry, I don't have a unmigrated database right now. I did a ugly workaround - I copied the step into my own custom step and just increased the command timeout. I also removed the original step by overriding MigrationManager and MigrationStore - so that my custom step could use the same step order as the original step (104).

I can tell that around 8 000 000 (from 9.5 to 1.5) meta keys was removed in the step. Some batches in the step took just over 30 seconds, even if I reduced the app setting ecf:RemoveOrphanedMetaKeysBatchSize (defaulted to 10 000).

#150944
Edited, Jul 04, 2016 15:29
Vote:
 

One other work around is to run the script in SSMS to avoid the timeout, and then the migration step would complete with ease.

#150946
Jul 04, 2016 16:12
Vote:
 

@Quan

When should I execute the script from RemoveOrphanedMetaKeys? Before all migration steps or after all steps? (I can prevent RemoveOrphanedMetaKeys using my existing MigrationManager/MigrationStore)

Btw, is this script correct? (I removed the @batch part)

;DECLARE @AllOrphans TABLE (MetaKey INT)

INSERT INTO @AllOrphans(MetaKey)
SELECT K.MetaKey 
FROM MetaKey K
LEFT OUTER JOIN
    (SELECT P.Number FROM CatalogContentProperty P
        INNER JOIN MetaField F ON P.MetaFieldId = F.MetaFieldId
        INNER JOIN MetaDataType T ON F.DataTypeId = T.DataTypeId
        WHERE T.Name IN ('DictionaryMultiValue', 'EnumMultiValue', 'File', 'ImageFile', 'StringDictionary', 'MetaObject')) U
ON K.MetaKey = U.Number
WHERE K.WorkId IS NULL AND U.Number IS NULL
ORDER BY MetaKey

DELETE D
FROM MetaMultiValueDictionary D
WHERE EXISTS (SELECT 1 FROM @AllOrphans WHERE MetaKey = D.MetaKey)

DELETE O
FROM MetaObjectValue O
WHERE EXISTS (SELECT 1 FROM @AllOrphans WHERE MetaKey = O.MetaKey)

DELETE F
FROM MetaFileValue F
WHERE EXISTS (SELECT 1 FROM @AllOrphans WHERE MetaKey = F.MetaKey)

DELETE S
FROM MetaStringDictionaryValue S
WHERE EXISTS (SELECT 1 FROM @AllOrphans WHERE MetaKey = S.MetaKey)

DELETE K
FROM MetaKey K
WHERE EXISTS (SELECT 1 FROM @AllOrphans WHERE MetaKey = K.MetaKey)
#150947
Edited, Jul 04, 2016 16:19
Vote:
 

I think it would make sense to try to run all the migration steps until the timeout exception happens - then run the sql above and then try to run the migration steps again.

It would help to resolve the problem if you run query I gave in the post above against your non-migrated database - if there are duplicated rows then it would make the fix simpler.

Regards,

.Q

#150949
Jul 04, 2016 22:23
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.