Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preinitialize entire channel map before using it in parallel restore.
Trying to assign channels to the map, and spin up a go routine that uses the map in the same loop can result in the following panic at run time. `fatal error: concurrent map read and map write` This can also be detected using golang's race condition detector ``` go run --race gprestore.go --timestamp 20240201180314 --create-db --redirect-db test2 --jobs 8 --verbose ... ================== WARNING: DATA RACE Read at 0x00c0003a6300 by goroutine 77: runtime.mapaccess1_fast64() /usr/local/go/src/runtime/map_fast64.go:13 +0x0 github.com/greenplum-db/gpbackup/restore.ExecuteStatements.func1() /home/kyeap/workspace/gpbackup/restore/parallel.go:158 +0x1c4 github.com/greenplum-db/gpbackup/restore.ExecuteStatements.func2() /home/kyeap/workspace/gpbackup/restore/parallel.go:159 +0x41 Previous write at 0x00c0003a6300 by main goroutine: runtime.mapassign_fast64() /usr/local/go/src/runtime/map_fast64.go:93 +0x0 github.com/greenplum-db/gpbackup/restore.ExecuteStatements() /home/kyeap/workspace/gpbackup/restore/parallel.go:144 +0x805 github.com/greenplum-db/gpbackup/restore.ExecuteRestoreMetadataStatements() /home/kyeap/workspace/gpbackup/restore/wrappers.go:321 +0xa4 github.com/greenplum-db/gpbackup/restore.restorePredata() /home/kyeap/workspace/gpbackup/restore/restore.go:334 +0x9d1 github.com/greenplum-db/gpbackup/restore.DoRestore() /home/kyeap/workspace/gpbackup/restore/restore.go:163 +0x184 ```
- Loading branch information