<#2844 Singer Spec clarification: supporting merge...
# meltano-repo-activity
g
#2844 Singer Spec clarification: supporting mergeable STATE artifacts Issue created by MeltyBot Migrated from GitLab: https://gitlab.com/meltano/meltano/-/issues/2903 Originally created by @aaronsteers on 2021-08-19 152609 --- As discussed in office hours yesterday, we need to document a spec clarification to allow STATE merging. Use Cases The main use cases involve orchestrator-driven or user-driven parallelization. 1. For any initial backfill tasks where we want the streams to be parallelized by the orchestrator (Meltano), for instance by breaking the list of streams into multiple sync groups, we also need a means of merging the multiple STATE outputs which are produced from the 4 jobs. 2. For #2727 (Melturbo), multiple states will be created and we'll need to merge them afterward. 3. (More use cases to-be-added...) Spec Proposal A: Top-level Mergeability The simplest spec proposal is as follows:
All top level bookmarks in the STATE json object should be considered atomic and mergeable with other top-level bookmarks.
In practice, this convention is already true for 99% of taps. The implications are that, if the STATE output from one job contains a top-level
users
bookmark, and the STATE output from another job contains a top-level
customers
bookmark, the two job outputs may be merged together to create a single merged STATE output with both
users
and
customers
bookmarks combined. Compatibility Detection As noted above, we can probably assume all taps already support this capability and then manage to the exceptions. If we do not take this assumption, detecting/confirming compatibility should still be simple step to accomplish, since we can check top-level boookmarks to see that they matching the name of the streams which were synced in the executed job. Limitations This method has the limitation of not being able to merge partitioned state. Optionally, we could expand the definition above to encompass multiple partition states within the jobs' STATE outputs. Spec Proposal B:
JSON Patch
A more complex spec proposal might implement the
JSON Patch
implementation for more advanced merging: http://jsonpatch.com/ This is likely not true today for most taps. There could still be valuable to enable this capability in order to support more advanced use cases meltano/meltano