diff --git a/creator-node/src/components/replicaSet/exportComponentService.js b/creator-node/src/components/replicaSet/exportComponentService.js index 70022403bb4..fa2eeafdfab 100644 --- a/creator-node/src/components/replicaSet/exportComponentService.js +++ b/creator-node/src/components/replicaSet/exportComponentService.js @@ -14,6 +14,7 @@ const exportComponentService = async ({ walletPublicKeys, requestedClockRangeMin, requestedClockRangeMax, + forceExport = false, logger }) => { const transaction = await models.sequelize.transaction({ @@ -112,7 +113,10 @@ const exportComponentService = async ({ ) if (!_.isEmpty(clockRecords) && cnodeUser.clock !== maxClockRecord) { const errorMsg = `Cannot export - exported data is not consistent. Exported max clock val = ${cnodeUser.clock} and exported max ClockRecord val ${maxClockRecord}` - throw new Error(errorMsg) + logger.error(errorMsg) + if (!forceExport) { + throw new Error(errorMsg) + } } cnodeUser.clockInfo = { diff --git a/creator-node/src/routes/nodeSync.js b/creator-node/src/routes/nodeSync.js index 8aa2ec870be..b69dea09c39 100644 --- a/creator-node/src/routes/nodeSync.js +++ b/creator-node/src/routes/nodeSync.js @@ -29,6 +29,7 @@ router.get( const walletPublicKeys = req.query.wallet_public_key // array const sourceEndpoint = req.query.source_endpoint // string + const forceExport = !!req.query.force_export // boolean const maxExportClockValueRange = config.get('maxExportClockValueRange') @@ -44,6 +45,7 @@ router.get( walletPublicKeys, requestedClockRangeMin, requestedClockRangeMax, + forceExport, logger: req.logger }) }, diff --git a/creator-node/src/services/sync/primarySyncFromSecondary.js b/creator-node/src/services/sync/primarySyncFromSecondary.js index 1de16b05280..9b72af45355 100644 --- a/creator-node/src/services/sync/primarySyncFromSecondary.js +++ b/creator-node/src/services/sync/primarySyncFromSecondary.js @@ -128,7 +128,8 @@ async function fetchExportFromSecondary({ const exportQueryParams = { wallet_public_key: [wallet], // export requires a wallet array clock_range_min: clockRangeMin, - source_endpoint: selfEndpoint + source_endpoint: selfEndpoint, + force_export: true } try {