List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:February 3 2009 2:54am
Subject:bzr commit into mysql-6.0-falcon-team branch (christopher.powers:2995)
Bug#42505
View as plain text  
#At file:///home/cpowers/work/dev/dev-04/mysql/

 2995 Christopher Powers	2009-02-02
      Bug #42505 "Falcon: Record backlogging not enabled by the Scavenger"
      
      Limit updateCardinalities() to once every 20 scavenge cycles. This
      function is too expensive to call every scavenge cycle. 
      
      Made Changes per Kevin's comments in the bug report, with one
      exception: Database::scavengeRecords() still determines low
      memory with retiredActiveMemory > recordScavengeFloor. Using 
      spaceRemaining > recordScavengeFloor does not enable backlogging
      when needed (confirmed against falcon_bug_36294-big.test). 
modified:
  storage/falcon/Database.cpp
  storage/falcon/Database.h
  storage/falcon/RecordScavenge.cpp
  storage/falcon/RecordVersion.cpp

per-file messages:
  storage/falcon/Database.cpp
    Restrict updateCardinalities() to once every 20 scavenge cycles
  storage/falcon/Database.h
    Added CARDINALITY_FREQUENCY
  storage/falcon/RecordScavenge.cpp
    RecordScavenge::print()
    - Modified recordsRemaining and spaceRemaining calculations
  storage/falcon/RecordVersion.cpp
    RecordVersion::scavenge()
    - Removed inefficient space remaining computation
    - getMemUsage() is too expensive for each unscavenged record
=== modified file 'storage/falcon/Database.cpp'
--- a/storage/falcon/Database.cpp	2009-02-01 09:00:52 +0000
+++ b/storage/falcon/Database.cpp	2009-02-03 02:53:42 +0000
@@ -472,6 +472,7 @@ Database::Database(const char *dbName, C
 	scavengerThreadSleeping = 0;
 	scavengerThreadSignaled = 0;
 	scavengeForced = 0;
+	scavengeCount = 0;
 	serialLog = NULL;
 	pageWriter = NULL;
 	zombieTables = NULL;
@@ -1735,8 +1736,11 @@ void Database::scavenge(bool forced)
 {
 	// Signal the cardinality task unless a forced scavenge is pending
 
-	if (!forced)
+	if (!forced &&
+		++scavengeCount % CARDINALITY_FREQUENCY == 0)
+		{
 		signalCardinality();
+		}
 	
 	scavengeForced = 0;
 
@@ -2474,7 +2478,7 @@ void Database::updateCardinalities(void)
 	Sync syncTbl(&syncTables, "Database::updateCardinalities(2)");
 	syncTbl.lock(Shared);
 	
-	Log::log("Update cardinalities begin...\n");
+	Log::log("Update cardinalities\n");
 	bool hit = false;
 	
 	try
@@ -2523,8 +2527,6 @@ void Database::updateCardinalities(void)
 		// Situations where this might happen can be due to problems with
 		// writing to the serial log
 		}
-	
-	Log::log("Update cardinalities complete.\n");
 }
 
 void Database::sync()

=== modified file 'storage/falcon/Database.h'
--- a/storage/falcon/Database.h	2009-02-01 09:00:52 +0000
+++ b/storage/falcon/Database.h	2009-02-03 02:53:42 +0000
@@ -40,8 +40,6 @@
 #define VERSION_CURRENT					COMBINED_VERSION(ODS_VERSION, ODS_MINOR_VERSION)					
 #define VERSION_SERIAL_LOG				COMBINED_VERSION(ODS_VERSION2, ODS_MINOR_VERSION1)
 
-#define SCAVENGE_WAIT_MS    20       // Milliseconds per iteration to wait for the Scavenger
-
 static const int FALC0N_TRACE_TRANSACTIONS	= 1;
 static const int FALC0N_SYNC_TEST			= 2;
 static const int FALC0N_SYNC_OBJECTS		= 4;
@@ -56,6 +54,15 @@ static const int FALC0N_TEST_BITMAP			= 
 
 static const int OUT_OF_RECORD_MEMORY_RETRIES = 10;
 
+// Milliseconds per iteration to wait for the Scavenger
+
+static const int SCAVENGE_WAIT_MS			  = 20;
+
+// Scavenger cycles per call to updateCardinalities()
+
+static const int CARDINALITY_FREQUENCY		  = 20;
+
+
 #define TABLE_HASH_SIZE		101
 
 class Table;
@@ -342,6 +349,7 @@ public:
 	uint64				recordPoolAllocCount;
 	uint64				lastGenerationMemory;
 	uint64				lastActiveMemoryChecked;
+	uint64				scavengeCount;
 	time_t				creationTime;
 	volatile time_t		lastScavenge;
 };

=== modified file 'storage/falcon/RecordScavenge.cpp'
--- a/storage/falcon/RecordScavenge.cpp	2009-02-01 08:18:51 +0000
+++ b/storage/falcon/RecordScavenge.cpp	2009-02-03 02:53:42 +0000
@@ -324,8 +324,8 @@ void RecordScavenge::print(void)
 
 	if (!recordsRetired)
 		{
-		recordsRemaining = totalRecords - recordsPruned;
-		spaceRemaining = totalRecordSpace - spacePruned;
+		recordsRemaining = totalRecords - recordsPruned - recordsRetired;
+		spaceRemaining = totalRecordSpace - spacePruned - spaceRetired;
 		}
 
 	Log::log(LogScavenge, "Cycle=" I64FORMAT 

=== modified file 'storage/falcon/RecordVersion.cpp'
--- a/storage/falcon/RecordVersion.cpp	2009-01-26 17:43:21 +0000
+++ b/storage/falcon/RecordVersion.cpp	2009-02-03 02:53:42 +0000
@@ -221,16 +221,6 @@ bool RecordVersion::retire(RecordScaveng
 		return true;
 		}
 
-	// Cannot retire this record.  Add up remaining space.
-
-	recordScavenge->recordsRemaining++;
-	recordScavenge->spaceRemaining += getMemUsage();
-
-	for (Record *prior = getPriorVersion(); prior; prior = prior->getPriorVersion())
-		{
-		++recordScavenge->recordsRemaining;
-		recordScavenge->spaceRemaining += prior->getMemUsage();
-		}
 	return false;
 }
 

Thread
bzr commit into mysql-6.0-falcon-team branch (christopher.powers:2995)Bug#42505Christopher Powers3 Feb