db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From be...@apache.org
Subject svn commit: r345215 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/Clock.java
Date Thu, 17 Nov 2005 09:57:24 GMT
Author: bernt
Date: Thu Nov 17 01:57:15 2005
New Revision: 345215

URL: http://svn.apache.org/viewcvs?rev=345215&view=rev
Log:
DERBY-704 Large page cache kills initial performance, additional comments from Knut.Hatlen@Sun.COM

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/Clock.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/Clock.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/Clock.java?rev=345215&r1=345214&r2=345215&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/Clock.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/cache/Clock.java Thu Nov
17 01:57:15 2005
@@ -862,7 +862,25 @@
 
 			synchronized (this) {
 
+				// 1) find out how many invalid items there are in the
+				//    cache
+				// 2) search for a free invalid item
+				// 3) stop searching when there are no more invalid
+				//    items to find
+
 				int invalidItems = holders.size() - validItemCount;
+
+				// Invalid items might occur in the cache when
+				//   a) a new item is created in growCache(), but it
+				//      is not in use yet, or
+				//   b) an item is deleted (usually when a table is
+				//      dropped)
+
+				// It is critical to break out of the loop as soon as
+				// possible since we are blocking others trying to
+				// access the page cache. New items are added to the
+				// end of the page cache, so the search for invalid
+				// items should start from the end.
 
 				for (int i = holders.size() - 1; (invalidItems > 0) && (i >= 0) ; i--)
{
 					CachedItem item = (CachedItem) holders.get(i);



Mime
View raw message