List:Commits« Previous MessageNext Message »
From:Kevin Lewis Date:February 3 2009 4:44pm
Subject:Re: bzr commit into mysql-6.0-falcon-team branch
(christopher.powers:2992) Bug#42424
View as plain text  
Chris,

This change is not fully correct.  The original record returned from 
fetchNext() has a useCount on it, but fetchVersion does not transfer 
that useCount to the prior version that it returns.  So in a concurrent 
environment, this code will leave some records with un-released useCounts.


=== modified file 'storage/falcon/Table.cpp'
--- a/storage/falcon/Table.cpp	2009-02-01 08:18:51 +0000
+++ b/storage/falcon/Table.cpp	2009-02-01 09:00:52 +0000
@@ -3581,14 +3581,22 @@ void Table::optimize(Connection *connect
	for (Record *record; (record = fetchNext(recordNumber));)
		{
		recordNumber = record->recordNumber + 1;
  		record = record->fetchVersion(transaction);
  		
  		if (record)
+			{
+			record->release(); // no need to keep it around
  			++count;
+			}
  		}

I think it should use a candidate like this.

-	for (Record *record; (record = fetchNext(recordNumber));)
+	for (Record *candidate; (candidate = fetchNext(recordNumber));)
		{
-		recordNumber = record->recordNumber + 1;
+		recordNumber = candidate->recordNumber + 1;
- 		Record *record = candidate->fetchVersion(transaction);
+ 		record = record->fetchVersion(transaction);
  		
  		if (record)
  			++count;

+		candidate->release(); // no need to keep it around
  		}



Christopher Powers wrote:
> #At file:///home/cpowers/work/dev/dev-04/mysql/
> 
>  2992 Christopher Powers	2009-02-01
>       Bug #42424, "Serious performance degradation after new scavenger"
>       
>       Increased scavenger wait increment from 10 to 20ms.
>       Use progressive scavenger wait timeout for record allocation methods.
> modified:
>   storage/falcon/Database.cpp
>   storage/falcon/Database.h
>   storage/falcon/Record.cpp
>   storage/falcon/Table.cpp
> 
> per-file messages:
>   storage/falcon/Database.cpp
>     Database::updateCardinalities()
>     - Added log message
>   storage/falcon/Database.h
>     Increased SCAVENGE_WAIT_MS from 10ms to 20ms
>   storage/falcon/Record.cpp
>     Record::allocRecordData()
>     - Progressively increase scavenger wait timeout
>   storage/falcon/Table.cpp
>     Table::allocRecordVersion() and ::allocRecord()
>     - Progressively increase scavenger wait timeout
> === modified file 'storage/falcon/Database.cpp'
> --- a/storage/falcon/Database.cpp	2009-02-01 08:18:51 +0000
> +++ b/storage/falcon/Database.cpp	2009-02-01 09:00:52 +0000
> @@ -2474,6 +2474,7 @@ void Database::updateCardinalities(void)
>  	Sync syncTbl(&syncTables, "Database::updateCardinalities(2)");
>  	syncTbl.lock(Shared);
>  	
> +	Log::log("Update cardinalities begin...\n");
>  	bool hit = false;
>  	
>  	try
> @@ -2522,6 +2523,8 @@ 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 08:18:51 +0000
> +++ b/storage/falcon/Database.h	2009-02-01 09:00:52 +0000
> @@ -40,7 +40,7 @@
>  #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   10       // Milliseconds per iteration to wait for the
> Scavenger
> +#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;
> 
> === modified file 'storage/falcon/Record.cpp'
> --- a/storage/falcon/Record.cpp	2009-02-01 08:18:51 +0000
> +++ b/storage/falcon/Record.cpp	2009-02-01 09:00:52 +0000
> @@ -955,10 +955,11 @@ char* Record::allocRecordData(int length
>  			
>  			format->table->database->signalScavenger(true);
>  
> -			// Give the scavenger thread a chance to release some memory
> +			// Give the scavenger thread a chance to release memory.
> +			// Increase the wait time per iteration.
>  
>  			Thread *thread = Thread::getThread("Database::ticker");
> -			thread->sleep(10);
> +			thread->sleep(n * SCAVENGE_WAIT_MS);
>  			}
>  	
>  	return NULL;
> 
> === modified file 'storage/falcon/Table.cpp'
> --- a/storage/falcon/Table.cpp	2009-02-01 08:18:51 +0000
> +++ b/storage/falcon/Table.cpp	2009-02-01 09:00:52 +0000
> @@ -3581,14 +3581,22 @@ void Table::optimize(Connection *connect
>  		record = record->fetchVersion(transaction);
>  		
>  		if (record)
> +			{
> +			record->release(); // no need to keep it around
>  			++count;
> +			}
>  		}
>  	
>  	cardinality = count;
>  	
> +	// Disable index optimization until a more
> +	// efficient method is implemented using
> +	// the IndexWalker (Bug#36442)
> +#if 0
>  	FOR_INDEXES(index, this);
>  		index->optimize(count, connection);
>  	END_FOR;
> +#endif	
>  
>  	database->commitSystemTransaction();
>  }
> @@ -3681,10 +3689,11 @@ Record* Table::allocRecord(int recordNum
>  
>  			database->signalScavenger(true);
>  
> -			// Give the scavenger thread a chance to release some memory
> +			// Give the scavenger thread a chance to release memory.
> +			// Increase the wait time per iteration.
>  
>  			Thread *thread = Thread::getThread("Database::ticker");
> -			thread->sleep(10);
> +			thread->sleep(n * SCAVENGE_WAIT_MS);
>  			}
>  		}
>  
> 
> 
Thread
bzr commit into mysql-6.0-falcon-team branch (christopher.powers:2992)Bug#42424Christopher Powers1 Feb
  • Re: bzr commit into mysql-6.0-falcon-team branch(christopher.powers:2992) Bug#42424Kevin Lewis3 Feb