Skip to content

Commit 5a25018

Browse files
committed
GH-5279: support up to 6 triple indexes in LmdbStore
1 parent f18d750 commit 5a25018

2 files changed

Lines changed: 48 additions & 1 deletion

File tree

core/sail/lmdb/src/main/java/org/eclipse/rdf4j/sail/lmdb/TripleStore.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ public int compareRegion(ByteBuffer array1, int startIdx1, ByteBuffer array2, in
201201
env = pp.get(0);
202202
}
203203

204-
E(mdb_env_set_maxdbs(env, 12));
204+
// 1 for contexts, 12 for triple indexes (2 per index)
205+
E(mdb_env_set_maxdbs(env, 13));
205206
E(mdb_env_set_maxreaders(env, 256));
206207

207208
// Open environment
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Eclipse RDF4J contributors.
3+
*
4+
* All rights reserved. This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Distribution License v1.0
6+
* which accompanies this distribution, and is available at
7+
* http://www.eclipse.org/org/documents/edl-v10.php.
8+
*
9+
* SPDX-License-Identifier: BSD-3-Clause
10+
*******************************************************************************/
11+
package org.eclipse.rdf4j.sail.lmdb;
12+
13+
import static org.junit.Assert.*;
14+
15+
import java.io.File;
16+
17+
import org.eclipse.rdf4j.sail.lmdb.config.LmdbStoreConfig;
18+
import org.junit.jupiter.api.BeforeEach;
19+
import org.junit.jupiter.api.Test;
20+
import org.junit.jupiter.api.io.TempDir;
21+
22+
/**
23+
* Test ensuring {@link TripleStore} can handle up to 6 indexes.
24+
*/
25+
public class TripleStoreManyIndexesTest {
26+
private File dataDir;
27+
28+
@BeforeEach
29+
public void before(@TempDir File dataDir) throws Exception {
30+
this.dataDir = dataDir;
31+
}
32+
33+
@Test
34+
public void testSixIndexes() throws Exception {
35+
TripleStore tripleStore = new TripleStore(dataDir,
36+
new LmdbStoreConfig("spoc,posc,ospc,cspo,cpos,cosp"));
37+
tripleStore.startTransaction();
38+
tripleStore.storeTriple(1, 2, 3, 1, true);
39+
tripleStore.commit();
40+
41+
try (TxnManager.Txn txn = tripleStore.getTxnManager().createReadTxn()) {
42+
var it = tripleStore.getTriples(txn, 1, 2, 3, 1, true);
43+
assertNotNull("Store should have a stored statement", it.next());
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)