kstaken 2003/02/05 20:55:12
Modified: java/scratchpad/src/org/apache/xindice/core/filer
BerkeleyBTreeFiler.java
Log:
Minor experiments.
Revision Changes Path
1.3 +11 -2
xml-xindice/java/scratchpad/src/org/apache/xindice/core/filer/BerkeleyBTreeFiler.java
Index: BerkeleyBTreeFiler.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/core/filer/BerkeleyBTreeFiler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BerkeleyBTreeFiler.java 15 Dec 2002 19:40:44 -0000 1.2
+++ BerkeleyBTreeFiler.java 6 Feb 2003 04:55:11 -0000 1.3
@@ -114,7 +114,8 @@
// Ideally we wouldn't need to do this, but since this interface
// requires the ability to get accurate record counts we have to add
// it. It creates a point of contention due to synchronization on
- // the updates to the record count.
+ // the updates to the record count. For hash filers setting this
+ // causes an error.
database.set_flags(Db.DB_RECNUM);
}
catch (Exception e) {
@@ -166,6 +167,10 @@
// We want to use a BTree for storage. The file mode should probably
// be configurable.
database.open(null, fileName, null, Db.DB_BTREE, Db.DB_CREATE,
0644);
+
+ // Uncomment the following line to make this a hash filer.
+ //database.open(null, fileName, null, Db.DB_HASH, Db.DB_CREATE,
0644);
+
opened = true;
return opened;
}
@@ -288,6 +293,10 @@
public long getRecordCount() throws DBException {
checkOpened();
try {
+ // Uncomment the following lines to make this into a hash filer.
+ // DbHashStat stats = (DbHashStat) database.stat(0);
+ // return stats.hash_nkeys;
+
DbBtreeStat stats = (DbBtreeStat) database.stat(Db.DB_FAST_STAT);
return stats.bt_nkeys;
}