diff options
author | unknown <monty@mysql.com> | 2004-09-06 15:14:10 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-09-06 15:14:10 +0300 |
commit | 4ad51359c1b7b5ed854f1af8df06fd6912068d28 (patch) | |
tree | d9ef905036723648a1d354d0523ef8124e4dee76 /ndb/tools | |
parent | fa3bfbe45796edd85cce30e62ff1fcfb81df745c (diff) | |
parent | 9a63c8e0e468d7a64dcb7e23f4e5c344eebf635b (diff) | |
download | mariadb-git-4ad51359c1b7b5ed854f1af8df06fd6912068d28.tar.gz |
Merge with 4.1
(Includes merge of arena code in 4.1 and 5.0)
BitKeeper/etc/ignore:
auto-union
BitKeeper/etc/logging_ok:
auto-union
VC++Files/sql/mysqld.dsp:
Auto merged
client/mysql.cc:
Auto merged
client/mysqltest.c:
Auto merged
include/my_global.h:
Auto merged
include/my_sys.h:
Auto merged
include/mysql.h:
Auto merged
include/mysql_com.h:
Auto merged
innobase/row/row0sel.c:
Auto merged
libmysql/client_settings.h:
Auto merged
libmysql/libmysql.c:
Auto merged
libmysqld/Makefile.am:
Auto merged
libmysqld/examples/Makefile.am:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
myisam/mi_check.c:
Auto merged
myisam/myisamchk.c:
Auto merged
myisam/sort.c:
Auto merged
mysql-test/r/connect.result:
Auto merged
mysql-test/r/ctype_recoding.result:
Auto merged
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/r/func_in.result:
Auto merged
mysql-test/r/func_like.result:
Auto merged
mysql-test/r/gis.result:
Auto merged
mysql-test/r/having.result:
Auto merged
mysql-test/r/heap.result:
Auto merged
mysql-test/r/join.result:
Auto merged
mysql-test/r/key.result:
Auto merged
mysql-test/r/lowercase_table.result:
Auto merged
mysql-test/r/ndb_autodiscover.result:
Auto merged
mysql-test/r/null.result:
Auto merged
mysql-test/r/olap.result:
Auto merged
mysql-test/r/order_by.result:
Auto merged
mysql-test/r/ps_1general.result:
Auto merged
mysql-test/r/ps_2myisam.result:
Auto merged
mysql-test/r/ps_3innodb.result:
Auto merged
mysql-test/r/ps_4heap.result:
Auto merged
mysql-test/r/ps_5merge.result:
Auto merged
mysql-test/r/ps_6bdb.result:
Auto merged
mysql-test/r/range.result:
Auto merged
mysql-test/r/rename.result:
Auto merged
mysql-test/r/show_check.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/union.result:
Auto merged
mysql-test/r/variables.result:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
mysql-test/t/null.test:
Auto merged
mysql-test/t/ps_1general.test:
Auto merged
mysql-test/t/rpl_charset.test:
Auto merged
mysql-test/t/rpl_heap.test:
Auto merged
mysql-test/t/rpl_relayrotate.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
mysql-test/t/variables.test:
Auto merged
netware/mysql_test_run.c:
Auto merged
scripts/make_binary_distribution.sh:
Auto merged
scripts/mysql_create_system_tables.sh:
Auto merged
scripts/mysql_fix_privilege_tables.sql:
Auto merged
scripts/mysql_install_db.sh:
Auto merged
sql/ha_berkeley.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/ha_innodb.h:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/handler.h:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_create.cc:
Auto merged
sql/item_create.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/item_timefunc.h:
Auto merged
sql/lex.h:
Auto merged
sql/lock.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/opt_sum.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/records.cc:
Auto merged
sql/repl_failsafe.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/set_var.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_acl.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_list.h:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_rename.cc:
Auto merged
sql/sql_select.h:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_string.h:
Auto merged
sql/table.cc:
Auto merged
sql-common/client.c:
Auto merged
client/mysqlbinlog.cc:
Merge with 4.1
configure.in:
Merge with 4.1
include/mysqld_error.h:
Add new error message (1) from 4.1
mysql-test/mysql-test-run.sh:
Merge with 4.1
mysql-test/r/func_gconcat.result:
Merge with 4.1
mysql-test/r/func_if.result:
Merge with 4.1
mysql-test/r/grant.result:
Merge with 4.1
mysql-test/r/join_outer.result:
Merge with 4.1
mysql-test/r/rpl_charset.result:
Merge with 4.1 (This has to be fixed before pushing)
mysql-test/r/system_mysql_db.result:
Merge with 4.1.
Added collation to new privileges
mysql-test/t/grant.test:
Merge with 4.1
mysql-test/t/grant_cache.test:
Merge with 4.1
mysql-test/t/show_check.test:
Merge with 4.1
sql/Makefile.am:
Merge with 4.1
sql/item.cc:
Merge with 4.1
sql/item_cmpfunc.cc:
Merge with 4.1 (arena code)
sql/item_subselect.cc:
Merge with 4.1
sql/item_subselect.h:
Merge with 4.1
sql/item_sum.cc:
Merge with 4.1
sql/item_sum.h:
Merge with 4.1
sql/log.cc:
Merge with 4.1 (Remove code that is not relevant for 5.0)
sql/mysqld.cc:
Merge with 4.1
sql/opt_range.cc:
Merge with 4.1
sql/share/czech/errmsg.txt:
Merge with 4.1
sql/share/danish/errmsg.txt:
Merge with 4.1
sql/share/dutch/errmsg.txt:
Merge with 4.1
sql/share/english/errmsg.txt:
Merge with 4.1
sql/share/estonian/errmsg.txt:
Merge with 4.1
sql/share/french/errmsg.txt:
Merge with 4.1
sql/share/german/errmsg.txt:
Merge with 4.1
sql/share/greek/errmsg.txt:
Merge with 4.1
sql/share/hungarian/errmsg.txt:
Merge with 4.1
sql/share/italian/errmsg.txt:
Merge with 4.1
sql/share/japanese/errmsg.txt:
Merge with 4.1
sql/share/korean/errmsg.txt:
Merge with 4.1
sql/share/norwegian-ny/errmsg.txt:
Merge with 4.1
sql/share/norwegian/errmsg.txt:
Merge with 4.1
sql/share/polish/errmsg.txt:
Merge with 4.1
sql/share/portuguese/errmsg.txt:
Merge with 4.1
sql/share/romanian/errmsg.txt:
Merge with 4.1
sql/share/russian/errmsg.txt:
Merge with 4.1
sql/share/serbian/errmsg.txt:
Merge with 4.1
sql/share/slovak/errmsg.txt:
Merge with 4.1
sql/share/spanish/errmsg.txt:
Merge with 4.1
sql/share/swedish/errmsg.txt:
Merge with 4.1
sql/share/ukrainian/errmsg.txt:
Merge with 4.1
sql/sql_base.cc:
Merge with 4.1
sql/sql_class.cc:
Merge with 4.1
Use arena code from 4.1
sql/sql_class.h:
Merge with 4.1
Use arena code from 4.1
sql/sql_derived.cc:
Merge with 4.1
sql/sql_lex.cc:
Merge with 4.1
sql/sql_lex.h:
Merge with 4.1
sql/sql_parse.cc:
Merge with 4.1
sql/sql_prepare.cc:
Merge with 4.1
sql/sql_select.cc:
Merge with 4.1
sql/sql_table.cc:
Merge with 4.1
sql/sql_union.cc:
Merge with 4.1
sql/sql_yacc.yy:
Merge with 4.1
sql/tztime.cc:
Merge with 4.1
tests/client_test.c:
Merge with 4.1
Diffstat (limited to 'ndb/tools')
-rw-r--r-- | ndb/tools/delete_all.cpp | 2 | ||||
-rw-r--r-- | ndb/tools/desc.cpp | 5 | ||||
-rw-r--r-- | ndb/tools/select_all.cpp | 64 | ||||
-rw-r--r-- | ndb/tools/select_count.cpp | 27 | ||||
-rw-r--r-- | ndb/tools/waiter.cpp | 34 |
5 files changed, 86 insertions, 46 deletions
diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp index dabd9a0e8fa..5110947c6a2 100644 --- a/ndb/tools/delete_all.cpp +++ b/ndb/tools/delete_all.cpp @@ -143,7 +143,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism) if(check != -1){ check = pTrans->execute(Commit); - pTrans->releaseCompletedOperations(); + pTrans->restart(); } err = pTrans->getNdbError(); diff --git a/ndb/tools/desc.cpp b/ndb/tools/desc.cpp index a5ff11edca9..e5b98c4c8e9 100644 --- a/ndb/tools/desc.cpp +++ b/ndb/tools/desc.cpp @@ -73,7 +73,8 @@ int main(int argc, const char** argv){ ndbout << "-- Indexes -- " << endl; ndbout << "PRIMARY KEY("; - for (unsigned j= 0; j < pTab->getNoOfPrimaryKeys(); j++) + unsigned j; + for (j= 0; j < pTab->getNoOfPrimaryKeys(); j++) { const NdbDictionary::Column * col = pTab->getColumn(j); ndbout << col->getName(); @@ -82,7 +83,7 @@ int main(int argc, const char** argv){ } ndbout << ") - UniqueHashIndex" << endl; - for (unsigned j= 0; j < list.count; j++) { + for (j= 0; j < list.count; j++) { NdbDictionary::Dictionary::List::Element& elt = list.elements[j]; const NdbDictionary::Index *pIdx = dict->getIndex(elt.name, argv[i]); if (!pIdx){ diff --git a/ndb/tools/select_all.cpp b/ndb/tools/select_all.cpp index 34f63a095bb..329ed87bc48 100644 --- a/ndb/tools/select_all.cpp +++ b/ndb/tools/select_all.cpp @@ -29,11 +29,13 @@ int scanReadRecords(Ndb*, const NdbDictionary::Table*, + const NdbDictionary::Index*, int parallel, int lockType, bool headers, bool useHexFormat, - char delim); + char delim, + bool orderby); int main(int argc, const char** argv){ int _parallelism = 240; @@ -44,6 +46,7 @@ int main(int argc, const char** argv){ const char* _dbname = "TEST_DB"; int _help = 0; int _lock = 0; + int _order = 0; struct getargs args[] = { { "database", 'd', arg_string, &_dbname, "dbname", @@ -57,7 +60,8 @@ int main(int argc, const char** argv){ "delimiter" }, { "usage", '?', arg_flag, &_help, "Print help", "" }, { "lock", 'l', arg_integer, &_lock, - "Read(0), Read-hold(1), Exclusive(2)", "lock"} + "Read(0), Read-hold(1), Exclusive(2)", "lock"}, + { "order", 'o', arg_flag, &_order, "Sort resultset according to index", ""} }; int num_args = sizeof(args) / sizeof(args[0]); int optind = 0; @@ -90,6 +94,11 @@ int main(int argc, const char** argv){ // Check if table exists in db const NdbDictionary::Table* pTab = NDBT_Table::discoverTableFromDb(&MyNdb, _tabname); + const NdbDictionary::Index * pIdx = 0; + if(optind+1 < argc){ + pIdx = MyNdb.getDictionary()->getIndex(argv[optind+1], _tabname); + } + if(pTab == NULL){ ndbout << " Table " << _tabname << " does not exist!" << endl; return NDBT_ProgramExit(NDBT_WRONGARGS); @@ -97,11 +106,12 @@ int main(int argc, const char** argv){ if (scanReadRecords(&MyNdb, pTab, + pIdx, _parallelism, _lock, _header, _useHexFormat, - (char)*_delimiter) != 0){ + (char)*_delimiter, _order) != 0){ return NDBT_ProgramExit(NDBT_FAILED); } @@ -111,17 +121,19 @@ int main(int argc, const char** argv){ int scanReadRecords(Ndb* pNdb, const NdbDictionary::Table* pTab, + const NdbDictionary::Index* pIdx, int parallel, int _lock, bool headers, bool useHexFormat, - char delimiter){ + char delimiter, bool order){ int retryAttempt = 0; const int retryMax = 100; int check; NdbConnection *pTrans; - NdbOperation *pOp; + NdbScanOperation *pOp; + NdbIndexScanOperation * pIOp; NDBT_ResultRow * row = new NDBT_ResultRow(*pTab, delimiter); @@ -146,29 +158,45 @@ int scanReadRecords(Ndb* pNdb, return -1; } - pOp = pTrans->getNdbOperation(pTab->getName()); + + pOp = (!pIdx) ? pTrans->getNdbScanOperation(pTab->getName()) : + pIOp=pTrans->getNdbIndexScanOperation(pIdx->getName(), pTab->getName()); + if (pOp == NULL) { ERR(pTrans->getNdbError()); pNdb->closeTransaction(pTrans); return -1; } - switch(_lock){ + NdbResultSet * rs; + switch(_lock + (3 * order)){ case 1: - check = pOp->openScanReadHoldLock(parallel); + rs = pOp->readTuples(NdbScanOperation::LM_Read, 0, parallel); break; case 2: - check = pOp->openScanExclusive(parallel); + rs = pOp->readTuples(NdbScanOperation::LM_Exclusive, 0, parallel); + break; + case 3: + rs = pIOp->readTuples(NdbScanOperation::LM_CommittedRead, 0, parallel, + true); break; + case 4: + rs = pIOp->readTuples(NdbScanOperation::LM_Read, 0, parallel, true); + break; + case 5: + rs = pIOp->readTuples(NdbScanOperation::LM_Exclusive, 0, parallel, true); + break; + case 0: default: - check = pOp->openScanRead(parallel); + rs = pOp->readTuples(NdbScanOperation::LM_CommittedRead, 0, parallel); + break; } - if( check == -1 ) { + if( rs == 0 ){ ERR(pTrans->getNdbError()); pNdb->closeTransaction(pTrans); return -1; } - + if(0){ NdbScanFilter sf(pOp); #if 0 @@ -229,10 +257,10 @@ int scanReadRecords(Ndb* pNdb, } } - check = pTrans->executeScan(); + check = pTrans->execute(NoCommit); if( check == -1 ) { const NdbError err = pTrans->getNdbError(); - + if (err.status == NdbError::TemporaryError){ pNdb->closeTransaction(pTrans); NdbSleep_MilliSleep(50); @@ -246,11 +274,11 @@ int scanReadRecords(Ndb* pNdb, if (headers) row->header(ndbout) << endl; - + int eof; int rows = 0; - eof = pTrans->nextScanResult(); - + eof = rs->nextResult(); + while(eof == 0){ rows++; @@ -260,7 +288,7 @@ int scanReadRecords(Ndb* pNdb, ndbout << (*row) << endl; } - eof = pTrans->nextScanResult(); + eof = rs->nextResult(); } if (eof == -1) { const NdbError err = pTrans->getNdbError(); diff --git a/ndb/tools/select_count.cpp b/ndb/tools/select_count.cpp index cae91feb378..2c43af20e64 100644 --- a/ndb/tools/select_count.cpp +++ b/ndb/tools/select_count.cpp @@ -30,8 +30,7 @@ static int select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism, int* count_rows, - UtilTransactions::ScanLock lock, - NdbConnection* pBuddyTrans=0); + UtilTransactions::ScanLock lock); int main(int argc, const char** argv){ const char* _dbname = "TEST_DB"; @@ -95,14 +94,13 @@ int select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism, int* count_rows, - UtilTransactions::ScanLock lock, - NdbConnection* pBuddyTrans){ + UtilTransactions::ScanLock lock){ int retryAttempt = 0; const int retryMax = 100; int check; NdbConnection *pTrans; - NdbOperation *pOp; + NdbScanOperation *pOp; while (true){ @@ -112,7 +110,7 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, return NDBT_FAILED; } - pTrans = pNdb->hupp(pBuddyTrans); + pTrans = pNdb->startTransaction(); if (pTrans == NULL) { const NdbError err = pNdb->getNdbError(); @@ -124,26 +122,27 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, ERR(err); return NDBT_FAILED; } - pOp = pTrans->getNdbOperation(pTab->getName()); + pOp = pTrans->getNdbScanOperation(pTab->getName()); if (pOp == NULL) { ERR(pTrans->getNdbError()); pNdb->closeTransaction(pTrans); return NDBT_FAILED; } + NdbResultSet * rs; switch(lock){ case UtilTransactions::SL_ReadHold: - check = pOp->openScanReadHoldLock(parallelism); + rs = pOp->readTuples(NdbScanOperation::LM_Read, 0, parallelism); break; case UtilTransactions::SL_Exclusive: - check = pOp->openScanExclusive(parallelism); + rs = pOp->readTuples(NdbScanOperation::LM_Exclusive, 0, parallelism); break; case UtilTransactions::SL_Read: default: - check = pOp->openScanRead(parallelism); + rs = pOp->readTuples(NdbScanOperation::LM_Dirty, 0, parallelism); } - if( check == -1 ) { + if( rs == 0 ) { ERR(pTrans->getNdbError()); pNdb->closeTransaction(pTrans); return NDBT_FAILED; @@ -156,7 +155,7 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, return NDBT_FAILED; } - check = pTrans->executeScan(); + check = pTrans->execute(NoCommit); if( check == -1 ) { ERR(pTrans->getNdbError()); pNdb->closeTransaction(pTrans); @@ -165,11 +164,11 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, int eof; int rows = 0; - eof = pTrans->nextScanResult(); + eof = rs->nextResult(); while(eof == 0){ rows++; - eof = pTrans->nextScanResult(); + eof = rs->nextResult(); } if (eof == -1) { const NdbError err = pTrans->getNdbError(); diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp index 7ce2739a157..86d34066c55 100644 --- a/ndb/tools/waiter.cpp +++ b/ndb/tools/waiter.cpp @@ -22,21 +22,26 @@ #include <NdbSleep.h> #include <getarg.h> #include <kernel/ndb_limits.h> -#include "../src/common/mgmcommon/LocalConfig.hpp" +#include "../include/mgmcommon/LocalConfig.hpp" #include <NDBT.hpp> int -waitClusterStarted(const char* _addr, unsigned int _timeout= 120); +waitClusterStatus(const char* _addr, + ndb_mgm_node_status _status= NDB_MGM_NODE_STATUS_STARTED, + unsigned int _timeout= 120); int main(int argc, const char** argv){ const char* _hostName = NULL; + int _no_contact = 0; int _help = 0; struct getargs args[] = { + { "no-contact", 0, arg_flag, &_no_contact, "Wait for cluster no contact", "" }, { "usage", '?', arg_flag, &_help, "Print help", "" } }; + int num_args = sizeof(args) / sizeof(args[0]); int optind = 0; char desc[] = @@ -62,13 +67,13 @@ int main(int argc, const char** argv){ return NDBT_ProgramExit(NDBT_FAILED); } - for (int i = 0; i<lcfg.items; i++) + for (int i = 0; i<lcfg.ids.size();i++) { - MgmtSrvrId * m = lcfg.ids[i]; + MgmtSrvrId * m = &lcfg.ids[i]; switch(m->type){ case MgmId_TCP: - snprintf(buf, 255, "%s:%d", m->data.tcp.remoteHost, m->data.tcp.port); + snprintf(buf, 255, "%s:%d", m->name.c_str(), m->port); _hostName = buf; break; case MgmId_File: @@ -86,7 +91,10 @@ int main(int argc, const char** argv){ } } - if (waitClusterStarted(_hostName) != 0) + if (_no_contact) { + if (waitClusterStatus(_hostName, NDB_MGM_NODE_STATUS_NO_CONTACT) != 0) + return NDBT_ProgramExit(NDBT_FAILED); + } else if (waitClusterStatus(_hostName) != 0) return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_OK); @@ -121,7 +129,8 @@ getStatus(){ retries++; continue; } - for (int i = 0; i < status->no_of_nodes; i++){ + int count = status->no_of_nodes; + for (int i = 0; i < count; i++){ node = &status->node_states[i]; switch(node->node_type){ case NDB_MGM_NODE_TYPE_NDB: @@ -142,7 +151,7 @@ getStatus(){ apiNodes.clear(); free(status); status = NULL; - i = status->no_of_nodes; + count = 0; ndbout << "kalle"<< endl; break; @@ -164,9 +173,10 @@ getStatus(){ } int -waitClusterStarted(const char* _addr, unsigned int _timeout) +waitClusterStatus(const char* _addr, + ndb_mgm_node_status _status, + unsigned int _timeout) { - ndb_mgm_node_status _status = NDB_MGM_NODE_STATUS_STARTED; int _startphase = -1; int _nodes[MAX_NDB_NODES]; @@ -290,10 +300,12 @@ waitClusterStarted(const char* _addr, unsigned int _timeout) allInState = false; } } - g_info << "Waiting for cluster enter state" + g_info << "Waiting for cluster enter state " << ndb_mgm_get_node_status_string(_status)<< endl; NdbSleep_SecSleep(1); attempts++; } return 0; } + +template class Vector<ndb_mgm_node_state>; |