是否有可能使一个函数调用(函数在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