checkpoints.asciidoc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. [role="xpack"]
  2. [[transform-checkpoints]]
  3. = How {transform} checkpoints work
  4. ++++
  5. <titleabbrev>How checkpoints work</titleabbrev>
  6. ++++
  7. Each time a {transform} examines the source indices and creates or updates the
  8. destination index, it generates a _checkpoint_.
  9. If your {transform} runs only once, there is logically only one checkpoint. If
  10. your {transform} runs continuously, however, it creates checkpoints as it
  11. ingests and transforms new source data. The `sync` property of the {transform}
  12. configures checkpointing by specifying a time field.
  13. To create a checkpoint, the {ctransform}:
  14. . Checks for changes to source indices.
  15. +
  16. Using a simple periodic timer, the {transform} checks for changes to the source
  17. indices. This check is done based on the interval defined in the transform's
  18. `frequency` property.
  19. +
  20. If the source indices remain unchanged or if a checkpoint is already in progress
  21. then it waits for the next timer.
  22. +
  23. If changes are found a checkpoint is created.
  24. . Identifies which entities and/or time buckets have changed.
  25. +
  26. The {transform} searches to see which entities or time buckets have changed
  27. between the last and the new checkpoint. The {transform} uses the values to
  28. synchronize the source and destination indices with fewer operations than a
  29. full re-run.
  30. . Updates the destination index (the {dataframe}) with the changes.
  31. +
  32. --
  33. The {transform} applies changes related to either new or changed entities or
  34. time buckets to the destination index. The set of changes can be paginated. The
  35. {transform} performs a composite aggregation similarly to the batch {transform}
  36. operation, however it also injects query filters based on the previous step to
  37. reduce the amount of work. After all changes have been applied, the checkpoint is
  38. complete.
  39. --
  40. This checkpoint process involves both search and indexing activity on the
  41. cluster. We have attempted to favor control over performance while developing
  42. {transforms}. We decided it was preferable for the {transform} to take longer to
  43. complete, rather than to finish quickly and take precedence in resource
  44. consumption. That being said, the cluster still requires enough resources to
  45. support both the composite aggregation search and the indexing of its results.
  46. TIP: If the cluster experiences unsuitable performance degradation due to the
  47. {transform}, stop the {transform} and refer to <<transform-performance>>.
  48. [discrete]
  49. [[ml-transform-checkpoint-heuristics]]
  50. == Change detection heuristics
  51. When the {transform} runs in continuous mode, it updates the documents in the
  52. destination index as new data comes in. The {transform} uses a set of heuristics
  53. called change detection to update the destination index with fewer operations.
  54. In this example, the data is grouped by host names. Change detection detects
  55. which host names have changed, for example, host `A`, `C` and `G` and only
  56. updates documents with those hosts but does not update documents that store
  57. information about host `B`, `D`, or any other host that are not changed.
  58. Another heuristic can be applied for time buckets when a `date_histogram` is
  59. used to group by time buckets. Change detection detects which time buckets have
  60. changed and only update those.
  61. [discrete]
  62. [[ml-transform-checkpoint-errors]]
  63. == Error handling
  64. Failures in {transforms} tend to be related to searching or indexing.
  65. To increase the resiliency of {transforms}, the cursor positions of
  66. the aggregated search and the changed entities search are tracked in memory and
  67. persisted periodically.
  68. Checkpoint failures can be categorized as follows:
  69. * Temporary failures: The checkpoint is retried. If 10 consecutive failures
  70. occur, the {transform} has a failed status. For example, this situation might
  71. occur when there are shard failures and queries return only partial results.
  72. * Irrecoverable failures: The {transform} immediately fails. For example, this
  73. situation occurs when the source index is not found.
  74. * Adjustment failures: The {transform} retries with adjusted settings. For
  75. example, if a parent circuit breaker memory errors occur during the composite
  76. aggregation, the {transform} receives partial results. The aggregated search is
  77. retried with a smaller number of buckets. This retry is performed at the
  78. interval defined in the `frequency` property for the {transform}. If the search
  79. is retried to the point where it reaches a minimal number of buckets, an
  80. irrecoverable failure occurs.
  81. If the node running the {transforms} fails, the {transform} restarts from the
  82. most recent persisted cursor position. This recovery process might repeat some
  83. of the work the {transform} had already done, but it ensures data consistency.