List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:November 27 2007 6:08pm
Subject:bk commit into 6.0 tree (jas:1.2691)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of . When  does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-27 13:08:29-05:00, jas@rowvwade. +3 -0
  Rework blob garbage collection to use bitmap of blob ids
  to replace n-squared operation on lists of record versions.
  
  The is a fix for Falcon bug 32062.

  storage/falcon/Record.cpp@stripped, 2007-11-27 13:08:19-05:00, jas@rowvwade. +35 -30
    Split out Record::getRawValue (returns blob ids) from
    Record::getValue (returns blob objects) to give blob
    garbage collection quick, cheap access to blob ids.

  storage/falcon/Record.h@stripped, 2007-11-27 13:08:20-05:00, jas@rowvwade. +1 -0
    Split out Record::getRawValue (returns blob ids) from
    Record::getValue (returns blob objects) to give blob
    garbage collection quick, cheap access to blob ids.

  storage/falcon/Table.cpp@stripped, 2007-11-27 13:08:20-05:00, jas@rowvwade. +33 -0
    Rework blob garbage collection to use bitmap of blob ids
    to replace n-squared operation on lists of record versions.

diff -Nrup a/storage/falcon/Record.cpp b/storage/falcon/Record.cpp
--- a/storage/falcon/Record.cpp	2007-09-25 01:14:41 -04:00
+++ b/storage/falcon/Record.cpp	2007-11-27 13:08:19 -05:00
@@ -288,6 +288,33 @@ Record* Record::fetchVersion(Transaction
 
 void Record::getValue(int fieldId, Value * value)
 {
+	getRawValue(fieldId, value);
+
+	switch (value->getType())
+		{
+		case Asciiblob:
+			{
+			AsciiBlob *blob = format->table->getAsciiBlob(value->getBlobId());
+			value->setValue (blob);
+			blob->release();
+			}
+			break;
+
+		case Binaryblob:
+			{
+			BinaryBlob *blob = format->table->getBinaryBlob(value->getBlobId());
+			value->setValue (blob);
+			blob->release();
+			}
+			break;
+
+		default:
+			break;
+		}
+}
+
+void Record::getRawValue(int fieldId, Value * value)
+{
 	//ASSERT (table);
 	ASSERT (format);
 	value->clear();
@@ -313,30 +340,6 @@ void Record::getValue(int fieldId, Value
 		case shortVector:
 		case longVector:
 			getEncodedValue(fieldId, value);
-
-			switch (value->getType())
-				{
-				case Asciiblob:
-					{
-					AsciiBlob *blob = format->table->getAsciiBlob(value->getBlobId());
-					value->setValue (blob);
-					blob->release();
-					}
-					break;
-
-				case Binaryblob:
-					{
-					BinaryBlob *blob = format->table->getBinaryBlob(value->getBlobId());
-					value->setValue (blob);
-					blob->release();
-					}
-					break;
-
-
-				default:
-					break;
-				}
-
 			return;
 
 		case valueVector:
@@ -439,17 +442,19 @@ void Record::getValue(int fieldId, Value
 
 		case Asciiblob:
 			{
-			AsciiBlob *blob = format->table->getAsciiBlob (*(int32*) ptr);
-			value->setValue (blob);
-			blob->release();
+			//AsciiBlob *blob = format->table->getAsciiBlob (*(int32*) ptr);
+			//value->setValue (blob);
+			//blob->release();
+			value->setAsciiBlob(*(int32*) ptr);
 			}
 			break;
 
 		case Binaryblob:
 			{
-			BinaryBlob *blob = format->table->getBinaryBlob (*(int32*) ptr);
-			value->setValue (blob);
-			blob->release();
+			//BinaryBlob *blob = format->table->getBinaryBlob (*(int32*) ptr);
+			//value->setValue (blob);
+			//blob->release();
+			value->setBinaryBlob(*(int32*) ptr);
 			}
 			break;
 
diff -Nrup a/storage/falcon/Record.h b/storage/falcon/Record.h
--- a/storage/falcon/Record.h	2007-09-25 01:14:41 -04:00
+++ b/storage/falcon/Record.h	2007-11-27 13:08:20 -05:00
@@ -84,6 +84,7 @@ public:
 	const UCHAR*	getEncoding (int index);
 	int				setEncodedRecord(Stream *stream, bool interlocked);
 	void			getValue (int fieldId, Value* value);
+	void			getRawValue (int fieldId, Value* value);
 	int				getFormatVersion();
 	void			setValue (Transaction *transaction, int id, Value *value, bool cloneFlag, bool copyFlag);
 	void			poke ();
diff -Nrup a/storage/falcon/Table.cpp b/storage/falcon/Table.cpp
--- a/storage/falcon/Table.cpp	2007-11-15 19:46:52 -05:00
+++ b/storage/falcon/Table.cpp	2007-11-27 13:08:20 -05:00
@@ -1949,6 +1949,7 @@ void Table::garbageCollect(Record * leav
 
 	FOR_FIELDS(field, this)
 		if (field->type == Asciiblob || field->type == Binaryblob)
+			/***
 			for (Record *next, *record = leaving; record && record != staying; record = next)
 				{
 				next = record->getPriorVersion();
@@ -1964,6 +1965,38 @@ void Table::garbageCollect(Record * leav
 						expungeBlob(&value);
 					}
 				}
+			***/
+			{
+			Bitmap blobs;
+			Record *record;
+			Value value;
+			
+			for (record = leaving; record && record != staying; record = record->getPriorVersion())
+				if (record->hasRecord())
+					{
+					record->getRawValue(field->id, &value);
+					
+					if ((value.getType() == Asciiblob || value.getType() == Binaryblob))
+						blobs.set(value.getBlobId());
+					}
+					
+			for (record = staying; record; record = record->getPriorVersion())
+				if (record->hasRecord())
+					{
+					record->getRawValue(field->id, &value);
+					
+					if ((value.getType() == Asciiblob || value.getType() == Binaryblob))
+						blobs.clear(value.getBlobId());
+					}
+			
+			for (int blobId = 0; (blobId = blobs.nextSet(blobId)) >= 0; ++blobId)
+				{		
+				BinaryBlob *blob = getBinaryBlob(blobId);
+				value.setValue (blob);
+				blob->release();
+				expungeBlob(&value);
+				}	
+			}
 	END_FOR
 }
 
Thread
bk commit into 6.0 tree (jas:1.2691)U-ROWVWADEjas27 Nov