![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
The hash_seq_search keeps track of what element that it should return next in a HASH_SEQ_STATUS struct when it peruses a bucket. Removing that element from the table won't change anything since the struct remains unaffected. It still holds onto that element and hence, will return it on next iteration. |
#3
| |||
| |||
|
|
"Thomas" <thhal (AT) mailblocks (DOT) com> writes: The hash_seq_search keeps track of what element that it should return next in a HASH_SEQ_STATUS struct when it peruses a bucket. Removing that element from the table won't change anything since the struct remains unaffected. It still holds onto that element and hence, will return it on next iteration. This isn't a bug; it's the designed way for it to work. It's up to callers to avoid causing a problem. This report origins from the hackers thread "SPI_finish and |
#4
| |||
| |||
|
|
Tom Lane wrote: "Thomas" <thhal (AT) mailblocks (DOT) com> writes: The hash_seq_search keeps track of what element that it should return next in a HASH_SEQ_STATUS struct when it peruses a bucket. Removing that element from the table won't change anything since the struct remains unaffected. It still holds onto that element and hence, will return it on next iteration. This isn't a bug; it's the designed way for it to work. It's up to callers to avoid causing a problem. This report origins from the hackers thread "SPI_finish and RegisterExprContextCallback" where you indicated that my report did not properly describe a problem. Since my report was correct and since you stated that "hash_seq_search() shouldn't return any already-dropped entries." I was led me to believe that it was *not* designed to do that. Anyway, the AtCommit_Portals doesn't avoid this problem and the end result for me is the same regardless of where the error is. I can't drop portals using a ExprContextCallback and I'd like to know the best way to fix it. I can contribute a patch but I want you to decide what needs to be fixed. |
#5
| |||
| |||
|
|
Thomas Hallgren wrote: Tom Lane wrote: "Thomas" <thhal (AT) mailblocks (DOT) com> writes: The hash_seq_search keeps track of what element that it should return next in a HASH_SEQ_STATUS struct when it peruses a bucket. Removing that element from the table won't change anything since the struct remains unaffected. It still holds onto that element and hence, will return it on next iteration. This isn't a bug; it's the designed way for it to work. It's up to callers to avoid causing a problem. This report origins from the hackers thread "SPI_finish and RegisterExprContextCallback" where you indicated that my report did not properly describe a problem. Since my report was correct and since you stated that "hash_seq_search() shouldn't return any already-dropped entries." I was led me to believe that it was *not* designed to do that. Anyway, the AtCommit_Portals doesn't avoid this problem and the end result for me is the same regardless of where the error is. I can't drop portals using a ExprContextCallback and I'd like to know the best way to fix it. I can contribute a patch but I want you to decide what needs to be fixed. Does this need a C comment addition? I'm thinking of providing a remedy for my problem that does the following. |
#6
| |||
| |||
|
|
Would such a patch be accepted? |
#7
| |||
| |||
|
|
Thomas Hallgren <thhal (AT) mailblocks (DOT) com> writes: Would such a patch be accepted? Seems like a brute-force solution. I'd look first at whether AtCommit_Portals could just restart its hashtable scan after each deletion; if that seems too inefficient, modify the hash table entries themselves to carry a "portal already deleted" flag. Yes, a static flag indicating that a deletion has occured will work fine |
![]() |
| Thread Tools | |
| Display Modes | |
| |