forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb85a9d0
committed
Avoid looping over all type cache entries in TypeCacheRelCallback()
Currently, when a single relcache entry gets invalidated,TypeCacheRelCallback() has to loop over all type cache entries to findappropriate typentry to invalidate. Unfortunately, using the syscache hereis impossible, because this callback could be called outside a transactionand this makes impossible catalog lookups. This is why present commitintroduces RelIdToTypeIdCacheHash to map relation OID to its composite typeOID.We are keeping RelIdToTypeIdCacheHash entry while corresponding type cacheentry have something to clean. Therefore, RelIdToTypeIdCacheHash shouldn'tget bloat in the case of temporary tables flood.There are many places in lookup_type_cache() where syscache invalidation,user interruption, or even error could occur. In order to handle this, wekeep an array of in-progress type cache entries. In the case oflookup_type_cache() interruption this array is processed to keepRelIdToTypeIdCacheHash in a consistent state.Discussion:https://postgr.es/m/5812a6e5-68ae-4d84-9d85-b443176966a1%40sigaev.ruAuthor: Teodor SigaevReviewed-by: Aleksander Alekseev, Tom Lane, Michael Paquier, Roman ZharkovReviewed-by: Andrei Lepikhov, Pavel Borisov, Jian He, Alexander LakhinReviewed-by: Artur Zakirov1 parentc1500a1 commitb85a9d0
File tree
11 files changed
+433
-46
lines changed- src
- backend
- access/transam
- utils/cache
- include/utils
- test/modules
- typcache
- expected
- sql
- tools/pgindent
11 files changed
+433
-46
lines changedLines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
70 | 70 |
| |
71 | 71 |
| |
72 | 72 |
| |
| 73 | + | |
73 | 74 |
| |
74 | 75 |
| |
75 | 76 |
| |
| |||
2407 | 2408 |
| |
2408 | 2409 |
| |
2409 | 2410 |
| |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
2410 | 2414 |
| |
2411 | 2415 |
| |
2412 | 2416 |
| |
| |||
2709 | 2713 |
| |
2710 | 2714 |
| |
2711 | 2715 |
| |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
2712 | 2719 |
| |
2713 | 2720 |
| |
2714 | 2721 |
| |
| |||
2951 | 2958 |
| |
2952 | 2959 |
| |
2953 | 2960 |
| |
| 2961 | + | |
2954 | 2962 |
| |
2955 | 2963 |
| |
2956 | 2964 |
| |
| |||
5153 | 5161 |
| |
5154 | 5162 |
| |
5155 | 5163 |
| |
| 5164 | + | |
5156 | 5165 |
| |
5157 | 5166 |
| |
5158 | 5167 |
| |
| |||
5328 | 5337 |
| |
5329 | 5338 |
| |
5330 | 5339 |
| |
| 5340 | + | |
5331 | 5341 |
| |
5332 | 5342 |
| |
5333 | 5343 |
| |
|
0 commit comments
Comments
(0)