Skip to content

Backport remote backend force push to v0.12#24884

Merged
pselle merged 2 commits intov0.12from
leetrout/force-push-v0.12
May 7, 2020
Merged

Backport remote backend force push to v0.12#24884
pselle merged 2 commits intov0.12from
leetrout/force-push-v0.12

Conversation

@leetrout
Copy link
Copy Markdown

@leetrout leetrout commented May 6, 2020

This is a copy of #24696 on the v0.12 tree.

Adds support for the -force flag for state push with the remote backend.

Lee Trout added 2 commits May 6, 2020 16:18
We only persist a new state if the actual state contents have
changed. This test demonstrates that behavior by calling write
and persist methods when either the lineage or serial have changed.
Both differing serials and lineage protections should be bypassed
with the -force flag (in addition to resources).

Compared to other backends we aren’t just shipping over the state
bytes in a simple payload during the persistence phase of the push
command and the force flag added to the Go TFE client needs to be
specified at that time.

To prevent changing every method signature of PersistState of the
remote client I added an optional interface that provides a hook
to flag the Client as operating in a force push context. Changing
the method signature would be more explicit at the cost of not
being used anywhere else currently or the optional interface pattern
could be applied to the state itself so it could be upgraded to
support PersistState(force bool) only when needed.

Prior to this only the resources of the state were checked for
changes not the lineage or the serial. To bring this in line with
documented behavior noted above those attributes also have a “read”
counterpart just like state has. These are now checked along with
state to determine if the state as a whole is unchanged.

Tests were altered to table driven test format and testing was
expanded to include WriteStateForMigration and its interaction
with a ClientForcePusher type.
@codecov
Copy link
Copy Markdown

codecov bot commented May 6, 2020

Codecov Report

Merging #24884 into v0.12 will increase coverage by 0.02%.
The diff coverage is 88.23%.

Impacted Files Coverage Δ
state/remote/remote.go 0.00% <ø> (ø)
backend/remote/backend_state.go 57.31% <33.33%> (-0.92%) ⬇️
state/remote/state.go 67.30% <100.00%> (+19.43%) ⬆️
backend/remote/backend_common.go 54.92% <0.00%> (-0.71%) ⬇️
states/statefile/version4.go 54.73% <0.00%> (-0.26%) ⬇️
dag/marshal.go 71.57% <0.00%> (ø)

@pselle pselle merged commit 12e509b into v0.12 May 7, 2020
@pselle pselle deleted the leetrout/force-push-v0.12 branch May 7, 2020 14:58
@ghost
Copy link
Copy Markdown

ghost commented Jun 7, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jun 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants