This plugin is part of the Kuzzle Enterprise Plan. If you are interested, please contact us.

Troubleshooting #

Writes are still refused #

A write refused with services.storage.collection_locked (503) means the collection is write-locked. The error message names the lock's owner and reason: locked by "mapping-migration" (mapping migration <jobId>).

  1. Call status. While the job's phase is waiting, copying or copied, writes stay closed by design: wait for done or aborted (see Planning for the expected window). A job that does not move is covered below.
  2. If the owner in the message is not mapping-migration, another component of the platform locked the collection: the plugin cannot release it.
  3. Once a job is done or aborted, the plugin has released the lock. A 503 that persists after that is not expected: keep the status output and the Kuzzle logs (lines starting with [mapping-migration]) and contact the Kuzzle support.

Reads are never locked: a read refused during a migration has another cause.

The job does not move #

Look at status (phase, processed, checkpointAt, owner, lastError) and at the Kuzzle logs:

What you seeWhyWhat to do
waiting for a few secondsThe grace delay (graceDelay, 5 s by default)Wait
processed and checkpointAt frozen, lastError nullThe node running the job stopped or crashedWait: another node takes it over within mutexTtl + resumeInterval (20 to 40 s by default), owner then changes and the logs show taken over by node …
lastError set, the job goes on after a whileA transient error (Elasticsearch unreachable, too many requests…), retried from the last checkpointWait; if it keeps coming back, look at Elasticsearch's health
copied with a recurring lastErrorThe switch is retried until it succeeds, writes closed meanwhileLook at Elasticsearch: the job cannot go back at that point
owner changes often, warnings Lock "{mapping-migration}/job/mutex" lostNodes unresponsive for about 2/3 × mutexTtl (slow Redis, long garbage collection pauses), or too low a mutexTtlRaise mutexTtl (see Configuration)
Every request answers api.process.not_enough_nodes (503)The cluster fell below Kuzzle's cluster.minimumNodesBring the nodes back; the job goes on meanwhile (see Planning)
Every node stoppedNothing runs the jobStart a node: it takes the job over from its last checkpoint

There is no cancel: a job always runs to done or aborted.

The job ended aborted #

The collection is unchanged, writes are open. lastError holds the cause; if it is empty, documents failed without allowFailures. List them with failures (jobId): each has Elasticsearch's reason (failed to parse field [code] of type [long] … 'abc'). The documents are still in the collection: fix their values there, or the target model, then run the dry run again. purge drops the failed documents list of the aborted job once you no longer need it.

Recover a failed document from the archive #

With allowFailures: true, the failed documents are not in the new collection: they only exist in the archive, the old indice, until it is purged.

  1. Find the job's archive indice in status (archives[].indice, for instance &iot.sensors), and the failed document ids with failures (jobId).

  2. Read the document from Elasticsearch directly (the archive belongs to no collection, Kuzzle's API cannot read it). The & of the indice name is URL-encoded:

    curl "http://<elasticsearch>:9200/%26iot.sensors/_doc/sensor-3"
    # {"_id":"sensor-3","found":true,"_source":{"code":"abc","name":"s-3","_kuzzle_info":{…}}}
  3. Fix the value the new model refused, and write the document back through Kuzzle, without _kuzzle_info (Kuzzle sets its own):

    await sdk.document.createOrReplace("iot", "sensors", "sensor-3", {
      code: 0,
      name: "s-3",
    });
  4. Once every document you need is recovered, purge the job: the archive is deleted for good.

Other questions #

The plan lists fields I did not touch as fieldRemoved. start takes the full model: every field left out of properties is removed. Send the whole model, the unchanged fields included. A field to keep under another name goes in renames.

After the migration, a document still reads "code": "7". The copy does not convert document content: Elasticsearch indexes the value with the new type, but the JSON returned is the original. See What the copy changes.

A field left out of the target is still in the documents. It was stored but not mapped (dynamic: false): only mapped fields are removed.

Changing only refresh_interval needs a copy. Any settings change goes through a copy. To change only dynamic settings, use Kuzzle's collection:update.

A new field added in place is not searchable on every document. Follow the reindex with status (index, collection): running means it is not finished; failed lists the documents whose stored value the new field refuses, and the documents after them are not reindexed. Fix the values, then reindex the collection (collection:update with reindexCollection: true).

reindex.state is unknown or untracked. unknown: Elasticsearch no longer knows the task (its node restarted, or its result was deleted from .tasks). untracked: Kuzzle's storage driver did not report the task id. In both cases the plugin cannot tell whether the reindex completed; reindex the collection again to be sure.

plan_changed right after the dry run. The fingerprint covers the collection's mapping and the whole request: a different value in mappings, renames or settings (key order does not matter), or a mapping changed by someone else since, changes it. Run the dry run again and review the new plan.

forbidden (403) although the role has the plugin's action. The caller also needs the matching right on the target collection, named in the message. See Rights and roles.

unsupported_engine (412). Kuzzle does not run on Elasticsearch 8. The plugin only supports Elasticsearch 8.