- bugfixing for flextable bug

- bugfixing for collection index bug
- several other bugfixes

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2785 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 74f09a0510
commit 688cbfb776

@ -64,8 +64,8 @@ Nightly builds from compiles out of SVN can be obtained from <a href="http://lat
</ul> </ul>
<li>Windows-flavour release of YaCy (same code as generic release, but with convenient Windows-Installer):</li> <li>Windows-flavour release of YaCy (same code as generic release, but with convenient Windows-Installer):</li>
<ul> <ul>
<li><tt>from yacy.net&nbsp;&nbsp;&nbsp;: <a href="http://www.yacy.net/yacy/release/yacy_v0.47_20060927_2665.exe"><tt>yacy_v0.47_20060927_2665.exe</tt></a></tt></li> <li><tt>from yacy.net&nbsp;&nbsp;&nbsp;: <a href="http://www.yacy.net/yacy/release/yacy_v0.48_20061010_2743.exe"><tt>yacy_v0.48_20061010_2743.exe</tt></a></tt></li>
<li><tt>from BerliOS.de&nbsp;: <a href="http://download.berlios.de/yacy/yacy_v0.47_20060927_2665.exe"><tt>yacy_v0.47_20060927_2665.exe</tt></a></tt></li> <li><tt>from BerliOS.de&nbsp;: <a href="http://download.berlios.de/yacy/yacy_v0.48_20061010_2743.exe"><tt>yacy_v0.48_20061010_2743.exe</tt></a></tt></li>
</ul> </ul>
</ul> </ul>
</p> </p>

@ -128,8 +128,8 @@
URL entries related to this word hash <span class="tt">#[keyHash]#</span><br /><br /> URL entries related to this word hash <span class="tt">#[keyHash]#</span><br /><br />
<form action="IndexControl_p.html" method="post" enctype="multipart/form-data"> <form action="IndexControl_p.html" method="post" enctype="multipart/form-data">
#{urlList}# #(urlExists)# #{urlList}# #(urlExists)#
<input type="checkbox" name="#[urlhxCount]#" checked value="#[urlhxValue]#" align="top" /><span class="tt">#[urlhxValue]#&nbsp;&lt;unresolved URL Hash&gt;</span><br /> <input type="checkbox" name="urlhx.#[urlhxCount]#" checked value="#[urlhxValue]#" align="top" /><span class="tt">#[urlhxValue]#&nbsp;&lt;unresolved URL Hash&gt;</span><br />
::<input type="checkbox" name="#[urlhxCount]#" #(urlhxChecked)#::checked #(/urlhxChecked)#value="#[urlhxValue]#" align="top" /> ::<input type="checkbox" name="urlhx.#[urlhxCount]#" #(urlhxChecked)#::checked #(/urlhxChecked)#value="#[urlhxValue]#" align="top" />
<a href="/IndexControl_p.html?keystring=#[keyString]#&amp;keyhash=#[keyHash]#&amp;urlhash=#[urlhxValue]#&amp;urlstringsearch=&amp;urlstring=#[urlString]#" class="tt">#[urlhxValue]#</a><span class="tt">&nbsp;#[urlString]#, pos=#[pos]#</span><br /> <a href="/IndexControl_p.html?keystring=#[keyString]#&amp;keyhash=#[keyHash]#&amp;urlhash=#[urlhxValue]#&amp;urlstringsearch=&amp;urlstring=#[urlString]#" class="tt">#[urlhxValue]#</a><span class="tt">&nbsp;#[urlString]#, pos=#[pos]#</span><br />
#(/urlExists)# #{/urlList}# #(/urlExists)# #{/urlList}#
<input type="hidden" name="keystring" value="#[keyString]#" /> <input type="hidden" name="keystring" value="#[keyString]#" />

@ -91,7 +91,6 @@ import java.lang.ref.SoftReference;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.Buffer;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.Date; import java.util.Date;

@ -53,6 +53,8 @@ public class kelondroBytesIntMap {
} }
public synchronized int removei(byte[] key) throws IOException { public synchronized int removei(byte[] key) throws IOException {
// returns the integer index of the key, if the key can be found and was removed
// and -1 if the key was not found.
if (ki.size() == 0) return -1; if (ki.size() == 0) return -1;
kelondroRow.Entry indexentry = ki.remove(key); kelondroRow.Entry indexentry = ki.remove(key);
if (indexentry == null) return -1; if (indexentry == null) return -1;

@ -105,7 +105,7 @@ public class kelondroCollectionIndex {
// open array files // open array files
this.arrays = new HashMap(); // all entries will be dynamically created with getArray() this.arrays = new HashMap(); // all entries will be dynamically created with getArray()
if (((fileIndexGeneration) || (ramIndexGeneration))) { if (((fileIndexGeneration) || (ramIndexGeneration))) {
serverLog.logFine("STARTUP", "STARTED MIGRATION OF OLD COLLECION INDEX TO NEW COLLECTION INDEX. THIS WILL TAKE SOME TIME"); serverLog.logFine("STARTUP", "STARTED INITIALIZATION OF NEW COLLECTION INDEX. THIS WILL TAKE SOME TIME");
openAllArrayFiles(((fileIndexGeneration) || (ramIndexGeneration)), indexOrder); openAllArrayFiles(((fileIndexGeneration) || (ramIndexGeneration)), indexOrder);
} }
@ -265,38 +265,39 @@ public class kelondroCollectionIndex {
synchronized (index) { synchronized (index) {
// first find an old entry, if one exists // first find an old entry, if one exists
kelondroRow.Entry oldindexrow = index.get(key); kelondroRow.Entry indexrow = index.get(key);
if (oldindexrow == null) { if (indexrow == null) {
if ((collection != null) && (collection.size() > 0)) { if ((collection != null) && (collection.size() > 0)) {
// the collection is new // the collection is new
overwrite(key, collection, arrayIndex(collection.size())); overwrite(key, collection, arrayIndex(collection.size()), index.row().newEntry());
} }
return 0; return 0;
} }
// overwrite the old collection // overwrite the old collection
// read old information // read old information
int oldchunksize = (int) oldindexrow.getColLong(idx_col_chunksize); // needed only for migration int oldchunksize = (int) indexrow.getColLong(idx_col_chunksize); // needed only for migration
int oldchunkcount = (int) oldindexrow.getColLong(idx_col_chunkcount); int oldchunkcount = (int) indexrow.getColLong(idx_col_chunkcount);
int oldrownumber = (int) oldindexrow.getColLong(idx_col_indexpos); int oldrownumber = (int) indexrow.getColLong(idx_col_indexpos);
int oldPartitionNumber = (int) oldindexrow.getColByte(idx_col_clusteridx); int oldPartitionNumber = (int) indexrow.getColByte(idx_col_clusteridx);
assert (oldPartitionNumber >= arrayIndex(oldchunkcount)); assert (oldPartitionNumber >= arrayIndex(oldchunkcount));
int oldSerialNumber = 0; int oldSerialNumber = 0;
if (merge) { if (merge) {
// load the old collection and join it // load the old collection and join it
kelondroRowSet oldcollection = getwithparams(oldindexrow, oldchunksize, oldchunkcount, oldPartitionNumber, oldrownumber, oldSerialNumber, false, false); kelondroRowSet oldcollection = getwithparams(indexrow, oldchunksize, oldchunkcount, oldPartitionNumber, oldrownumber, oldSerialNumber, false, false);
// join with new collection // join with new collection
oldcollection.addAll(collection); oldcollection.addAll(collection);
oldcollection.shape();
collection = oldcollection; collection = oldcollection;
} }
int removed = 0; int removed = 0;
if (removekeys != null) { if (removekeys != null) {
// load the old collection and remove keys // load the old collection and remove keys
kelondroRowSet oldcollection = getwithparams(oldindexrow, oldchunksize, oldchunkcount, oldPartitionNumber, oldrownumber, oldSerialNumber, false, false); kelondroRowSet oldcollection = getwithparams(indexrow, oldchunksize, oldchunkcount, oldPartitionNumber, oldrownumber, oldSerialNumber, false, false);
// remove the keys from the set // remove the keys from the set
Iterator i = removekeys.iterator(); Iterator i = removekeys.iterator();
@ -314,6 +315,12 @@ public class kelondroCollectionIndex {
if (deletecomplete) { if (deletecomplete) {
kelondroFixedWidthArray array = getArray(oldPartitionNumber, oldSerialNumber, oldchunksize); kelondroFixedWidthArray array = getArray(oldPartitionNumber, oldSerialNumber, oldchunksize);
array.remove(oldrownumber); array.remove(oldrownumber);
index.remove(key);
} else {
// update the index entry
indexrow.setCol(idx_col_chunkcount, 0);
indexrow.setCol(idx_col_lastwrote, kelondroRowCollection.daysSince2000(System.currentTimeMillis()));
index.put(indexrow);
} }
return removed; return removed;
} }
@ -337,11 +344,11 @@ public class kelondroCollectionIndex {
array.set(oldrownumber, arrayEntry); array.set(oldrownumber, arrayEntry);
// update the index entry // update the index entry
oldindexrow.setCol(idx_col_chunkcount, collection.size()); indexrow.setCol(idx_col_chunkcount, collection.size());
oldindexrow.setCol(idx_col_clusteridx, (byte) oldPartitionNumber); indexrow.setCol(idx_col_clusteridx, (byte) oldPartitionNumber);
oldindexrow.setCol(idx_col_flags, (byte) 0); indexrow.setCol(idx_col_flags, (byte) 0);
oldindexrow.setCol(idx_col_lastwrote, kelondroRowCollection.daysSince2000(System.currentTimeMillis())); indexrow.setCol(idx_col_lastwrote, kelondroRowCollection.daysSince2000(System.currentTimeMillis()));
index.put(oldindexrow); index.put(indexrow);
} else { } else {
// we need a new slot, that means we must first delete the old entry // we need a new slot, that means we must first delete the old entry
// find array file // find array file
@ -351,13 +358,13 @@ public class kelondroCollectionIndex {
array.remove(oldrownumber); array.remove(oldrownumber);
// write a new entry in the other array // write a new entry in the other array
overwrite(key, collection, newPartitionNumber); overwrite(key, collection, newPartitionNumber, indexrow);
} }
return removed; return removed;
} }
} }
private void overwrite(byte[] key, kelondroRowCollection collection, int targetpartition) throws IOException { private void overwrite(byte[] key, kelondroRowCollection collection, int targetpartition, kelondroRow.Entry indexEntry) throws IOException {
// helper method, should not be called directly and only within a synchronized(index) environment // helper method, should not be called directly and only within a synchronized(index) environment
// simply store a collection without check if the collection existed before // simply store a collection without check if the collection existed before
@ -373,7 +380,6 @@ public class kelondroCollectionIndex {
int newRowNumber = array.add(arrayEntry); int newRowNumber = array.add(arrayEntry);
// store the new row number in the index // store the new row number in the index
kelondroRow.Entry indexEntry = index.row().newEntry();
indexEntry.setCol(idx_col_key, key); indexEntry.setCol(idx_col_key, key);
indexEntry.setCol(idx_col_chunksize, this.playloadrow.objectsize()); indexEntry.setCol(idx_col_chunksize, this.playloadrow.objectsize());
indexEntry.setCol(idx_col_chunkcount, collection.size()); indexEntry.setCol(idx_col_chunkcount, collection.size());

@ -80,8 +80,9 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
} }
private kelondroIndex initializeRamIndex(kelondroOrder objectOrder) throws IOException { private kelondroIndex initializeRamIndex(kelondroOrder objectOrder) throws IOException {
kelondroRowBufferedSet ri = new kelondroRowBufferedSet(new kelondroRow(new kelondroColumn[]{super.row().column(0), new kelondroColumn("int c-4 {b256}")}), 0); kelondroRowBufferedSet ri = new kelondroRowBufferedSet(new kelondroRow(new kelondroColumn[]{super.row().column(0), new kelondroColumn("int c-4 {b256}")}), objectOrder, 0, 0);
ri.setOrdering(objectOrder, 0); //kelondroRowSet ri = new kelondroRowSet(new kelondroRow(new kelondroColumn[]{super.row().column(0), new kelondroColumn("int c-4 {b256}")}), 0);
//ri.setOrdering(objectOrder, 0);
Iterator content = super.col[0].contentNodes(-1); Iterator content = super.col[0].contentNodes(-1);
kelondroRecords.Node node; kelondroRecords.Node node;
kelondroRow.Entry indexentry; kelondroRow.Entry indexentry;
@ -89,10 +90,10 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
while (content.hasNext()) { while (content.hasNext()) {
node = (kelondroRecords.Node) content.next(); node = (kelondroRecords.Node) content.next();
i = node.handle().hashCode(); i = node.handle().hashCode();
indexentry = ri.rowdef.newEntry(); indexentry = ri.row().newEntry();
indexentry.setCol(0, node.getValueRow()); indexentry.setCol(0, node.getValueRow());
indexentry.setCol(1, i); indexentry.setCol(1, i);
ri.add(indexentry); ri.put(indexentry);
if ((i % 10000) == 0) { if ((i % 10000) == 0) {
System.out.print('.'); System.out.print('.');
System.out.flush(); System.out.flush();
@ -100,7 +101,7 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
} }
System.out.print(" -ordering- "); System.out.print(" -ordering- ");
System.out.flush(); System.out.flush();
ri.shape(); ri.trim();
return ri; return ri;
} }

@ -29,10 +29,7 @@ package de.anomic.kelondro;
public class kelondroIntBytesMap extends kelondroRowBufferedSet { public class kelondroIntBytesMap extends kelondroRowBufferedSet {
public kelondroIntBytesMap(int payloadSize, int initSize) { public kelondroIntBytesMap(int payloadSize, int initSize) {
super(new kelondroRow("Cardinal key-4 {b256}, byte[] payload-" + payloadSize), initSize); super(new kelondroRow("Cardinal key-4 {b256}, byte[] payload-" + payloadSize), kelondroNaturalOrder.naturalOrder, 0, initSize);
// initialize ordering
super.setOrdering(kelondroNaturalOrder.naturalOrder, 0);
} }
public byte[] getb(int ii) { public byte[] getb(int ii) {
@ -42,7 +39,7 @@ public class kelondroIntBytesMap extends kelondroRowBufferedSet {
} }
public byte[] putb(int ii, byte[] value) { public byte[] putb(int ii, byte[] value) {
kelondroRow.Entry newentry = rowdef.newEntry(); kelondroRow.Entry newentry = super.row().newEntry();
newentry.setCol(0, (long) ii); newentry.setCol(0, (long) ii);
newentry.setCol(1, value); newentry.setCol(1, value);
kelondroRow.Entry oldentry = super.put(newentry); kelondroRow.Entry oldentry = super.put(newentry);
@ -50,19 +47,11 @@ public class kelondroIntBytesMap extends kelondroRowBufferedSet {
return oldentry.getColBytes(1); return oldentry.getColBytes(1);
} }
public void addb(int ii, byte[] value) {
kelondroRow.Entry newentry = rowdef.newEntry();
newentry.setCol(0, (long) ii);
newentry.setCol(1, value);
add(newentry);
}
public byte[] removeb(int ii) { public byte[] removeb(int ii) {
if (size() == 0) { if (size() == 0) {
if (System.currentTimeMillis() - this.lastTimeWrote > 10000) this.trim();
return null; return null;
} }
kelondroRow.Entry indexentry = super.removeMarked(kelondroNaturalOrder.encodeLong((long) ii, 4)); kelondroRow.Entry indexentry = super.remove(kelondroNaturalOrder.encodeLong((long) ii, 4));
if (indexentry == null) return null; if (indexentry == null) return null;
return indexentry.getColBytes(1); return indexentry.getColBytes(1);
} }

@ -416,7 +416,6 @@ public class kelondroRecords {
} else { } else {
this.cacheSize = (int) (buffersize / cacheNodeChunkSize()); this.cacheSize = (int) (buffersize / cacheNodeChunkSize());
this.cacheHeaders = new kelondroIntBytesMap(this.headchunksize, 0); this.cacheHeaders = new kelondroIntBytesMap(this.headchunksize, 0);
this.cacheHeaders.setOrdering(kelondroNaturalOrder.naturalOrder, 0);
} }
this.readHit = 0; this.readHit = 0;
this.readMiss = 0; this.readMiss = 0;
@ -434,10 +433,10 @@ public class kelondroRecords {
Node n; Node n;
while ((System.currentTimeMillis() < stop) && (cacheHeaders.size() < cacheSize) && (i.hasNext())) { while ((System.currentTimeMillis() < stop) && (cacheHeaders.size() < cacheSize) && (i.hasNext())) {
n = (Node) i.next(); n = (Node) i.next();
cacheHeaders.addb(n.handle.index, n.headChunk); cacheHeaders.putb(n.handle.index, n.headChunk);
count++; count++;
} }
cacheHeaders.shape(); cacheHeaders.trim();
logFine("preloaded " + count + " records into cache"); logFine("preloaded " + count + " records into cache");
} catch (kelondroException e) { } catch (kelondroException e) {
// the contentNodes iterator had a time-out; we don't do a preload // the contentNodes iterator had a time-out; we don't do a preload

@ -24,6 +24,7 @@
package de.anomic.kelondro; package de.anomic.kelondro;
import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
@ -31,24 +32,20 @@ import java.util.TreeMap;
import de.anomic.server.serverMemory; import de.anomic.server.serverMemory;
public class kelondroRowBufferedSet extends kelondroRowSet { public class kelondroRowBufferedSet implements kelondroIndex {
private static final long memBlockLimit = 2000000; // do not fill cache further if the amount of available memory is less that this private static final long memBlockLimit = 2000000; // do not fill cache further if the amount of available memory is less that this
private static final int bufferFlushLimit = 10000; private static final int bufferFlushLimit = 10000;
private static final int bufferFlushMinimum = 1000; private static final int bufferFlushMinimum = 1000;
private final boolean useRowCollection = true;
private kelondroProfile profile; private kelondroProfile profile;
private TreeMap buffer; private TreeMap buffer;
private kelondroRowSet store;
public kelondroRowBufferedSet(kelondroRow rowdef) { public kelondroRowBufferedSet(kelondroRow rowdef, kelondroOrder objectOrder, int orderColumn, int objectCount) {
super(rowdef); store = new kelondroRowSet(rowdef, objectCount);
buffer = new TreeMap(kelondroNaturalOrder.naturalOrder); assert (objectOrder != null);
profile = new kelondroProfile(); store.setOrdering(objectOrder, orderColumn);
} buffer = new TreeMap(objectOrder);
public kelondroRowBufferedSet(kelondroRow rowdef, int objectCount) {
super(rowdef, objectCount);
buffer = new TreeMap(kelondroNaturalOrder.naturalOrder);
profile = new kelondroProfile(); profile = new kelondroProfile();
} }
@ -58,145 +55,126 @@ public class kelondroRowBufferedSet extends kelondroRowSet {
Map.Entry entry; Map.Entry entry;
while (i.hasNext()) { while (i.hasNext()) {
entry = (Map.Entry) i.next(); entry = (Map.Entry) i.next();
super.add((kelondroRow.Entry) entry.getValue()); store.add((kelondroRow.Entry) entry.getValue());
} }
buffer.clear(); buffer.clear();
} }
public final void trim() { public synchronized final void trim() {
synchronized (buffer) {
flush(); flush();
super.trim(); store.trim();
}
} }
public void removeOne() { public synchronized void removeOne() {
synchronized (buffer) {
if (buffer.size() == 0) { if (buffer.size() == 0) {
super.removeOne(); store.removeOne();
} else try { } else try {
//buffer.remove(buffer.keySet().iterator().next()); // buffer.remove(buffer.keySet().iterator().next());
buffer.remove(buffer.lastKey()); buffer.remove(buffer.lastKey());
} catch (NoSuchElementException e) {} } catch (NoSuchElementException e) {}
} }
}
public void clear() { public synchronized void clear() {
synchronized (buffer) { store.clear();
super.clear();
buffer.clear(); buffer.clear();
} }
}
public int size() { public synchronized int size() {
synchronized (buffer) { return buffer.size() + store.size();
return buffer.size() + super.size();
}
} }
public Iterator rows() { public synchronized Iterator rows() {
synchronized (buffer) {
flush(); flush();
} return store.rows();
return super.rows();
} }
public void uniq() { public synchronized void uniq() {
synchronized (buffer) {
flush(); flush();
super.uniq(); store.uniq();
}
} }
public String toString() { public synchronized String toString() {
synchronized (buffer) {
flush(); flush();
return super.toString(); return store.toString();
}
} }
public kelondroRow.Entry get(byte[] key) { public synchronized kelondroRow.Entry get(byte[] key) {
long handle = profile.startRead(); long handle = profile.startRead();
kelondroRow.Entry entry = null; kelondroRow.Entry entry = null;
synchronized (buffer) {
entry = (kelondroRow.Entry) buffer.get(key); entry = (kelondroRow.Entry) buffer.get(key);
if ((entry == null) && (useRowCollection)) entry = super.get(key); if (entry == null) entry = store.get(key);
}
profile.stopRead(handle); profile.stopRead(handle);
return entry; return entry;
} }
public kelondroRow.Entry put(kelondroRow.Entry newentry) { public synchronized kelondroRow.Entry put(kelondroRow.Entry row, Date entryDate) {
return put(row);
}
public synchronized kelondroRow.Entry put(kelondroRow.Entry newentry) {
long handle = profile.startWrite(); long handle = profile.startWrite();
byte[] key = newentry.getColBytes(super.sortColumn); byte[] key = newentry.getColBytes(store.sortColumn);
kelondroRow.Entry oldentry = null; kelondroRow.Entry oldentry = null;
synchronized (buffer) {
if (useRowCollection) {
oldentry = (kelondroRow.Entry) buffer.get(key); oldentry = (kelondroRow.Entry) buffer.get(key);
if (oldentry == null) { if (oldentry == null) {
// try the collection // try the collection
oldentry = super.get(key); oldentry = store.get(key);
if (oldentry == null) { if (oldentry == null) {
// this was not anywhere // this was not anywhere
buffer.put(key, newentry); buffer.put(key, newentry);
if (((buffer.size() > bufferFlushMinimum) && (serverMemory.available() > memBlockLimit)) || if (((buffer.size() > bufferFlushMinimum) && (serverMemory.available() > memBlockLimit))
(buffer.size() > bufferFlushLimit)) flush(); || (buffer.size() > bufferFlushLimit))
flush();
} else { } else {
// replace old entry // replace old entry
super.put(newentry); store.put(newentry);
} }
} else { } else {
// the entry is already in buffer // the entry is already in buffer
// simply replace old entry // simply replace old entry
buffer.put(key, newentry); buffer.put(key, newentry);
} }
} else {
oldentry = (kelondroRow.Entry) buffer.put(key, newentry);
}
}
profile.stopWrite(handle); profile.stopWrite(handle);
return oldentry; return oldentry;
} }
public kelondroRow.Entry removeShift(byte[] key) { public synchronized kelondroRow.Entry remove(byte[] key) {
long handle = profile.startDelete(); long handle = profile.startDelete();
kelondroRow.Entry oldentry = null; kelondroRow.Entry oldentry = null;
synchronized (buffer) {
oldentry = (kelondroRow.Entry) buffer.remove(key); oldentry = (kelondroRow.Entry) buffer.remove(key);
if ((oldentry == null) && (useRowCollection)) { if (oldentry == null) {
// try the collection // try the collection
oldentry = super.removeShift(key); return store.remove(key);
}
} }
profile.stopDelete(handle); profile.stopDelete(handle);
return oldentry; return oldentry;
} }
public kelondroRow.Entry removeMarked(byte[] key) { public synchronized void removeMarkedAll(kelondroRowCollection c) {
long handle = profile.startDelete(); long handle = profile.startDelete();
kelondroRow.Entry oldentry = null; flush();
synchronized (buffer) { store.removeMarkedAll(c);
oldentry = (kelondroRow.Entry) buffer.remove(key);
if ((oldentry == null) && (useRowCollection)) {
// try the collection
return super.removeMarked(key);
}
}
profile.stopDelete(handle); profile.stopDelete(handle);
return oldentry;
} }
public void removeMarkedAll(kelondroRowCollection c) { public kelondroProfile profile() {
long handle = profile.startDelete(); return store.profile();
synchronized (buffer) { }
public synchronized void close() {
flush(); flush();
super.removeMarkedAll(c); store.close();
} }
profile.stopDelete(handle);
public kelondroOrder order() {
return store.order();
} }
public kelondroProfile profile() { public kelondroRow row() {
return profile; return store.row();
} }
public Iterator rows(boolean up, boolean rotating, byte[] firstKey) {
return store.rows(up, rotating, firstKey);
}
} }

@ -45,10 +45,6 @@ public class kelondroRowCollection {
private static final int exp_order_bound = 5; private static final int exp_order_bound = 5;
private static final int exp_collection = 6; private static final int exp_collection = 6;
public kelondroRowCollection(kelondroRow rowdef) {
this(rowdef, 0);
}
public kelondroRowCollection(kelondroRowCollection rc) { public kelondroRowCollection(kelondroRowCollection rc) {
this.rowdef = rc.rowdef; this.rowdef = rc.rowdef;
this.chunkcache = rc.chunkcache; this.chunkcache = rc.chunkcache;

@ -45,7 +45,7 @@ public class kelondroRowSet extends kelondroRowCollection implements kelondroInd
} }
public kelondroRowSet(kelondroRow rowdef) { public kelondroRowSet(kelondroRow rowdef) {
super(rowdef); super(rowdef, 0);
this.removeMarker = new TreeSet(); this.removeMarker = new TreeSet();
this.profile = new kelondroProfile(); this.profile = new kelondroProfile();
} }
@ -106,10 +106,6 @@ public class kelondroRowSet extends kelondroRowCollection implements kelondroInd
} }
public kelondroRow.Entry remove(byte[] a) { public kelondroRow.Entry remove(byte[] a) {
return removeMarked(a);
}
public kelondroRow.Entry removeMarked(byte[] a) {
return removeMarked(a, 0, a.length); return removeMarked(a, 0, a.length);
} }
@ -180,30 +176,6 @@ public class kelondroRowSet extends kelondroRowCollection implements kelondroInd
removeMarker.clear(); removeMarker.clear();
} }
protected kelondroRow.Entry removeShift(byte[] a) {
return removeShift(a, 0, a.length);
}
private kelondroRow.Entry removeShift(byte[] a, int astart, int alength) {
// the byte[] a may be shorter than the chunksize
if (chunkcount == 0) return null;
long handle = profile.startDelete();
kelondroRow.Entry entry = null;
synchronized(chunkcache) {
int p = find(a, astart, alength);
if (p < 0) return null;
entry = get(p);
if (p < sortBound) {
removeShift(p);
} else {
super.swap(p, --chunkcount, 0);
}
}
profile.stopDelete(handle);
return entry;
}
public void removeMarkedAll(kelondroRowCollection c) { public void removeMarkedAll(kelondroRowCollection c) {
long handle = profile.startDelete(); long handle = profile.startDelete();
Iterator i = c.rows(); Iterator i = c.rows();
@ -328,7 +300,7 @@ public class kelondroRowSet extends kelondroRowCollection implements kelondroInd
return super.rows(); return super.rows();
} }
public Iterator rows(boolean up, boolean rotating, byte[] firstKey) throws IOException { public Iterator rows(boolean up, boolean rotating, byte[] firstKey) {
return new rowIterator(up, rotating, firstKey); return new rowIterator(up, rotating, firstKey);
} }

Loading…
Cancel
Save