Loading TOC...

MarkLogic 9 Product Documentation
flexrep.documentReset

flexrep.documentReset(
   uri as String,
   domain-id as (Number|String),
   [target-ids as (Number|String)[]]
) as null

Summary

This function resets the URI status for all replication targets. A reset involves retaining any record of last success, clearing any failure status, and setting the time for the next replication attempt to the current time. The status is reset for the specified targetIds. If no targetIds parameter is specified, then the URI status for all replication targets is reset.

Resetting the URI status for a target is useful if the document has errored out due to too many failures, or if you want to replicate the document again.

Parameters
uri The URI to be assigned the new status.
domain-id The ID of the replicated domain.
target-ids The ID of the replication target.

Example

const flexrep = require('/MarkLogic/flexrep');

  declareUpdate();

  // Obtain the domain ID from the database used by the Master to enable CPF.
  const domain = xdmp.eval(
    'const dom = require("/MarkLogic/cpf/domains");' +
      'fn.data(dom.get("Default Master").xpath("//dom:domain-id"));',
       null,
         {
          'database' : xdmp.database('Triggers')
         });

  const cfg = flexrep.configurationGet(domain, true);
  const targetId = flexrep.configurationTargetGetId(cfg, 'Replica');

  flexrep.documentReset("http://localhost:8011/", domain, targetId);

  // Resets the URI status for the "Replica" target.
   

Required Privileges

http://marklogic.com/xdmp/privileges/flexrep-user

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.