From 0b537c6341c317b1a2a916c37a546779b75fa09b Mon Sep 17 00:00:00 2001 From: David Kyle Date: Tue, 28 May 2019 16:54:01 +0100 Subject: [PATCH] Tidying up --- .../dataframe/transforms/DataFrameTransformTask.java | 9 ++------- .../test/data_frame/transforms_start_stop.yml | 6 +++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/x-pack/plugin/data-frame/src/main/java/org/elasticsearch/xpack/dataframe/transforms/DataFrameTransformTask.java b/x-pack/plugin/data-frame/src/main/java/org/elasticsearch/xpack/dataframe/transforms/DataFrameTransformTask.java index 4b6c3c2060eb6..f3f67f4bfd2ab 100644 --- a/x-pack/plugin/data-frame/src/main/java/org/elasticsearch/xpack/dataframe/transforms/DataFrameTransformTask.java +++ b/x-pack/plugin/data-frame/src/main/java/org/elasticsearch/xpack/dataframe/transforms/DataFrameTransformTask.java @@ -238,7 +238,7 @@ public synchronized void stop() { IndexerState state = getIndexer().stop(); if (state == IndexerState.STOPPED) { - getIndexer().saveState(state, () -> getIndexer().onStop()); + getIndexer().doSaveState(state, getIndexer().getPosition(), () -> getIndexer().onStop()); } } @@ -534,15 +534,10 @@ protected void doSaveState(IndexerState indexerState, Map positi return; } - saveState(indexerState, next); - } - - public void saveState(IndexerState indexerState, Runnable next){ - final DataFrameTransformState state = new DataFrameTransformState( transformTask.taskState.get(), indexerState, - getPosition(), + position, transformTask.currentCheckpoint.get(), transformTask.stateReason.get(), getProgress()); diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/data_frame/transforms_start_stop.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/data_frame/transforms_start_stop.yml index 3d5aba1ce1cc1..617da7fb25189 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/data_frame/transforms_start_stop.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/data_frame/transforms_start_stop.yml @@ -118,7 +118,7 @@ teardown: - match: { count: 1 } - match: { transforms.0.id: "airline-transform-start-stop" } - match: { transforms.0.state.indexer_state: "stopped" } -# - match: { transforms.0.state.task_state: "stopped" } + - match: { transforms.0.state.task_state: "stopped" } - do: data_frame.start_data_frame_transform: @@ -245,9 +245,9 @@ teardown: transform_id: "*" - match: { count: 2 } - match: { transforms.0.state.indexer_state: "stopped" } -# - match: { transforms.0.state.task_state: "stopped" } + - match: { transforms.0.state.task_state: "stopped" } - match: { transforms.1.state.indexer_state: "stopped" } -# - match: { transforms.1.state.task_state: "stopped" } + - match: { transforms.1.state.task_state: "stopped" } - do: data_frame.delete_data_frame_transform: