Skip to content

Commit

Permalink
Fix accounting of dropped prefetch requests
Browse files Browse the repository at this point in the history
Apparently, we failed to do this bookkeeping in quite a few places...
  • Loading branch information
MMeent authored Jan 3, 2025
1 parent 4b2f568 commit 2b51171
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pgxn/neon/pagestore_smgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,8 @@ prefetch_on_ps_disconnect(void)
MyPState->ring_receive += 1;

prefetch_set_unused(ring_index);
pgBufferUsage.prefetch.expired += 1;
MyNeonCounters->getpage_prefetch_discards_total += 1;
}

/*
Expand Down Expand Up @@ -935,7 +937,8 @@ prefetch_register_bufferv(BufferTag tag, neon_request_lsns *frlsns,
prefetch_set_unused(ring_index);
entry = NULL;
slot = NULL;
MyNeonCounters->getpage_prefetch_discards_total++;
pgBufferUsage.prefetch.expired += 1;
MyNeonCounters->getpage_prefetch_discards_total += 1;
}
}

Expand Down Expand Up @@ -1026,10 +1029,14 @@ prefetch_register_bufferv(BufferTag tag, neon_request_lsns *frlsns,
if (!prefetch_wait_for(cleanup_index))
goto Retry;
prefetch_set_unused(cleanup_index);
pgBufferUsage.prefetch.expired += 1;
MyNeonCounters->getpage_prefetch_discards_total += 1;
break;
case PRFS_RECEIVED:
case PRFS_TAG_REMAINS:
prefetch_set_unused(cleanup_index);
pgBufferUsage.prefetch.expired += 1;
MyNeonCounters->getpage_prefetch_discards_total += 1;
break;
default:
pg_unreachable();
Expand Down

0 comments on commit 2b51171

Please sign in to comment.