MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:February 3 2008 9:42pm
Subject:bk commit into 6.0 tree (jas:1.2801)
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, 2008-02-03 16:42:31-05:00, jas@rowvwade. +4 -0
  Fix undetected record update conflict in Table::deleteRecord.

  storage/falcon/StorageConnection.cpp@stripped, 2008-02-03 16:42:20-05:00, jas@rowvwade. +10 -0
    Add hook for database validation and repair (tied off
    in StorageInterface at the moment).

  storage/falcon/StorageConnection.h@stripped, 2008-02-03 16:42:21-05:00, jas@rowvwade. +3 -15
    Add hook for database validation and repair (tied off
    in StorageInterface at the moment).

  storage/falcon/Table.cpp@stripped, 2008-02-03 16:42:21-05:00, jas@rowvwade. +19 -7
    Fix undetected record update conflict in Table::deleteRecord.

  storage/falcon/ha_falcon.cpp@stripped, 2008-02-03 16:42:21-05:00, jas@rowvwade. +1 -1
    Turn off table check/repair.

diff -Nrup a/storage/falcon/StorageConnection.cpp b/storage/falcon/StorageConnection.cpp
--- a/storage/falcon/StorageConnection.cpp	2007-11-16 01:16:40 -05:00
+++ b/storage/falcon/StorageConnection.cpp	2008-02-03 16:42:20 -05:00
@@ -406,3 +406,13 @@ Transaction* StorageConnection::getTrans
 {
 	return connection->getTransaction();
 }
+
+void StorageConnection::validate(int options)
+{
+	int flags = 0;
+	
+	if (options & VALIDATE_REPAIR)
+		flags |= validateRepair;
+	
+	connection->validate(flags);
+}
diff -Nrup a/storage/falcon/StorageConnection.h b/storage/falcon/StorageConnection.h
--- a/storage/falcon/StorageConnection.h	2007-10-11 08:12:05 -04:00
+++ b/storage/falcon/StorageConnection.h	2008-02-03 16:42:21 -05:00
@@ -18,6 +18,8 @@
 
 #include "JString.h"
 
+static const int VALIDATE_REPAIR	= 1;
+
 class StorageConnection;
 class StorageTable;
 class StorageDatabase;
@@ -25,21 +27,6 @@ class Database;
 class THD;
 class Table;
 class Stream;
-
-//typedef void (Logger) (int, const char*, void *arg);
-
-/***
-extern "C"
-{
-StorageConnection* getStorageConnection(const char *path, THD *mySqlThread, OpenOption create);
-void	initializeNfsEngine();
-void	shutdownNfsEngine(const char *path);
-void	shutdownNfsAll();
-void	addNfsLogger(int mask, Logger listener, void *arg);
-int		isTempTable(const char *path);
-};
-***/
-
 class Connection;
 class THD;
 class StorageTableShare;
@@ -81,6 +68,7 @@ public:
 	virtual void	validate(void);
 	virtual const char* getLastErrorString(void);
 	virtual int		getMaxKeyLength(void);
+	virtual void	 validate(int options);
 	
 	void			setErrorText(const char* text);
 	int				setErrorText(SQLException *exception);
diff -Nrup a/storage/falcon/Table.cpp b/storage/falcon/Table.cpp
--- a/storage/falcon/Table.cpp	2008-02-03 14:58:50 -05:00
+++ b/storage/falcon/Table.cpp	2008-02-03 16:42:21 -05:00
@@ -1317,21 +1317,24 @@ ForeignKey* Table::findForeignKey(Foreig
 	return NULL;
 }
 
-void Table::deleteRecord(Transaction * transaction, Record * oldRecord)
+void Table::deleteRecord(Transaction * transaction, Record * orgRecord)
 {
 	database->preUpdate();
 	Sync scavenge(&syncScavenge, "Table::deleteRecord");
-	Record *candidate = fetch(oldRecord->recordNumber);
-	checkAncestor(candidate, oldRecord);
+	Record *candidate = fetch(orgRecord->recordNumber);
+	checkAncestor(candidate, orgRecord);
 	RecordVersion *record;
 	bool wasLock = false;
 	
+	if (!candidate)
+		return;
+	
 	if (candidate->state == recLock && candidate->getTransaction() == transaction)
 		{
 		if (candidate->getSavePointId() == transaction->curSavePointId)
 			{
 			record = (RecordVersion*) candidate;
-			ASSERT(record->priorVersion == oldRecord);
+			ASSERT(record->priorVersion == orgRecord);
 			wasLock = true;
 			}
 		else
@@ -1339,12 +1342,21 @@ void Table::deleteRecord(Transaction * t
 		}
 	else
 		{
+		Record *oldVersion = candidate->fetchVersion(transaction);
+		
+		if (oldVersion != candidate)
+			{
+			candidate->release();
+			throw SQLError(UPDATE_CONFLICT, "delete conflict in table %s.%s", schemaName, name);
+			}
+		
+		ASSERT(candidate->hasRecord());
 		record = allocRecordVersion(NULL, transaction, candidate);
 		candidate->release();
 		}
 
 	record->state = recDeleted;
-	fireTriggers(transaction, PreDelete, oldRecord, NULL);
+	fireTriggers(transaction, PreDelete, orgRecord, NULL);
 
 	// Do any necessary cascading
 
@@ -1353,7 +1365,7 @@ void Table::deleteRecord(Transaction * t
 		key->bind(database);
 
 		if (key->primaryTable == this && key->deleteRule == importedKeyCascade)
-			key->cascadeDelete(transaction, oldRecord);
+			key->cascadeDelete(transaction, orgRecord);
 		}
 
 	// Checkin with any attachments
@@ -1384,7 +1396,7 @@ void Table::deleteRecord(Transaction * t
 		}
 		
 	record->release();
-	fireTriggers(transaction, PostDelete, oldRecord, NULL);
+	fireTriggers(transaction, PostDelete, orgRecord, NULL);
 }
 
 int Table::getFieldId(const char * name)
diff -Nrup a/storage/falcon/ha_falcon.cpp b/storage/falcon/ha_falcon.cpp
--- a/storage/falcon/ha_falcon.cpp	2008-02-03 14:58:50 -05:00
+++ b/storage/falcon/ha_falcon.cpp	2008-02-03 16:42:21 -05:00
@@ -44,7 +44,7 @@
 #include "BigInt.h"
 
 //#define NO_OPTIMIZE
-#define VALIDATE
+//#define VALIDATE
 
 #ifndef MIN
 #define MIN(a,b)			((a <= b) ? (a) : (b))
Thread
bk commit into 6.0 tree (jas:1.2801)U-ROWVWADEjas3 Feb