MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Vladislav Vaintroub Date:February 2 2009 1:00pm
Subject:bzr commit into mysql-6.0-falcon-team branch (vvaintroub:2991)
Bug#42542
View as plain text  
#At file:///G:/bzr/mysql-6.0-falcon-team/ based on revid:vvaintroub@stripped

 2991 Vladislav Vaintroub	2009-02-02
      Bug #42542 falcon_bug_28095 crashes in StorageHandler::dropTempTables 
      
      The reason for the crash is accessing Dbb::sections , which is NULL pointer in this case (temp tablespace is not opened during recovery)
      
      Solution:
      Make Dbb::sections an array instead of pointer, that  is initialized only when tablespace is created or opened. Initialize this array with NULLs in Dbb constructor.
      
      No test case provided,  it seems quite tricky to create one, we should get a serial log that does not try to open temp tablespace during recovery.
      (checkpoint or switching log files twice would do the trick).
modified:
  storage/falcon/Dbb.cpp
  storage/falcon/Dbb.h

=== modified file 'storage/falcon/Dbb.cpp'
--- a/storage/falcon/Dbb.cpp	2009-01-27 20:44:30 +0000
+++ b/storage/falcon/Dbb.cpp	2009-02-02 13:00:38 +0000
@@ -56,7 +56,7 @@
 //#define STOP_RECORD	123
 //#define TRACE_PAGE	109
 
-static const int SECTION_HASH_SIZE	= 997;
+
 
 extern uint falcon_large_blob_threshold;
 
@@ -74,7 +74,6 @@ Dbb::Dbb(Database *dbase)
 {
 	database = dbase;
 	cache = NULL;
-	sections = NULL;
 	sequenceSection = NULL;
 	nextIndex = 0;
 	nextSection = 0;
@@ -91,6 +90,7 @@ Dbb::Dbb(Database *dbase)
 	noLog = false;
 	syncClone.setName("Dbb::syncClone");
 	syncSequences.setName("Dbb::syncSequences");
+	memset (sections, 0, sizeof (sections));
 }
 
 
@@ -101,7 +101,6 @@ Dbb::Dbb(Dbb *dbb, int tblSpaceId)
 	cache = dbb->cache;
 	pageSize = dbb->pageSize;
 	serialLog = dbb->serialLog;
-	sections = NULL;
 	sequenceSection = NULL;
 	nextIndex = 0;
 	nextSection = 0;
@@ -113,6 +112,7 @@ Dbb::Dbb(Dbb *dbb, int tblSpaceId)
 	highPage = 0;
 	defaultIndexVersion = dbb->defaultIndexVersion;
 	noLog = false;
+	memset (sections, 0, sizeof (sections));
 }
 
 Dbb::~Dbb()
@@ -131,16 +131,14 @@ Dbb::~Dbb()
 
 	Section *section;
 
-	if (sections)
-		for (int n = 0; n < SECTION_HASH_SIZE; ++n)
-			while ((section = sections [n]))
-				{
-				sections [n] = section->hash;
-				delete section;
-				}
+	for (int n = 0; n < SECTION_HASH_SIZE; ++n)
+		while ((section = sections [n]))
+			{
+			sections [n] = section->hash;
+			delete section;
+			}
+
 
-	if (sections)
-		delete [] sections;
 
 	if (inversion)
 		delete inversion;
@@ -199,8 +197,7 @@ void Dbb::init()
 	linesPerPage = (short) ((pageSize - OFFSET (RecordLocatorPage*, elements)) / sizeof (struct RecordIndex));
 	sequencesPerPage = (short) ((pageSize - OFFSET (SequencePage*, sequences)) / sizeof (int64));
 	sequencesPerSection = (int) (pagesPerSection * sequencesPerPage);
-	sections = new Section* [SECTION_HASH_SIZE];
-	memset (sections, 0, sizeof (Section*) * SECTION_HASH_SIZE);
+
 	utf8 = false;
 }
 

=== modified file 'storage/falcon/Dbb.h'
--- a/storage/falcon/Dbb.h	2009-01-27 20:44:30 +0000
+++ b/storage/falcon/Dbb.h	2009-02-02 13:00:38 +0000
@@ -36,6 +36,7 @@
 
 #define PAGE_SIZE		4096
 #define CACHE_SIZE		1024
+#define SECTION_HASH_SIZE	997
 
 // Selective debugging
 
@@ -201,7 +202,7 @@ public:
 	int			sequencesPerSection;
 	bool		utf8;
 	bool		noLog;
-	Section		**sections;
+	Section		*sections[SECTION_HASH_SIZE];
 	int			debug;
 	int			sequence;
 	int			odsVersion;

Thread
bzr commit into mysql-6.0-falcon-team branch (vvaintroub:2991)Bug#42542Vladislav Vaintroub2 Feb