-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-4134 add benchmarks and tests for the LmdbStore to the ShaclSail
- Loading branch information
1 parent
1cf9678
commit 2357a40
Showing
5 changed files
with
174 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/MultithreadedLmdbStoreIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Eclipse RDF4J contributors. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*******************************************************************************/ | ||
package org.eclipse.rdf4j.sail.shacl; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
import org.assertj.core.util.Files; | ||
import org.eclipse.rdf4j.common.transaction.IsolationLevels; | ||
import org.eclipse.rdf4j.sail.NotifyingSail; | ||
import org.eclipse.rdf4j.sail.NotifyingSailConnection; | ||
import org.eclipse.rdf4j.sail.lmdb.LmdbStore; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Tag; | ||
|
||
@Tag("slow") | ||
public class MultithreadedLmdbStoreIT extends MultithreadedTest { | ||
|
||
File file; | ||
|
||
@AfterEach | ||
public void after() { | ||
try { | ||
FileUtils.deleteDirectory(file); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@BeforeEach | ||
public void before() { | ||
file = Files.newTemporaryFolder(); | ||
System.out.println("Max memory: " + Runtime.getRuntime().maxMemory() / 1024 / 1024 + " MB"); | ||
} | ||
|
||
@Override | ||
NotifyingSail getBaseSail() { | ||
NotifyingSail notifyingSail = new LmdbStore(file); | ||
try (NotifyingSailConnection connection = notifyingSail.getConnection()) { | ||
connection.begin(IsolationLevels.NONE); | ||
connection.clear(); | ||
connection.commit(); | ||
} | ||
return notifyingSail; | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/MultithreadedLmdbStoreRDFSIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Eclipse RDF4J contributors. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*******************************************************************************/ | ||
package org.eclipse.rdf4j.sail.shacl; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
import org.assertj.core.util.Files; | ||
import org.eclipse.rdf4j.common.transaction.IsolationLevels; | ||
import org.eclipse.rdf4j.sail.NotifyingSail; | ||
import org.eclipse.rdf4j.sail.NotifyingSailConnection; | ||
import org.eclipse.rdf4j.sail.inferencer.fc.SchemaCachingRDFSInferencer; | ||
import org.eclipse.rdf4j.sail.lmdb.LmdbStore; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Tag; | ||
|
||
@Tag("slow") | ||
public class MultithreadedLmdbStoreRDFSIT extends MultithreadedTest { | ||
|
||
File file; | ||
|
||
@AfterEach | ||
public void after() { | ||
try { | ||
FileUtils.deleteDirectory(file); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@BeforeEach | ||
public void before() { | ||
file = Files.newTemporaryFolder(); | ||
} | ||
|
||
@Override | ||
NotifyingSail getBaseSail() { | ||
NotifyingSail notifyingSail = new LmdbStore(file); | ||
notifyingSail = new SchemaCachingRDFSInferencer(notifyingSail); | ||
try (NotifyingSailConnection connection = notifyingSail.getConnection()) { | ||
connection.begin(IsolationLevels.NONE); | ||
connection.clear(); | ||
connection.commit(); | ||
} | ||
return notifyingSail; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters