Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mutex to progress bar for concurrency safe incrementing
Our progress bar is not concurrency safe since many go routines may be attempting to modify the values at the same time. Add a mutex to be used by the progress bar for safe incrementing in go routines. Without this fix the following issue is found by the golang race detector ``` WARNING: DATA RACE Write at 0x00c0005a2b40 by goroutine 59: github.com/greenplum-db/gpbackup/utils.(*VerboseProgressBar).Increment() /home/kyeap/workspace/gpbackup/utils/progress_bar.go:77 +0xbc github.com/greenplum-db/gpbackup/restore.executeStatementsForConn() /home/kyeap/workspace/gpbackup/restore/parallel.go:59 +0xaa github.com/greenplum-db/gpbackup/restore.ExecuteStatements.func1() /home/kyeap/workspace/gpbackup/restore/parallel.go:164 +0x209 github.com/greenplum-db/gpbackup/restore.ExecuteStatements.func2() /home/kyeap/workspace/gpbackup/restore/parallel.go:165 +0x41 Previous read at 0x00c0005a2b40 by goroutine 60: github.com/greenplum-db/gpbackup/utils.(*VerboseProgressBar).Increment() /home/kyeap/workspace/gpbackup/utils/progress_bar.go:81 +0xe5 github.com/greenplum-db/gpbackup/restore.executeStatementsForConn() /home/kyeap/workspace/gpbackup/restore/parallel.go:59 +0xaa github.com/greenplum-db/gpbackup/restore.ExecuteStatements.func1() /home/kyeap/workspace/gpbackup/restore/parallel.go:164 +0x209 github.com/greenplum-db/gpbackup/restore.ExecuteStatements.func2() /home/kyeap/workspace/gpbackup/restore/parallel.go:165 +0x41 ```
- Loading branch information