From: Wolfgang M. M. <wol...@us...> - 2004-08-16 19:47:31
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/sync In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18472/src/org/exist/storage/sync Modified Files: Sync.java Log Message: Removed the cache sync events that had been triggered by every database file independantly. Instead, the global BrokerPool will now trigger all sync events (through the SyncDaemon background thread). It distinguishes between minor and major syncs. Major syncs write all caches to disk, minor syncs only write the main document store (dom.dbx + collections.dbx). Minor syncs occur every 2 seconds, major syncs after a configurable period of time. As BrokerPool controls all sync events, it is guaranteed that only one cache is written at the same time. This has a positive effect on indexing performance. Index: Sync.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/sync/Sync.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Sync.java 15 May 2003 12:38:01 -0000 1.1 --- Sync.java 16 Aug 2004 19:47:12 -0000 1.2 *************** *** 5,21 **** /** ! * Sync open buffers to disk. */ public class Sync implements Runnable { private BrokerPool pool; ! public Sync(BrokerPool pool) { this.pool = pool; } public void run() { ! pool.triggerSync(); } - } --- 5,32 ---- /** ! * This class is registered with the {@link org.exist.storage.sync.SyncDaemon}. ! * It will periodically trigger a cache sync to write cached pages to disk. */ public class Sync implements Runnable { + public final static int MINOR_SYNC = 0; + public final static int MAJOR_SYNC = 1; + + private long majorSyncPeriod; + private long lastMajorSync = System.currentTimeMillis(); private BrokerPool pool; ! public Sync(BrokerPool pool, long majorSyncPeriod) { this.pool = pool; + this.majorSyncPeriod = majorSyncPeriod; } public void run() { ! if(System.currentTimeMillis() - lastMajorSync > majorSyncPeriod) { ! pool.triggerSync(MAJOR_SYNC); ! lastMajorSync = System.currentTimeMillis(); ! } else { ! pool.triggerSync(MINOR_SYNC); ! } } } |