Skip to content

Commit

Permalink
Merge trackpg/REL1_6_STABLE/pg17 and trackjdk/REL1_6_STABLE/jdk23bld …
Browse files Browse the repository at this point in the history
…into REL1_6_STABLE
  • Loading branch information
jcflack committed Oct 5, 2024
3 parents f9e962f + 603197d + 7ed4918 commit 3118cf2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public SourceVersion getSupportedSourceVersion()
* Update latest_tested to be the latest Java release on which this
* annotation processor has been tested without problems.
*/
int latest_tested = 22;
int latest_tested = 23;
int ordinal_9 = SourceVersion.RELEASE_9.ordinal();
int ordinal_latest = latest_tested - 9 + ordinal_9;

Expand Down
2 changes: 1 addition & 1 deletion pljava-so/src/main/c/Backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,7 @@ void Backend_warnJEP411(bool isCommit)
"Those changes will come in releases after Java 17."),
errhint(
"For migration planning, this version of PL/Java can still "
"enforce policy in Java versions up to and including 22, "
"enforce policy in Java versions up to and including 23, "
"and Java 17 and 21 are positioned as long-term support releases. "
"For details on how PL/Java will adapt, please bookmark "
"https://github.com/tada/pljava/wiki/JEP-411")
Expand Down
16 changes: 10 additions & 6 deletions pljava-so/src/main/c/InstallHelper.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2023 Tada AB and other contributors, as listed below.
* Copyright (c) 2015-2024 Tada AB and other contributors, as listed below.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the The BSD 3-Clause License
Expand All @@ -14,6 +14,7 @@
#include <access/xact.h>
#include <catalog/pg_language.h>
#include <catalog/pg_proc.h>
#include <commands/dbcommands.h>
#include <commands/extension.h>
#include <commands/portalcmds.h>
#include <executor/spi.h>
Expand Down Expand Up @@ -43,18 +44,21 @@
#include "pljava/PgObject.h"
#include "pljava/type/String.h"

#if PG_VERSION_NUM < 170000
#define AmAutoVacuumWorkerProcess() IsAutoVacuumWorkerProcess()
#define AmBackgroundWorkerProcess() IsBackgroundWorker
/*
* As of 9.6.1, IsBackgroundWorker still does not
* have PGDLLIMPORT, but MyBgworkerEntry != NULL can be used in MSVC instead.
*
* One thing it's needed for is to avoid dereferencing MyProcPort in a
* background worker, where it's not set.
*/
#include <commands/dbcommands.h>
#if defined(_MSC_VER)
#include <postmaster/bgworker.h>
#define IsBackgroundWorker (MyBgworkerEntry != NULL)
#endif
#endif /* PG_VERSION_NUM < 170000 */

/*
* The name of the table the extension scripts will create to pass information
Expand Down Expand Up @@ -90,7 +94,7 @@ bool pljavaViableXact()

char *pljavaDbName()
{
if ( IsAutoVacuumWorkerProcess() || IsBackgroundWorker )
if ( AmAutoVacuumWorkerProcess() || AmBackgroundWorkerProcess() )
{
char *shortlived;
static char *longlived;
Expand All @@ -110,7 +114,7 @@ char *pljavaDbName()

static char *origUserName()
{
if ( IsAutoVacuumWorkerProcess() || IsBackgroundWorker )
if ( AmAutoVacuumWorkerProcess() || AmBackgroundWorkerProcess() )
{
char *shortlived;
static char *longlived;
Expand Down Expand Up @@ -354,8 +358,8 @@ char *pljavaFnOidToLibPath(Oid fnOid, char **langName, bool *trusted)

bool InstallHelper_shouldDeferInit()
{
if ( IsBackgroundWorker || IsAutoVacuumWorkerProcess() )
return true;
if ( AmAutoVacuumWorkerProcess() || AmBackgroundWorkerProcess() )
return true;

if ( ! IsBinaryUpgrade )
return false;
Expand Down
4 changes: 3 additions & 1 deletion pljava-so/src/main/c/PgSavepoint.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2019 Tada AB and other contributors, as listed below.
* Copyright (c) 2004-2024 Tada AB and other contributors, as listed below.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the The BSD 3-Clause License
Expand Down Expand Up @@ -187,7 +187,9 @@ Java_org_postgresql_pljava_internal_PgSavepoint__1rollback(JNIEnv* env, jclass c
PG_TRY();
{
unwind(RollbackAndReleaseCurrentSubTransaction, xid, nestLevel);
#if PG_VERSION_NUM < 100000
SPI_restore_connection();
#endif
}
PG_CATCH();
{
Expand Down
2 changes: 1 addition & 1 deletion src/site/markdown/use/policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ release, so relying on it is not recommended.
The developers of Java have elected to phase out important language features
used by PL/Java to enforce policy. The changes will come in releases after
Java 17. For migration planning, this version of PL/Java can still enable
policy enforcement in Java versions up to and including 22, and Java 17 and 21
policy enforcement in Java versions up to and including 23, and Java 17 and 21
are positioned as long-term support releases. (There is a likelihood,
increasing with later Java versions, even before policy stops being enforceable,
that some internal privileged operations by Java itself, or other libraries,
Expand Down

0 comments on commit 3118cf2

Please sign in to comment.