8
8
"sync"
9
9
"os"
10
10
"strconv"
11
+ "strings"
11
12
)
12
13
13
14
func read_to_channel (r io.Reader ,c chan string ,wg * sync.WaitGroup ) {
@@ -94,6 +95,7 @@ func postgres(bin string, datadir string, port int, nodeid int, wg *sync.WaitGro
94
95
"-c" ,"autovacuum=off" ,
95
96
"-c" ,"fsync=off" ,
96
97
"-c" ,"synchronous_commit=off" ,
98
+ "-c" ,"shared_preload_libraries=pg_dtm" ,
97
99
}
98
100
name := "postgres " + datadir
99
101
c := make (chan string )
@@ -118,11 +120,30 @@ func check_bin(bin *map[string]string) {
118
120
}
119
121
}
120
122
123
+ func get_prefix (srcroot string )string {
124
+ makefile ,err := os .Open (srcroot + "/src/Makefile.global" )
125
+ if err != nil {
126
+ return "."
127
+ }
128
+
129
+ scanner := bufio .NewScanner (makefile )
130
+ for scanner .Scan () {
131
+ s := scanner .Text ()
132
+ if strings .HasPrefix (s ,"prefix := " ) {
133
+ return strings .TrimPrefix (s ,"prefix := " )
134
+ }
135
+ }
136
+ return "."
137
+ }
138
+
121
139
func main () {
140
+ srcroot := "../../.."
141
+ prefix := get_prefix (srcroot )
142
+
122
143
bin := map [string ]string {
123
- "dtmd" :"/home/kvap/postgrespro/ contrib/pg_xtm /dtmd/bin/dtmd" ,
124
- "initdb" :"/home/kvap/postgrespro-build /bin/initdb" ,
125
- "postgres" :"/home/kvap/postgrespro-build /bin/postgres" ,
144
+ "dtmd" :srcroot + "/ contrib/pg_dtm /dtmd/bin/dtmd" ,
145
+ "initdb" :prefix + " /bin/initdb" ,
146
+ "postgres" :prefix + " /bin/postgres" ,
126
147
}
127
148
128
149
datadirs := []string {"/tmp/data1" ,"/tmp/data2" }