mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 05:22:56 +00:00
Fix segfault in unimplemented function
We need to implement this eventually, but for now let's at least silence the segfault. See also https://github.com/neondatabase/neon/pull/12696
This commit is contained in:
@@ -1358,19 +1358,12 @@ communicator_new_approximate_working_set_size_seconds(time_t duration, bool rese
|
||||
|
||||
|
||||
/*
|
||||
* Return an array of LfcStatsEntrys, terminated by an entry with NULL name
|
||||
* Return an array of LfcStatsEntrys
|
||||
*/
|
||||
LfcStatsEntry *
|
||||
communicator_new_get_lfc_stats(void)
|
||||
communicator_new_get_lfc_stats(uint32 *num_entries)
|
||||
{
|
||||
LfcStatsEntry *entries;
|
||||
int i = 0;
|
||||
|
||||
// TODO
|
||||
#define NUM_ENTRIES 0
|
||||
entries = palloc(sizeof(LfcStatsEntry) * (NUM_ENTRIES + 1));
|
||||
entries[i++] = (LfcStatsEntry) { NULL, false, 0 };
|
||||
Assert(i <= NUM_ENTRIES);
|
||||
|
||||
return entries;
|
||||
*num_entries = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,6 @@ extern void communicator_new_update_cached_rel_size(NRelFileInfo rinfo, ForkNumb
|
||||
/* other functions */
|
||||
extern int32 communicator_new_approximate_working_set_size_seconds(time_t duration, bool reset);
|
||||
extern FileCacheState *communicator_new_get_lfc_state(size_t max_entries);
|
||||
extern LfcStatsEntry *communicator_new_get_lfc_stats(void);
|
||||
extern LfcStatsEntry *communicator_new_get_lfc_stats(uint32 *num_entries);
|
||||
|
||||
#endif /* COMMUNICATOR_NEW_H */
|
||||
|
||||
@@ -1535,40 +1535,40 @@ lfc_writev(NRelFileInfo rinfo, ForkNumber forkNum, BlockNumber blkno,
|
||||
}
|
||||
|
||||
/*
|
||||
* Return an array of LfcStatsEntrys, terminated by an entry with NULL name
|
||||
* Return an array of LfcStatsEntrys
|
||||
*/
|
||||
LfcStatsEntry *
|
||||
get_lfc_stats(void)
|
||||
get_lfc_stats(uint32 *num_entries)
|
||||
{
|
||||
LfcStatsEntry *entries;
|
||||
int i = 0;
|
||||
int n = 0;
|
||||
|
||||
#define NUM_ENTRIES 10
|
||||
entries = palloc(sizeof(LfcStatsEntry) * (NUM_ENTRIES + 1));
|
||||
entries = palloc(sizeof(LfcStatsEntry) * NUM_ENTRIES);
|
||||
|
||||
entries[i++] = (LfcStatsEntry) {"file_cache_chunk_size_pages", lfc_ctl == NULL,
|
||||
entries[n++] = (LfcStatsEntry) {"file_cache_chunk_size_pages", lfc_ctl == NULL,
|
||||
lfc_ctl ? lfc_blocks_per_chunk : 0 };
|
||||
entries[i++] = (LfcStatsEntry) {"file_cache_misses", lfc_ctl == NULL,
|
||||
entries[n++] = (LfcStatsEntry) {"file_cache_misses", lfc_ctl == NULL,
|
||||
lfc_ctl ? lfc_ctl->misses : 0};
|
||||
entries[i++] = (LfcStatsEntry) {"file_cache_hits", lfc_ctl == NULL,
|
||||
entries[n++] = (LfcStatsEntry) {"file_cache_hits", lfc_ctl == NULL,
|
||||
lfc_ctl ? lfc_ctl->hits : 0 };
|
||||
entries[i++] = (LfcStatsEntry) {"file_cache_used", lfc_ctl == NULL,
|
||||
entries[n++] = (LfcStatsEntry) {"file_cache_used", lfc_ctl == NULL,
|
||||
lfc_ctl ? lfc_ctl->used : 0 };
|
||||
entries[i++] = (LfcStatsEntry) {"file_cache_writes", lfc_ctl == NULL,
|
||||
entries[n++] = (LfcStatsEntry) {"file_cache_writes", lfc_ctl == NULL,
|
||||
lfc_ctl ? lfc_ctl->writes : 0 };
|
||||
entries[i++] = (LfcStatsEntry) {"file_cache_size", lfc_ctl == NULL,
|
||||
entries[n++] = (LfcStatsEntry) {"file_cache_size", lfc_ctl == NULL,
|
||||
lfc_ctl ? lfc_ctl->size : 0 };
|
||||
entries[i++] = (LfcStatsEntry) {"file_cache_used_pages", lfc_ctl == NULL,
|
||||
entries[n++] = (LfcStatsEntry) {"file_cache_used_pages", lfc_ctl == NULL,
|
||||
lfc_ctl ? lfc_ctl->used_pages : 0 };
|
||||
entries[i++] = (LfcStatsEntry) {"file_cache_evicted_pages", lfc_ctl == NULL,
|
||||
entries[n++] = (LfcStatsEntry) {"file_cache_evicted_pages", lfc_ctl == NULL,
|
||||
lfc_ctl ? lfc_ctl->evicted_pages : 0 };
|
||||
entries[i++] = (LfcStatsEntry) {"file_cache_limit", lfc_ctl == NULL,
|
||||
entries[n++] = (LfcStatsEntry) {"file_cache_limit", lfc_ctl == NULL,
|
||||
lfc_ctl ? lfc_ctl->limit : 0 };
|
||||
entries[i++] = (LfcStatsEntry) {"file_cache_chunks_pinned", lfc_ctl == NULL,
|
||||
entries[n++] = (LfcStatsEntry) {"file_cache_chunks_pinned", lfc_ctl == NULL,
|
||||
lfc_ctl ? lfc_ctl->pinned : 0 };
|
||||
entries[i++] = (LfcStatsEntry) { NULL, false, 0 };
|
||||
Assert(i <= NUM_ENTRIES);
|
||||
Assert(n <= NUM_ENTRIES);
|
||||
|
||||
*num_entries = n;
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ extern bool lfc_prefetch(NRelFileInfo rinfo, ForkNumber forknum, BlockNumber blk
|
||||
|
||||
extern FileCacheState* lfc_get_state(size_t max_entries);
|
||||
extern int32 lfc_approximate_working_set_size_seconds(time_t duration, bool reset);
|
||||
extern LfcStatsEntry *get_lfc_stats(void);
|
||||
extern LfcStatsEntry *get_lfc_stats(uint32 *num_entries);
|
||||
|
||||
static inline bool
|
||||
lfc_read(NRelFileInfo rinfo, ForkNumber forkNum, BlockNumber blkno,
|
||||
|
||||
@@ -720,18 +720,18 @@ neon_get_lfc_stats(PG_FUNCTION_ARGS)
|
||||
#define NUM_NEON_GET_STATS_COLS 2
|
||||
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
|
||||
LfcStatsEntry *entries;
|
||||
LfcStatsEntry *entry;
|
||||
uint32 num_entries;
|
||||
|
||||
InitMaterializedSRF(fcinfo, 0);
|
||||
|
||||
if (neon_use_communicator_worker)
|
||||
entries = communicator_new_get_lfc_stats();
|
||||
entries = communicator_new_get_lfc_stats(&num_entries);
|
||||
else
|
||||
entries = get_lfc_stats();
|
||||
entries = get_lfc_stats(&num_entries);
|
||||
|
||||
entry = entries;
|
||||
while (entry->metric_name != NULL)
|
||||
for (uint32 i = 0; i < num_entries; i++)
|
||||
{
|
||||
LfcStatsEntry *entry = &entries[i];
|
||||
Datum values[NUM_NEON_GET_STATS_COLS];
|
||||
bool nulls[NUM_NEON_GET_STATS_COLS];
|
||||
|
||||
@@ -739,7 +739,6 @@ neon_get_lfc_stats(PG_FUNCTION_ARGS)
|
||||
nulls[1] = entry->isnull;
|
||||
values[1] = Int64GetDatum(entry->isnull ? 0 : entry->value);
|
||||
tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, values, nulls);
|
||||
entry++;
|
||||
}
|
||||
|
||||
PG_RETURN_VOID();
|
||||
|
||||
Reference in New Issue
Block a user