From 2d9b4653c611e26efade179a0d8a1bb9aa6ec584 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 17 Oct 2009 21:26:58 +0000 Subject: [PATCH] Replace kluge fix for ndbd sparc crash with a real fix (mysql bug 48132) --- mysql-signal-align.patch | 38 ++++++++++++++++++++++++++++++++++++++ mysql-sparc-gcc-bug.patch | 22 ---------------------- mysql.spec | 7 +++++-- 3 files changed, 43 insertions(+), 24 deletions(-) create mode 100644 mysql-signal-align.patch delete mode 100644 mysql-sparc-gcc-bug.patch diff --git a/mysql-signal-align.patch b/mysql-signal-align.patch new file mode 100644 index 0000000..75fb56e --- /dev/null +++ b/mysql-signal-align.patch @@ -0,0 +1,38 @@ +Fix a bit of silliness; the original coding not only computes the required +size of the temp variable incorrectly, but doesn't guarantee the correct +alignment. This demonstrably leads to ndbd crashing at launch on sparc64, +and is probably bad news for performance on other 64-bit machines even +if they don't give an actual SIGBUS. + +Filed upstream at http://bugs.mysql.com/bug.php?id=48132 + + +diff -Naur mysql-5.1.39.orig/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp mysql-5.1.39/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp +--- mysql-5.1.39.orig/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp 2009-09-04 12:21:18.000000000 -0400 ++++ mysql-5.1.39/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp 2009-10-17 14:24:56.000000000 -0400 +@@ -1144,8 +1144,9 @@ + KeyReqStruct *req_struct, + Uint32* outBuffer) + { +- Uint32 tmp[sizeof(SignalHeader)+25]; +- Signal * signal = (Signal*)&tmp; ++ SignalT<25> signalT; ++ Signal *signal= (Signal*)&signalT; ++ + switch(attrId){ + case AttributeHeader::FRAGMENT: + * outBuffer = fragptr.p->fragmentId; +diff -Naur mysql-5.1.39.orig/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp mysql-5.1.39/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +--- mysql-5.1.39.orig/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp 2009-09-04 12:21:19.000000000 -0400 ++++ mysql-5.1.39/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp 2009-10-17 14:26:21.000000000 -0400 +@@ -529,8 +529,8 @@ + { + off_t off = 0; + const off_t sz = request->par.open.file_size; +- Uint32 tmp[sizeof(SignalHeader)+25]; +- Signal * signal = (Signal*)(&tmp[0]); ++ SignalT<25> signalT; ++ Signal *signal= (Signal*)&signalT; + FsReadWriteReq* req = (FsReadWriteReq*)signal->getDataPtrSend(); + + Uint32 index = 0; diff --git a/mysql-sparc-gcc-bug.patch b/mysql-sparc-gcc-bug.patch deleted file mode 100644 index 4771bdc..0000000 --- a/mysql-sparc-gcc-bug.patch +++ /dev/null @@ -1,22 +0,0 @@ -This is a temporary workaround for what is surely a gcc bug on Sparc. -Submitted as bz #529299 - - -diff -Naur mysql-5.1.39.orig/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp mysql-5.1.39/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp ---- mysql-5.1.39.orig/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp 2009-09-04 12:21:16.000000000 -0400 -+++ mysql-5.1.39/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp 2009-10-15 22:19:07.000000000 -0400 -@@ -8538,11 +8538,7 @@ - default: - tmp = 0; - } -- memcpy(signal->theData, &tmp, 8); /* must be memcpy, gives strange results on -- * ithanium gcc (GCC) 3.4.1 smp linux 2.4 -- * otherwise -- */ -- // Uint32 * src = (Uint32*)&tmp; -- // signal->theData[0] = src[0]; -- // signal->theData[1] = src[1]; -+ Uint32 * src = (Uint32*)&tmp; -+ signal->theData[0] = src[0]; -+ signal->theData[1] = src[1]; - } diff --git a/mysql.spec b/mysql.spec index 6b6c0bb..fc46e99 100644 --- a/mysql.spec +++ b/mysql.spec @@ -1,6 +1,6 @@ Name: mysql Version: 5.1.39 -Release: 3%{?dist} +Release: 4%{?dist} Summary: MySQL client programs and shared libraries Group: Applications/Databases URL: http://www.mysql.com @@ -33,7 +33,7 @@ Patch7: mysql-plugin-bug.patch Patch8: mysql-setschedparam.patch Patch9: mysql-ndb-stacksize.patch Patch10: mysql-strmov.patch -Patch11: mysql-sparc-gcc-bug.patch +Patch11: mysql-signal-align.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: gperf, perl, readline-devel, openssl-devel @@ -649,6 +649,9 @@ fi %{_mandir}/man1/mysql_client_test.1* %changelog +* Sat Oct 17 2009 Tom Lane 5.1.39-4 +- Replace kluge fix for ndbd sparc crash with a real fix (mysql bug 48132) + * Thu Oct 15 2009 Tom Lane 5.1.39-3 - Work around two different compiler bugs on sparc, one by backing off optimization from -O2 to -O1, and the other with a klugy patch