Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move persistent tasks to core #28455

Merged
merged 50 commits into from
Feb 1, 2018

Commits on Jan 31, 2018

  1. Adds support for persistent actions

    A persistent action is a transport-like action that is using the cluster state instead of transport to start tasks. This allows persistent tasks to survive restart of executing nodes. A persistent action can be implemented by extending TransportPersistentAction. TransportPersistentAction will start the task by using PersistentActionService, which controls persistent tasks lifecycle.  See TestPersistentActionPlugin for an example implementing a persistent action.
    
    Original commit: elastic/x-pack@5e83f1b
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    f136bfa View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    777b21f View commit details
    Browse the repository at this point in the history
  3. Add support for task status on persistent tasks

    Similarly to task status on normal tasks it's now possible to update task status on the persistent tasks. This should allow updating the state of the running tasks (such as loading, started, etc) as well as store intermediate state or progress.
    
    Original commit: elastic/x-pack@048006b
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    ac67d02 View commit details
    Browse the repository at this point in the history
  4. Fix check style error after upgrade

    Original commit: elastic/x-pack@3bf4025
    davidkyle authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    32e4061 View commit details
    Browse the repository at this point in the history
  5. Replace List with Map in PersistentTasksInProgress

    Store currently running persistent tasks in a map instead of a list.
    
    Original commit: elastic/x-pack@f88c9ad
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    d340c19 View commit details
    Browse the repository at this point in the history
  6. Moved job lifecycle over to persistent tasks

    Also replaced the DELETING status from JobState with a boolean flag on Job. The state of a job is now stored inside a persistent task in cluster state. Jobs that aren't running don't have a persistent task, so I moved that notion of being deleted to the job config itself.
    
    Original commit: elastic/x-pack@21cd19c
    martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    243b7e4 View commit details
    Browse the repository at this point in the history
  7. Make persistent task persist full cluster restart

    This commit moves persistent tasks from ClusterState.Custom to MetaData.Custom and adds ability for the task to remain in the metadata after completion.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    16e661c View commit details
    Browse the repository at this point in the history
  8. In order to keep track of restarted tasks, `allocationIdOnLastStatusU…

    …pdate` field was added to `PersistentTaskInProgress` class.
    
    This will allow persistent task implementors to detect whether the executor node has changed or has been unset since the last status update has occured.
    martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    479429c View commit details
    Browse the repository at this point in the history
  9. Add persistent task assignment explanations.

    This commit allows persistent actions to indicate why a task was or wasn't assigned to a certain node.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    5eeb480 View commit details
    Browse the repository at this point in the history
  10. Request and Status in Persistent Tasks should be serialized using the…

    …ir writable names
    
    Refactors xcontent serialization of Request and Status to use their writable names instead of action name. That simplifies the parsing logic, allows reuse of the same status object for multiple actions and is consistent with how named objects in xcontent are used.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    b33fc05 View commit details
    Browse the repository at this point in the history
  11. Simplify names of PersistentTasks-related classes

    PersistentTask -> NodePersistentTask
    PersistentTasksInProgress -> PersistentTasks
    PersistentTaskInProgress -> PersistentTask
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    810d933 View commit details
    Browse the repository at this point in the history
  12. Make PersistentAction independent from TransportActions (elastic#742)

    Removes the transport layer dependency from PersistentActions, makes PersistentActionRegistry immutable and rename actions into tasks in class and variable names.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    9bd2441 View commit details
    Browse the repository at this point in the history
  13. Persistent Tasks: remove task restart on failure (elastic#815)

    If a persistent task throws an exception, the persistent tasks framework will no longer try to restart the task. This is a temporary measure to prevent threshing the cluster with endless restart attempt. We will revisit this in the future version to make the restart process more robust. Please note, however, that if node executing the task goes down, the task will still be restarted on another node.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    19f39fd View commit details
    Browse the repository at this point in the history
  14. Persistent Tasks: Merge NodePersistentTask and RunningPersistentTask (e…

    …lastic#842)
    
    Refactors NodePersistentTask and RunningPersistentTask into a single AllocatedPersistentTask. Makes it possible to update Persistent Task Status via AllocatedPersistentTask.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    37fad04 View commit details
    Browse the repository at this point in the history
  15. Persistent Tasks: Remove unused stopped and removeOnCompletion flags (e…

    …lastic#853)
    
    The stopped and removeOnCompletion flags are not currently used, this commit removes them for now to simplify things.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    b142d7e View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    78b844e View commit details
    Browse the repository at this point in the history
  17. Persistent Tasks: Add waitForPersistentTaskStatus method (elastic#901)

    This method allows to wait for tasks to change their status to match the supplied predicate.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    6ca0447 View commit details
    Browse the repository at this point in the history
  18. Persistent Tasks: require correct allocation id for status updates (e…

    …lastic#923)
    
    In order to prevent tasks state updates by stale executors, this commit adds a check for correct allocation id during status update operation.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    1b0f5b9 View commit details
    Browse the repository at this point in the history
  19. Use PersistentTasksService#waitForPersistentTaskStatus(...) to wait f…

    …or job and datafeed status and use PersistentTasksService#removeTask(...) to force close job and force stop datafeed.
    martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    a5acb55 View commit details
    Browse the repository at this point in the history
  20. Persistent Tasks: check the current state in waitForPersistentTaskSta…

    …tus (elastic#935)
    
    Add a check for the current state waitForPersistentTaskStatus before waiting for the next one. This fixes sporadic failure in testPersistentActionStatusUpdate test.
    
    Fixes elastic#928
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    5b45b16 View commit details
    Browse the repository at this point in the history
  21. Respond to rename random ASCII helper methods

    This commit is response to the renaming of the random ASCII helper
    methods in ESTestCase. The name of this method was changed because these
    methods only produce random strings generated from [a-zA-Z], not from
    all ASCII characters.
    jasontedor authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    97822db View commit details
    Browse the repository at this point in the history
  22. Persistent Tasks: refactor PersistentTasksService to use ActionListen…

    …er (elastic#937)
    
    PersistentTasksService methods are not using ActionListener<PersistentTask<?>> instead of PersistentTaskOperationListener.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    5a8512b View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    fab0dc4 View commit details
    Browse the repository at this point in the history
  24. Persistent Tasks: remove retries on notification failures (elastic#977)

    Retries should be already handled by TransportMasterNodeAction, there is no need to introduce another retry layer in Persistent Tasks code.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    95c6005 View commit details
    Browse the repository at this point in the history
  25. Persistent Tasks: remove listener from PersistentTasksExecutor#nodeOp…

    …eration (elastic#1032)
    
    Instead of having a separate listener for indicating that the current task is finished, this commit is switching to use allocated object itself.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    0a1abd4 View commit details
    Browse the repository at this point in the history
  26. Added PersistentTasksService#waitForPersistentTasksStatus(...) method…

    … to allow callers to wait when an executor node has updated its task status.
    Hendrik Muhs authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    0a1f255 View commit details
    Browse the repository at this point in the history
  27. Persistent Tasks: switch from long task ids to string task ids (elast…

    …ic#1035)
    
    This commit switches from long persistent task ids to caller-supplied string persistent task ids.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    6bfea09 View commit details
    Browse the repository at this point in the history
  28. Persistent Tasks: PersistentTaskRequest -> PersistTaskParams (elastic…

    …#1057)
    
    Removes the last pieces of ActionRequest from PersistentTaskRequest and renames it into PersistTaskParams, which is now just an interface that extends NamedWriteable and ToXContent.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    abd9ae3 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    4771965 View commit details
    Browse the repository at this point in the history
  30. Persistent Tasks: force writeable name of params and status to be the…

    … same as their task (elastic#1072)
    
    Changes persistent task serialization and forces params and status to have the same writeable name as the task itself.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    fc524bc View commit details
    Browse the repository at this point in the history
  31. Fixes compile errors in Eclipse due to generics

    PersistentTasksCustomMetadata was using a generic param named `Params`. This conflicted with the imported interface `ToXContent.Params`. The java compiler was preferring the generic param over the interface so everything was fine but Eclipse apparently prefers the interface int his case which was screwing up the Hierarchy and causing compile errors in Eclipse. This changes fixes it by renaming the Generic param to `P`
    colings86 authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    76cd7b1 View commit details
    Browse the repository at this point in the history
  32. Persistent tasks: require allocation id on task completion (elastic#1107

    )
    
    Persistent tasks should verify that completion notification is done for correct version of the task, otherwise a delayed notification from an old node can accidentally close a newly reassigned task.
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    a08e2d9 View commit details
    Browse the repository at this point in the history
  33. Separate publishing from applying cluster states

    Companion commit to elastic#24236
    ywelsch authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    44ea5d6 View commit details
    Browse the repository at this point in the history
  34. Don't call ClusterService.state() in a ClusterStateUpdateTask

    The current state is readily available as a parameter
    ywelsch authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    e69317b View commit details
    Browse the repository at this point in the history
  35. Fix static / version based BWC tests (elastic#1456)

    With the leniency in Version.java we missed to really setup BWC
    testing for static indices. This change brings back the testing and adds
    missing bwc indices.
    
    Relates to elastic#24732
    s1monw authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    292e383 View commit details
    Browse the repository at this point in the history
  36. Pass down the provided timeout.

    Hendrik Muhs authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    614aef2 View commit details
    Browse the repository at this point in the history
  37. Always Accumulate Transport Exceptions (elastic#1619)

    This is the x-pack side of the removal of `accumulateExceptions()` for both `TransportNodesAction` and `TransportTasksAction`.
    
    There are occasional, random failures that occur during API calls that are silently ignored from the caller's perspective, which also leads to weird API responses that have no response and also no errors, which is obviously untrue.
    pickypg authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    1cef531 View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    0d50f9c View commit details
    Browse the repository at this point in the history
  39. Persistent Tasks: remove unused isCurrentStatus method (elastic#2076)

    Removes a method that is no longer used in production code.
    
    Relates to elastic#957
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    ffdb05e View commit details
    Browse the repository at this point in the history
  40. Move tribe to a module (elastic#2088)

    Companion PR to elastic#25778
    ywelsch authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    b5f2813 View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    65ce227 View commit details
    Browse the repository at this point in the history
  42. Configuration menu
    Copy the full SHA
    b0de3c3 View commit details
    Browse the repository at this point in the history
  43. Make AllocatedPersistentTask members volatile (elastic#2297)

    These members are default initialized on contruction and then set by the
    init() method.  It's possible that another thread accessing the object
    after init() is called could still see the null/0 values, depending on how
    the compiler optimizes the code.
    droberts195 authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    7313ad5 View commit details
    Browse the repository at this point in the history
  44. Refactor/to x content fragments2 (elastic#2329)

    * Moves more classes over to ToXContentObject/Fragment
    
    * Removes ToXContentToBytes
    
    * Removes ToXContent from Enums
    
    * review comment fix
    
    * slight change to use XContantHelper
    colings86 authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    1c489ee View commit details
    Browse the repository at this point in the history
  45. Make the persistent task status available to PersistentTasksExecutor.…

    …nodeOperation(...) method
    martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    4dd6995 View commit details
    Browse the repository at this point in the history
  46. Remove InternalClient and InternalSecurityClient (elastic#3054)

    This change removes the InternalClient and the InternalSecurityClient. These are replaced with
    usage of the ThreadContext and a transient value, `action.origin`, to indicate which component the
    request came from. The security code has been updated to look for this value and ensure the
    request is executed as the proper user. This work comes from elastic#2808 where @s1monw suggested
    that we do this.
    
    While working on this, I came across index template registries and rather than updating them to use
    the new method, I replaced the ML one with the template upgrade framework so that we could
    remove this template registry. The watcher template registry is still needed as the template must be
    updated for rolling upgrades to work (see elastic#2950).
    jaymode authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    8521b2d View commit details
    Browse the repository at this point in the history
  47. Add adding ability to associate an ID with tasks.

    Persistent tasks portion of elastic#23250
    imotov authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    41071e4 View commit details
    Browse the repository at this point in the history
  48. Added AllocatedPersistentTask#waitForPersistentTaskStatus(...) that d…

    …elegates to PersistentTasksService#waitForPersistentTaskStatus(...)
    
    This allows persistent tasks executor implementations to not have an instance of PersistentTasksService.
    droberts195 authored and martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    cc16f9d View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    07e727c View commit details
    Browse the repository at this point in the history
  50. Make persistent tasks work.

    Made persistent tasks executors pluggable.
    martijnvg committed Jan 31, 2018
    Configuration menu
    Copy the full SHA
    592eedb View commit details
    Browse the repository at this point in the history