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

Ut conflict resolver #806

Merged
merged 9 commits into from
Jun 5, 2018
Merged

Ut conflict resolver #806

merged 9 commits into from
Jun 5, 2018

Conversation

wxing1292
Copy link
Contributor

@wxing1292 wxing1292 commented May 31, 2018

*bugfix: getHistory should return output next token, not input token
*bugfix: state builder should set the version on mutable state before apply events, especially when ms builder is reset.

partially solve #791

@wxing1292 wxing1292 requested a review from samarabbas May 31, 2018 23:39
@@ -107,6 +108,9 @@ func (r *conflictResolver) reset(replayEventID int64, startTime time.Time) (*mut
// the last updated time is not important here, since this should be updated with event time afterwards
resetMutableStateBuilder.executionInfo.LastUpdatedTimestamp = startTime

sourceCluster := r.clusterMetadata.ClusterNameForFailoverVersion(resetMutableStateBuilder.GetCurrentVersion())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should read the version from last event rather than rely on CurrentVersion.

*decisionInfo, *mutableStateBuilder, error) {
var lastEvent *shared.HistoryEvent
var lastDecision *decisionInfo
var newRunStateBuilder *mutableStateBuilder
for _, event := range history.Events {
lastEvent = event
// must set the current version, since this is standby here, not active
b.msBuilder.updateReplicationStateVersion(event.GetVersion())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the right place to update CurrentStateVersion. It is currently updated on workflow execution load. I think we should just update the API on 'updateReplicationStateLastEventID' to also take in clusterName and lastWriteVersion and update both lastWriteVersion and lastWriteEventID as part of the same API. Then we can call this explicitly from conflict resolver at the end like we update other mutableState fields.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's hold onto this till Monday. I think we should have a quick discussion before we land this.

func (e *mutableStateBuilder) updateReplicationStateLastEventID(clusterName string, lastEventID int64) {
func (e *mutableStateBuilder) updateReplicationStateLastEventID(clusterName string, lastWriteVersion,
lastEventID int64) {
e.replicationState.LastWriteVersion = lastWriteVersion
e.replicationState.LastWriteVersion = e.replicationState.CurrentVersion
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line should be deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the active workflow, when calling this function, should use the current version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@samarabbas samarabbas merged commit 166ef58 into master Jun 5, 2018
@samarabbas samarabbas deleted the ut-conflict-resolver branch June 5, 2018 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants