Skip to content

Commit

Permalink
Add compatibility for DBMS 5.15
Browse files Browse the repository at this point in the history
Co-authored-by: Sören Reichardt <[email protected]>
  • Loading branch information
Mats-SX and soerenreichardt committed Dec 19, 2023
1 parent 74dd6e0 commit 93d58fe
Show file tree
Hide file tree
Showing 36 changed files with 3,690 additions and 6 deletions.
12 changes: 8 additions & 4 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ When installing GDS manually, please refer to the below compatibility matrix:
.Compatibility matrix (italicized version is in development)
|===
|GDS version | Neo4j version | Java Version
.10+<.^|_GDS 2.6.x_ (preview)
.11+<.^|_GDS 2.6.x_ (preview)
|Neo4j 5.15.0
.2+.^|Java 21 & Java 17
|Neo4j 5.14.0
.9+.^|Java 17
|Neo4j 5.13.0
.8+.^|Java 17
|Neo4j 5.12.0
|Neo4j 5.11.0
|Neo4j 5.10.0
Expand All @@ -39,10 +41,12 @@ When installing GDS manually, please refer to the below compatibility matrix:
|Neo4j 5.6.0
|Neo4j 4.4.9 - 4.4.28
.1+.^|Java 11
.10+<.^|GDS 2.5.x
.11+<.^|GDS 2.5.x
|Neo4j 5.15.0
.2+.^|Java 21 & Java 17
|Neo4j 5.14.0
.9+.^|Java 17
|Neo4j 5.13.0
.8+.^|Java 17
|Neo4j 5.12.0
|Neo4j 5.11.0
|Neo4j 5.10.0
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ext {
project(':neo4j-kernel-adapter-5.12'),
project(':neo4j-kernel-adapter-5.13'),
project(':neo4j-kernel-adapter-5.14'),
project(':neo4j-kernel-adapter-5.15'),
],
'storage-engine-adapter': [
project(':storage-engine-adapter-4.4'),
Expand All @@ -50,6 +51,7 @@ ext {
project(':storage-engine-adapter-5.12'),
project(':storage-engine-adapter-5.13'),
project(':storage-engine-adapter-5.14'),
project(':storage-engine-adapter-5.15'),
]
]
}
Expand Down
67 changes: 67 additions & 0 deletions compatibility/5.15/neo4j-kernel-adapter/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apply plugin: 'java-library'
apply plugin: 'me.champeau.mrjar'

description = 'Neo4j Graph Data Science :: Neo4j Kernel Adapter 5.15'

group = 'org.neo4j.gds'

// for all 5.x versions
if (ver.'neo4j'.startsWith('5.')) {
sourceSets {
main {
java {
srcDirs = ['src/main/java17']
}
}
}

dependencies {
annotationProcessor project(':annotations')
annotationProcessor group: 'org.immutables', name: 'value', version: ver.'immutables'
annotationProcessor group: 'org.neo4j', name: 'annotations', version: neos.'5.15'

compileOnly project(':annotations')
compileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: ver.'spotbugsToolVersion'
compileOnly group: 'org.immutables', name: 'value-annotations', version: ver.'immutables'
compileOnly group: 'org.neo4j', name: 'annotations', version: neos.'5.15'
compileOnly group: 'org.neo4j', name: 'neo4j', version: neos.'5.15'
compileOnly group: 'org.neo4j', name: 'neo4j-record-storage-engine', version: neos.'5.15'
compileOnly group: 'org.neo4j.community', name: 'it-test-support', version: neos.'5.15'

implementation project(':neo4j-kernel-adapter-api')
implementation project(':neo4j-kernel-adapter-5-common')
}
} else {
multiRelease {
targetVersions 11, 17
}

if (!project.hasProperty('no-forbidden-apis')) {
forbiddenApisJava17 {
exclude('**')
}
}

dependencies {
annotationProcessor group: 'org.neo4j', name: 'annotations', version: ver.'neo4j'

compileOnly project(':annotations')
compileOnly group: 'org.neo4j', name: 'annotations', version: ver.'neo4j'

implementation project(':neo4j-kernel-adapter-api')

java17AnnotationProcessor project(':annotations')
java17AnnotationProcessor group: 'org.immutables', name: 'value', version: ver.'immutables'
java17AnnotationProcessor group: 'org.neo4j', name: 'annotations', version: neos.'5.15'

java17CompileOnly project(':annotations')
java17CompileOnly group: 'org.immutables', name: 'value-annotations', version: ver.'immutables'
java17CompileOnly group: 'org.neo4j', name: 'neo4j', version: neos.'5.15'
java17CompileOnly group: 'org.neo4j', name: 'neo4j-record-storage-engine', version: neos.'5.15'
java17CompileOnly group: 'org.neo4j.community', name: 'it-test-support', version: neos.'5.15'
java17CompileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: ver.'spotbugsToolVersion'

java17Implementation project(':neo4j-kernel-adapter-api')
java17Implementation project(':neo4j-kernel-adapter-5-common')
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.gds.compat._515;

import org.neo4j.annotations.service.ServiceProvider;
import org.neo4j.gds.compat.Neo4jProxyApi;
import org.neo4j.gds.compat.Neo4jProxyFactory;
import org.neo4j.gds.compat.Neo4jVersion;

@ServiceProvider
public final class Neo4jProxyFactoryImpl implements Neo4jProxyFactory {

@Override
public boolean canLoad(Neo4jVersion version) {
return false;
}

@Override
public Neo4jProxyApi load() {
throw new UnsupportedOperationException("5.15 compatibility requires JDK17");
}

@Override
public String description() {
return "Neo4j 5.15 (placeholder)";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.gds.compat._515;

import org.neo4j.bolt.dbapi.BoltGraphDatabaseServiceSPI;
import org.neo4j.bolt.dbapi.BoltTransaction;
import org.neo4j.bolt.protocol.common.message.AccessMode;
import org.neo4j.bolt.protocol.common.message.request.connection.RoutingContext;
import org.neo4j.bolt.tx.statement.StatementQuerySubscriber;
import org.neo4j.exceptions.KernelException;
import org.neo4j.gds.compat.BoltQuerySubscriber;
import org.neo4j.gds.compat.BoltTransactionRunner;
import org.neo4j.graphdb.QueryStatistics;
import org.neo4j.internal.kernel.api.connectioninfo.ClientConnectionInfo;
import org.neo4j.internal.kernel.api.security.LoginContext;
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.impl.query.QueryExecutionConfiguration;
import org.neo4j.kernel.impl.query.QueryExecutionKernelException;
import org.neo4j.values.virtual.MapValue;

import java.time.Duration;
import java.util.List;
import java.util.Map;

public class BoltTransactionRunnerImpl extends BoltTransactionRunner<StatementQuerySubscriber, String> {

@Override
protected BoltQuerySubscriber<StatementQuerySubscriber> boltQuerySubscriber() {
var subscriber = new StatementQuerySubscriber();
return new BoltQuerySubscriber<>() {
@Override
public void assertSucceeded() throws KernelException {
subscriber.assertSuccess();
}

@Override
public QueryStatistics queryStatistics() {
return subscriber.getStatistics();
}

@Override
public StatementQuerySubscriber innerSubscriber() {
return subscriber;
}
};
}

@Override
protected void executeQuery(
BoltTransaction boltTransaction,
String query,
MapValue parameters,
StatementQuerySubscriber querySubscriber
) throws QueryExecutionKernelException {
boltTransaction.executeQuery(query, parameters, true, querySubscriber);
}

@Override
protected BoltTransaction beginBoltWriteTransaction(
BoltGraphDatabaseServiceSPI fabricDb,
LoginContext loginContext,
KernelTransaction.Type kernelTransactionType,
ClientConnectionInfo clientConnectionInfo,
List<String> bookmarks,
Duration txTimeout,
Map<String, Object> txMetadata
) {
return fabricDb.beginTransaction(
kernelTransactionType,
loginContext,
clientConnectionInfo,
bookmarks,
txTimeout,
AccessMode.WRITE,
txMetadata,
new RoutingContext(true, Map.of()),
QueryExecutionConfiguration.DEFAULT_CONFIG
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.gds.compat._515;

import org.neo4j.annotations.service.ServiceProvider;
import org.neo4j.gds.compat.Neo4jProxyApi;
import org.neo4j.gds.compat.Neo4jProxyFactory;
import org.neo4j.gds.compat.Neo4jVersion;

@ServiceProvider
public final class Neo4jProxyFactoryImpl implements Neo4jProxyFactory {

@Override
public boolean canLoad(Neo4jVersion version) {
return version == Neo4jVersion.V_5_15;
}

@Override
public Neo4jProxyApi load() {
return new Neo4jProxyImpl();
}

@Override
public String description() {
return "Neo4j 5.15";
}
}
Loading

0 comments on commit 93d58fe

Please sign in to comment.