ndb - bug#18067 bug#18075 closes these bugs

mysql-test/r/rpl_ndb_blob.result:
  test case for varsize PK + blob
mysql-test/t/rpl_ndb_blob.test:
  test case for varsize PK + blob
storage/ndb/include/ndbapi/NdbBlob.hpp:
  table PK in blob part key is fixed-sized so keep extra bytes zero if varsize PK
storage/ndb/src/ndbapi/NdbBlob.cpp:
  table PK in blob part key is fixed-sized so keep extra bytes zero if varsize PK
This commit is contained in:
unknown 2006-03-09 17:16:04 +01:00
commit 9f5731821a
4 changed files with 122 additions and 51 deletions

View file

@ -288,6 +288,7 @@ private:
Buf();
~Buf();
void alloc(unsigned n);
void zerorest();
void copyfrom(const Buf& src);
};
Buf theKeyBuf;

View file

@ -307,6 +307,13 @@ NdbBlob::Buf::alloc(unsigned n)
#endif
}
void
NdbBlob::Buf::zerorest()
{
assert(size <= maxsize);
memset(data + size, 0, maxsize - size);
}
void
NdbBlob::Buf::copyfrom(const NdbBlob::Buf& src)
{
@ -441,6 +448,7 @@ NdbBlob::packKeyValue(const NdbTableImpl* aTable, const Buf& srcBuf)
assert(4 * pos == srcBuf.size);
assert(4 * pack_pos <= thePackKeyBuf.maxsize);
thePackKeyBuf.size = 4 * pack_pos;
thePackKeyBuf.zerorest();
DBUG_RETURN(0);
}
@ -1316,6 +1324,7 @@ NdbBlob::atPrepare(NdbTransaction* aCon, NdbOperation* anOp, const NdbColumnImpl
DBUG_RETURN(-1);
}
thePackKeyBuf.size = 4 * size;
thePackKeyBuf.zerorest();
if (unpackKeyValue(theTable, theKeyBuf) == -1)
DBUG_RETURN(-1);
}
@ -1328,6 +1337,7 @@ NdbBlob::atPrepare(NdbTransaction* aCon, NdbOperation* anOp, const NdbColumnImpl
DBUG_RETURN(-1);
}
thePackKeyBuf.size = 4 * size;
thePackKeyBuf.zerorest();
if (unpackKeyValue(theAccessTable, theAccessKeyBuf) == -1)
DBUG_RETURN(-1);
}
@ -1634,6 +1644,7 @@ NdbBlob::postExecute(NdbTransaction::ExecType anExecType)
// copy key from first blob
theKeyBuf.copyfrom(tFirstBlob->theKeyBuf);
thePackKeyBuf.copyfrom(tFirstBlob->thePackKeyBuf);
thePackKeyBuf.zerorest();
}
}
if (isReadOp()) {
@ -1795,6 +1806,7 @@ NdbBlob::atNextResult()
DBUG_RETURN(-1);
}
thePackKeyBuf.size = 4 * size;
thePackKeyBuf.zerorest();
if (unpackKeyValue(theTable, theKeyBuf) == -1)
DBUG_RETURN(-1);
}