heapam_tuple_complete_speculative : remove unnecessary tuple fetch
В списке pgsql-hackers по дате отправления:
| От | Chao Li |
|---|---|
| Тема | heapam_tuple_complete_speculative : remove unnecessary tuple fetch |
| Дата | |
| Msg-id | FCB61654-575D-4F08-AA7E-ED462EDE48A7@gmail.com обсуждение исходный текст |
| Ответы |
Re: heapam_tuple_complete_speculative : remove unnecessary tuple fetch
|
| Список | pgsql-hackers |
Hi,
While reviewing another patch, I noticed this:
```
static void
heapam_tuple_complete_speculative(Relation relation, TupleTableSlot *slot,
uint32 specToken, bool succeeded)
{
bool shouldFree = true;
HeapTuple tuple = ExecFetchSlotHeapTuple(slot, true, &shouldFree); // <== tuple is not used
/* adjust the tuple's state accordingly */
if (succeeded)
heap_finish_speculative(relation, &slot->tts_tid);
else
heap_abort_speculative(relation, &slot->tts_tid);
if (shouldFree)
pfree(tuple);
}
```
In this function, tuple is not used at all, so there seems to be no need to fetch it, and shouldFree is thus not needed
either.
This appears to have been there since 5db6df0c011, where the function was introduced. It looks like a copy-pasto from
theprevious function, heapam_tuple_insert_speculative(), which does need to fetch and possibly free the tuple.
I tried simply removing ExecFetchSlotHeapTuple(), and "make check" still passes. But I may be missing something, so I’d
liketo confirm.
The attached patch just removes the unused tuple and shouldFree from this function. As touching the file, I also fixed
atypo in the file header comment.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера