Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas 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, 2007-04-12 11:43:56+02:00, jonas@stripped +4 -0
ndb - hugo - add new method for setting primary key(s)
storage/ndb/test/include/HugoOperations.hpp@stripped, 2007-04-12 11:43:54+02:00,
jonas@stripped +2 -0
Add method for setting of primary key
storage/ndb/test/src/HugoAsynchTransactions.cpp@stripped, 2007-04-12 11:43:54+02:00,
jonas@stripped +23 -35
Add method for setting of primary key
storage/ndb/test/src/HugoOperations.cpp@stripped, 2007-04-12 11:43:54+02:00,
jonas@stripped +33 -60
Add method for setting of primary key
storage/ndb/test/src/HugoTransactions.cpp@stripped, 2007-04-12 11:43:54+02:00,
jonas@stripped +29 -53
Add method for setting of primary key
# 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: jonas
# Host: perch.ndb.mysql.com
# Root: /home/jonas/src/51-telco-gca
--- 1.19/storage/ndb/test/include/HugoOperations.hpp 2007-04-12 11:44:01 +02:00
+++ 1.20/storage/ndb/test/include/HugoOperations.hpp 2007-04-12 11:44:01 +02:00
@@ -83,6 +83,8 @@
int equalForAttr(NdbOperation*,
int attrId,
int rowId);
+
+ int equalForRow(NdbOperation*, int rowid);
int setValues(NdbOperation*, int rowId, int updateId);
--- 1.7/storage/ndb/test/src/HugoAsynchTransactions.cpp 2007-04-12 11:44:01 +02:00
+++ 1.8/storage/ndb/test/src/HugoAsynchTransactions.cpp 2007-04-12 11:44:01 +02:00
@@ -188,14 +188,11 @@
// Read
// Define primary keys
check = pOp->readTupleExclusive();
- for (a = 0; a < tab.getNoOfColumns(); a++) {
- if (tab.getColumn(a)->getPrimaryKey() == true) {
- if (equalForAttr(pOp, a, cReadRecords) != 0){
- ERR(transactions[t]->getNdbError());
- pNdb->closeTransaction(transactions[t]);
- return NDBT_FAILED;
- }
- }
+ if (equalForRow(pOp, cReadRecords) != 0)
+ {
+ ERR(transactions[t]->getNdbError());
+ pNdb->closeTransaction(transactions[t]);
+ return NDBT_FAILED;
}
// Define attributes to read
for (a = 0; a < tab.getNoOfColumns(); a++) {
@@ -259,15 +256,12 @@
}
// Set search condition for the record
- for (a = 0; a < tab.getNoOfColumns(); a++) {
- if (tab.getColumn(a)->getPrimaryKey() == true) {
- if (equalForAttr(pOp, a, cRecords) != 0) {
- ERR(transactions[t]->getNdbError());
- pNdb->closeTransaction(transactions[t]);
- return NDBT_FAILED;
- }
- }
- }
+ if (equalForRow(pOp, cReadRecords) != 0)
+ {
+ ERR(transactions[t]->getNdbError());
+ pNdb->closeTransaction(transactions[t]);
+ return NDBT_FAILED;
+ }
// Update the record
for (a = 0; a < tab.getNoOfColumns(); a++) {
@@ -396,15 +390,12 @@
case NO_READ:
// Define primary keys
check = pOp->readTuple();
- for (a = 0; a < tab.getNoOfColumns(); a++) {
- if (tab.getColumn(a)->getPrimaryKey() == true) {
- if (equalForAttr(pOp, a, cRecords) != 0){
- ERR(transactions[t]->getNdbError());
- pNdb->closeTransaction(transactions[t]);
- return NDBT_FAILED;
- }
- }
- }
+ if (equalForRow(pOp, cRecords) != 0)
+ {
+ ERR(transactions[t]->getNdbError());
+ pNdb->closeTransaction(transactions[t]);
+ return NDBT_FAILED;
+ }
// Define attributes to read
for (a = 0; a < tab.getNoOfColumns(); a++) {
if ((rows[cIndex]->attributeStore(a) =
@@ -425,15 +416,12 @@
}
// Define primary keys
- for (a = 0; a < tab.getNoOfColumns(); a++) {
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if (equalForAttr(pOp, a, cRecords) != 0) {
- ERR(transactions[t]->getNdbError());
- pNdb->closeTransaction(transactions[t]);
- return NDBT_FAILED;
- }
- }
- }
+ if (equalForRow(pOp, cRecords) != 0)
+ {
+ ERR(transactions[t]->getNdbError());
+ pNdb->closeTransaction(transactions[t]);
+ return NDBT_FAILED;
+ }
break;
default:
// Should not happen...
--- 1.29/storage/ndb/test/src/HugoOperations.cpp 2007-04-12 11:44:01 +02:00
+++ 1.30/storage/ndb/test/src/HugoOperations.cpp 2007-04-12 11:44:01 +02:00
@@ -111,14 +111,8 @@
}
// Define primary keys
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pOp, a, r+recordNo) != 0){
- ERR(pTrans->getNdbError());
- return NDBT_FAILED;
- }
- }
- }
+ if (equalForRow(pOp, r+recordNo) != 0)
+ return NDBT_FAILED;
if(pIndexScanOp)
pIndexScanOp->end_of_bound(r);
@@ -143,7 +137,6 @@
int recordNo,
int numRecords,
int updatesValue){
- int a;
allocRows(numRecords);
int check;
for(int r=0; r < numRecords; r++){
@@ -172,14 +165,8 @@
{
// Define primary keys
int a;
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pOp, a, rowId) != 0){
- ERR(pTrans->getNdbError());
- return NDBT_FAILED;
- }
- }
- }
+ if (equalForRow(pOp, rowId) != 0)
+ return NDBT_FAILED;
for(a = 0; a<tab.getNoOfColumns(); a++){
if (tab.getColumn(a)->getPrimaryKey() == false){
@@ -198,7 +185,7 @@
int numRecords,
int updatesValue){
- int a, check;
+ int check;
for(int r=0; r < numRecords; r++){
NdbOperation* pOp = getOperation(pTrans, NdbOperation::InsertRequest);
if (pOp == NULL) {
@@ -240,14 +227,8 @@
}
// Define primary keys
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pOp, a, r+recordNo) != 0){
- ERR(pTrans->getNdbError());
- return NDBT_FAILED;
- }
- }
- }
+ if (equalForRow(pOp, r+recordNo) != 0)
+ return NDBT_FAILED;
// Define attributes to update
for(a = 0; a<tab.getNoOfColumns(); a++){
@@ -266,7 +247,7 @@
int recordNo,
int numRecords){
- int a, check;
+ int check;
for(int r=0; r < numRecords; r++){
NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
if (pOp == NULL) {
@@ -281,14 +262,8 @@
}
// Define primary keys
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pOp, a, r+recordNo) != 0){
- ERR(pTrans->getNdbError());
- return NDBT_FAILED;
- }
- }
- }
+ if (equalForRow(pOp, r+recordNo) != 0)
+ return NDBT_FAILED;
}
return NDBT_OK;
}
@@ -297,7 +272,7 @@
int recordNo,
int numRecords){
- int a, check;
+ int check;
for(int r=0; r < numRecords; r++){
NdbOperation* pOp = getOperation(pTrans, NdbOperation::DeleteRequest);
if (pOp == NULL) {
@@ -312,14 +287,8 @@
}
// Define primary keys
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pOp, a, r+recordNo) != 0){
- ERR(pTrans->getNdbError());
- return NDBT_FAILED;
- }
- }
- }
+ if (equalForRow(pOp, r+recordNo) != 0)
+ return NDBT_FAILED;
}
return NDBT_OK;
}
@@ -518,6 +487,22 @@
}
}
+int
+HugoOperations::equalForRow(NdbOperation* pOp, int row)
+{
+ for(int a = 0; a<tab.getNoOfColumns(); a++)
+ {
+ if (tab.getColumn(a)->getPrimaryKey() == true)
+ {
+ if(equalForAttr(pOp, a, row) != 0)
+ {
+ ERR(pOp->getNdbError());
+ return NDBT_FAILED;
+ }
+ }
+ }
+ return NDBT_OK;
+}
int HugoOperations::equalForAttr(NdbOperation* pOp,
int attrId,
@@ -676,14 +661,8 @@
}
// Define primary keys
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pOp, a, r+recordNo) != 0){
- ERR(pTrans->getNdbError());
- return NDBT_FAILED;
- }
- }
- }
+ if (equalForRow(pOp, r+recordNo) != 0)
+ return NDBT_FAILED;
// Define attributes to read
for(a = 0; a<tab.getNoOfColumns(); a++){
@@ -720,14 +699,8 @@
}
// Define primary keys
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pOp, a, r+recordNo) != 0){
- ERR(pTrans->getNdbError());
- return NDBT_FAILED;
- }
- }
- }
+ if (equalForRow(pOp, r+recordNo) != 0)
+ return NDBT_FAILED;
// Define attributes to update
for(a = 0; a<tab.getNoOfColumns(); a++){
--- 1.31/storage/ndb/test/src/HugoTransactions.cpp 2007-04-12 11:44:01 +02:00
+++ 1.32/storage/ndb/test/src/HugoTransactions.cpp 2007-04-12 11:44:01 +02:00
@@ -520,10 +520,9 @@
bool oneTrans,
int value,
bool abort){
- int check, a;
+ int check;
int retryAttempt = 0;
int retryMax = 5;
- NdbOperation *pOp;
bool first_batch = true;
const int org = batch;
@@ -667,10 +666,9 @@
int
HugoTransactions::fillTable(Ndb* pNdb,
int batch){
- int check, a, b;
+ int check;
int retryAttempt = 0;
int retryMax = 5;
- NdbOperation *pOp;
const int org = batch;
const int cols = tab.getNoOfColumns();
@@ -791,7 +789,7 @@
int reads = 0;
int r = 0;
int retryAttempt = 0;
- int check, a;
+ int check;
if (batch == 0) {
g_info << "ERROR: Argument batch == 0 in pkReadRecords(). Not allowed."
<< endl;
@@ -910,8 +908,7 @@
int updated = 0;
int r = 0;
int retryAttempt = 0;
- int check, a, b;
- NdbOperation *pOp;
+ int check, b;
allocRows(batch);
@@ -1097,14 +1094,10 @@
}
// Define primary keys
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pOp, a, r) != 0){
- ERR(pTrans->getNdbError());
- closeTransaction(pNdb);
- return NDBT_FAILED;
- }
- }
+ if (equalForRow(pOp, r) != 0)
+ {
+ closeTransaction(pNdb);
+ return NDBT_FAILED;
}
// Read update value
@@ -1153,14 +1146,10 @@
}
// PKs
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pUpdOp, a, r) != 0){
- ERR(pTrans->getNdbError());
- closeTransaction(pNdb);
- return NDBT_FAILED;
- }
- }
+ if (equalForRow(pOp, r) != 0)
+ {
+ closeTransaction(pNdb);
+ return NDBT_FAILED;
}
// Update col
@@ -1236,8 +1225,7 @@
int deleted = 0;
int r = 0;
int retryAttempt = 0;
- int check, a;
- NdbOperation *pOp;
+ int check;
g_info << "|- Deleting records..." << endl;
while (r < records){
@@ -1335,8 +1323,7 @@
// and lock som other records
int r = 0;
int retryAttempt = 0;
- int check, a, b;
- NdbOperation *pOp;
+ int check;
NdbOperation::LockMode lm = NdbOperation::LM_Exclusive;
// Calculate how many records to lock in each batch
@@ -1522,14 +1509,10 @@
}
// Define primary keys
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pOp, a, r+b) != 0){
- ERR(pTrans->getNdbError());
- closeTransaction(pNdb);
- return NDBT_FAILED;
- }
- }
+ if (equalForRow(pOp, r+b) != 0)
+ {
+ closeTransaction(pNdb);
+ return NDBT_FAILED;
}
// Define attributes to read
@@ -1663,14 +1646,10 @@
}
// Define primary keys
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pOp, a, r+b) != 0){
- ERR(pTrans->getNdbError());
- closeTransaction(pNdb);
- return NDBT_FAILED;
- }
- }
+ if (equalForRow(pOp, r+b) != 0)
+ {
+ closeTransaction(pNdb);
+ return NDBT_FAILED;
}
// Define attributes to read
@@ -1733,16 +1712,13 @@
return NDBT_FAILED;
}
- if(!ordered){
- for(a = 0; a<tab.getNoOfColumns(); a++){
- if (tab.getColumn(a)->getPrimaryKey() == true){
- if(equalForAttr(pUpdOp, a, r+b) != 0){
- ERR(pTrans->getNdbError());
- closeTransaction(pNdb);
- return NDBT_FAILED;
- }
- }
- }
+ if(!ordered)
+ {
+ if (equalForRow(pOp, r+b) != 0)
+ {
+ closeTransaction(pNdb);
+ return NDBT_FAILED;
+ }
}
for(a = 0; a<tab.getNoOfColumns(); a++){
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.2459) | jonas | 12 Apr |