summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <kent@kent-amd64.(none)>2007-03-14 14:37:50 +0100
committerunknown <kent@kent-amd64.(none)>2007-03-14 14:37:50 +0100
commitb249782bbff1df127e34c9aeb9a154eadb5630f8 (patch)
treeb4f70bbfdf54e7857d796de65e014150a776bc7d
parent2b183b5588e09cf7e9edc1883edb56ca10af9cbc (diff)
parent29e6d30882394c8b39191c346df87beafbf006a7 (diff)
downloadmariadb-git-b249782bbff1df127e34c9aeb9a154eadb5630f8.tar.gz
Merge mysql.com:/home/kent/bk/tmp/mysql-5.0-build
into mysql.com:/home/kent/bk/tmp/mysql-5.1-build configure.in: Auto merged storage/ndb/src/ndbapi/NdbBlob.cpp: Auto merged storage/ndb/test/ndbapi/testBlobs.cpp: Auto merged
-rw-r--r--configure.in3
-rw-r--r--storage/ndb/src/ndbapi/NdbBlob.cpp4
-rw-r--r--storage/ndb/test/ndbapi/testBlobs.cpp54
3 files changed, 59 insertions, 2 deletions
diff --git a/configure.in b/configure.in
index 9739a1017b9..99f05be35a5 100644
--- a/configure.in
+++ b/configure.in
@@ -739,6 +739,9 @@ AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
+# For the sched_yield() function on Solaris
+AC_CHECK_FUNC(sched_yield, , AC_CHECK_LIB(posix4, sched_yield))
+
MYSQL_CHECK_ZLIB_WITH_COMPRESS
# For large pages support
diff --git a/storage/ndb/src/ndbapi/NdbBlob.cpp b/storage/ndb/src/ndbapi/NdbBlob.cpp
index ee3a1cfd66a..98ba28c8d2e 100644
--- a/storage/ndb/src/ndbapi/NdbBlob.cpp
+++ b/storage/ndb/src/ndbapi/NdbBlob.cpp
@@ -1031,7 +1031,9 @@ NdbBlob::writeDataPrivate(const char* buf, Uint32 bytes)
DBUG_RETURN(-1);
Uint32 n = thePartSize - off;
if (n > len) {
- memset(thePartBuf.data + off + len, theFillChar, n - len);
+ /* If we are adding data at the end, fill rest of part. */
+ if (pos + len >= theLength)
+ memset(thePartBuf.data + off + len, theFillChar, n - len);
n = len;
}
memcpy(thePartBuf.data + off, buf, n);
diff --git a/storage/ndb/test/ndbapi/testBlobs.cpp b/storage/ndb/test/ndbapi/testBlobs.cpp
index 5d2552220f9..e26910a64ad 100644
--- a/storage/ndb/test/ndbapi/testBlobs.cpp
+++ b/storage/ndb/test/ndbapi/testBlobs.cpp
@@ -138,6 +138,7 @@ printusage()
<< " 2 readData / writeData" << endl
<< "bug tests (no blob test)" << endl
<< " -bug 4088 ndb api hang with mixed ops on index table" << endl
+ << " -bug 27018 middle partial part write clobbers rest of part" << endl
<< " -bug nnnn delete + write gives 626" << endl
<< " -bug nnnn acc crash on delete and long key" << endl
;
@@ -1808,6 +1809,56 @@ bugtest_4088()
}
static int
+bugtest_27018()
+{
+ DBG("bug test 27018 - middle partial part write clobbers rest of part");
+
+ // insert rows
+ calcTups(false);
+ CHK(insertPk(false) == 0);
+ // new trans
+ for (unsigned k= 0; k < g_opt.m_rows; k++)
+ {
+ Tup& tup= g_tups[k];
+
+ CHK((g_con= g_ndb->startTransaction()) != 0);
+ CHK((g_opr= g_con->getNdbOperation(g_opt.m_tname)) != 0);
+ CHK(g_opr->updateTuple() == 0);
+ CHK(g_opr->equal("PK1", tup.m_pk1) == 0);
+ if (g_opt.m_pk2len != 0)
+ CHK(g_opr->equal("PK2", tup.m_pk2) == 0);
+ CHK(getBlobHandles(g_opr) == 0);
+ CHK(g_con->execute(NoCommit) == 0);
+
+ /* Update one byte in random position. */
+ Uint32 offset= urandom(tup.m_blob1.m_len);
+ tup.m_blob1.m_buf[0]= 0xff ^ tup.m_blob1.m_val[offset];
+ CHK(g_bh1->setPos(offset) == 0);
+ CHK(g_bh1->writeData(&(tup.m_blob1.m_buf[0]), 1) == 0);
+ CHK(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+
+ CHK((g_con= g_ndb->startTransaction()) != 0);
+ CHK((g_opr= g_con->getNdbOperation(g_opt.m_tname)) != 0);
+ CHK(g_opr->readTuple() == 0);
+ CHK(g_opr->equal("PK1", tup.m_pk1) == 0);
+ if (g_opt.m_pk2len != 0)
+ CHK(g_opr->equal("PK2", tup.m_pk2) == 0);
+ CHK(getBlobHandles(g_opr) == 0);
+
+ CHK(g_bh1->getValue(tup.m_blob1.m_buf, tup.m_blob1.m_len) == 0);
+ CHK(g_con->execute(Commit) == 0);
+ Uint64 len= ~0;
+ CHK(g_bh1->getLength(len) == 0 && len == tup.m_blob1.m_len);
+ tup.m_blob1.m_buf[offset]^= 0xff;
+ CHK(memcmp(tup.m_blob1.m_buf, tup.m_blob1.m_val, tup.m_blob1.m_len) == 0);
+ g_ndb->closeTransaction(g_con);
+ }
+
+ return 0;
+}
+
+static int
bugtest_2222()
{
return 0;
@@ -1823,7 +1874,8 @@ static struct {
int m_bug;
int (*m_test)();
} g_bugtest[] = {
- { 4088, bugtest_4088 }
+ { 4088, bugtest_4088 },
+ { 27018, bugtest_27018 }
};
NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)