Below is the list of changes that have just been committed into a local
4.1 repository of pekka. When pekka 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
1.2480 06/05/15 16:31:23 pekka@stripped +3 -0
ndb - bug#19537: arithmetic conversion Uint64 reg to Uint32 attr
ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
1.12 06/05/15 16:27:30 pekka@stripped +6 -0
bug#19537: write_attr: perform arithmetic conversion Uint64 to Uint32
ndb/test/ndbapi/testInterpreter.cpp
1.4 06/05/15 16:19:56 pekka@stripped +162 -40
add test case Bug19537
the bug fix also fixed IncValue64 for whatever reason..
ndb/test/ndbapi/Makefile.am
1.18 06/05/15 16:15:44 pekka@stripped +3 -0
enable testInterpreter
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: pekka
# Host: orca.ndb.mysql.com
# Root: /space/pekka/ndb/version/my41
--- 1.11/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp 2004-12-03 14:51:01 +01:00
+++ 1.12/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp 2006-05-15 16:27:30 +02:00
@@ -1494,6 +1494,7 @@
// word read. Thus we set the register to be a 32 bit register.
/* ------------------------------------------------------------- */
TregMemBuffer[theRegister] = 0x50;
+ // arithmetic conversion if big-endian
* (Int64*)(TregMemBuffer+theRegister+2) = TregMemBuffer[theRegister+1];
} else if (TnoDataRW == 3) {
/* ------------------------------------------------------------- */
@@ -1557,6 +1558,11 @@
Tlen = TattrNoOfWords + 1;
if (Toptype == ZUPDATE) {
if (TattrNoOfWords <= 2) {
+ if (TattrNoOfWords == 1) {
+ // arithmetic conversion if big-endian
+ TdataForUpdate[1] = *(Int64*)&TregMemBuffer[theRegister + 2];
+ TdataForUpdate[2] = 0;
+ }
if (TregType == 0) {
/* --------------------------------------------------------- */
// Write a NULL value into the attribute
--- 1.3/ndb/test/ndbapi/testInterpreter.cpp 2004-09-15 11:43:34 +02:00
+++ 1.4/ndb/test/ndbapi/testInterpreter.cpp 2006-05-15 16:19:56 +02:00
@@ -79,46 +79,46 @@
Ndb* pNdb = GETNDB(step);
- NdbConnection* pTrans = pNdb->startTransaction();
- if (pTrans == NULL){
- ERR(pNdb->getNdbError());
- return NDBT_FAILED;
- }
-
- NdbOperation* pOp = pTrans->getNdbOperation(pTab->getName());
- if (pOp == NULL) {
- ERR(pTrans->getNdbError());
- pNdb->closeTransaction(pTrans);
- return NDBT_FAILED;
- }
-
- int check = pOp->interpretedUpdateTuple();
- if( check == -1 ) {
- ERR(pTrans->getNdbError());
- pNdb->closeTransaction(pTrans);
- return NDBT_FAILED;
- }
-
-
- // Primary keys
- Uint32 pkVal = 1;
- check = pOp->equal("KOL1", pkVal );
- if( check == -1 ) {
- ERR(pTrans->getNdbError());
- pNdb->closeTransaction(pTrans);
- return NDBT_FAILED;
- }
-
- // Attributes
-
- // Update column
- Uint32 valToIncWith = 1;
- check = pOp->incValue("KOL2", valToIncWith);
- if( check == -1 ) {
- ERR(pTrans->getNdbError());
- pNdb->closeTransaction(pTrans);
- return NDBT_FAILED;
- }
+ NdbConnection* pTrans = pNdb->startTransaction();
+ if (pTrans == NULL){
+ ERR(pNdb->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ NdbOperation* pOp = pTrans->getNdbOperation(pTab->getName());
+ if (pOp == NULL) {
+ ERR(pTrans->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ int check = pOp->interpretedUpdateTuple();
+ if( check == -1 ) {
+ ERR(pTrans->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+
+ // Primary keys
+ Uint32 pkVal = 1;
+ check = pOp->equal("KOL1", pkVal );
+ if( check == -1 ) {
+ ERR(pTrans->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ // Attributes
+
+ // Update column
+ Uint32 valToIncWith = 1;
+ check = pOp->incValue("KOL2", valToIncWith);
+ if( check == -1 ) {
+ ERR(pTrans->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
NdbRecAttr* valueRec = pOp->getValue("KOL2");
if( valueRec == NULL ) {
@@ -142,6 +142,122 @@
return NDBT_OK;
}
+int runTestBug19537(NDBT_Context* ctx, NDBT_Step* step){
+ int result = NDBT_OK;
+ const NdbDictionary::Table * pTab = ctx->getTab();
+ Ndb* pNdb = GETNDB(step);
+
+ if (strcmp(pTab->getName(), "T1") != 0) {
+ g_err << "runTestBug19537: skip, table != T1" << endl;
+ return NDBT_OK;
+ }
+
+
+ NdbConnection* pTrans = pNdb->startTransaction();
+ if (pTrans == NULL){
+ ERR(pNdb->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ NdbOperation* pOp = pTrans->getNdbOperation(pTab->getName());
+ if (pOp == NULL) {
+ ERR(pTrans->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ if (pOp->interpretedUpdateTuple() == -1) {
+ ERR(pOp->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+
+ // Primary keys
+ const Uint32 pkVal = 1;
+ if (pOp->equal("KOL1", pkVal) == -1) {
+ ERR(pTrans->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ // Load 64-bit constant into register 1 and
+ // write from register 1 to 32-bit column KOL2
+ const Uint64 reg_val = 0x0102030405060708ULL;
+
+ const Uint32* reg_ptr32 = (const Uint32*)®_val;
+ if (reg_ptr32[0] == 0x05060708 && reg_ptr32[1] == 0x01020304) {
+ g_err << "runTestBug19537: platform is LITTLE endian" << endl;
+ } else if (reg_ptr32[0] == 0x01020304 && reg_ptr32[1] == 0x05060708) {
+ g_err << "runTestBug19537: platform is BIG endian" << endl;
+ } else {
+ g_err << "runTestBug19537: impossible platform"
+ << hex << " [0]=" << reg_ptr32[0] << " [1]="
<<reg_ptr32[1] << endl;
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ if (pOp->load_const_u64(1, reg_val) == -1 ||
+ pOp->write_attr("KOL2", 1) == -1) {
+ ERR(pOp->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ if (pTrans->execute(Commit) == -1) {
+ ERR(pTrans->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ // Read value via a new transaction
+
+ pTrans = pNdb->startTransaction();
+ if (pTrans == NULL){
+ ERR(pNdb->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ pOp = pTrans->getNdbOperation(pTab->getName());
+ if (pOp == NULL) {
+ ERR(pTrans->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ Uint32 kol2 = 0x09090909;
+ if (pOp->readTuple() == -1 ||
+ pOp->equal("KOL1", pkVal) == -1 ||
+ pOp->getValue("KOL2", (char*)&kol2) == 0) {
+ ERR(pOp->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ if (pTrans->execute(Commit) == -1) {
+ ERR(pTrans->getNdbError());
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ // Expected conversion as in C - truncate to lower (logical) word
+
+ if (kol2 == 0x01020304) {
+ g_err << "runTestBug19537: the bug manifests itself !" << endl;
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ if (kol2 != 0x05060708) {
+ g_err << "runTestBug19537: impossible KOL2 " << hex << kol2
<< endl;
+ pNdb->closeTransaction(pTrans);
+ return NDBT_FAILED;
+ }
+
+ pNdb->closeTransaction(pTrans);
+ return NDBT_OK;
+}
+
NDBT_TESTSUITE(testInterpreter);
TESTCASE("IncValue32",
@@ -154,6 +270,12 @@
"Test incValue for 64 bit integer\n"){
INITIALIZER(runLoadTable);
INITIALIZER(runTestIncValue64);
+ FINALIZER(runClearTable);
+}
+TESTCASE("Bug19537",
+ "Test big-endian write_attr of 32 bit integer\n"){
+ INITIALIZER(runLoadTable);
+ INITIALIZER(runTestBug19537);
FINALIZER(runClearTable);
}
#if 0
--- 1.17/ndb/test/ndbapi/Makefile.am 2005-09-09 12:39:02 +02:00
+++ 1.18/ndb/test/ndbapi/Makefile.am 2006-05-15 16:15:44 +02:00
@@ -24,6 +24,7 @@
testOperations \
testRestartGci \
testScan \
+testInterpreter \
testScanInterpreter \
testScanPerf \
testSystemRestart \
@@ -61,6 +62,7 @@
testOperations_SOURCES = testOperations.cpp
testRestartGci_SOURCES = testRestartGci.cpp
testScan_SOURCES = testScan.cpp ScanFunctions.hpp
+testInterpreter_SOURCES = testInterpreter.cpp
testScanInterpreter_SOURCES = testScanInterpreter.cpp ScanFilter.hpp
ScanInterpretTest.hpp
testScanPerf_SOURCES = testScanPerf.cpp
testSystemRestart_SOURCES = testSystemRestart.cpp
@@ -152,3 +154,4 @@
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(testScan_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+
| Thread |
|---|
| • bk commit into 4.1 tree (pekka:1.2480) BUG#19537 | pekka | 15 May |