Skip to content

Commit 2a1f020

Browse files
committed
fixup! WIP Refactoring and cleanup of BTree storage classes
1 parent d66f8b0 commit 2a1f020

File tree

4 files changed

+15
-69
lines changed

4 files changed

+15
-69
lines changed

exist-core/src/main/java/org/exist/storage/NativeValueIndex.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,7 @@ public NativeValueIndex(final DBBroker broker, final byte id, final Path dataDir
184184
//use inheritance
185185
final Path file = dataDir.resolve(getFileName());
186186
LOG.debug("Creating '{}'...", FileUtils.fileName(file));
187-
nativeFile = new BFile(broker.getBrokerPool(), id, FILE_FORMAT_VERSION_ID, false, file,
188-
broker.getBrokerPool().getCacheManager(), cacheGrowth,
189-
cacheValueThresHold);
187+
nativeFile = BFile.open(broker.getBrokerPool(), id, FILE_FORMAT_VERSION_ID, file, false, cacheGrowth, cacheValueThresHold);
190188
config.setProperty(getConfigKeyForFile(), nativeFile);
191189
}
192190
dbValues = nativeFile;

exist-core/src/main/java/org/exist/storage/btree/AbstractBTree.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public String getLockName() {
189189
return null;
190190
}
191191

192-
protected void setSplitFactor(final double factor) {
192+
public void setSplitFactor(final double factor) {
193193
if (factor > 1.0) {
194194
throw new IllegalArgumentException("splitFactor should be <= 1 > 0");
195195
}

exist-core/src/main/java/org/exist/storage/index/BTreeStore.java

Lines changed: 0 additions & 61 deletions
This file was deleted.

exist-core/src/main/java/org/exist/storage/structural/NativeStructuralIndex.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
/*
2+
* Copyright (C) 2014 Evolved Binary Ltd
3+
*
4+
* Changes made by Evolved Binary are proprietary and are not Open Source.
5+
*
6+
* NOTE: Parts of this file contain code from The eXist-db Authors.
7+
* The original license header is included below.
8+
*
9+
* ----------------------------------------------------------------------------
10+
*
211
* eXist-db Open Source Native XML Database
312
* Copyright (C) 2001 The eXist-db Authors
413
*
@@ -35,8 +44,8 @@
3544
import org.exist.indexing.RawBackupSupport;
3645
import org.exist.storage.BrokerPool;
3746
import org.exist.storage.DBBroker;
47+
import org.exist.storage.btree.BTree;
3848
import org.exist.storage.btree.DBException;
39-
import org.exist.storage.index.BTreeStore;
4049
import org.exist.storage.lock.LockManager;
4150
import org.exist.storage.lock.ManagedLock;
4251
import org.exist.util.DatabaseConfigurationException;
@@ -55,7 +64,7 @@ public class NativeStructuralIndex extends AbstractIndex implements RawBackupSup
5564
public static final byte STRUCTURAL_INDEX_ID = 1;
5665

5766
/** The datastore for this node index */
58-
protected BTreeStore btree;
67+
protected BTree btree;
5968

6069
protected LockManager lockManager;
6170
protected SymbolTable symbols;
@@ -76,8 +85,8 @@ public void open() throws DatabaseConfigurationException {
7685
final Path file = getDataDir().resolve(FILE_NAME);
7786
LOG.debug("Creating '{}'...", FileUtils.fileName(file));
7887
try {
79-
btree = new BTreeStore(pool, STRUCTURAL_INDEX_ID, FILE_FORMAT_VERSION_ID, false,
80-
file, pool.getCacheManager());
88+
this.btree = BTree.open(pool, STRUCTURAL_INDEX_ID, FILE_FORMAT_VERSION_ID, file, false);
89+
this.btree.setSplitFactor(0.7);
8190
} catch (final DBException e) {
8291
LOG.error("Failed to initialize structural index: {}", e.getMessage(), e);
8392
throw new DatabaseConfigurationException(e.getMessage(), e);

0 commit comments

Comments
 (0)