Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) Correcting wrong % values on IndexTransfer_p page See: http://www.yacy-forum.de/viewtopic.php?p=12646

theli9b35ae902718
diff --git a/htroot/IndexTransfer_p.html b/htroot/IndexTransfer_p.html
index e85917716..a8fd10a6e 100644
--- a/htroot/IndexTransfer_p.html
+++ b/htroot/IndexTransfer_p.html
@@ -17,7 +17,7 @@
<tr class="TableHeader" valign="bottom">
<td>&nbsp;</td>
<td class="small" >Status</td>
-<td class="small" >Chunk Size</td>
+<td class="small" >Chunk Size<br>(Word Entries)</td>
<td class="small" >Words Range</td>
<td class="small" >Transfered Words</td>
<td class="small" >Delete<br>Index</td>
@@ -55,7 +55,9 @@
<td class="small" ><font color="#(stopped)#green::red#(/stopped)#">#[selection.status]#</font></td>
<td class="small" align="rigth">#[selection.twchunk]# words</td>
<td class="small" align="right"><tt>#[selection.twrange]#</tt></td>
- <td class="small" rowspan="2" align="right">#[twcount]# (#[twpercent]#%)<br>#[twspeed]# words/s</td>
+ <td class="small" rowspan="2" align="left">#[twEntityCount]# Entities (#[twEntityPercent]#%)<br>
+ #[twEntryCount]# Entries<br>
+ #[twEntitySpeed]# entities/s</td>
<td class="small" rowspan="2">#(deleteIndex)#false::true#(/deleteIndex)#</td>
<td class="small" rowspan="2">#[peerName]#</td>
<td class="small" rowspan="2">#(stopped)#<input type="submit" name="stopIndexTransfer" value="Stop Index Transfer">::
diff --git a/htroot/IndexTransfer_p.java b/htroot/IndexTransfer_p.java
index 0a939f1a5..0eefed90a 100644
--- a/htroot/IndexTransfer_p.java
+++ b/htroot/IndexTransfer_p.java
@@ -74,7 +74,7 @@ public final class IndexTransfer_p {
if (seed == null) {
prop.put("running_status","Disconnected peer");
} else {
- boolean deleteIndex = ((String)post.get("deleteIndex", "0")).equals("1");
+ boolean deleteIndex = post.get("deleteIndex", "0").equals("1");
switchboard.indexDistribution.startTransferWholeIndex(seed,deleteIndex);
prop.put("LOCATION","");
return prop;
@@ -99,7 +99,6 @@ public final class IndexTransfer_p {
prop.put("ucount", Integer.toString(ucount = switchboard.urlPool.loadedURL.size()));
prop.put("running",(transfThread==null)?0:1);
if (transfThread != null) {
- int transferedIdxCount = transfThread.getTransferedIndexCount();
String[] status = transfThread.getStatus();
String[] range = transfThread.getRange();
int[] chunk = transfThread.getChunkSize();
@@ -113,9 +112,10 @@ public final class IndexTransfer_p {
prop.put("running_transfer.twchunk", Integer.toString(chunk[1]));
- prop.put("running_twcount",transferedIdxCount);
- prop.put("running_twpercent",Float.toString(transfThread.getTransferedIndexPercent()));
- prop.put("running_twspeed",Integer.toString(transfThread.getTransferedIndexSpeed()));
+ prop.put("running_twEntityCount",transfThread.getTransferedEntityCount());
+ prop.put("running_twEntryCount",transfThread.getTransferedEntryCount());
+ prop.put("running_twEntityPercent",Float.toString(transfThread.getTransferedEntityPercent()));
+ prop.put("running_twEntitySpeed",Integer.toString(transfThread.getTransferedEntitySpeed()));
prop.put("running_deleteIndex", transfThread.deleteIndex()?1:0);
prop.put("running_peerName",transfThread.getSeed().getName());
diff --git a/source/de/anomic/plasma/plasmaWordIndexDistribution.java b/source/de/anomic/plasma/plasmaWordIndexDistribution.java
index e98647245..77d005579 100644
--- a/source/de/anomic/plasma/plasmaWordIndexDistribution.java
+++ b/source/de/anomic/plasma/plasmaWordIndexDistribution.java
@@ -652,10 +652,11 @@ public final class plasmaWordIndexDistribution {
private boolean gzipBody = false;
private int timeout = 60000;
private int maxOpenFiles = 800;
- private int transferedIndexCount = 0;
+ private int transferedEntryCount = 0;
+ private int transferedEntityCount = 0;
private String status = "Running";
private String oldStartingPointHash = "------------", startPointHash = "------------";
- private int wordsDBSize = 0;
+ private int initialWordsDBSize = 0;
private int chunkSize = 500;
private final long startingTime = System.currentTimeMillis();
private final plasmaSwitchboard sb;
@@ -667,7 +668,7 @@ public final class plasmaWordIndexDistribution {
this.seed = seed;
this.delete = delete;
this.sb = plasmaSwitchboard.getSwitchboard();
- this.wordsDBSize = sb.wordIndex.size();
+ this.initialWordsDBSize = sb.wordIndex.size();
this.gzipBody = "true".equalsIgnoreCase(sb.getConfig("indexTransfer.gzipBody","false"));
this.timeout = (int) sb.getConfigLong("indexTransfer.timeout",60000);
this.maxOpenFiles = (int) sb.getConfigLong("indexTransfer.maxOpenFiles",800);
@@ -698,17 +699,24 @@ public final class plasmaWordIndexDistribution {
return new int[]{this.chunkSize,500};
}
- public int getTransferedIndexCount() {
- return this.transferedIndexCount;
+ public int getTransferedEntryCount() {
+ return this.transferedEntryCount;
}
- public float getTransferedIndexPercent() {
- if (wordsDBSize == 0) return 100;
- else return (float)(this.transferedIndexCount*100/wordsDBSize);
+ public int getTransferedEntityCount() {
+ return this.transferedEntityCount;
}
- public int getTransferedIndexSpeed() {
- return (int) ((1000 * transferedIndexCount) / (System.currentTimeMillis()-startingTime));
+ public float getTransferedEntityPercent() {
+ long currentWordsDBSize = sb.wordIndex.size();
+ if (initialWordsDBSize == 0) return 100;
+ else if (currentWordsDBSize >= initialWordsDBSize) return 0;
+ //else return (float) ((initialWordsDBSize-currentWordsDBSize)/(initialWordsDBSize/100));
+ else return (float)(this.transferedEntityCount*100/initialWordsDBSize);
+ }
+
+ public int getTransferedEntitySpeed() {
+ return (int) ((1000 * transferedEntryCount) / (System.currentTimeMillis()-startingTime));
}
public yacySeed getSeed() {
@@ -839,7 +847,8 @@ public final class plasmaWordIndexDistribution {
try {
if (deleteTransferIndexes(oldIndexEntities)) {
plasmaWordIndexDistribution.this.log.logFine("Deleted all " + oldIndexEntities.length + " transferred whole-word indexes locally");
- transferedIndexCount += idxCount;
+ transferedEntryCount += idxCount;
+ transferedEntityCount += oldIndexEntities.length;
} else {
plasmaWordIndexDistribution.this.log.logSevere("Deleted not all transferred whole-word indexes");
}
@@ -848,7 +857,8 @@ public final class plasmaWordIndexDistribution {
}
} else {
this.closeEntities(oldIndexEntities);
- transferedIndexCount += idxCount;
+ transferedEntryCount += idxCount;
+ transferedEntityCount += oldIndexEntities.length;
}
oldIndexEntities = null;
}