| From: | cca5507 <cca5507(at)qq(dot)com> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Minor refactor in catcache.c |
| Date: | 2025-12-30 11:48:44 |
| Message-ID: | tencent_12D586A7D4CB04E1A11C08D9E187FE15760A@qq.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
```
@@ -1010,7 +1010,7 @@ RehashCatCache(CatCache *cp)
dlist_foreach_modify(iter, &cp->cc_bucket[i])
{
CatCTup *ct = dlist_container(CatCTup, cache_elem, iter.cur);
- int hashIndex = HASH_INDEX(ct->hash_value, newnbuckets);
+ Index hashIndex = HASH_INDEX(ct->hash_value, newnbuckets);
dlist_delete(iter.cur);
dlist_push_head(&newbucket[hashIndex], &ct->cache_elem);
@@ -1048,7 +1048,7 @@ RehashCatCacheLists(CatCache *cp)
dlist_foreach_modify(iter, &cp->cc_lbucket[i])
{
CatCList *cl = dlist_container(CatCList, cache_elem, iter.cur);
- int hashIndex = HASH_INDEX(cl->hash_value, newnbuckets);
+ Index hashIndex = HASH_INDEX(cl->hash_value, newnbuckets);
dlist_delete(iter.cur);
dlist_push_head(&newbucket[hashIndex], &cl->cache_elem);
```
The 'hashIndex' should be 'Index' rather than 'int'.
```
@@ -2039,8 +2039,7 @@ SearchCatCacheList(CatCache *cache,
#ifndef CATCACHE_FORCE_RELEASE
ct->dead &&
#endif
- ct->refcount == 0 &&
- (ct->c_list == NULL || ct->c_list->refcount == 0))
+ ct->refcount == 0)
CatCacheRemoveCTup(cache, ct);
}
```
Remove the dead code because we have a 'Assert(ct->c_list == NULL);'.
--
Regards,
ChangAo Chen
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Minor-refactor-in-catcache.c.patch | application/octet-stream | 1.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matthias van de Meent | 2025-12-30 12:15:03 | Re: Minor refactor in catcache.c |
| Previous Message | Ashutosh Bapat | 2025-12-30 11:27:15 | Re: SQL Property Graph Queries (SQL/PGQ) |