Bug in migration step "Migrates published Catalog Content"

Vote:
 

Hello Community,

We have migrated to the new version and faced with the issue due to which it is possible to lose products data.
Preconditions for reproduce issue.
We have more then N product of one type. N it is amunt from appSettings 'ecf:DraftMigrationBatchSize' or 5000

Code from MigratePublishedContentStep

do {
	DataTable idTable = DraftStoreMigrator.CreateIdTable();
	DataTable propertyTable = this.CreatePropertyTable();
	DataTable contentExTable = this.CreateContentExTable();
	num2 = 0;
	foreach(string language in(IEnumerable < string > )languages)
	num2 += this.ListPropertyData(metaClass, language, (int)contentType, MigratePublishedContentStep.BatchSize, propertyTable, contentExTable, idTable);
	if (num2 > 0) {
		using(TransactionScope transactionScope = new TransactionScope()) {

			DBHelper.ExecuteNonQuery(MetaDataContext.Instance, CommandType.StoredProcedure, "CatalogContentProperty_Migrate", 600, new DataParameter("ContentProperty", (object)propertyTable), new DataParameter("ContentExData", (object)contentExTable));
			DBHelper.ExecuteNonQuery(MetaDataContext.Instance, CommandType.StoredProcedure, string.Format("mdpsp_avto_{0}_DeleteSpecificRecord", (object)metaClass.TableName), 600, new DataParameter[1]{
				new DataParameter("IdsToDelete", (object)idTable)
			});

			transactionScope.Complete();
		}
		num1 += num2;
	} else
		break;
} while (num2 >= MigratePublishedContentStep.BatchSize);

For example
N = 3, we have 4 products
P1 (languages en-US, ru-RU)
P2 (languages en-US, ru-RU)
P3 (languages en-US)
P4 (languages en-US, ru-RU)

After first iteration of do-while product P4 will be removed but content for en-US won't by migrated.

Workaround
Set ecf:DraftMigrationBatchSize to result of following script

SELECT MAX(CountOfType)
FROM (SELECT COUNT(CatalogEntryId) AS CountOfType
    FROM CatalogEntry
    GROUP BY MetaClassId) sub






#173281
Edited, Dec 19, 2016 14:52
* 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.