是否有可能使一個函數調用(函數在Postgres的代碼一樣hash_estimate_size(很久很久)從像pg_ctl一個實用程序或pg_dump的?是否可以從util調用postgres內部方法?
hash_estimate_size(很久很久)文件的src /後端/ utils的定義/hash/dynahash.c和SRC聲明/包括/ utils的/ hsearch.h
我創建了一個新的文件夾UTIL:。SRC /斌/ test_code與Makefile文件和test_code.c的Makefile
內容
PGFILEDESC = "test_code"
PGAPPICON=win32
subdir = src/bin/test_code
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
OBJS= test_code.o $(WIN32RES)
all: test_code
test_code: $(OBJS) | submake-libpgport
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o [email protected]$(X)
install: all installdirs
$(INSTALL_PROGRAM) test_code$(X) '$(DESTDIR)$(bindir)/test_code$(X)'
installdirs:
$(MKDIR_P) '$(DESTDIR)$(bindir)'
uninstall:
rm -f '$(DESTDIR)$(bindir)/test_code$(X)'
clean distclean maintainer-clean:
rm -f test_code$(X) $(OBJS)
test_code.c
#include "postgres.h"
#include "replication/walreceiver.h"
int main(int argc, char *argv[])
{
printf("Has estimate value is = %zu\n", hash_estimate_size(10, 10));
return 0;
}
當我正在 「製造」,它的錯誤出像 test_code.o:在功能main': test_code.c:(.text+0x17a): undefined reference to
hash_estimate_size」 collect2:LD返回1個退出狀態 化妝:*** [test_code]錯誤1
解決此問題的任何幫助?
是否有可能找到共享存儲器的計算,而無需啓動使用某種工具的或任何其它處理以postgres發動機(在該方法中CreateSharedMemoryAndSemaphores()在ipci.c文件計算出的值)的值? – leoaaryan
這是核心服務器代碼,所以沒有。你爲什麼想要?你想達到什麼目的? –
我正在針對不同的postgres.conf文件配置對所有Postgres版本進行一些基於內存的分析。我可以在日誌文件中獲得這個值作爲「DEFUG3」的日誌級別,但我只是不想旋轉數據庫引擎。 我正在尋找替代方法來找到這個值。 – leoaaryan