Commit 70010fb
Merge #158087
158087: catalog/lease: add support for bulk leasing r=fqazi a=fqazi
This patch does the following to help support bulk leasing in the crdb_internal / pg_catalog / information_schema views:
1. Refactor the storage layer for the lease manager to support bulk acquisitions by introducing a new `acquireBatch` API, which allows the lease manager to acquire multiple leases in a transaction. This also is used to implement `acquire`
2. Add a new `EnsureBatch` public method in the lease manager, which allows the lease manager to acquire multiple leases into memory, which acts as a prefetch mechanism. If a normal acquisition occurs concurrently it will correctly wait for the bulk acquisition to complete.
3. Modification to descriptor collection API to use EnsureBatch in the GetAll.* API.
New benchmarks for these change and leased descriptors vs KV in GetAll.*:
```
Cold
======================
BenchmarkLargeDatabaseColdPgClass/pg_class/leased_descriptors=true/use_prefetch=true/tables=8192 1000000000 0.7835 ns/op 0 B/op 0 allocs/op
BenchmarkLargeDatabaseColdPgClass/pg_class/leased_descriptors=true/use_prefetch=false/tables=8192 1 8642132499 ns/op 1731154008 B/op 12307123 allocs/op
BenchmarkLargeDatabaseColdPgClass/pg_class/leased_descriptors=false/use_prefetch=false/tables=8192 1000000000 0.3063 ns/op 0 B/op 0 allocs/op
Warm
======================
BenchmarkLargeDatabaseWarmPgClass/pg_class/leased_descriptors=true/use_prefetch=true/tables=8192 6 170890458 ns/op 90846753 B/op 428243 allocs/op
BenchmarkLargeDatabaseWarmPgClass/pg_class/leased_descriptors=true/use_prefetch=false/tables=8192 7 192905720 ns/op 91194598 B/op 431132 allocs/op
BenchmarkLargeDatabaseWarmPgClass/pg_class/leased_descriptors=false/use_prefetch=false/tables=8192 4 269645802 ns/op 243010064 B/op 1401622 allocs/op
BenchmarkLargeDatabaseWarmPgClass/pg_class/leased_descriptors=true/use_prefetch=true/tables=16384 3 352242778 ns/op 182838792 B/op 847251 allocs/op
BenchmarkLargeDatabaseWarmPgClass/pg_class/leased_descriptors=true/use_prefetch=false/tables=16384 3 399849806 ns/op 182671565 B/op 847271 allocs/op
BenchmarkLargeDatabaseWarmPgClass/pg_class/leased_descriptors=false/use_prefetch=false/tables=16384 2 582772520 ns/op 488168660 B/op 2793079 allocs/op
BenchmarkLargeDatabaseWarmPgClass/pg_class/leased_descriptors=true/use_prefetch=true/tables=32768 2 778396542 ns/op 365770676 B/op 1690881 allocs/op
BenchmarkLargeDatabaseWarmPgClass/pg_class/leased_descriptors=true/use_prefetch=false/tables=32768 2 803655520 ns/op 364708036 B/op 1685706 allocs/op
BenchmarkLargeDatabaseWarmPgClass/pg_class/leased_descriptors=false/use_prefetch=false/tables=32768 1 1300587666 ns/op 977227432 B/op 5585049 allocs/tp
```
Co-authored-by: Faizan Qazi <[email protected]>File tree
13 files changed
+502
-96
lines changed- pkg/sql
- catalog
- descs
- lease
- logictest
- regions
13 files changed
+502
-96
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
419 | 426 | | |
420 | 427 | | |
421 | 428 | | |
| |||
1058 | 1065 | | |
1059 | 1066 | | |
1060 | 1067 | | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
1061 | 1073 | | |
1062 | 1074 | | |
1063 | 1075 | | |
| |||
1084 | 1096 | | |
1085 | 1097 | | |
1086 | 1098 | | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
1087 | 1104 | | |
1088 | 1105 | | |
1089 | 1106 | | |
| |||
1131 | 1148 | | |
1132 | 1149 | | |
1133 | 1150 | | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
1134 | 1156 | | |
1135 | 1157 | | |
1136 | 1158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
203 | 205 | | |
204 | 206 | | |
205 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
206 | 215 | | |
207 | 216 | | |
208 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
64 | 73 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | | - | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
70 | 76 | | |
71 | | - | |
| 77 | + | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
| |||
85 | 91 | | |
86 | 92 | | |
87 | 93 | | |
88 | | - | |
| 94 | + | |
89 | 95 | | |
90 | 96 | | |
91 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
285 | 292 | | |
0 commit comments