Skip to content

Commit

Permalink
- more space in error db to store larger error messages
Browse files Browse the repository at this point in the history
- added hash to HTCACHE storage files which will make it possible to join separate caches by just copying files

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5329 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Nov 11, 2008
1 parent 674ad2d commit ef66438
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions source/de/anomic/crawler/CrawlQueues.java
Expand Up @@ -78,8 +78,8 @@ public CrawlQueues(final plasmaSwitchboard sb, final File plasmaPath) {
// this is useful because there is currently no re-use of the data in this table.
if (errorDBFile.isDirectory()) kelondroFlexWidthArray.delete(plasmaPath, "urlError2.db"); else errorDBFile.delete();
}
errorURL = new ZURL(plasmaPath, "urlError2.db", false);
delegatedURL = new ZURL(plasmaPath, "urlDelegated2.db", true);
errorURL = new ZURL(plasmaPath, "urlError3.db", false);
delegatedURL = new ZURL(plasmaPath, "urlDelegated3.db", true);
}

public String urlExists(final String hash) {
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/crawler/ZURL.java
Expand Up @@ -51,7 +51,7 @@ public class ZURL {
"String executor-" + yacySeedDB.commonHashLength + ", " + // the crawling executor
"Cardinal workdate-8 {b256}, " + // the time when the url was last time tried to load
"Cardinal workcount-4 {b256}, " + // number of load retries
"String anycause-80, " + // string describing load failure
"String anycause-132, " + // string describing load failure
"byte[] entry-" + CrawlEntry.rowdef.objectsize, // extra space
kelondroBase64Order.enhancedCoder,
0);
Expand Down
9 changes: 6 additions & 3 deletions source/de/anomic/kelondro/kelondroBLOBArray.java
Expand Up @@ -64,12 +64,15 @@ public class kelondroBLOBArray implements kelondroBLOB {
private long repositoryAgeMax;
private long repositorySizeMax;
private List<blobItem> blobs;
private String blobSalt;

public kelondroBLOBArray(
final File heapLocation,
final String blobSalt,
final int keylength,
final kelondroByteOrder ordering) throws IOException {
this.keylength = keylength;
this.blobSalt = blobSalt;
this.ordering = ordering;
this.heapLocation = heapLocation;
this.fileAgeLimit = oneMonth;
Expand All @@ -91,7 +94,7 @@ public kelondroBLOBArray(
kelondroBLOB oneBlob;
File f;
for (int i = 0; i < files.length; i++) {
if (files[i].length() == 19 && files[i].endsWith("blob")) {
if (files[i].length() >= 19 && files[i].endsWith(".blob")) {
try {
d = serverDate.parseShortSecond(files[i].substring(0, 14));
} catch (ParseException e) {continue;}
Expand Down Expand Up @@ -164,7 +167,7 @@ public blobItem(Date creation, File location, kelondroBLOB blob) {
public blobItem() throws IOException {
// make a new blob file and assign it in this item
this.creation = new Date();
this.location = new File(heapLocation, serverDate.formatShortSecond(creation) + ".blob");
this.location = new File(heapLocation, serverDate.formatShortSecond(creation) + "." + blobSalt + ".blob");
this.blob = new kelondroBLOBHeap(location, keylength, ordering);
}
}
Expand Down Expand Up @@ -316,7 +319,7 @@ public static void main(final String[] args) {
final File f = new File("/Users/admin/blobarraytest");
try {
//f.delete();
final kelondroBLOBArray heap = new kelondroBLOBArray(f, 12, kelondroNaturalOrder.naturalOrder);
final kelondroBLOBArray heap = new kelondroBLOBArray(f, "test", 12, kelondroNaturalOrder.naturalOrder);
heap.put("aaaaaaaaaaaa".getBytes(), "eins zwei drei".getBytes());
heap.put("aaaaaaaaaaab".getBytes(), "vier fuenf sechs".getBytes());
heap.put("aaaaaaaaaaac".getBytes(), "sieben acht neun".getBytes());
Expand Down
8 changes: 5 additions & 3 deletions source/de/anomic/plasma/plasmaHTCache.java
Expand Up @@ -67,6 +67,7 @@ public final class plasmaHTCache {

public static long maxCacheSize = 0l;
public static File cachePath = null;
public static String salt;
public static final serverLog log = new serverLog("HTCACHE");


Expand All @@ -80,11 +81,12 @@ public final class plasmaHTCache {
public static final char LT_GLOBAL = 'G';


public static void init(final File htCachePath, final long CacheSizeMax) {
public static void init(final File htCachePath, String peerSalt, final long CacheSizeMax) {

cachePath = htCachePath;
maxCacheSize = CacheSizeMax;

salt = peerSalt;

// reset old HTCache ?
String[] list = cachePath.list();
if (list != null) {
Expand Down Expand Up @@ -134,7 +136,7 @@ private static void openDB() {
}
responseHeaderDB = new kelondroMap(blob, 500);
try {
fileDBunbuffered = new kelondroBLOBArray(new File(cachePath, FILE_DB_NAME), 12, kelondroBase64Order.enhancedCoder);
fileDBunbuffered = new kelondroBLOBArray(new File(cachePath, FILE_DB_NAME), salt, 12, kelondroBase64Order.enhancedCoder);
fileDBunbuffered.setMaxSize(maxCacheSize);
fileDB = new kelondroBLOBBuffer(fileDBunbuffered, 2 * 1024 * 1024, true);
} catch (IOException e) {
Expand Down
6 changes: 3 additions & 3 deletions source/de/anomic/plasma/plasmaSwitchboard.java
Expand Up @@ -265,8 +265,8 @@ public plasmaSwitchboard(final File rootPath, final String initPath, final Strin
setLog(new serverLog("PLASMA"));
if (applyPro) this.log.logInfo("This is the pro-version of YaCy");

// init TrayIcon if possible
yacyTray.init(this);
// init TrayIcon if possible
yacyTray.init(this);

// remote proxy configuration
httpRemoteProxyConfig.init(this);
Expand Down Expand Up @@ -406,7 +406,7 @@ public plasmaSwitchboard(final File rootPath, final String initPath, final Strin
htCachePath = getConfigPath(plasmaSwitchboardConstants.HTCACHE_PATH, plasmaSwitchboardConstants.HTCACHE_PATH_DEFAULT);
this.log.logInfo("HTCACHE Path = " + htCachePath.getAbsolutePath());
final long maxCacheSize = 1024 * 1024 * Long.parseLong(getConfig(plasmaSwitchboardConstants.PROXY_CACHE_SIZE, "2")); // this is megabyte
plasmaHTCache.init(htCachePath, maxCacheSize);
plasmaHTCache.init(htCachePath, webIndex.seedDB.mySeed().hash, maxCacheSize);

// create the release download directory
releasePath = getConfigPath(plasmaSwitchboardConstants.RELEASE_PATH, plasmaSwitchboardConstants.RELEASE_PATH_DEFAULT);
Expand Down

0 comments on commit ef66438

Please sign in to comment.