Skip to content

Add support PostgreSQL 9.6 #108

Closed
Closed

Description

@pmichalek

Please add support for PostgreSQL 9.6. Thanks!

Activity

  1. jcflack commented on Oct 5, 2016

    @jcflack
    Contributor

    I confess I've been on other projects lately and have not yet built against 9.6. If you could report here any compilation or runtime errors or areas of incompatibility that you have noticed, that might be helpful as I get back into it.

    Thanks,
    -Chap

  2. pmichalek commented on Oct 6, 2016

    @pmichalek
    Author

    Build result contains this type of warnings:

    [ERROR] /usr/local/src/pljava/pljava-so/src/main/c/type/Array.c: In function ‘createArrayType’:
    [WARNING] /usr/local/src/pljava/pljava-so/src/main/c/type/Array.c:31:25: warning: conversion to ‘size_t {aka long unsigned int}’ from ‘jsize {aka int}’ may change the sign of the result [-Wsign-conversion]
    [ERROR] Size nBytes = elemSize * nElems;
    [ERROR] ^
    [ERROR] In file included from /usr/local/pgsql/include/server/postgres.h:47:0,
    [ERROR] from /usr/local/src/pljava/pljava-so/src/main/include/pljava/pljava.h:29,
    [ERROR] from /usr/local/src/pljava/pljava-so/src/main/include/pljava/JNICalls.h:12,
    [ERROR] from /usr/local/src/pljava/pljava-so/src/main/include/pljava/PgObject.h:12,
    [ERROR] from /usr/local/src/pljava/pljava-so/src/main/include/pljava/PgObject_priv.h:12,
    [ERROR] from /usr/local/src/pljava/pljava-so/src/main/include/pljava/type/Type_priv.h:12,
    [ERROR] from /usr/local/src/pljava/pljava-so/src/main/c/type/Array.c:9:

    Petr

  3. jcflack commented on Oct 7, 2016

    @jcflack
    Contributor

    Hi,

    Many warnings of the type [-Wsign-conversion] are known to be benign; the maven-nar-plugin enables gcc warnings that would be suppressed by default, and that is an especially fastidious and unhelpful one. If you add -Pwnosign on the mvn command line, those warnings will be suppressed, and you can see more easily whether any more serious issues exist.

    Did your build ultimately complete?

    -Chap

  4. pmichalek commented on Oct 7, 2016

    @pmichalek
    Author

    Hi, now compile results in following errors:
    Tkanks! Petr

    [ERROR] /usr/local/src/pljava/pljava-so/src/main/c/type/Portal.c: In function ‘Java_org_postgresql_pljava_internal_Portal__1isPosOverflow’:
    [ERROR] /usr/local/src/pljava/pljava-so/src/main/c/type/Portal.c:338:42: error: ‘struct PortalData’ has no member named ‘posOverflow’
    [ERROR] result = (jboolean)((Portal)p2l.ptrVal)->posOverflow;
    [ERROR] ^~
    [ERROR] /usr/local/src/pljava/pljava-so/src/main/c/XactListener.c: In function ‘xactCB’:
    [WARNING] /usr/local/src/pljava/pljava-so/src/main/c/XactListener.c:25:2: warning: enumeration value ‘XACT_EVENT_PARALLEL_COMMIT’ not handled in switch [-Wswitch]
    [ERROR] switch(event)
    [ERROR] ^~~~~~
    [WARNING] /usr/local/src/pljava/pljava-so/src/main/c/XactListener.c:25:2: warning: enumeration value ‘XACT_EVENT_PARALLEL_ABORT’ not handled in switch [-Wswitch]
    [WARNING] /usr/local/src/pljava/pljava-so/src/main/c/XactListener.c:25:2: warning: enumeration value ‘XACT_EVENT_PRE_COMMIT’ not handled in switch [-Wswitch]
    [WARNING] /usr/local/src/pljava/pljava-so/src/main/c/XactListener.c:25:2: warning: enumeration value ‘XACT_EVENT_PARALLEL_PRE_COMMIT’ not handled in switch [-Wswitch]
    [WARNING] /usr/local/src/pljava/pljava-so/src/main/c/XactListener.c:25:2: warning: enumeration value ‘XACT_EVENT_PRE_PREPARE’ not handled in switch [-Wswitch]
    [ERROR] /usr/local/src/pljava/pljava-so/src/main/c/SubXactListener.c: In function ‘subXactCB’:
    [WARNING] /usr/local/src/pljava/pljava-so/src/main/c/SubXactListener.c:26:2: warning: enumeration value ‘SUBXACT_EVENT_PRE_COMMIT_SUB’ not handled in switch [-Wswitch]
    [ERROR] switch(event)
    [ERROR] ^~~~~~
    [ERROR] /usr/local/src/pljava/pljava-so/src/main/c/type/TupleDesc.c: In function ‘Java_org_postgresql_pljava_internal_TupleDesc__1formTuple’:
    [WARNING] /usr/local/src/pljava/pljava-so/src/main/c/type/TupleDesc.c:239:11: warning: implicit declaration of function ‘heap_formtuple’ [-Wimplicit-function-declaration]
    [ERROR] tuple = heap_formtuple(self, values, nulls);
    [ERROR] ^~~~~~~~~~~~~~
    [WARNING] /usr/local/src/pljava/pljava-so/src/main/c/type/TupleDesc.c:239:9: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
    [ERROR] tuple = heap_formtuple(self, values, nulls);
    [ERROR] ^

  5. jcflack commented on Oct 10, 2016

    @jcflack
    Contributor

    Thank you for the patch! It looks as if it may resolve the compilation errors, but I will need to look more deeply to be sure of correctness. Also, ultimately, it needs version conditionals so compatibility with older versions doesn't break.

    We have been using GitHub pull requests in this project to share patches (I understand the PostgreSQL core team doesn't, but here it's the norm). An ideal pull request for this would be a branch for 9.6 compatibility, containing at least: one commit accommodating the loss of posOverflow (with commit comments explaining its removal from pgsql, and whether that changes anything for pljava), and another one for the heap_form_tuple change (I hope this thing isn't really implicitly declared, but has just moved to another .h file and needs to be included).

    If you'd like to work on that, please do! If it seems like a burden, this does seem like something I could get to myself, though it be into next week before I get there.

    Looking through the 9.6 release notes, the one other thing that looks like attention is needed will be the addition of PARALLEL { UNSAFE, RESTRICTED, SAFE } to CREATE FUNCTION. For completeness, the @Function Java annotation ought to accept this, though, for now anyway, the SQL generator should reject settings other than UNSAFE, and the run-time code should check and do the same on a function's first reference. It might be possible to allow RESTRICTED also, probably with some work to disallow certain activities in PL/Java, so that will probably need to happen in a subsequent release. I doubt that SAFE will ever be feasible in PL/Java....

    -Chap

  6. yazun commented on Oct 20, 2016

    @yazun

    Hello Chap,
    Any chance you have checked if this patch is robust?
    Cheers
    Chris

  7. yazun commented on Oct 21, 2016

    @yazun

    I have seen this today after installing on 9.6 with the above patch, what is unusual, I do not think pljava was called explicitly:

    _

    [55502.155269] postgres[28839]: segfault at 148 ip 00007f3b9af4ce9b sp 00007ffcf6462a90 error 4
    [55502.155272] postgres[28843]: segfault at 148 ip 00007f3b9af4ce9b sp 00007ffcf6462a90 error 4
    [55502.155274] postgres[28841]: segfault at 148 ip 00007f3b9af4ce9b sp 00007ffcf6462a90 error 4
    [55502.155276] in libpljava-so-1.6.0-SNAPSHOT.so[7f3b9af31000+3a000]
    [55502.155281] in libpljava-so-1.6.0-SNAPSHOT.so[7f3b9af31000+3a000]
    [55502.155283] postgres[28838]: segfault at 148 ip 00007f3b9af4ce9b sp 00007ffcf6462410 error 4

    [55502.155287] postgres[28840]: segfault at 148 ip 00007f3b9af4ce9b sp 00007ffcf6462a90 error 4
    [55502.155288] in libpljava-so-1.6.0-SNAPSHOT.so[7f3b9af31000+3a000]

    [55502.155290] in libpljava-so-1.6.0-SNAPSHOT.so[7f3b9af31000+3a000]
    [55502.155297] in libpljava-so-1.6.0-SNAPSHOT.so[7f3b9af31000+3a000]

    _

    and of course the whole cluster went down..

  8. jcflack commented on Oct 21, 2016

    @jcflack
    Contributor

    No, I don't recommend the patch as-is. I had optimistically thought I would get to it this week. I'd like to push something this weekend for testing.

    -Chap

  9. yazun commented on Oct 21, 2016

    @yazun

    ok, thanks!

  10. yazun commented on Oct 24, 2016

    @yazun

    just in case this helps, coredump, it happens from time to time for 2,3 processes at the same time so it looks like there is a race during the initialization of parallel workers (even the max gather workers is set to 0).

    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1".
    Missing separate debuginfo for /opt/jdk1.8.0_101/jre/lib/amd64/server/libjvm.so
    Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/b2/d6eedcaa5b4e5fc274fdf484b907274b1a70f0.debug
    Core was generated by `postgres: bgworker: parallel worker for PID 30788     '.
    Program terminated with signal 11, Segmentation fault.
    #0  0x00007f3b9af4ce9b in pljavaDbName () from /home/postgres/pg96/lib/libpljava-so-1.6.0-SNAPSHOT.so
    Missing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.26-20.el7_2.x86_64 glibc-2.17-106.el7_2.8.x86_64 libgcc-4.8.5-4.el7.x86_64 libstdc++-4.8.5-4.el7.x86_64 libxml2-2.9.1-6.el7_2.3.x86_64 nspr-4.11.0-1.el7_2.x86_64 nss-3.21.0-9.el7_2.x86_64 nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64 nss-util-3.21.0-2.2.el7_2.x86_64 openldap-2.4.40-9.el7_2.x86_64 xz-libs-5.1.2-12alpha.el7.x86_64 zlib-1.2.7-15.el7.x86_64
    (gdb) bt
    #0  0x00007f3b9af4ce9b in pljavaDbName () from /home/postgres/pg96/lib/libpljava-so-1.6.0-SNAPSHOT.so
    #1  0x00007f3b9af44e0d in JVMOptList_addVisualVMName () from /home/postgres/pg96/lib/libpljava-so-1.6.0-SNAPSHOT.so
    #2  0x00007f3b9af43b84 in initsequencer () from /home/postgres/pg96/lib/libpljava-so-1.6.0-SNAPSHOT.so
    #3  0x00007f3b9af44358 in _PG_init () from /home/postgres/pg96/lib/libpljava-so-1.6.0-SNAPSHOT.so
    #4  0x00000000004cd45a in internal_load_library.339867 ()
    #5  0x00000000009680f0 in ParallelWorkerMain.53180 ()
    #6  0x000000000070ed5c in StartBackgroundWorker ()
    #7  0x000000000070f27b in maybe_start_bgworker.242791 ()
    #8  0x000000000097798d in sigusr1_handler.242530.3554 ()
    #9  <signal handler called>
    #10 0x00007f3ba473b3f3 in __select_nocancel () from /lib64/libc.so.6
    #11 0x0000000000470b7d in ServerLoop.242796.3582 ()
    #12 0x00000000009794f6 in PostmasterMain ()
    #13 0x0000000000471ab0 in main ()
    
  11. jcflack commented on Oct 25, 2016

    @jcflack
    Contributor

    Thank you for that. It appears to be an issue in addition to the ones I've already identified (right now, I'm still working on the 32-bit things that PG 9.6 widened to 64), so it's good to know about.

    In general, at the moment, I'd recommend playing with the REL1_5_STABLE branch (which is going to become 1.5.1-SNAPSHOT fairly soon when I push some new stuff for testing). 1.6.0-SNAPSHOT on the master branch is definitely work-in-progress right now (I have tried not to push except at stages where things work, but it's distinctly development-quality).

    That's probably not responsible for the pljavaDbName crash though.

    Hmm, there could simply be a limitation at the moment for PL/Java in a background worker. It is getting the database name from the MyProcPort structure; I wonder whether a background worker even has one.

  12. jcflack commented on Oct 25, 2016

    @jcflack
    Contributor

    Chris,

    In your environment, what is causing PL/Java to be loaded in a background worker process?

    Is there a background worker process being created explicitly and then using PL/Java, or is there a PL/Java function that has been marked parallel-safe and used in a parallel query?

  13. jcflack commented on Oct 25, 2016

    @jcflack
    Contributor

    I have pushed a branch trackpg/REL1_5_STABLE/pg96 for testing. For me it builds successfully and completes the example tests. More is needed before a release, but please give it a try.

    -Chap

  14. yazun commented on Oct 25, 2016

    @yazun

    Thanks Chap!
    We do nothing special, I think we are calling function in this case that is not marked parallel-safe at all and is called in a unidentified (for now) parallelized query.

    I will try 1_5 branch.
    Cheers
    Chris

  15. 14 remaining items

  16. jcflack commented on Apr 4, 2017

    @jcflack
    Contributor

    @devrimgunduz, are you able to retry that with a couple extra Maven options?

    mvn -Pwnosign -Dnar.cores=1 clean package

    If you don't have the -Pwnosign, the number of nuisance sign-conversion warnings will make it difficult to see what actual problem caused your build to fail. And without the -Dnar.cores=1 the messages can be coming from different threads in arbitrary order, which also makes it hard to see what's what. (PL/Java builds fast enough that restricting the build to one thread doesn't noticeably slow it down anyway.)

  17. devrimgunduz commented on Apr 4, 2017

    @devrimgunduz

    @jcflack

    Thanks for the reply. Here is the output:

    pljava.txt

    Regards, Devrim

  18. jcflack commented on Apr 4, 2017

    @jcflack
    Contributor

    @devrimgunduz, have you tried building from the trackpg/REL1_5_STABLE/pg96 branch? That reminds me of something that's been fixed there.

    -Chap

  19. devrimgunduz commented on Apr 4, 2017

    @devrimgunduz

    Hi @jcflack , no, because this is an RPM build, and it depends on released versions (tarballs)

    Will you release 1.5.1 that also includes this fix? Actually this is holding 9.5 -> 9.6 upgrades for PL/Java users.

    Regards, Devrim

  20. devrimgunduz commented on Apr 4, 2017

    @devrimgunduz

    @jcflack I created a fake 1.5.1 tarball using that branch, and it compiles fine. I'm still getting these, though, but they don't block the build. So, may I please insist on 1.5.1? :-)

    [ERROR] /home/devrim/Documents/Devrim/Projects/repo/pgrpms/rpm/redhat/9.6/pljava/F-25/pljava-1_5_1/pljava-so/src/main/c/SubXactListener.c: In function 'subXactCB': [WARNING] /home/devrim/Documents/Devrim/Projects/repo/pgrpms/rpm/redhat/9.6/pljava/F-25/pljava-1_5_1/pljava-so/src/main/c/SubXactListener.c:26:2: warning: enumeration value 'SUBXACT_EVENT_PRE_COMMIT_SUB' not handled in switch [-Wswitch] [ERROR] switch(event) [ERROR] ^~~~~~ [ERROR] /home/devrim/Documents/Devrim/Projects/repo/pgrpms/rpm/redhat/9.6/pljava/F-25/pljava-1_5_1/pljava-so/src/main/c/XactListener.c: In function 'xactCB': [WARNING] /home/devrim/Documents/Devrim/Projects/repo/pgrpms/rpm/redhat/9.6/pljava/F-25/pljava-1_5_1/pljava-so/src/main/c/XactListener.c:25:2: warning: enumeration value 'XACT_EVENT_PARALLEL_COMMIT' not handled in switch [-Wswitch] [ERROR] switch(event) [ERROR] ^~~~~~ [WARNING] /home/devrim/Documents/Devrim/Projects/repo/pgrpms/rpm/redhat/9.6/pljava/F-25/pljava-1_5_1/pljava-so/src/main/c/XactListener.c:25:2: warning: enumeration value 'XACT_EVENT_PARALLEL_ABORT' not handled in switch [-Wswitch] [WARNING] /home/devrim/Documents/Devrim/Projects/repo/pgrpms/rpm/redhat/9.6/pljava/F-25/pljava-1_5_1/pljava-so/src/main/c/XactListener.c:25:2: warning: enumeration value 'XACT_EVENT_PRE_COMMIT' not handled in switch [-Wswitch] [WARNING] /home/devrim/Documents/Devrim/Projects/repo/pgrpms/rpm/redhat/9.6/pljava/F-25/pljava-1_5_1/pljava-so/src/main/c/XactListener.c:25:2: warning: enumeration value 'XACT_EVENT_PARALLEL_PRE_COMMIT' not handled in switch [-Wswitch] [WARNING] /home/devrim/Documents/Devrim/Projects/repo/pgrpms/rpm/redhat/9.6/pljava/F-25/pljava-1_5_1/pljava-so/src/main/c/XactListener.c:25:2: warning: enumeration value 'XACT_EVENT_PRE_PREPARE' not handled in switch [-Wswitch]

    Regards, Devrim

  21. jcflack commented on Apr 4, 2017

    @jcflack
    Contributor

    Yes. :) I just need to make sure the right issues are addressed in it, and schedule one (I hope) beta period of a reasonable length, announced over the usual channels.

    Speaking of rpms, a while back you were having problems because some part of the rpmbuild process was rebuilding the generated jar and creating intermediate directories in it. Did you ever find a way to turn that behavior off?

    -Chap

  22. devrimgunduz commented on Apr 4, 2017

    @devrimgunduz

    @jcflack Well, this is a blocker for the upgrades, so the sooner, the better...

    Yeah, I fixed the RPM issue for 9.5:

    https://git.postgresql.org/gitweb/?p=pgrpms.git;a=commit;h=93ab117fa7400b0609db66385718f479eea3ce5a

    (and a few more followup commits, too). Actually this is why I'm pushing more for 9.6 now ;)

    Regards, Devrim

  23. jcflack commented on Apr 4, 2017

    @jcflack
    Contributor

    @devrimgunduz Hm, so you ended up not running the installable jar at all, but just duplicating the code to put the files in place directly? That seems more brittle to me, more code in the spec file that you would need to keep in sync with the javascript in the jar.

    Does that mean you never had success with either %define __jar_repack 0 in the spec file, or export ZIPOPT=-D in the %build section? I never heard back after my email to you in October, so I don't know whether you tried either one. The %define __jar_repack 0 seems most desirable to me, if it works.

    This is not completely off-topic, because I did want to know whether I needed to put some adjustment into the javascript for 1.5.1 to accommodate that, if you were not able to get either spec file adjustment to work.

    -Chap

  24. jcflack commented on Apr 7, 2017

    @jcflack
    Contributor

    @devrimgunduz have I driven you away by asking about that jar repacking issue? Didn't mean to. I'm just eager for a way to resolve it that doesn't force you to duplicate code.

    -Chap

  25. DavidGradwell commented on May 4, 2017

    @DavidGradwell

    I've successfully built pljava on Debian with Postgresql 9.6 and will now test.
    For anyone else who wants to do the same:

    1. put everything needed to compile in place including sudo apt-get install libkrb5-dev
    2. git clone https://github.com/tada/pljava.git
    3. git checkout trackpg/REL1_5_STABLE/pg96
    4. mvn clean install -Pwnosign
  26. SDILIPS commented on Oct 16, 2017

    @SDILIPS

    Is Postgres 9.6 supported in Pl/Java REL1_5_STABLE on windows 7 building and installation?

    I am getting the below Error:
    "Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.2.3"while building Pl/Java using visual studio on windows 7.

  27. jcflack commented on Oct 26, 2017

    @jcflack
    Contributor

    @SDILIPS sorry for my delay.

    To the best of my knowledge, there is no issue building 1.5.1-BETA1 (or REL1_5_STABLE, which at this moment is nearly equivalent, though I would recommend 1.5.1-BETA1 just for clarity) on Windows.

    There are, however, two ways of building for Windows (MS Visual Studio or MinGW-w64), and for each way there is a special topics page in the build instructions (msvc or MinGW), so I hope you will read the one of those that applies to your situation, if you haven't already.

    Also, near the bottom of that build page, there is a section on "Troubleshooting the build", covering many issues that first-time builders run into.

    If you still have building difficulties after reviewing those, please post again here, and please describe your environment in more detail, and whether you are building with MSVC or with MinGW-w64. Also, please use -X -Dnar.cores=1 on the mvn command line and capture the output in a file, and include that file as an attachment with your followup post.

    Thanks!

  28. SDILIPS commented on Oct 26, 2017

    @SDILIPS

    @jcflack - Thank you for your reply. I am still facing the same error. Below is my detailed description of environment. Also please find attached the output of "mvn clean install -X -Dnar.cores=1" in the output file named "ErrorLog.txt"

    OS - Windows 7 - 64 bit
    Postgres version - 9.6.5
    PL/Java version - 1.5.1-BETA1
    Build type - MS Visual studio version 10
    Javac version - 1.8.0_121
    Maven version - 3.0.3
    Git version - 2.14.2.windows.2
    ErrorLog.txt

  29. jcflack commented on Oct 18, 2018

    @jcflack
    Contributor

    Closing with release of 1.5.1.

    I see there was an unanswered comment on this issue about a failed link when building with MSVC. But I have recent reports of successful 1.5.1 builds with MSVC, so I have to hope that was a fluke that got resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions