Open onderkalaci opened 9 years ago
Wow, looks like there's an avalanche of independent discoveries of errors related to shared library(ies) symbol resolution. Just a couple days ago, was looking at a segfault where a library loaded with shared_preload_libraries had a yet-unfixed-for-PG-9.4+ copy of a function that a later loaded library also had defined. And since the later loaded library has already fixed the function for-PG-9.4+, it took a while to figure this out since yet-unfixed copy was being used in all places.
We've discussed this a little bit and it seems you are planning to use -Bsymbolic on extension side. Have you considered downsides of using it though, as I encountered (or you may have) a few Bsymbolic-Considered-Harmful posts around web[1]. Maybe a little more reliable would be -Bsymbolic-functions?
I tried to see what happens if we rename GetConnection in pg_shard to something else to avoid this conflict. I was able to create a postgres_fdw table that pointed to a pg_shard table, which allowed me to do joins between a local table and a distributed table.
However, when I ran an INSERT command I got the following error:
LOG: statement: INSERT INTO customer_reviews_fdw VALUES
('HN802', '2004-01-01', 1, 10, 4, 'B00007B5DN',
'Tug of War', 133191, 'Music', 'Indie Music', 'Pop', '{}');
LOG: statement: SET search_path = pg_catalog
LOG: statement: SET timezone = 'UTC'
LOG: statement: SET datestyle = ISO
LOG: statement: SET intervalstyle = postgres
LOG: statement: SET extra_float_digits = 3
LOG: statement: START TRANSACTION ISOLATION LEVEL REPEATABLE READ
ERROR: unrecognized node type: 2100
STATEMENT: INSERT INTO public.customer_reviews(customer_id, review_date, review_rating, review_votes, review_helpful_votes, product_id, product_title, product_sales_rank, produ)
ERROR: unrecognized node type: 2100
CONTEXT: Remote SQL command: INSERT INTO public.customer_reviews(customer_id, review_date, review_rating, review_votes, review_helpful_votes, product_id, product_title, product)
STATEMENT: INSERT INTO customer_reviews_fdw VALUES
('HN802', '2004-01-01', 1, 10, 4, 'B00007B5DN',
'Tug of War', 133191, 'Music', 'Indie Music', 'Pop', '{}');
LOG: statement: ABORT TRANSACTION
TRAP: FailedAssertion("!(IsTransactionState())", File: "relcache.c", Line: 1650)
WARNING: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
CONTEXT: Remote SQL command: ABORT TRANSACTION
LOG: server process (PID 9804) was terminated by signal 6: Aborted
DETAIL: Failed process was running: ABORT TRANSACTION
LOG: terminating any other active server processes
@samay-sharma discovered that postgres_fdw does not work when shared_preload_libraries is set to 'pg_shard'.
When the instructions on this link is followed for postgres_fdw, we get the following error on INSERT statements to postgres_fdw table:
The root of the problem seems to be about linking/loading of shared libraries. postgres_fdw extension calls a function GetConnection() in somewhere in the code. However, since pg_shard is also loaded, pg_shard's GetConnection() function is called.
We might consider this comment in the Makefile.
Also note that, call to DeterminePlannerType(), returns _PLANNER_TYPEPOSTGRES, and _standardplanner() is called. This error is thrown after _standardplanner() is called.