Skip to content

Commit

Permalink
Skip function_telemetry.c when telemetry is disabled
Browse files Browse the repository at this point in the history
This avoids allocating the telemetry hash table, which saves a little
shared memory.
  • Loading branch information
hlinnaka committed Feb 13, 2025
1 parent 910cbbf commit 6ff88d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ set(SOURCES
bgw_counter.c
bgw_launcher.c
bgw_interface.c
function_telemetry.c
lwlocks.c)

if(USE_TELEMETRY)
list(APPEND SOURCES function_telemetry.c)
endif()

set(TEST_SOURCES ${PROJECT_SOURCE_DIR}/test/src/symbol_conflict.c)

add_library(${PROJECT_NAME}-loader MODULE ${SOURCES})
Expand Down
6 changes: 6 additions & 0 deletions src/loader/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
#include "loader/bgw_interface.h"
#include "loader/bgw_launcher.h"
#include "loader/bgw_message_queue.h"
#ifdef USE_TELEMETRY
#include "loader/function_telemetry.h"
#endif
#include "loader/loader.h"
#include "loader/lwlocks.h"

Expand Down Expand Up @@ -546,7 +548,9 @@ timescaledb_shmem_startup_hook(void)
ts_bgw_counter_shmem_startup();
ts_bgw_message_queue_shmem_startup();
ts_lwlocks_shmem_startup();
#ifdef USE_TELEMETRY
ts_function_telemetry_shmem_startup();
#endif
}

/*
Expand All @@ -565,7 +569,9 @@ timescaledb_shmem_request_hook(void)
ts_bgw_counter_shmem_alloc();
ts_bgw_message_queue_alloc();
ts_lwlocks_shmem_alloc();
#ifdef USE_TELEMETRY
ts_function_telemetry_shmem_alloc();
#endif
}

static void
Expand Down

0 comments on commit 6ff88d2

Please sign in to comment.