summaryrefslogtreecommitdiff
path: root/ndb/test
diff options
context:
space:
mode:
Diffstat (limited to 'ndb/test')
-rw-r--r--ndb/test/Makefile19
-rw-r--r--ndb/test/Makefile.am6
-rw-r--r--ndb/test/include/NDBT_Table.hpp69
-rw-r--r--ndb/test/include/NdbConfig.hpp19
-rw-r--r--ndb/test/include/NdbRestarter.hpp4
-rw-r--r--ndb/test/include/NdbSchemaCon.hpp147
-rw-r--r--ndb/test/include/NdbSchemaOp.hpp587
-rw-r--r--ndb/test/ndbapi/InsertRecs.cpp (renamed from ndb/test/ndbapi/telco/InsertRecs.cpp)0
-rw-r--r--ndb/test/ndbapi/Makefile.am81
-rw-r--r--ndb/test/ndbapi/Makefile_old (renamed from ndb/test/ndbapi/Makefile)3
-rw-r--r--ndb/test/ndbapi/ScanFilter.hpp (renamed from ndb/test/ndbapi/testScanInterpreter/ScanFilter.hpp)0
-rw-r--r--ndb/test/ndbapi/ScanFunctions.hpp (renamed from ndb/test/ndbapi/testScan/ScanFunctions.hpp)0
-rw-r--r--ndb/test/ndbapi/ScanInterpretTest.hpp (renamed from ndb/test/ndbapi/testScanInterpreter/ScanInterpretTest.hpp)0
-rw-r--r--ndb/test/ndbapi/TraceNdbApi.cpp (renamed from ndb/test/ndbapi/acid2/TraceNdbApi.cpp)0
-rw-r--r--ndb/test/ndbapi/VerifyNdbApi.cpp (renamed from ndb/test/ndbapi/acid2/VerifyNdbApi.cpp)0
-rw-r--r--ndb/test/ndbapi/acid.cpp (renamed from ndb/test/ndbapi/acid/acid.cpp)15
-rw-r--r--ndb/test/ndbapi/acid2.cpp (renamed from ndb/test/ndbapi/acid2/acid2.cpp)0
-rw-r--r--ndb/test/ndbapi/adoInsertRecs.cpp (renamed from ndb/test/ndbapi/telco/adoInsertRecs.cpp)0
-rw-r--r--ndb/test/ndbapi/asyncGenerator.cpp (renamed from ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp)0
-rw-r--r--ndb/test/ndbapi/bank/Bank.cpp (renamed from ndb/test/ndbapi/bank/src/Bank.cpp)2
-rw-r--r--ndb/test/ndbapi/bank/BankLoad.cpp (renamed from ndb/test/ndbapi/bank/src/BankLoad.cpp)2
-rw-r--r--ndb/test/ndbapi/bank/Makefile.am22
-rw-r--r--ndb/test/ndbapi/bank/Makefile_old (renamed from ndb/test/ndbapi/bank/Makefile)0
-rw-r--r--ndb/test/ndbapi/bank/bankCreator.cpp (renamed from ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp)2
-rw-r--r--ndb/test/ndbapi/bank/bankMakeGL.cpp (renamed from ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp)2
-rw-r--r--ndb/test/ndbapi/bank/bankSumAccounts.cpp (renamed from ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp)2
-rw-r--r--ndb/test/ndbapi/bank/bankTimer.cpp (renamed from ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp)2
-rw-r--r--ndb/test/ndbapi/bank/bankTransactionMaker.cpp (renamed from ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp)2
-rw-r--r--ndb/test/ndbapi/bank/bankValidateAllGLs.cpp (renamed from ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp)2
-rw-r--r--ndb/test/ndbapi/bank/old_dirs/bankCreator/Makefile (renamed from ndb/test/ndbapi/bank/bankCreator/Makefile)0
-rw-r--r--ndb/test/ndbapi/bank/old_dirs/bankMakeGL/Makefile (renamed from ndb/test/ndbapi/bank/bankMakeGL/Makefile)0
-rw-r--r--ndb/test/ndbapi/bank/old_dirs/bankSumAccounts/Makefile (renamed from ndb/test/ndbapi/bank/bankSumAccounts/Makefile)0
-rw-r--r--ndb/test/ndbapi/bank/old_dirs/bankTimer/Makefile (renamed from ndb/test/ndbapi/bank/bankTimer/Makefile)0
-rw-r--r--ndb/test/ndbapi/bank/old_dirs/bankTransactionMaker/Makefile (renamed from ndb/test/ndbapi/bank/bankTransactionMaker/Makefile)0
-rw-r--r--ndb/test/ndbapi/bank/old_dirs/bankValidateAllGLs/Makefile (renamed from ndb/test/ndbapi/bank/bankValidateAllGLs/Makefile)0
-rw-r--r--ndb/test/ndbapi/bank/old_dirs/src/Makefile (renamed from ndb/test/ndbapi/bank/src/Makefile)0
-rw-r--r--ndb/test/ndbapi/bank/old_dirs/testBank/Makefile (renamed from ndb/test/ndbapi/bank/testBank/Makefile)0
-rw-r--r--ndb/test/ndbapi/bank/testBank.cpp (renamed from ndb/test/ndbapi/bank/testBank/testBank.cpp)2
-rw-r--r--ndb/test/ndbapi/benchronja.cpp (renamed from ndb/test/ndbapi/ronja/benchronja/benchronja.cpp)0
-rw-r--r--ndb/test/ndbapi/bulk_copy.cpp (renamed from ndb/test/ndbapi/bulk_copy/bulk_copy.cpp)0
-rw-r--r--ndb/test/ndbapi/cdrserver.cpp (renamed from ndb/test/ndbapi/vw_test/cdrserver.cpp)0
-rw-r--r--ndb/test/ndbapi/celloDb.cpp (renamed from ndb/test/ndbapi/cello-sessionDb/celloDb.cpp)0
-rw-r--r--ndb/test/ndbapi/create_all_tabs.cpp (renamed from ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp)0
-rw-r--r--ndb/test/ndbapi/create_tab.cpp (renamed from ndb/test/ndbapi/create_tab/create_tab.cpp)0
-rw-r--r--ndb/test/ndbapi/drop_all_tabs.cpp (renamed from ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp)0
-rw-r--r--ndb/test/ndbapi/flexAsynch.cpp (renamed from ndb/test/ndbapi/flexAsynch/flexAsynch.cpp)9
-rw-r--r--ndb/test/ndbapi/flexBench.cpp (renamed from ndb/test/ndbapi/flexBench/flexBench.cpp)0
-rw-r--r--ndb/test/ndbapi/flexHammer.cpp (renamed from ndb/test/ndbapi/flexHammer/flexHammer.cpp)15
-rw-r--r--ndb/test/ndbapi/flexScan.cpp (renamed from ndb/test/ndbapi/flexScan/flexScan.cpp)25
-rw-r--r--ndb/test/ndbapi/flexTT.cpp (renamed from ndb/test/ndbapi/flexTT/flexTT.cpp)5
-rw-r--r--ndb/test/ndbapi/flexTimedAsynch.cpp (renamed from ndb/test/ndbapi/flexTimedAsynch/flexTimedAsynch.cpp)0
-rw-r--r--ndb/test/ndbapi/flex_bench_mysql.cpp (renamed from ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp)0
-rw-r--r--ndb/test/ndbapi/index.cpp (renamed from ndb/test/ndbapi/indexTest/index.cpp)0
-rw-r--r--ndb/test/ndbapi/index2.cpp (renamed from ndb/test/ndbapi/indexTest2/index2.cpp)0
-rw-r--r--ndb/test/ndbapi/initronja.cpp (renamed from ndb/test/ndbapi/ronja/initronja/initronja.cpp)11
-rw-r--r--ndb/test/ndbapi/interpreterInTup.cpp (renamed from ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp)45
-rw-r--r--ndb/test/ndbapi/mainAsyncGenerator.cpp (renamed from ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp)0
-rw-r--r--ndb/test/ndbapi/msa.cpp (renamed from ndb/test/ndbapi/telco/msa.cpp)6
-rw-r--r--ndb/test/ndbapi/ndb_async1.cpp (renamed from ndb/test/ndbapi/lmc-bench/async-src/user/ndb_async1.cpp)0
-rw-r--r--ndb/test/ndbapi/ndb_async2.cpp (renamed from ndb/test/ndbapi/lmc-bench/async-src/user/ndb_async2.cpp)0
-rw-r--r--ndb/test/ndbapi/ndb_user_populate.cpp (renamed from ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp)0
-rw-r--r--ndb/test/ndbapi/ndb_user_transaction.cpp (renamed from ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction.cpp)0
-rw-r--r--ndb/test/ndbapi/ndb_user_transaction2.cpp (renamed from ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction2.cpp)0
-rw-r--r--ndb/test/ndbapi/ndb_user_transaction3.cpp (renamed from ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction3.cpp)0
-rw-r--r--ndb/test/ndbapi/ndb_user_transaction4.cpp (renamed from ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction4.cpp)0
-rw-r--r--ndb/test/ndbapi/ndb_user_transaction5.cpp (renamed from ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction5.cpp)0
-rw-r--r--ndb/test/ndbapi/ndb_user_transaction6.cpp (renamed from ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction6.cpp)0
-rw-r--r--ndb/test/ndbapi/old_dirs/acid/Makefile (renamed from ndb/test/ndbapi/acid/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/acid2/Makefile (renamed from ndb/test/ndbapi/acid2/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp (renamed from ndb/test/ndbapi/acid2/TraceNdbApi.hpp)0
-rw-r--r--ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp (renamed from ndb/test/ndbapi/acid2/VerifyNdbApi.hpp)0
-rwxr-xr-xndb/test/ndbapi/old_dirs/basicAsynch/Makefile (renamed from ndb/test/ndbapi/basicAsynch/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/bulk_copy/Makefile (renamed from ndb/test/ndbapi/bulk_copy/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile (renamed from ndb/test/ndbapi/create_all_tabs/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/create_tab/Makefile (renamed from ndb/test/ndbapi/create_tab/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile (renamed from ndb/test/ndbapi/drop_all_tabs/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/flexAsynch/Makefile (renamed from ndb/test/ndbapi/flexAsynch/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/flexBench/Makefile.am10
-rw-r--r--ndb/test/ndbapi/old_dirs/flexBench/Makefile_old (renamed from ndb/test/ndbapi/flexBench/Makefile)0
-rwxr-xr-xndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl (renamed from ndb/test/ndbapi/flexBench/ndbplot.pl)0
-rw-r--r--ndb/test/ndbapi/old_dirs/flexHammer/Makefile (renamed from ndb/test/ndbapi/flexHammer/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/flexHammer/README (renamed from ndb/test/ndbapi/flexHammer/README)0
-rw-r--r--ndb/test/ndbapi/old_dirs/flexScan/Makefile (renamed from ndb/test/ndbapi/flexScan/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/flexScan/README (renamed from ndb/test/ndbapi/flexScan/README)0
-rw-r--r--ndb/test/ndbapi/old_dirs/flexTT/Makefile (renamed from ndb/test/ndbapi/flexTT/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile (renamed from ndb/test/ndbapi/flexTimedAsynch/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile (renamed from ndb/test/ndbapi/flex_bench_mysql/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/indexTest/Makefile (renamed from ndb/test/ndbapi/indexTest/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/indexTest2/Makefile (renamed from ndb/test/ndbapi/indexTest2/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile (renamed from ndb/test/ndbapi/interpreterInTup/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/Makefile (renamed from ndb/test/ndbapi/lmc-bench/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/async-src/Makefile (renamed from ndb/test/ndbapi/lmc-bench/async-src/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/async-src/generator/Makefile (renamed from ndb/test/ndbapi/lmc-bench/async-src/generator/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h (renamed from ndb/test/ndbapi/lmc-bench/async-src/include/dbGenerator.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h (renamed from ndb/test/ndbapi/lmc-bench/async-src/include/testData.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h (renamed from ndb/test/ndbapi/lmc-bench/async-src/include/userInterface.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/Makefile (renamed from ndb/test/ndbapi/lmc-bench/async-src/user/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h (renamed from ndb/test/ndbapi/lmc-bench/async-src/user/macros.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp (renamed from ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty (renamed from ndb/test/ndbapi/lmc-bench/bin/.empty)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp (renamed from ndb/test/ndbapi/lmc-bench/include/ndb_schema.hpp)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h (renamed from ndb/test/ndbapi/lmc-bench/include/testDefinitions.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty (renamed from ndb/test/ndbapi/lmc-bench/lib/.empty)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile (renamed from ndb/test/ndbapi/lmc-bench/script/Makefile)0
-rwxr-xr-xndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l-p10.sh (renamed from ndb/test/ndbapi/lmc-bench/script/async-lmc-bench-l-p10.sh)0
-rwxr-xr-xndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l.sh (renamed from ndb/test/ndbapi/lmc-bench/script/async-lmc-bench-l.sh)0
-rwxr-xr-xndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-p10.sh (renamed from ndb/test/ndbapi/lmc-bench/script/async-lmc-bench-p10.sh)0
-rwxr-xr-xndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench.sh (renamed from ndb/test/ndbapi/lmc-bench/script/async-lmc-bench.sh)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile (renamed from ndb/test/ndbapi/lmc-bench/src/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/README (renamed from ndb/test/ndbapi/lmc-bench/src/README)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/Makefile (renamed from ndb/test/ndbapi/lmc-bench/src/generator/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c (renamed from ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h (renamed from ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c (renamed from ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h (renamed from ndb/test/ndbapi/lmc-bench/src/include/testData.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h (renamed from ndb/test/ndbapi/lmc-bench/src/include/userInterface.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.linux (renamed from ndb/test/ndbapi/lmc-bench/src/makevars.linux)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.sparc (renamed from ndb/test/ndbapi/lmc-bench/src/makevars.sparc)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/Makefile (renamed from ndb/test/ndbapi/lmc-bench/src/populator/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c (renamed from ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.h (renamed from ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/mainPopulate.c (renamed from ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/user/Makefile (renamed from ndb/test/ndbapi/lmc-bench/src/user/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/user/localDbPrepare.c (renamed from ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h (renamed from ndb/test/ndbapi/lmc-bench/src/user/macros.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp (renamed from ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/Makefile (renamed from ndb/test/ndbapi/lmc-bench/src/user/old/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h (renamed from ndb/test/ndbapi/lmc-bench/src/user/old/userHandle.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c (renamed from ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c (renamed from ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h (renamed from ndb/test/ndbapi/lmc-bench/src/user/userHandle.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp (renamed from ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp)61
-rw-r--r--ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c (renamed from ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c)0
-rw-r--r--ndb/test/ndbapi/old_dirs/restarter/Makefile (renamed from ndb/test/ndbapi/restarter/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/restarter2/Makefile (renamed from ndb/test/ndbapi/restarter2/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/restarts/Makefile (renamed from ndb/test/ndbapi/restarts/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/ronja/Makefile (renamed from ndb/test/ndbapi/ronja/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile (renamed from ndb/test/ndbapi/ronja/benchronja/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile (renamed from ndb/test/ndbapi/ronja/initronja/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/telco/Makefile (renamed from ndb/test/ndbapi/telco/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/telco/readme (renamed from ndb/test/ndbapi/telco/readme)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testBackup/Makefile (renamed from ndb/test/ndbapi/testBackup/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testBasic/Makefile (renamed from ndb/test/ndbapi/testBasic/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testBlobs/Makefile (renamed from ndb/test/ndbapi/testBlobs/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile (renamed from ndb/test/ndbapi/testDataBuffers/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testDict/Makefile (renamed from ndb/test/ndbapi/testDict/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testGrep/Makefile (renamed from ndb/test/ndbapi/testGrep/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile (renamed from ndb/test/ndbapi/testGrep/verify/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testIndex/Makefile (renamed from ndb/test/ndbapi/testIndex/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testInterpreter/Makefile (renamed from ndb/test/ndbapi/testInterpreter/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testMgm/Makefile (renamed from ndb/test/ndbapi/testMgm/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testNdbApi/Makefile (renamed from ndb/test/ndbapi/testNdbApi/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile (renamed from ndb/test/ndbapi/testNodeRestart/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testOIBasic/Makefile (renamed from ndb/test/ndbapi/testOIBasic/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testOIBasic/times.txt (renamed from ndb/test/ndbapi/testOIBasic/times.txt)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testOperations/Makefile (renamed from ndb/test/ndbapi/testOperations/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile (renamed from ndb/test/ndbapi/testOrderedIndex/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testRestartGci/Makefile (renamed from ndb/test/ndbapi/testRestartGci/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testScan/Makefile (renamed from ndb/test/ndbapi/testScan/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testScanInterpreter/Makefile (renamed from ndb/test/ndbapi/testScanInterpreter/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testSystemRestart/Makefile (renamed from ndb/test/ndbapi/testSystemRestart/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testTimeout/Makefile (renamed from ndb/test/ndbapi/testTimeout/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/testTransactions/Makefile (renamed from ndb/test/ndbapi/testTransactions/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/test_event/Makefile (renamed from ndb/test/ndbapi/test_event/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/vw_test/Makefile (renamed from ndb/test/ndbapi/vw_test/Makefile)0
-rw-r--r--ndb/test/ndbapi/old_dirs/vw_test/bcd.h (renamed from ndb/test/ndbapi/vw_test/bcd.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/vw_test/script/client_start (renamed from ndb/test/ndbapi/vw_test/script/client_start)0
-rw-r--r--ndb/test/ndbapi/old_dirs/vw_test/utv.h (renamed from ndb/test/ndbapi/vw_test/utv.h)0
-rw-r--r--ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h (renamed from ndb/test/ndbapi/vw_test/vcdrfunc.h)0
-rw-r--r--ndb/test/ndbapi/restarter.cpp (renamed from ndb/test/ndbapi/restarter/restarter.cpp)0
-rw-r--r--ndb/test/ndbapi/restarter2.cpp (renamed from ndb/test/ndbapi/restarter2/restarter2.cpp)0
-rw-r--r--ndb/test/ndbapi/restarts.cpp (renamed from ndb/test/ndbapi/restarts/restarts.cpp)0
-rw-r--r--ndb/test/ndbapi/size.cpp (renamed from ndb/test/ndbapi/vw_test/size.cpp)0
-rw-r--r--ndb/test/ndbapi/testBackup.cpp (renamed from ndb/test/ndbapi/testBackup/testBackup.cpp)3
-rw-r--r--ndb/test/ndbapi/testBasic.cpp (renamed from ndb/test/ndbapi/testBasic/testBasic.cpp)0
-rw-r--r--[-rwxr-xr-x]ndb/test/ndbapi/testBasicAsynch.cpp (renamed from ndb/test/ndbapi/basicAsynch/testBasicAsynch.cpp)0
-rw-r--r--ndb/test/ndbapi/testBlobs.cpp1213
-rw-r--r--ndb/test/ndbapi/testBlobs/testBlobs.cpp195
-rw-r--r--ndb/test/ndbapi/testDataBuffers.cpp (renamed from ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp)6
-rw-r--r--ndb/test/ndbapi/testDict.cpp (renamed from ndb/test/ndbapi/testDict/testDict.cpp)6
-rw-r--r--ndb/test/ndbapi/testGrep.cpp (renamed from ndb/test/ndbapi/testGrep/testGrep.cpp)0
-rw-r--r--ndb/test/ndbapi/testGrepVerify.cpp (renamed from ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp)5
-rw-r--r--ndb/test/ndbapi/testIndex.cpp (renamed from ndb/test/ndbapi/testIndex/testIndex.cpp)0
-rw-r--r--ndb/test/ndbapi/testInterpreter.cpp (renamed from ndb/test/ndbapi/testInterpreter/testInterpreter.cpp)0
-rw-r--r--ndb/test/ndbapi/testMgm.cpp (renamed from ndb/test/ndbapi/testMgm/testMgm.cpp)0
-rw-r--r--ndb/test/ndbapi/testNdbApi.cpp (renamed from ndb/test/ndbapi/testNdbApi/testNdbApi.cpp)4
-rw-r--r--ndb/test/ndbapi/testNodeRestart.cpp (renamed from ndb/test/ndbapi/testNodeRestart/testNodeRestart.cpp)0
-rw-r--r--ndb/test/ndbapi/testOIBasic.cpp (renamed from ndb/test/ndbapi/testOIBasic/testOIBasic.cpp)61
-rw-r--r--ndb/test/ndbapi/testOperations.cpp (renamed from ndb/test/ndbapi/testOperations/testOperations.cpp)0
-rw-r--r--ndb/test/ndbapi/testOrderedIndex.cpp (renamed from ndb/test/ndbapi/testOrderedIndex/testOrderedIndex.cpp)0
-rw-r--r--ndb/test/ndbapi/testRestartGci.cpp (renamed from ndb/test/ndbapi/testRestartGci/testRestartGci.cpp)2
-rw-r--r--ndb/test/ndbapi/testScan.cpp (renamed from ndb/test/ndbapi/testScan/testScan.cpp)91
-rw-r--r--ndb/test/ndbapi/testScanInterpreter.cpp (renamed from ndb/test/ndbapi/testScanInterpreter/testScanInterpreter.cpp)20
-rw-r--r--ndb/test/ndbapi/testScanPerf/Makefile9
-rw-r--r--ndb/test/ndbapi/testScanPerf/testScanPerf.cpp368
-rw-r--r--ndb/test/ndbapi/testSystemRestart.cpp (renamed from ndb/test/ndbapi/testSystemRestart/testSystemRestart.cpp)247
-rw-r--r--ndb/test/ndbapi/testTimeout.cpp (renamed from ndb/test/ndbapi/testTimeout/testTimeout.cpp)12
-rw-r--r--ndb/test/ndbapi/testTransactions.cpp (renamed from ndb/test/ndbapi/testTransactions/testTransactions.cpp)0
-rw-r--r--ndb/test/ndbapi/test_event.cpp (renamed from ndb/test/ndbapi/test_event/test_event.cpp)0
-rw-r--r--ndb/test/ndbapi/userInterface.cpp (renamed from ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp)0
-rw-r--r--ndb/test/newtonapi/Makefile8
-rw-r--r--ndb/test/odbc/Makefile13
-rw-r--r--ndb/test/odbc/driver/testOdbcDriver.cpp2
-rw-r--r--ndb/test/run-test/Makefile.am18
-rw-r--r--ndb/test/run-test/Makefile_old (renamed from ndb/test/run-test/Makefile)0
-rw-r--r--ndb/test/run-test/README43
-rw-r--r--ndb/test/run-test/atrt-example.tgzbin0 -> 2196 bytes
-rw-r--r--ndb/test/run-test/basic.txt763
-rw-r--r--ndb/test/run-test/main.cpp150
-rwxr-xr-xndb/test/run-test/make-html-reports.sh406
-rw-r--r--ndb/test/src/Makefile.am20
-rw-r--r--ndb/test/src/Makefile_old (renamed from ndb/test/src/Makefile)8
-rw-r--r--ndb/test/src/NDBT_ResultRow.cpp74
-rw-r--r--ndb/test/src/NDBT_Table.cpp128
-rw-r--r--ndb/test/src/NdbBackup.cpp33
-rw-r--r--ndb/test/src/NdbConfig.cpp131
-rw-r--r--ndb/test/src/NdbRestarter.cpp13
-rw-r--r--ndb/test/src/NdbSchemaCon.cpp169
-rw-r--r--ndb/test/src/NdbSchemaOp.cpp220
-rw-r--r--ndb/test/src/UtilTransactions.cpp4
-rw-r--r--ndb/test/tools/Makefile.am31
-rw-r--r--ndb/test/tools/Makefile_old (renamed from ndb/test/tools/Makefile)0
-rw-r--r--ndb/test/tools/copy_tab.cpp99
-rw-r--r--ndb/test/tools/cpcc.cpp349
-rw-r--r--ndb/test/tools/create_index.cpp95
-rw-r--r--ndb/test/tools/hugoCalculator.cpp (renamed from ndb/test/tools/hugoCalculator/hugoCalculator.cpp)0
-rw-r--r--ndb/test/tools/hugoFill.cpp (renamed from ndb/test/tools/hugoFill/hugoFill.cpp)0
-rw-r--r--ndb/test/tools/hugoLoad.cpp (renamed from ndb/test/tools/hugoLoad/hugoLoad.cpp)0
-rw-r--r--ndb/test/tools/hugoLockRecords.cpp (renamed from ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp)0
-rw-r--r--ndb/test/tools/hugoPkDelete.cpp (renamed from ndb/test/tools/hugoPkDelete/hugoPkDel.cpp)0
-rw-r--r--ndb/test/tools/hugoPkRead.cpp (renamed from ndb/test/tools/hugoPkRead/hugoPkRead.cpp)0
-rw-r--r--ndb/test/tools/hugoPkReadRecord.cpp (renamed from ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp)0
-rw-r--r--ndb/test/tools/hugoPkUpdate.cpp (renamed from ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp)0
-rw-r--r--ndb/test/tools/hugoScanRead.cpp (renamed from ndb/test/tools/hugoScanRead/hugoScanRead.cpp)0
-rw-r--r--ndb/test/tools/hugoScanUpdate.cpp (renamed from ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp)0
-rw-r--r--ndb/test/tools/old_dirs/hugoCalculator/Makefile (renamed from ndb/test/tools/hugoCalculator/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/hugoFill/Makefile (renamed from ndb/test/tools/hugoFill/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/hugoLoad/Makefile (renamed from ndb/test/tools/hugoLoad/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/hugoLockRecords/Makefile (renamed from ndb/test/tools/hugoLockRecords/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/hugoPkDelete/Makefile (renamed from ndb/test/tools/hugoPkDelete/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/hugoPkRead/Makefile (renamed from ndb/test/tools/hugoPkRead/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/hugoPkReadRecord/Makefile (renamed from ndb/test/tools/hugoPkReadRecord/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/hugoPkUpdate/Makefile (renamed from ndb/test/tools/hugoPkUpdate/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/hugoScanRead/Makefile (renamed from ndb/test/tools/hugoScanRead/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/hugoScanUpdate/Makefile (renamed from ndb/test/tools/hugoScanUpdate/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/restart/Makefile (renamed from ndb/test/tools/restart/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/transproxy/Makefile29
-rw-r--r--ndb/test/tools/old_dirs/verify_index/Makefile9
-rw-r--r--ndb/test/tools/old_dirs/waiter/Makefile_old (renamed from ndb/test/tools/waiter/Makefile)0
-rw-r--r--ndb/test/tools/old_dirs/waiter/waiter.cpp (renamed from ndb/test/tools/waiter/waiter.cpp)0
-rw-r--r--ndb/test/tools/restart.cpp (renamed from ndb/test/tools/restart/restart.cpp)0
-rw-r--r--ndb/test/tools/transproxy.cpp362
-rw-r--r--ndb/test/tools/verify_index.cpp85
253 files changed, 5552 insertions, 1129 deletions
diff --git a/ndb/test/Makefile b/ndb/test/Makefile
deleted file mode 100644
index 19472917560..00000000000
--- a/ndb/test/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-include .defs.mk
-
-DIRS := src tools ndbapi run-test
-
-EXTRA_DIRS = newtonapi
-
-ifeq ($(NDB_ARCH), x86_64)
-EXTRA_DIRS =
-endif
-
-DIRS += $(EXTRA_DIRS)
-
-ifneq ($(NDB_ODBC),N)
-DIRS += odbc
-endif
-
-include $(NDB_TOP)/Epilogue.mk
-
-_bins_ndbapi : _libs_src
diff --git a/ndb/test/Makefile.am b/ndb/test/Makefile.am
new file mode 100644
index 00000000000..2e0f30df9d4
--- /dev/null
+++ b/ndb/test/Makefile.am
@@ -0,0 +1,6 @@
+SUBDIRS = src tools ndbapi run-test
+
+EXTRA_DIST = include
+
+dist-hook:
+ -rm -rf `find $(distdir) -type d -name SCCS`
diff --git a/ndb/test/include/NDBT_Table.hpp b/ndb/test/include/NDBT_Table.hpp
index 950c1f15ff7..eee76773106 100644
--- a/ndb/test/include/NDBT_Table.hpp
+++ b/ndb/test/include/NDBT_Table.hpp
@@ -25,66 +25,6 @@
class NDBT_Attribute : public NdbDictionary::Column {
friend class NdbOut& operator <<(class NdbOut&, const NDBT_Attribute &);
public:
- NDBT_Attribute(const char* anAttrName,
- AttrType type,
- int sz = 4,
- KeyType key = NoKey,
- bool nullable = false,
- StorageAttributeType indexOnly = NormalStorageAttribute,
- StorageMode _sm = MMBased) :
- NdbDictionary::Column(anAttrName)
- {
- assert(anAttrName != 0);
-
- setNullable(nullable);
- setIndexOnlyStorage(indexOnly == IndexStorageAttribute);
- setPrimaryKey(key != NoKey);
- setTupleKey(key == TupleId);
- setLength(1);
- switch(type){
- case ::Signed:
- if(sz == 8)
- setType(NdbDictionary::Column::Bigint);
- else if (sz == 4)
- setType(NdbDictionary::Column::Int);
- else {
- setType(NdbDictionary::Column::Int);
- setLength(sz);
- }
- break;
-
- case ::UnSigned:
- if(sz == 8)
- setType(NdbDictionary::Column::Bigunsigned);
- else if (sz == 4)
- setType(NdbDictionary::Column::Unsigned);
- else {
- setType(NdbDictionary::Column::Unsigned);
- setLength(sz);
- }
- break;
-
- case ::Float:
- if(sz == 8)
- setType(NdbDictionary::Column::Double);
- else if (sz == 4)
- setType(NdbDictionary::Column::Float);
- else{
- setType(NdbDictionary::Column::Float);
- setLength(sz);
- }
- break;
-
- case ::String:
- setType(NdbDictionary::Column::Char);
- setLength(sz);
- break;
-
- case ::NoAttrTypeDef:
- break;
- }
- }
-
NDBT_Attribute(const char* _name,
Column::Type _type,
int _length = 1,
@@ -132,4 +72,13 @@ NDBT_Table::discoverTableFromDb(Ndb* ndb, const char * name){
return ndb->getDictionary()->getTable(name);
}
+
+/**
+ * Print meta information about index
+ * (information on how it is strored, what the attributes look like etc.)
+ */
+class NdbOut& operator <<(class NdbOut&, const NdbDictionary::Index &);
+
+
+
#endif
diff --git a/ndb/test/include/NdbConfig.hpp b/ndb/test/include/NdbConfig.hpp
index f13872f4d64..19439fafbb2 100644
--- a/ndb/test/include/NdbConfig.hpp
+++ b/ndb/test/include/NdbConfig.hpp
@@ -17,29 +17,22 @@
#ifndef NDBT_CONFIG_HPP
#define NDBT_CONFIG_HPP
+#include <ndb_types.h>
#include <mgmapi.h>
#include <Vector.hpp>
#include <NdbRestarter.hpp>
-#include <Properties.hpp>
+#include <mgmapi_config_parameters.h>
-class NdbConfig : public NdbRestarter{
+class NdbConfig : public NdbRestarter {
public:
NdbConfig(int own_id, const char* addr = 0)
: NdbRestarter(addr),
ownNodeId(own_id) {};
- bool getProperty(unsigned int node_id, const char* type,
- const char * name, Uint32 * value) const;
- bool getProperty(unsigned int node_id, const char* type,
- const char * name, const char ** value) const;
-
- bool getHostName(unsigned int node_id,
- const char ** hostname) const;
-protected:
- bool getPropsForNode(unsigned int node_id,
- const char* type,
- const Properties ** props) const;
+ bool getProperty(unsigned nodeid, unsigned type, unsigned key, Uint32 * val);
+ bool getHostName(unsigned int node_id, const char ** hostname);
+ //protected:
int ownNodeId;
};
diff --git a/ndb/test/include/NdbRestarter.hpp b/ndb/test/include/NdbRestarter.hpp
index cfd5409bb69..b4c29a87eff 100644
--- a/ndb/test/include/NdbRestarter.hpp
+++ b/ndb/test/include/NdbRestarter.hpp
@@ -89,7 +89,9 @@ protected:
const char* host;
int port;
NdbMgmHandle handle;
-
+ ndb_mgm_configuration * m_config;
+protected:
+ ndb_mgm_configuration * getConfig();
};
#endif
diff --git a/ndb/test/include/NdbSchemaCon.hpp b/ndb/test/include/NdbSchemaCon.hpp
new file mode 100644
index 00000000000..313daf0094b
--- /dev/null
+++ b/ndb/test/include/NdbSchemaCon.hpp
@@ -0,0 +1,147 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef NdbSchemaCon_H
+#define NdbSchemaCon_H
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+
+#include <ndb_types.h>
+#include "NdbError.hpp"
+#include <NdbSchemaOp.hpp>
+
+class NdbSchemaOp;
+class Ndb;
+class NdbApiSignal;
+
+/**
+ * @class NdbSchemaCon
+ * @brief Represents a schema transaction.
+ *
+ * When creating a new table,
+ * the first step is to get a NdbSchemaCon object to represent
+ * the schema transaction.
+ * This is done by calling Ndb::startSchemaTransaction.
+ *
+ * The next step is to get a NdbSchemaOp object by calling
+ * NdbSchemaCon::getNdbSchemaOp.
+ * The NdbSchemaOp object then has methods to define the table and
+ * its attributes.
+ *
+ * Finally, the NdbSchemaCon::execute method inserts the table
+ * into the database.
+ *
+ * @note Currently only one table can be added per transaction.
+ * @note Depricated, use NdbDictionary
+ */
+class NdbSchemaCon
+{
+friend class Ndb;
+friend class NdbSchemaOp;
+
+public:
+
+ static
+ NdbSchemaCon* startSchemaTrans(Ndb* pNdb){
+ return new NdbSchemaCon(pNdb);
+ }
+
+ static
+ void closeSchemaTrans(NdbSchemaCon* pSchCon){
+ delete pSchCon;
+ }
+
+
+ /**
+ * Execute a schema transaction.
+ *
+ * @return 0 if successful otherwise -1.
+ */
+ int execute();
+
+ /**
+ * Get a schemaoperation.
+ *
+ * @note Currently, only one operation per transaction is allowed.
+ *
+ * @return Pointer to a NdbSchemaOp or NULL if unsuccessful.
+ */
+ NdbSchemaOp* getNdbSchemaOp();
+
+ /**
+ * Get the latest error
+ *
+ * @return Error object.
+ */
+ const NdbError & getNdbError() const;
+
+private:
+
+/******************************************************************************
+ * These are the create and delete methods of this class.
+ *****************************************************************************/
+
+ NdbSchemaCon(Ndb* aNdb);
+ ~NdbSchemaCon();
+
+/******************************************************************************
+ * These are the private methods of this class.
+ *****************************************************************************/
+
+ void release(); // Release all schemaop in schemaCon
+
+ /***************************************************************************
+ * These methods are service methods to other classes in the NDBAPI.
+ ***************************************************************************/
+
+ int checkMagicNumber(); // Verify correct object
+ int receiveDICTTABCONF(NdbApiSignal* aSignal);
+ int receiveDICTTABREF(NdbApiSignal* aSignal);
+
+
+ int receiveCREATE_INDX_CONF(NdbApiSignal*);
+ int receiveCREATE_INDX_REF(NdbApiSignal*);
+ int receiveDROP_INDX_CONF(NdbApiSignal*);
+ int receiveDROP_INDX_REF(NdbApiSignal*);
+
+
+/*****************************************************************************
+ * These are the private variables of this class.
+ *****************************************************************************/
+
+
+ NdbError theError; // Errorcode
+ Ndb* theNdb; // Pointer to Ndb object
+
+ NdbSchemaOp* theFirstSchemaOpInList; // First operation in operation list.
+ int theMagicNumber; // Magic number
+};
+
+inline
+int
+NdbSchemaCon::checkMagicNumber()
+{
+ if (theMagicNumber != 0x75318642)
+ return -1;
+ return 0;
+}//NdbSchemaCon::checkMagicNumber()
+
+
+
+#endif
+#endif
+
+
diff --git a/ndb/test/include/NdbSchemaOp.hpp b/ndb/test/include/NdbSchemaOp.hpp
new file mode 100644
index 00000000000..43f76c8c253
--- /dev/null
+++ b/ndb/test/include/NdbSchemaOp.hpp
@@ -0,0 +1,587 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef NdbSchemaOp_H
+#define NdbSchemaOp_H
+
+#include <NdbDictionary.hpp>
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+
+ /**
+ * Type of attribute
+ *
+ * NOTE! AttrType is deprecated, use NdbDictionary::Column::Type instead!
+ */
+ enum AttrType {
+ Signed, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::int64_value,
+ ///< NdbRecAttr::int32_value,
+ ///< NdbRecAttr::short_value,
+ ///< NdbRecAttr::char_value
+ UnSigned, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::u_64_value,
+ ///< NdbRecAttr::u_32_value,
+ ///< NdbRecAttr::u_short_value,
+ ///< NdbRecAttr::u_char_value
+ Float, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::float_value and
+ ///< NdbRecAttr::double_value
+ String, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::aRef,
+ ///< NdbRecAttr::getAttributeObject
+ NoAttrTypeDef ///< Used for debugging only
+ };
+
+
+ /**
+ * @deprecated
+ */
+ enum NullAttributeType {
+ NoNullTypeDefined = -1,
+ NotNullAttribute,
+ NullAttribute,
+ AttributeDefined
+ };
+ /**
+ * Indicates whether the attribute is part of a primary key or not
+ */
+ enum KeyType {
+ Undefined = -1, ///< Used for debugging only
+ NoKey, ///< Attribute is not part of primary key
+ ///< or tuple identity
+ TupleKey, ///< Attribute is part of primary key
+ TupleId ///< Attribute is part of tuple identity
+ ///< (This type of attribute is created
+ ///< internally, and should not be
+ ///< manually created.)
+ };
+ /**
+ * Indicate whether the attribute should be stored on disk or not
+ */
+ enum StorageMode {
+ MMBased = 0, ///< Main memory
+ DiskBased = 1, ///< Disk (Not yet supported.)
+ NoStorageTypeDef ///< Used for debugging only
+ };
+
+ /**
+ * Where attribute is stored.
+ *
+ * This is used to indicate whether a primary key
+ * should only be stored in the index storage and not in the data storage
+ * or if it should be stored in both places.
+ * The first alternative makes the attribute take less space,
+ * but makes it impossible to scan using attribute.
+ *
+ * @note Use NormalStorageAttribute for most cases.
+ * (IndexStorageAttribute should only be used on primary key
+ * attributes and only if you do not want to scan using the attribute.)
+ */
+ enum StorageAttributeType {
+ NoStorageAttributeTypeDefined = -1, ///< <i>Missing explanation</i>
+ IndexStorageAttribute, ///< Attribute is only stored in
+ ///< index storage (ACC)
+ NormalStorageAttribute ///< Attribute values are stored
+ ///< both in the index (ACC) and
+ ///< in the data storage (TUP)
+ };
+
+
+ /**
+ * Type of fragmentation used for a table
+ */
+ enum FragmentType {
+ Default = 0, ///< (All is default!)
+ Single = 1, ///< Only one fragment
+ All = 2, ///< Default value. One fragment per node group
+ DistributionGroup = 3, ///< Distribution Group used for fragmentation.
+ ///< One fragment per node group
+ DistributionKey = 4, ///< Distribution Key used for fragmentation.
+ ///< One fragment per node group.
+ AllLarge = 5, ///< Sixten fragments per node group.
+ DGroupLarge = 6, ///< Distribution Group used for fragmentation.
+ ///< Sixten fragments per node group
+ DKeyLarge = 7 ///< Distribution Key used for fragmentation.
+ ///< Sixten fragments per node group
+ };
+
+ /**
+ * Type of table or index.
+ */
+ enum TableType {
+ UndefTableType = 0,
+ SystemTable = 1, ///< Internal.Table cannot be updated by user
+ UserTable = 2, ///< Normal application table
+ UniqueHashIndex = 3, ///< Unique un-ordered hash index
+ HashIndex = 4, ///< Non-unique un-ordered hash index
+ UniqueOrderedIndex = 5, ///< Unique ordered index
+ OrderedIndex = 6 ///< Non-unique ordered index
+ };
+
+
+class NdbSchemaCon;
+class Ndb;
+
+
+/**
+ * @class NdbSchemaOp
+ * @brief Represents various operations for use in schema transactions
+ *
+ * This class is used for schema operations, e.g. creating tables and
+ * attributes.
+ *
+ * The NdbSchemaOp object is created using NdbSchemaCon::getNdbSchemaOp.
+ *
+ * @note This class is depricated and is now replaced with the class
+ * NdbDictionary.
+ */
+class NdbSchemaOp
+{
+ friend class Ndb;
+ friend class NdbSchemaCon;
+
+public:
+
+
+ /**
+ * Create a new table in the database.
+ *
+ * @note The NdbSchemaCon should be closed with
+ * Ndb::closeSchemaTransaction, even if this method fails.
+ *
+ * @param aTableName Table name. Should not be NULL.
+ * @param aTableSize (Performance parameter.)
+ * Initial size of the data part of the table
+ * expressed in kByte.
+ * The database handles
+ * bad parameter setting but at a certain
+ * loss in performance.
+ * The size given here is
+ * the initial size allocated for the table
+ * storage (the data part).
+ * When calculating the data storage one should
+ * add the size of all attributes (each attribute
+ * consumes at least 4 bytes) and also an overhead
+ * of 12 byte.
+ * Variable size attributes (not supported yet)
+ * will have a size of 12 bytes plus the actual
+ * data storage parts where there is an
+ * additional overhead based on the size of the
+ * variable part.
+ * <br>
+ * An example table with 5 attributes:
+ * one 64 bit attribute, one 32 bit attribute,
+ * two 16 bit attributes and one array of 64 8 bits.
+ * This table will consume
+ * 12 (overhead) + 8 + 4 + 2*4 (4 is minimum) + 64 =
+ * 96 bytes per record.
+ * Additionally an overhead of about 2 % as page
+ * headers and waste should be allocated.
+ * Thus, 1 million records should consume 96 MBytes
+ * plus the overhead 2 MByte and rounded up to
+ * 100 000 kBytes.
+ * <br><em>
+ * This parameter is currently not used.
+ * </em>
+ * @param aTupleKey Indicates if the table has a primary key or not.
+ * <br>
+ * <b>TupleKey</b> means that a <em>primary key</em>
+ * consisting of one to four attributes
+ * (at most one of variable size)
+ * uniquely identifies each record in the created
+ * table.
+ * <br>
+ * <b>TupleId</b> means that a <em>tuple identity</em>
+ * is used. The tuple identity is
+ * a unique key indentifying each record of the
+ * created table.
+ * The tuple identity is a (non-stored)
+ * 64 bit attribute named <b>NDB$TID</b>.
+ * <br>
+ * When inserting a record (tuple), the method
+ * NdbOperation::setTupleId
+ * will generate a unique tuple identity
+ * and return it to the user.
+ * <br>
+ * When reading, updating or deleting a record
+ * in a table with <b>TupleId</b>,
+ * NdbOperation::equal("NDB$TID", value_Uint64)
+ * can be used to identify the record.
+ * <br>
+ * Legal values: TupleKey or TupleId.
+ * @param aNrOfPages (Performance parameter.)
+ * Specifies the initial size of the index storage.
+ * When calculating the index storage,
+ * each key has approximately 14 byte of
+ * overhead plus the size of the key.
+ * Each key attribute takes up at least 4 bytes
+ * of storage.
+ * Thus a mixed key consisting of a
+ * 64 bit attribute, a 32 bit attribute
+ * and a 16 bit attribute will
+ * consume approx. 30 bytes per key.
+ * Thus, the if initial size is to be 1 million rows,
+ * then aNrOfPages should be set to
+ * 30 M / 8k = 2670 pages.
+ * <br><em>
+ * This parameter is currently not used.
+ * </em>
+ * @param aFragmentType Type of fragmentation.<br>
+ * <b>All</b> (default) means that the
+ * table fragments are automatically
+ * distributed on all nodes in the system.<br>
+ * <b>DistributionGroup</b> and
+ * <b>DistributionKey</b> are
+ * also supported. For further details about
+ * these types see the documentation of
+ * Ndb::startTransaction.
+ * @param aKValue (Hash parameter.)
+ * Only allowed value is 6.
+ * Later implementations might add flexibility
+ * in this parameter.
+ * @param aMinLoadFactor (Hash parameter.)
+ * This value specifies the load factor when
+ * starting to shrink the hash table.
+ * It must be smaller than aMaxLoadFactor.
+ * Both these factors are given in percentage.
+ * @param aMaxLoadFactor (Hash parameter.)
+ * This value specifies the load factor when
+ * starting to split the containers in the local
+ * hash tables. 100 is the maximum which will
+ * optimize memory usage (this is the figure
+ * used for the above calculations).
+ * A lower figure will store less information in
+ * each container and thus
+ * find the key faster but consume more memory.
+ * @param aMemoryType Currently only 1 is allowed which specifies
+ * storage of table in main memory.
+ * Later 2 will be added where the table is stored
+ * completely on disk
+ * and 3 where the index is in main memory but
+ * data is on disk.
+ * If 1 is chosen an individual attribute can
+ * still be specified as a disk attribute.
+ * @param aStoredTable If set to false it indicates that the table is
+ * a temporary table and should not be logged
+ * to disk.
+ * In case of a system restart the table will still
+ * be defined and exist but will be empty.
+ * Thus no checkpointing and
+ * no logging is performed on the table.
+ * The default value is true and indicates a
+ * normal table with full checkpointing and
+ * logging activated.
+ * @return Returns 0 when successful and returns -1 otherwise.
+ */
+ int createTable( const char* aTableName,
+ Uint32 aTableSize = 8,
+ KeyType aTupleKey = TupleKey,
+ int aNrOfPages = 2,
+ FragmentType aFragmentType = All,
+ int aKValue = 6,
+ int aMinLoadFactor = 78,
+ int aMaxLoadFactor = 80,
+ int aMemoryType = 1,
+ bool aStoredTable = true);
+
+ /**
+ * This is the old function declaration, don't use.
+ *
+ * @deprecated do not use!
+ */
+ inline int createTable( const char* aTableName,
+ Uint32 aTableSize,
+ KeyType aTupleKey,
+ int aNrOfPages,
+ FragmentType aFragmentType,
+ int aKValue,
+ int aMinLoadFactor,
+ int aMaxLoadFactor,
+ int aMemoryType,
+ int aStoredTable){
+ return createTable(aTableName,
+ aTableSize,
+ aTupleKey,
+ aNrOfPages,
+ aFragmentType,
+ aKValue,
+ aMinLoadFactor,
+ aMaxLoadFactor,
+ aMemoryType,
+ (aStoredTable == 1 ? true : false));
+ }
+
+ /**
+ * Add a new attribute to a database table.
+ *
+ * Attributes can only be added to a table in the same transaction
+ * as the transaction creating the table.
+ *
+ * @note The NdbSchemaCon transaction should be closed with
+ * Ndb::closeSchemaTransaction, even if this method fails.
+ *
+ * Example creating an unsigned int attribute belonging to the primary key
+ * of the table it is created in:
+ * @code
+ * MySchemaOp->createAttribute("Attr1", // Attribute name
+ * TupleKey, // Belongs to primary key
+ * 32, // 32 bits
+ * 1, // Not an array attribute
+ * UnSigned, // Unsigned type
+ * );
+ * @endcode
+ *
+ * Example creating a string attribute belonging to the primary key
+ * of the table it is created in:
+ * @code
+ * MySchemaOp->createAttribute("Attr1", // Attribute name
+ * TupleKey, // Belongs to primary key
+ * 8, // Each character is 8 bits
+ * 12, // Max 12 chars in string
+ * String, // Attribute if of type string
+ * );
+ * @endcode
+ *
+ * A <em>distribution key</em> is a set of attributes which are used
+ * to distribute the tuples onto the NDB nodes.
+ * A <em>distribution group</em> is a part (currently 16 bits)
+ * of an attribute used to distribute the tuples onto the NDB nodes.
+ * The distribution key uses the NDB Cluster hashing function,
+ * while the distribution group uses a simpler function.
+ *
+ * @param aAttrName Attribute name. Should not be NULL.
+ * @param aTupleKey This parameter specifies whether the
+ * attribute is part of the primary key or not.
+ * Floats are not allowed in the primary key.
+ * <br>
+ * Legal values: NoKey, TupleKey
+ * @param aAttrSize Specifies the size of the elements of the
+ * attribute. (An attribute can consist
+ * of an array of elements.)
+ * <br>
+ * Legal values: 8, 16, 32, 64 and 128 bits.
+ * @param aArraySize Size of array.
+ * <br>
+ * Legal values:
+ * 0 = variable-sized array,
+ * 1 = no array, and
+ * 2- = fixed size array.
+ * <br>
+ * <em>
+ * Variable-sized array attributes are
+ * not yet supported.
+ * </em>
+ * <br>
+ * There is no upper limit of the array size
+ * for a single attribute.
+ * @param aAttrType The attribute type.
+ * This is only of interest if calculations are
+ * made within NDB.
+ * <br>
+ * Legal values: UnSigned, Signed, Float, String
+ * @param aStorageMode Main memory based or disk based attribute.<br>
+ * Legal values: MMBased, DiskBased
+ * <br>
+ * <em>
+ * Disk-based attributes are not yet supported.
+ * </em>
+ * @param nullable Set to true if NULL is a correct value for
+ * the attribute.
+ * <br>
+ * Legal values: true, false
+ * @param aStType Stored in both index and data storage or
+ * only store in index data storage.
+ * <br>
+ * This parameter is only of interest for tuple
+ * key attributes.
+ * All tuple key attributes values are always stored
+ * in the index storage part.
+ * If this parameter is set to
+ * IndexStorageAttribute, then the attribute values
+ * will <em>only</em> be stored in the index
+ * storage part and <em>not</em> in the data
+ * storage part.
+ * <br>
+ * If there will be no scans using the primary
+ * key attribute and if the size of the attribute
+ * is large, then this might be of interest.
+ * A typical example is a table where
+ * http-addresses are used as primary key.
+ * <br>
+ * Legal values: NormalStorageAttribute,
+ * IndexStorageAttribute
+ * @param aDistributionKey Sometimes it is preferable to use a subset
+ * of the primary key as the distribution key.
+ * An example is TPC-C where it might be
+ * good to use the warehouse id and district id
+ * as the distribution key.
+ * <br>
+ * Locally in the fragments the full primary key
+ * will still be used with the hashing algorithm.
+ * Set to 1 if this attribute is part of the
+ * distribution key.
+ * All distribution key attributes must be
+ * defined before
+ * any other attributes are defined.
+ * @param aDistributionGroup In other applications it is desirable to use
+ * only a part of an attribute to create the
+ * distribution key.
+ * This is applicable for some telecom
+ * applications.
+ * <br>
+ * In these situations one must provide how many
+ * bits of the attribute that is to
+ * be used as the distribution hash value.
+ * <br>
+ * This provides some control to the
+ * application of the distribution.
+ * It still needs to be part of a primary key
+ * the attribute and must be defined as the
+ * first attribute.
+ * @param aDistributionGroupNoOfBits
+ * Number of bits to use of the
+ * distribution group attribute in the
+ * distribution hash value.
+ * <br>
+ * Currently, only 16 bits is supported. It will
+ * always be the last 16 bits in the attribute
+ * which is used for the distribution group.
+ * @param aAutoIncrement Set to autoincrement attribute.
+ * @param aDefaultValue Set a default value of attribute.
+ *
+ * @return Returns 0 when successful and returns -1 otherwise.
+ ****************************************************************************/
+ int createAttribute(const char* aAttrName,
+ KeyType aTupleKey = NoKey,
+ int aAttrSize = 32,
+ int aArraySize = 1,
+ AttrType aAttrType = UnSigned,
+ StorageMode aStorageMode = MMBased,
+ bool nullable = false,
+ StorageAttributeType aStType= NormalStorageAttribute,
+ int aDistributionKey = 0,
+ int aDistributionGroup = 0,
+ int aDistributionGroupNoOfBits = 16,
+ bool aAutoIncrement = false,
+ const char* aDefaultValue = 0);
+
+ /**
+ * @deprecated do not use!
+ */
+ int createAttribute(const char* aAttrName,
+ KeyType aTupleKey,
+ int aAttrSize,
+ int aArraySize,
+ AttrType aAttrType,
+ StorageMode aStorageMode,
+ NullAttributeType aNullAttr,
+ StorageAttributeType aStType = NormalStorageAttribute,
+ int aDistributionKey = 0,
+ int aDistributionGroup = 0,
+ int aDistributionGroupNoOfBits = 16){
+ return createAttribute(aAttrName,
+ aTupleKey,
+ aAttrSize,
+ aArraySize,
+ aAttrType,
+ aStorageMode,
+ aNullAttr == NullAttribute,
+ aStType,
+ aDistributionKey,
+ aDistributionGroup,
+ aDistributionGroupNoOfBits);
+ }
+
+ const NdbError & getNdbError() const;
+
+protected:
+
+/*****************************************************************************
+ * These are the methods used to create and delete the NdbOperation objects.
+ ****************************************************************************/
+ NdbSchemaOp(Ndb* aNdb);
+
+ ~NdbSchemaOp();
+
+/******************************************************************************
+ * These methods are service routines used by the other NDBAPI classes.
+ *****************************************************************************/
+
+ void release(); // Release all memory connected
+ // to the operations object.
+
+/****************************************************************************
+ * The methods below is the execution part of the NdbSchemaOp class.
+ *****************************************************************************/
+
+ int sendRec();
+ int sendSignals(Uint32 aNodeId, bool HaveMutex);
+
+ int init(NdbSchemaCon* aSchemaCon);
+
+ /**************************************************************************
+ * These are the private variables that are defined in the operation
+ * objects.
+ **************************************************************************/
+ Ndb* theNdb; // Point back to the Ndb object.
+ NdbSchemaCon* theSchemaCon; // Point back to the connection object.
+
+
+ class NdbDictionary::Table * m_currentTable;
+};
+
+
+/**
+ * Get old attribute type from new type
+ *
+ * NOTE! attrType is deprecated, use getType instead!
+ *
+ * @return Type of attribute: { Signed, UnSigned, Float,a String }
+ */
+inline
+AttrType
+convertColumnTypeToAttrType(NdbDictionary::Column::Type _type)
+{
+
+ switch(_type){
+ case NdbDictionary::Column::Bigint:
+ case NdbDictionary::Column::Int:
+ return Signed;
+ case NdbDictionary::Column::Bigunsigned:
+ case NdbDictionary::Column::Unsigned:
+ return UnSigned;
+ case NdbDictionary::Column::Float:
+ case NdbDictionary::Column::Decimal:
+ case NdbDictionary::Column::Double:
+ return Float;
+ case NdbDictionary::Column::Char:
+ case NdbDictionary::Column::Varchar:
+ case NdbDictionary::Column::Binary:
+ case NdbDictionary::Column::Varbinary:
+ return String;
+ case NdbDictionary::Column::Datetime:
+ case NdbDictionary::Column::Timespec:
+ case NdbDictionary::Column::Undefined:
+ default:
+ return NoAttrTypeDef;
+ }
+}
+#endif
+
+#endif
+
+
diff --git a/ndb/test/ndbapi/telco/InsertRecs.cpp b/ndb/test/ndbapi/InsertRecs.cpp
index f42786d666d..f42786d666d 100644
--- a/ndb/test/ndbapi/telco/InsertRecs.cpp
+++ b/ndb/test/ndbapi/InsertRecs.cpp
diff --git a/ndb/test/ndbapi/Makefile.am b/ndb/test/ndbapi/Makefile.am
new file mode 100644
index 00000000000..52058c306fb
--- /dev/null
+++ b/ndb/test/ndbapi/Makefile.am
@@ -0,0 +1,81 @@
+
+SUBDIRS = bank
+
+ndbtest_PROGRAMS = \
+flexBench \
+drop_all_tabs \
+create_all_tabs \
+create_tab \
+flexAsynch \
+flexBench \
+flexHammer \
+flexScan \
+flexTT \
+testBackup \
+testBasic \
+testBasicAsynch \
+testBlobs \
+testDataBuffers \
+testDict \
+testIndex \
+testMgm \
+testNdbApi \
+testNodeRestart \
+testOIBasic \
+testOperations \
+testRestartGci \
+testScan \
+testScanInterpreter \
+testSystemRestart \
+testTimeout \
+testTransactions \
+test_event
+
+#flexTimedAsynch
+#testBlobs
+#flex_bench_mysql
+
+create_all_tabs_SOURCES = create_all_tabs.cpp
+create_tab_SOURCES = create_tab.cpp
+drop_all_tabs_SOURCES = drop_all_tabs.cpp
+flexAsynch_SOURCES = flexAsynch.cpp
+flexBench_SOURCES = flexBench.cpp
+flexHammer_SOURCES = flexHammer.cpp
+flexScan_SOURCES = flexScan.cpp
+flexTT_SOURCES = flexTT.cpp
+#flexTimedAsynch_SOURCES = flexTimedAsynch.cpp
+#flex_bench_mysql_SOURCES = flex_bench_mysql.cpp
+testBackup_SOURCES = testBackup.cpp
+testBasic_SOURCES = testBasic.cpp
+testBasicAsynch_SOURCES = testBasicAsynch.cpp
+testBlobs_SOURCES = testBlobs.cpp
+testDataBuffers_SOURCES = testDataBuffers.cpp
+testDict_SOURCES = testDict.cpp
+testIndex_SOURCES = testIndex.cpp
+testMgm_SOURCES = testMgm.cpp
+testNdbApi_SOURCES = testNdbApi.cpp
+testNodeRestart_SOURCES = testNodeRestart.cpp
+testOIBasic_SOURCES = testOIBasic.cpp
+testOperations_SOURCES = testOperations.cpp
+testRestartGci_SOURCES = testRestartGci.cpp
+testScan_SOURCES = testScan.cpp
+testScanInterpreter_SOURCES = testScanInterpreter.cpp
+testSystemRestart_SOURCES = testSystemRestart.cpp
+testTimeout_SOURCES = testTimeout.cpp
+testTransactions_SOURCES = testTransactions.cpp
+test_event_SOURCES = test_event.cpp
+
+INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel
+
+include $(top_srcdir)/ndb/config/common.mk.am
+include $(top_srcdir)/ndb/config/type_ndbapitest.mk.am
+
+##testDict_INCLUDES = $(INCLUDES) -I$(top_srcdir)/ndb/include/kernel
+##testIndex_INCLUDES = $(INCLUDES) -I$(top_srcdir)/ndb/include/kernel
+##testSystemRestart_INCLUDES = $(INCLUDES) -I$(top_srcdir)/ndb/include/kernel
+##testTransactions_INCLUDES = $(INCLUDES) -I$(top_srcdir)/ndb/include/kernel
+testBackup_LDADD = $(LDADD) bank/libbank.a
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
+
diff --git a/ndb/test/ndbapi/Makefile b/ndb/test/ndbapi/Makefile_old
index 91f0c84c18e..34761e1eb9c 100644
--- a/ndb/test/ndbapi/Makefile
+++ b/ndb/test/ndbapi/Makefile_old
@@ -37,7 +37,8 @@ BIN_DIRS = \
indexTest \
test_event \
indexTest2 \
- testGrep
+ testGrep \
+ testBlobs
ifeq ($(NDB_OS), SOLARIS)
ifeq ($(NDB_COMPILER), FORTE6)
diff --git a/ndb/test/ndbapi/testScanInterpreter/ScanFilter.hpp b/ndb/test/ndbapi/ScanFilter.hpp
index 09786756798..09786756798 100644
--- a/ndb/test/ndbapi/testScanInterpreter/ScanFilter.hpp
+++ b/ndb/test/ndbapi/ScanFilter.hpp
diff --git a/ndb/test/ndbapi/testScan/ScanFunctions.hpp b/ndb/test/ndbapi/ScanFunctions.hpp
index 36d01909861..36d01909861 100644
--- a/ndb/test/ndbapi/testScan/ScanFunctions.hpp
+++ b/ndb/test/ndbapi/ScanFunctions.hpp
diff --git a/ndb/test/ndbapi/testScanInterpreter/ScanInterpretTest.hpp b/ndb/test/ndbapi/ScanInterpretTest.hpp
index 3862de34111..3862de34111 100644
--- a/ndb/test/ndbapi/testScanInterpreter/ScanInterpretTest.hpp
+++ b/ndb/test/ndbapi/ScanInterpretTest.hpp
diff --git a/ndb/test/ndbapi/acid2/TraceNdbApi.cpp b/ndb/test/ndbapi/TraceNdbApi.cpp
index bd43b15f2e6..bd43b15f2e6 100644
--- a/ndb/test/ndbapi/acid2/TraceNdbApi.cpp
+++ b/ndb/test/ndbapi/TraceNdbApi.cpp
diff --git a/ndb/test/ndbapi/acid2/VerifyNdbApi.cpp b/ndb/test/ndbapi/VerifyNdbApi.cpp
index 79645827e2c..79645827e2c 100644
--- a/ndb/test/ndbapi/acid2/VerifyNdbApi.cpp
+++ b/ndb/test/ndbapi/VerifyNdbApi.cpp
diff --git a/ndb/test/ndbapi/acid/acid.cpp b/ndb/test/ndbapi/acid.cpp
index 49961531a1c..157b3c7b3ef 100644
--- a/ndb/test/ndbapi/acid/acid.cpp
+++ b/ndb/test/ndbapi/acid.cpp
@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbApi.hpp>
+#include <NdbSchemaCon.hpp>
#include <NdbMutex.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
@@ -230,7 +231,6 @@ extern "C" void* NdbThreadFuncInsert(void* pArg)
VerifyMethodInt(pNdbOperationW, setValue(c_szWarehouseSum, nWarehouseSum));
int iExec = pNdbConnection->execute(Commit);
int iError = pNdbConnection->getNdbError().code;
- CommitStatusType cs = pNdbConnection->commitStatus();
if(iExec<0 && iError!=0 && iError!=266 && iError!=630) {
ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__);
@@ -285,7 +285,6 @@ extern "C" void* NdbThreadFuncUpdate(void* pArg)
VerifyMethodInt(pNdbOperationW, setValue(c_szWarehouseSum, nWarehouseSum));
int iExec = pNdbConnection->execute(Commit);
int iError = pNdbConnection->getNdbError().code;
- CommitStatusType cs = pNdbConnection->commitStatus();
if(iExec<0 && iError!=0 && iError!=266 && iError!=626) {
ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__);
@@ -333,7 +332,6 @@ extern "C" void* NdbThreadFuncDelete(void* pArg)
}
int iExec = pNdbConnection->execute(Commit);
int iError = pNdbConnection->getNdbError().code;
- CommitStatusType cs = pNdbConnection->commitStatus();
if(iExec<0 && iError!=0 && iError!=266 && iError!=626) {
ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__);
@@ -389,7 +387,7 @@ extern "C" void* NdbThreadFuncRead(void* pArg)
}
int iExec = pNdbConnection->execute(Commit);
int iError = pNdbConnection->getNdbError().code;
- CommitStatusType cs = pNdbConnection->commitStatus();
+
if(iExec<0 && iError!=0 && iError!=266 && iError!=626) {
ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__);
}
@@ -465,8 +463,7 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535)
VerifyMethodInt(pNdb, init());
VerifyMethodInt(pNdb, waitUntilReady());
- NdbSchemaCon* pNdbSchemaCon = NULL ;
- VerifyMethodPtr(pNdbSchemaCon, pNdb, startSchemaTransaction());
+ NdbSchemaCon* pNdbSchemaCon= NdbSchemaCon::startSchemaTrans(pNdb);
if(!pNdbSchemaCon){
ndbout <<"startSchemaTransaction failed, exiting now" << endl ;
delete pNdb ;
@@ -497,9 +494,9 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535)
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szWarehouseSum, NoKey, 32, 1, UnSigned, MMBased, false));
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szWarehouseCount, NoKey, 32, 1, UnSigned, MMBased, false));
VerifyMethodInt(pNdbSchemaCon, execute());
- VerifyMethodVoid(pNdb, closeSchemaTransaction(pNdbSchemaCon));
+ NdbSchemaCon::closeSchemaTrans(pNdbSchemaCon);
- VerifyMethodPtr(pNdbSchemaCon, pNdb, startSchemaTransaction());
+ pNdbSchemaCon= NdbSchemaCon::startSchemaTrans(pNdb);
VerifyMethodPtr(pNdbSchemaOp, pNdbSchemaCon, getNdbSchemaOp());
#if defined NDB_OSE || defined NDB_SOFTOSE
VerifyMethodInt(pNdbSchemaOp, createTable(
@@ -526,7 +523,7 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535)
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szDistrictSum, NoKey, 32, 1, UnSigned, MMBased, false));
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szDistrictCount, NoKey, 32, 1, UnSigned, MMBased, false));
VerifyMethodInt(pNdbSchemaCon, execute());
- VerifyMethodVoid(pNdb, closeSchemaTransaction(pNdbSchemaCon));
+ NdbSchemaCon::closeSchemaTrans(pNdbSchemaCon);
g_pNdbMutex = NdbMutex_Create();
NdbMutex_Lock(g_pNdbMutex);
diff --git a/ndb/test/ndbapi/acid2/acid2.cpp b/ndb/test/ndbapi/acid2.cpp
index 434a0450daa..434a0450daa 100644
--- a/ndb/test/ndbapi/acid2/acid2.cpp
+++ b/ndb/test/ndbapi/acid2.cpp
diff --git a/ndb/test/ndbapi/telco/adoInsertRecs.cpp b/ndb/test/ndbapi/adoInsertRecs.cpp
index 0bc67ef641b..0bc67ef641b 100644
--- a/ndb/test/ndbapi/telco/adoInsertRecs.cpp
+++ b/ndb/test/ndbapi/adoInsertRecs.cpp
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp b/ndb/test/ndbapi/asyncGenerator.cpp
index 84a93414712..84a93414712 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp
+++ b/ndb/test/ndbapi/asyncGenerator.cpp
diff --git a/ndb/test/ndbapi/bank/src/Bank.cpp b/ndb/test/ndbapi/bank/Bank.cpp
index 11ebf087fd4..14883205693 100644
--- a/ndb/test/ndbapi/bank/src/Bank.cpp
+++ b/ndb/test/ndbapi/bank/Bank.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "../Bank.hpp"
+#include "Bank.hpp"
#include <time.h>
#include <NdbSleep.h>
#include <UtilTransactions.hpp>
diff --git a/ndb/test/ndbapi/bank/src/BankLoad.cpp b/ndb/test/ndbapi/bank/BankLoad.cpp
index 985a49d5f64..76261b664a6 100644
--- a/ndb/test/ndbapi/bank/src/BankLoad.cpp
+++ b/ndb/test/ndbapi/bank/BankLoad.cpp
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "../Bank.hpp"
+#include "Bank.hpp"
#include <UtilTransactions.hpp>
/**
diff --git a/ndb/test/ndbapi/bank/Makefile.am b/ndb/test/ndbapi/bank/Makefile.am
new file mode 100644
index 00000000000..886d664aefb
--- /dev/null
+++ b/ndb/test/ndbapi/bank/Makefile.am
@@ -0,0 +1,22 @@
+
+ndbtest_PROGRAMS = testBank bankSumAccounts bankValidateAllGLs bankMakeGL bankTransactionMaker bankCreator bankTimer
+
+noinst_LIBRARIES = libbank.a
+
+libbank_a_SOURCES = Bank.cpp BankLoad.cpp Bank.hpp
+
+testBank_SOURCES = testBank.cpp
+bankSumAccounts_SOURCES = bankSumAccounts.cpp
+bankValidateAllGLs_SOURCES = bankValidateAllGLs.cpp
+bankMakeGL_SOURCES = bankMakeGL.cpp
+bankTransactionMaker_SOURCES = bankTransactionMaker.cpp
+bankCreator_SOURCES = bankCreator.cpp
+bankTimer_SOURCES = bankTimer.cpp
+
+LDADD_LOC = $(noinst_LIBRARIES)
+
+include $(top_srcdir)/ndb/config/common.mk.am
+include $(top_srcdir)/ndb/config/type_ndbapitest.mk.am
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/ndb/test/ndbapi/bank/Makefile b/ndb/test/ndbapi/bank/Makefile_old
index f710f9e6612..f710f9e6612 100644
--- a/ndb/test/ndbapi/bank/Makefile
+++ b/ndb/test/ndbapi/bank/Makefile_old
diff --git a/ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp b/ndb/test/ndbapi/bank/bankCreator.cpp
index d84818baf24..5331ec6ba69 100644
--- a/ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp
+++ b/ndb/test/ndbapi/bank/bankCreator.cpp
@@ -23,7 +23,7 @@
#include <NDBT.hpp>
#include <NdbSleep.h>
#include <getarg.h>
-#include "../Bank.hpp"
+#include "Bank.hpp"
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp b/ndb/test/ndbapi/bank/bankMakeGL.cpp
index 55e9081a598..54bc559fbf9 100644
--- a/ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp
+++ b/ndb/test/ndbapi/bank/bankMakeGL.cpp
@@ -23,7 +23,7 @@
#include <NDBT.hpp>
#include <NdbSleep.h>
#include <getarg.h>
-#include "../Bank.hpp"
+#include "Bank.hpp"
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp b/ndb/test/ndbapi/bank/bankSumAccounts.cpp
index ab3e862e8d2..c0a903f9034 100644
--- a/ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp
+++ b/ndb/test/ndbapi/bank/bankSumAccounts.cpp
@@ -23,7 +23,7 @@
#include <NDBT.hpp>
#include <NdbSleep.h>
#include <getarg.h>
-#include "../Bank.hpp"
+#include "Bank.hpp"
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp b/ndb/test/ndbapi/bank/bankTimer.cpp
index ba8de9e4af1..ba3165fccb4 100644
--- a/ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp
+++ b/ndb/test/ndbapi/bank/bankTimer.cpp
@@ -24,7 +24,7 @@
#include <NDBT.hpp>
#include <NdbSleep.h>
#include <getarg.h>
-#include "../Bank.hpp"
+#include "Bank.hpp"
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp b/ndb/test/ndbapi/bank/bankTransactionMaker.cpp
index 0c7d5d72473..fe9b53e0c8d 100644
--- a/ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp
+++ b/ndb/test/ndbapi/bank/bankTransactionMaker.cpp
@@ -24,7 +24,7 @@
#include <NDBT.hpp>
#include <NdbSleep.h>
#include <getarg.h>
-#include "../Bank.hpp"
+#include "Bank.hpp"
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp b/ndb/test/ndbapi/bank/bankValidateAllGLs.cpp
index 13136755de8..f9d974bb5f7 100644
--- a/ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp
+++ b/ndb/test/ndbapi/bank/bankValidateAllGLs.cpp
@@ -24,7 +24,7 @@
#include <NDBT.hpp>
#include <NdbSleep.h>
#include <getarg.h>
-#include "../Bank.hpp"
+#include "Bank.hpp"
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/bank/bankCreator/Makefile b/ndb/test/ndbapi/bank/old_dirs/bankCreator/Makefile
index d40103a8347..d40103a8347 100644
--- a/ndb/test/ndbapi/bank/bankCreator/Makefile
+++ b/ndb/test/ndbapi/bank/old_dirs/bankCreator/Makefile
diff --git a/ndb/test/ndbapi/bank/bankMakeGL/Makefile b/ndb/test/ndbapi/bank/old_dirs/bankMakeGL/Makefile
index 16a092e885c..16a092e885c 100644
--- a/ndb/test/ndbapi/bank/bankMakeGL/Makefile
+++ b/ndb/test/ndbapi/bank/old_dirs/bankMakeGL/Makefile
diff --git a/ndb/test/ndbapi/bank/bankSumAccounts/Makefile b/ndb/test/ndbapi/bank/old_dirs/bankSumAccounts/Makefile
index 34f1cc21bc6..34f1cc21bc6 100644
--- a/ndb/test/ndbapi/bank/bankSumAccounts/Makefile
+++ b/ndb/test/ndbapi/bank/old_dirs/bankSumAccounts/Makefile
diff --git a/ndb/test/ndbapi/bank/bankTimer/Makefile b/ndb/test/ndbapi/bank/old_dirs/bankTimer/Makefile
index a2fcf703723..a2fcf703723 100644
--- a/ndb/test/ndbapi/bank/bankTimer/Makefile
+++ b/ndb/test/ndbapi/bank/old_dirs/bankTimer/Makefile
diff --git a/ndb/test/ndbapi/bank/bankTransactionMaker/Makefile b/ndb/test/ndbapi/bank/old_dirs/bankTransactionMaker/Makefile
index 2e482898476..2e482898476 100644
--- a/ndb/test/ndbapi/bank/bankTransactionMaker/Makefile
+++ b/ndb/test/ndbapi/bank/old_dirs/bankTransactionMaker/Makefile
diff --git a/ndb/test/ndbapi/bank/bankValidateAllGLs/Makefile b/ndb/test/ndbapi/bank/old_dirs/bankValidateAllGLs/Makefile
index 660b73fb830..660b73fb830 100644
--- a/ndb/test/ndbapi/bank/bankValidateAllGLs/Makefile
+++ b/ndb/test/ndbapi/bank/old_dirs/bankValidateAllGLs/Makefile
diff --git a/ndb/test/ndbapi/bank/src/Makefile b/ndb/test/ndbapi/bank/old_dirs/src/Makefile
index e0ab8e0e536..e0ab8e0e536 100644
--- a/ndb/test/ndbapi/bank/src/Makefile
+++ b/ndb/test/ndbapi/bank/old_dirs/src/Makefile
diff --git a/ndb/test/ndbapi/bank/testBank/Makefile b/ndb/test/ndbapi/bank/old_dirs/testBank/Makefile
index 382aaadad7c..382aaadad7c 100644
--- a/ndb/test/ndbapi/bank/testBank/Makefile
+++ b/ndb/test/ndbapi/bank/old_dirs/testBank/Makefile
diff --git a/ndb/test/ndbapi/bank/testBank/testBank.cpp b/ndb/test/ndbapi/bank/testBank.cpp
index 094ecaa499c..77ac1172d7c 100644
--- a/ndb/test/ndbapi/bank/testBank/testBank.cpp
+++ b/ndb/test/ndbapi/bank/testBank.cpp
@@ -29,7 +29,7 @@
continue; }
-#include "../Bank.hpp"
+#include "Bank.hpp"
int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
Bank bank;
diff --git a/ndb/test/ndbapi/ronja/benchronja/benchronja.cpp b/ndb/test/ndbapi/benchronja.cpp
index ce0aee35e8f..ce0aee35e8f 100644
--- a/ndb/test/ndbapi/ronja/benchronja/benchronja.cpp
+++ b/ndb/test/ndbapi/benchronja.cpp
diff --git a/ndb/test/ndbapi/bulk_copy/bulk_copy.cpp b/ndb/test/ndbapi/bulk_copy.cpp
index 18881cae216..18881cae216 100644
--- a/ndb/test/ndbapi/bulk_copy/bulk_copy.cpp
+++ b/ndb/test/ndbapi/bulk_copy.cpp
diff --git a/ndb/test/ndbapi/vw_test/cdrserver.cpp b/ndb/test/ndbapi/cdrserver.cpp
index 8354d28f53f..8354d28f53f 100644
--- a/ndb/test/ndbapi/vw_test/cdrserver.cpp
+++ b/ndb/test/ndbapi/cdrserver.cpp
diff --git a/ndb/test/ndbapi/cello-sessionDb/celloDb.cpp b/ndb/test/ndbapi/celloDb.cpp
index ec61e783585..ec61e783585 100644
--- a/ndb/test/ndbapi/cello-sessionDb/celloDb.cpp
+++ b/ndb/test/ndbapi/celloDb.cpp
diff --git a/ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp b/ndb/test/ndbapi/create_all_tabs.cpp
index 55d04888144..55d04888144 100644
--- a/ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp
+++ b/ndb/test/ndbapi/create_all_tabs.cpp
diff --git a/ndb/test/ndbapi/create_tab/create_tab.cpp b/ndb/test/ndbapi/create_tab.cpp
index 8bb1e7a9572..8bb1e7a9572 100644
--- a/ndb/test/ndbapi/create_tab/create_tab.cpp
+++ b/ndb/test/ndbapi/create_tab.cpp
diff --git a/ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp b/ndb/test/ndbapi/drop_all_tabs.cpp
index 59c57396acd..59c57396acd 100644
--- a/ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp
+++ b/ndb/test/ndbapi/drop_all_tabs.cpp
diff --git a/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch.cpp
index 0822f3ee999..396ac06c87a 100644
--- a/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp
+++ b/ndb/test/ndbapi/flexAsynch.cpp
@@ -15,7 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
#include "NdbApi.hpp"
+#include <NdbSchemaCon.hpp>
#include <NdbMain.h>
#include <md5_hash.hpp>
@@ -738,7 +740,7 @@ createTables(Ndb* pMyNdb){
if (theTableCreateFlag == 0) {
for(int i=0; i < 1 ;i++) {
ndbout << "Creating " << tableName[i] << "..." << endl;
- MySchemaTransaction = pMyNdb->startSchemaTransaction();
+ MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pMyNdb);
if(MySchemaTransaction == NULL &&
(!error_handler(MySchemaTransaction->getNdbError())))
@@ -748,7 +750,8 @@ createTables(Ndb* pMyNdb){
if(MySchemaOp == NULL &&
(!error_handler(MySchemaTransaction->getNdbError())))
return -1;
-
+
+
check = MySchemaOp->createTable( tableName[i]
,8 // Table Size
,TupleKey // Key Type
@@ -793,7 +796,7 @@ createTables(Ndb* pMyNdb){
(!error_handler(MySchemaTransaction->getNdbError())))
return -1;
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
}
}
diff --git a/ndb/test/ndbapi/flexBench/flexBench.cpp b/ndb/test/ndbapi/flexBench.cpp
index 809d11086bf..809d11086bf 100644
--- a/ndb/test/ndbapi/flexBench/flexBench.cpp
+++ b/ndb/test/ndbapi/flexBench.cpp
diff --git a/ndb/test/ndbapi/flexHammer/flexHammer.cpp b/ndb/test/ndbapi/flexHammer.cpp
index 057efb31e74..c1c47923de9 100644
--- a/ndb/test/ndbapi/flexHammer/flexHammer.cpp
+++ b/ndb/test/ndbapi/flexHammer.cpp
@@ -58,6 +58,7 @@ Revision history:
#include <NdbTick.h>
#include <NdbTest.hpp>
#include <NDBT_Error.hpp>
+#include <NdbSchemaCon.hpp>
ErrorData * flexHammerErrorData;
@@ -754,7 +755,7 @@ createTables(Ndb* pMyNdb)
} // if
ndbout << endl;
- MySchemaTransaction = pMyNdb->startSchemaTransaction();
+ MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pMyNdb);
if (MySchemaTransaction == NULL) {
return(-1);
} // if
@@ -762,7 +763,7 @@ createTables(Ndb* pMyNdb)
MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if (MySchemaOp == NULL) {
// Clean up opened schema transaction
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return(-1);
} // if
@@ -787,7 +788,7 @@ createTables(Ndb* pMyNdb)
#endif
if (check == -1) {
// Clean up opened schema transaction
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return(-1);
} // if
@@ -798,7 +799,7 @@ createTables(Ndb* pMyNdb)
NotNullAttribute );
if (check == -1) {
// Clean up opened schema transaction
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return(-1);
} // if
@@ -810,7 +811,7 @@ createTables(Ndb* pMyNdb)
NotNullAttribute );
if (check == -1) {
// Clean up opened schema transaction
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return(-1);
} // if
} // for
@@ -819,11 +820,11 @@ createTables(Ndb* pMyNdb)
check = MySchemaTransaction->execute();
if (check == -1) {
// Clean up opened schema transaction
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return(-1);
} // if
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
} // for
} // if
diff --git a/ndb/test/ndbapi/flexScan/flexScan.cpp b/ndb/test/ndbapi/flexScan.cpp
index 19fb6dc5ab0..5b5b4dde730 100644
--- a/ndb/test/ndbapi/flexScan/flexScan.cpp
+++ b/ndb/test/ndbapi/flexScan.cpp
@@ -62,6 +62,7 @@
#include <NdbMain.h>
#include <NdbTest.hpp>
#include <NDBT_Error.hpp>
+#include <NdbSchemaCon.hpp>
#define PKSIZE 1
#define FOREVER 1
@@ -151,7 +152,6 @@ static void UpdateArray(int *attrValue)
int attrCount = 0;
int opCount = 0;
int sizeCount = 0;
- int Index = 0;
int* pValue = attrValue;
for (tableCount = 0; tableCount < tNoOfTables; tableCount++) {
@@ -179,7 +179,6 @@ static void Compare(int* attrValue, int* readValue)
int attrCount = 0;
int OpCount = 0;
int first = 0;
- int sizeCount = 0;
for (tableCount = 0; tableCount < tNoOfTables; tableCount++) {
for (attrCount = 0; attrCount < tNoOfAttributes-1; attrCount++) {
@@ -592,19 +591,14 @@ flexScanThread(void* ThreadData)
ThreadNdb* pThreadData = (ThreadNdb*)ThreadData;
unsigned int thread_no = pThreadData->ThreadNo;
unsigned int thread_base = (thread_no * 2000000) + (tNodeId * 26000);
- int NrOfScannedRecords = 0;
int tThreadResult = 0;
Ndb* MyNdb = NULL;
- NdbConnection *MyTransaction = NULL;
- NdbOperation* MyOperation[MAXTABLES];
int check = 0;
StartType tType = stLast;
int* pkValue = NULL;
int* attrValue = NULL;
int* readValue = NULL;
int AllocSize = 0;
- NdbRecAttr* tTmp = NULL;
- OperationType opType;
AllocSize = tNoOfTables * (tNoOfAttributes-1) * tNoOfOperations *
tAttributeSize * sizeof(int);
@@ -770,15 +764,15 @@ static int createTables(Ndb* pMyNdb)
do {
i++;
ndbout << endl << "Creating " << tableName[i - 1] << "..." << endl;
-
- MySchemaTransaction = pMyNdb->startSchemaTransaction();
+
+ MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pMyNdb);
if( MySchemaTransaction == NULL ) {
return (-1);
} // if
MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( MySchemaOp == NULL ) {
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return (-1);
} // if
@@ -800,14 +794,14 @@ static int createTables(Ndb* pMyNdb)
,40); // Nr of Pages
#endif
if (check == -1) {
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return -1;
} // if
check = MySchemaOp->createAttribute( (char*)attrName[0], TupleKey, 32, PKSIZE,
UnSigned, MMBased, NotNullAttribute );
if (check == -1) {
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return -1;
} // if
@@ -815,7 +809,7 @@ static int createTables(Ndb* pMyNdb)
check = MySchemaOp->createAttribute( (char*)attrName[j], NoKey, 32, tAttributeSize,
UnSigned, MMBased, NotNullAttribute );
if (check == -1) {
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return -1;
} // if
} // for
@@ -825,7 +819,7 @@ static int createTables(Ndb* pMyNdb)
ndbout << "Probably, " << tableName[i - 1] << " already exist" << endl;
} // if
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
} while (tNoOfTables > i);
}
@@ -1058,7 +1052,6 @@ static int insertRows(Ndb* pNdb, // NDB object
int attrCount = 0;
NdbConnection* MyTransaction = NULL;
NdbOperation* MyOperations[MAXTABLES] = {NULL};
- int Index = 0;
int opCount = 0;
for (opCount = 0; opCount < tNoOfOperations; opCount++) {
@@ -1099,7 +1092,7 @@ static int insertRows(Ndb* pNdb, // NDB object
} // if
for (attrCount = 0; attrCount < tNoOfAttributes - 1; attrCount++) {
- Index = tableCount * (tNoOfAttributes - 1) * tNoOfOperations * tAttributeSize +
+ int Index = tableCount * (tNoOfAttributes - 1) * tNoOfOperations * tAttributeSize +
attrCount * tNoOfOperations * tAttributeSize + opCount * tAttributeSize;
check = MyOperations[tableCount]->
setValue((char*)attrName[attrCount + 1],
diff --git a/ndb/test/ndbapi/flexTT/flexTT.cpp b/ndb/test/ndbapi/flexTT.cpp
index c45cbd95762..a82875de5c2 100644
--- a/ndb/test/ndbapi/flexTT/flexTT.cpp
+++ b/ndb/test/ndbapi/flexTT.cpp
@@ -18,6 +18,7 @@
#include <ndb_global.h>
#include <NdbApi.hpp>
+#include <NdbSchemaCon.hpp>
#include <NdbMain.h>
#include <md5_hash.hpp>
@@ -662,7 +663,7 @@ createTables(Ndb* pMyNdb){
if (theTableCreateFlag == 0) {
ndbout << "Creating Table: vpn_users " << "..." << endl;
- MySchemaTransaction = pMyNdb->startSchemaTransaction();
+ MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pMyNdb);
if(MySchemaTransaction == NULL &&
(!error_handler(MySchemaTransaction->getNdbError())))
@@ -748,7 +749,7 @@ createTables(Ndb* pMyNdb){
(!error_handler(MySchemaTransaction->getNdbError())))
return -1;
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
}//if
return 0;
diff --git a/ndb/test/ndbapi/flexTimedAsynch/flexTimedAsynch.cpp b/ndb/test/ndbapi/flexTimedAsynch.cpp
index 761be53fdd3..761be53fdd3 100644
--- a/ndb/test/ndbapi/flexTimedAsynch/flexTimedAsynch.cpp
+++ b/ndb/test/ndbapi/flexTimedAsynch.cpp
diff --git a/ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp b/ndb/test/ndbapi/flex_bench_mysql.cpp
index 7cc883ab3e6..7cc883ab3e6 100644
--- a/ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp
+++ b/ndb/test/ndbapi/flex_bench_mysql.cpp
diff --git a/ndb/test/ndbapi/indexTest/index.cpp b/ndb/test/ndbapi/index.cpp
index 508186de529..508186de529 100644
--- a/ndb/test/ndbapi/indexTest/index.cpp
+++ b/ndb/test/ndbapi/index.cpp
diff --git a/ndb/test/ndbapi/indexTest2/index2.cpp b/ndb/test/ndbapi/index2.cpp
index e49113d2f1b..e49113d2f1b 100644
--- a/ndb/test/ndbapi/indexTest2/index2.cpp
+++ b/ndb/test/ndbapi/index2.cpp
diff --git a/ndb/test/ndbapi/ronja/initronja/initronja.cpp b/ndb/test/ndbapi/initronja.cpp
index f3f4d9628e2..b3215104822 100644
--- a/ndb/test/ndbapi/ronja/initronja/initronja.cpp
+++ b/ndb/test/ndbapi/initronja.cpp
@@ -21,6 +21,7 @@
* *************************************************** */
#include "NdbApi.hpp"
+#include "NdbSchemaCon.hpp"
#include <NdbOut.hpp>
#include <NdbMain.h>
#include <NdbTest.hpp>
@@ -90,7 +91,7 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
ndbout << endl << "Creating the table SHORT_REC" << "..." << endl;
- MySchemaTransaction = pNdb->startSchemaTransaction();
+ MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if(!MySchemaTransaction) goto error_handler;
MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if(!MySchemaOp) goto error_handler;
@@ -148,11 +149,11 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
ndbout << "SHORT_REC created " << endl;
}// if
- pNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
ndbout << endl << "Creating the table LONG_REC..." << endl;
- MySchemaTransaction = pNdb->startSchemaTransaction();
+ MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if(!MySchemaTransaction) goto error_handler;
MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
@@ -212,7 +213,7 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
ndbout << "LONG_REC created" << endl;
}// if
- pNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
check = InsertRecords(pNdb, tNoOfRecords);
@@ -234,7 +235,7 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
error_handler:
ndbout << "SchemaTransaction returned error:" ;
ndbout << MySchemaTransaction->getNdbError() << endl;
- pNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
delete pNdb ;
NDBT_ProgramExit(NDBT_FAILED) ;
exit(-1);
diff --git a/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp b/ndb/test/ndbapi/interpreterInTup.cpp
index a2352edf707..47960cd5d12 100644
--- a/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp
+++ b/ndb/test/ndbapi/interpreterInTup.cpp
@@ -58,6 +58,7 @@
#include <NdbThread.h>
#include <NdbMutex.h>
#include <NdbApi.hpp>
+#include <NdbSchemaCon.hpp>
#include <NDBT.hpp>
#define MAXATTR 3
@@ -93,8 +94,8 @@ TTYPE t_addReg(int, NdbOperation*);
TTYPE t_subReg(int, NdbOperation*);
TTYPE t_subroutineWithBranchLabel(int, NdbOperation*);
-char tableName[MAXTABLES][MAXSTRLEN+1] = {0};
-char attrName[MAXATTR][MAXSTRLEN+1] = {0};
+char tableName[MAXSTRLEN+1];
+char attrName[MAXATTR][MAXSTRLEN+1];
int attrValue[NUMBEROFRECORDS] = {0};
int pkValue[NUMBEROFRECORDS] = {0};
const int tAttributeSize = 1 ;
@@ -105,11 +106,9 @@ int bTestPassed = 0;
int main(int argc, const char** argv) {
- int tTableId = 0;
int operationType = 0;
- int tupTest = 0 ;
- int scanTest = 0 ;
- bool loop = 0 ;
+ int tupTest = 0;
+ int scanTest = 0;
Ndb* pNdb = new Ndb("TEST_DB");
pNdb->init();
@@ -140,7 +139,7 @@ int main(int argc, const char** argv) {
setAttrNames() ;
setTableNames() ;
- const void * p = NDBT_Table::discoverTableFromDb(pNdb, tableName[0]);
+ const void * p = NDBT_Table::discoverTableFromDb(pNdb, tableName);
if (p != 0){
create_table(pNdb);
}
@@ -252,18 +251,17 @@ void create_table(Ndb* pMyNdb) {
***************************************************************/
int check = -1 ;
- NdbSchemaCon *MySchemaTransaction = NULL ;
NdbSchemaOp *MySchemaOp = NULL ;
- ndbout << endl << "Creating " << tableName[0] << " ... " << endl;
+ ndbout << endl << "Creating " << tableName << " ... " << endl;
- MySchemaTransaction = pMyNdb->startSchemaTransaction();
+ NdbSchemaCon* MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pMyNdb);
if(!MySchemaTransaction) error_handler(MySchemaTransaction->getNdbError(), NO_FAIL);
MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( !MySchemaOp ) error_handler(MySchemaTransaction->getNdbError(), NO_FAIL);
// Create table
- check = MySchemaOp->createTable( tableName[0],
+ check = MySchemaOp->createTable( tableName,
8, // Table size
TupleKey, // Key Type
40 // Nr of Pages
@@ -305,7 +303,8 @@ void create_table(Ndb* pMyNdb) {
ndbout << tableName[0] << " created" << endl;
}
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return;
@@ -333,7 +332,7 @@ void write_rows (Ndb* pMyNdb) {
error_handler(pMyNdb->getNdbError(), NO_FAIL);
}//if
- MyOperation = MyTransaction->getNdbOperation(tableName[0]);
+ MyOperation = MyTransaction->getNdbOperation(tableName);
if (!MyOperation) {
error_handler(pMyNdb->getNdbError(), NO_FAIL);
}//if
@@ -366,9 +365,6 @@ void verify_deleted(Ndb* pMyNdb) {
int check = -1 ;
int loop_count_ops = nRecords;
- NdbRecAttr* tTmp;
- int readValue[MAXATTR];
- NdbConnection* pMyTransaction = NULL ;
NdbOperation* pMyOperation = NULL ;
ndbout << "Verifying deleted records..."<< flush;
@@ -378,7 +374,7 @@ void verify_deleted(Ndb* pMyNdb) {
NdbConnection* pMyTransaction = pMyNdb->startTransaction();
if (!pMyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL);
- pMyOperation = pMyTransaction->getNdbOperation(tableName[0]);
+ pMyOperation = pMyTransaction->getNdbOperation(tableName);
if (!pMyOperation) error_handler(pMyNdb->getNdbError(), NO_FAIL);
check = pMyOperation->readTuple();
@@ -421,7 +417,7 @@ void read_and_verify_rows(Ndb* pMyNdb, bool pre) {
pMyTransaction = pMyNdb->startTransaction();
if (!pMyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL);
- MyOp = pMyTransaction->getNdbOperation(tableName[0]);
+ MyOp = pMyTransaction->getNdbOperation(tableName);
if (!MyOp) error_handler( pMyTransaction->getNdbError(), NO_FAIL);
@@ -1232,14 +1228,13 @@ void scan_rows(Ndb* pMyNdb, int opType, int tupleType, int scanType) {
int readValue = 0 ;
int readValue2 = 0 ;
int scanCount = 0 ;
- NdbRecAttr* tTmp = NULL ;
TTYPE fail = NO_FAIL ;
for (int count=0 ; count < loop_count_ops ; count++) {
NdbConnection* MyTransaction = pMyNdb->startTransaction();
if (!MyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL);
- NdbOperation* MyOperation = MyTransaction->getNdbOperation(tableName[0]);
+ NdbOperation* MyOperation = MyTransaction->getNdbOperation(tableName);
if (!MyOperation) error_handler(pMyNdb->getNdbError(), NO_FAIL);
if (opType == 1)
@@ -1306,7 +1301,7 @@ void scan_rows(Ndb* pMyNdb, int opType, int tupleType, int scanType) {
}else{
// Sends the SCAN_NEXTREQ signal(s) and reads the answer in TRANS_ID signals.
// SCAN_TABCONF or SCAN_TABREF is the confirmation.
- while (eOf = MyTransaction->nextScanResult() == 0) {
+ while ((eOf = MyTransaction->nextScanResult()) == 0) {
ndbout << readValue <<"; ";
// Here we call takeOverScanOp for update of the tuple.
}
@@ -1348,7 +1343,7 @@ void update_rows(Ndb* pMyNdb, int tupleType, int opType) {
return;
}//if
- MyOperation = MyTransaction->getNdbOperation(tableName[0]);
+ MyOperation = MyTransaction->getNdbOperation(tableName);
if (MyOperation == NULL) {
error_handler(pMyNdb->getNdbError(), NO_FAIL);
return;
@@ -1442,7 +1437,7 @@ void delete_rows(Ndb* pMyNdb, int tupleTest, int opType) {
MyTransaction = pMyNdb->startTransaction();
if (!MyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL) ;
- MyOperation = MyTransaction->getNdbOperation(tableName[0]);
+ MyOperation = MyTransaction->getNdbOperation(tableName);
if (!MyOperation) error_handler(pMyNdb->getNdbError(), NO_FAIL) ;
check = MyOperation->interpretedDeleteTuple();
@@ -1517,8 +1512,6 @@ inline void setAttrNames(){
inline void setTableNames(){
- for (int i = 0; i < MAXTABLES; i++){
- snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
- }
+ snprintf(tableName, MAXSTRLEN, "TAB1");
}
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp b/ndb/test/ndbapi/mainAsyncGenerator.cpp
index f613c66d07b..f613c66d07b 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp
+++ b/ndb/test/ndbapi/mainAsyncGenerator.cpp
diff --git a/ndb/test/ndbapi/telco/msa.cpp b/ndb/test/ndbapi/msa.cpp
index 39ddaac2019..7a734f9cb79 100644
--- a/ndb/test/ndbapi/telco/msa.cpp
+++ b/ndb/test/ndbapi/msa.cpp
@@ -17,6 +17,7 @@
#include <ndb_global.h>
#include <NdbApi.hpp>
+#include <NdbSchemaCon.hpp>
#include <NdbCondition.h>
#include <NdbMutex.h>
#include <NdbSleep.h>
@@ -849,7 +850,7 @@ int CreateCallContextTable(Ndb* pNdb, const char* szTableName, bool bStored)
NdbError err;
memset(&err, 0, sizeof(err));
- NdbSchemaCon* pNdbSchemaCon = pNdb->startSchemaTransaction();
+ NdbSchemaCon* pNdbSchemaCon = NdbSchemaCon::startSchemaTrans(pNdb);
if(pNdbSchemaCon)
{
NdbSchemaOp* pNdbSchemaOp = pNdbSchemaCon->getNdbSchemaOp();
@@ -874,7 +875,8 @@ int CreateCallContextTable(Ndb* pNdb, const char* szTableName, bool bStored)
}
else
err = pNdbSchemaCon->getNdbError();
- pNdb->closeSchemaTransaction(pNdbSchemaCon);
+
+ NdbSchemaCon::closeSchemaTrans(pNdbSchemaCon);
}
else
err = pNdb->getNdbError();
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_async1.cpp b/ndb/test/ndbapi/ndb_async1.cpp
index 2a84f6b2aca..2a84f6b2aca 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_async1.cpp
+++ b/ndb/test/ndbapi/ndb_async1.cpp
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_async2.cpp b/ndb/test/ndbapi/ndb_async2.cpp
index 0c1d138defb..0c1d138defb 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_async2.cpp
+++ b/ndb/test/ndbapi/ndb_async2.cpp
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp b/ndb/test/ndbapi/ndb_user_populate.cpp
index ce3a76cdd59..ce3a76cdd59 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp
+++ b/ndb/test/ndbapi/ndb_user_populate.cpp
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction.cpp b/ndb/test/ndbapi/ndb_user_transaction.cpp
index 182f1f99586..182f1f99586 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction.cpp
+++ b/ndb/test/ndbapi/ndb_user_transaction.cpp
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction2.cpp b/ndb/test/ndbapi/ndb_user_transaction2.cpp
index df3c7a7989e..df3c7a7989e 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction2.cpp
+++ b/ndb/test/ndbapi/ndb_user_transaction2.cpp
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction3.cpp b/ndb/test/ndbapi/ndb_user_transaction3.cpp
index d2c92ecd424..d2c92ecd424 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction3.cpp
+++ b/ndb/test/ndbapi/ndb_user_transaction3.cpp
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction4.cpp b/ndb/test/ndbapi/ndb_user_transaction4.cpp
index e652c7bfed8..e652c7bfed8 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction4.cpp
+++ b/ndb/test/ndbapi/ndb_user_transaction4.cpp
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction5.cpp b/ndb/test/ndbapi/ndb_user_transaction5.cpp
index 86580008d10..86580008d10 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction5.cpp
+++ b/ndb/test/ndbapi/ndb_user_transaction5.cpp
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction6.cpp b/ndb/test/ndbapi/ndb_user_transaction6.cpp
index 262f38e9ffb..262f38e9ffb 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_transaction6.cpp
+++ b/ndb/test/ndbapi/ndb_user_transaction6.cpp
diff --git a/ndb/test/ndbapi/acid/Makefile b/ndb/test/ndbapi/old_dirs/acid/Makefile
index 33dc49fcdea..33dc49fcdea 100644
--- a/ndb/test/ndbapi/acid/Makefile
+++ b/ndb/test/ndbapi/old_dirs/acid/Makefile
diff --git a/ndb/test/ndbapi/acid2/Makefile b/ndb/test/ndbapi/old_dirs/acid2/Makefile
index 69c9d409b9e..69c9d409b9e 100644
--- a/ndb/test/ndbapi/acid2/Makefile
+++ b/ndb/test/ndbapi/old_dirs/acid2/Makefile
diff --git a/ndb/test/ndbapi/acid2/TraceNdbApi.hpp b/ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp
index 2bd4eab6b70..2bd4eab6b70 100644
--- a/ndb/test/ndbapi/acid2/TraceNdbApi.hpp
+++ b/ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp
diff --git a/ndb/test/ndbapi/acid2/VerifyNdbApi.hpp b/ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp
index 4a5b8cc8111..4a5b8cc8111 100644
--- a/ndb/test/ndbapi/acid2/VerifyNdbApi.hpp
+++ b/ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp
diff --git a/ndb/test/ndbapi/basicAsynch/Makefile b/ndb/test/ndbapi/old_dirs/basicAsynch/Makefile
index 802c5e5a2bd..802c5e5a2bd 100755
--- a/ndb/test/ndbapi/basicAsynch/Makefile
+++ b/ndb/test/ndbapi/old_dirs/basicAsynch/Makefile
diff --git a/ndb/test/ndbapi/bulk_copy/Makefile b/ndb/test/ndbapi/old_dirs/bulk_copy/Makefile
index 22c05b138b7..22c05b138b7 100644
--- a/ndb/test/ndbapi/bulk_copy/Makefile
+++ b/ndb/test/ndbapi/old_dirs/bulk_copy/Makefile
diff --git a/ndb/test/ndbapi/create_all_tabs/Makefile b/ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile
index 58309807682..58309807682 100644
--- a/ndb/test/ndbapi/create_all_tabs/Makefile
+++ b/ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile
diff --git a/ndb/test/ndbapi/create_tab/Makefile b/ndb/test/ndbapi/old_dirs/create_tab/Makefile
index c2ea0b52b15..c2ea0b52b15 100644
--- a/ndb/test/ndbapi/create_tab/Makefile
+++ b/ndb/test/ndbapi/old_dirs/create_tab/Makefile
diff --git a/ndb/test/ndbapi/drop_all_tabs/Makefile b/ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile
index 96db0781417..96db0781417 100644
--- a/ndb/test/ndbapi/drop_all_tabs/Makefile
+++ b/ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile
diff --git a/ndb/test/ndbapi/flexAsynch/Makefile b/ndb/test/ndbapi/old_dirs/flexAsynch/Makefile
index 2c77c8e21df..2c77c8e21df 100644
--- a/ndb/test/ndbapi/flexAsynch/Makefile
+++ b/ndb/test/ndbapi/old_dirs/flexAsynch/Makefile
diff --git a/ndb/test/ndbapi/old_dirs/flexBench/Makefile.am b/ndb/test/ndbapi/old_dirs/flexBench/Makefile.am
new file mode 100644
index 00000000000..d4de4b92b60
--- /dev/null
+++ b/ndb/test/ndbapi/old_dirs/flexBench/Makefile.am
@@ -0,0 +1,10 @@
+
+bin_PROGRAMS = flexBench
+
+flexBench_SOURCES = flexBench.cpp
+
+include $(top_srcdir)/ndb/config/common.mk.am
+include $(top_srcdir)/ndb/config/type_ndbapitest.mk.am
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/ndb/test/ndbapi/flexBench/Makefile b/ndb/test/ndbapi/old_dirs/flexBench/Makefile_old
index bfff5cd161a..bfff5cd161a 100644
--- a/ndb/test/ndbapi/flexBench/Makefile
+++ b/ndb/test/ndbapi/old_dirs/flexBench/Makefile_old
diff --git a/ndb/test/ndbapi/flexBench/ndbplot.pl b/ndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl
index b16f6d5897d..b16f6d5897d 100755
--- a/ndb/test/ndbapi/flexBench/ndbplot.pl
+++ b/ndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl
diff --git a/ndb/test/ndbapi/flexHammer/Makefile b/ndb/test/ndbapi/old_dirs/flexHammer/Makefile
index c8e436fb7f5..c8e436fb7f5 100644
--- a/ndb/test/ndbapi/flexHammer/Makefile
+++ b/ndb/test/ndbapi/old_dirs/flexHammer/Makefile
diff --git a/ndb/test/ndbapi/flexHammer/README b/ndb/test/ndbapi/old_dirs/flexHammer/README
index 556582aab96..556582aab96 100644
--- a/ndb/test/ndbapi/flexHammer/README
+++ b/ndb/test/ndbapi/old_dirs/flexHammer/README
diff --git a/ndb/test/ndbapi/flexScan/Makefile b/ndb/test/ndbapi/old_dirs/flexScan/Makefile
index 78f9d481063..78f9d481063 100644
--- a/ndb/test/ndbapi/flexScan/Makefile
+++ b/ndb/test/ndbapi/old_dirs/flexScan/Makefile
diff --git a/ndb/test/ndbapi/flexScan/README b/ndb/test/ndbapi/old_dirs/flexScan/README
index cddbdea5336..cddbdea5336 100644
--- a/ndb/test/ndbapi/flexScan/README
+++ b/ndb/test/ndbapi/old_dirs/flexScan/README
diff --git a/ndb/test/ndbapi/flexTT/Makefile b/ndb/test/ndbapi/old_dirs/flexTT/Makefile
index a63bd803d95..a63bd803d95 100644
--- a/ndb/test/ndbapi/flexTT/Makefile
+++ b/ndb/test/ndbapi/old_dirs/flexTT/Makefile
diff --git a/ndb/test/ndbapi/flexTimedAsynch/Makefile b/ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile
index e9995dbd16f..e9995dbd16f 100644
--- a/ndb/test/ndbapi/flexTimedAsynch/Makefile
+++ b/ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile
diff --git a/ndb/test/ndbapi/flex_bench_mysql/Makefile b/ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile
index d2608526cae..d2608526cae 100644
--- a/ndb/test/ndbapi/flex_bench_mysql/Makefile
+++ b/ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile
diff --git a/ndb/test/ndbapi/indexTest/Makefile b/ndb/test/ndbapi/old_dirs/indexTest/Makefile
index d842e487ee5..d842e487ee5 100644
--- a/ndb/test/ndbapi/indexTest/Makefile
+++ b/ndb/test/ndbapi/old_dirs/indexTest/Makefile
diff --git a/ndb/test/ndbapi/indexTest2/Makefile b/ndb/test/ndbapi/old_dirs/indexTest2/Makefile
index ad78fd51986..ad78fd51986 100644
--- a/ndb/test/ndbapi/indexTest2/Makefile
+++ b/ndb/test/ndbapi/old_dirs/indexTest2/Makefile
diff --git a/ndb/test/ndbapi/interpreterInTup/Makefile b/ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile
index 074adbf674a..074adbf674a 100644
--- a/ndb/test/ndbapi/interpreterInTup/Makefile
+++ b/ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile
diff --git a/ndb/test/ndbapi/lmc-bench/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/Makefile
index af472b1589f..af472b1589f 100644
--- a/ndb/test/ndbapi/lmc-bench/Makefile
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/Makefile
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/Makefile
index 744d6171139..744d6171139 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/Makefile
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/Makefile
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/generator/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/generator/Makefile
index c1f84a3ef70..c1f84a3ef70 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/generator/Makefile
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/generator/Makefile
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/include/dbGenerator.h b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h
index 2256498e151..2256498e151 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/include/dbGenerator.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/include/testData.h b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h
index 3db85e7342e..3db85e7342e 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/include/testData.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/include/userInterface.h b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h
index 94bd1e80ab3..94bd1e80ab3 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/include/userInterface.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/Makefile
index c0b532a8359..c0b532a8359 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/user/Makefile
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/Makefile
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/macros.h b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h
index 22b7f564490..22b7f564490 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/user/macros.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp
index 9e6c5e55e73..9e6c5e55e73 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp
diff --git a/ndb/test/ndbapi/lmc-bench/bin/.empty b/ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty
index e69de29bb2d..e69de29bb2d 100644
--- a/ndb/test/ndbapi/lmc-bench/bin/.empty
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty
diff --git a/ndb/test/ndbapi/lmc-bench/include/ndb_schema.hpp b/ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp
index af08bc2eecd..af08bc2eecd 100644
--- a/ndb/test/ndbapi/lmc-bench/include/ndb_schema.hpp
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp
diff --git a/ndb/test/ndbapi/lmc-bench/include/testDefinitions.h b/ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h
index 2f4aeb30975..2f4aeb30975 100644
--- a/ndb/test/ndbapi/lmc-bench/include/testDefinitions.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h
diff --git a/ndb/test/ndbapi/lmc-bench/lib/.empty b/ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty
index e69de29bb2d..e69de29bb2d 100644
--- a/ndb/test/ndbapi/lmc-bench/lib/.empty
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty
diff --git a/ndb/test/ndbapi/lmc-bench/script/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile
index 240b5957573..240b5957573 100644
--- a/ndb/test/ndbapi/lmc-bench/script/Makefile
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile
diff --git a/ndb/test/ndbapi/lmc-bench/script/async-lmc-bench-l-p10.sh b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l-p10.sh
index 1ce3969f9fb..1ce3969f9fb 100755
--- a/ndb/test/ndbapi/lmc-bench/script/async-lmc-bench-l-p10.sh
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l-p10.sh
diff --git a/ndb/test/ndbapi/lmc-bench/script/async-lmc-bench-l.sh b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l.sh
index a5de71395c4..a5de71395c4 100755
--- a/ndb/test/ndbapi/lmc-bench/script/async-lmc-bench-l.sh
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l.sh
diff --git a/ndb/test/ndbapi/lmc-bench/script/async-lmc-bench-p10.sh b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-p10.sh
index 92c853cdd86..92c853cdd86 100755
--- a/ndb/test/ndbapi/lmc-bench/script/async-lmc-bench-p10.sh
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-p10.sh
diff --git a/ndb/test/ndbapi/lmc-bench/script/async-lmc-bench.sh b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench.sh
index da8e9d9bf42..da8e9d9bf42 100755
--- a/ndb/test/ndbapi/lmc-bench/script/async-lmc-bench.sh
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench.sh
diff --git a/ndb/test/ndbapi/lmc-bench/src/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile
index ae7fac9c49b..ae7fac9c49b 100644
--- a/ndb/test/ndbapi/lmc-bench/src/Makefile
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile
diff --git a/ndb/test/ndbapi/lmc-bench/src/README b/ndb/test/ndbapi/old_dirs/lmc-bench/src/README
index e81c8ba0051..e81c8ba0051 100644
--- a/ndb/test/ndbapi/lmc-bench/src/README
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/README
diff --git a/ndb/test/ndbapi/lmc-bench/src/generator/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/Makefile
index 143d9ba655e..143d9ba655e 100644
--- a/ndb/test/ndbapi/lmc-bench/src/generator/Makefile
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/Makefile
diff --git a/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c
index 7484c7647f5..7484c7647f5 100644
--- a/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c
diff --git a/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h
index 824688b6cf9..824688b6cf9 100644
--- a/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h
diff --git a/ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c
index 4a31db0b4e9..4a31db0b4e9 100644
--- a/ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c
diff --git a/ndb/test/ndbapi/lmc-bench/src/include/testData.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h
index 863c230502b..863c230502b 100644
--- a/ndb/test/ndbapi/lmc-bench/src/include/testData.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h
diff --git a/ndb/test/ndbapi/lmc-bench/src/include/userInterface.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h
index b70ded87756..b70ded87756 100644
--- a/ndb/test/ndbapi/lmc-bench/src/include/userInterface.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h
diff --git a/ndb/test/ndbapi/lmc-bench/src/makevars.linux b/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.linux
index a933669cfe7..a933669cfe7 100644
--- a/ndb/test/ndbapi/lmc-bench/src/makevars.linux
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.linux
diff --git a/ndb/test/ndbapi/lmc-bench/src/makevars.sparc b/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.sparc
index 57ab8bf982f..57ab8bf982f 100644
--- a/ndb/test/ndbapi/lmc-bench/src/makevars.sparc
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.sparc
diff --git a/ndb/test/ndbapi/lmc-bench/src/populator/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/Makefile
index 2107c948843..2107c948843 100644
--- a/ndb/test/ndbapi/lmc-bench/src/populator/Makefile
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/Makefile
diff --git a/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c
index 42fbb52f3b2..42fbb52f3b2 100644
--- a/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c
diff --git a/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.h
index 1916720e141..1916720e141 100644
--- a/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.h
diff --git a/ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/mainPopulate.c
index 838ac8a7196..838ac8a7196 100644
--- a/ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/mainPopulate.c
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/Makefile
index 9bf229ac84c..9bf229ac84c 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/Makefile
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/Makefile
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/localDbPrepare.c
index dd100507016..dd100507016 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/localDbPrepare.c
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/macros.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h
index 363f247b93f..363f247b93f 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/macros.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp
index b3aaeac822e..b3aaeac822e 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/old/Makefile b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/Makefile
index 9b1247d44af..9b1247d44af 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/old/Makefile
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/Makefile
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/old/userHandle.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h
index 1de468d4dad..1de468d4dad 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/old/userHandle.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c
index bacf1861dde..bacf1861dde 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c
index a2f4787bb0c..a2f4787bb0c 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/userHandle.h b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h
index 6da76fc2bff..6da76fc2bff 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/userHandle.h
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp
index 67c4e037215..fe3c17acbf5 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp
@@ -32,6 +32,7 @@
#include <NdbSleep.h>
#include "ndb_schema.hpp"
#include <NDBT.hpp>
+#include <NdbSchemaCon.hpp>
/***************************************************************
* L O C A L C O N S T A N T S *
@@ -141,13 +142,11 @@ extern int useIndexTables;
int
-create_table_server(Ndb * pNDB){
-
+create_table_server(Ndb * pNdb){
int check;
-
- NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction();
+ NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if( MySchemaTransaction == NULL )
- error_handler("startSchemaTransaction", pNDB->getNdbError(), 0);
+ error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( MySchemaOp == NULL )
@@ -246,17 +245,17 @@ create_table_server(Ndb * pNDB){
error_handler("schemaTransaction->execute()",
MySchemaTransaction->getNdbError(), 0);
}
- pNDB->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return 0;
}
int
-create_table_group(Ndb * pNDB){
+create_table_group(Ndb * pNdb){
int check;
- NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction();
+ NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if( MySchemaTransaction == NULL )
- error_handler("startSchemaTransaction", pNDB->getNdbError(), 0);
+ error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( MySchemaOp == NULL )
@@ -340,16 +339,16 @@ create_table_group(Ndb * pNDB){
error_handler("schemaTransaction->execute()",
MySchemaTransaction->getNdbError(), 0);
}
- pNDB->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return 0;
}
int
-create_table_subscriber(Ndb * pNDB){
+create_table_subscriber(Ndb * pNdb){
int check;
- NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction();
+ NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if( MySchemaTransaction == NULL )
- error_handler("startSchemaTransaction", pNDB->getNdbError(), 0);
+ error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( MySchemaOp == NULL )
@@ -459,16 +458,16 @@ create_table_subscriber(Ndb * pNDB){
error_handler("schemaTransaction->execute()",
MySchemaTransaction->getNdbError(), 0);
}
- pNDB->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return 0;
}
int
-create_table_session(Ndb * pNDB){
+create_table_session(Ndb * pNdb){
int check;
- NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction();
+ NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if( MySchemaTransaction == NULL )
- error_handler("startSchemaTransaction", pNDB->getNdbError(), 0);
+ error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( MySchemaOp == NULL )
@@ -533,29 +532,29 @@ create_table_session(Ndb * pNDB){
error_handler("schemaTransaction->execute()",
MySchemaTransaction->getNdbError(), 0);
}
- pNDB->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return 0;
}
void
-create_table(const char * name, int (* function)(Ndb * pNDB), Ndb* pNDB){
+create_table(const char * name, int (* function)(Ndb * pNdb), Ndb* pNdb){
printf("creating table %s...", name);
- if(pNDB->getDictionary()->getTable(name) != 0){
+ if(pNdb->getDictionary()->getTable(name) != 0){
printf(" it already exists\n");
return;
} else {
printf("\n");
}
- function(pNDB);
+ function(pNdb);
printf("creating table %s... done\n", name);
}
-static int dbCreate(Ndb * pNDB)
+static int dbCreate(Ndb * pNdb)
{
- create_table(SUBSCRIBER_TABLE, create_table_subscriber, pNDB);
- create_table(GROUP_TABLE , create_table_group, pNDB);
- create_table(SESSION_TABLE , create_table_session, pNDB);
- create_table(SERVER_TABLE , create_table_server, pNDB);
+ create_table(SUBSCRIBER_TABLE, create_table_subscriber, pNdb);
+ create_table(GROUP_TABLE , create_table_group, pNdb);
+ create_table(SESSION_TABLE , create_table_session, pNdb);
+ create_table(SERVER_TABLE , create_table_server, pNdb);
return 0;
}
@@ -570,23 +569,23 @@ userDbConnect(uint32 createDb, char *dbName)
{
NdbMutex_Lock(startupMutex);
- Ndb * pNDB = new Ndb("");
+ Ndb * pNdb = new Ndb("");
//printf("Initializing...\n");
- pNDB->init();
+ pNdb->init();
//printf("Waiting...");
- while(pNDB->waitUntilReady() != 0){
+ while(pNdb->waitUntilReady() != 0){
//printf("...");
}
// printf("done\n");
if( createDb )
- dbCreate(pNDB);
+ dbCreate(pNdb);
UserHandle * uh = new UserHandle;
- uh->pNDB = pNDB;
+ uh->pNDB = pNdb;
uh->pCurrTrans = 0;
NdbMutex_Unlock(startupMutex);
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c
index a2f4787bb0c..a2f4787bb0c 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c
+++ b/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c
diff --git a/ndb/test/ndbapi/restarter/Makefile b/ndb/test/ndbapi/old_dirs/restarter/Makefile
index 041fbfd82ba..041fbfd82ba 100644
--- a/ndb/test/ndbapi/restarter/Makefile
+++ b/ndb/test/ndbapi/old_dirs/restarter/Makefile
diff --git a/ndb/test/ndbapi/restarter2/Makefile b/ndb/test/ndbapi/old_dirs/restarter2/Makefile
index ba33a2e21dc..ba33a2e21dc 100644
--- a/ndb/test/ndbapi/restarter2/Makefile
+++ b/ndb/test/ndbapi/old_dirs/restarter2/Makefile
diff --git a/ndb/test/ndbapi/restarts/Makefile b/ndb/test/ndbapi/old_dirs/restarts/Makefile
index 9f14b81fae5..9f14b81fae5 100644
--- a/ndb/test/ndbapi/restarts/Makefile
+++ b/ndb/test/ndbapi/old_dirs/restarts/Makefile
diff --git a/ndb/test/ndbapi/ronja/Makefile b/ndb/test/ndbapi/old_dirs/ronja/Makefile
index a11a27c5fd7..a11a27c5fd7 100644
--- a/ndb/test/ndbapi/ronja/Makefile
+++ b/ndb/test/ndbapi/old_dirs/ronja/Makefile
diff --git a/ndb/test/ndbapi/ronja/benchronja/Makefile b/ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile
index f0521c3ba77..f0521c3ba77 100644
--- a/ndb/test/ndbapi/ronja/benchronja/Makefile
+++ b/ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile
diff --git a/ndb/test/ndbapi/ronja/initronja/Makefile b/ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile
index dd66dd813d1..dd66dd813d1 100644
--- a/ndb/test/ndbapi/ronja/initronja/Makefile
+++ b/ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile
diff --git a/ndb/test/ndbapi/telco/Makefile b/ndb/test/ndbapi/old_dirs/telco/Makefile
index 8f82c714119..8f82c714119 100644
--- a/ndb/test/ndbapi/telco/Makefile
+++ b/ndb/test/ndbapi/old_dirs/telco/Makefile
diff --git a/ndb/test/ndbapi/telco/readme b/ndb/test/ndbapi/old_dirs/telco/readme
index 627b4256eef..627b4256eef 100644
--- a/ndb/test/ndbapi/telco/readme
+++ b/ndb/test/ndbapi/old_dirs/telco/readme
diff --git a/ndb/test/ndbapi/testBackup/Makefile b/ndb/test/ndbapi/old_dirs/testBackup/Makefile
index ce0e404803c..ce0e404803c 100644
--- a/ndb/test/ndbapi/testBackup/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testBackup/Makefile
diff --git a/ndb/test/ndbapi/testBasic/Makefile b/ndb/test/ndbapi/old_dirs/testBasic/Makefile
index 755b19939cb..755b19939cb 100644
--- a/ndb/test/ndbapi/testBasic/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testBasic/Makefile
diff --git a/ndb/test/ndbapi/testBlobs/Makefile b/ndb/test/ndbapi/old_dirs/testBlobs/Makefile
index cc5bb629c17..cc5bb629c17 100644
--- a/ndb/test/ndbapi/testBlobs/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testBlobs/Makefile
diff --git a/ndb/test/ndbapi/testDataBuffers/Makefile b/ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile
index 181fbc829d4..181fbc829d4 100644
--- a/ndb/test/ndbapi/testDataBuffers/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile
diff --git a/ndb/test/ndbapi/testDict/Makefile b/ndb/test/ndbapi/old_dirs/testDict/Makefile
index 75d493c3424..75d493c3424 100644
--- a/ndb/test/ndbapi/testDict/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testDict/Makefile
diff --git a/ndb/test/ndbapi/testGrep/Makefile b/ndb/test/ndbapi/old_dirs/testGrep/Makefile
index 34fdd7113d0..34fdd7113d0 100644
--- a/ndb/test/ndbapi/testGrep/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testGrep/Makefile
diff --git a/ndb/test/ndbapi/testGrep/verify/Makefile b/ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile
index 4e6182de6b2..4e6182de6b2 100644
--- a/ndb/test/ndbapi/testGrep/verify/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile
diff --git a/ndb/test/ndbapi/testIndex/Makefile b/ndb/test/ndbapi/old_dirs/testIndex/Makefile
index e5cd4542c9c..e5cd4542c9c 100644
--- a/ndb/test/ndbapi/testIndex/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testIndex/Makefile
diff --git a/ndb/test/ndbapi/testInterpreter/Makefile b/ndb/test/ndbapi/old_dirs/testInterpreter/Makefile
index e84287a1b16..e84287a1b16 100644
--- a/ndb/test/ndbapi/testInterpreter/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testInterpreter/Makefile
diff --git a/ndb/test/ndbapi/testMgm/Makefile b/ndb/test/ndbapi/old_dirs/testMgm/Makefile
index be50d3dae7e..be50d3dae7e 100644
--- a/ndb/test/ndbapi/testMgm/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testMgm/Makefile
diff --git a/ndb/test/ndbapi/testNdbApi/Makefile b/ndb/test/ndbapi/old_dirs/testNdbApi/Makefile
index 3bb3cba427e..3bb3cba427e 100644
--- a/ndb/test/ndbapi/testNdbApi/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testNdbApi/Makefile
diff --git a/ndb/test/ndbapi/testNodeRestart/Makefile b/ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile
index 8c13ab3beb4..8c13ab3beb4 100644
--- a/ndb/test/ndbapi/testNodeRestart/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile
diff --git a/ndb/test/ndbapi/testOIBasic/Makefile b/ndb/test/ndbapi/old_dirs/testOIBasic/Makefile
index 1bbbcf1d17e..1bbbcf1d17e 100644
--- a/ndb/test/ndbapi/testOIBasic/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testOIBasic/Makefile
diff --git a/ndb/test/ndbapi/testOIBasic/times.txt b/ndb/test/ndbapi/old_dirs/testOIBasic/times.txt
index 641e9ddb4bf..641e9ddb4bf 100644
--- a/ndb/test/ndbapi/testOIBasic/times.txt
+++ b/ndb/test/ndbapi/old_dirs/testOIBasic/times.txt
diff --git a/ndb/test/ndbapi/testOperations/Makefile b/ndb/test/ndbapi/old_dirs/testOperations/Makefile
index 25546ade639..25546ade639 100644
--- a/ndb/test/ndbapi/testOperations/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testOperations/Makefile
diff --git a/ndb/test/ndbapi/testOrderedIndex/Makefile b/ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile
index d8899a37895..d8899a37895 100644
--- a/ndb/test/ndbapi/testOrderedIndex/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile
diff --git a/ndb/test/ndbapi/testRestartGci/Makefile b/ndb/test/ndbapi/old_dirs/testRestartGci/Makefile
index 24f449b747d..24f449b747d 100644
--- a/ndb/test/ndbapi/testRestartGci/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testRestartGci/Makefile
diff --git a/ndb/test/ndbapi/testScan/Makefile b/ndb/test/ndbapi/old_dirs/testScan/Makefile
index fe48f5bc926..fe48f5bc926 100644
--- a/ndb/test/ndbapi/testScan/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testScan/Makefile
diff --git a/ndb/test/ndbapi/testScanInterpreter/Makefile b/ndb/test/ndbapi/old_dirs/testScanInterpreter/Makefile
index c7d96494148..c7d96494148 100644
--- a/ndb/test/ndbapi/testScanInterpreter/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testScanInterpreter/Makefile
diff --git a/ndb/test/ndbapi/testSystemRestart/Makefile b/ndb/test/ndbapi/old_dirs/testSystemRestart/Makefile
index 7a306eb313d..7a306eb313d 100644
--- a/ndb/test/ndbapi/testSystemRestart/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testSystemRestart/Makefile
diff --git a/ndb/test/ndbapi/testTimeout/Makefile b/ndb/test/ndbapi/old_dirs/testTimeout/Makefile
index 01a9df9887f..01a9df9887f 100644
--- a/ndb/test/ndbapi/testTimeout/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testTimeout/Makefile
diff --git a/ndb/test/ndbapi/testTransactions/Makefile b/ndb/test/ndbapi/old_dirs/testTransactions/Makefile
index 0279a526923..0279a526923 100644
--- a/ndb/test/ndbapi/testTransactions/Makefile
+++ b/ndb/test/ndbapi/old_dirs/testTransactions/Makefile
diff --git a/ndb/test/ndbapi/test_event/Makefile b/ndb/test/ndbapi/old_dirs/test_event/Makefile
index 6299fa47845..6299fa47845 100644
--- a/ndb/test/ndbapi/test_event/Makefile
+++ b/ndb/test/ndbapi/old_dirs/test_event/Makefile
diff --git a/ndb/test/ndbapi/vw_test/Makefile b/ndb/test/ndbapi/old_dirs/vw_test/Makefile
index 144873dcc69..144873dcc69 100644
--- a/ndb/test/ndbapi/vw_test/Makefile
+++ b/ndb/test/ndbapi/old_dirs/vw_test/Makefile
diff --git a/ndb/test/ndbapi/vw_test/bcd.h b/ndb/test/ndbapi/old_dirs/vw_test/bcd.h
index d0aaffbd8b7..d0aaffbd8b7 100644
--- a/ndb/test/ndbapi/vw_test/bcd.h
+++ b/ndb/test/ndbapi/old_dirs/vw_test/bcd.h
diff --git a/ndb/test/ndbapi/vw_test/script/client_start b/ndb/test/ndbapi/old_dirs/vw_test/script/client_start
index 2965be6fbb5..2965be6fbb5 100644
--- a/ndb/test/ndbapi/vw_test/script/client_start
+++ b/ndb/test/ndbapi/old_dirs/vw_test/script/client_start
diff --git a/ndb/test/ndbapi/vw_test/utv.h b/ndb/test/ndbapi/old_dirs/vw_test/utv.h
index 6f378e5595b..6f378e5595b 100644
--- a/ndb/test/ndbapi/vw_test/utv.h
+++ b/ndb/test/ndbapi/old_dirs/vw_test/utv.h
diff --git a/ndb/test/ndbapi/vw_test/vcdrfunc.h b/ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h
index 3c5444d733b..3c5444d733b 100644
--- a/ndb/test/ndbapi/vw_test/vcdrfunc.h
+++ b/ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h
diff --git a/ndb/test/ndbapi/restarter/restarter.cpp b/ndb/test/ndbapi/restarter.cpp
index 9a522f5dcac..9a522f5dcac 100644
--- a/ndb/test/ndbapi/restarter/restarter.cpp
+++ b/ndb/test/ndbapi/restarter.cpp
diff --git a/ndb/test/ndbapi/restarter2/restarter2.cpp b/ndb/test/ndbapi/restarter2.cpp
index f2bcf6f8e7b..f2bcf6f8e7b 100644
--- a/ndb/test/ndbapi/restarter2/restarter2.cpp
+++ b/ndb/test/ndbapi/restarter2.cpp
diff --git a/ndb/test/ndbapi/restarts/restarts.cpp b/ndb/test/ndbapi/restarts.cpp
index 0ec2883d53c..0ec2883d53c 100644
--- a/ndb/test/ndbapi/restarts/restarts.cpp
+++ b/ndb/test/ndbapi/restarts.cpp
diff --git a/ndb/test/ndbapi/vw_test/size.cpp b/ndb/test/ndbapi/size.cpp
index c506771ebde..c506771ebde 100644
--- a/ndb/test/ndbapi/vw_test/size.cpp
+++ b/ndb/test/ndbapi/size.cpp
diff --git a/ndb/test/ndbapi/testBackup/testBackup.cpp b/ndb/test/ndbapi/testBackup.cpp
index f9ae7ffcbbc..129eced54b0 100644
--- a/ndb/test/ndbapi/testBackup/testBackup.cpp
+++ b/ndb/test/ndbapi/testBackup.cpp
@@ -205,8 +205,7 @@ int runClearTable(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
-
-#include "../bank/Bank.hpp"
+#include "bank/Bank.hpp"
int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
Bank bank;
diff --git a/ndb/test/ndbapi/testBasic/testBasic.cpp b/ndb/test/ndbapi/testBasic.cpp
index 64dfe492c2c..64dfe492c2c 100644
--- a/ndb/test/ndbapi/testBasic/testBasic.cpp
+++ b/ndb/test/ndbapi/testBasic.cpp
diff --git a/ndb/test/ndbapi/basicAsynch/testBasicAsynch.cpp b/ndb/test/ndbapi/testBasicAsynch.cpp
index a97920e53da..a97920e53da 100755..100644
--- a/ndb/test/ndbapi/basicAsynch/testBasicAsynch.cpp
+++ b/ndb/test/ndbapi/testBasicAsynch.cpp
diff --git a/ndb/test/ndbapi/testBlobs.cpp b/ndb/test/ndbapi/testBlobs.cpp
new file mode 100644
index 00000000000..001ec83630a
--- /dev/null
+++ b/ndb/test/ndbapi/testBlobs.cpp
@@ -0,0 +1,1213 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/*
+ * testBlobs
+ */
+
+#include <ndb_global.h>
+#include <NdbMain.h>
+#include <NdbOut.hpp>
+#include <NdbTest.hpp>
+
+struct Bcol {
+ bool m_nullable;
+ unsigned m_inline;
+ unsigned m_partsize;
+ unsigned m_stripe;
+ char m_btname[NdbBlob::BlobTableNameSize];
+ Bcol(bool a, unsigned b, unsigned c, unsigned d) :
+ m_nullable(a),
+ m_inline(b),
+ m_partsize(c),
+ m_stripe(d)
+ {}
+};
+
+struct Opt {
+ bool m_core;
+ bool m_dbg;
+ bool m_dbgall;
+ bool m_full;
+ unsigned m_loop;
+ unsigned m_parts;
+ unsigned m_rows;
+ unsigned m_seed;
+ char m_skip[255];
+ // metadata
+ const char* m_tname;
+ const char* m_x1name; // hash index
+ const char* m_x2name; // ordered index
+ unsigned m_pk1off;
+ unsigned m_pk2len;
+ bool m_oneblob;
+ Bcol m_blob1;
+ Bcol m_blob2;
+ // bugs
+ int m_bug;
+ int (*m_bugtest)();
+ Opt() :
+ m_core(false),
+ m_dbg(false),
+ m_dbgall(false),
+ m_full(false),
+ m_loop(1),
+ m_parts(10),
+ m_rows(100),
+ m_seed(0),
+ // metadata
+ m_tname("TBLOB1"),
+ m_x1name("TBLOB1X1"),
+ m_x2name("TBLOB1X2"),
+ m_pk1off(0x12340000),
+ m_pk2len(55),
+ m_oneblob(false),
+ m_blob1(false, 7, 1137, 10),
+ m_blob2(true, 99, 55, 1),
+ // bugs
+ m_bug(0),
+ m_bugtest(0) {
+ memset(m_skip, false, sizeof(m_skip));
+ }
+};
+
+static const unsigned g_max_pk2len = 256;
+
+static void
+printusage()
+{
+ Opt d;
+ ndbout
+ << "usage: testBlobs options [default/max]" << endl
+ << " -core dump core on error" << endl
+ << " -dbg print debug" << endl
+ << " -dbgall print also NDB API debug (if compiled in)" << endl
+ << " -full read/write only full blob values" << endl
+ << " -inline read/write only blobs which fit inline" << endl
+ << " -loop N loop N times 0=forever [" << d.m_loop << "]" << endl
+ << " -parts N max parts in blob value [" << d.m_parts << "]" << endl
+ << " -rows N number of rows [" << d.m_rows << "]" << endl
+ << " -seed N random seed 0=loop number [" << d.m_seed << "]" << endl
+ << " -skip xxx skip these tests (see list)" << endl
+ << "metadata" << endl
+ << " -pk2len N length of PK2 [" << d.m_pk2len << "/" << g_max_pk2len <<"]" << endl
+ << " -oneblob only 1 blob attribute [default 2]" << endl
+ << "testcases for -skip" << endl
+ << " k primary key ops" << endl
+ << " i hash index ops" << endl
+ << " s table scans" << endl
+ << " r ordered index scans" << endl
+ << " u update blob value" << endl
+ << " v getValue / setValue" << endl
+ << " w readData / writeData" << endl
+ << "bug tests (no blob test)" << endl
+ << " -bug 4088 ndb api hang with mixed ops on index table" << endl
+ << " -bug 2222 delete + write gives 626" << endl
+ << " -bug 3333 acc crash on delete and long key" << endl
+ ;
+}
+
+static Opt g_opt;
+
+static char&
+skip(unsigned x)
+{
+ assert(x < sizeof(g_opt.m_skip));
+ return g_opt.m_skip[x];
+}
+
+static Ndb* g_ndb = 0;
+static NdbDictionary::Dictionary* g_dic = 0;
+static NdbConnection* g_con = 0;
+static NdbOperation* g_opr = 0;
+static NdbIndexOperation* g_opx = 0;
+static NdbScanOperation* g_ops = 0;
+static NdbBlob* g_bh1 = 0;
+static NdbBlob* g_bh2 = 0;
+static bool g_printerror = true;
+
+static void
+printerror(int line, const char* msg)
+{
+ ndbout << "line " << line << ": " << msg << " failed" << endl;
+ if (! g_printerror) {
+ return;
+ }
+ if (g_ndb != 0 && g_ndb->getNdbError().code != 0) {
+ ndbout << "ndb: " << g_ndb->getNdbError() << endl;
+ }
+ if (g_dic != 0 && g_dic->getNdbError().code != 0) {
+ ndbout << "dic: " << g_dic->getNdbError() << endl;
+ }
+ if (g_con != 0 && g_con->getNdbError().code != 0) {
+ ndbout << "con: " << g_con->getNdbError() << endl;
+ if (g_opr != 0 && g_opr->getNdbError().code != 0) {
+ ndbout << "opr: table=" << g_opr->getTableName() << " " << g_opr->getNdbError() << endl;
+ }
+ if (g_opx != 0 && g_opx->getNdbError().code != 0) {
+ ndbout << "opx: table=" << g_opx->getTableName() << " " << g_opx->getNdbError() << endl;
+ }
+ if (g_ops != 0 && g_ops->getNdbError().code != 0) {
+ ndbout << "ops: table=" << g_ops->getTableName() << " " << g_ops->getNdbError() << endl;
+ }
+ NdbOperation* ope = g_con->getNdbErrorOperation();
+ if (ope != 0 && ope->getNdbError().code != 0) {
+ if (ope != g_opr && ope != g_opx && ope != g_ops)
+ ndbout << "ope: table=" << ope->getTableName() << " " << ope->getNdbError() << endl;
+ }
+ }
+ if (g_bh1 != 0 && g_bh1->getNdbError().code != 0) {
+ ndbout << "bh1: " << g_bh1->getNdbError() << endl;
+ }
+ if (g_bh2 != 0 && g_bh2->getNdbError().code != 0) {
+ ndbout << "bh2: " << g_bh2->getNdbError() << endl;
+ }
+ if (g_opt.m_core) {
+ abort();
+ }
+ g_printerror = false;
+}
+
+#define CHK(x) \
+ do { \
+ if (x) break; \
+ printerror(__LINE__, #x); return -1; \
+ } while (0)
+#define DBG(x) \
+ do { \
+ if (! g_opt.m_dbg) break; \
+ ndbout << "line " << __LINE__ << " " << x << endl; \
+ } while (0)
+
+static int
+dropTable()
+{
+ NdbDictionary::Table tab(g_opt.m_tname);
+ if (g_dic->getTable(g_opt.m_tname) != 0)
+ CHK(g_dic->dropTable(tab) == 0);
+ return 0;
+}
+
+static int
+createTable()
+{
+ NdbDictionary::Table tab(g_opt.m_tname);
+ // col PK1 - Uint32
+ { NdbDictionary::Column col("PK1");
+ col.setType(NdbDictionary::Column::Unsigned);
+ col.setPrimaryKey(true);
+ tab.addColumn(col);
+ }
+ // col BL1 - Blob not-nullable
+ { NdbDictionary::Column col("BL1");
+ const Bcol& b = g_opt.m_blob1;
+ col.setType(NdbDictionary::Column::Blob);
+ col.setInlineSize(b.m_inline);
+ col.setPartSize(b.m_partsize);
+ col.setStripeSize(b.m_stripe);
+ tab.addColumn(col);
+ }
+ // col PK2 - Char[55]
+ if (g_opt.m_pk2len != 0)
+ { NdbDictionary::Column col("PK2");
+ col.setType(NdbDictionary::Column::Char);
+ col.setLength(g_opt.m_pk2len);
+ col.setPrimaryKey(true);
+ tab.addColumn(col);
+ }
+ // col BL2 - Clob nullable
+ if (! g_opt.m_oneblob)
+ { NdbDictionary::Column col("BL2");
+ const Bcol& b = g_opt.m_blob2;
+ col.setType(NdbDictionary::Column::Clob);
+ col.setNullable(true);
+ col.setInlineSize(b.m_inline);
+ col.setPartSize(b.m_partsize);
+ col.setStripeSize(b.m_stripe);
+ tab.addColumn(col);
+ }
+ // create table
+ CHK(g_dic->createTable(tab) == 0);
+ // unique hash index on PK2
+ if (g_opt.m_pk2len != 0)
+ { NdbDictionary::Index idx(g_opt.m_x1name);
+ idx.setType(NdbDictionary::Index::UniqueHashIndex);
+ idx.setTable(g_opt.m_tname);
+ idx.addColumnName("PK2");
+ CHK(g_dic->createIndex(idx) == 0);
+ }
+ // ordered index on PK2
+ if (g_opt.m_pk2len != 0)
+ { NdbDictionary::Index idx(g_opt.m_x2name);
+ idx.setType(NdbDictionary::Index::OrderedIndex);
+ idx.setLogging(false);
+ idx.setTable(g_opt.m_tname);
+ idx.addColumnName("PK2");
+ CHK(g_dic->createIndex(idx) == 0);
+ }
+ return 0;
+}
+
+// tuples
+
+struct Bval {
+ char* m_val;
+ unsigned m_len;
+ char* m_buf;
+ unsigned m_buflen;
+ Bval() :
+ m_val(0),
+ m_len(0),
+ m_buf(0), // read/write buffer
+ m_buflen(0)
+ {}
+ ~Bval() { delete [] m_val; delete [] m_buf; }
+ void alloc(unsigned buflen) {
+ m_buflen = buflen;
+ delete [] m_buf;
+ m_buf = new char [m_buflen];
+ trash();
+ }
+ void copy(const Bval& v) {
+ m_len = v.m_len;
+ delete [] m_val;
+ if (v.m_val == 0)
+ m_val = 0;
+ else
+ m_val = (char*)memcpy(new char [m_len], v.m_val, m_len);
+ }
+ void trash() const {
+ assert(m_buf != 0);
+ memset(m_buf, 'x', m_buflen);
+ }
+private:
+ Bval(const Bval&);
+ Bval& operator=(const Bval&);
+};
+
+struct Tup {
+ bool m_exists; // exists in table
+ Uint32 m_pk1; // primary keys concatenated like keyinfo
+ char m_pk2[g_max_pk2len + 1];
+ Bval m_blob1;
+ Bval m_blob2;
+ Tup() :
+ m_exists(false)
+ {}
+ ~Tup() { }
+ // alloc buffers of max size
+ void alloc() {
+ m_blob1.alloc(g_opt.m_blob1.m_inline + g_opt.m_blob1.m_partsize * g_opt.m_parts);
+ m_blob2.alloc(g_opt.m_blob2.m_inline + g_opt.m_blob2.m_partsize * g_opt.m_parts);
+ }
+ void copy(const Tup& tup) {
+ assert(m_pk1 == tup.m_pk1);
+ m_blob1.copy(tup.m_blob1);
+ m_blob2.copy(tup.m_blob2);
+ }
+private:
+ Tup(const Tup&);
+ Tup& operator=(const Tup&);
+};
+
+static Tup* g_tups;
+
+static unsigned
+urandom(unsigned n)
+{
+ return n == 0 ? 0 : random() % n;
+}
+
+static void
+calcBval(const Bcol& b, Bval& v, bool keepsize)
+{
+ if (b.m_nullable && urandom(10) == 0) {
+ v.m_len = 0;
+ delete v.m_val;
+ v.m_val = 0;
+ v.m_buf = new char [1];
+ } else {
+ if (keepsize && v.m_val != 0)
+ ;
+ else if (urandom(10) == 0)
+ v.m_len = urandom(b.m_inline);
+ else
+ v.m_len = urandom(b.m_inline + g_opt.m_parts * b.m_partsize + 1);
+ delete v.m_val;
+ v.m_val = new char [v.m_len + 1];
+ for (unsigned i = 0; i < v.m_len; i++)
+ v.m_val[i] = 'a' + urandom(25);
+ v.m_val[v.m_len] = 0;
+ v.m_buf = new char [v.m_len];
+ }
+ v.m_buflen = v.m_len;
+ v.trash();
+}
+
+static void
+calcTups(bool keepsize)
+{
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ tup.m_pk1 = g_opt.m_pk1off + k;
+ for (unsigned i = 0, n = k; i < g_opt.m_pk2len; i++) {
+ if (n != 0) {
+ tup.m_pk2[i] = '0' + n % 10;
+ n = n / 10;
+ } else {
+ tup.m_pk2[i] = 'a' + i % 26;
+ }
+ }
+ calcBval(g_opt.m_blob1, tup.m_blob1, keepsize);
+ if (! g_opt.m_oneblob)
+ calcBval(g_opt.m_blob2, tup.m_blob2, keepsize);
+ }
+}
+
+// blob handle ops
+
+static int
+getBlobLength(NdbBlob* h, unsigned& len)
+{
+ Uint64 len2 = (unsigned)-1;
+ CHK(h->getLength(len2) == 0);
+ len = (unsigned)len2;
+ assert(len == len2);
+ return 0;
+}
+
+static int
+setBlobValue(NdbBlob* h, const Bval& v)
+{
+ bool null = (v.m_val == 0);
+ bool isNull;
+ unsigned len;
+ DBG("set " << h->getColumn()->getName() << " len=" << v.m_len << " null=" << null);
+ if (null) {
+ CHK(h->setNull() == 0);
+ isNull = false;
+ CHK(h->getNull(isNull) == 0 && isNull == true);
+ CHK(getBlobLength(h, len) == 0 && len == 0);
+ } else {
+ CHK(h->setValue(v.m_val, v.m_len) == 0);
+ CHK(h->getNull(isNull) == 0 && isNull == false);
+ CHK(getBlobLength(h, len) == 0 && len == v.m_len);
+ }
+ return 0;
+}
+
+static int
+getBlobValue(NdbBlob* h, const Bval& v)
+{
+ bool null = (v.m_val == 0);
+ DBG("get " << h->getColumn()->getName() << " len=" << v.m_len << " null=" << null);
+ CHK(h->getValue(v.m_buf, v.m_buflen) == 0);
+ return 0;
+}
+
+static int
+getBlobValue(const Tup& tup)
+{
+ CHK(getBlobValue(g_bh1, tup.m_blob1) == 0);
+ if (! g_opt.m_oneblob)
+ CHK(getBlobValue(g_bh2, tup.m_blob2) == 0);
+ return 0;
+}
+
+static int
+verifyBlobValue(NdbBlob* h, const Bval& v)
+{
+ bool null = (v.m_val == 0);
+ bool isNull;
+ unsigned len;
+ if (null) {
+ isNull = false;
+ CHK(h->getNull(isNull) == 0 && isNull == true);
+ CHK(getBlobLength(h, len) == 0 && len == 0);
+ } else {
+ isNull = true;
+ CHK(h->getNull(isNull) == 0 && isNull == false);
+ CHK(getBlobLength(h, len) == 0 && len == v.m_len);
+ for (unsigned i = 0; i < v.m_len; i++)
+ CHK(v.m_val[i] == v.m_buf[i]);
+ }
+ return 0;
+}
+
+static int
+verifyBlobValue(const Tup& tup)
+{
+ CHK(verifyBlobValue(g_bh1, tup.m_blob1) == 0);
+ if (! g_opt.m_oneblob)
+ CHK(verifyBlobValue(g_bh2, tup.m_blob2) == 0);
+ return 0;
+}
+
+static int
+writeBlobData(NdbBlob* h, const Bval& v)
+{
+ bool null = (v.m_val == 0);
+ bool isNull;
+ unsigned len;
+ DBG("write " << h->getColumn()->getName() << " len=" << v.m_len << " null=" << null);
+ if (null) {
+ CHK(h->setNull() == 0);
+ isNull = false;
+ CHK(h->getNull(isNull) == 0 && isNull == true);
+ CHK(getBlobLength(h, len) == 0 && len == 0);
+ } else {
+ unsigned n = 0;
+ do {
+ unsigned m = g_opt.m_full ? v.m_len : urandom(v.m_len + 1);
+ if (m > v.m_len - n)
+ m = v.m_len - n;
+ DBG("write pos=" << n << " cnt=" << m);
+ CHK(h->writeData(v.m_val + n, m) == 0);
+ n += m;
+ } while (n < v.m_len);
+ assert(n == v.m_len);
+ isNull = true;
+ CHK(h->getNull(isNull) == 0 && isNull == false);
+ CHK(getBlobLength(h, len) == 0 && len == v.m_len);
+ }
+ return 0;
+}
+
+static int
+readBlobData(NdbBlob* h, const Bval& v)
+{
+ bool null = (v.m_val == 0);
+ bool isNull;
+ unsigned len;
+ DBG("read " << h->getColumn()->getName() << " len=" << v.m_len << " null=" << null);
+ if (null) {
+ isNull = false;
+ CHK(h->getNull(isNull) == 0 && isNull == true);
+ CHK(getBlobLength(h, len) == 0 && len == 0);
+ } else {
+ isNull = true;
+ CHK(h->getNull(isNull) == 0 && isNull == false);
+ CHK(getBlobLength(h, len) == 0 && len == v.m_len);
+ v.trash();
+ unsigned n = 0;
+ while (n < v.m_len) {
+ unsigned m = g_opt.m_full ? v.m_len : urandom(v.m_len + 1);
+ if (m > v.m_len - n)
+ m = v.m_len - n;
+ DBG("read pos=" << n << " cnt=" << m);
+ const unsigned m2 = m;
+ CHK(h->readData(v.m_buf + n, m) == 0);
+ CHK(m2 == m);
+ n += m;
+ }
+ assert(n == v.m_len);
+ // need to execute to see the data
+ CHK(g_con->execute(NoCommit) == 0);
+ for (unsigned i = 0; i < v.m_len; i++)
+ CHK(v.m_val[i] == v.m_buf[i]);
+ }
+ return 0;
+}
+
+static int
+readBlobData(const Tup& tup)
+{
+ CHK(readBlobData(g_bh1, tup.m_blob1) == 0);
+ if (! g_opt.m_oneblob)
+ CHK(readBlobData(g_bh2, tup.m_blob2) == 0);
+ return 0;
+}
+
+// verify blob data
+
+static int
+verifyHeadInline(const Bcol& c, const Bval& v, NdbRecAttr* ra)
+{
+ if (v.m_val == 0) {
+ CHK(ra->isNULL() == 1);
+ } else {
+ CHK(ra->isNULL() == 0);
+ CHK(ra->u_64_value() == v.m_len);
+ }
+ return 0;
+}
+
+static int
+verifyHeadInline(const Tup& tup)
+{
+ DBG("verifyHeadInline pk1=" << tup.m_pk1);
+ 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);
+ NdbRecAttr* ra1;
+ NdbRecAttr* ra2;
+ CHK((ra1 = g_opr->getValue("BL1")) != 0);
+ if (! g_opt.m_oneblob)
+ CHK((ra2 = g_opr->getValue("BL2")) != 0);
+ if (tup.m_exists) {
+ CHK(g_con->execute(Commit) == 0);
+ DBG("verifyHeadInline BL1");
+ CHK(verifyHeadInline(g_opt.m_blob1, tup.m_blob1, ra1) == 0);
+ if (! g_opt.m_oneblob) {
+ DBG("verifyHeadInline BL2");
+ CHK(verifyHeadInline(g_opt.m_blob2, tup.m_blob2, ra2) == 0);
+ }
+ } else {
+ CHK(g_con->execute(Commit) == -1 && g_con->getNdbError().code == 626);
+ }
+ g_ndb->closeTransaction(g_con);
+ g_opr = 0;
+ g_con = 0;
+ return 0;
+}
+
+static int
+verifyBlobTable(const Bcol& b, const Bval& v, Uint32 pk1, bool exists)
+{
+ DBG("verify " << b.m_btname << " pk1=" << pk1);
+ NdbRecAttr* ra_pk;
+ NdbRecAttr* ra_part;
+ NdbRecAttr* ra_data;
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ CHK((g_opr = g_con->getNdbOperation(b.m_btname)) != 0);
+ CHK(g_opr->openScanRead() == 0);
+ CHK((ra_pk = g_opr->getValue("PK")) != 0);
+ CHK((ra_part = g_opr->getValue("PART")) != 0);
+ CHK((ra_data = g_opr->getValue("DATA")) != 0);
+ CHK(g_con->executeScan() == 0);
+ unsigned partcount;
+ if (! exists || v.m_len <= b.m_inline)
+ partcount = 0;
+ else
+ partcount = (v.m_len - b.m_inline + b.m_partsize - 1) / b.m_partsize;
+ char* seen = new char [partcount];
+ memset(seen, 0, partcount);
+ while (1) {
+ int ret;
+ CHK((ret = g_con->nextScanResult()) == 0 || ret == 1);
+ if (ret == 1)
+ break;
+ if (pk1 != ra_pk->u_32_value())
+ continue;
+ Uint32 part = ra_part->u_32_value();
+ DBG("part " << part << " of " << partcount);
+ const char* data = ra_data->aRef();
+ CHK(part < partcount && ! seen[part]);
+ seen[part] = 1;
+ unsigned n = b.m_inline + part * b.m_partsize;
+ assert(exists && v.m_val != 0 && n < v.m_len);
+ unsigned m = v.m_len - n;
+ if (m > b.m_partsize)
+ m = b.m_partsize;
+ CHK(memcmp(data, v.m_val + n, m) == 0);
+ }
+ for (unsigned i = 0; i < partcount; i++)
+ CHK(seen[i] == 1);
+ g_ndb->closeTransaction(g_con);
+ g_opr = 0;
+ g_con = 0;
+ return 0;
+}
+
+static int
+verifyBlobTable(const Tup& tup)
+{
+ CHK(verifyBlobTable(g_opt.m_blob1, tup.m_blob1, tup.m_pk1, tup.m_exists) == 0);
+ if (! g_opt.m_oneblob)
+ CHK(verifyBlobTable(g_opt.m_blob2, tup.m_blob2, tup.m_pk1, tup.m_exists) == 0);
+ return 0;
+}
+
+static int
+verifyBlob()
+{
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ const Tup& tup = g_tups[k];
+ DBG("verifyBlob pk1=" << tup.m_pk1);
+ CHK(verifyHeadInline(tup) == 0);
+ CHK(verifyBlobTable(tup) == 0);
+ }
+ return 0;
+}
+
+// operations
+
+static int
+insertPk(bool rw)
+{
+ DBG("--- insertPk ---");
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ DBG("insertPk pk1=" << tup.m_pk1);
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ CHK((g_opr = g_con->getNdbOperation(g_opt.m_tname)) != 0);
+ CHK(g_opr->insertTuple() == 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((g_bh1 = g_opr->getBlobHandle("BL1")) != 0);
+ if (! g_opt.m_oneblob)
+ CHK((g_bh2 = g_opr->getBlobHandle("BL2")) != 0);
+ if (! rw) {
+ CHK(setBlobValue(g_bh1, tup.m_blob1) == 0);
+ if (! g_opt.m_oneblob)
+ CHK(setBlobValue(g_bh2, tup.m_blob2) == 0);
+ } else {
+ // non-nullable must be set
+ CHK(g_bh1->setValue("", 0) == 0);
+ CHK(g_con->execute(NoCommit) == 0);
+ CHK(writeBlobData(g_bh1, tup.m_blob1) == 0);
+ if (! g_opt.m_oneblob)
+ CHK(writeBlobData(g_bh2, tup.m_blob2) == 0);
+ }
+ CHK(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+ g_opr = 0;
+ g_con = 0;
+ tup.m_exists = true;
+ }
+ return 0;
+}
+
+static int
+updatePk(bool rw)
+{
+ DBG("--- updatePk ---");
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ DBG("updatePk pk1=" << tup.m_pk1);
+ 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((g_bh1 = g_opr->getBlobHandle("BL1")) != 0);
+ if (! g_opt.m_oneblob)
+ CHK((g_bh2 = g_opr->getBlobHandle("BL2")) != 0);
+ if (! rw) {
+ CHK(setBlobValue(g_bh1, tup.m_blob1) == 0);
+ if (! g_opt.m_oneblob)
+ CHK(setBlobValue(g_bh2, tup.m_blob2) == 0);
+ } else {
+ CHK(g_con->execute(NoCommit) == 0);
+ CHK(writeBlobData(g_bh1, tup.m_blob1) == 0);
+ if (! g_opt.m_oneblob)
+ CHK(writeBlobData(g_bh2, tup.m_blob2) == 0);
+ }
+ CHK(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+ g_opr = 0;
+ g_con = 0;
+ tup.m_exists = true;
+ }
+ return 0;
+}
+
+static int
+updateIdx(bool rw)
+{
+ DBG("--- updateIdx ---");
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ DBG("updateIdx pk1=" << tup.m_pk1);
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ CHK((g_opx = g_con->getNdbIndexOperation(g_opt.m_x1name, g_opt.m_tname)) != 0);
+ CHK(g_opx->updateTuple() == 0);
+ CHK(g_opx->equal("PK2", tup.m_pk2) == 0);
+ CHK((g_bh1 = g_opx->getBlobHandle("BL1")) != 0);
+ if (! g_opt.m_oneblob)
+ CHK((g_bh2 = g_opx->getBlobHandle("BL2")) != 0);
+ if (! rw) {
+ CHK(setBlobValue(g_bh1, tup.m_blob1) == 0);
+ if (! g_opt.m_oneblob)
+ CHK(setBlobValue(g_bh2, tup.m_blob2) == 0);
+ } else {
+ CHK(g_con->execute(NoCommit) == 0);
+ CHK(writeBlobData(g_bh1, tup.m_blob1) == 0);
+ if (! g_opt.m_oneblob)
+ CHK(writeBlobData(g_bh2, tup.m_blob2) == 0);
+ }
+ CHK(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+ g_opx = 0;
+ g_con = 0;
+ tup.m_exists = true;
+ }
+ return 0;
+}
+
+static int
+readPk(bool rw)
+{
+ DBG("--- readPk ---");
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ DBG("readPk pk1=" << tup.m_pk1);
+ 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((g_bh1 = g_opr->getBlobHandle("BL1")) != 0);
+ if (! g_opt.m_oneblob)
+ CHK((g_bh2 = g_opr->getBlobHandle("BL2")) != 0);
+ if (! rw) {
+ CHK(getBlobValue(tup) == 0);
+ } else {
+ CHK(g_con->execute(NoCommit) == 0);
+ CHK(readBlobData(tup) == 0);
+ }
+ CHK(g_con->execute(Commit) == 0);
+ if (! rw) {
+ CHK(verifyBlobValue(tup) == 0);
+ }
+ g_ndb->closeTransaction(g_con);
+ g_opr = 0;
+ g_con = 0;
+ }
+ return 0;
+}
+
+static int
+readIdx(bool rw)
+{
+ DBG("--- readIdx ---");
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ DBG("readIdx pk1=" << tup.m_pk1);
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ CHK((g_opx = g_con->getNdbIndexOperation(g_opt.m_x1name, g_opt.m_tname)) != 0);
+ CHK(g_opx->readTuple() == 0);
+ CHK(g_opx->equal("PK2", tup.m_pk2) == 0);
+ CHK((g_bh1 = g_opx->getBlobHandle("BL1")) != 0);
+ if (! g_opt.m_oneblob)
+ CHK((g_bh2 = g_opx->getBlobHandle("BL2")) != 0);
+ if (! rw) {
+ CHK(getBlobValue(tup) == 0);
+ } else {
+ CHK(g_con->execute(NoCommit) == 0);
+ CHK(readBlobData(tup) == 0);
+ }
+ CHK(g_con->execute(Commit) == 0);
+ if (! rw) {
+ CHK(verifyBlobValue(tup) == 0);
+ }
+ g_ndb->closeTransaction(g_con);
+ g_opx = 0;
+ g_con = 0;
+ }
+ return 0;
+}
+
+static int
+readScan(bool rw, bool idx)
+{
+ const char* func = ! idx ? "scan read table" : "scan read index";
+ DBG("--- " << func << " ---");
+ Tup tup;
+ tup.alloc(); // allocate buffers
+ NdbResultSet* rs;
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ if (! idx) {
+ CHK((g_ops = g_con->getNdbScanOperation(g_opt.m_tname)) != 0);
+ } else {
+ CHK((g_ops = g_con->getNdbScanOperation(g_opt.m_x2name, g_opt.m_tname)) != 0);
+ }
+ CHK((rs = g_ops->readTuples(240, NdbScanOperation::LM_Exclusive)) != 0);
+ CHK(g_ops->getValue("PK1", (char*)&tup.m_pk1) != 0);
+ if (g_opt.m_pk2len != 0)
+ CHK(g_ops->getValue("PK2", tup.m_pk2) != 0);
+ CHK((g_bh1 = g_ops->getBlobHandle("BL1")) != 0);
+ if (! g_opt.m_oneblob)
+ CHK((g_bh2 = g_ops->getBlobHandle("BL2")) != 0);
+ if (! rw) {
+ CHK(getBlobValue(tup) == 0);
+ }
+ CHK(g_con->execute(NoCommit) == 0);
+ unsigned rows = 0;
+ while (1) {
+ int ret;
+ tup.m_pk1 = (Uint32)-1;
+ memset(tup.m_pk2, 'x', g_opt.m_pk2len);
+ CHK((ret = rs->nextResult(true)) == 0 || ret == 1);
+ if (ret == 1)
+ break;
+ DBG(func << " pk1=" << tup.m_pk1);
+ Uint32 k = tup.m_pk1 - g_opt.m_pk1off;
+ CHK(k < g_opt.m_rows && g_tups[k].m_exists);
+ tup.copy(g_tups[k]);
+ if (! rw) {
+ CHK(verifyBlobValue(tup) == 0);
+ } else {
+ CHK(readBlobData(tup) == 0);
+ }
+ rows++;
+ }
+ g_ndb->closeTransaction(g_con);
+ g_con = 0;
+ g_ops = 0;
+ CHK(g_opt.m_rows == rows);
+ return 0;
+}
+
+static int
+deletePk()
+{
+ DBG("--- deletePk ---");
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ DBG("deletePk pk1=" << tup.m_pk1);
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ CHK((g_opr = g_con->getNdbOperation(g_opt.m_tname)) != 0);
+ CHK(g_opr->deleteTuple() == 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(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+ g_opr = 0;
+ g_con = 0;
+ tup.m_exists = false;
+ }
+ return 0;
+}
+
+static int
+deleteIdx()
+{
+ DBG("--- deleteIdx ---");
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ DBG("deleteIdx pk1=" << tup.m_pk1);
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ CHK((g_opx = g_con->getNdbIndexOperation(g_opt.m_x1name, g_opt.m_tname)) != 0);
+ CHK(g_opx->deleteTuple() == 0);
+ CHK(g_opx->equal("PK2", tup.m_pk2) == 0);
+ CHK(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+ g_opx = 0;
+ g_con = 0;
+ tup.m_exists = false;
+ }
+ return 0;
+}
+
+static int
+deleteScan(bool idx)
+{
+ const char* func = ! idx ? "scan delete table" : "scan delete index";
+ DBG("--- " << func << " ---");
+ Tup tup;
+ NdbResultSet* rs;
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ if (! idx) {
+ CHK((g_ops = g_con->getNdbScanOperation(g_opt.m_tname)) != 0);
+ } else {
+ CHK((g_ops = g_con->getNdbScanOperation(g_opt.m_x2name, g_opt.m_tname)) != 0);
+ }
+ CHK((rs = g_ops->readTuples(240, NdbScanOperation::LM_Exclusive)) != 0);
+ CHK(g_ops->getValue("PK1", (char*)&tup.m_pk1) != 0);
+ if (g_opt.m_pk2len != 0)
+ CHK(g_ops->getValue("PK2", tup.m_pk2) != 0);
+ CHK(g_con->execute(NoCommit) == 0);
+ unsigned rows = 0;
+ while (1) {
+ int ret;
+ tup.m_pk1 = (Uint32)-1;
+ memset(tup.m_pk2, 'x', g_opt.m_pk2len);
+ CHK((ret = rs->nextResult()) == 0 || ret == 1);
+ if (ret == 1)
+ break;
+ DBG(func << " pk1=" << tup.m_pk1);
+ CHK(rs->deleteTuple() == 0);
+ CHK(g_con->execute(NoCommit) == 0);
+ Uint32 k = tup.m_pk1 - g_opt.m_pk1off;
+ CHK(k < g_opt.m_rows && g_tups[k].m_exists);
+ g_tups[k].m_exists = false;
+ rows++;
+ }
+ CHK(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+ g_con = 0;
+ g_opr = 0;
+ g_ops = 0;
+ CHK(g_opt.m_rows == rows);
+ return 0;
+}
+
+// main
+
+static int
+testmain()
+{
+ g_ndb = new Ndb("TEST_DB");
+ CHK(g_ndb->init() == 0);
+ CHK(g_ndb->waitUntilReady() == 0);
+ g_dic = g_ndb->getDictionary();
+ g_tups = new Tup [g_opt.m_rows];
+ CHK(dropTable() == 0);
+ CHK(createTable() == 0);
+ if (g_opt.m_bugtest != 0) {
+ // test a general bug instead of blobs
+ CHK((*g_opt.m_bugtest)() == 0);
+ return 0;
+ }
+ Bcol& b1 = g_opt.m_blob1;
+ CHK(NdbBlob::getBlobTableName(b1.m_btname, g_ndb, g_opt.m_tname, "BL1") == 0);
+ DBG("BL1: inline=" << b1.m_inline << " part=" << b1.m_partsize << " table=" << b1.m_btname);
+ if (! g_opt.m_oneblob) {
+ Bcol& b2 = g_opt.m_blob2;
+ CHK(NdbBlob::getBlobTableName(b2.m_btname, g_ndb, g_opt.m_tname, "BL2") == 0);
+ DBG("BL2: inline=" << b2.m_inline << " part=" << b2.m_partsize << " table=" << b2.m_btname);
+ }
+ if (g_opt.m_seed != 0)
+ srandom(g_opt.m_seed);
+ for (unsigned loop = 0; g_opt.m_loop == 0 || loop < g_opt.m_loop; loop++) {
+ DBG("=== loop " << loop << " ===");
+ if (g_opt.m_seed == 0)
+ srandom(loop);
+ bool llim = skip('v') ? true : false;
+ bool ulim = skip('w') ? false : true;
+ // pk
+ for (int rw = llim; rw <= ulim; rw++) {
+ if (skip('k'))
+ continue;
+ DBG("--- pk ops " << (! rw ? "get/set" : "read/write") << " ---");
+ calcTups(false);
+ CHK(insertPk(rw) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readPk(rw) == 0);
+ if (! skip('u')) {
+ calcTups(rw);
+ CHK(updatePk(rw) == 0);
+ CHK(verifyBlob() == 0);
+ }
+ CHK(readPk(rw) == 0);
+ CHK(deletePk() == 0);
+ CHK(verifyBlob() == 0);
+ }
+ // hash index
+ for (int rw = llim; rw <= ulim; rw++) {
+ if (skip('i'))
+ continue;
+ DBG("--- idx ops " << (! rw ? "get/set" : "read/write") << " ---");
+ calcTups(false);
+ CHK(insertPk(rw) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readIdx(rw) == 0);
+ calcTups(rw);
+ if (! skip('u')) {
+ CHK(updateIdx(rw) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readIdx(rw) == 0);
+ }
+ CHK(deleteIdx() == 0);
+ CHK(verifyBlob() == 0);
+ }
+ // scan table
+ for (int rw = llim; rw <= ulim; rw++) {
+ if (skip('s'))
+ continue;
+ DBG("--- table scan " << (! rw ? "get/set" : "read/write") << " ---");
+ calcTups(false);
+ CHK(insertPk(rw) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readScan(rw, false) == 0);
+ CHK(deleteScan(false) == 0);
+ CHK(verifyBlob() == 0);
+ }
+ // scan index
+ for (int rw = llim; rw <= ulim; rw++) {
+ if (skip('r'))
+ continue;
+ DBG("--- index scan " << (! rw ? "get/set" : "read/write") << " ---");
+ calcTups(false);
+ CHK(insertPk(rw) == 0);
+ CHK(verifyBlob() == 0);
+ CHK(readScan(rw, true) == 0);
+ CHK(deleteScan(true) == 0);
+ CHK(verifyBlob() == 0);
+ }
+ }
+ delete g_ndb;
+ return 0;
+}
+
+// bug tests
+
+static int
+bugtest_4088()
+{
+ DBG("bug test 4088 - ndb api hang with mixed ops on index table");
+ // insert rows
+ calcTups(false);
+ CHK(insertPk(false) == 0);
+ // new trans
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ for (unsigned k = 0; k < g_opt.m_rows; k++) {
+ Tup& tup = g_tups[k];
+ // read table pk via index as a table
+ const unsigned pkcnt = 2;
+ Tup pktup[pkcnt];
+ for (unsigned i = 0; i < pkcnt; i++) {
+ char name[20];
+ // XXX guess table id
+ sprintf(name, "%d/%s", 4, g_opt.m_x1name);
+ CHK((g_opr = g_con->getNdbOperation(name)) != 0);
+ CHK(g_opr->readTuple() == 0);
+ CHK(g_opr->equal("PK2", tup.m_pk2) == 0);
+ CHK(g_opr->getValue("NDB$PK", (char*)&pktup[i].m_pk1) != 0);
+ }
+ // read blob inline via index as an index
+ CHK((g_opx = g_con->getNdbIndexOperation(g_opt.m_x1name, g_opt.m_tname)) != 0);
+ CHK(g_opx->readTuple() == 0);
+ CHK(g_opx->equal("PK2", tup.m_pk2) == 0);
+ assert(tup.m_blob1.m_buf != 0);
+ CHK(g_opx->getValue("BL1", (char*)tup.m_blob1.m_buf) != 0);
+ // execute
+ // BUG 4088: gets 1 tckeyconf, 1 tcindxconf, then hangs
+ CHK(g_con->execute(Commit) == 0);
+ // verify
+ for (unsigned i = 0; i < pkcnt; i++) {
+ CHK(pktup[i].m_pk1 == tup.m_pk1);
+ CHK(memcmp(pktup[i].m_pk2, tup.m_pk2, g_opt.m_pk2len) == 0);
+ }
+ CHK(memcmp(tup.m_blob1.m_val, tup.m_blob1.m_buf, 8 + g_opt.m_blob1.m_inline) == 0);
+ }
+ return 0;
+}
+
+static int
+bugtest_2222()
+{
+ return 0;
+}
+
+static int
+bugtest_3333()
+{
+ return 0;
+}
+
+static struct {
+ int m_bug;
+ int (*m_test)();
+} g_bugtest[] = {
+ { 4088, bugtest_4088 },
+ { 2222, bugtest_2222 },
+ { 3333, bugtest_3333 }
+};
+
+NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
+{
+ while (++argv, --argc > 0) {
+ const char* arg = argv[0];
+ if (strcmp(arg, "-core") == 0) {
+ g_opt.m_core = true;
+ continue;
+ }
+ if (strcmp(arg, "-dbg") == 0) {
+ g_opt.m_dbg = true;
+ continue;
+ }
+ if (strcmp(arg, "-dbgall") == 0) {
+ g_opt.m_dbg = true;
+ g_opt.m_dbgall = true;
+ putenv("NDB_BLOB_DEBUG=1");
+ continue;
+ }
+ if (strcmp(arg, "-full") == 0) {
+ g_opt.m_full = true;
+ continue;
+ }
+ if (strcmp(arg, "-loop") == 0) {
+ if (++argv, --argc > 0) {
+ g_opt.m_loop = atoi(argv[0]);
+ continue;
+ }
+ }
+ if (strcmp(arg, "-parts") == 0) {
+ if (++argv, --argc > 0) {
+ g_opt.m_parts = atoi(argv[0]);
+ continue;
+ }
+ }
+ if (strcmp(arg, "-rows") == 0) {
+ if (++argv, --argc > 0) {
+ g_opt.m_rows = atoi(argv[0]);
+ continue;
+ }
+ }
+ if (strcmp(arg, "-seed") == 0) {
+ if (++argv, --argc > 0) {
+ g_opt.m_seed = atoi(argv[0]);
+ continue;
+ }
+ }
+ if (strcmp(arg, "-skip") == 0) {
+ if (++argv, --argc > 0) {
+ for (const char* p = argv[0]; *p != 0; p++) {
+ skip(*p) = true;
+ }
+ continue;
+ }
+ }
+ // metadata
+ if (strcmp(arg, "-pk2len") == 0) {
+ if (++argv, --argc > 0) {
+ g_opt.m_pk2len = atoi(argv[0]);
+ if (g_opt.m_pk2len == 0) {
+ skip('i') = true;
+ skip('r') = true;
+ }
+ if (g_opt.m_pk2len <= g_max_pk2len)
+ continue;
+ }
+ }
+ if (strcmp(arg, "-oneblob") == 0) {
+ g_opt.m_oneblob = true;
+ continue;
+ }
+ // bugs
+ if (strcmp(arg, "-bug") == 0) {
+ if (++argv, --argc > 0) {
+ g_opt.m_bug = atoi(argv[0]);
+ for (unsigned i = 0; i < sizeof(g_bugtest)/sizeof(g_bugtest[0]); i++) {
+ if (g_opt.m_bug == g_bugtest[i].m_bug) {
+ g_opt.m_bugtest = g_bugtest[i].m_test;
+ break;
+ }
+ }
+ if (g_opt.m_bugtest != 0)
+ continue;
+ }
+ }
+ ndbout << "testOIBasic: unknown option " << arg << endl;
+ printusage();
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+ }
+ if (testmain() == -1) {
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+ return NDBT_ProgramExit(NDBT_OK);
+}
+
+// vim: set sw=2 et:
diff --git a/ndb/test/ndbapi/testBlobs/testBlobs.cpp b/ndb/test/ndbapi/testBlobs/testBlobs.cpp
deleted file mode 100644
index 9f959702402..00000000000
--- a/ndb/test/ndbapi/testBlobs/testBlobs.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/* Copyright (C) 2003 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/*
- * testBlobs
- */
-
-#include <ndb_global.h>
-
-#include <NdbMain.h>
-#include <NdbOut.hpp>
-#include <NdbThread.h>
-#include <NdbMutex.h>
-#include <NdbCondition.h>
-#include <NdbTest.hpp>
-#include <NdbTick.h>
-#include <ndb_limits.h>
-
-struct Opt {
- bool m_core;
- const char* m_table;
- Opt() :
- m_core(false),
- m_table("TB1")
- {
- }
-};
-
-static Opt opt;
-
-static void printusage()
-{
- Opt d;
- ndbout
- << "usage: testBlobs [options]" << endl
- << "-core dump core on error - default " << d.m_core << endl
- ;
-}
-
-static Ndb* myNdb = 0;
-static NdbDictionary::Dictionary* myDic = 0;
-static NdbConnection* myCon = 0;
-static NdbOperation* myOp = 0;
-static NdbBlob* myBlob = 0;
-
-static void
-fatal(const char* fmt, ...)
-{
- va_list ap;
- char buf[200];
- va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
- ndbout << "fatal: " << buf << endl;
- if (myNdb != 0 && myNdb->getNdbError().code != 0)
- ndbout << "ndb - " << myNdb->getNdbError() << endl;
- if (myDic != 0 && myDic->getNdbError().code != 0)
- ndbout << "dic - " << myDic->getNdbError() << endl;
- if (opt.m_core)
- abort();
- NDBT_ProgramExit(NDBT_FAILED);
- exit(1);
-}
-
-static void
-dropBlobsTable()
-{
- NdbDictionary::Table tab(NDB_BLOB_TABLE_NAME);
- if (myDic->dropTable(tab) == -1)
- if (myDic->getNdbError().code != 709)
- fatal("dropTable");
-}
-
-static void
-createBlobsTable()
-{
- NdbDictionary::Table tab(NDB_BLOB_TABLE_NAME);
- // col 0
- NdbDictionary::Column col0("BLOBID");
- col0.setPrimaryKey(true);
- col0.setType(NdbDictionary::Column::Bigunsigned);
- tab.addColumn(col0);
- // col 1
- NdbDictionary::Column col1("DATA");
- col1.setPrimaryKey(false);
- col1.setType(NdbDictionary::Column::Binary);
- col1.setLength(NDB_BLOB_PIECE_SIZE);
- tab.addColumn(col1);
- // create
- if (myDic->createTable(tab) == -1)
- fatal("createTable");
-}
-
-static void
-dropTable()
-{
- NdbDictionary::Table tab(opt.m_table);
- if (myDic->dropTable(tab) == -1)
- if (myDic->getNdbError().code != 709)
- fatal("dropTable");
-}
-
-static void
-createTable()
-{
- NdbDictionary::Table tab(opt.m_table);
- // col 0
- NdbDictionary::Column col0("A");
- col0.setPrimaryKey(true);
- col0.setType(NdbDictionary::Column::Unsigned);
- tab.addColumn(col0);
- // col 1
- NdbDictionary::Column col1("B");
- col1.setPrimaryKey(false);
- col1.setType(NdbDictionary::Column::Blob);
- tab.addColumn(col1);
- // create
- if (myDic->createTable(tab) == -1)
- fatal("createTable");
-}
-
-static void
-insertData(Uint32 key)
-{
-}
-
-static void
-insertTuples()
-{
- for (Uint32 key = 0; key <= 99; key++) {
- if ((myCon = myNdb->startTransaction()) == 0)
- fatal("startTransaction");
- if ((myOp = myCon->getNdbOperation(opt.m_table)) == 0)
- fatal("getNdbOperation");
- if (myOp->insertTuple() == -1)
- fatal("insertTuple");
- if (myOp->setValue((unsigned)0, key) == -1)
- fatal("setValue %u", (unsigned)key);
- if ((myBlob = myOp->setBlob(1)) == 0)
- fatal("setBlob");
- if (myCon->execute(NoCommit) == -1)
- fatal("execute NoCommit");
- insertData(key);
- if (myCon->execute(Commit) == -1)
- fatal("execute Commit");
- myNdb->closeTransaction(myCon);
- myOp = 0;
- myBlob = 0;
- myCon = 0;
- }
-}
-
-static void
-testMain()
-{
- myNdb = new Ndb("TEST_DB");
- if (myNdb->init() != 0)
- fatal("init");
- if (myNdb->waitUntilReady() < 0)
- fatal("waitUntilReady");
- myDic = myNdb->getDictionary();
- dropBlobsTable();
- createBlobsTable(); // until moved to Ndbcntr
- dropTable();
- createTable();
- insertTuples();
-}
-
-NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
-{
- while (++argv, --argc > 0) {
- const char* arg = argv[0];
- if (strcmp(arg, "-core") == 0) {
- opt.m_core = true;
- continue;
- }
- }
- testMain();
- return NDBT_ProgramExit(NDBT_OK);
-}
-
-// vim: set sw=4:
diff --git a/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp b/ndb/test/ndbapi/testDataBuffers.cpp
index b8e0fef6cef..75773040113 100644
--- a/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp
+++ b/ndb/test/ndbapi/testDataBuffers.cpp
@@ -34,7 +34,7 @@
#include <NdbOut.hpp>
#include <NdbApi.hpp>
#include <NdbTest.hpp>
-
+#include <NdbSchemaCon.hpp>
// limits
static int const MaxAttr = 64;
static int const MaxOper = 1000;
@@ -99,7 +99,7 @@ ndberror(char const* fmt, ...)
if (tcon)
ndbout << "tcon: " << tcon->getNdbError() << endl;
if (top)
- ndbout << "top : " << top->getNdbError() << endl;
+ ndbout << "top: " << top->getNdbError() << endl;
if (con)
ndbout << "con : " << con->getNdbError() << endl;
if (op)
@@ -258,7 +258,7 @@ testcase(int flag)
if (ndb->waitUntilReady(30) < 0)
return ndberror("waitUntilReady");
- if ((tcon = ndb->startSchemaTransaction()) == 0)
+ if ((tcon = NdbSchemaCon::startSchemaTrans(ndb)) == 0)
return ndberror("startSchemaTransaction");
if ((top = tcon->getNdbSchemaOp()) == 0)
return ndberror("getNdbSchemaOp");
diff --git a/ndb/test/ndbapi/testDict/testDict.cpp b/ndb/test/ndbapi/testDict.cpp
index 06614690b8d..1451c942362 100644
--- a/ndb/test/ndbapi/testDict/testDict.cpp
+++ b/ndb/test/ndbapi/testDict.cpp
@@ -1003,9 +1003,9 @@ int runGetPrimaryKey(NDBT_Context* ctx, NDBT_Step* step){
int
NF_codes[] = {
- 14000
- ,14001
- //,14002
+ 6003
+ ,6004
+ //,6005
};
int
diff --git a/ndb/test/ndbapi/testGrep/testGrep.cpp b/ndb/test/ndbapi/testGrep.cpp
index 4b870f6f9a9..4b870f6f9a9 100644
--- a/ndb/test/ndbapi/testGrep/testGrep.cpp
+++ b/ndb/test/ndbapi/testGrep.cpp
diff --git a/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp b/ndb/test/ndbapi/testGrepVerify.cpp
index 7fd2c19d9f7..05445c1ba1b 100644
--- a/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp
+++ b/ndb/test/ndbapi/testGrepVerify.cpp
@@ -74,16 +74,13 @@ int main(int argc, const char** argv){
if(table == 0)
return NDBT_ProgramExit(NDBT_WRONGARGS);
- Ndb::useFullyQualifiedNames(false);
-
Ndb * m_ndb = new Ndb("");
+ m_ndb->useFullyQualifiedNames(false);
m_ndb->setConnectString(connectString);
- Ndb::useFullyQualifiedNames(false);
/**
* @todo Set proper max no of transactions?? needed?? Default 12??
*/
m_ndb->init(2048);
- Ndb::useFullyQualifiedNames(false);
if (m_ndb->waitUntilReady() != 0){
ndbout_c("NDB Cluster not ready for connections");
}
diff --git a/ndb/test/ndbapi/testIndex/testIndex.cpp b/ndb/test/ndbapi/testIndex.cpp
index 47db0b3cff7..47db0b3cff7 100644
--- a/ndb/test/ndbapi/testIndex/testIndex.cpp
+++ b/ndb/test/ndbapi/testIndex.cpp
diff --git a/ndb/test/ndbapi/testInterpreter/testInterpreter.cpp b/ndb/test/ndbapi/testInterpreter.cpp
index 9c584d6f581..9c584d6f581 100644
--- a/ndb/test/ndbapi/testInterpreter/testInterpreter.cpp
+++ b/ndb/test/ndbapi/testInterpreter.cpp
diff --git a/ndb/test/ndbapi/testMgm/testMgm.cpp b/ndb/test/ndbapi/testMgm.cpp
index d5b9372cc9b..d5b9372cc9b 100644
--- a/ndb/test/ndbapi/testMgm/testMgm.cpp
+++ b/ndb/test/ndbapi/testMgm.cpp
diff --git a/ndb/test/ndbapi/testNdbApi/testNdbApi.cpp b/ndb/test/ndbapi/testNdbApi.cpp
index c0e262f590f..2e08ebbed4e 100644
--- a/ndb/test/ndbapi/testNdbApi/testNdbApi.cpp
+++ b/ndb/test/ndbapi/testNdbApi.cpp
@@ -23,8 +23,8 @@
#include <Vector.hpp>
#include <random.h>
#include <NdbTick.h>
-#include <AttrType.hpp>
+#define MAX_NDB_OBJECTS 32678
#define CHECK(b) if (!(b)) { \
ndbout << "ERR: "<< step->getName() \
@@ -79,7 +79,7 @@ int runTestMaxNdb(NDBT_Context* ctx, NDBT_Step* step){
ndbout << i << " ndb objects created" << endl;
- if (l > 0 && i != oldi && init != MAX_NO_THREADS){
+ if (l > 0 && i != oldi && init != MAX_NDB_OBJECTS){
ndbout << l << ": not as manyNdb objects created" << endl
<< i << " != " << oldi << endl;
result = NDBT_FAILED;
diff --git a/ndb/test/ndbapi/testNodeRestart/testNodeRestart.cpp b/ndb/test/ndbapi/testNodeRestart.cpp
index fd591f04c69..fd591f04c69 100644
--- a/ndb/test/ndbapi/testNodeRestart/testNodeRestart.cpp
+++ b/ndb/test/ndbapi/testNodeRestart.cpp
diff --git a/ndb/test/ndbapi/testOIBasic/testOIBasic.cpp b/ndb/test/ndbapi/testOIBasic.cpp
index a47d9d2099e..0ca8ce79e2e 100644
--- a/ndb/test/ndbapi/testOIBasic/testOIBasic.cpp
+++ b/ndb/test/ndbapi/testOIBasic.cpp
@@ -39,6 +39,7 @@ struct Opt {
NdbDictionary::Object::FragmentType m_fragtype;
const char* m_index;
unsigned m_loop;
+ bool m_nologging;
unsigned m_rows;
unsigned m_scanrd;
unsigned m_scanex;
@@ -54,6 +55,7 @@ struct Opt {
m_fragtype(NdbDictionary::Object::FragUndefined),
m_index(0),
m_loop(1),
+ m_nologging(false),
m_rows(1000),
m_scanrd(240),
m_scanex(240),
@@ -82,6 +84,7 @@ printhelp()
<< " -fragtype T fragment type single/small/medium/large" << endl
<< " -index xyz only given index numbers (digits 1-9)" << endl
<< " -loop N loop count full suite forever=0 [" << d.m_loop << "]" << endl
+ << " -nologging create tables in no-logging mode" << endl
<< " -rows N rows per thread [" << d.m_rows << "]" << endl
<< " -scanrd N scan read parallelism [" << d.m_scanrd << "]" << endl
<< " -scanex N scan exclusive parallelism [" << d.m_scanex << "]" << endl
@@ -476,7 +479,7 @@ tt1 = {
"TT1", 5, tt1col, 4, tt1itab
};
-// tt2 + tt2x1 tt2x2 tt2x3
+// tt2 + tt2x1 tt2x2 tt2x3 tt2x4
static const Col
tt2col[] = {
@@ -505,6 +508,14 @@ tt2x3col[] = {
{ 1, tt2col[4] }
};
+static const ICol
+tt2x4col[] = {
+ { 0, tt2col[4] },
+ { 1, tt2col[3] },
+ { 2, tt2col[2] },
+ { 3, tt2col[1] }
+};
+
static const ITab
tt2x1 = {
"TT2X1", 2, tt2x1col
@@ -521,15 +532,21 @@ tt2x3 = {
};
static const ITab
+tt2x4 = {
+ "TT2X4", 4, tt2x4col
+};
+
+static const ITab
tt2itab[] = {
tt2x1,
tt2x2,
- tt2x3
+ tt2x3,
+ tt2x4
};
static const Tab
tt2 = {
- "TT2", 5, tt2col, 3, tt2itab
+ "TT2", 5, tt2col, 4, tt2itab
};
// all tables
@@ -823,6 +840,9 @@ createtable(Par par)
if (par.m_fragtype != NdbDictionary::Object::FragUndefined) {
t.setFragmentType(par.m_fragtype);
}
+ if (par.m_nologging) {
+ t.setLogging(false);
+ }
for (unsigned k = 0; k < tab.m_cols; k++) {
const Col& col = tab.m_col[k];
NdbDictionary::Column c(col.m_name);
@@ -2202,7 +2222,6 @@ pkupdateindexbuild(Par par)
{
if (par.m_no == 0) {
CHK(createindex(par) == 0);
- CHK(invalidateindex(par) == 0);
} else {
CHK(pkupdate(par) == 0);
}
@@ -2493,6 +2512,7 @@ tbusybuild(Par par)
RUNSTEP(par, pkinsert, MT);
for (unsigned i = 0; i < par.m_subloop; i++) {
RUNSTEP(par, pkupdateindexbuild, MT);
+ RUNSTEP(par, invalidateindex, MT);
RUNSTEP(par, readverify, MT);
RUNSTEP(par, dropindex, ST);
}
@@ -2500,9 +2520,28 @@ tbusybuild(Par par)
}
static int
-ttiming(Par par)
+ttimebuild(Par par)
+{
+ Tmr t1;
+ RUNSTEP(par, droptable, ST);
+ RUNSTEP(par, createtable, ST);
+ RUNSTEP(par, invalidatetable, MT);
+ for (unsigned i = 0; i < par.m_subloop; i++) {
+ RUNSTEP(par, pkinsert, MT);
+ t1.on();
+ RUNSTEP(par, createindex, ST);
+ t1.off(par.m_totrows);
+ RUNSTEP(par, invalidateindex, MT);
+ RUNSTEP(par, dropindex, ST);
+ }
+ LL1("build index - " << t1.time());
+ return 0;
+}
+
+static int
+ttimemaint(Par par)
{
- Tmr t0, t1, t2;
+ Tmr t1, t2;
RUNSTEP(par, droptable, ST);
RUNSTEP(par, createtable, ST);
RUNSTEP(par, invalidatetable, MT);
@@ -2511,16 +2550,13 @@ ttiming(Par par)
t1.on();
RUNSTEP(par, pkupdate, MT);
t1.off(par.m_totrows);
- t0.on();
RUNSTEP(par, createindex, ST);
RUNSTEP(par, invalidateindex, MT);
- t0.off(par.m_totrows);
t2.on();
RUNSTEP(par, pkupdate, MT);
t2.off(par.m_totrows);
RUNSTEP(par, dropindex, ST);
}
- LL1("build index - " << t0.time());
LL1("update - " << t1.time());
LL1("update indexed - " << t2.time());
LL1("overhead - " << t2.over(t1));
@@ -2551,7 +2587,8 @@ tcaselist[] = {
TCase("b", tpkops, "pk operations and scan reads"),
TCase("c", tmixedops, "pk operations and scan operations"),
TCase("d", tbusybuild, "pk operations and index build"),
- TCase("t", ttiming, "time index build and maintenance"),
+ TCase("t", ttimebuild, "time index build"),
+ TCase("u", ttimemaint, "time index maintenance"),
TCase("z", tdrop, "drop test tables")
};
@@ -2689,6 +2726,10 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535)
continue;
}
}
+ if (strcmp(arg, "-nologging") == 0) {
+ g_opt.m_nologging = true;
+ continue;
+ }
if (strcmp(arg, "-rows") == 0) {
if (++argv, --argc > 0) {
g_opt.m_rows = atoi(argv[0]);
diff --git a/ndb/test/ndbapi/testOperations/testOperations.cpp b/ndb/test/ndbapi/testOperations.cpp
index bb58e69e898..bb58e69e898 100644
--- a/ndb/test/ndbapi/testOperations/testOperations.cpp
+++ b/ndb/test/ndbapi/testOperations.cpp
diff --git a/ndb/test/ndbapi/testOrderedIndex/testOrderedIndex.cpp b/ndb/test/ndbapi/testOrderedIndex.cpp
index 51cc53c9975..51cc53c9975 100644
--- a/ndb/test/ndbapi/testOrderedIndex/testOrderedIndex.cpp
+++ b/ndb/test/ndbapi/testOrderedIndex.cpp
diff --git a/ndb/test/ndbapi/testRestartGci/testRestartGci.cpp b/ndb/test/ndbapi/testRestartGci.cpp
index 1e36368ba62..e3dd1f8e2ce 100644
--- a/ndb/test/ndbapi/testRestartGci/testRestartGci.cpp
+++ b/ndb/test/ndbapi/testRestartGci.cpp
@@ -121,7 +121,7 @@ int runVerifyInserts(NDBT_Context* ctx, NDBT_Step* step){
HugoOperations hugoOps(*ctx->getTab());
NdbRestarter restarter;
- int restartGCI = pNdb->NdbTamper(ReadRestartGCI, 0);
+ int restartGCI = pNdb->NdbTamper(Ndb::ReadRestartGCI, 0);
ndbout << "restartGCI = " << restartGCI << endl;
int count = 0;
diff --git a/ndb/test/ndbapi/testScan/testScan.cpp b/ndb/test/ndbapi/testScan.cpp
index dbf91f016d8..bc3be0b7dc9 100644
--- a/ndb/test/ndbapi/testScan/testScan.cpp
+++ b/ndb/test/ndbapi/testScan.cpp
@@ -379,6 +379,31 @@ int runScanReadUntilStoppedNoCount(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
+int runScanReadUntilStoppedPrintTime(NDBT_Context* ctx, NDBT_Step* step){
+ int records = ctx->getNumRecords();
+ int i = 0;
+ int parallelism = ctx->getProperty("Parallelism", 240);
+ NdbTimer timer;
+ Ndb* ndb = GETNDB(step);
+
+
+ HugoTransactions hugoTrans(*ctx->getTab());
+ while (ctx->isTestStopped() == false) {
+ timer.doReset();
+ timer.doStart();
+ g_info << i << ": ";
+ if (ndb->waitUntilReady() != 0)
+ return NDBT_FAILED;
+ if (hugoTrans.scanReadRecords(GETNDB(step), records, 0, parallelism) != 0)
+ return NDBT_FAILED;
+ timer.doStop();
+ if ((timer.elapsedTime()/1000) > 1)
+ timer.printTotalTime();
+ i++;
+ }
+ return NDBT_OK;
+}
+
int runPkRead(NDBT_Context* ctx, NDBT_Step* step){
int loops = ctx->getNumLoops();
@@ -504,6 +529,64 @@ int runRestarter(NDBT_Context* ctx, NDBT_Step* step){
return result;
}
+
+int runStopAndStartNode(NDBT_Context* ctx, NDBT_Step* step){
+ int result = NDBT_OK;
+ int loops = ctx->getNumLoops();
+ NdbRestarter restarter;
+ int i = 0;
+ int lastId = 0;
+ int timeout = 240;
+
+ if (restarter.getNumDbNodes() < 2){
+ ctx->stopTest();
+ return NDBT_OK;
+ }
+ while(i<loops && result != NDBT_FAILED){
+ if(restarter.waitClusterStarted(timeout) != 0){
+ g_err << "Cluster failed to start 1" << endl;
+ result = NDBT_FAILED;
+ break;
+ }
+ NdbSleep_SecSleep(1);
+ int nodeId = restarter.getDbNodeId(lastId);
+ lastId = (lastId + 1) % restarter.getNumDbNodes();
+ g_err << "Stopping node " << nodeId << endl;
+
+ if(restarter.restartOneDbNode(nodeId, false, true) != 0){
+ g_err << "Failed to restartOneDbNode" << endl;
+ result = NDBT_FAILED;
+ break;
+ }
+
+ if(restarter.waitNodesNoStart(&nodeId, 1, timeout) != 0){
+ g_err << "Node failed to reach NoStart" << endl;
+ result = NDBT_FAILED;
+ break;
+ }
+
+ g_info << "Sleeping for 10 secs" << endl;
+ NdbSleep_SecSleep(10);
+
+ g_err << "Starting node " << nodeId << endl;
+ if(restarter.startNodes(&nodeId, 1) != 0){
+ g_err << "Failed to start the node" << endl;
+ result = NDBT_FAILED;
+ break;
+ }
+
+ i++;
+ }
+ if(restarter.waitClusterStarted(timeout) != 0){
+ g_err << "Cluster failed to start 2" << endl;
+ result = NDBT_FAILED;
+ }
+
+ ctx->stopTest();
+
+ return result;
+}
+
int runRestarter9999(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
int loops = ctx->getNumLoops();
@@ -1302,6 +1385,14 @@ TESTCASE("CheckAfterTerror",
STEPS(runScanRead, 5);
FINALIZER(runClearTable);
}
+TESTCASE("ScanReadWhileNodeIsDown",
+ "Scan requirement:A scan should be able to run as fast when "\
+ "one or more nodes in the cluster is down."){
+ INITIALIZER(runLoadTable);
+ STEP(runScanReadUntilStoppedPrintTime);
+ STEP(runStopAndStartNode);
+ FINALIZER(runClearTable);
+}
NDBT_TESTSUITE_END(testScan);
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/testScanInterpreter/testScanInterpreter.cpp b/ndb/test/ndbapi/testScanInterpreter.cpp
index 18fd98bdbb3..3b5baf954e0 100644
--- a/ndb/test/ndbapi/testScanInterpreter/testScanInterpreter.cpp
+++ b/ndb/test/ndbapi/testScanInterpreter.cpp
@@ -214,8 +214,8 @@ TESTCASE("ScanLessThan",
"Read all records in table TX with attrX less "\
"than a value and store the resultset in TX_RES."\
"Then compare records in TX_RES with records in TX."){
- TABLE("T1");
- TABLE("T2");
+ // TABLE("T1");
+ // TABLE("T2");
INITIALIZER(runLoadTable);
INITIALIZER(runCreateResultTable);
STEP(runScanLessThan);
@@ -227,8 +227,8 @@ TESTCASE("ScanEqual",
"Read all records in table TX with attrX equal "\
"to a value and store the resultset in TX_RES."\
"Then compare records in TX_RES with records in TX."){
- TABLE("T1");
- TABLE("T2");
+ // TABLE("T1");
+ // TABLE("T2");
INITIALIZER(runLoadTable);
INITIALIZER(runCreateResultTable);
STEP(runScanEqual);
@@ -239,8 +239,8 @@ TESTCASE("ScanEqual",
TESTCASE("ScanEqualLoop",
"Scan all records in TX equal to a value."\
"Do this loop number of times"){
- TABLE("T1");
- TABLE("T2");
+ // TABLE("T1");
+ // TABLE("T2");
INITIALIZER(runLoadTable);
INITIALIZER(runCreateResultTable);
STEP(runScanEqualLoop);
@@ -251,8 +251,8 @@ TESTCASE("ScanEqualVerifyLoop",
"Scan all records in TX equal to a value."\
"Verify record in TX_RES table"\
"Do this loop number of times"){
- TABLE("T1");
- TABLE("T2");
+ // TABLE("T1");
+ // TABLE("T2");
INITIALIZER(runLoadTable);
INITIALIZER(runCreateResultTable);
STEP(runScanEqualVerifyLoop);
@@ -262,8 +262,8 @@ TESTCASE("ScanEqualVerifyLoop",
TESTCASE("ScanLessThanLoop",
"Scan all records in TX less than a value."\
"Do this loop number of times"){
- TABLE("T1");
- TABLE("T2");
+ // TABLE("T1");
+ // TABLE("T2");
INITIALIZER(runLoadTable);
INITIALIZER(runCreateResultTable);
STEP(runScanLessThanLoop);
diff --git a/ndb/test/ndbapi/testScanPerf/Makefile b/ndb/test/ndbapi/testScanPerf/Makefile
new file mode 100644
index 00000000000..fdf5980b385
--- /dev/null
+++ b/ndb/test/ndbapi/testScanPerf/Makefile
@@ -0,0 +1,9 @@
+include .defs.mk
+
+TYPE = ndbapitest
+
+BIN_TARGET = testScanPerf
+
+SOURCES = testScanPerf.cpp
+
+include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/test/ndbapi/testScanPerf/testScanPerf.cpp b/ndb/test/ndbapi/testScanPerf/testScanPerf.cpp
new file mode 100644
index 00000000000..61af1ffb989
--- /dev/null
+++ b/ndb/test/ndbapi/testScanPerf/testScanPerf.cpp
@@ -0,0 +1,368 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <NDBT.hpp>
+#include <NDBT_Test.hpp>
+#include <HugoTransactions.hpp>
+#include <UtilTransactions.hpp>
+#include <random.h>
+#include <getarg.h>
+
+struct Parameter {
+ char * name;
+ unsigned value;
+ unsigned min;
+ unsigned max;
+};
+
+#define P_BATCH 0
+#define P_PARRA 1
+#define P_LOCK 2
+#define P_FILT 3
+#define P_BOUND 4
+#define P_ACCESS 5
+#define P_FETCH 6
+#define P_ROWS 7
+#define P_LOOPS 8
+#define P_CREATE 9
+#define P_LOAD 10
+
+#define P_MAX 11
+
+static
+Parameter
+g_paramters[] = {
+ { "batch", 0, 0, 1 }, // 0, 15
+ { "parallelism", 0, 0, 1 }, // 0, 1
+ { "lock", 0, 0, 2 }, // read, exclusive, dirty
+ { "filter", 0, 0, 3 }, // all, none, 1, 100
+ { "range", 0, 0, 3 }, // all, none, 1, 100
+ { "access", 0, 0, 2 }, // scan, idx, idx sorted
+ { "fetch", 0, 0, 1 }, // No, yes
+ { "size", 1000000, 1, ~0 },
+ { "iterations", 3, 1, ~0 },
+ { "create_drop", 1, 0, 1 },
+ { "data", 1, 0, 1 }
+};
+
+static Ndb* g_ndb = 0;
+static const NdbDictionary::Table * g_table;
+static const NdbDictionary::Index * g_index;
+static char g_tablename[256];
+static char g_indexname[256];
+
+int create_table();
+int load_table();
+int run_scan();
+int clear_table();
+int drop_table();
+
+int
+main(int argc, const char** argv){
+ int verbose = 1;
+ int optind = 0;
+
+ struct getargs args[1+P_MAX] = {
+ { "verbose", 'v', arg_flag, &verbose, "Print verbose status", "verbose" }
+ };
+ const int num_args = 1 + P_MAX;
+ for(int i = 0; i<P_MAX; i++){
+ args[i+1].long_name = g_paramters[i].name;
+ args[i+1].short_name = * g_paramters[i].name;
+ args[i+1].type = arg_integer;
+ args[i+1].value = &g_paramters[i].value;
+ BaseString tmp;
+ tmp.assfmt("min: %d max: %d", g_paramters[i].min, g_paramters[i].max);
+ args[i+1].help = strdup(tmp.c_str());
+ args[i+1].arg_help = 0;
+ }
+
+ if(getarg(args, num_args, argc, argv, &optind)) {
+ arg_printusage(args, num_args, argv[0], "tabname1 tabname2 ...");
+ return NDBT_WRONGARGS;
+ }
+
+ myRandom48Init(NdbTick_CurrentMillisecond());
+
+ g_ndb = new Ndb("TEST_DB");
+ if(g_ndb->init() != 0){
+ g_err << "init() failed" << endl;
+ goto error;
+ }
+ if(g_ndb->waitUntilReady() != 0){
+ g_err << "Wait until ready failed" << endl;
+ goto error;
+ }
+ for(int i = optind; i<argc; i++){
+ const char * T = argv[i];
+ g_info << "Testing " << T << endl;
+ snprintf(g_tablename, sizeof(g_tablename), T);
+ snprintf(g_indexname, sizeof(g_indexname), "IDX_%s", T);
+ if(create_table())
+ goto error;
+ if(load_table())
+ goto error;
+ if(run_scan())
+ goto error;
+ if(clear_table())
+ goto error;
+ if(drop_table())
+ goto error;
+ }
+
+ if(g_ndb) delete g_ndb;
+ return NDBT_OK;
+ error:
+ if(g_ndb) delete g_ndb;
+ return NDBT_FAILED;
+}
+
+int
+create_table(){
+ NdbDictionary::Dictionary* dict = g_ndb->getDictionary();
+ assert(dict);
+ if(g_paramters[P_CREATE].value){
+ const NdbDictionary::Table * pTab = NDBT_Tables::getTable(g_tablename);
+ assert(pTab);
+ NdbDictionary::Table copy = * pTab;
+ copy.setLogging(false);
+ if(dict->createTable(copy) != 0){
+ g_err << "Failed to create table: " << g_tablename << endl;
+ return -1;
+ }
+
+ NdbDictionary::Index x(g_indexname);
+ x.setTable(g_tablename);
+ x.setType(NdbDictionary::Index::OrderedIndex);
+ x.setLogging(false);
+ for (unsigned k = 0; k < copy.getNoOfColumns(); k++){
+ if(copy.getColumn(k)->getPrimaryKey()){
+ x.addColumnName(copy.getColumn(k)->getName());
+ }
+ }
+
+ if(dict->createIndex(x) != 0){
+ g_err << "Failed to create index: " << endl;
+ return -1;
+ }
+ }
+ g_table = dict->getTable(g_tablename);
+ g_index = dict->getIndex(g_indexname, g_tablename);
+ assert(g_table);
+ assert(g_index);
+ return 0;
+}
+
+int
+drop_table(){
+ if(!g_paramters[P_CREATE].value)
+ return 0;
+ if(g_ndb->getDictionary()->dropTable(g_table->getName()) != 0){
+ g_err << "Failed to drop table: " << g_table->getName() << endl;
+ return -1;
+ }
+ g_table = 0;
+ return 0;
+}
+
+int
+load_table(){
+ if(!g_paramters[P_LOAD].value)
+ return 0;
+
+ int rows = g_paramters[P_ROWS].value;
+ HugoTransactions hugoTrans(* g_table);
+ if (hugoTrans.loadTable(g_ndb, rows)){
+ g_err.println("Failed to load %s with %d rows", g_table->getName(), rows);
+ return -1;
+ }
+ return 0;
+}
+
+int
+clear_table(){
+ if(!g_paramters[P_LOAD].value)
+ return 0;
+
+ int rows = g_paramters[P_ROWS].value;
+
+ UtilTransactions utilTrans(* g_table);
+ if (utilTrans.clearTable(g_ndb, rows) != 0){
+ g_err.println("Failed to clear table %s", g_table->getName());
+ return -1;
+ }
+ return 0;
+}
+
+inline
+void err(NdbError e){
+ ndbout << e << endl;
+}
+
+int
+run_scan(){
+ int iter = g_paramters[P_LOOPS].value;
+ Uint64 start1;
+ Uint64 sum1 = 0;
+
+ Uint32 tot = g_paramters[P_ROWS].value;
+
+ for(int i = 0; i<iter; i++){
+ start1 = NdbTick_CurrentMillisecond();
+ NdbConnection * pTrans = g_ndb->startTransaction();
+ if(!pTrans){
+ g_err << "Failed to start transaction" << endl;
+ err(g_ndb->getNdbError());
+ return -1;
+ }
+
+ NdbScanOperation * pOp;
+#ifdef NdbIndexScanOperation_H
+ NdbIndexScanOperation * pIOp;
+#else
+ NdbScanOperation * pIOp;
+#endif
+
+ NdbResultSet * rs;
+ int par = g_paramters[P_PARRA].value;
+ int bat = g_paramters[P_BATCH].value;
+ NdbScanOperation::LockMode lm;
+ switch(g_paramters[P_LOCK].value){
+ case 0:
+ lm = NdbScanOperation::LM_Read;
+ break;
+ case 1:
+ lm = NdbScanOperation::LM_Exclusive;
+ break;
+ case 2:
+ lm = NdbScanOperation::LM_CommittedRead;
+ break;
+ default:
+ abort();
+ }
+
+ if(g_paramters[P_ACCESS].value == 0){
+ pOp = pTrans->getNdbScanOperation(g_tablename);
+ assert(pOp);
+#ifdef NdbIndexScanOperation_H
+ rs = pOp->readTuples(lm, bat, par);
+#else
+ int oldp = (par == 0 ? 240 : par) * (bat == 0 ? 15 : bat);
+ rs = pOp->readTuples(oldp > 240 ? 240 : oldp, lm);
+#endif
+ } else {
+#ifdef NdbIndexScanOperation_H
+ pOp = pIOp = pTrans->getNdbIndexScanOperation(g_indexname, g_tablename);
+ bool ord = g_paramters[P_ACCESS].value == 2;
+ rs = pIOp->readTuples(lm, bat, par, ord);
+#else
+ pOp = pIOp = pTrans->getNdbScanOperation(g_indexname, g_tablename);
+ assert(pOp);
+ int oldp = (par == 0 ? 240 : par) * (bat == 0 ? 15 : bat);
+ rs = pIOp->readTuples(oldp > 240 ? 240 : oldp, lm);
+#endif
+ switch(g_paramters[P_BOUND].value){
+ case 0: // All
+ break;
+ case 1: // None
+#ifdef NdbIndexScanOperation_H
+ pIOp->setBound((Uint32)0, NdbIndexScanOperation::BoundEQ, 0);
+#else
+ pIOp->setBound((Uint32)0, NdbOperation::BoundEQ, 0);
+#endif
+ break;
+ case 2: { // 1 row
+ default:
+ assert(g_table->getNoOfPrimaryKeys() == 1); // only impl. so far
+ abort();
+#if 0
+ int tot = g_paramters[P_ROWS].value;
+ int row = rand() % tot;
+ fix_eq_bound(pIOp, row);
+#endif
+ break;
+ }
+ }
+ }
+ assert(pOp);
+ assert(rs);
+
+ int check = 0;
+ switch(g_paramters[P_FILT].value){
+ case 0: // All
+ check = pOp->interpret_exit_ok();
+ break;
+ case 1: // None
+ check = pOp->interpret_exit_nok();
+ break;
+ case 2: { // 1 row
+ default:
+ assert(g_table->getNoOfPrimaryKeys() == 1); // only impl. so far
+ abort();
+#if 0
+ int tot = g_paramters[P_ROWS].value;
+ int row = rand() % tot;
+ NdbScanFilter filter(pOp) ;
+ filter.begin(NdbScanFilter::AND);
+ fix_eq(filter, pOp, row);
+ filter.end();
+ break;
+#endif
+ }
+ }
+ if(check != 0){
+ err(pOp->getNdbError());
+ return -1;
+ }
+ assert(check == 0);
+
+ for(int i = 0; i<g_table->getNoOfColumns(); i++){
+ pOp->getValue(i);
+ }
+
+ int rows = 0;
+ check = pTrans->execute(NoCommit);
+ assert(check == 0);
+ int fetch = g_paramters[P_FETCH].value;
+ while((check = rs->nextResult(true)) == 0){
+ do {
+ rows++;
+ } while(!fetch && ((check = rs->nextResult(false)) == 0));
+ if(check == -1){
+ err(pTrans->getNdbError());
+ return -1;
+ }
+ assert(check == 2);
+ }
+
+ if(check == -1){
+ err(pTrans->getNdbError());
+ return -1;
+ }
+ assert(check == 1);
+ g_info << "Found " << rows << " rows" << endl;
+
+ pTrans->close();
+
+ Uint64 stop = NdbTick_CurrentMillisecond();
+ start1 = (stop - start1);
+ sum1 += start1;
+ }
+ sum1 /= iter;
+
+ g_err.println("Avg time: %Ldms = %d rows/sec", sum1, (1000*tot)/sum1);
+ return 0;
+}
diff --git a/ndb/test/ndbapi/testSystemRestart/testSystemRestart.cpp b/ndb/test/ndbapi/testSystemRestart.cpp
index 1b8a35487cb..61e086ff941 100644
--- a/ndb/test/ndbapi/testSystemRestart/testSystemRestart.cpp
+++ b/ndb/test/ndbapi/testSystemRestart.cpp
@@ -805,6 +805,207 @@ int runSystemRestart5(NDBT_Context* ctx, NDBT_Step* step){
return result;
}
+int runSystemRestart6(NDBT_Context* ctx, NDBT_Step* step){
+ Ndb* pNdb = GETNDB(step);
+ int result = NDBT_OK;
+ int timeout = 300;
+ Uint32 loops = ctx->getNumLoops();
+ int records = ctx->getNumRecords();
+ NdbRestarter restarter;
+ Uint32 i = 1;
+
+ const Uint32 nodeCount = restarter.getNumDbNodes();
+ if(nodeCount < 2){
+ g_info << "SR6 - Needs atleast 2 nodes to test" << endl;
+ return NDBT_OK;
+ }
+
+ Vector<int> nodeIds;
+ for(Uint32 i = 0; i<nodeCount; i++)
+ nodeIds.push_back(restarter.getDbNodeId(i));
+
+ Uint32 currentRestartNodeIndex = 0;
+ UtilTransactions utilTrans(*ctx->getTab());
+ HugoTransactions hugoTrans(*ctx->getTab());
+
+ while(i<=loops && result != NDBT_FAILED){
+
+ g_info << "Loop " << i << "/"<< loops <<" started" << endl;
+ /**
+ * 1. Load data
+ * 2. Restart all node -nostart
+ * 3. Restart some nodes -i -nostart
+ * 4. Start all nodes verify records
+ */
+ g_info << "Loading records..." << endl;
+ hugoTrans.loadTable(pNdb, records);
+
+ CHECK(restarter.restartAll(false, true, false) == 0);
+
+ Uint32 nodeId = nodeIds[currentRestartNodeIndex];
+ currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
+
+ CHECK(restarter.restartOneDbNode(nodeId, true, true,false) == 0);
+ CHECK(restarter.waitClusterNoStart(timeout) == 0);
+ CHECK(restarter.startAll() == 0);
+ CHECK(restarter.waitClusterStarted(timeout) == 0);
+ CHECK(pNdb->waitUntilReady(timeout) == 0);
+ int count = records - 1;
+ CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
+ CHECK(count == records);
+ CHECK(utilTrans.clearTable(pNdb) == 0);
+ i++;
+ }
+
+ g_info << "runSystemRestart6 finished" << endl;
+
+ return result;
+}
+
+int runSystemRestart7(NDBT_Context* ctx, NDBT_Step* step){
+ Ndb* pNdb = GETNDB(step);
+ int result = NDBT_OK;
+ Uint32 loops = ctx->getNumLoops();
+ int records = ctx->getNumRecords();
+ NdbRestarter restarter;
+ Uint32 i = 1;
+
+ const Uint32 nodeCount = restarter.getNumDbNodes();
+ if(nodeCount < 2){
+ g_info << "SR8 - Needs atleast 2 nodes to test" << endl;
+ return NDBT_OK;
+ }
+
+ Vector<int> nodeIds;
+ for(Uint32 i = 0; i<nodeCount; i++)
+ nodeIds.push_back(restarter.getDbNodeId(i));
+
+ int a_nodeIds[64];
+ if(nodeCount > 64)
+ abort();
+
+ Uint32 currentRestartNodeIndex = 1;
+ UtilTransactions utilTrans(*ctx->getTab());
+ HugoTransactions hugoTrans(*ctx->getTab());
+
+ while(i<=loops && result != NDBT_FAILED){
+
+ g_info << "Loop " << i << "/"<< loops <<" started" << endl;
+ /**
+ * 1. Load data
+ * 2. Restart all node -nostart
+ * 3. Start all but one node
+ * 4. Wait for startphase >= 2
+ * 5. Start last node
+ * 6. Verify records
+ */
+ g_info << "Loading records..." << endl;
+ hugoTrans.loadTable(pNdb, records);
+
+ CHECK(restarter.restartAll(false, true, false) == 0);
+
+ int nodeId = nodeIds[currentRestartNodeIndex];
+ currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
+
+ Uint32 j = 0;
+ for(Uint32 k = 0; k<nodeCount; k++){
+ if(nodeIds[k] != nodeId){
+ a_nodeIds[j++] = nodeIds[k];
+ }
+ }
+
+ CHECK(restarter.startNodes(a_nodeIds, nodeCount - 1) == 0);
+ CHECK(restarter.waitNodesStarted(a_nodeIds, nodeCount - 1, 120) == 0);
+ CHECK(pNdb->waitUntilReady(5) == 0);
+ int count = records - 1;
+ CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
+ CHECK(count == records);
+
+ CHECK(restarter.startNodes(&nodeId, 1) == 0);
+ CHECK(restarter.waitNodesStarted(&nodeId, 1, 120) == 0);
+
+ CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
+ CHECK(count == records);
+ CHECK(utilTrans.clearTable(pNdb) == 0);
+
+ i++;
+ }
+
+ g_info << "runSystemRestart7 finished" << endl;
+
+ return result;
+}
+
+int runSystemRestart8(NDBT_Context* ctx, NDBT_Step* step){
+ Ndb* pNdb = GETNDB(step);
+ int result = NDBT_OK;
+ int timeout = 300;
+ Uint32 loops = ctx->getNumLoops();
+ int records = ctx->getNumRecords();
+ NdbRestarter restarter;
+ Uint32 i = 1;
+
+ const Uint32 nodeCount = restarter.getNumDbNodes();
+ if(nodeCount < 2){
+ g_info << "SR8 - Needs atleast 2 nodes to test" << endl;
+ return NDBT_OK;
+ }
+
+ Vector<int> nodeIds;
+ for(Uint32 i = 0; i<nodeCount; i++)
+ nodeIds.push_back(restarter.getDbNodeId(i));
+
+ int a_nodeIds[64];
+ if(nodeCount > 64)
+ abort();
+
+ Uint32 currentRestartNodeIndex = 1;
+ UtilTransactions utilTrans(*ctx->getTab());
+ HugoTransactions hugoTrans(*ctx->getTab());
+
+ while(i<=loops && result != NDBT_FAILED){
+
+ g_info << "Loop " << i << "/"<< loops <<" started" << endl;
+ /**
+ * 1. Load data
+ * 2. Restart all node -nostart
+ * 3. Start all but one node
+ * 4. Verify records
+ * 5. Start last node
+ * 6. Verify records
+ */
+ g_info << "Loading records..." << endl;
+ hugoTrans.loadTable(pNdb, records);
+
+ CHECK(restarter.restartAll(false, true, false) == 0);
+
+ int nodeId = nodeIds[currentRestartNodeIndex];
+ currentRestartNodeIndex = (currentRestartNodeIndex + 1 ) % nodeCount;
+
+ Uint32 j = 0;
+ for(Uint32 k = 0; k<nodeCount; k++){
+ if(nodeIds[k] != nodeId){
+ a_nodeIds[j++] = nodeIds[k];
+ }
+ }
+
+ CHECK(restarter.startNodes(a_nodeIds, nodeCount-1) == 0);
+ CHECK(restarter.waitNodesStartPhase(a_nodeIds, nodeCount-1, 3, 120) == 0);
+ CHECK(restarter.startNodes(&nodeId, 1) == 0);
+ CHECK(restarter.waitClusterStarted(timeout) == 0);
+
+ int count = records - 1;
+ CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
+ CHECK(count == records);
+ CHECK(utilTrans.clearTable(pNdb) == 0);
+ i++;
+ }
+
+ g_info << "runSystemRestart7 finished" << endl;
+
+ return result;
+}
+
int runWaitStarted(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter;
@@ -817,8 +1018,13 @@ int runWaitStarted(NDBT_Context* ctx, NDBT_Step* step){
int runClearTable(NDBT_Context* ctx, NDBT_Step* step){
int records = ctx->getNumRecords();
- UtilTransactions utilTrans(*ctx->getTab());
- if (utilTrans.clearTable2(GETNDB(step), records) != 0){
+ Ndb* pNdb = GETNDB(step);
+ if(pNdb->waitUntilReady(5) != 0){
+ return NDBT_FAILED;
+ }
+
+ UtilTransactions utilTrans(*ctx->getTab());
+ if (utilTrans.clearTable2(pNdb, records) != 0){
return NDBT_FAILED;
}
return NDBT_OK;
@@ -933,6 +1139,43 @@ TESTCASE("SR5",
STEP(runSystemRestart5);
FINALIZER(runClearTable);
}
+TESTCASE("SR6",
+ "Perform system restart with some nodes having FS others wo/\n"
+ "* 1. Load data\n"
+ "* 2. Restart all node -nostart\n"
+ "* 3. Restart some nodes -i -nostart\n"
+ "* 4. Start all nodes verify records\n"){
+ INITIALIZER(runWaitStarted);
+ INITIALIZER(runClearTable);
+ STEP(runSystemRestart6);
+ FINALIZER(runClearTable);
+}
+TESTCASE("SR7",
+ "Perform partition win system restart\n"
+ "* 1. Load data\n"
+ "* 2. Restart all node -nostart\n"
+ "* 3. Start all but one node\n"
+ "* 4. Verify records\n"
+ "* 5. Start last node\n"
+ "* 6. Verify records\n"){
+ INITIALIZER(runWaitStarted);
+ INITIALIZER(runClearTable);
+ STEP(runSystemRestart7);
+ FINALIZER(runClearTable);
+}
+TESTCASE("SR8",
+ "Perform partition win system restart with other nodes delayed\n"
+ "* 1. Load data\n"
+ "* 2. Restart all node -nostart\n"
+ "* 3. Start all but one node\n"
+ "* 4. Wait for startphase >= 2\n"
+ "* 5. Start last node\n"
+ "* 6. Verify records\n"){
+ INITIALIZER(runWaitStarted);
+ INITIALIZER(runClearTable);
+ STEP(runSystemRestart8);
+ FINALIZER(runClearTable);
+}
NDBT_TESTSUITE_END(testSystemRestart);
int main(int argc, const char** argv){
diff --git a/ndb/test/ndbapi/testTimeout/testTimeout.cpp b/ndb/test/ndbapi/testTimeout.cpp
index de1d2cfc40b..8a7866880b3 100644
--- a/ndb/test/ndbapi/testTimeout/testTimeout.cpp
+++ b/ndb/test/ndbapi/testTimeout.cpp
@@ -57,8 +57,8 @@ int runTimeoutTrans(NDBT_Context* ctx, NDBT_Step* step){
int stepNo = step->getStepNo();
Uint32 timeoutVal;
if (!conf.getProperty(nodeId,
- "DB",
- "TransactionInactiveTimeout",
+ NODE_TYPE_DB,
+ CFG_DB_TRANSACTION_INACTIVE_TIMEOUT,
&timeoutVal)){
return NDBT_FAILED;
}
@@ -103,8 +103,8 @@ int runDontTimeoutTrans(NDBT_Context* ctx, NDBT_Step* step){
int stepNo = step->getStepNo();
Uint32 timeoutVal;
if (!conf.getProperty(nodeId,
- "DB",
- "TransactionInactiveTimeout",
+ NODE_TYPE_DB,
+ CFG_DB_TRANSACTION_INACTIVE_TIMEOUT,
&timeoutVal)){
return NDBT_FAILED;
}
@@ -151,8 +151,8 @@ int runBuddyTransNoTimeout(NDBT_Context* ctx, NDBT_Step* step){
int stepNo = step->getStepNo();
Uint32 timeoutVal;
if (!conf.getProperty(nodeId,
- "DB",
- "TransactionInactiveTimeout",
+ NODE_TYPE_DB,
+ CFG_DB_TRANSACTION_INACTIVE_TIMEOUT,
&timeoutVal)){
return NDBT_FAILED;
}
diff --git a/ndb/test/ndbapi/testTransactions/testTransactions.cpp b/ndb/test/ndbapi/testTransactions.cpp
index 9ce928f8736..9ce928f8736 100644
--- a/ndb/test/ndbapi/testTransactions/testTransactions.cpp
+++ b/ndb/test/ndbapi/testTransactions.cpp
diff --git a/ndb/test/ndbapi/test_event/test_event.cpp b/ndb/test/ndbapi/test_event.cpp
index 40fc1c6defa..40fc1c6defa 100644
--- a/ndb/test/ndbapi/test_event/test_event.cpp
+++ b/ndb/test/ndbapi/test_event.cpp
diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp b/ndb/test/ndbapi/userInterface.cpp
index fdbc229cc98..fdbc229cc98 100644
--- a/ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp
+++ b/ndb/test/ndbapi/userInterface.cpp
diff --git a/ndb/test/newtonapi/Makefile b/ndb/test/newtonapi/Makefile
deleted file mode 100644
index e3eabd26c64..00000000000
--- a/ndb/test/newtonapi/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-include .defs.mk
-
-DIRS := \
- basic_test \
- perf_test
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/test/odbc/Makefile b/ndb/test/odbc/Makefile
deleted file mode 100644
index eb9f2dc9e3e..00000000000
--- a/ndb/test/odbc/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-include .defs.mk
-
-DIRS += driver
-
-#ifneq ($(findstring odbc, $(wildcard /usr/lib/libodbc.so)),)
-#DIRS += dm-unixodbc
-#endif
-
-ifneq ($(findstring $(NDB_OS), SOLARIS),)
-DIRS += dm-iodbc
-endif
-
-include ${NDB_TOP}/Epilogue.mk
diff --git a/ndb/test/odbc/driver/testOdbcDriver.cpp b/ndb/test/odbc/driver/testOdbcDriver.cpp
index b856b6a21f2..d3b3802ebe1 100644
--- a/ndb/test/odbc/driver/testOdbcDriver.cpp
+++ b/ndb/test/odbc/driver/testOdbcDriver.cpp
@@ -37,6 +37,7 @@
*/
#include <ndb_global.h>
+#undef test
#include <ndb_version.h>
#include <kernel/ndb_limits.h>
#include <Bitmask.hpp>
@@ -1281,6 +1282,7 @@ struct Fld {
return test.verify(m_double, m_ind, fld.m_double, fld.m_ind);
}
assert(false);
+ return false;
}
// debug
void print() const {
diff --git a/ndb/test/run-test/Makefile.am b/ndb/test/run-test/Makefile.am
new file mode 100644
index 00000000000..3dd9632ce4b
--- /dev/null
+++ b/ndb/test/run-test/Makefile.am
@@ -0,0 +1,18 @@
+
+ndbtest_PROGRAMS = atrt
+
+atrt_SOURCES = main.cpp
+
+ndbtest_SCRIPTS = atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
+ atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh
+EXTRA_DIST = $(ndbtest_SCRIPTS)
+
+INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmclient
+LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CpcClient.o $(top_builddir)/ndb/src/libndbclient.la
+
+include $(top_srcdir)/ndb/config/common.mk.am
+include $(top_srcdir)/ndb/config/type_util.mk.am
+include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/ndb/test/run-test/Makefile b/ndb/test/run-test/Makefile_old
index 6b4689b2dbb..6b4689b2dbb 100644
--- a/ndb/test/run-test/Makefile
+++ b/ndb/test/run-test/Makefile_old
diff --git a/ndb/test/run-test/README b/ndb/test/run-test/README
new file mode 100644
index 00000000000..d5da8f05c17
--- /dev/null
+++ b/ndb/test/run-test/README
@@ -0,0 +1,43 @@
+run-test/README
+
+This document describes how atrt works and how to use it.
+
+atrt is a test program driver.
+atrt supports fully distributed test and utilizes ndb_cpcd.
+
+=================================
+atrt has the following main loop:
+
+/**
+ * Psuedo code for atrt
+ */
+ read config file (default d.txt)
+ contact each ndb_cpcd
+ start each ndb_mgmd
+ connect to each ndb_mgmd
+ for each read(test case)
+ do
+ if previous test failed (or is first test)
+ stop each ndbd
+ start each ndbd
+ wait for ndbd to get started
+
+ start each mysqld
+
+ start each test prg
+
+ wait while all is running and max time not elapsed
+
+ stop each mysqld
+
+ stop each test prg
+
+ gather result
+
+ done
+/**
+ * End of psuedo code
+ */
+
+=================================
+
diff --git a/ndb/test/run-test/atrt-example.tgz b/ndb/test/run-test/atrt-example.tgz
new file mode 100644
index 00000000000..8455b2eb00d
--- /dev/null
+++ b/ndb/test/run-test/atrt-example.tgz
Binary files differ
diff --git a/ndb/test/run-test/basic.txt b/ndb/test/run-test/basic.txt
new file mode 100644
index 00000000000..a952320db08
--- /dev/null
+++ b/ndb/test/run-test/basic.txt
@@ -0,0 +1,763 @@
+# BASIC FUNCTIONALITY
+max-time: 500
+cmd: testBasic
+args: -n PkRead
+
+max-time: 500
+cmd: testBasic
+args: -n PkUpdate
+
+max-time: 500
+cmd: testBasic
+args: -n PkDelete
+
+max-time: 500
+cmd: testBasic
+args: -n PkInsert
+
+max-time: 600
+cmd: testBasic
+args: -n UpdateAndRead
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadAndLocker T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadAndLocker2 T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkReadUpdateAndLocker T6
+
+max-time: 500
+cmd: testBasic
+args: -n ReadWithLocksAndInserts T6
+
+max-time: 500
+cmd: testBasic
+args: -n PkInsertTwice T1 T6 T10
+
+max-time: 1500
+cmd: testBasic
+args: -n Fill T1
+
+max-time: 1500
+cmd: testBasic
+args: -n Fill T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitSleep T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitAndClose T6
+
+max-time: 500
+cmd: testBasic
+args: -n Commit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitTry626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitAsMuch626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit626 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitRollback626 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n Commit630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitTry630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitAsMuch630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommit630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitRollback630 T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n NoCommitAndClose T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackUpdate T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackDeleteMultiple T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n ImplicitRollbackDelete T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n CommitDelete T1 T6
+
+max-time: 500
+cmd: testBasic
+args: -n RollbackNothing T1 T6
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkInsertAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkReadAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkUpdateAsynch
+
+max-time: 500
+cmd: testBasicAsynch
+args: -n PkDeleteAsynch
+
+max-time: 500
+cmd: testBasic
+args: -n MassiveRollback T1 T6 T13
+
+max-time: 500
+cmd: testBasic
+args: -n MassiveRollback2 T1 T6 T13
+
+#-m 500 1: testBasic -n ReadConsistency T6
+cmd: testTimeout
+args: -n DontTimeoutTransaction T1
+
+cmd: testTimeout
+args: -n DontTimeoutTransaction5 T1
+
+cmd: testTimeout
+args: -n TimeoutTransaction T1
+
+cmd: testTimeout
+args: -n TimeoutTransaction5 T1
+
+cmd: testTimeout
+args: -n BuddyTransNoTimeout T1
+
+cmd: testTimeout
+args: -n BuddyTransNoTimeout5 T1
+
+#
+# SCAN TESTS
+#
+max-time: 500
+cmd: testScan
+args: -n ScanRead16
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead240
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadCommitted240
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdate
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdate2 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanDelete
+
+max-time: 500
+cmd: testScan
+args: -n ScanDelete2 T10
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateAndScanRead T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAndLocker T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAndPkRead T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanRead488 -l 10 T6
+
+max-time: 600
+cmd: testScan
+args: -n ScanRead40 -l 100 T2
+
+max-time: 1800
+cmd: testScan
+args: -n ScanRead100 -l 100 T1
+
+max-time: 600
+cmd: testScan
+args: -n ScanRead40 -l 100 T1
+
+max-time: 1800
+cmd: testScan
+args: -n ScanRead40RandomTable -l 100 T1
+
+max-time: 3600
+cmd: testScan
+args: -n ScanRead40RandomTable -l 1000 T2
+
+max-time: 500
+cmd: testScan
+args: -n ScanWithLocksAndInserts T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort15 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadAbort240 T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateAbort16 T6
+
+max-time: 3600
+cmd: testScan
+args: -n ScanReadRestart T1 T6 T13
+
+max-time: 500
+cmd: testScan
+args: -n ScanUpdateRestart T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckGetValue T6
+
+max-time: 500
+cmd: testScan
+args: -n CloseWithoutStop T6
+
+max-time: 500
+cmd: testScan
+args: -n NextScanWhenNoMore T6
+
+max-time: 500
+cmd: testScan
+args: -n ExecuteScanWithoutOpenScan T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOpenScanOnce T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneOpInScanTrans T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneOpBeforeOpenScan T6
+
+max-time: 500
+cmd: testScan
+args: -n OnlyOneScanPerTrans T6
+
+max-time: 500
+cmd: testScan
+args: -n NoCloseTransaction T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckInactivityTimeOut T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckInactivityBeforeClose T6
+
+max-time: 500
+cmd: testScan
+args: -n CheckAfterTerror T6
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5021 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReaderror5022 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5023 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5024 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5025 T1
+
+max-time: 500
+cmd: testScan
+args: -n ScanReadError5030 T1
+
+# OLD FLEX
+max-time: 500
+cmd: flexBench
+args: -c 25 -t 10
+
+max-time: 500
+cmd: flexHammer
+args: -r 5 -t 32
+
+#
+# DICT TESTS
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDrop
+
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDropWithData
+
+max-time: 1500
+cmd: testDict
+args: -n CreateAndDropDuring T6 T10
+
+max-time: 1500
+cmd: testDict
+args: -n CreateInvalidTables
+
+max-time: 1500
+cmd: testDict
+args: -n CreateTableWhenDbIsFull T6
+
+max-time: 1500
+cmd: testDict
+args: -n CreateMaxTables T6
+
+max-time: 500
+cmd: testDict
+args: -n FragmentTypeSingle T1
+
+max-time: 1500
+cmd: testDict
+args: -n FragmentTypeAll T1 T6 T7 T8
+
+max-time: 1500
+cmd: testDict
+args: -n FragmentTypeAllLarge T1 T6 T7 T8
+
+max-time: 1500
+cmd: testDict
+args: -n TemporaryTables T1 T6 T7 T8
+
+#
+# TEST NDBAPI
+#
+max-time: 500
+cmd: testDataBuffers
+args:
+
+# Testsuite: testNdbApi
+# Number of tests: 5
+max-time: 500
+cmd: testNdbApi
+args: -n MaxNdb T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxTransactions T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxOperations T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxGetValue T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxEqual
+
+max-time: 500
+cmd: testNdbApi
+args: -n DeleteNdb T1 T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n WaitUntilReady T1 T6 T7 T8 T13
+
+max-time: 500
+cmd: testNdbApi
+args: -n GetOperationNoTab T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n NdbErrorOperation T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n MissingOperation T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n GetValueInUpdate T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n UpdateWithoutKeys T6
+
+max-time: 500
+cmd: testNdbApi
+args: -n UpdateWithoutValues T6
+
+max-time: 500
+cmd: testInterpreter
+args: T1
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadRead
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadRead
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExRead
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertRead
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateRead
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteRead
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteReadEx
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteInsert
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteUpdate
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteDelete
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadDirtyRead
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n FReadDirtyRead
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n ReadExDirtyRead
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n InsertDirtyRead
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n UpdateDirtyRead
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteSimpleRead
+
+max-time: 1500
+cmd: testOperations
+args: -n DeleteDirtyRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadReadEx
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadInsert
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadUpdate
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadDelete
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExReadEx
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExInsert
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExUpdate
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExDelete
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertReadEx
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertInsert
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertUpdate
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertDelete
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateReadEx
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateInsert
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateUpdate
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateDelete
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteReadEx
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteInsert
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteUpdate
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteDelete
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadSimpleRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadDirtyRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExSimpleRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n ReadExDirtyRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertSimpleRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n InsertDirtyRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateSimpleRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n UpdateDirtyRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteSimpleRead
+
+max-time: 1500
+cmd: testTransactions
+args: -n DeleteDirtyRead
+
+max-time: 1500
+cmd: testRestartGci
+args: T6
+
diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp
index eb8a626dc2b..9e318b0219e 100644
--- a/ndb/test/run-test/main.cpp
+++ b/ndb/test/run-test/main.cpp
@@ -30,35 +30,6 @@
#include <mgmapi.h>
#include "CpcClient.hpp"
-/**
- psuedo code for run-test.bin
-
- define autotest_wrapper process at each host
- start ndb-processes
-
- for each testcase
- do
- start mysqld processes
- start replication processes
- start test programs
-
- wait until test program finished or max time passed
-
- stop test program
- stop replication processes
- stop mysqld processes
-
- write report data-file
- if test failed and ! last test
- restart ndb processes
-
- drop all tables created by test
- done
-
- stop ndb processes
- undefined wrapper processes
-*/
-
/** Global variables */
static const char progname[] = "ndb_atrt";
static const char * g_gather_progname = "atrt-gather-result.sh";
@@ -75,6 +46,7 @@ static const char * g_report_filename = 0;
static const char * g_default_user = 0;
static const char * g_default_base_dir = 0;
static int g_default_base_port = 0;
+static int g_mysqld_use_base = 1;
static int g_report = 0;
static int g_verbosity = 0;
@@ -158,10 +130,17 @@ main(int argc, const char ** argv){
if(!start_processes(g_config, atrt_process::NDB_DB))
goto end;
-
- if(!wait_ndb(g_config, NDB_MGM_NODE_STATUS_STARTED))
- goto end;
-
+
+ if(!wait_ndb(g_config, NDB_MGM_NODE_STATUS_NOT_STARTED))
+ goto end;
+
+ for(Uint32 i = 0; i<3; i++)
+ if(wait_ndb(g_config, NDB_MGM_NODE_STATUS_STARTED))
+ goto started;
+
+ goto end;
+
+started:
g_logger.info("Ndb start completed");
}
@@ -347,7 +326,7 @@ parse_args(int argc, const char** argv){
return false;
}
- g_default_user = strdup(getenv("USER"));
+ g_default_user = strdup(getenv("LOGNAME"));
return true;
}
@@ -377,6 +356,8 @@ setup_config(atrt_config& config){
int lineno = 0;
char buf[2048];
+ BaseString connect_string;
+ int mysql_port_offset = 0;
while(fgets(buf, 2048, f)){
lineno++;
@@ -408,6 +389,11 @@ setup_config(atrt_config& config){
continue;
}
+ if(split1[0].trim() == "mysqld-use-base" && split1[1].trim() == "no"){
+ g_mysqld_use_base = 0;
+ continue;
+ }
+
Vector<BaseString> hosts;
if(split1[1].trim().split(hosts) <= 0){
g_logger.warning("Invalid line %d in %s - ignoring",
@@ -449,8 +435,10 @@ setup_config(atrt_config& config){
for(size_t i = 0; i<hosts.size(); i++){
BaseString & tmp = hosts[i];
atrt_host * host = find(tmp, config.m_hosts);
+ BaseString & dir = host->m_base_dir;
const int index = config.m_processes.size() + 1;
+
atrt_process proc;
proc.m_index = index;
proc.m_host = host;
@@ -458,8 +446,8 @@ setup_config(atrt_config& config){
proc.m_proc.m_type = "temporary";
proc.m_proc.m_owner = "atrt";
proc.m_proc.m_group = "group";
- proc.m_proc.m_cwd.assign(host->m_base_dir).append("/run/");
- proc.m_proc.m_env.assign("LD_LIBRARY_PATH=").append(host->m_base_dir).append("/lib");
+ proc.m_proc.m_cwd.assign(dir).append("/run/");
+ proc.m_proc.m_env.assfmt("LD_LIBRARY_PATH=%s/lib/mysql", dir.c_str());
proc.m_proc.m_stdout = "log.out";
proc.m_proc.m_stderr = "2>&1";
proc.m_proc.m_runas = proc.m_host->m_user;
@@ -468,16 +456,33 @@ setup_config(atrt_config& config){
proc.m_ndb_mgm_port = g_default_base_port;
if(split1[0] == "mgm"){
proc.m_type = atrt_process::NDB_MGM;
- proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_mgm");
- proc.m_proc.m_path.assign(host->m_base_dir).append("/bin/mgmtsrvr");
+ proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_mgmd");
+ proc.m_proc.m_path.assign(dir).append("/libexec/ndb_mgmd");
proc.m_proc.m_args = "-n -c initconfig.txt";
- proc.m_proc.m_cwd.appfmt("%d.ndb_mgm", index);
+ proc.m_proc.m_cwd.appfmt("%d.ndb_mgmd", index);
+ connect_string.appfmt(";host=%s:%d",
+ proc.m_hostname.c_str(), proc.m_ndb_mgm_port);
} else if(split1[0] == "ndb"){
proc.m_type = atrt_process::NDB_DB;
- proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_db");
- proc.m_proc.m_path.assign(host->m_base_dir).append("/bin/ndb");
+ proc.m_proc.m_name.assfmt("%d-%s", index, "ndbd");
+ proc.m_proc.m_path.assign(dir).append("/libexec/ndbd");
proc.m_proc.m_args = "-i -n";
- proc.m_proc.m_cwd.appfmt("%d.ndb_db", index);
+ proc.m_proc.m_cwd.appfmt("%d.ndbd", index);
+ } else if(split1[0] == "mysqld"){
+ proc.m_type = atrt_process::MYSQL_SERVER;
+ proc.m_proc.m_name.assfmt("%d-%s", index, "mysqld");
+ proc.m_proc.m_path.assign(dir).append("/libexec/mysqld");
+ proc.m_proc.m_args = "--core-file --ndbcluster";
+ proc.m_proc.m_cwd.appfmt("%d.mysqld", index);
+ if(mysql_port_offset > 0 || g_mysqld_use_base){
+ // setup mysql specific stuff
+ const char * basedir = proc.m_proc.m_cwd.c_str();
+ proc.m_proc.m_args.appfmt("--datadir=%s", basedir);
+ proc.m_proc.m_args.appfmt("--pid-file=%s/mysql.pid", basedir);
+ proc.m_proc.m_args.appfmt("--socket=%s/mysql.sock", basedir);
+ proc.m_proc.m_args.appfmt("--port=%d",
+ g_default_base_port-(++mysql_port_offset));
+ }
} else if(split1[0] == "api"){
proc.m_type = atrt_process::NDB_API;
proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_api");
@@ -494,7 +499,13 @@ setup_config(atrt_config& config){
config.m_processes.push_back(proc);
}
}
-
+
+ // Setup connect string
+ for(size_t i = 0; i<config.m_processes.size(); i++){
+ config.m_processes[i].m_proc.m_env.appfmt(" NDB_CONNECTSTRING=nodeid=%d%s",
+ i+1, connect_string.c_str());
+ }
+
end:
fclose(f);
return result;
@@ -622,6 +633,11 @@ wait_ndb(atrt_config& config, int goal){
g_logger.critical("Strange DB status during start: %d %d", i, min2);
return false;
}
+
+ if(min2 < min){
+ g_logger.critical("wait ndb failed node: %d %d %d %d",
+ state->node_states[i].node_id, min, min2, goal);
+ }
}
}
@@ -691,7 +707,7 @@ bool
start_processes(atrt_config& config, int types){
for(size_t i = 0; i<config.m_processes.size(); i++){
atrt_process & proc = config.m_processes[i];
- if((types & proc.m_type) != 0){
+ if((types & proc.m_type) != 0 && proc.m_proc.m_path != ""){
if(!start_process(proc)){
return false;
}
@@ -759,18 +775,24 @@ update_status(atrt_config& config, int){
for(size_t i = 0; i<config.m_processes.size(); i++){
atrt_process & proc = config.m_processes[i];
- Vector<SimpleCpcClient::Process> & h_procs = m_procs[proc.m_host->m_index];
- bool found = false;
- for(size_t j = 0; j<h_procs.size(); j++){
- if(proc.m_proc.m_id == h_procs[j].m_id){
- found = true;
- proc.m_proc.m_status = h_procs[j].m_status;
- break;
+ if(proc.m_proc.m_id != -1){
+ Vector<SimpleCpcClient::Process> &h_procs= m_procs[proc.m_host->m_index];
+ bool found = false;
+ for(size_t j = 0; j<h_procs.size(); j++){
+ if(proc.m_proc.m_id == h_procs[j].m_id){
+ found = true;
+ proc.m_proc.m_status = h_procs[j].m_status;
+ break;
+ }
+ }
+ if(!found){
+ g_logger.error("update_status: not found");
+ g_logger.error("id: %d host: %s cmd: %s",
+ proc.m_proc.m_id,
+ proc.m_hostname.c_str(),
+ proc.m_proc.m_path.c_str());
+ return false;
}
- }
- if(!found){
- g_logger.error("update_status: not found");
- return false;
}
}
return true;
@@ -877,16 +899,24 @@ setup_test_case(atrt_config& config, const atrt_testcase& tc){
return false;
}
- for(size_t i = 0; i<config.m_processes.size(); i++){
+ size_t i = 0;
+ for(; i<config.m_processes.size(); i++){
atrt_process & proc = config.m_processes[i];
if(proc.m_type == atrt_process::NDB_API){
- proc.m_proc.m_path.assign(proc.m_host->m_base_dir).append("/bin/").append(tc.m_command);
+ proc.m_proc.m_path.assfmt("%s/bin/%s", proc.m_host->m_base_dir.c_str(),
+ tc.m_command.c_str());
proc.m_proc.m_args.assign(tc.m_args);
- return true;
+ break;
}
}
-
- return false;
+ for(i++; i<config.m_processes.size(); i++){
+ atrt_process & proc = config.m_processes[i];
+ if(proc.m_type == atrt_process::NDB_API){
+ proc.m_proc.m_path.assign("");
+ proc.m_proc.m_args.assign("");
+ }
+ }
+ return true;
}
bool
diff --git a/ndb/test/run-test/make-html-reports.sh b/ndb/test/run-test/make-html-reports.sh
index 079650a729f..89f13a4b62a 100755
--- a/ndb/test/run-test/make-html-reports.sh
+++ b/ndb/test/run-test/make-html-reports.sh
@@ -1,106 +1,23 @@
#!/bin/sh
-# NAME
-# make-html-reports.sh
-#
-# SYNOPSIS
-# make-html-reports.sh [-q] [ -R <YYYY-MM-DD> ] [ -s <src dir> ] [ -d <dst dir> ] [ -c <conf dir> ]
-#
-# DESCRIPTION
-#
-# OPTIONS
-#
-# EXAMPLES
-#
-#
-# ENVIRONMENT
-# NDB_PROJ_HOME Home dir for ndb
-#
-# FILES
-# $NDB_PROJ_HOME/lib/funcs.sh general shell script functions
-#
-#
-# SEE ALSO
-#
-# DIAGNOSTICTS
-#
-# VERSION
-# 1.0
-#
-# AUTHOR
-# Jonas Oreland
-#
-
-progname=`basename $0`
-synopsis="make-html-reports.sh [ -R <YYYY-MM-DD> ] [ -s <src dir> ] [ -d <dst dir> ] [ -c <conf dir> ]"
-
-: ${NDB_PROJ_HOME:?} # If undefined, exit with error message
-
-: ${NDB_LOCAL_BUILD_OPTIONS:=--} # If undef, set to --. Keeps getopts happy.
- # You may have to experiment a bit
- # to get quoting right (if you need it).
-
-
-. $NDB_PROJ_HOME/lib/funcs.sh # Load some good stuff
-
-# defaults for options related variables
-#
-
-
-src_dir=`pwd`
-dst_dir=`pwd`
-conf_dir=`pwd`
-report_date=`date '+%Y-%m-%d'`
-uniq_id=$$.$$
-verbose=yes
-
-# used if error when parsing the options environment variable
-#
-env_opterr="options environment variable: <<$options>>"
-
-# Option parsing, for the options variable as well as the command line.
-#
-# We want to be able to set options in an environment variable,
-# as well as on the command line. In order not to have to repeat
-# the same getopts information twice, we loop two times over the
-# getopts while loop. The first time, we process options from
-# the options environment variable, the second time we process
-# options from the command line.
-#
-# The things to change are the actual options and what they do.
-#
-#
-
-for optstring in "$options" "" # 1. options variable 2. cmd line
-do
-
- while getopts q:s:R:d:c: i $optstring # optstring empty => no arg => cmd line
- do
- case $i in
-
- q) verbose="";; # echo important things
- d) dst_dir=$OPTARG;; # Destination directory
- s) src_dir=$OPTARG;; # Destination directory
- c) conf_dir=$OPTARG;; #
- R) report_date=$OPTARG;; #
- \?) syndie $env_opterr;; # print synopsis and exit
-
- esac
- done
-
- [ -n "$optstring" ] && OPTIND=1 # Reset for round 2, cmdline options
- env_opterr= # Round 2 should not use the value
+src_dir=$1
+run=$2
+date=$3
+src_file=$src_dir/report.txt
-done
-shift `expr $OPTIND - 1`
-
-src_dir=`abspath $src_dir`
-dst_dir=`abspath $dst_dir`
-conf_dir=`abspath $conf_dir`
+if [ ! -f $src_dir/report.txt ]
+then
+ echo "$src_dir/report.txt is missing"
+ exit 1
+fi
###
#
# General html functions
+trim(){
+ echo $*
+}
+
header(){
cat <<EOF
<html><head><title>$*</title></head>
@@ -166,64 +83,7 @@ hr(){
EOF
}
-# --- option parsing done ---
-
# -- Verify
-trace "Verifying arguments"
-summary_file=$src_dir/reports/summary.$report_date
-
-if [ ! -r $summary_file ]
-then
- syndie "Invalid src directory or report date: $summary_file not found"
-fi
-
-if [ ! -d $conf_dir/configurations ]
-then
- syndie "Invalid src directory: $conf_dir/configurations not found"
-fi
-
-if [ ! -d $conf_dir/testcases ]
-then
- syndie "Invalid src directory: $conf_dir/testcases not found"
-fi
-
-if [ ! -d $dst_dir ]
-then
- syndie "Invalid dst dir..."
-fi
-
-# --- option verifying done ---
-
-trace "src_dir: $src_dir"
-trace "dst_dir: $dst_dir"
-trace "conf_dir: $conf_dir"
-trace "report date: $report_date"
-
-###
-config_spec(){
- cat <<EOF
-<a href=#$1>$1</a>
-EOF
-}
-
-config_spec_include(){
- # Print the $1 file to the file we are generating
- cat <<EOF
-<a name=$1><pre>
-EOF
- if [ -r $conf_dir/configurations/$1 ]
- then
- cat -E $conf_dir/configurations/$1 | sed 's/\$/<BR>/g'
- else
- cat <<EOF
- Config spec $1 not found
-EOF
- fi
-cat <<EOF
-</pre></a>
-EOF
-}
-
time_spec(){
# $1 - secs
_ts_tmp=$1
@@ -232,8 +92,14 @@ time_spec(){
_ts_tmp=`expr $_ts_tmp / 60`
_ts_m=`expr $_ts_tmp % 60`
- _ts_tmp=`expr $_ts_tmp / 60`
+ if [ $_ts_tmp -ge 60 ]
+ then
+ _ts_tmp=`expr $_ts_tmp / 60`
+ else
+ _ts_tmp=0
+ fi
+ a=3
_ts_h=$_ts_tmp
if [ $_ts_h -gt 0 ]
@@ -247,191 +113,77 @@ time_spec(){
echo $ret
}
-log_spec(){
- _ff_=$src_dir/log/$report_date/$1.$2/test.$3.out
- if [ -r $_ff_ ] && [ -s $_ff_ ]
- then
- _f2_=$dst_dir/log.$report_date.$1.$2.$3.out.gz
- if [ -r $_f2_ ]
- then
- rm $_f2_
- fi
- cp $_ff_ $dst_dir/log.$report_date.$1.$2.$3.out
- gzip $dst_dir/log.$report_date.$1.$2.$3.out
- rm -f $dst_dir/log.$report_date.$1.$2.$3.out
- echo "<a href=log.$report_date.$1.$2.$3.out.gz>Log file</a>"
- else
- echo "-"
- fi
-}
+### Main
-err_spec(){
- _ff_=$src_dir/log/$report_date/$1.$2/test.$3.err.tar
- if [ -r $_ff_ ] && [ -s $_ff_ ]
- then
- cp $_ff_ $dst_dir/err.$report_date.$1.$2.$3.err.tar
- gzip $dst_dir/err.$report_date.$1.$2.$3.err.tar
- rm -f $dst_dir/err.$report_date.$1.$2.$3.err.tar
- echo "<a href=err.$report_date.$1.$2.$3.err.tar.gz>Error tarball</a>"
- else
- echo "-"
- fi
-}
+report_file=$src_dir/report.html
+summary_file=$src_dir/summary.html
-command_spec(){
- echo $* | sed 's/;/<BR>/g'
-}
+passed=0
+failed=0
+total=0
-### Main
+pass(){
+ passed=`expr $passed + 1`
+}
-html_summary_file=$dst_dir/summary.$report_date.html
+fail(){
+ failed=`expr $failed + 1`
+}
-trace "Creating summary"
(
- eval `grep "TOTAL" $summary_file | awk -F";" '{ printf("test_file=\"%s\"; elapsed=\"%s\"; started=\"%s\"; stopped=\"%s\"", $2, $3, $4, $5); }'`
-
- header "Autotest summary $report_date"
- heading 1 "Autotest summary $report_date"
- table
- row ; column `bold test file: `; column $test_file ; end_row
- row ; column `bold Started:` ; column "$started "; end_row
- row ; column `bold Stopped:` ; column "$stopped "; end_row
- row ; column `bold Elapsed:` ; column "`time_spec $elapsed secs`" ; end_row
- end_table
- hr
-
- table "border=1"
- row
- c_column `bold Report`
- c_column `bold Tag`
- c_column `bold Version`
- c_column `bold Distr-Config`
- c_column `bold Db-Config`
- c_column `bold Type`
- c_column `bold Test file`
- c_column `bold Make`
- c_column `bold Config`
- c_column `bold Test time`
- c_column `bold Passed`
- c_column `bold Failed`
- end_row
-
- grep -v "^#" $summary_file | grep -v TOTAL | sed 's/;/ /g' | \
- while read tag version config template type test_file make_res make_time conf_res conf_time test_time passed failed
- do
+ header Report $run $date
+ table "border=1"
row
- if [ -r $src_dir/reports/report.$tag.$version.$config.$template.$type.$test_file.$report_date ]
- then
- column "<a href=\"report.$tag.$version.$config.$template.$type.$test_file.$report_date.html\">report</a>"
- else
- column "-"
- fi
-
- column $tag
- column $version
- column $config
- column $template
- column $type
- column $test_file
- column "$make_res(`time_spec $make_time`)"
- column "$conf_res(`time_spec $conf_time`)"
- c_column "`time_spec $test_time`"
- c_column `bold $passed`
- c_column `bold $failed`
+ column `bold Test case`
+ column `bold Result`
+ column `bold Elapsed`
+ column `bold Log`
end_row
- done
- end_table
+) > $report_file
- footer
-) > $html_summary_file
-
-for i in $src_dir/reports/report.*.$report_date
+cat $src_file | while read line
do
- f=`basename $i`
- trace "Creating report: $f"
- eval `echo $f | awk -F"." '{printf("tag=%s;version=%s;config=%s;template=%s;type=%s;test_file=%s", $2, $3, $4, $5, $6, $7);}'`
-
- (
- header "Autotest report $report_date"
- heading 1 "Autotest report $report_date"
- table #"border=1"
- row ; column `bold Tag:`; column $tag ; end_row
- row ; column `bold Version:` ; column $version ; end_row
- row ; column `bold Configuration:` ; column `config_spec $config`; end_row
- row ; column `bold Template:` ; column `config_spec $template`; end_row
- row ; column `bold Type:` ; column $type ; end_row
- row ; column `bold Test file:` ; column $test_file; end_row
- end_table
- hr
-
- table "border=1"
- row
- c_column `bold Test case`
- c_column `bold Result`
- c_column `bold Test time`
- c_column `bold Logfile`
- c_column `bold Error tarfile`
- end_row
-
- grep -v "^#" $i | sed 's/;/ /g' | \
- while read test_no test_res test_time cmd
- do
- row
- column "`command_spec $cmd`"
- case "$test_res" in
- 0)
- column "PASSED";;
- 1001)
- column "API error";;
- 1002)
- column "Max time expired";;
- 1003)
- column "Mgm port busy";;
- *)
- column "Unknown: $test_res";;
- esac
-
- column "`time_spec $test_time`"
-
- column "`log_spec $tag $version $test_no`"
- column "`err_spec $tag $version $test_no`"
- end_row
- done
- end_table
-
- # Last on page we include spec
- # of used machines and template for config
- # for future reference
- hr
- table "border=1"
- row; column `bold Configuration:` $config; end_row
- row; column `config_spec_include $config`; end_row
- end_table
- hr
- table "border=1"
- row; column `bold Template:` $template; end_row
- row; column `config_spec_include $template`; end_row
- end_table
-
- footer
-
- ) > $dst_dir/$f.html
+ eval `echo $line | awk -F";" '{ printf("prg=\"%s\"; no=\"%s\"; res=\"%s\"; time=\"%s\"", $1, $2, $3, $4); }'`
+
+ prg=`trim $prg`
+ no=`trim $no`
+ res=`trim $res`
+ time=`trim $time`
+ res_dir="<a href=\"result.$no/\">log</a>"
+
+ ts=`time_spec $time`
+ res_txt=""
+ case $res in
+ 0) pass; res_txt="PASSED"; res_dir="&nbsp;";;
+ *) fail; res_txt="FAILED";;
+ esac
+ total=`expr $total + $time`
+
+ (
+ row
+ column $prg
+ column $res_txt
+ column $ts
+ column $res_dir
+ end_row
+ ) >> $report_file
+
+ (
+ row
+ column $run
+ column $date
+ column $passed
+ column $failed
+ column `time_spec $total`
+ column "<a href=\"result-$run/$date/report.html\">report</a>"
+ column "<a href=\"result-$run/$date/log.txt\">log.txt</a>"
+ end_row
+ ) > $summary_file
done
-# Re creating index
-trace "Recreating index"
(
- header "Autotest super-duper index"
- heading 1 "<center>Autotest super-duper index</center>"
- hr
- for i in `ls $dst_dir/summary.*.html | sort -r -n`
- do
- f=`basename $i`
- cat <<EOF
-<p><a href=$f>$f</a></p>
-EOF
- done
- footer
-) > $dst_dir/index.html
+ end_table
+ footer
+) >> $report_file
exit 0
diff --git a/ndb/test/src/Makefile.am b/ndb/test/src/Makefile.am
new file mode 100644
index 00000000000..a513086dc33
--- /dev/null
+++ b/ndb/test/src/Makefile.am
@@ -0,0 +1,20 @@
+
+noinst_LIBRARIES = libNDBT.a
+
+libNDBT_a_SOURCES = \
+ NDBT_ReturnCodes.cpp \
+ NDBT_Error.cpp NDBT_Tables.cpp NDBT_ResultRow.cpp \
+ NDBT_Test.cpp HugoCalculator.cpp \
+ HugoOperations.cpp HugoTransactions.cpp \
+ HugoAsynchTransactions.cpp UtilTransactions.cpp \
+ NdbRestarter.cpp NdbRestarts.cpp NDBT_Output.cpp \
+ NdbBackup.cpp NdbConfig.cpp NdbGrep.cpp NDBT_Table.cpp \
+ NdbSchemaCon.cpp NdbSchemaOp.cpp
+
+INCLUDES_LOC = -I$(top_srcdir)/ndb/src/common/mgmcommon -I$(top_srcdir)/ndb/include/mgmcommon -I$(top_srcdir)/ndb/include/kernel -I$(top_srcdir)/ndb/src/mgmapi
+
+include $(top_srcdir)/ndb/config/common.mk.am
+include $(top_srcdir)/ndb/config/type_ndbapitest.mk.am
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/ndb/test/src/Makefile b/ndb/test/src/Makefile_old
index 2b634bcd3cd..2738ce1aba2 100644
--- a/ndb/test/src/Makefile
+++ b/ndb/test/src/Makefile_old
@@ -15,10 +15,12 @@ SOURCES = NDBT_ReturnCodes.cpp \
SOURCES.c =
CFLAGS_NdbRestarter.cpp := -I$(call fixpath,$(NDB_TOP)/src/common/mgmcommon)
-CFLAGS_NdbBackup.cpp := -I$(call fixpath,$(NDB_TOP)/include/mgmcommon)
-CFLAGS_NdbConfig.cpp := -I$(call fixpath,$(NDB_TOP)/include/mgmcommon)
+CFLAGS_NdbConfig.cpp := -I$(call fixpath,$(NDB_TOP)/include/mgmcommon) \
+ -I$(call fixpath,$(NDB_TOP)/src/mgmapi)
CFLAGS_NdbRestarts.cpp := -I$(call fixpath,$(NDB_TOP)/include/kernel)
-CFLAGS_NdbBackup.cpp += -I$(call fixpath,$(NDB_TOP)/include/kernel)
+CFLAGS_NdbBackup.cpp := -I$(call fixpath,$(NDB_TOP)/include/mgmcommon) \
+ -I$(call fixpath,$(NDB_TOP)/src/mgmapi) \
+ -I$(call fixpath,$(NDB_TOP)/include/kernel)
CFLAGS_NdbGrep.cpp += -I$(call fixpath,$(NDB_TOP)/include/kernel) -I$(call fixpath,$(NDB_TOP)/include/mgmcommon)
include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/test/src/NDBT_ResultRow.cpp b/ndb/test/src/NDBT_ResultRow.cpp
index ba46be203e1..7c419444760 100644
--- a/ndb/test/src/NDBT_ResultRow.cpp
+++ b/ndb/test/src/NDBT_ResultRow.cpp
@@ -17,6 +17,7 @@
#include <ndb_global.h>
#include "NDBT_ResultRow.hpp"
#include <NdbOut.hpp>
+#include <NdbSchemaCon.hpp>
NDBT_ResultRow::NDBT_ResultRow(const NdbDictionary::Table& tab,
char attrib_delimiter)
@@ -111,77 +112,8 @@ BaseString NDBT_ResultRow::c_str() {
NdbOut &
operator << (NdbOut& ndbout, const NDBT_ResultRow & res) {
- for(int i = 0; i<res.cols; i++){
- if(res.data[i]->isNULL())
- ndbout << "NULL";
- else{
- const int size = res.data[i]->attrSize();
- const int aSize = res.data[i]->arraySize();
- switch(res.data[i]->attrType()){
- case UnSigned:
- switch(size){
- case 8:
- ndbout << res.data[i]->u_64_value();
- break;
- case 4:
- ndbout << res.data[i]->u_32_value();
- break;
- case 2:
- ndbout << res.data[i]->u_short_value();
- break;
- case 1:
- ndbout << (unsigned) res.data[i]->u_char_value();
- break;
- default:
- ndbout << "Unknown size";
- }
- break;
-
- case Signed:
- switch(size){
- case 8:
- ndbout << res.data[i]->int64_value();
- break;
- case 4:
- ndbout << res.data[i]->int32_value();
- break;
- case 2:
- ndbout << res.data[i]->short_value();
- break;
- case 1:
- ndbout << (int) res.data[i]->char_value();
- break;
- default:
- ndbout << "Unknown size";
- }
- break;
-
- case String:
- {
- char * buf = new char[aSize+1];
- memcpy(buf, res.data[i]->aRef(), aSize);
- buf[aSize] = 0;
- ndbout << buf;
- delete [] buf;
- // Null terminate string
- //res.data[i][res.sizes[i]] = 0;
- //ndbout << res.data[i];
- }
- break;
-
- case Float:
- ndbout_c("%f", res.data[i]->float_value());
- break;
-
- default:
- ndbout << "Unknown(" << res.data[i]->attrType() << ")";
- break;
- }
- }
- if (i < res.cols-1)
- ndbout << res.ad;
- }
-
+ for(int i = 0; i<res.cols; i++)
+ ndbout << *(res.data[i]) << "\t";
return ndbout;
}
diff --git a/ndb/test/src/NDBT_Table.cpp b/ndb/test/src/NDBT_Table.cpp
index c520b01c990..485377e690a 100644
--- a/ndb/test/src/NDBT_Table.cpp
+++ b/ndb/test/src/NDBT_Table.cpp
@@ -14,105 +14,35 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include "NDBT_Table.hpp"
+#include <NDBT_Table.hpp>
#include <NdbTimer.hpp>
#include <NDBT.hpp>
-
class NdbOut&
operator <<(class NdbOut& ndbout, const NDBT_Attribute & attr){
NdbDictionary::Column::Type type = attr.getType();
- bool key = attr.getPrimaryKey();
- bool null = attr.getNullable();
- ndbout << attr.getName() << "\t";
- char tmp[100];
- if(attr.getLength() != 1)
- snprintf(tmp, 100," [%d]", attr.getLength());
- else
- tmp[0] = 0;
+ ndbout << attr.getName() << " " << type;
switch(type){
- case NdbDictionary::Column::Tinyint:
- ndbout << "Tinyint" << tmp;
- break;
- case NdbDictionary::Column::Tinyunsigned:
- ndbout << "Tinyunsigned" << tmp;
- break;
- case NdbDictionary::Column::Smallint:
- ndbout << "Smallint" << tmp;
- break;
- case NdbDictionary::Column::Smallunsigned:
- ndbout << "Smallunsigned" << tmp;
- break;
- case NdbDictionary::Column::Mediumint:
- ndbout << "Mediumint" << tmp;
- break;
- case NdbDictionary::Column::Mediumunsigned:
- ndbout << "Mediumunsigned" << tmp;
- break;
- case NdbDictionary::Column::Int:
- ndbout << "Int" << tmp;
- break;
- case NdbDictionary::Column::Unsigned:
- ndbout << "Unsigned" << tmp;
- break;
- case NdbDictionary::Column::Bigint:
- ndbout << "Bigint" << tmp;
- break;
- case NdbDictionary::Column::Bigunsigned:
- ndbout << "Bigunsigned" << tmp;
- break;
- case NdbDictionary::Column::Float:
- ndbout << "Float" << tmp;
- break;
- case NdbDictionary::Column::Double:
- ndbout << "Double" << tmp;
- break;
case NdbDictionary::Column::Decimal:
- ndbout << "Decimal("
- << attr.getScale() << ", " << attr.getPrecision() << ")"
- << tmp;
- break;
- case NdbDictionary::Column::Char:
- ndbout << "Char(" << attr.getLength() << ")";
- break;
- case NdbDictionary::Column::Varchar:
- ndbout << "Varchar(" << attr.getLength() << ")";
- break;
- case NdbDictionary::Column::Binary:
- ndbout << "Binary(" << attr.getLength() << ")";
- break;
- case NdbDictionary::Column::Varbinary:
- ndbout << "Varbinary(" << attr.getLength() << ")";
- break;
- case NdbDictionary::Column::Datetime:
- ndbout << "Datetime" << tmp;
- break;
- case NdbDictionary::Column::Timespec:
- ndbout << "Timespec" << tmp;
- break;
- case NdbDictionary::Column::Blob:
- ndbout << "Blob" << tmp;
- break;
- case NdbDictionary::Column::Undefined:
- ndbout << "Undefined" << tmp;
+ ndbout << "(" << attr.getScale() << ", " << attr.getPrecision() << ")";
break;
default:
- ndbout << "Unknown(" << type << ")";
+ break;
}
- ndbout << "\t";
- if(null){
- ndbout << "NULL";
- } else {
- ndbout << "NOT NULL";
- }
- ndbout << "\t";
+ if(attr.getLength() != 1)
+ ndbout << "[" << attr.getLength() << "]";
+
+ if(attr.getNullable())
+ ndbout << " NULL";
+ else
+ ndbout << " NOT NULL";
- if(key)
- ndbout << "\tprimary key";
+ if(attr.getPrimaryKey())
+ ndbout << " PRIMARY KEY";
return ndbout;
}
@@ -130,6 +60,9 @@ operator <<(class NdbOut& ndbout, const NDBT_Table & tab)
ndbout << "Temporary table: " << (tab.getStoredTable() ? "no" : "yes") << endl;
ndbout << "Number of attributes: " << tab.getNoOfColumns() << endl;
ndbout << "Number of primary keys: " << tab.getNoOfPrimaryKeys() << endl;
+ ndbout << "Length of frm data: " << tab.getFrmLength() << endl;
+
+
//<< ((tab.getTupleKey() == TupleId) ? " tupleid" : "") <<endl;
ndbout << "TableStatus: ";
switch(tab.getObjectStatus()){
@@ -154,3 +87,32 @@ operator <<(class NdbOut& ndbout, const NDBT_Table & tab)
return ndbout;
}
+
+class NdbOut& operator <<(class NdbOut&, const NdbDictionary::Index & idx)
+{
+ ndbout << idx.getName();
+ ndbout << "(";
+ for (unsigned i=0; i < idx.getNoOfColumns(); i++)
+ {
+ const NdbDictionary::Column *col = idx.getColumn(i);
+ ndbout << col->getName();
+ if (i < idx.getNoOfColumns()-1)
+ ndbout << ", ";
+ }
+ ndbout << ")";
+
+ ndbout << " - ";
+ switch (idx.getType()) {
+ case NdbDictionary::Object::UniqueHashIndex:
+ ndbout << "UniqueHashIndex";
+ break;
+ case NdbDictionary::Object::OrderedIndex:
+ ndbout << "OrderedIndex";
+ break;
+ default:
+ ndbout << "Type " << idx.getType();
+ break;
+ }
+ return ndbout;
+}
+
diff --git a/ndb/test/src/NdbBackup.cpp b/ndb/test/src/NdbBackup.cpp
index 6cbb69508f5..169034e0c07 100644
--- a/ndb/test/src/NdbBackup.cpp
+++ b/ndb/test/src/NdbBackup.cpp
@@ -19,7 +19,6 @@
#include <NdbOut.hpp>
#include <NDBT_Output.hpp>
#include <NdbConfig.h>
-#include <ConfigRetriever.hpp>
#include <ndb_version.h>
#include <NDBT.hpp>
#include <NdbSleep.h>
@@ -32,6 +31,10 @@
<< " (Line: " << __LINE__ << ")" << "- " << _xx << endl; \
return NDBT_FAILED; } }
+#include <ConfigRetriever.hpp>
+#include <mgmapi.h>
+#include <mgmapi_config_parameters.h>
+#include <mgmapi_configuration.hpp>
int
NdbBackup::start(unsigned int & _backup_id){
@@ -68,16 +71,12 @@ NdbBackup::getFileSystemPathForNode(int _node_id){
*/
ConfigRetriever cr;
-
- Properties * p = cr.getConfig(host,
- port,
- _node_id,
- NDB_VERSION);
+ ndb_mgm_configuration * p = cr.getConfig(host, port, 0);
if(p == 0){
const char * s = cr.getErrorString();
if(s == 0)
s = "No error given!";
-
+
ndbout << "Could not fetch configuration" << endl;
ndbout << s << endl;
return NULL;
@@ -86,19 +85,20 @@ NdbBackup::getFileSystemPathForNode(int _node_id){
/**
* Setup cluster configuration data
*/
- const Properties * db = 0;
- if (!p->get("Node", _node_id, &db)) {
+ ndb_mgm_configuration_iterator iter(* p, CFG_SECTION_NODE);
+ if (iter.find(CFG_NODE_ID, _node_id)){
ndbout << "Invalid configuration fetched, DB missing" << endl;
return NULL;
}
- const char * type;
- if(!(db->get("Type", &type) && strcmp(type, "DB") == 0)){
+ unsigned int type = 123456;
+ if(iter.get(CFG_TYPE_OF_SECTION, &type) || type != NODE_TYPE_DB){
+ ndbout <<"type = " << type << endl;
ndbout <<"Invalid configuration fetched, I'm wrong type of node" << endl;
return NULL;
}
-
+
const char * path;
- if (!db->get("FileSystemPath", &path)){
+ if (iter.get(CFG_DB_FILESYSTEM_PATH, &path)){
ndbout << "FileSystemPath not found" << endl;
return NULL;
}
@@ -115,10 +115,13 @@ NdbBackup::execRestore(bool _restore_data,
const int buf_len = 1000;
char buf[buf_len];
+ ndbout << "getFileSystemPathForNode "<< _node_id <<endl;
+
const char* path = getFileSystemPathForNode(_node_id);
if (path == NULL)
return -1;
+ ndbout << "getHostName "<< _node_id <<endl;
const char *host;
if (!getHostName(_node_id, &host)){
return -1;
@@ -139,7 +142,7 @@ NdbBackup::execRestore(bool _restore_data,
ndbout << "res: " << res << endl;
#if 0
- snprintf(buf, 255, "restore -c \"nodeid=%d;host=%s\" -n %d -b %d %s %s %s/BACKUP/BACKUP-%d",
+ snprintf(buf, 255, "ndb_restore -c \"nodeid=%d;host=%s\" -n %d -b %d %s %s %s/BACKUP/BACKUP-%d",
ownNodeId,
addr,
_node_id,
@@ -151,7 +154,7 @@ NdbBackup::execRestore(bool _restore_data,
#endif
- snprintf(buf, 255, "restore -c \"nodeid=%d;host=%s\" -n %d -b %d %s %s .",
+ snprintf(buf, 255, "ndb_restore -c \"nodeid=%d;host=%s\" -n %d -b %d %s %s .",
ownNodeId,
addr,
_node_id,
diff --git a/ndb/test/src/NdbConfig.cpp b/ndb/test/src/NdbConfig.cpp
index 3a254bc1577..2fb466d1b8f 100644
--- a/ndb/test/src/NdbConfig.cpp
+++ b/ndb/test/src/NdbConfig.cpp
@@ -17,144 +17,67 @@
#include "NdbConfig.hpp"
#include <NdbOut.hpp>
#include <NDBT_Output.hpp>
+#include <assert.h>
#include <NdbConfig.h>
#include <ConfigRetriever.hpp>
#include <ndb_version.h>
-
-
+#include <mgmapi.h>
+#include <mgmapi_config_parameters.h>
+#include <mgmapi_configuration.hpp>
bool
-NdbConfig::getPropsForNode(unsigned int node_id,
- const char* type,
- const Properties ** props) const {
-
- /**
- * Fetch configuration from management server
- */
- ConfigRetriever cr;
-
-
- Properties * p = cr.getConfig(host,
- port,
- node_id,
- NDB_VERSION);
+NdbConfig::getHostName(unsigned int node_id, const char ** hostname) {
+
+ ndb_mgm_configuration * p = getConfig();
if(p == 0){
- const char * s = cr.getErrorString();
- if(s == 0)
- s = "No error given!";
-
- ndbout << "Could not fetch configuration" << endl;
- ndbout << s << endl;
return false;
- }
+ }
/**
* Setup cluster configuration data
*/
- if (!p->get("Node", node_id, props)) {
- ndbout << "Invalid configuration fetched no info for nodeId = "
- << node_id << endl;
+ ndb_mgm_configuration_iterator iter(* p, CFG_SECTION_NODE);
+ if (iter.find(CFG_NODE_ID, node_id)){
+ ndbout << "Invalid configuration fetched, DB missing" << endl;
return false;
}
- const char * str;
- if(!((*props)->get("Type", &str) && strcmp(str, type) == 0)){
- ndbout <<"Invalid configuration fetched, type != " << type << endl;
- return false;
- }
- return true;
-}
-
-bool
-NdbConfig::getProperty(unsigned int node_id,
- const char* type,
- const char* name,
- const char ** value) const {
- const Properties * db = 0;
-
- if(!getPropsForNode(node_id, type, &db)){
+ if (iter.get(CFG_NODE_HOST, hostname)){
+ ndbout << "Host not found" << endl;
return false;
}
- if (!db->get(name, value)){
- ndbout << name << " not found" << endl;
- return false;
- }
-
return true;
}
bool
-NdbConfig::getProperty(unsigned int node_id,
- const char* type,
- const char* name,
- Uint32 * value) const {
- const Properties * db = 0;
-
- if(!getPropsForNode(node_id, type, &db)){
- return false;
- }
-
- if (!db->get(name, value)){
- ndbout << name << " not found" << endl;
- return false;
- }
-
- return true;
-}
-
-
-bool
-NdbConfig::getHostName(unsigned int node_id,
- const char ** hostname) const {
- /**
- * Fetch configuration from management server
- */
- ConfigRetriever cr;
-
-
- Properties * p = cr.getConfig(host,
- port,
- node_id,
- NDB_VERSION);
+NdbConfig::getProperty(unsigned nodeid,
+ unsigned type, unsigned key, Uint32 * val){
+ ndb_mgm_configuration * p = getConfig();
if(p == 0){
- const char * s = cr.getErrorString();
- if(s == 0)
- s = "No error given!";
-
- ndbout << "Could not fetch configuration" << endl;
- ndbout << s << endl;
return false;
- }
+ }
/**
* Setup cluster configuration data
*/
- const Properties * node_props;
- if (!p->get("Node", node_id, &node_props)) {
- ndbout << "Invalid configuration fetched no info for node = "
- << node_id << endl;
- return false;
- }
- const char* computer_id_str;
- if (!node_props->get("ExecuteOnComputer", &computer_id_str)){
- ndbout << "ExecuteOnComputer not found" << endl;
+ ndb_mgm_configuration_iterator iter(* p, CFG_SECTION_NODE);
+ if (iter.find(CFG_NODE_ID, nodeid)){
+ ndbout << "Invalid configuration fetched, DB missing" << endl;
return false;
}
-
- const Properties * comp_props;
- if (!p->get("Computer", atoi(computer_id_str), &comp_props)) {
- ndbout << "Invalid configuration fetched no info for computer = "
- << node_id << endl;
+ unsigned _type;
+ if (iter.get(CFG_TYPE_OF_SECTION, &_type) || type != _type){
+ ndbout << "No such node in configuration" << endl;
return false;
}
- if (!comp_props->get("HostName", hostname)){
- ndbout << "HostName not found" << endl;
+
+ if (iter.get(key, val)){
+ ndbout << "No such key: " << key << " in configuration" << endl;
return false;
}
-
-
+
return true;
}
diff --git a/ndb/test/src/NdbRestarter.cpp b/ndb/test/src/NdbRestarter.cpp
index cc2fab46cc5..b731cccb259 100644
--- a/ndb/test/src/NdbRestarter.cpp
+++ b/ndb/test/src/NdbRestarter.cpp
@@ -36,7 +36,8 @@ NdbRestarter::NdbRestarter(const char* _addr):
addr(_addr),
host(NULL),
port(-1),
- handle(NULL)
+ handle(NULL),
+ m_config(0)
{
if (addr == NULL){
LocalConfig lcfg;
@@ -661,3 +662,13 @@ int NdbRestarter::exitSingleUserMode(){
}
return reply.return_code;
}
+
+ndb_mgm_configuration*
+NdbRestarter::getConfig(){
+ if(m_config) return m_config;
+
+ if (!isConnected())
+ return 0;
+ m_config = ndb_mgm_get_configuration(handle, 0);
+ return m_config;
+}
diff --git a/ndb/test/src/NdbSchemaCon.cpp b/ndb/test/src/NdbSchemaCon.cpp
new file mode 100644
index 00000000000..0de49ff983f
--- /dev/null
+++ b/ndb/test/src/NdbSchemaCon.cpp
@@ -0,0 +1,169 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+
+/*********************************************************************
+Name: NdbSchemaCon.cpp
+Include:
+Link:
+Author: UABMNST Mona Natterkvist UAB/B/SD
+ EMIKRON Mikael Ronstrom
+Date: 020826
+Version: 3.0
+Description: Old Interface between application and NDB
+Documentation:
+Adjust: 980126 UABMNST First version.
+ 020826 EMIKRON New version adapted to new DICT version
+ 040524 Magnus Svensson - Adapted to not be included in public NdbApi
+ unless the user wants to use it.
+
+ NOTE: This file is only used as a compatibility layer for old test programs,
+ New programs should use NdbDictionary.hpp
+*********************************************************************/
+
+#include <ndb_global.h>
+#include <NdbApi.hpp>
+#include <NdbSchemaCon.hpp>
+#include <NdbSchemaOp.hpp>
+
+
+/*********************************************************************
+NdbSchemaCon(Ndb* aNdb);
+
+Parameters: aNdb: Pointers to the Ndb object
+Remark: Creates a schemacon object.
+************************************************************************************************/
+NdbSchemaCon::NdbSchemaCon( Ndb* aNdb ) :
+ theNdb(aNdb),
+ theFirstSchemaOpInList(NULL),
+ theMagicNumber(0x75318642)
+{
+ theError.code = 0;
+}//NdbSchemaCon::NdbSchemaCon()
+
+/*********************************************************************
+~NdbSchemaCon();
+
+Remark: Deletes the connection object.
+************************************************************************************************/
+NdbSchemaCon::~NdbSchemaCon()
+{
+}//NdbSchemaCon::~NdbSchemaCon()
+
+/*********************************************************************
+NdbSchemaOp* getNdbSchemaOp();
+
+Return Value Return a pointer to a NdbSchemaOp object if getNdbSchemaOp was sussesful.
+ Return NULL: In all other case.
+Parameters: tableId : Id of the database table beeing deleted.
+************************************************************************************************/
+NdbSchemaOp*
+NdbSchemaCon::getNdbSchemaOp()
+{
+ NdbSchemaOp* tSchemaOp;
+ if (theFirstSchemaOpInList != NULL) {
+ theError.code = 4401; // Only support one add table per transaction
+ return NULL;
+ }//if
+ tSchemaOp = new NdbSchemaOp(theNdb);
+ if ( tSchemaOp == NULL ) {
+ theError.code = 4000; // Could not allocate schema operation
+ return NULL;
+ }//if
+ theFirstSchemaOpInList = tSchemaOp;
+ int retValue = tSchemaOp->init(this);
+ if (retValue == -1) {
+ release();
+ theError.code = 4000; // Could not allocate buffer in schema operation
+ return NULL;
+ }//if
+ return tSchemaOp;
+}//NdbSchemaCon::getNdbSchemaOp()
+
+/*********************************************************************
+int execute();
+
+Return Value: Return 0 : execute was successful.
+ Return -1: In all other case.
+Parameters : aTypeOfExec: Type of execute.
+Remark: Initialise connection object for new transaction.
+************************************************************************************************/
+int
+NdbSchemaCon::execute()
+{
+ if(theError.code != 0) {
+ return -1;
+ }//if
+
+ NdbSchemaOp* tSchemaOp;
+
+ tSchemaOp = theFirstSchemaOpInList;
+ if (tSchemaOp == NULL) {
+ theError.code = 4402;
+ return -1;
+ }//if
+
+ if ((tSchemaOp->sendRec() == -1) || (theError.code != 0)) {
+ // Error Code already set in other place
+ return -1;
+ }//if
+
+ return 0;
+}//NdbSchemaCon::execute()
+
+/*********************************************************************
+void release();
+
+Remark: Release all schemaop.
+************************************************************************************************/
+void
+NdbSchemaCon::release()
+{
+ NdbSchemaOp* tSchemaOp;
+ tSchemaOp = theFirstSchemaOpInList;
+ if (tSchemaOp != NULL) {
+ tSchemaOp->release();
+ delete tSchemaOp;
+ }//if
+ theFirstSchemaOpInList = NULL;
+ return;
+}//NdbSchemaCon::release()
+
+#include <NdbError.hpp>
+
+static void
+update(const NdbError & _err){
+ NdbError & error = (NdbError &) _err;
+ ndberror_struct ndberror = (ndberror_struct)error;
+ ndberror_update(&ndberror);
+ error = NdbError(ndberror);
+}
+
+const
+NdbError &
+NdbSchemaCon::getNdbError() const {
+ update(theError);
+ return theError;
+}
+
+
+
+
+
+
+
+
diff --git a/ndb/test/src/NdbSchemaOp.cpp b/ndb/test/src/NdbSchemaOp.cpp
new file mode 100644
index 00000000000..a296094ea9d
--- /dev/null
+++ b/ndb/test/src/NdbSchemaOp.cpp
@@ -0,0 +1,220 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+/*****************************************************************************
+Name: NdbSchemaOp.cpp
+Include:
+Link:
+Author: UABMNST Mona Natterkvist UAB/B/SD
+ EMIKRON Mikael Ronstrom
+Date: 040524
+Version: 3.0
+Description: Interface between application and NDB
+Documentation: Handles createTable and createAttribute calls
+
+Adjust: 980125 UABMNST First version.
+ 020826 EMIKRON New version for new DICT
+ 040524 Magnus Svensson - Adapted to not be included in public NdbApi
+ unless the user wants to use it.
+
+ NOTE: This file is only used as a compatibility layer for old test programs,
+ New programs should use NdbDictionary.hpp
+*****************************************************************************/
+
+#include <ndb_global.h>
+#include <NdbApi.hpp>
+#include <NdbSchemaOp.hpp>
+#include <NdbSchemaCon.hpp>
+
+
+/*****************************************************************************
+NdbSchemaOp(Ndb* aNdb, Table* aTable);
+
+Return Value: None
+Parameters: aNdb: Pointers to the Ndb object.
+ aTable: Pointers to the Table object
+Remark: Creat an object of NdbSchemaOp.
+*****************************************************************************/
+NdbSchemaOp::NdbSchemaOp(Ndb* aNdb) :
+ theNdb(aNdb),
+ theSchemaCon(NULL),
+ m_currentTable(NULL)
+{
+}//NdbSchemaOp::NdbSchemaOp()
+
+/*****************************************************************************
+~NdbSchemaOp();
+
+Remark: Delete tables for connection pointers (id).
+*****************************************************************************/
+NdbSchemaOp::~NdbSchemaOp( )
+{
+}//~NdbSchemaOp::NdbSchemaOp()
+
+/*****************************************************************************
+int createTable( const char* tableName )
+*****************************************************************************/
+int
+NdbSchemaOp::createTable(const char* aTableName,
+ Uint32 aTableSize,
+ KeyType aTupleKey,
+ int aNrOfPages,
+ FragmentType aFragmentType,
+ int aKValue,
+ int aMinLoadFactor,
+ int aMaxLoadFactor,
+ int aMemoryType,
+ bool aStoredTable)
+{
+ if(m_currentTable != 0){
+ return -1;
+ }
+
+ m_currentTable = new NdbDictionary::Table(aTableName);
+ m_currentTable->setKValue(aKValue);
+ m_currentTable->setMinLoadFactor(aMinLoadFactor);
+ m_currentTable->setMaxLoadFactor(aMaxLoadFactor);
+ m_currentTable->setLogging(aStoredTable);
+ m_currentTable->setFragmentType(NdbDictionary::Object::FragAllMedium);
+ return 0;
+}//NdbSchemaOp::createTable()
+
+/******************************************************************************
+int createAttribute( const char* anAttrName,
+ KeyType aTupleyKey,
+ int anAttrSize,
+ int anArraySize,
+ AttrType anAttrType,
+ SafeType aSafeType,
+ StorageMode aStorageMode,
+ int aNullAttr,
+ int aStorageAttr );
+
+******************************************************************************/
+int
+NdbSchemaOp::createAttribute( const char* anAttrName,
+ KeyType aTupleKey,
+ int anAttrSize,
+ int anArraySize,
+ AttrType anAttrType,
+ StorageMode aStorageMode,
+ bool nullable,
+ StorageAttributeType aStorageAttr,
+ int aDistributionKeyFlag,
+ int aDistributionGroupFlag,
+ int aDistributionGroupNoOfBits,
+ bool aAutoIncrement,
+ const char* aDefaultValue)
+{
+ if (m_currentTable == 0){
+ return -1;
+ }//if
+
+ NdbDictionary::Column col(anAttrName);
+ switch(anAttrType){
+ case Signed:
+ if(anAttrSize == 64)
+ col.setType(NdbDictionary::Column::Bigint);
+ else
+ col.setType(NdbDictionary::Column::Int);
+ break;
+ case UnSigned:
+ if(anAttrSize == 64)
+ col.setType(NdbDictionary::Column::Bigunsigned);
+ else
+ col.setType(NdbDictionary::Column::Unsigned);
+ break;
+ case Float:
+ if(anAttrSize == 64)
+ col.setType(NdbDictionary::Column::Double);
+ else
+ col.setType(NdbDictionary::Column::Float);
+ break;
+ case String:
+ col.setType(NdbDictionary::Column::Char);
+ break;
+ case NoAttrTypeDef:
+ abort();
+ }
+ col.setLength(anArraySize);
+ col.setNullable(nullable);
+ if(aTupleKey != NoKey)
+ col.setPrimaryKey(true);
+ else
+ col.setPrimaryKey(false);
+
+ col.setDistributionKey(aDistributionKeyFlag);
+ col.setDistributionGroup(aDistributionGroupFlag,aDistributionGroupNoOfBits);
+ col.setAutoIncrement(aAutoIncrement);
+ col.setDefaultValue(aDefaultValue != 0 ? aDefaultValue : "");
+
+ m_currentTable->addColumn(col);
+ return 0;
+}
+
+/******************************************************************************
+void release();
+
+Remark: Release all objects connected to the schemaop object.
+******************************************************************************/
+void
+NdbSchemaOp::release(){
+}//NdbSchemaOp::release()
+
+/******************************************************************************
+int sendRec()
+
+Return Value: Return 0 : send was succesful.
+ Return -1: In all other case.
+Parameters:
+Remark: Send and receive signals for schema transaction based on state
+******************************************************************************/
+int
+NdbSchemaOp::sendRec(){
+ int retVal = 0;
+ if(m_currentTable == 0){
+ retVal = -1;
+ } else {
+ retVal = theNdb->getDictionary()->createTable(* m_currentTable);
+ delete m_currentTable;
+ theSchemaCon->theError.code = theNdb->getDictionary()->getNdbError().code;
+ }
+
+ return retVal;
+}//NdbSchemaOp::sendRec()
+
+/******************************************************************************
+int init();
+
+Return Value: Return 0 : init was successful.
+ Return -1: In all other case.
+Remark: Initiates SchemaOp record after allocation.
+******************************************************************************/
+int
+NdbSchemaOp::init(NdbSchemaCon* aSchemaCon)
+{
+ theSchemaCon = aSchemaCon;
+ return 0;
+}//NdbSchemaOp::init()
+
+
+const NdbError &
+NdbSchemaOp::getNdbError() const
+{
+ return theSchemaCon->getNdbError();
+}
+
diff --git a/ndb/test/src/UtilTransactions.cpp b/ndb/test/src/UtilTransactions.cpp
index 2e6ff360123..3ef31a2f535 100644
--- a/ndb/test/src/UtilTransactions.cpp
+++ b/ndb/test/src/UtilTransactions.cpp
@@ -980,8 +980,8 @@ UtilTransactions::verifyIndex(Ndb* pNdb,
}
switch (pIndex->getType()){
- case UniqueHashIndex:
- case OrderedIndex:
+ case NdbDictionary::Index::UniqueHashIndex:
+ case NdbDictionary::Index::OrderedIndex:
return verifyUniqueIndex(pNdb, indexName, parallelism, transactional);
break;
default:
diff --git a/ndb/test/tools/Makefile.am b/ndb/test/tools/Makefile.am
new file mode 100644
index 00000000000..8d94c21b721
--- /dev/null
+++ b/ndb/test/tools/Makefile.am
@@ -0,0 +1,31 @@
+
+ndbtest_PROGRAMS = hugoCalculator hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc
+
+# transproxy
+
+hugoCalculator_SOURCES = hugoCalculator.cpp
+hugoFill_SOURCES = hugoFill.cpp
+hugoLoad_SOURCES = hugoLoad.cpp
+hugoLockRecords_SOURCES = hugoLockRecords.cpp
+hugoPkDelete_SOURCES = hugoPkDelete.cpp
+hugoPkRead_SOURCES = hugoPkRead.cpp
+hugoPkReadRecord_SOURCES = hugoPkReadRecord.cpp
+hugoPkUpdate_SOURCES = hugoPkUpdate.cpp
+hugoScanRead_SOURCES = hugoScanRead.cpp
+hugoScanUpdate_SOURCES = hugoScanUpdate.cpp
+restart_SOURCES = restart.cpp
+# transproxy_SOURCES = transproxy.cpp
+verify_index_SOURCES = verify_index.cpp
+copy_tab_SOURCES = copy_tab.cpp
+create_index_SOURCES = create_index.cpp
+ndb_cpcc_SOURCES = cpcc.cpp
+
+INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmclient
+
+include $(top_srcdir)/ndb/config/common.mk.am
+include $(top_srcdir)/ndb/config/type_ndbapitest.mk.am
+
+ndb_cpcc_LDADD = $(LDADD) $(top_builddir)/ndb/src/mgmclient/CpcClient.o
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/ndb/test/tools/Makefile b/ndb/test/tools/Makefile_old
index b8e90ae207f..b8e90ae207f 100644
--- a/ndb/test/tools/Makefile
+++ b/ndb/test/tools/Makefile_old
diff --git a/ndb/test/tools/copy_tab.cpp b/ndb/test/tools/copy_tab.cpp
new file mode 100644
index 00000000000..33ce8e01d9a
--- /dev/null
+++ b/ndb/test/tools/copy_tab.cpp
@@ -0,0 +1,99 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <ndb_global.h>
+
+#include <NdbOut.hpp>
+#include <NdbApi.hpp>
+#include <NDBT.hpp>
+#include "UtilTransactions.hpp"
+
+#include <getarg.h>
+
+int main(int argc, const char** argv){
+
+ const char* _tabname = NULL;
+ const char* _to_tabname = NULL;
+ const char* _dbname = "TEST_DB";
+ const char* _connectstr = NULL;
+ int _copy_data = true;
+ int _help = 0;
+
+ struct getargs args[] = {
+ { "database", 'd', arg_string, &_dbname, "dbname",
+ "Name of database table is in"},
+ { "connstr", 'c', arg_string, &_connectstr, "connect string",
+ "How to connect to NDB"},
+ { "copy-data", '\0', arg_negative_flag, &_copy_data, "Don't copy data to new table",
+ "How to connect to NDB"},
+ { "usage", '?', arg_flag, &_help, "Print help", "" }
+ };
+ int num_args = sizeof(args) / sizeof(args[0]);
+ int optind = 0;
+ char desc[] =
+ "srctab desttab\n"\
+ "This program will copy one table in Ndb\n";
+
+ if(getarg(args, num_args, argc, argv, &optind) ||
+ argv[optind] == NULL || argv[optind + 1] == NULL || _help){
+ arg_printusage(args, num_args, argv[0], desc);
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+ }
+ _tabname = argv[optind];
+ _to_tabname = argv[optind+1];
+
+ if (_connectstr)
+ Ndb::setConnectString(_connectstr);
+ Ndb MyNdb(_dbname);
+ if(MyNdb.init() != 0){
+ ERR(MyNdb.getNdbError());
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+
+ while(MyNdb.waitUntilReady() != 0)
+ ndbout << "Waiting for ndb to become ready..." << endl;
+
+ ndbout << "Copying table " << _tabname << " to " << _to_tabname << "...";
+ const NdbDictionary::Table* ptab = MyNdb.getDictionary()->getTable(_tabname);
+ if (ptab){
+ NdbDictionary::Table tab2(*ptab);
+ tab2.setName(_to_tabname);
+ if (MyNdb.getDictionary()->createTable(tab2) != 0){
+ ndbout << endl << MyNdb.getDictionary()->getNdbError() << endl;
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+ } else {
+ ndbout << endl << MyNdb.getDictionary()->getNdbError() << endl;
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+ ndbout << "OK" << endl;
+ if (_copy_data){
+ ndbout << "Copying data..."<<endl;
+ const NdbDictionary::Table * tab3 =
+ NDBT_Table::discoverTableFromDb(&MyNdb,
+ _tabname);
+ // if (!tab3)
+
+ UtilTransactions util(*tab3);
+
+ if(util.copyTableData(&MyNdb,
+ _to_tabname) != NDBT_OK){
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+ ndbout << "OK" << endl;
+ }
+ return NDBT_ProgramExit(NDBT_OK);
+}
diff --git a/ndb/test/tools/cpcc.cpp b/ndb/test/tools/cpcc.cpp
new file mode 100644
index 00000000000..e768d707bbc
--- /dev/null
+++ b/ndb/test/tools/cpcc.cpp
@@ -0,0 +1,349 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+#include <ndb_global.h>
+#include <getarg.h>
+#include "CpcClient.hpp"
+#include <NdbEnv.h>
+
+#define DEFAULT_PORT 1234
+#define ENV_HOSTS "NDB_CPCC_HOSTS"
+
+struct settings {
+ int m_longl;
+ short m_port;
+} g_settings = { 0 , DEFAULT_PORT };
+
+Vector<SimpleCpcClient*> g_hosts;
+int connect(Vector<SimpleCpcClient*>&);
+
+class Expression {
+public:
+ virtual bool evaluate(SimpleCpcClient*, const SimpleCpcClient::Process &)= 0;
+};
+
+int for_each(Vector<SimpleCpcClient*>& list, Expression &);
+int start_stop(const char * cmd, Vector<SimpleCpcClient*>& list,
+ Vector<Vector<Uint32> >& procs);
+
+class True : public Expression {
+public:
+ virtual bool evaluate(SimpleCpcClient*, const SimpleCpcClient::Process & p){
+ return true;
+ }
+};
+
+class FieldEQ : public Expression {
+ BaseString m_field;
+ BaseString m_value;
+public:
+ FieldEQ(const BaseString & field, const BaseString & value){
+ m_field = field;
+ m_value = value;
+ }
+ virtual ~FieldEQ(){}
+
+ virtual bool evaluate(SimpleCpcClient*, const SimpleCpcClient::Process & p){
+ BaseString v;
+ if(m_field == "name") v = p.m_name;
+
+ if(m_field == "type") v = p.m_type;
+ if(m_field == "status") v = p.m_status;
+ if(m_field == "owner") v = p.m_owner;
+ if(m_field == "group") v = p.m_group;
+ if(m_field == "path") v = p.m_path;
+ if(m_field == "args") v = p.m_args;
+ if(m_field == "env") v = p.m_env;
+ if(m_field == "cwd") v = p.m_cwd;
+
+ if(m_field == "stdin") v = p.m_stdin;
+ if(m_field == "stdout") v = p.m_stdout;
+ if(m_field == "stderr") v = p.m_stderr;
+
+ return v == m_value;
+ }
+};
+
+class Match : public Expression {
+ Expression & m_cond;
+ Expression & m_apply;
+public:
+ Match(Expression& condition, Expression & rule)
+ : m_cond(condition), m_apply(rule) {
+ }
+ virtual ~Match(){}
+
+ virtual bool evaluate(SimpleCpcClient* c,const SimpleCpcClient::Process & p){
+ if(m_cond.evaluate(c, p))
+ return m_apply.evaluate(c, p);
+ return false;
+ }
+};
+
+class Operate : public Expression {
+ const char * cmd;
+ SimpleCpcClient * host;
+ settings & sets;
+public:
+ Operate(const char * c, settings & s) : sets(s) {
+ cmd = c;
+ host = 0;
+ }
+
+ virtual bool evaluate(SimpleCpcClient*, const SimpleCpcClient::Process & p);
+};
+
+class ProcEQ : public Expression {
+ SimpleCpcClient * host;
+ Uint32 id;
+public:
+ ProcEQ(SimpleCpcClient* h, Uint32 i){
+ host = h; id = i;
+ }
+
+ virtual bool evaluate(SimpleCpcClient* c,const SimpleCpcClient::Process & p){
+ return p.m_id == (int)id && c == host;
+ }
+};
+
+class OrExpr : public Expression {
+ Expression * m_rule;
+ Vector<Expression *> m_cond;
+ bool on_empty;
+public:
+ OrExpr(Expression * rule, bool onEmp = true){
+ m_rule = rule;
+ on_empty = onEmp;
+ }
+
+ virtual ~OrExpr(){}
+
+ virtual bool evaluate(SimpleCpcClient* c, const SimpleCpcClient::Process & p){
+ bool run = on_empty;
+ for(size_t i = 0; i<m_cond.size(); i++){
+ if(m_cond[i]->evaluate(c, p)){
+ run = true;
+ break;
+ }
+ }
+ if(run)
+ return m_rule->evaluate(c, p);
+ return false;
+ }
+
+ void push_back(Expression * expr){
+ m_cond.push_back(expr);
+ }
+};
+
+void
+add_host(Vector<SimpleCpcClient*> & hosts, BaseString tmp){
+ Vector<BaseString> split;
+ tmp.split(split, ":");
+
+ short port = g_settings.m_port;
+ if(split.size() > 1)
+ port = atoi(split[1].c_str());
+
+ hosts.push_back(new SimpleCpcClient(split[0].c_str(), port));
+}
+
+void
+add_hosts(Vector<SimpleCpcClient*> & hosts, BaseString list){
+ Vector<BaseString> split;
+ list.split(split);
+ for(size_t i = 0; i<split.size(); i++){
+ add_host(hosts, split[i]);
+ }
+}
+
+int
+main(int argc, const char** argv){
+ int help = 0;
+ const char *cmd=0, *name=0, *group=0, *owner=0;
+ int list = 0, start = 0, stop = 0, rm = 0;
+ struct getargs args[] = {
+ { "cmd", 'c', arg_string, &cmd, "command", "command to run (default ls)" }
+ ,{ "name", 'n', arg_string, &name,
+ "apply command for all processes with name" }
+ ,{ "group", 'g', arg_string, &group,
+ "apply command for all processes in group" }
+ ,{ "owner", 'g', arg_string, &owner,
+ "apply command for all processes with owner" }
+ ,{ "long", 'l', arg_flag, &g_settings.m_longl, "long", "long listing"}
+ ,{ "usage", '?', arg_flag, &help, "Print help", "" }
+ ,{ "ls", 0, arg_flag, &list, "-c list", "list process(es)" }
+ ,{ "start", 0, arg_flag, &start, "-c start", "start process(es)" }
+ ,{ "stop", 0, arg_flag, &stop, "-c stop", "stop process(es)" }
+ ,{ "rm", 0, arg_flag, &rm, "-c rm", "undefine process(es)" }
+ };
+ const int num_args = 10;
+
+ int optind = 0;
+ char desc[] = "[host:[port]]\n";
+
+ if(getarg(args, num_args, argc, argv, &optind) || help) {
+ arg_printusage(args, num_args, argv[0], desc);
+ return 1;
+ }
+
+ if(list + start + stop + rm > 1){
+ ndbout_c("Can only specify one command");
+ arg_printusage(args, num_args, argv[0], desc);
+ return 1;
+ }
+
+ if(list) cmd = "list";
+ if(start) cmd = "start";
+ if(stop) cmd = "stop";
+ if(rm) cmd = "rm";
+ if(!cmd) cmd = "list";
+
+ Expression * m_expr = 0;
+
+ for(int i = optind; i<argc; i++){
+ add_host(g_hosts, argv[i]);
+ }
+
+ OrExpr * orE = new OrExpr(new Operate(cmd, g_settings), true);
+ m_expr = orE;
+ for(int i = optind; i<argc; i++){
+ BaseString tmp(argv[i]);
+ Vector<BaseString> split;
+ tmp.split(split, ":");
+
+ if(split.size() > 2){
+ Uint32 id = atoi(split[2].c_str());
+ orE->push_back(new ProcEQ(g_hosts[i-optind], id));
+ }
+ }
+
+ if(g_hosts.size() == 0){
+ char buf[1024];
+ if(NdbEnv_GetEnv(ENV_HOSTS, buf, sizeof(buf))){
+ add_hosts(g_hosts, BaseString(buf));
+ }
+ }
+
+ if(g_hosts.size() == 0){
+ g_hosts.push_back(new SimpleCpcClient("localhost", g_settings.m_port));
+ }
+
+ if(group != 0){
+ Expression * tmp = new FieldEQ("group", group);
+ m_expr = new Match(* tmp, * m_expr);
+ }
+
+ if(name != 0){
+ Expression * tmp = new FieldEQ("name", name);
+ m_expr = new Match(* tmp, * m_expr);
+ }
+
+ if(owner != 0){
+ Expression * tmp = new FieldEQ("owner", owner);
+ m_expr = new Match(* tmp, * m_expr);
+ }
+
+ connect(g_hosts);
+ for_each(g_hosts, * m_expr);
+
+ return 0;
+}
+
+int
+connect(Vector<SimpleCpcClient*>& list){
+ for(size_t i = 0; i<list.size(); i++){
+ if(list[i]->connect() != 0){
+ ndbout_c("Failed to connect to %s:%d",
+ list[i]->getHost(), list[i]->getPort());
+ delete list[i]; list[i] = 0;
+ }
+ }
+ return 0;
+}
+
+int
+for_each(Vector<SimpleCpcClient*>& list, Expression & expr){
+ for(size_t i = 0; i<list.size(); i++){
+ if(list[i] == 0)
+ continue;
+ Properties p;
+ Vector<SimpleCpcClient::Process> procs;
+ if(list[i]->list_processes(procs, p) != 0){
+ ndbout << "Failed to list processes on "
+ << list[i]->getHost() << ":" << list[i]->getPort() << endl;
+ }
+ for(size_t j = 0; j<procs.size(); j++)
+ expr.evaluate(list[i], procs[j]);
+ }
+ return 0;
+}
+
+bool
+Operate::evaluate(SimpleCpcClient* c, const SimpleCpcClient::Process & pp){
+ Uint32 id = pp.m_id;
+ Properties p;
+ int res;
+
+ if(strcasecmp(cmd, "start") == 0)
+ res = c->start_process(id, p);
+ else if(strcasecmp(cmd, "stop") == 0)
+ res = c->stop_process(id, p);
+ else if(strcasecmp(cmd, "rm") == 0)
+ res = c->undefine_process(id, p);
+ else if(strcasecmp(cmd, "list") == 0){
+ if(!sets.m_longl){
+ if(host != c){
+ ndbout_c("--- %s:%d", c->getHost(), c->getPort());
+ host = c;
+ }
+ }
+
+ char s = 0;
+ const char * status = pp.m_status.c_str();
+ if(strcmp(status, "stopped") == 0) s = '-';
+ if(strcmp(status, "starting") == 0) s = 's';
+ if(strcmp(status, "running") == 0) s = 'r';
+ if(strcmp(status, "stopping") == 0) s = 'k';
+ if(s == 0) s = '?';
+
+ if(!sets.m_longl){
+ ndbout_c("%c%c\t%d\t%s\t%s\t%s(%s)",
+ s,
+ pp.m_type.c_str()[0], id, pp.m_owner.c_str(),
+ pp.m_group.c_str(), pp.m_name.c_str(), pp.m_path.c_str());
+ } else {
+ ndbout_c("%c%c %s:%d:%d %s %s %s(%s)",
+ s, pp.m_type.c_str()[0], c->getHost(), c->getPort(),
+ id, pp.m_owner.c_str(), pp.m_group.c_str(),
+ pp.m_name.c_str(), pp.m_path.c_str());
+ }
+ return true;
+ }
+
+ if(res != 0){
+ BaseString msg;
+ p.get("errormessage", msg);
+ ndbout_c("Failed to %s %d on %s:%d - %s",
+ cmd, id,
+ c->getHost(), c->getPort(), msg.c_str());
+ return false;
+ }
+
+ return true;
+}
+
diff --git a/ndb/test/tools/create_index.cpp b/ndb/test/tools/create_index.cpp
new file mode 100644
index 00000000000..dc9e6c606d6
--- /dev/null
+++ b/ndb/test/tools/create_index.cpp
@@ -0,0 +1,95 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <ndb_global.h>
+
+#include <NdbOut.hpp>
+#include <NdbApi.hpp>
+#include <NDBT.hpp>
+
+#include <getarg.h>
+
+
+
+int
+main(int argc, const char** argv){
+
+ const char* _dbname = "TEST_DB";
+ int _help = 0;
+
+ struct getargs args[] = {
+ { "database", 'd', arg_string, &_dbname, "dbname",
+ "Name of database table is in"},
+ { "usage", '?', arg_flag, &_help, "Print help", "" }
+ };
+
+ int num_args = sizeof(args) / sizeof(args[0]);
+ int optind = 0;
+ char desc[] =
+ "<tabname>+\n"\
+ "This program will create one unique hash index named ind_<tabname> "
+ " for each table. The index will contain all columns in the table";
+
+ if(getarg(args, num_args, argc, argv, &optind) || _help ||
+ argv[optind] == NULL){
+ arg_printusage(args, num_args, argv[0], desc);
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+ }
+
+
+ Ndb MyNdb(_dbname);
+ if(MyNdb.init() != 0){
+ ERR(MyNdb.getNdbError());
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+
+ while(MyNdb.waitUntilReady() != 0)
+ ndbout << "Waiting for ndb to become ready..." << endl;
+
+ NdbDictionary::Dictionary * dict = MyNdb.getDictionary();
+
+ for(int i = optind; i<argc; i++){
+ const NdbDictionary::Table * tab = dict->getTable(argv[i]);
+ if(tab == 0){
+ g_err << "Unknown table: " << argv[i] << endl;
+ continue;
+ }
+
+ if(tab->getNoOfColumns() > 16){
+ g_err << "Table " << argv[i] << " has more than 16 columns" << endl;
+ }
+
+ NdbDictionary::Index ind;
+ char buf[512];
+ sprintf(buf, "IND_%s", argv[i]);
+ ind.setName(buf);
+ ind.setTable(argv[i]);
+ ind.setType(NdbDictionary::Index::UniqueHashIndex);
+ for(int c = 0; c<tab->getNoOfColumns(); c++)
+ ind.addIndexColumn(tab->getColumn(c)->getName());
+
+ ndbout << "creating index " << buf << " on table " << argv[i] << "...";
+ const int res = dict->createIndex(ind);
+ if(res != 0)
+ ndbout << endl << dict->getNdbError() << endl;
+ else
+ ndbout << "OK" << endl;
+ }
+
+ return NDBT_ProgramExit(NDBT_OK);
+}
+
+
diff --git a/ndb/test/tools/hugoCalculator/hugoCalculator.cpp b/ndb/test/tools/hugoCalculator.cpp
index 7f2751be2ba..7f2751be2ba 100644
--- a/ndb/test/tools/hugoCalculator/hugoCalculator.cpp
+++ b/ndb/test/tools/hugoCalculator.cpp
diff --git a/ndb/test/tools/hugoFill/hugoFill.cpp b/ndb/test/tools/hugoFill.cpp
index dee6ce2e6c8..dee6ce2e6c8 100644
--- a/ndb/test/tools/hugoFill/hugoFill.cpp
+++ b/ndb/test/tools/hugoFill.cpp
diff --git a/ndb/test/tools/hugoLoad/hugoLoad.cpp b/ndb/test/tools/hugoLoad.cpp
index be7f878d106..be7f878d106 100644
--- a/ndb/test/tools/hugoLoad/hugoLoad.cpp
+++ b/ndb/test/tools/hugoLoad.cpp
diff --git a/ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp b/ndb/test/tools/hugoLockRecords.cpp
index e2c2cd13f00..e2c2cd13f00 100644
--- a/ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp
+++ b/ndb/test/tools/hugoLockRecords.cpp
diff --git a/ndb/test/tools/hugoPkDelete/hugoPkDel.cpp b/ndb/test/tools/hugoPkDelete.cpp
index 1855f19796f..1855f19796f 100644
--- a/ndb/test/tools/hugoPkDelete/hugoPkDel.cpp
+++ b/ndb/test/tools/hugoPkDelete.cpp
diff --git a/ndb/test/tools/hugoPkRead/hugoPkRead.cpp b/ndb/test/tools/hugoPkRead.cpp
index 50351f08195..50351f08195 100644
--- a/ndb/test/tools/hugoPkRead/hugoPkRead.cpp
+++ b/ndb/test/tools/hugoPkRead.cpp
diff --git a/ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp b/ndb/test/tools/hugoPkReadRecord.cpp
index ac17ffffee8..ac17ffffee8 100644
--- a/ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp
+++ b/ndb/test/tools/hugoPkReadRecord.cpp
diff --git a/ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp b/ndb/test/tools/hugoPkUpdate.cpp
index e7edc3a991d..e7edc3a991d 100644
--- a/ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp
+++ b/ndb/test/tools/hugoPkUpdate.cpp
diff --git a/ndb/test/tools/hugoScanRead/hugoScanRead.cpp b/ndb/test/tools/hugoScanRead.cpp
index 47ea8f4a8a7..47ea8f4a8a7 100644
--- a/ndb/test/tools/hugoScanRead/hugoScanRead.cpp
+++ b/ndb/test/tools/hugoScanRead.cpp
diff --git a/ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp b/ndb/test/tools/hugoScanUpdate.cpp
index 3e2255ca0f3..3e2255ca0f3 100644
--- a/ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp
+++ b/ndb/test/tools/hugoScanUpdate.cpp
diff --git a/ndb/test/tools/hugoCalculator/Makefile b/ndb/test/tools/old_dirs/hugoCalculator/Makefile
index a29deeaacd3..a29deeaacd3 100644
--- a/ndb/test/tools/hugoCalculator/Makefile
+++ b/ndb/test/tools/old_dirs/hugoCalculator/Makefile
diff --git a/ndb/test/tools/hugoFill/Makefile b/ndb/test/tools/old_dirs/hugoFill/Makefile
index 3da745810b6..3da745810b6 100644
--- a/ndb/test/tools/hugoFill/Makefile
+++ b/ndb/test/tools/old_dirs/hugoFill/Makefile
diff --git a/ndb/test/tools/hugoLoad/Makefile b/ndb/test/tools/old_dirs/hugoLoad/Makefile
index 7c5756d0d41..7c5756d0d41 100644
--- a/ndb/test/tools/hugoLoad/Makefile
+++ b/ndb/test/tools/old_dirs/hugoLoad/Makefile
diff --git a/ndb/test/tools/hugoLockRecords/Makefile b/ndb/test/tools/old_dirs/hugoLockRecords/Makefile
index 3235750cbf8..3235750cbf8 100644
--- a/ndb/test/tools/hugoLockRecords/Makefile
+++ b/ndb/test/tools/old_dirs/hugoLockRecords/Makefile
diff --git a/ndb/test/tools/hugoPkDelete/Makefile b/ndb/test/tools/old_dirs/hugoPkDelete/Makefile
index e6d53611c54..e6d53611c54 100644
--- a/ndb/test/tools/hugoPkDelete/Makefile
+++ b/ndb/test/tools/old_dirs/hugoPkDelete/Makefile
diff --git a/ndb/test/tools/hugoPkRead/Makefile b/ndb/test/tools/old_dirs/hugoPkRead/Makefile
index 03580dc0d18..03580dc0d18 100644
--- a/ndb/test/tools/hugoPkRead/Makefile
+++ b/ndb/test/tools/old_dirs/hugoPkRead/Makefile
diff --git a/ndb/test/tools/hugoPkReadRecord/Makefile b/ndb/test/tools/old_dirs/hugoPkReadRecord/Makefile
index 158a79a5666..158a79a5666 100644
--- a/ndb/test/tools/hugoPkReadRecord/Makefile
+++ b/ndb/test/tools/old_dirs/hugoPkReadRecord/Makefile
diff --git a/ndb/test/tools/hugoPkUpdate/Makefile b/ndb/test/tools/old_dirs/hugoPkUpdate/Makefile
index 48795b62206..48795b62206 100644
--- a/ndb/test/tools/hugoPkUpdate/Makefile
+++ b/ndb/test/tools/old_dirs/hugoPkUpdate/Makefile
diff --git a/ndb/test/tools/hugoScanRead/Makefile b/ndb/test/tools/old_dirs/hugoScanRead/Makefile
index b88377c299e..b88377c299e 100644
--- a/ndb/test/tools/hugoScanRead/Makefile
+++ b/ndb/test/tools/old_dirs/hugoScanRead/Makefile
diff --git a/ndb/test/tools/hugoScanUpdate/Makefile b/ndb/test/tools/old_dirs/hugoScanUpdate/Makefile
index ec0e07bfd84..ec0e07bfd84 100644
--- a/ndb/test/tools/hugoScanUpdate/Makefile
+++ b/ndb/test/tools/old_dirs/hugoScanUpdate/Makefile
diff --git a/ndb/test/tools/restart/Makefile b/ndb/test/tools/old_dirs/restart/Makefile
index 05d9e98c5bc..05d9e98c5bc 100644
--- a/ndb/test/tools/restart/Makefile
+++ b/ndb/test/tools/old_dirs/restart/Makefile
diff --git a/ndb/test/tools/old_dirs/transproxy/Makefile b/ndb/test/tools/old_dirs/transproxy/Makefile
new file mode 100644
index 00000000000..d6a76ed2e3d
--- /dev/null
+++ b/ndb/test/tools/old_dirs/transproxy/Makefile
@@ -0,0 +1,29 @@
+include .defs.mk
+
+TYPE =
+
+BIN_TARGET = transproxy
+
+SOURCES = transproxy.cpp
+
+CCFLAGS_LOC +=\
+ -I$(NDB_TOP)/include/kernel \
+ -I$(NDB_TOP)/include/mgmcommon \
+ -I$(NDB_TOP)/src/common/mgmcommon \
+ -I$(NDB_TOP)/src/mgmsrv
+
+LIBS_LOC +=\
+ -L$(NDB_TOP)/lib
+
+LIBS_SPEC +=\
+ $(NDB_TOP)/src/mgmsrv/InitConfigFileParser.o \
+ $(NDB_TOP)/src/mgmsrv/Config.o \
+ $(NDB_TOP)/src/mgmsrv/Container.o \
+ $(NDB_TOP)/src/mgmsrv/Str.o \
+ $(NDB_TOP)/src/mgmsrv/convertStrToInt.o \
+ -lNDB_API \
+ -leventlogger \
+ -llogger \
+ -lportlib
+
+include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/test/tools/old_dirs/verify_index/Makefile b/ndb/test/tools/old_dirs/verify_index/Makefile
new file mode 100644
index 00000000000..f6b31e4dc8e
--- /dev/null
+++ b/ndb/test/tools/old_dirs/verify_index/Makefile
@@ -0,0 +1,9 @@
+include .defs.mk
+
+TYPE := ndbapitest
+
+BIN_TARGET := verify_index
+
+SOURCES := verify_index.cpp
+
+include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/test/tools/waiter/Makefile b/ndb/test/tools/old_dirs/waiter/Makefile_old
index da2c9daff00..da2c9daff00 100644
--- a/ndb/test/tools/waiter/Makefile
+++ b/ndb/test/tools/old_dirs/waiter/Makefile_old
diff --git a/ndb/test/tools/waiter/waiter.cpp b/ndb/test/tools/old_dirs/waiter/waiter.cpp
index d57daff3aea..d57daff3aea 100644
--- a/ndb/test/tools/waiter/waiter.cpp
+++ b/ndb/test/tools/old_dirs/waiter/waiter.cpp
diff --git a/ndb/test/tools/restart/restart.cpp b/ndb/test/tools/restart.cpp
index 88cfb231a72..88cfb231a72 100644
--- a/ndb/test/tools/restart/restart.cpp
+++ b/ndb/test/tools/restart.cpp
diff --git a/ndb/test/tools/transproxy.cpp b/ndb/test/tools/transproxy.cpp
new file mode 100644
index 00000000000..384a8a34f03
--- /dev/null
+++ b/ndb/test/tools/transproxy.cpp
@@ -0,0 +1,362 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <ndb_global.h>
+
+#include <NdbTCP.h>
+#include <NdbOut.hpp>
+#include <NdbThread.h>
+#include <NdbSleep.h>
+#include <Properties.hpp>
+#include <LocalConfig.hpp>
+#include <Config.hpp>
+#include <InitConfigFileParser.hpp>
+#include <IPCConfig.hpp>
+
+static void
+fatal(char const* fmt, ...)
+{
+ va_list ap;
+ char buf[200];
+ va_start(ap, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+ ndbout << "FATAL: " << buf << endl;
+ sleep(1);
+ exit(1);
+}
+
+static void
+debug(char const* fmt, ...)
+{
+ va_list ap;
+ char buf[200];
+ va_start(ap, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+ ndbout << buf << endl;
+}
+
+// node
+struct Node {
+ enum Type { MGM = 1, DB = 2, API = 3 };
+ Type type;
+ unsigned id; // node id
+ static Node* list;
+ static unsigned count;
+ static Node* find(unsigned n) {
+ for (unsigned i = 0; i < count; i++) {
+ if (list[i].id == n)
+ return &list[i];
+ }
+ return 0;
+ }
+};
+
+unsigned Node::count = 0;
+Node* Node::list = 0;
+
+struct Copy {
+ int rfd; // read from
+ int wfd; // write to
+ unsigned char* buf;
+ unsigned bufsiz;
+ NdbThread* thread;
+ void run();
+ char info[20];
+};
+
+// connection between nodes 0-server side 1-client side
+// we are client to 0 and server to 1
+struct Conn {
+ Node* node[2]; // the nodes
+ unsigned port; // server port
+ unsigned proxy; // proxy port
+ static unsigned count;
+ static unsigned proxycount;
+ static Conn* list;
+ NdbThread* thread; // thread handling this connection
+ void run(); // run the connection
+ int sockfd[2]; // socket 0-on server side 1-client side
+ void conn0(); // connect to side 0
+ void conn1(); // connect to side 0
+ char info[20];
+ Copy copy[2]; // 0-to-1 and 1-to-0
+};
+
+unsigned Conn::count = 0;
+unsigned Conn::proxycount = 0;
+Conn* Conn::list = 0;
+
+// global data
+static char* hostname = 0;
+static struct sockaddr_in hostaddr;
+static char* localcfgfile = 0;
+static char* initcfgfile = 0;
+static unsigned ownnodeid = 0;
+
+static void
+properr(const Properties* props, const char* name, int i = -1)
+{
+ if (i < 0) {
+ fatal("get %s failed: errno = %d", name, props->getPropertiesErrno());
+ } else {
+ fatal("get %s_%d failed: errno = %d", name, i, props->getPropertiesErrno());
+ }
+}
+
+// read config and load it into our structs
+static void
+getcfg()
+{
+ LocalConfig lcfg;
+ if (! lcfg.read(localcfgfile)) {
+ fatal("read %s failed", localcfgfile);
+ }
+ ownnodeid = lcfg._ownNodeId;
+ debug("ownnodeid = %d", ownnodeid);
+ InitConfigFileParser pars(initcfgfile);
+ Config icfg;
+ if (! pars.getConfig(icfg)) {
+ fatal("parse %s failed", initcfgfile);
+ }
+ Properties* ccfg = icfg.getConfig(ownnodeid);
+ if (ccfg == 0) {
+ const char* err = "unknown error";
+ fatal("getConfig: %s", err);
+ }
+ ccfg->put("NodeId", ownnodeid);
+ ccfg->put("NodeType", "MGM");
+ if (! ccfg->get("NoOfNodes", &Node::count)) {
+ properr(ccfg, "NoOfNodes", -1);
+ }
+ debug("Node::count = %d", Node::count);
+ Node::list = new Node[Node::count];
+ for (unsigned i = 0; i < Node::count; i++) {
+ Node& node = Node::list[i];
+ const Properties* nodecfg;
+ if (! ccfg->get("Node", 1+i, &nodecfg)) {
+ properr(ccfg, "Node", 1+i);
+ }
+ const char* type;
+ if (! nodecfg->get("Type", &type)) {
+ properr(nodecfg, "Type");
+ }
+ if (strcmp(type, "MGM") == 0) {
+ node.type = Node::MGM;
+ } else if (strcmp(type, "DB") == 0) {
+ node.type = Node::DB;
+ } else if (strcmp(type, "API") == 0) {
+ node.type = Node::API;
+ } else {
+ fatal("prop %s_%d bad Type = %s", "Node", 1+i, type);
+ }
+ if (! nodecfg->get("NodeId", &node.id)) {
+ properr(nodecfg, "NodeId");
+ }
+ debug("node id=%d type=%d", node.id, node.type);
+ }
+ IPCConfig ipccfg(ccfg);
+ if (ipccfg.init() != 0) {
+ fatal("ipccfg init failed");
+ }
+ if (! ccfg->get("NoOfConnections", &Conn::count)) {
+ properr(ccfg, "NoOfConnections");
+ }
+ debug("Conn::count = %d", Conn::count);
+ Conn::list = new Conn[Conn::count];
+ for (unsigned i = 0; i < Conn::count; i++) {
+ Conn& conn = Conn::list[i];
+ const Properties* conncfg;
+ if (! ccfg->get("Connection", i, &conncfg)) {
+ properr(ccfg, "Connection", i);
+ }
+ unsigned n;
+ if (! conncfg->get("NodeId1", &n)) {
+ properr(conncfg, "NodeId1");
+ }
+ if ((conn.node[0] = Node::find(n)) == 0) {
+ fatal("node %d not found", n);
+ }
+ if (! conncfg->get("NodeId2", &n)) {
+ properr(conncfg, "NodeId2");
+ }
+ if ((conn.node[1] = Node::find(n)) == 0) {
+ fatal("node %d not found", n);
+ }
+ if (! conncfg->get("PortNumber", &conn.port)) {
+ properr(conncfg, "PortNumber");
+ }
+ conn.proxy = 0;
+ const char* proxy;
+ if (conncfg->get("Proxy", &proxy)) {
+ conn.proxy = atoi(proxy);
+ if (conn.proxy > 0) {
+ Conn::proxycount++;
+ }
+ }
+ sprintf(conn.info, "conn %d-%d", conn.node[0]->id, conn.node[1]->id);
+ }
+}
+
+void
+Conn::conn0()
+{
+ int fd;
+ while (1) {
+ if ((fd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
+ fatal("%s: create client socket failed: %s", info, strerror(errno));
+ }
+ struct sockaddr_in servaddr;
+ memset(&servaddr, 0, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(port);
+ servaddr.sin_addr = hostaddr.sin_addr;
+#if 0 // coredump
+ if (Ndb_getInAddr(&servaddr.sin_addr, hostname) != 0) {
+ fatal("%s: hostname %s lookup failed", info, hostname);
+ }
+#endif
+ if (connect(fd, (struct sockaddr*)&servaddr, sizeof(servaddr)) == 0)
+ break;
+ if (errno != ECONNREFUSED) {
+ fatal("%s: connect failed: %s", info, strerror(errno));
+ }
+ close(fd);
+ NdbSleep_MilliSleep(100);
+ }
+ sockfd[0] = fd;
+ debug("%s: side 0 connected", info);
+}
+
+void
+Conn::conn1()
+{
+ int servfd;
+ if ((servfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
+ fatal("%s: create server socket failed: %s", info, strerror(errno));
+ }
+ struct sockaddr_in servaddr;
+ memset(&servaddr, 0, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ servaddr.sin_port = htons(proxy);
+ const int on = 1;
+ setsockopt(servfd, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on));
+ if (bind(servfd, (struct sockaddr*) &servaddr, sizeof(servaddr)) == -1) {
+ fatal("%s: bind %d failed: %s", info, proxy, strerror(errno));
+ }
+ if (listen(servfd, 1) == -1) {
+ fatal("%s: listen %d failed: %s", info, proxy, strerror(errno));
+ }
+ int fd;
+ if ((fd = accept(servfd, 0, 0)) == -1) {
+ fatal("%s: accept failed: %s", info, strerror(errno));
+ }
+ sockfd[1] = fd;
+ close(servfd);
+ debug("%s: side 1 connected", info);
+}
+
+void
+Copy::run()
+{
+ debug("%s: start", info);
+ int n, m;
+ while (1) {
+ n = read(rfd, buf, sizeof(buf));
+ if (n < 0)
+ fatal("read error: %s", strerror(errno));
+ m = write(wfd, buf, n);
+ if (m != n)
+ fatal("write error: %s", strerror(errno));
+ }
+ debug("%s: stop", info);
+}
+
+extern "C" void*
+copyrun_C(void* copy)
+{
+ ((Copy*) copy)->run();
+ NdbThread_Exit(0);
+ return 0;
+}
+
+void
+Conn::run()
+{
+ debug("%s: start", info);
+ conn1();
+ conn0();
+ const unsigned siz = 32 * 1024;
+ for (int i = 0; i < 2; i++) {
+ Copy& copy = this->copy[i];
+ copy.rfd = sockfd[i];
+ copy.wfd = sockfd[1-i];
+ copy.buf = new unsigned char[siz];
+ copy.bufsiz = siz;
+ sprintf(copy.info, "copy %d-%d", this->node[i]->id, this->node[1-i]->id);
+ copy.thread = NdbThread_Create(copyrun_C, (void**)&copy,
+ 8192, "copyrun", NDB_THREAD_PRIO_LOW);
+ if (copy.thread == 0) {
+ fatal("%s: create thread %d failed errno=%d", i, errno);
+ }
+ }
+ debug("%s: stop", info);
+}
+
+extern "C" void*
+connrun_C(void* conn)
+{
+ ((Conn*) conn)->run();
+ NdbThread_Exit(0);
+ return 0;
+}
+
+static void
+start()
+{
+ NdbThread_SetConcurrencyLevel(3 * Conn::proxycount + 2);
+ for (unsigned i = 0; i < Conn::count; i++) {
+ Conn& conn = Conn::list[i];
+ if (! conn.proxy)
+ continue;
+ conn.thread = NdbThread_Create(connrun_C, (void**)&conn,
+ 8192, "connrun", NDB_THREAD_PRIO_LOW);
+ if (conn.thread == 0) {
+ fatal("create thread %d failed errno=%d", i, errno);
+ }
+ }
+ sleep(3600);
+}
+
+int
+main(int av, char** ac)
+{
+ debug("start");
+ hostname = "ndb-srv7";
+ if (Ndb_getInAddr(&hostaddr.sin_addr, hostname) != 0) {
+ fatal("hostname %s lookup failed", hostname);
+ }
+ localcfgfile = "Ndb.cfg";
+ initcfgfile = "config.txt";
+ getcfg();
+ start();
+ debug("done");
+ return 0;
+}
+
+// vim: set sw=4 noet:
diff --git a/ndb/test/tools/verify_index.cpp b/ndb/test/tools/verify_index.cpp
new file mode 100644
index 00000000000..1295b657e9b
--- /dev/null
+++ b/ndb/test/tools/verify_index.cpp
@@ -0,0 +1,85 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <ndb_global.h>
+
+#include <NdbOut.hpp>
+
+#include <NdbApi.hpp>
+#include <NdbMain.h>
+#include <NDBT.hpp>
+#include <NdbSleep.h>
+#include <getarg.h>
+#include <UtilTransactions.hpp>
+
+
+int main(int argc, const char** argv){
+ int _parallelism = 240;
+ const char* _tabname = NULL;
+ const char* _indexname = NULL;
+ int _help = 0;
+
+ struct getargs args[] = {
+ { "parallelism", 's', arg_integer, &_parallelism, "parallelism", "parallelism" },
+ { "usage", '?', arg_flag, &_help, "Print help", "" }
+ };
+ int num_args = sizeof(args) / sizeof(args[0]);
+ int optind = 0;
+ char desc[] =
+ "tabname indexname\n"\
+ "This program will verify the index [indexname] and compare it to data\n"
+ "in table [tablename]\n";
+
+ if(getarg(args, num_args, argc, argv, &optind) ||
+ argv[optind] == NULL || argv[optind+1] == NULL || _help) {
+ arg_printusage(args, num_args, argv[0], desc);
+ return NDBT_ProgramExit(NDBT_WRONGARGS);
+ }
+ _tabname = argv[optind];
+ _indexname = argv[optind+1];
+
+ // Connect to Ndb
+ Ndb MyNdb( "TEST_DB" );
+
+ if(MyNdb.init() != 0){
+ ERR(MyNdb.getNdbError());
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+
+ // Connect to Ndb and wait for it to become ready
+ while(MyNdb.waitUntilReady() != 0)
+ ndbout << "Waiting for ndb to become ready..." << endl;
+
+ // Check if table exists in db
+ const NdbDictionary::Table * pTab = NDBT_Table::discoverTableFromDb(&MyNdb, _tabname);
+ if(pTab == NULL){
+ ndbout << " Table " << _tabname << " does not exist!" << endl;
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+
+ int rows = 0;
+ UtilTransactions utilTrans(*pTab);
+ if (utilTrans.verifyIndex(&MyNdb,
+ _indexname,
+ _parallelism) != 0){
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+
+ return NDBT_ProgramExit(NDBT_OK);
+}
+
+
+