Author: toad Date: 2008-10-18 22:01:26 +0000 (Sat, 18 Oct 2008) New Revision: 23001
Modified: branches/db4o/freenet/src/freenet/node/NodeRestartJobsQueue.java Log: Store dbJobs to depth of 1 hop only. Workaround for http://tracker.db4o.com/browse/COR-1436 : collections get stored to a depth of 3 This was causing lots of blocks to be added before we had a chance to store them, which took ages (see PersistentBlobTempBucketFactory.store). Modified: branches/db4o/freenet/src/freenet/node/NodeRestartJobsQueue.java =================================================================== --- branches/db4o/freenet/src/freenet/node/NodeRestartJobsQueue.java 2008-10-18 17:53:16 UTC (rev 23000) +++ branches/db4o/freenet/src/freenet/node/NodeRestartJobsQueue.java 2008-10-18 22:01:26 UTC (rev 23001) @@ -53,7 +53,15 @@ public void queueRestartJob(DBJob job, int priority, ObjectContainer container) { container.activate(dbJobs[priority], 1); dbJobs[priority].add(job); - container.store(dbJobs[priority]); + /* + * Store to 1 hop only. + * Otherwise db4o will update ALL the jobs on the queue to a depth of 3, + * which in practice means all the buckets inside the BucketChainBucket's + * linked by the BucketChainBucketKillTag's (adding new ones). This will + * take ages and is in any case not what we want. + * See http://tracker.db4o.com/browse/COR-1436 + */ + container.ext().store(dbJobs[priority], 1); container.deactivate(dbJobs[priority], 1); } @@ -66,7 +74,15 @@ for(int i=0;i<dbJobs.length;i++) { container.activate(dbJobs[priority], 1); if(dbJobs[priority].remove(job)) { - container.store(dbJobs[priority]); + /* + * Store to 1 hop only. + * Otherwise db4o will update ALL the jobs on the queue to a depth of 3, + * which in practice means all the buckets inside the BucketChainBucket's + * linked by the BucketChainBucketKillTag's (adding new ones). This will + * take ages and is in any case not what we want. + * See http://tracker.db4o.com/browse/COR-1436 + */ + container.ext().store(dbJobs[priority], 1); found++; } container.deactivate(dbJobs[priority], 1); @@ -76,7 +92,15 @@ else Logger.error(this, "Job "+job+" not found when removing it"); } else { - container.store(dbJobs[priority]); + /* + * Store to 1 hop only. + * Otherwise db4o will update ALL the jobs on the queue to a depth of 3, + * which in practice means all the buckets inside the BucketChainBucket's + * linked by the BucketChainBucketKillTag's (adding new ones). This will + * take ages and is in any case not what we want. + * See http://tracker.db4o.com/browse/COR-1436 + */ + container.ext().store(dbJobs[priority], 1); container.deactivate(dbJobs[priority], 1); } if(!jobWasActive) container.deactivate(job, 1);
