Commit 7ba6405
committed
fix: Stop locking catalog for every resources.
Historically, this provider takes a (golang) lock on a database for every resource of this database.
So only one create/update/delete of resource by database can be done at the same time.
(As it's a RWLock, read of resources can be parallelized)
Since #5 refactoring, I mistakenly change the lock which now takes a write lock even for read operations
(basically the plan part of Terraform). So provider was slower since v1.10
We could fix this and take a read lock for read operations as before but actually I don't see the point of this lock.
For me, most operations could be done at the same time.
Most of the request are now done in a transaction, the only risk is that a transaction will fail to commit
if multiple resources modifies the same database line.
That's the case for `postgresql_default_privileges`, one `pg_default_acl` row could represents multiple resources,
so this PR takes a lock on the owner role to avoid that.
This should make the provider way faster.
Fix #481 parent 89f50c2 commit 7ba6405
File tree
3 files changed
+20
-14
lines changed- postgresql
3 files changed
+20
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | 144 | | |
152 | 145 | | |
153 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
| |||
30 | 27 | | |
31 | 28 | | |
32 | 29 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 30 | | |
37 | 31 | | |
38 | 32 | | |
| |||
447 | 441 | | |
448 | 442 | | |
449 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
156 | 160 | | |
157 | 161 | | |
158 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
159 | 167 | | |
160 | 168 | | |
161 | 169 | | |
| |||
176 | 184 | | |
177 | 185 | | |
178 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
179 | 191 | | |
180 | 192 | | |
181 | 193 | | |
| |||
208 | 220 | | |
209 | 221 | | |
210 | 222 | | |
211 | | - | |
212 | 223 | | |
213 | 224 | | |
214 | 225 | | |
| |||
0 commit comments