Skip to content

Commit

Permalink
Revert "Do not fetch and build vitess if it is the same commit as the…
Browse files Browse the repository at this point in the history
… previous execution"

This reverts commit d5473f2.
  • Loading branch information
frouioui committed Feb 5, 2024
1 parent d7675e7 commit a1e00ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 0 additions & 2 deletions ansible/roles/vitess_build/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
- name: Update Vitess
become: yes
become_user: root
when: commit_previous_exec != vitess_git_version
block:
- name: Fetch Updated Vitess
include_tasks: install_vitess.yml
Expand Down Expand Up @@ -53,7 +52,6 @@
changed_when: false

- name: Disbale AppArmor
when: not clean_previous_exec | bool
block:
- name: link apparmor
file:
Expand Down
16 changes: 8 additions & 8 deletions go/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,10 @@ type Exec struct {

vitessSchemaPath string

// We always fetch the previous execution to let Ansible skip certain steps of the benchmark
// execution. Like cleaning up at the start of the execution, this is not required when the
// previous execution was clean and did not fail. Moreover, we can skip the fetch and build
// of Vitess if the previous execution share the same commit as the current execution.
previousExecution *Exec
// cleanPreviousExecution is set to true when the previous execution in the database is marked
// as "finished", meaning it has executed normally. In this case, Ansible doesn't need to clean up
// the execution server at the start of the execution to save time.
cleanPreviousExecution bool
}

const (
Expand Down Expand Up @@ -266,7 +265,9 @@ func (e *Exec) Prepare() error {
if err != nil {
return err
}
e.previousExecution = previousExec
if previousExec.Status == StatusFinished {
e.cleanPreviousExecution = true
}

// insert new exec in SQL
if _, err = e.clientDB.Insert(
Expand Down Expand Up @@ -394,8 +395,7 @@ func (e *Exec) prepareAnsibleForExecution() error {
e.AnsibleConfig.AddExtraVar(ansible.KeyGoVersion, e.GolangVersion)

// previous execution
e.AnsibleConfig.AddExtraVar(ansible.KeyCleanPreviousExec, e.previousExecution.Status == StatusFinished)
e.AnsibleConfig.AddExtraVar(ansible.KeyCommitPreviousExec, e.previousExecution.GitRef)
e.AnsibleConfig.AddExtraVar(ansible.KeyCleanPreviousExec, e.cleanPreviousExecution)

// stats database related values
e.statsRemoteDBConfig.AddToAnsible(&e.AnsibleConfig)
Expand Down
3 changes: 0 additions & 3 deletions go/infra/ansible/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ const (
// this is useful when doing optimization to skip certain steps of the setup
KeyCleanPreviousExec = "clean_previous_exec"

// KeyCommitPreviousExec is the commit SHA of the previous execution.
KeyCommitPreviousExec = "commit_previous_exec"

// Stats database related keys

// KeyStatsDBHost corresponding value in the map is the hostname for the stats
Expand Down

0 comments on commit a1e00ac

Please sign in to comment.