summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore18
-rw-r--r--BitKeeper/etc/logging_ok3
-rwxr-xr-xBuild-tools/Bootstrap4
-rw-r--r--Docs/Images/Makefile.am35
-rw-r--r--Docs/Makefile.am4
-rw-r--r--Makefile.am8
-rw-r--r--VC++Files/client/mysqladmin.dsp2
-rw-r--r--acinclude.m412
-rw-r--r--client/Makefile.am1
-rw-r--r--client/client_priv.h3
-rw-r--r--client/mysql.cc6
-rw-r--r--client/mysqladmin.cc (renamed from client/mysqladmin.c)46
-rw-r--r--client/mysqlbinlog.cc40
-rw-r--r--client/mysqldump.c435
-rw-r--r--client/mysqltest.c9
-rw-r--r--configure.in14
-rw-r--r--dbug/dbug.c56
-rw-r--r--extra/perror.c2
-rw-r--r--heap/_check.c23
-rw-r--r--heap/hp_block.c51
-rw-r--r--heap/hp_clear.c1
-rw-r--r--heap/hp_create.c1
-rw-r--r--heap/hp_delete.c12
-rw-r--r--heap/hp_hash.c20
-rw-r--r--heap/hp_rfirst.c1
-rw-r--r--heap/hp_write.c98
-rw-r--r--include/config-win.h2
-rw-r--r--include/heap.h51
-rw-r--r--include/m_ctype.h2
-rw-r--r--include/my_dbug.h3
-rw-r--r--include/my_global.h10
-rw-r--r--include/my_sys.h1
-rw-r--r--include/my_time.h5
-rw-r--r--include/mysql.h2
-rw-r--r--include/mysql_time.h12
-rw-r--r--innobase/dict/dict0dict.c53
-rw-r--r--innobase/fil/fil0fil.c19
-rw-r--r--innobase/include/dict0dict.ic9
-rw-r--r--innobase/include/fil0fil.h2
-rw-r--r--innobase/include/lock0lock.h8
-rw-r--r--innobase/include/row0mysql.h6
-rw-r--r--innobase/lock/lock0lock.c16
-rw-r--r--innobase/row/row0ins.c2
-rw-r--r--innobase/row/row0mysql.c14
-rw-r--r--innobase/row/row0sel.c134
-rw-r--r--innobase/trx/trx0purge.c47
-rw-r--r--innobase/trx/trx0undo.c2
-rw-r--r--libmysql/Makefile.am2
-rw-r--r--libmysql/libmysql.c16
-rw-r--r--libmysql/libmysql.def1
-rw-r--r--myisam/ft_boolean_search.c26
-rw-r--r--myisam/mi_check.c9
-rw-r--r--myisam/mi_write.c1
-rw-r--r--mysql-test/Makefile.am8
-rw-r--r--mysql-test/include/ctype_common.inc56
-rw-r--r--mysql-test/init_db.sql58
-rw-r--r--mysql-test/my_manage.c877
-rw-r--r--mysql-test/my_manage.h133
-rw-r--r--mysql-test/mysql-test-run.sh13
-rw-r--r--mysql-test/mysql_test_run.c1728
-rw-r--r--mysql-test/mysql_test_run_new.c1769
-rw-r--r--mysql-test/ndb/Makefile.am2
-rw-r--r--mysql-test/ndb/ndbcluster.sh23
-rw-r--r--mysql-test/r/alter_table.result10
-rw-r--r--mysql-test/r/binary.result7
-rw-r--r--mysql-test/r/consistent_snapshot.result15
-rw-r--r--mysql-test/r/ctype_big5.result56
-rw-r--r--mysql-test/r/ctype_latin1.result9
-rw-r--r--mysql-test/r/ctype_tis620.result38
-rw-r--r--mysql-test/r/ctype_uca.result57
-rw-r--r--mysql-test/r/ctype_ucs.result22
-rw-r--r--mysql-test/r/ctype_ujis.result40
-rw-r--r--mysql-test/r/delete.result30
-rw-r--r--mysql-test/r/fulltext.result23
-rw-r--r--mysql-test/r/fulltext_order_by.result54
-rw-r--r--mysql-test/r/func_group.result16
-rw-r--r--mysql-test/r/func_in.result6
-rw-r--r--mysql-test/r/func_str.result5
-rw-r--r--mysql-test/r/func_time.result6
-rw-r--r--mysql-test/r/grant.result44
-rw-r--r--mysql-test/r/have_moscow_leap_timezone.require2
-rw-r--r--mysql-test/r/heap.result15
-rw-r--r--mysql-test/r/heap_hash.result160
-rw-r--r--mysql-test/r/innodb.result18
-rw-r--r--mysql-test/r/join_outer.result65
-rw-r--r--mysql-test/r/key.result18
-rw-r--r--mysql-test/r/key_cache.result10
-rw-r--r--mysql-test/r/metadata.result2
-rw-r--r--mysql-test/r/mix_innodb_myisam_binlog.result21
-rw-r--r--mysql-test/r/myisam.result3
-rw-r--r--mysql-test/r/ndb_autodiscover.result7
-rw-r--r--mysql-test/r/ndb_autodiscover2.result3
-rw-r--r--mysql-test/r/ndb_basic.result12
-rw-r--r--mysql-test/r/ndb_charset.result4
-rw-r--r--mysql-test/r/ndb_grant.result416
-rw-r--r--mysql-test/r/ndb_index_ordered.result37
-rw-r--r--mysql-test/r/ndb_index_unique.result60
-rw-r--r--mysql-test/r/ndb_insert.result45
-rw-r--r--mysql-test/r/null.result94
-rw-r--r--mysql-test/r/ps.result27
-rw-r--r--mysql-test/r/ps_1general.result42
-rw-r--r--mysql-test/r/ps_2myisam.result80
-rw-r--r--mysql-test/r/ps_3innodb.result80
-rw-r--r--mysql-test/r/ps_4heap.result112
-rw-r--r--mysql-test/r/ps_5merge.result160
-rw-r--r--mysql-test/r/ps_6bdb.result80
-rw-r--r--mysql-test/r/ps_7ndb.result112
-rw-r--r--mysql-test/r/range.result4
-rw-r--r--mysql-test/r/rpl_rewrite_db.result92
-rw-r--r--mysql-test/r/select.result4
-rw-r--r--mysql-test/r/subselect.result15
-rw-r--r--mysql-test/r/timezone3.result41
-rw-r--r--mysql-test/r/type_blob.result4
-rw-r--r--mysql-test/r/type_datetime.result11
-rw-r--r--mysql-test/r/type_float.result4
-rw-r--r--mysql-test/r/union.result10
-rw-r--r--mysql-test/r/user_var.result17
-rw-r--r--mysql-test/std_data/Moscow_leapbin0 -> 991 bytes
-rw-r--r--mysql-test/t/alter_table.test12
-rw-r--r--mysql-test/t/binary.test7
-rw-r--r--mysql-test/t/client_test.test2
-rw-r--r--mysql-test/t/consistent_snapshot.test41
-rw-r--r--mysql-test/t/ctype_big5.test12
-rw-r--r--mysql-test/t/ctype_latin1.test7
-rw-r--r--mysql-test/t/ctype_tis620.test35
-rw-r--r--mysql-test/t/ctype_uca.test4
-rw-r--r--mysql-test/t/ctype_ucs.test24
-rw-r--r--mysql-test/t/ctype_ujis.test36
-rw-r--r--mysql-test/t/delete.test30
-rw-r--r--mysql-test/t/fulltext.test15
-rw-r--r--mysql-test/t/fulltext_order_by.test12
-rw-r--r--mysql-test/t/func_group.test11
-rw-r--r--mysql-test/t/func_in.test7
-rw-r--r--mysql-test/t/func_str.test6
-rw-r--r--mysql-test/t/func_time.test7
-rw-r--r--mysql-test/t/grant.test39
-rw-r--r--mysql-test/t/heap.test11
-rw-r--r--mysql-test/t/heap_hash.test112
-rw-r--r--mysql-test/t/innodb.test23
-rw-r--r--mysql-test/t/insert.test11
-rw-r--r--mysql-test/t/join_outer.test76
-rw-r--r--mysql-test/t/key.test23
-rw-r--r--mysql-test/t/key_cache.test11
-rw-r--r--mysql-test/t/mix_innodb_myisam_binlog-master.opt1
-rw-r--r--mysql-test/t/mix_innodb_myisam_binlog.test32
-rw-r--r--mysql-test/t/myisam.test3
-rw-r--r--mysql-test/t/ndb_autodiscover.test20
-rw-r--r--mysql-test/t/ndb_autodiscover2.test3
-rw-r--r--mysql-test/t/ndb_basic.test17
-rw-r--r--mysql-test/t/ndb_charset.test4
-rw-r--r--mysql-test/t/ndb_grant.test374
-rw-r--r--mysql-test/t/ndb_index_ordered.test28
-rw-r--r--mysql-test/t/ndb_index_unique.test42
-rw-r--r--mysql-test/t/ndb_insert.test36
-rw-r--r--mysql-test/t/null.test67
-rw-r--r--mysql-test/t/ps.test18
-rw-r--r--mysql-test/t/ps_1general.test35
-rw-r--r--mysql-test/t/rpl000001.test2
-rw-r--r--mysql-test/t/rpl_failed_optimize-master.opt2
-rw-r--r--mysql-test/t/rpl_rewrite_db-slave.opt1
-rw-r--r--mysql-test/t/rpl_rewrite_db.test77
-rw-r--r--mysql-test/t/select.test9
-rw-r--r--mysql-test/t/subselect.test19
-rw-r--r--mysql-test/t/timezone3-master.opt1
-rw-r--r--mysql-test/t/timezone3.test59
-rw-r--r--mysql-test/t/type_blob.test4
-rw-r--r--mysql-test/t/type_datetime.test7
-rw-r--r--mysql-test/t/type_float.test3
-rw-r--r--mysql-test/t/union.test6
-rw-r--r--mysql-test/t/user_var.test11
-rw-r--r--mysql-test/t/variables.test1
-rw-r--r--mysys/charset.c11
-rw-r--r--mysys/default.c118
-rw-r--r--mysys/mf_keycache.c25
-rw-r--r--mysys/mf_keycaches.c2
-rw-r--r--mysys/my_init.c9
-rw-r--r--ndb/config/type_ndbapitools.mk.am3
-rwxr-xr-xndb/home/bin/cvschk569
-rw-r--r--ndb/include/Makefile.am1
-rw-r--r--ndb/include/kernel/signaldata/ArbitSignalData.hpp15
-rw-r--r--ndb/include/kernel/signaldata/TupFrag.hpp6
-rw-r--r--ndb/include/mgmapi/LocalConfig.hpp (renamed from ndb/include/mgmcommon/LocalConfig.hpp)0
-rw-r--r--ndb/include/mgmapi/mgmapi.h1
-rw-r--r--ndb/include/ndb_types.h10
-rw-r--r--ndb/include/ndbapi/NdbConnection.hpp4
-rw-r--r--ndb/include/ndbapi/NdbDictionary.hpp14
-rw-r--r--ndb/include/portlib/NdbConfig.h (renamed from ndb/include/mgmcommon/NdbConfig.h)0
-rw-r--r--ndb/include/util/Bitmask.hpp34
-rw-r--r--ndb/include/util/SocketServer.hpp4
-rw-r--r--ndb/src/Makefile.am2
-rw-r--r--ndb/src/common/Makefile.am2
-rw-r--r--ndb/src/common/Makefile_old15
-rw-r--r--ndb/src/common/debugger/EventLogger.cpp5
-rw-r--r--ndb/src/common/debugger/Makefile_old11
-rw-r--r--ndb/src/common/debugger/signaldata/Makefile_old33
-rw-r--r--ndb/src/common/debugger/signaldata/SignalDataPrint.cpp70
-rw-r--r--ndb/src/common/editline/MANIFEST15
-rw-r--r--ndb/src/common/editline/Makefile.am10
-rw-r--r--ndb/src/common/editline/Makefile_old18
-rw-r--r--ndb/src/common/editline/README53
-rw-r--r--ndb/src/common/editline/complete.c211
-rw-r--r--ndb/src/common/editline/editline.3178
-rw-r--r--ndb/src/common/editline/editline.c1514
-rw-r--r--ndb/src/common/editline/editline_internal.h46
-rw-r--r--ndb/src/common/editline/sysunix.c148
-rw-r--r--ndb/src/common/editline/test/Makefile10
-rw-r--r--ndb/src/common/editline/test/testit.c55
-rw-r--r--ndb/src/common/logger/Makefile_old27
-rw-r--r--ndb/src/common/mgmcommon/ConfigRetriever.cpp13
-rw-r--r--ndb/src/common/mgmcommon/Makefile.am5
-rw-r--r--ndb/src/common/mgmcommon/Makefile_old29
-rw-r--r--ndb/src/common/portlib/Makefile.am3
-rw-r--r--ndb/src/common/portlib/Makefile_old21
-rw-r--r--ndb/src/common/portlib/NdbConfig.c (renamed from ndb/src/common/mgmcommon/NdbConfig.c)2
-rw-r--r--ndb/src/common/portlib/NdbDaemon.c20
-rw-r--r--ndb/src/common/portlib/old_dirs/unix/Makefile_old27
-rw-r--r--ndb/src/common/transporter/Makefile_old43
-rw-r--r--ndb/src/common/transporter/TransporterRegistry.cpp12
-rw-r--r--ndb/src/common/util/Makefile_old28
-rw-r--r--ndb/src/common/util/NdbSqlUtil.cpp6
-rw-r--r--ndb/src/common/util/SocketServer.cpp15
-rw-r--r--ndb/src/common/util/basestring_vsnprintf.c31
-rw-r--r--ndb/src/common/util/getarg.3315
-rw-r--r--ndb/src/common/util/getarg.3.ps458
-rw-r--r--ndb/src/common/util/md5-rfc1321.txt1179
-rw-r--r--ndb/src/cw/Makefile_old6
-rw-r--r--ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs58
-rw-r--r--ndb/src/cw/cpcc-win32/vb6/frmSplash.frm159
-rw-r--r--ndb/src/cw/cpcd/Makefile_old11
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/list.h56
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/os/inttypes.h53
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/rmlib.h212
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sci_errno.h216
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sci_types.h300
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sisci_api.h2170
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h226
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sisci_error.h89
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sisci_types.h133
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/sisci_version.h91
-rw-r--r--ndb/src/external/LINUX.x86/sci/include/version.h25
-rw-r--r--ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h2148
-rw-r--r--ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h89
-rw-r--r--ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h133
-rw-r--r--ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h91
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/rmlib.h212
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/scilib.h330
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/sisci_api.h2217
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h226
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/sisci_error.h94
-rw-r--r--ndb/src/external/WIN32.x86/sci/include/sisci_types.h133
-rw-r--r--ndb/src/kernel/Makefile_old5
-rw-r--r--ndb/src/kernel/blocks/ERROR_codes.txt13
-rw-r--r--ndb/src/kernel/blocks/Makefile_old28
-rw-r--r--ndb/src/kernel/blocks/backup/Makefile.am2
-rw-r--r--ndb/src/kernel/blocks/backup/Makefile_old18
-rw-r--r--ndb/src/kernel/blocks/backup/restore/Makefile.am16
-rw-r--r--ndb/src/kernel/blocks/cmvmi/Makefile_old9
-rw-r--r--ndb/src/kernel/blocks/dbacc/DbaccMain.cpp14
-rw-r--r--ndb/src/kernel/blocks/dbacc/Makefile_old11
-rw-r--r--ndb/src/kernel/blocks/dbdict/Dbdict.cpp12
-rw-r--r--ndb/src/kernel/blocks/dbdict/Dbdict.hpp4
-rw-r--r--ndb/src/kernel/blocks/dbdict/Makefile_old12
-rw-r--r--ndb/src/kernel/blocks/dbdih/Makefile_old13
-rw-r--r--ndb/src/kernel/blocks/dblqh/Dblqh.hpp2
-rw-r--r--ndb/src/kernel/blocks/dblqh/DblqhMain.cpp105
-rw-r--r--ndb/src/kernel/blocks/dblqh/Makefile_old12
-rw-r--r--ndb/src/kernel/blocks/dbtc/Makefile_old11
-rw-r--r--ndb/src/kernel/blocks/dbtup/Dbtup.hpp2
-rw-r--r--ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp65
-rw-r--r--ndb/src/kernel/blocks/dbtup/Makefile_old26
-rw-r--r--ndb/src/kernel/blocks/dbtux/Dbtux.hpp2
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp13
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp9
-rw-r--r--ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp88
-rw-r--r--ndb/src/kernel/blocks/dbtux/Makefile_old17
-rw-r--r--ndb/src/kernel/blocks/dbutil/Makefile_old8
-rw-r--r--ndb/src/kernel/blocks/grep/Makefile_old9
-rw-r--r--ndb/src/kernel/blocks/ndbcntr/Makefile_old12
-rw-r--r--ndb/src/kernel/blocks/ndbfs/Makefile_old14
-rw-r--r--ndb/src/kernel/blocks/qmgr/Makefile_old11
-rw-r--r--ndb/src/kernel/blocks/qmgr/QmgrMain.cpp43
-rw-r--r--ndb/src/kernel/blocks/suma/Makefile_old10
-rw-r--r--ndb/src/kernel/blocks/trix/Makefile_old8
-rw-r--r--ndb/src/kernel/error/Makefile_old12
-rw-r--r--ndb/src/kernel/vm/Configuration.cpp40
-rw-r--r--ndb/src/kernel/vm/Makefile_old30
-rw-r--r--ndb/src/mgmapi/LocalConfig.cpp (renamed from ndb/src/common/mgmcommon/LocalConfig.cpp)34
-rw-r--r--ndb/src/mgmapi/Makefile.am7
-rw-r--r--ndb/src/mgmapi/Makefile_old27
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp126
-rw-r--r--ndb/src/mgmclient/CommandInterpreter.cpp442
-rw-r--r--ndb/src/mgmclient/CommandInterpreter.hpp197
-rw-r--r--ndb/src/mgmclient/Makefile.am22
-rw-r--r--ndb/src/mgmclient/Makefile_old25
-rw-r--r--ndb/src/mgmclient/main.cpp80
-rw-r--r--ndb/src/mgmclient/ndb_mgmclient.h (renamed from ndb/src/common/editline/unix.h)22
-rw-r--r--ndb/src/mgmclient/ndb_mgmclient.hpp (renamed from ndb/src/common/editline/editline_win32.c)29
-rw-r--r--ndb/src/mgmsrv/CommandInterpreter.hpp28
-rw-r--r--ndb/src/mgmsrv/ConfigInfo.cpp8
-rw-r--r--ndb/src/mgmsrv/Makefile.am2
-rw-r--r--ndb/src/mgmsrv/Makefile_old41
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp88
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.hpp11
-rw-r--r--ndb/src/mgmsrv/Services.cpp42
-rw-r--r--ndb/src/mgmsrv/Services.hpp6
-rw-r--r--ndb/src/mgmsrv/main.cpp5
-rw-r--r--ndb/src/ndbapi/Makefile_old60
-rw-r--r--ndb/src/ndbapi/NdbConnection.cpp36
-rw-r--r--ndb/src/ndbapi/NdbDictionary.cpp16
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp46
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.hpp8
-rw-r--r--ndb/src/ndbapi/NdbIndexOperation.cpp2
-rw-r--r--ndb/src/ndbapi/NdbOperationExec.cpp4
-rw-r--r--ndb/src/ndbapi/NdbOperationSearch.cpp2
-rw-r--r--ndb/src/ndbapi/NdbScanOperation.cpp17
-rw-r--r--ndb/src/ndbapi/ndberror.c41
-rw-r--r--ndb/test/include/CpcClient.hpp (renamed from ndb/src/mgmclient/CpcClient.hpp)0
-rw-r--r--ndb/test/include/NDBT_Test.hpp4
-rw-r--r--ndb/test/ndbapi/Makefile_old49
-rw-r--r--ndb/test/ndbapi/ScanFunctions.hpp20
-rw-r--r--ndb/test/ndbapi/bank/Makefile_old12
-rw-r--r--ndb/test/ndbapi/old_dirs/flexBench/Makefile_old11
-rw-r--r--ndb/test/ndbapi/testBlobs.cpp303
-rw-r--r--ndb/test/ndbapi/testDataBuffers.cpp50
-rw-r--r--ndb/test/ndbapi/testDeadlock.cpp7
-rw-r--r--ndb/test/ndbapi/testDict.cpp89
-rw-r--r--ndb/test/ndbapi/testIndex.cpp24
-rw-r--r--ndb/test/ndbapi/testLcp.cpp7
-rw-r--r--ndb/test/ndbapi/testNdbApi.cpp16
-rw-r--r--ndb/test/ndbapi/testOIBasic.cpp19
-rw-r--r--ndb/test/ndbapi/testReadPerf.cpp5
-rw-r--r--ndb/test/ndbapi/testRestartGci.cpp5
-rw-r--r--ndb/test/ndbapi/testScanPerf.cpp5
-rw-r--r--ndb/test/ndbapi/testSystemRestart.cpp12
-rw-r--r--ndb/test/odbc/tpcb/Makefile30
-rw-r--r--ndb/test/odbc/tpcb/Makefile_mysql33
-rw-r--r--ndb/test/odbc/tpcb/Makefile_ndb30
-rw-r--r--ndb/test/odbc/tpcb/readme.txt15
-rw-r--r--ndb/test/odbc/tpcb/timesten.h188
-rw-r--r--ndb/test/odbc/tpcb/tpcb.cpp1415
-rw-r--r--ndb/test/odbc/tpcb/ttTime.c366
-rw-r--r--ndb/test/odbc/tpcb/ttTime.h125
-rw-r--r--ndb/test/run-test/Makefile.am5
-rw-r--r--ndb/test/run-test/Makefile_old22
-rw-r--r--ndb/test/src/CpcClient.cpp (renamed from ndb/src/mgmclient/CpcClient.cpp)0
-rw-r--r--ndb/test/src/Makefile.am3
-rw-r--r--ndb/test/src/Makefile_old33
-rw-r--r--ndb/test/tools/Makefile.am4
-rw-r--r--ndb/test/tools/Makefile_old9
-rw-r--r--ndb/test/tools/old_dirs/waiter/Makefile_old11
-rw-r--r--ndb/tools/Makefile.am20
-rw-r--r--ndb/tools/Makefile_old12
-rw-r--r--ndb/tools/ndb_test_platform.cpp95
-rw-r--r--ndb/tools/restore/Restore.cpp (renamed from ndb/src/kernel/blocks/backup/restore/Restore.cpp)4
-rw-r--r--ndb/tools/restore/Restore.hpp (renamed from ndb/src/kernel/blocks/backup/restore/Restore.hpp)3
-rw-r--r--ndb/tools/restore/consumer.cpp (renamed from ndb/src/kernel/blocks/backup/restore/consumer.cpp)0
-rw-r--r--ndb/tools/restore/consumer.hpp (renamed from ndb/src/kernel/blocks/backup/restore/consumer.hpp)0
-rw-r--r--ndb/tools/restore/consumer_printer.cpp (renamed from ndb/src/kernel/blocks/backup/restore/consumer_printer.cpp)0
-rw-r--r--ndb/tools/restore/consumer_printer.hpp (renamed from ndb/src/kernel/blocks/backup/restore/consumer_printer.hpp)0
-rw-r--r--ndb/tools/restore/consumer_restore.cpp (renamed from ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp)1
-rw-r--r--ndb/tools/restore/consumer_restore.hpp (renamed from ndb/src/kernel/blocks/backup/restore/consumer_restore.hpp)0
-rw-r--r--ndb/tools/restore/consumer_restorem.cpp (renamed from ndb/src/kernel/blocks/backup/restore/consumer_restorem.cpp)0
-rw-r--r--ndb/tools/restore/restore_main.cpp (renamed from ndb/src/kernel/blocks/backup/restore/main.cpp)29
-rw-r--r--ndb/tools/waiter.cpp7
-rw-r--r--scripts/fill_help_tables.sh10
-rw-r--r--scripts/mysqld_safe.sh2
-rw-r--r--sql-common/my_time.c30
-rw-r--r--sql/field.cc30
-rw-r--r--sql/field_conv.cc2
-rw-r--r--sql/ha_berkeley.cc10
-rw-r--r--sql/ha_heap.cc55
-rw-r--r--sql/ha_heap.h10
-rw-r--r--sql/ha_innodb.cc50
-rw-r--r--sql/ha_innodb.h4
-rw-r--r--sql/ha_ndbcluster.cc482
-rw-r--r--sql/ha_ndbcluster.h76
-rw-r--r--sql/handler.cc94
-rw-r--r--sql/handler.h6
-rw-r--r--sql/item.cc34
-rw-r--r--sql/item.h13
-rw-r--r--sql/item_cmpfunc.cc31
-rw-r--r--sql/item_func.cc31
-rw-r--r--sql/item_strfunc.cc14
-rw-r--r--sql/item_subselect.cc44
-rw-r--r--sql/item_sum.cc39
-rw-r--r--sql/item_sum.h9
-rw-r--r--sql/item_timefunc.cc55
-rw-r--r--sql/lex.h2
-rw-r--r--sql/log.cc44
-rw-r--r--sql/log_event.cc57
-rw-r--r--sql/log_event.h2
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc38
-rw-r--r--sql/opt_range.cc15
-rw-r--r--sql/repl_failsafe.cc2
-rw-r--r--sql/set_var.cc51
-rw-r--r--sql/share/french/errmsg.txt2
-rw-r--r--sql/share/greek/errmsg.txt2
-rw-r--r--sql/share/portuguese/errmsg.txt2
-rw-r--r--sql/share/romanian/errmsg.txt2
-rw-r--r--sql/share/serbian/errmsg.txt2
-rw-r--r--sql/share/spanish/errmsg.txt6
-rw-r--r--sql/share/swedish/errmsg.txt4
-rw-r--r--sql/slave.cc9
-rw-r--r--sql/slave.h4
-rw-r--r--sql/sql_acl.cc57
-rw-r--r--sql/sql_base.cc49
-rw-r--r--sql/sql_class.cc25
-rw-r--r--sql/sql_class.h40
-rw-r--r--sql/sql_db.cc9
-rw-r--r--sql/sql_do.cc1
-rw-r--r--sql/sql_error.cc6
-rw-r--r--sql/sql_help.cc14
-rw-r--r--sql/sql_insert.cc11
-rw-r--r--sql/sql_lex.h2
-rw-r--r--sql/sql_parse.cc55
-rw-r--r--sql/sql_prepare.cc29
-rw-r--r--sql/sql_select.cc21
-rw-r--r--sql/sql_select.h2
-rw-r--r--sql/sql_table.cc16
-rw-r--r--sql/sql_union.cc14
-rw-r--r--sql/sql_yacc.yy60
-rw-r--r--sql/structs.h7
-rw-r--r--sql/table.cc14
-rw-r--r--sql/thr_malloc.cc2
-rw-r--r--strings/ctype-czech.c12
-rw-r--r--strings/ctype-mb.c75
-rw-r--r--strings/ctype-tis620.c12
-rw-r--r--strings/ctype-uca.c32
-rw-r--r--strings/ctype-win1250ch.c12
-rw-r--r--strings/uca-dump.c91
-rw-r--r--tests/client_test.c770
432 files changed, 12753 insertions, 20082 deletions
diff --git a/.bzrignore b/.bzrignore
index 27fb593c662..10388d79013 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -922,3 +922,21 @@ Docs/Images/mydsn-test-success.txt
Docs/Images/mydsn-trace.txt
Docs/Images/mydsn.txt
Docs/Images/myflowchart.txt
+mysql-test/mysql_test_run_new
+ndb/tools/ndb_test_platform
+help
+ndbcluster-1186
+ndbcluster-1186/SCCS
+ndbcluster-1186/config.ini
+ndbcluster-1186/ndb_1.pid
+ndbcluster-1186/ndb_1_out.log
+ndbcluster-1186/ndb_1_signal.log
+ndbcluster-1186/ndb_2.pid
+ndbcluster-1186/ndb_2_out.log
+ndbcluster-1186/ndb_2_signal.log
+ndbcluster-1186/ndb_3.pid
+ndbcluster-1186/ndb_3_cluster.log
+ndbcluster-1186/ndb_3_out.log
+ndbcluster-1186/ndbcluster.pid
+ndb/tools/ndb_restore
+ac_available_languages_fragment
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index ac02fa84bbc..8fcec769a0c 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -163,6 +163,7 @@ pem@mysql.com
peter@linux.local
peter@mysql.com
peterg@mysql.com
+petr@mysql.com
pgulutzan@linux.local
ram@deer.(none)
ram@gw.mysql.r18.ru
@@ -195,9 +196,11 @@ tim@bitch.mysql.fi
tim@black.box
tim@hundin.mysql.fi
tim@sand.box
+tim@siva.hindu.god
tim@threads.polyesthetic.msg
tim@white.box
tim@work.mysql.com
+timour@mysql.com
tom@basil-firewall.home.com
tomas@mc05.(none)
tomas@poseidon.(none)
diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap
index 8cad093bc5f..a7d347ba32f 100755
--- a/Build-tools/Bootstrap
+++ b/Build-tools/Bootstrap
@@ -288,6 +288,10 @@ unless ($opt_skip_manual)
system ("bk cat $opt_docdir/Docs/$file.texi > $target_dir/Docs/$file.texi") == 0
or &abort("Could not update $file.texi in $target_dir/Docs/!");
}
+ system ("rm -f $target_dir/Docs/Images/Makefile*") == 0
+ or &abort("Could not remove Makefiles in $target_dir/Docs/Images/!");
+ system ("cp $opt_docdir/Docs/Images/*.* $target_dir/Docs/Images") == 0
+ or &abort("Could not copy image files in $target_dir/Docs/Images/!");
}
#
diff --git a/Docs/Images/Makefile.am b/Docs/Images/Makefile.am
new file mode 100644
index 00000000000..b57d701d8a0
--- /dev/null
+++ b/Docs/Images/Makefile.am
@@ -0,0 +1,35 @@
+# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library 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
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA
+
+## Process this file with automake to create Makefile.in
+
+# This is a dummy file to satisfy the hierarchy of Makefiles.
+# When a release is built, the true Makefile will be copied
+# together with the "real" files in this directory.
+
+EXTRA_DIST =
+
+# Nothing to create in this dummy directory.
+all:
+ :
+
+# Nothing to cleanup in this dummy directory.
+clean:
+ :
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/Docs/Makefile.am b/Docs/Makefile.am
index 034cec3b133..681046543bd 100644
--- a/Docs/Makefile.am
+++ b/Docs/Makefile.am
@@ -9,7 +9,7 @@
# If you know how to fix any of this more elegantly please mail
# docs@mysql.com
-TEXI2HTML_FLAGS = -iso -number
+TEXI2HTML_FLAGS = -iso -number -acc
DVIPS = dvips
MAKEINFO = @MAKEINFO@
TEXINFO_TEX = Support/texinfo.tex
@@ -24,6 +24,8 @@ BUILT_SOURCES = $(targets) manual_toc.html include.texi
EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \
INSTALL-BINARY reservedwords.texi internals.texi
+SUBDIRS = Images
+
all: $(targets) txt_files
txt_files: ../INSTALL-SOURCE ../COPYING ../INSTALL-WIN-SOURCE ../EXCEPTIONS-CLIENT \
diff --git a/Makefile.am b/Makefile.am
index 0dbb5032e15..0770854f176 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,15 +22,15 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common \
- @thread_dirs@ pstack @sql_client_dirs@ \
- @sql_server_dirs@ scripts man tests \
+ @thread_dirs@ pstack \
+ @sql_server_dirs@ @sql_client_dirs@ scripts man tests \
netware @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
DIST_SUBDIRS = . include @docs_dirs@ zlib \
@readline_topdir@ sql-common \
- @thread_dirs@ pstack @sql_client_dirs@ \
- @sql_server_dirs@ scripts @man_dirs@ tests SSL\
+ @thread_dirs@ pstack \
+ @sql_server_dirs@ @sql_client_dirs@ scripts @man_dirs@ tests SSL\
BUILD netware os2 @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
diff --git a/VC++Files/client/mysqladmin.dsp b/VC++Files/client/mysqladmin.dsp
index a7e4404e253..7a0b3bec1a7 100644
--- a/VC++Files/client/mysqladmin.dsp
+++ b/VC++Files/client/mysqladmin.dsp
@@ -115,7 +115,7 @@ LINK32=xilink6.exe
# Name "mysqladmin - Win32 classic"
# Begin Source File
-SOURCE=.\mysqladmin.c
+SOURCE=.\mysqladmin.cpp
# End Source File
# End Target
# End Project
diff --git a/acinclude.m4 b/acinclude.m4
index 7f25b447f10..81917372206 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -208,7 +208,7 @@ INCLUDES="$INCLUDES $ZLIB_INCLUDES"
LIBS="$LIBS $ZLIB_LIBS"
AC_CACHE_VAL([mysql_cv_compress],
[AC_TRY_LINK([#include <zlib.h>],
- [int link_test() { return compress(0, (unsigned long*) 0, "", 0); }],
+ [return compress(0, (unsigned long*) 0, "", 0);],
[mysql_cv_compress="yes"
AC_MSG_RESULT([ok])],
[mysql_cv_compress="no"])
@@ -1614,9 +1614,14 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
--with-ndb-docs Include the NDB Cluster ndbapi and mgmapi documentation],
[ndb_docs="$withval"],
[ndb_docs=no])
+ AC_ARG_WITH([ndb-port],
+ [
+ --with-ndb-port Port for NDB Cluster management server],
+ [ndb_port="$withval"],
+ [ndb_port="default"])
AC_ARG_WITH([ndb-port-base],
[
- --with-ndb-port-base Base port for NDB Cluster],
+ --with-ndb-port-base Base port for NDB Cluster transporters],
[ndb_port_base="$withval"],
[ndb_port_base="default"])
@@ -1673,6 +1678,7 @@ AC_DEFUN([MYSQL_CHECK_NDBCLUSTER], [
have_ndbcluster=no
ndbcluster_includes=
ndbcluster_libs=
+ ndb_mgmclient_libs=
case "$ndbcluster" in
yes )
AC_MSG_RESULT([Using NDB Cluster])
@@ -1681,6 +1687,7 @@ AC_DEFUN([MYSQL_CHECK_NDBCLUSTER], [
ndbcluster_includes="-I../ndb/include -I../ndb/include/ndbapi"
ndbcluster_libs="\$(top_builddir)/ndb/src/.libs/libndbclient.a"
ndbcluster_system_libs=""
+ ndb_mgmclient_libs="\$(top_builddir)/ndb/src/mgmclient/libndbmgmclient.la"
MYSQL_CHECK_NDB_OPTIONS
;;
* )
@@ -1692,6 +1699,7 @@ AC_DEFUN([MYSQL_CHECK_NDBCLUSTER], [
AC_SUBST(ndbcluster_includes)
AC_SUBST(ndbcluster_libs)
AC_SUBST(ndbcluster_system_libs)
+ AC_SUBST(ndb_mgmclient_libs)
])
dnl ---------------------------------------------------------------------------
diff --git a/client/Makefile.am b/client/Makefile.am
index a9da284a753..514ed7fdf51 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -26,6 +26,7 @@ bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
mysqldump mysqlimport mysqltest mysqlbinlog mysqlmanagerc mysqlmanager-pwgen
noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \
client_priv.h
+mysqladmin_SOURCES = mysqladmin.cc
mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS)
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
diff --git a/client/client_priv.h b/client/client_priv.h
index f16ec0e802b..184eed241ed 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -46,4 +46,7 @@ enum options_client
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS,
OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
OPT_SIGINT_IGNORE, OPT_HEXBLOB
+#ifdef HAVE_NDBCLUSTER_DB
+ ,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING
+#endif
};
diff --git a/client/mysql.cc b/client/mysql.cc
index 358b13e652b..8e9dd84c8f0 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1609,7 +1609,7 @@ static void print_help_item(MYSQL_ROW *cur, int num_name, int num_cat, char *las
char ccat= (*cur)[num_cat][0];
if (*last_char != ccat)
{
- put_info(ccat == 'Y' ? "categories :" : "topics :", INFO_INFO);
+ put_info(ccat == 'Y' ? "categories:" : "topics:", INFO_INFO);
*last_char= ccat;
}
tee_fprintf(PAGER, " %s\n", (*cur)[num_name]);
@@ -1676,8 +1676,8 @@ static int com_server_help(String *buffer __attribute__((unused)),
if (num_fields == 2)
{
- put_info("Many help items for your request exist", INFO_INFO);
- put_info("To make a more specific request, please type 'help <item>',\nwhere item is one of next", INFO_INFO);
+ put_info("Many help items for your request exist.", INFO_INFO);
+ put_info("To make a more specific request, please type 'help <item>',\nwhere item is one of the following", INFO_INFO);
num_name= 0;
num_cat= 1;
last_char= '_';
diff --git a/client/mysqladmin.c b/client/mysqladmin.cc
index bccbf29ef83..eec0dcb90fe 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.cc
@@ -16,7 +16,6 @@
/* maintaince of mysql databases */
-
#include "client_priv.h"
#include <signal.h>
#ifdef THREAD
@@ -25,6 +24,10 @@
#include <sys/stat.h>
#include <mysql.h>
+#ifdef LATER_HAVE_NDBCLUSTER_DB
+#include "../ndb/src/mgmclient/ndb_mgmclient.h"
+#endif
+
#define ADMIN_VERSION "8.41"
#define MAX_MYSQL_VAR 256
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
@@ -42,6 +45,10 @@ static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
opt_count_iterations= 0;
static ulong opt_connect_timeout, opt_shutdown_timeout;
static my_string unix_port=0;
+#ifdef LATER_HAVE_NDBCLUSTER_DB
+static my_bool opt_ndbcluster=0;
+static char *opt_ndb_connectstring=0;
+#endif
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
@@ -94,6 +101,9 @@ enum commands {
ADMIN_PING, ADMIN_EXTENDED_STATUS, ADMIN_FLUSH_STATUS,
ADMIN_FLUSH_PRIVILEGES, ADMIN_START_SLAVE, ADMIN_STOP_SLAVE,
ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD
+#ifdef LATER_HAVE_NDBCLUSTER_DB
+ ,ADMIN_NDB_MGM
+#endif
};
static const char *command_names[]= {
"create", "drop", "shutdown",
@@ -104,11 +114,14 @@ static const char *command_names[]= {
"ping", "extended-status", "flush-status",
"flush-privileges", "start-slave", "stop-slave",
"flush-threads","old-password",
+#ifdef LATER_HAVE_NDBCLUSTER_DB
+ "ndb-mgm",
+#endif
NullS
};
static TYPELIB command_typelib=
-{ array_elements(command_names)-1,"commands", command_names};
+{ array_elements(command_names)-1,"commands", command_names, NULL};
static struct my_option my_long_options[] =
{
@@ -184,6 +197,14 @@ static struct my_option my_long_options[] =
{"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", (gptr*) &opt_shutdown_timeout,
(gptr*) &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0},
+#ifdef LATER_HAVE_NDBCLUSTER_DB
+ {"ndbcluster", OPT_NDBCLUSTER, ""
+ "", (gptr*) &opt_ndbcluster,
+ (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"ndb-connectstring", OPT_NDB_CONNECTSTRING, ""
+ "", (gptr*) &opt_ndb_connectstring,
+ (gptr*) &opt_ndb_connectstring, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#endif
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -882,6 +903,24 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
mysql->reconnect=1; /* Automatic reconnect is default */
break;
+#ifdef LATER_HAVE_NDBCLUSTER_DB
+ case ADMIN_NDB_MGM:
+ {
+ if (argc < 2)
+ {
+ my_printf_error(0,"Too few arguments to ndb-mgm",MYF(ME_BELL));
+ return 1;
+ }
+ {
+ Ndb_mgmclient_handle cmd=
+ ndb_mgmclient_handle_create(opt_ndb_connectstring);
+ ndb_mgmclient_execute(cmd, --argc, ++argv);
+ ndb_mgmclient_handle_destroy(cmd);
+ }
+ argc= 0;
+ }
+ break;
+#endif
default:
my_printf_error(0,"Unknown command: '%-.60s'",MYF(ME_BELL),argv[0]);
return 1;
@@ -1248,3 +1287,6 @@ static my_bool wait_pidfile(char *pidfile, time_t last_modified,
}
DBUG_RETURN(error);
}
+#ifdef __GNUC__
+FIX_GCC_LINKING_PROBLEM
+#endif
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 5f9a499bd31..de53831c43d 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -44,7 +44,7 @@ static const char *load_default_groups[]= { "mysqlbinlog","client",0 };
void sql_print_error(const char *format, ...);
-static bool one_database=0, to_last_remote_log= 0;
+static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0;
static const char* database= 0;
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
static ulonglong offset = 0;
@@ -204,7 +204,7 @@ int Load_log_processor::load_old_format_file(NET* net, const char*server_fname,
for (;;)
{
- uint packet_len = my_net_read(net);
+ ulong packet_len = my_net_read(net);
if (packet_len == 0)
{
if (my_net_write(net, "", 0) || net_flush(net))
@@ -226,7 +226,13 @@ int Load_log_processor::load_old_format_file(NET* net, const char*server_fname,
return -1;
}
- if (my_write(file, (byte*) net->read_pos, packet_len,MYF(MY_WME|MY_NABP)))
+ if (packet_len > UINT_MAX)
+ {
+ sql_print_error("Illegal length of packet read from net");
+ return -1;
+ }
+ if (my_write(file, (byte*) net->read_pos,
+ (uint) packet_len, MYF(MY_WME|MY_NABP)))
return -1;
}
@@ -432,6 +438,13 @@ static struct my_option my_long_options[] =
{"database", 'd', "List entries for just this database (local log only).",
(gptr*) &database, (gptr*) &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
+ {"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
+ "enabled --to-last-log and are sending the output to the same MySQL server. "
+ "This way you could avoid an endless loop. You would also like to use it "
+ "when restoring after a crash to avoid duplication of the statements you "
+ "already have. NOTE: you will need a SUPER privilege to use this option.",
+ (gptr*) &disable_log_bin, (gptr*) &disable_log_bin, 0, GET_BOOL,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
{"force-read", 'f', "Force reading unknown binlog events.",
(gptr*) &force_opt, (gptr*) &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
@@ -747,7 +760,8 @@ static int dump_remote_log_entries(const char* logname)
{
char buf[128];
char last_db[FN_REFLEN+1] = "";
- uint len, logname_len;
+ ulong len;
+ uint logname_len;
NET* net;
int old_format;
int error= 0;
@@ -770,7 +784,15 @@ static int dump_remote_log_entries(const char* logname)
*/
int4store(buf, (uint32)start_position);
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
- logname_len = (uint) strlen(logname);
+
+ size_s tlen = strlen(logname);
+ if (tlen > UINT_MAX)
+ {
+ fprintf(stderr,"Log name too long\n");
+ error= 1;
+ goto err;
+ }
+ logname_len = (uint) tlen;
int4store(buf + 6, 0);
memcpy(buf + 10, logname, logname_len);
if (simple_command(mysql, COM_BINLOG_DUMP, buf, logname_len + 10, 1))
@@ -1053,6 +1075,11 @@ int main(int argc, char** argv)
fprintf(result_file,
"/*!40019 SET @@session.max_insert_delayed_threads=0*/;\n");
+
+ if (disable_log_bin)
+ fprintf(result_file,
+ "/*!32316 SET @OLD_SQL_LOG_BIN=@@SQL_LOG_BIN, SQL_LOG_BIN=0*/;\n");
+
for (save_stop_position= stop_position, stop_position= ~(my_off_t)0 ;
(--argc >= 0) && !stop_passed ; )
{
@@ -1067,6 +1094,9 @@ int main(int argc, char** argv)
start_position= BIN_LOG_HEADER_SIZE;
}
+ if (disable_log_bin)
+ fprintf(result_file, "/*!32316 SET SQL_LOG_BIN=@OLD_SQL_LOG_BIN*/;\n");
+
if (tmpdir.list)
free_tmpdir(&tmpdir);
if (result_file != stdout)
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 1686278096b..cfe93a11024 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -37,7 +37,7 @@
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
*/
-#define DUMP_VERSION "10.8"
+#define DUMP_VERSION "10.9"
#include <my_global.h>
#include <my_sys.h>
@@ -78,8 +78,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
lock_tables=1,ignore_errors=0,flush_logs=0,replace=0,
ignore=0,opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0,
opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
- opt_alldbs=0,opt_create_db=0,opt_first_slave=0,opt_set_charset,
- opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0,
+ opt_alldbs=0,opt_create_db=0,opt_lock_all_tables=0,opt_set_charset,
+ opt_autocommit=0,opt_disable_keys=1,opt_xml=0,
opt_delete_master_logs=0, tty_password=0,
opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
opt_hex_blob=0;
@@ -93,7 +93,9 @@ static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*err_ptr= 0;
static char compatible_mode_normal_str[255];
static ulong opt_compatible_mode= 0;
-static uint opt_mysql_port= 0, err_len= 0;
+#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
+#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
+static uint opt_mysql_port= 0, err_len= 0, opt_master_data;
static my_string opt_mysql_unix_port=0;
static int first_error=0;
static DYNAMIC_STRING extended_row;
@@ -124,7 +126,7 @@ const char *compatible_mode_names[]=
(1<<10) /* ANSI */\
)
TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
- "", compatible_mode_names};
+ "", compatible_mode_names, NULL};
static struct my_option my_long_options[] =
@@ -148,6 +150,9 @@ static struct my_option my_long_options[] =
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"comments", 'i', "Write additional information.",
+ (gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG,
+ 1, 0, 0, 0, 0, 0},
{"compatible", OPT_COMPATIBLE,
"Change the dump to be compatible with a given mode. By default tables are dumped in a format optimized for MySQL. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option is ignored with earlier server versions.",
(gptr*) &opt_compatible_mode_str, (gptr*) &opt_compatible_mode_str, 0,
@@ -183,8 +188,9 @@ static struct my_option my_long_options[] =
(gptr*) &opt_delayed, (gptr*) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"delete-master-logs", OPT_DELETE_MASTER_LOGS,
- "Delete logs on master after backup. This automatically enables --first-slave.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "Delete logs on master after backup. This automatically enables --master-data.",
+ (gptr*) &opt_delete_master_logs, (gptr*) &opt_delete_master_logs, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-keys", 'K',
"'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (gptr*) &opt_disable_keys,
(gptr*) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
@@ -203,13 +209,18 @@ static struct my_option my_long_options[] =
(gptr*) &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
{"fields-escaped-by", OPT_ESC, "Fields in the i.file are escaped by ...",
(gptr*) &escaped, (gptr*) &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"first-slave", 'x', "Locks all tables across all databases.",
- (gptr*) &opt_first_slave, (gptr*) &opt_first_slave, 0, GET_BOOL, NO_ARG,
+ {"first-slave", 'x', "Deprecated, renamed to --lock-all-tables.",
+ (gptr*) &opt_lock_all_tables, (gptr*) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"flush-logs", 'F', "Flush logs file in server before starting dump. "
- "Note that if you dump many databases at once (using the option "
- "--databases= or --all-databases), the logs will be flushed for "
- "each database dumped.",
+ "Note that if you dump many databases at once (using the option "
+ "--databases= or --all-databases), the logs will be flushed for "
+ "each database dumped. The exception is when using --lock-all-tables "
+ "or --master-data: "
+ "in this case the logs will be flushed only once, corresponding "
+ "to the moment all tables are locked. So if you want your dump and "
+ "the log flush to happen at the same exact moment you should use "
+ "--lock-all-tables or --master-data with --flush-logs",
(gptr*) &flush_logs, (gptr*) &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"force", 'f', "Continue even if we get an sql-error.",
@@ -217,24 +228,45 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"hex-blob", OPT_HEXBLOB, "Dump binary strings (BINARY, "
+ "VARBINARY, BLOB) in hexadecimal format.",
+ (gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &current_host,
(gptr*) &current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"lock-all-tables", 'x', "Locks all tables across all databases. This "
+ "is achieved by taking a global read lock for the duration of the whole "
+ "dump. Automatically turns --single-transaction and --lock-tables off.",
+ (gptr*) &opt_lock_all_tables, (gptr*) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
+ 0, 0, 0, 0, 0, 0},
{"lock-tables", 'l', "Lock all tables for read.", (gptr*) &lock_tables,
(gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"master-data", OPT_MASTER_DATA,
- "This causes the master position and filename to be appended to your output. This automatically enables --first-slave.",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ "This causes the binary log position and filename to be appended to the "
+ "output. If equal to 1, will print it as a CHANGE MASTER command; if equal"
+ " to 2, that command will be prefixed with a comment symbol. "
+ "This option will turn --lock-all-tables on, unless "
+ "--single-transaction is specified too (in which case a "
+ "global read lock is only taken a short time at the beginning of the dump "
+ "- don't forget to read about --single-transaction below). In all cases "
+ "any action on logs will happen at the exact moment of the dump."
+ "Option automatically turns --lock-tables off.",
+ (gptr*) &opt_master_data, (gptr*) &opt_master_data, 0,
+ GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0},
+ {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
+ (gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0,
+ GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
+ (longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
+ {"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
+ (gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0,
+ GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L,
+ MALLOC_OVERHEAD-1024, 1024, 0},
{"no-autocommit", OPT_AUTOCOMMIT,
"Wrap tables with autocommit/commit statements.",
(gptr*) &opt_autocommit, (gptr*) &opt_autocommit, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
- {"single-transaction", OPT_TRANSACTION,
- "Dump all tables in single transaction to get consistent snapshot. Mutually exclusive with --lock-tables.",
- (gptr*) &opt_single_transaction, (gptr*) &opt_single_transaction, 0,
- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-create-db", 'n',
"'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will not be put in the output. The above line will be added otherwise, if --databases or --all-databases option was given.}.",
(gptr*) &opt_create_db, (gptr*) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0,
@@ -246,13 +278,6 @@ static struct my_option my_long_options[] =
{"no-set-names", 'N',
"Deprecated. Use --skip-set-charset instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"set-charset", OPT_SET_CHARSET,
- "Add 'SET NAMES default_character_set' to the output. Enabled by default; suppress with --skip-set-charset.",
- (gptr*) &opt_set_charset, (gptr*) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
- 0, 0, 0, 0, 0},
- {"set-variable", 'O',
- "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"opt", OPT_OPTIMIZE,
"Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -276,11 +301,31 @@ static struct my_option my_long_options[] =
{"result-file", 'r',
"Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"set-charset", OPT_SET_CHARSET,
+ "Add 'SET NAMES default_character_set' to the output. Enabled by default; suppress with --skip-set-charset.",
+ (gptr*) &opt_set_charset, (gptr*) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
+ 0, 0, 0, 0, 0},
+ {"set-variable", 'O',
+ "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
+ 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
+ /*
+ Note that the combination --single-transaction --master-data
+ will give bullet-proof binlog position only if server >=4.1.3. That's the
+ old "FLUSH TABLES WITH READ LOCK does not block commit" fixed bug.
+ */
+ {"single-transaction", OPT_TRANSACTION,
+ "Creates a consistent snapshot by dumping all tables in a single "
+ "transaction. Works ONLY for tables stored in storage engines which "
+ "support multiversioning (currently only InnoDB does); the dump is NOT "
+ "guaranteed to be consistent for other storage engines. Option "
+ "automatically turns off --lock-tables.",
+ (gptr*) &opt_single_transaction, (gptr*) &opt_single_transaction, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-opt", OPT_SKIP_OPTIMIZATION,
"Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -306,20 +351,7 @@ static struct my_option my_long_options[] =
(gptr*) &where, (gptr*) &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
- (gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0,
- GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
- (longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
- {"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
- (gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0,
- GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L,
- MALLOC_OVERHEAD-1024, 1024, 0},
- {"comments", 'i', "Write additional information.",
- (gptr*) &opt_comments, (gptr*) &opt_comments, 0, GET_BOOL, NO_ARG,
- 1, 0, 0, 0, 0, 0},
- {"hex-blob", OPT_HEXBLOB, "Dump BLOBs in HEX. this mode does not work with extended-insert",
- (gptr*) &opt_hex_blob, (gptr*) &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static const char *load_default_groups[]= { "mysqldump","client",0 };
@@ -472,14 +504,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
- case OPT_MASTER_DATA:
- opt_master_data=1;
- opt_first_slave=1;
- break;
- case OPT_DELETE_MASTER_LOGS:
- opt_delete_master_logs=1;
- opt_first_slave=1;
- break;
case 'p':
if (argument)
{
@@ -524,10 +548,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case '?':
usage();
exit(0);
+ case (int) OPT_MASTER_DATA:
+ if (!argument) /* work like in old versions */
+ opt_master_data= MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL;
+ break;
case (int) OPT_OPTIMIZE:
extended_insert= opt_drop= opt_lock= quick= create_options=
opt_disable_keys= lock_tables= opt_set_charset= 1;
- if (opt_single_transaction) lock_tables=0;
break;
case (int) OPT_SKIP_OPTIMIZATION:
extended_insert= opt_drop= opt_lock= quick= create_options=
@@ -623,7 +650,19 @@ static int get_options(int *argc, char ***argv)
"%s: You must use option --tab with --fields-...\n", my_progname);
return(1);
}
- if (opt_single_transaction)
+
+ /* Ensure consistency of the set of binlog & locking options */
+ if (opt_delete_master_logs && !opt_master_data)
+ opt_master_data= MYSQL_OPT_MASTER_DATA_COMMENTED_SQL;
+ if (opt_single_transaction && opt_lock_all_tables)
+ {
+ fprintf(stderr, "%s: You can't use --single-transaction and "
+ "--lock-all-tables at the same time.\n", my_progname);
+ return(1);
+ }
+ if (opt_master_data)
+ opt_lock_all_tables= !opt_single_transaction;
+ if (opt_single_transaction || opt_lock_all_tables)
lock_tables= 0;
if (enclosed && opt_enclosed)
{
@@ -670,6 +709,36 @@ static void DBerror(MYSQL *mysql, const char *when)
} /* DBerror */
+/*
+ Sends a query to server, optionally reads result, prints error message if
+ some.
+
+ SYNOPSIS
+ mysql_query_with_error_report()
+ mysql_con connection to use
+ res if non zero, result will be put there with mysql_store_result
+ query query to send to server
+
+ RETURN VALUES
+ 0 query sending and (if res!=0) result reading went ok
+ 1 error
+*/
+
+static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
+ const char *query)
+{
+ if (mysql_query(mysql_con, query) ||
+ (res && !((*res)= mysql_store_result(mysql_con))))
+ {
+ my_printf_error(0, "%s: Couldn't execute '%s': %s (%d)",
+ MYF(0), my_progname, query,
+ mysql_error(mysql_con), mysql_errno(mysql_con));
+ return 1;
+ }
+ return 0;
+}
+
+
static void safe_exit(int error)
{
if (!first_error)
@@ -717,12 +786,15 @@ static int dbConnect(char *host, char *user,char *passwd)
DBerror(&mysql_connection, "when trying to connect");
return 1;
}
+ /*
+ As we're going to set SQL_MODE, it would be lost on reconnect, so we
+ cannot reconnect.
+ */
+ sock->reconnect= 0;
sprintf(buff, "/*!40100 SET @@SQL_MODE=\"%s\" */",
compatible_mode_normal_str);
- if (mysql_query(sock, buff))
+ if (mysql_query_with_error_report(sock, 0, buff))
{
- fprintf(stderr, "%s: Can't set the compatible mode %s (error %s)\n",
- my_progname, compatible_mode_normal_str, mysql_error(sock));
mysql_close(sock);
safe_exit(EX_MYSQLERR);
return 1;
@@ -961,7 +1033,7 @@ static uint getTableStructure(char *table, char* db)
result_table= quote_name(table, table_buff, 1);
opt_quoted_table= quote_name(table, table_buff2, 0);
- if (!opt_xml && !mysql_query(sock,insert_pat))
+ if (!opt_xml && !mysql_query_with_error_report(sock, 0, insert_pat))
{
/* using SHOW CREATE statement */
if (!tFlag)
@@ -970,10 +1042,8 @@ static uint getTableStructure(char *table, char* db)
char buff[20+FN_REFLEN];
sprintf(buff,"show create table %s", result_table);
- if (mysql_query(sock, buff))
+ if (mysql_query_with_error_report(sock, 0, buff))
{
- fprintf(stderr, "%s: Can't get CREATE TABLE for table %s (%s)\n",
- my_progname, result_table, mysql_error(sock));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
@@ -1010,10 +1080,8 @@ static uint getTableStructure(char *table, char* db)
mysql_free_result(tableRes);
}
sprintf(insert_pat,"show fields from %s", result_table);
- if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock)))
+ if (mysql_query_with_error_report(sock, &tableRes, insert_pat))
{
- fprintf(stderr, "%s: Can't get info about table: %s\nerror: %s\n",
- my_progname, result_table, mysql_error(sock));
if (path)
my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
@@ -1053,10 +1121,8 @@ static uint getTableStructure(char *table, char* db)
my_progname, mysql_error(sock));
sprintf(insert_pat,"show fields from %s", result_table);
- if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock)))
+ if (mysql_query_with_error_report(sock, &tableRes, insert_pat))
{
- fprintf(stderr, "%s: Can't get info about table: %s\nerror: %s\n",
- my_progname, result_table, mysql_error(sock));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
@@ -1150,17 +1216,14 @@ static uint getTableStructure(char *table, char* db)
char buff[20+FN_REFLEN];
uint keynr,primary_key;
sprintf(buff,"show keys from %s", result_table);
- if (mysql_query(sock, buff))
+ if (mysql_query_with_error_report(sock, &tableRes, buff))
{
- fprintf(stderr, "%s: Can't get keys for table %s (%s)\n",
- my_progname, result_table, mysql_error(sock));
if (path)
my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
- tableRes=mysql_store_result(sock);
/* Find first which key is primary key */
keynr=0;
primary_key=INT_MAX;
@@ -1224,7 +1287,7 @@ static uint getTableStructure(char *table, char* db)
char show_name_buff[FN_REFLEN];
sprintf(buff,"show table status like %s",
quote_for_like(table, show_name_buff));
- if (mysql_query(sock, buff))
+ if (mysql_query_with_error_report(sock, &tableRes, buff))
{
if (mysql_errno(sock) != ER_PARSE_ERROR)
{ /* If old MySQL version */
@@ -1234,8 +1297,7 @@ static uint getTableStructure(char *table, char* db)
result_table,mysql_error(sock));
}
}
- else if (!(tableRes=mysql_store_result(sock)) ||
- !(row=mysql_fetch_row(tableRes)))
+ else if (!(row=mysql_fetch_row(tableRes)))
{
fprintf(stderr,
"Error: Couldn't read status information for table %s (%s)\n",
@@ -1439,22 +1501,14 @@ static void dumpTable(uint numFields, char *table)
fputs("\n", md_result_file);
check_io(md_result_file);
}
- if (mysql_query(sock, query))
- {
+ if (mysql_query_with_error_report(sock, 0, query))
DBerror(sock, "when retrieving data from server");
- error= EX_CONSCHECK;
- goto err;
- }
if (quick)
res=mysql_use_result(sock);
else
res=mysql_store_result(sock);
if (!res)
- {
DBerror(sock, "when retrieving data from server");
- error= EX_CONSCHECK;
- goto err;
- }
if (verbose)
fprintf(stderr, "-- Retrieving rows...\n");
if (mysql_num_fields(res) != numFields)
@@ -1523,10 +1577,12 @@ static void dumpTable(uint numFields, char *table)
/*
63 is my_charset_bin. If charsetnr is not 63,
we have not a BLOB but a TEXT column.
- we'll dump it in hex only BLOB columns.
+ we'll dump in hex only BLOB columns.
*/
is_blob= (opt_hex_blob && field->charsetnr == 63 &&
- (field->type == FIELD_TYPE_BLOB ||
+ (field->type == FIELD_TYPE_STRING ||
+ field->type == FIELD_TYPE_VAR_STRING ||
+ field->type == FIELD_TYPE_BLOB ||
field->type == FIELD_TYPE_LONG_BLOB ||
field->type == FIELD_TYPE_MEDIUM_BLOB ||
field->type == FIELD_TYPE_TINY_BLOB)) ? 1 : 0;
@@ -1544,6 +1600,13 @@ static void dumpTable(uint numFields, char *table)
{
if (!IS_NUM_FIELD(field))
{
+ /*
+ "length * 2 + 2" is OK for both HEX and non-HEX modes:
+ - In HEX mode we need exactly 2 bytes per character
+ plus 2 bytes for '0x' prefix.
+ - In non-HEX mode we need up to 2 bytes per character,
+ plus 2 bytes for leading and trailing '\'' characters.
+ */
if (dynstr_realloc(&extended_row,length * 2+2))
{
fputs("Aborting dump (out of memory)",stderr);
@@ -1552,15 +1615,11 @@ static void dumpTable(uint numFields, char *table)
}
if (opt_hex_blob && is_blob)
{
- ulong counter;
- unsigned char *ptr= row[i];
dynstr_append(&extended_row, "0x");
- for (counter = 0; counter < lengths[i]; counter++)
- {
- char xx[3];
- sprintf(xx, "%02X", ptr[counter]);
- dynstr_append(&extended_row, xx);
- }
+ extended_row.length+= mysql_hex_string(extended_row.str +
+ extended_row.length,
+ row[i], length);
+ extended_row.str[extended_row.length]= '\0';
}
else
{
@@ -1623,16 +1682,12 @@ static void dumpTable(uint numFields, char *table)
fputs("</field>\n", md_result_file);
}
else if (opt_hex_blob && is_blob)
- { /* sakaik got this idea. */
- ulong counter;
- char xx[4];
- unsigned char *ptr= row[i];
+ {
+ /* sakaik got the idea to to provide blob's in hex notation. */
+ char *ptr= row[i], *end= ptr+ lengths[i];
fputs("0x", md_result_file);
- for (counter = 0; counter < lengths[i]; counter++)
- {
- sprintf(xx, "%02X", ptr[counter]);
- fputs(xx, md_result_file);
- }
+ for (; ptr < end ; ptr++)
+ fprintf(md_result_file, "%02X", *ptr);
}
else
unescape(md_result_file, row[i], lengths[i]);
@@ -1784,13 +1839,8 @@ static int dump_all_databases()
MYSQL_RES *tableres;
int result=0;
- if (mysql_query(sock, "SHOW DATABASES") ||
- !(tableres = mysql_store_result(sock)))
- {
- my_printf_error(0, "Error: Couldn't execute 'SHOW DATABASES': %s",
- MYF(0), mysql_error(sock));
+ if (mysql_query_with_error_report(sock, &tableres, "SHOW DATABASES"))
return 1;
- }
while ((row = mysql_fetch_row(tableres)))
{
if (dump_all_tables_in_db(row[0]))
@@ -1843,7 +1893,7 @@ static int init_dumping(char *database)
sprintf(qbuf,"SHOW CREATE DATABASE WITH IF NOT EXISTS %s",
qdatabase);
- if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock)))
+ if (mysql_query_with_error_report(sock, &dbinfo, qbuf))
{
/* Old server version, dump generic CREATE DATABASE */
fprintf(md_result_file,
@@ -1912,7 +1962,7 @@ static int dump_all_tables_in_db(char *database)
check_io(md_result_file);
}
if (lock_tables)
- mysql_query(sock,"UNLOCK TABLES");
+ mysql_query_with_error_report(sock, 0, "UNLOCK TABLES");
return 0;
} /* dump_all_tables_in_db */
@@ -1961,11 +2011,86 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
check_io(md_result_file);
}
if (lock_tables)
- mysql_query(sock,"UNLOCK TABLES");
+ mysql_query_with_error_report(sock, 0, "UNLOCK TABLES");
return 0;
} /* dump_selected_tables */
+static int do_show_master_status(MYSQL *mysql_con)
+{
+ MYSQL_ROW row;
+ MYSQL_RES *master;
+ const char *comment_prefix=
+ (opt_master_data == MYSQL_OPT_MASTER_DATA_COMMENTED_SQL) ? "-- " : "";
+ if (mysql_query_with_error_report(mysql_con, &master, "SHOW MASTER STATUS"))
+ {
+ my_printf_error(0, "Error: Couldn't execute 'SHOW MASTER STATUS': %s",
+ MYF(0), mysql_error(mysql_con));
+ return 1;
+ }
+ else
+ {
+ row = mysql_fetch_row(master);
+ if (row && row[0] && row[1])
+ {
+ if (opt_comments)
+ fprintf(md_result_file,
+ "\n--\n-- Position to start replication or point-in-time "
+ "recovery from\n--\n\n");
+ fprintf(md_result_file,
+ "%sCHANGE MASTER TO MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n",
+ comment_prefix, row[0], row[1]);
+ check_io(md_result_file);
+ }
+ mysql_free_result(master);
+ }
+ return 0;
+}
+
+
+static int do_flush_tables_read_lock(MYSQL *mysql_con)
+{
+ /*
+ We do first a FLUSH TABLES. If a long update is running, the FLUSH TABLES
+ will wait but will not stall the whole mysqld, and when the long update is
+ done the FLUSH TABLES WITH READ LOCK will start and succeed quickly. So,
+ FLUSH TABLES is to lower the probability of a stage where both mysqldump
+ and most client connections are stalled. Of course, if a second long
+ update starts between the two FLUSHes, we have that bad stall.
+ */
+ return
+ ( mysql_query_with_error_report(mysql_con, 0, "FLUSH TABLES") ||
+ mysql_query_with_error_report(mysql_con, 0,
+ "FLUSH TABLES WITH READ LOCK") );
+}
+
+
+static int do_unlock_tables(MYSQL *mysql_con)
+{
+ return mysql_query_with_error_report(mysql_con, 0, "UNLOCK TABLES");
+}
+
+
+static int do_reset_master(MYSQL *mysql_con)
+{
+ return mysql_query_with_error_report(mysql_con, 0, "RESET MASTER");
+}
+
+
+static int start_transaction(MYSQL *mysql_con, my_bool consistent_read_now)
+{
+ /*
+ We use BEGIN for old servers. --single-transaction --master-data will fail
+ on old servers, but that's ok as it was already silently broken (it didn't
+ do a consistent read, so better tell people frankly, with the error).
+ */
+ return (mysql_query_with_error_report(mysql_con, 0,
+ consistent_read_now ?
+ "START TRANSACTION "
+ "WITH CONSISTENT SNAPSHOT" :
+ "BEGIN"));
+}
+
static ulong find_set(TYPELIB *lib, const char *x, uint length,
char **err_pos, uint *err_len)
@@ -2063,7 +2188,7 @@ static const char *check_if_ignore_table(const char *table_name)
sprintf(buff,"show table status like %s",
quote_for_like(table_name, show_name_buff));
- if (mysql_query(sock, buff))
+ if (mysql_query_with_error_report(sock, &res, buff))
{
if (mysql_errno(sock) != ER_PARSE_ERROR)
{ /* If old MySQL version */
@@ -2074,8 +2199,7 @@ static const char *check_if_ignore_table(const char *table_name)
return 0; /* assume table is ok */
}
}
- if (!(res= mysql_store_result(sock)) ||
- !(row= mysql_fetch_row(res)))
+ if (!(row= mysql_fetch_row(res)))
{
fprintf(stderr,
"Error: Couldn't read status information for table %s (%s)\n",
@@ -2094,8 +2218,6 @@ static const char *check_if_ignore_table(const char *table_name)
int main(int argc, char **argv)
{
- MYSQL_ROW row;
- MYSQL_RES *master;
compatible_mode_normal_str[0]= 0;
MY_INIT(argv[0]);
@@ -2109,28 +2231,24 @@ int main(int argc, char **argv)
if (!path)
write_header(md_result_file, *argv);
- if (opt_first_slave)
- {
- lock_tables=0; /* No other locks needed */
- if (mysql_query(sock, "FLUSH TABLES WITH READ LOCK"))
- {
- my_printf_error(0, "Error: Couldn't execute 'FLUSH TABLES WITH READ LOCK': %s",
- MYF(0), mysql_error(sock));
- my_end(0);
- return(first_error);
- }
- }
- else if (opt_single_transaction)
+ if ((opt_lock_all_tables || opt_master_data) &&
+ do_flush_tables_read_lock(sock))
+ goto err;
+ if (opt_single_transaction && start_transaction(sock, test(opt_master_data)))
+ goto err;
+ if (opt_delete_master_logs && do_reset_master(sock))
+ goto err;
+ if (opt_lock_all_tables || opt_master_data)
{
- /* There is no sense to start transaction if all tables are locked */
- if (mysql_query(sock, "BEGIN"))
- {
- my_printf_error(0, "Error: Couldn't execute 'BEGIN': %s",
- MYF(0), mysql_error(sock));
- my_end(0);
- return(first_error);
- }
+ if (flush_logs && mysql_refresh(sock, REFRESH_LOG))
+ goto err;
+ flush_logs= 0; /* not anymore; that would not be sensible */
}
+ if (opt_master_data && do_show_master_status(sock))
+ goto err;
+ if (opt_single_transaction && do_unlock_tables(sock)) /* unlock but no commit! */
+ goto err;
+
if (opt_alldbs)
dump_all_databases();
else if (argc > 1 && !opt_databases)
@@ -2143,57 +2261,16 @@ int main(int argc, char **argv)
/* One or more databases, all tables */
dump_databases(argv);
}
-
- if (opt_first_slave)
- {
- if (opt_delete_master_logs && mysql_query(sock, "FLUSH MASTER"))
- {
- my_printf_error(0, "Error: Couldn't execute 'FLUSH MASTER': %s",
- MYF(0), mysql_error(sock));
- }
- if (opt_master_data)
- {
- if (mysql_query(sock, "SHOW MASTER STATUS") ||
- !(master = mysql_store_result(sock)))
- my_printf_error(0, "Error: Couldn't execute 'SHOW MASTER STATUS': %s",
- MYF(0), mysql_error(sock));
- else
- {
- row = mysql_fetch_row(master);
- if (row && row[0] && row[1])
- {
- if (opt_comments)
- fprintf(md_result_file,
- "\n--\n-- Position to start replication from\n--\n\n");
- fprintf(md_result_file,
- "CHANGE MASTER TO MASTER_LOG_FILE='%s', \
-MASTER_LOG_POS=%s ;\n",row[0],row[1]);
- check_io(md_result_file);
- }
- mysql_free_result(master);
- }
- }
- if (mysql_query(sock, "UNLOCK TABLES"))
- my_printf_error(0, "Error: Couldn't execute 'UNLOCK TABLES': %s",
- MYF(0), mysql_error(sock));
- }
- else if (opt_single_transaction) /* Just to make it beautiful enough */
#ifdef HAVE_SMEM
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif
- {
- /*
- In case we were locking all tables, we did not start transaction
- so there is no need to commit it.
- */
-
- /* This should just free locks as we did not change anything */
- if (mysql_query(sock, "COMMIT"))
- {
- my_printf_error(0, "Error: Couldn't execute 'COMMIT': %s",
- MYF(0), mysql_error(sock));
- }
- }
+ /*
+ No reason to explicitely COMMIT the transaction, neither to explicitely
+ UNLOCK TABLES: these will be automatically be done by the server when we
+ disconnect now. Saves some code here, some network trips, adds nothing to
+ server.
+ */
+err:
dbDisconnect(current_host);
if (!path)
write_footer(md_result_file);
diff --git a/client/mysqltest.c b/client/mysqltest.c
index aef36823dfc..dfaf48dd60e 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -949,7 +949,6 @@ static void do_exec(struct st_query* q)
while (fgets(buf, sizeof(buf), res_file))
replace_dynstr_append_mem(ds, buf, strlen(buf));
}
-
error= pclose(res_file);
if (error != 0)
@@ -3352,7 +3351,8 @@ static void init_var_hash(MYSQL *mysql)
my_hash_insert(&var_hash, (byte*) v);
v= var_init(0,"SERVER_VERSION", 0, mysql_get_server_info(mysql), 0);
my_hash_insert(&var_hash, (byte*) v);
-
+ v= var_init(0,"DB", 2, db, 0);
+ my_hash_insert(&var_hash, (byte*) v);
DBUG_VOID_RETURN;
}
@@ -4516,8 +4516,7 @@ static void get_replace_column(struct st_query *q)
my_free(start, MYF(0));
}
-#ifdef __NETWARE__
-
+#if defined(__NETWARE__) || defined(__WIN__)
/*
Substitute environment variables with text.
@@ -4613,4 +4612,4 @@ FILE *my_popen(const char *cmd, const char *mode __attribute__((unused)))
return res_file;
}
-#endif /* __NETWARE__ */
+#endif /* __NETWARE__ or __WIN__*/
diff --git a/configure.in b/configure.in
index 71adaa747f5..1fcba6b8f5f 100644
--- a/configure.in
+++ b/configure.in
@@ -480,7 +480,7 @@ if $PS p $$ 2> /dev/null | grep $0 > /dev/null
then
FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null"
# Solaris
-elif $PS -p $$ 2> /dev/null | grep $0 > /dev/null
+elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
then
FIND_PROC="$PS -p \$\$PID | grep mysqld > /dev/null"
# BSD style
@@ -3052,9 +3052,15 @@ AC_SUBST([NDB_DEFS])
AC_SUBST([ndb_cxxflags_fix])
+if test X"$ndb_port" = Xdefault
+then
+ ndb_port="1186"
+fi
+AC_SUBST([ndb_port])
+
if test X"$ndb_port_base" = Xdefault
then
- ndb_port_base="2200"
+ ndb_port_base="2202"
fi
AC_SUBST([ndb_port_base])
@@ -3093,7 +3099,6 @@ AC_CONFIG_FILES(ndb/Makefile ndb/include/Makefile dnl
ndb/src/common/logger/Makefile dnl
ndb/src/common/transporter/Makefile dnl
ndb/src/common/mgmcommon/Makefile dnl
- ndb/src/common/editline/Makefile dnl
ndb/src/kernel/Makefile dnl
ndb/src/kernel/error/Makefile dnl
ndb/src/kernel/blocks/Makefile dnl
@@ -3109,7 +3114,6 @@ AC_CONFIG_FILES(ndb/Makefile ndb/include/Makefile dnl
ndb/src/kernel/blocks/qmgr/Makefile dnl
ndb/src/kernel/blocks/trix/Makefile dnl
ndb/src/kernel/blocks/backup/Makefile dnl
- ndb/src/kernel/blocks/backup/restore/Makefile dnl
ndb/src/kernel/blocks/dbutil/Makefile dnl
ndb/src/kernel/blocks/suma/Makefile dnl
ndb/src/kernel/blocks/grep/Makefile dnl
@@ -3144,7 +3148,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
sql-common/Makefile SSL/Makefile dnl
dbug/Makefile scripts/Makefile dnl
include/Makefile sql-bench/Makefile tools/Makefile dnl
- tests/Makefile Docs/Makefile support-files/Makefile dnl
+ tests/Makefile Docs/Makefile Docs/Images/Makefile support-files/Makefile dnl
support-files/MacOSX/Makefile mysql-test/Makefile dnl
netware/Makefile dnl
include/mysql_version.h dnl
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 1796d883c5e..02175f8b091 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -227,14 +227,15 @@ static my_bool init_done = FALSE; /* Set to TRUE when initialization done */
static struct state *stack=0;
typedef struct st_code_state {
- int lineno; /* Current debugger output line number */
- int level; /* Current function nesting level */
const char *func; /* Name of current user function */
const char *file; /* Name of current user file */
char **framep; /* Pointer to current frame */
- int jmplevel; /* Remember nesting level at setjmp () */
const char *jmpfunc; /* Remember current function for setjmp */
const char *jmpfile; /* Remember current file for setjmp */
+ int lineno; /* Current debugger output line number */
+ int level; /* Current function nesting level */
+ int disable_output; /* Set to it if output is disabled */
+ int jmplevel; /* Remember nesting level at setjmp () */
/*
* The following variables are used to hold the state information
@@ -247,8 +248,8 @@ typedef struct st_code_state {
*/
uint u_line; /* User source code line number */
- const char *u_keyword; /* Keyword for current macro */
int locked; /* If locked with _db_lock_file */
+ const char *u_keyword; /* Keyword for current macro */
} CODE_STATE;
/* Parse a debug command string */
@@ -370,8 +371,10 @@ static CODE_STATE *code_state(void)
#define code_state() (&static_code_state)
#define pthread_mutex_lock(A) {}
#define pthread_mutex_unlock(A) {}
-static CODE_STATE static_code_state = { 0,0,"?func","?file",NULL,0,NULL,
- NULL,0,"?",0};
+static CODE_STATE static_code_state=
+{
+ "?func", "?file", NULL, NullS, NullS, 0,0,0,0,0,0, NullS
+};
#endif
@@ -728,9 +731,12 @@ char ***_sframep_ __attribute__((unused)))
if (DoProfile ())
{
long stackused;
- if (*state->framep == NULL) {
+ if (*state->framep == NULL)
+ {
stackused = 0;
- } else {
+ }
+ else
+ {
stackused = ((long)(*state->framep)) - ((long)(state->framep));
stackused = stackused > 0 ? stackused : -stackused;
}
@@ -744,7 +750,7 @@ char ***_sframep_ __attribute__((unused)))
(void) fflush (_db_pfp_);
}
#endif
- if (DoTrace (state))
+ if (DoTrace(state))
{
if (!state->locked)
pthread_mutex_lock(&THR_LOCK_dbug);
@@ -754,7 +760,7 @@ char ***_sframep_ __attribute__((unused)))
dbug_flush (state); /* This does a unlock */
}
#ifdef SAFEMALLOC
- if (stack -> flags & SANITY_CHECK_ON)
+ if (stack->flags & SANITY_CHECK_ON && !state->disable_output)
if (_sanity(_file_,_line_)) /* Check of safemalloc */
stack -> flags &= ~SANITY_CHECK_ON;
#endif
@@ -809,9 +815,11 @@ uint *_slevel_)
else
{
#ifdef SAFEMALLOC
- if (stack -> flags & SANITY_CHECK_ON)
+ if (stack->flags & SANITY_CHECK_ON && !state->disable_output)
+ {
if (_sanity(*_sfile_,_line_))
stack->flags &= ~SANITY_CHECK_ON;
+ }
#endif
#ifndef THREAD
if (DoProfile ())
@@ -954,7 +962,6 @@ uint length)
int pos;
char dbuff[90];
CODE_STATE *state;
- /* Sasha: pre-my_thread_init() safety */
if (!(state=code_state()))
return;
@@ -994,6 +1001,25 @@ uint length)
}
}
+
+/*
+ Enable/Disable output for this thread
+
+ SYNOPSIS
+ _db_output_()
+ flag 1 = enable output, 0 = disable_output
+
+*/
+
+void _db_output_(uint flag)
+{
+ CODE_STATE *state;
+ if (!(state=code_state()))
+ return;
+ state->disable_output= !flag;
+}
+
+
/*
* FUNCTION
*
@@ -1159,7 +1185,7 @@ static BOOLEAN DoTrace (CODE_STATE *state)
{
reg2 BOOLEAN trace=FALSE;
- if (TRACING &&
+ if (TRACING && !state->disable_output &&
state->level <= stack -> maxdepth &&
InList (stack -> functions, state->func) &&
InList (stack -> processes, _db_process_))
@@ -1195,7 +1221,7 @@ static BOOLEAN DoProfile ()
state=code_state();
profile = FALSE;
- if (PROFILING &&
+ if (PROFILING && !state->disable_output &&
state->level <= stack -> maxdepth &&
InList (stack -> p_functions, state->func) &&
InList (stack -> processes, _db_process_))
@@ -1242,7 +1268,7 @@ const char *keyword)
if (!(state=code_state()))
return FALSE;
result = FALSE;
- if (DEBUGGING &&
+ if (DEBUGGING && !state->disable_output &&
state->level <= stack -> maxdepth &&
InList (stack -> functions, state->func) &&
InList (stack -> keywords, keyword) &&
diff --git a/extra/perror.c b/extra/perror.c
index a28626fd873..1bd4b203120 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -69,7 +69,7 @@ static HA_ERRORS ha_errlist[]=
{
{ 120,"Didn't find key on read or update" },
{ 121,"Duplicate key on write or update" },
- { 123,"Someone has changed the row since it was read; Update with is recoverable" },
+ { 123,"Someone has changed the row since it was read (while the table was locked to prevent it)" },
{ 124,"Wrong index given to function" },
{ 126,"Index file is crashed" },
{ 127,"Record-file is crashed" },
diff --git a/heap/_check.c b/heap/_check.c
index 233cb8cb0c5..a745aee48bf 100644
--- a/heap/_check.c
+++ b/heap/_check.c
@@ -102,9 +102,11 @@ static int check_one_key(HP_KEYDEF *keydef, uint keynr, ulong records,
int error;
uint i,found,max_links,seek,links;
uint rec_link; /* Only used with debugging */
+ uint hash_buckets_found;
HASH_INFO *hash_info;
error=0;
+ hash_buckets_found= 0;
for (i=found=max_links=seek=0 ; i < records ; i++)
{
hash_info=hp_find_hash(&keydef->block,i);
@@ -128,21 +130,32 @@ static int check_one_key(HP_KEYDEF *keydef, uint keynr, ulong records,
found++;
}
if (links > max_links) max_links=links;
+ hash_buckets_found++;
}
}
if (found != records)
{
- DBUG_PRINT("error",("Found %ld of %ld records"));
+ DBUG_PRINT("error",("Found %ld of %ld records", found, records));
+ error=1;
+ }
+ if (keydef->hash_buckets != hash_buckets_found)
+ {
+ DBUG_PRINT("error",("Found %ld buckets, stats shows %ld buckets",
+ hash_buckets_found, keydef->hash_buckets));
error=1;
}
DBUG_PRINT("info",
- ("records: %ld seeks: %d max links: %d hitrate: %.2f",
+ ("records: %ld seeks: %d max links: %d hitrate: %.2f "
+ "buckets: %d",
records,seek,max_links,
- (float) seek / (float) (records ? records : 1)));
+ (float) seek / (float) (records ? records : 1),
+ hash_buckets_found));
if (print_status)
- printf("Key: %d records: %ld seeks: %d max links: %d hitrate: %.2f\n",
+ printf("Key: %d records: %ld seeks: %d max links: %d "
+ "hitrate: %.2f buckets: %d\n",
keynr, records, seek, max_links,
- (float) seek / (float) (records ? records : 1));
+ (float) seek / (float) (records ? records : 1),
+ hash_buckets_found);
return error;
}
diff --git a/heap/hp_block.c b/heap/hp_block.c
index 6a022fb3084..f26b208b521 100644
--- a/heap/hp_block.c
+++ b/heap/hp_block.c
@@ -18,12 +18,19 @@
#include "heapdef.h"
- /* Find record according to record-position */
+/*
+ Find record according to record-position.
+
+ The record is located by factoring position number pos into (p_0, p_1, ...)
+ such that
+ pos = SUM_i(block->level_info[i].records_under_level * p_i)
+ {p_0, p_1, ...} serve as indexes to descend the blocks tree.
+*/
byte *hp_find_block(HP_BLOCK *block, ulong pos)
{
reg1 int i;
- reg3 HP_PTRS *ptr;
+ reg3 HP_PTRS *ptr; /* block base ptr */
for (i=block->levels-1, ptr=block->root ; i > 0 ; i--)
{
@@ -34,8 +41,18 @@ byte *hp_find_block(HP_BLOCK *block, ulong pos)
}
- /* get one new block-of-records. Alloc ptr to block if neaded */
- /* Interrupts are stopped to allow ha_panic in interrupts */
+/*
+ Get one new block-of-records. Alloc ptr to block if needed
+ SYNOPSIS
+ hp_get_new_block()
+ block HP_BLOCK tree-like block
+ alloc_length OUT Amount of memory allocated from the heap
+
+ Interrupts are stopped to allow ha_panic in interrupts
+ RETURN
+ 0 OK
+ 1 Out of memory
+*/
int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length)
{
@@ -46,6 +63,18 @@ int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length)
if (block->level_info[i].free_ptrs_in_block)
break;
+ /*
+ Allocate space for leaf block plus space for upper level blocks up to
+ first level that has a free slot to put the pointer.
+ In some cases we actually allocate more then we need:
+ Consider e.g. a situation where we have one level 1 block and one level 0
+ block, the level 0 block is full and this function is called. We only
+ need a leaf block in this case. Nevertheless, we will get here with i=1
+ and will also allocate sizeof(HP_PTRS) for non-leaf block and will never
+ use this space.
+ This doesn't add much overhead - with current values of sizeof(HP_PTRS)
+ and my_default_record_cache_size we get about 1/128 unused memory.
+ */
*alloc_length=sizeof(HP_PTRS)*i+block->records_in_block* block->recbuffer;
if (!(root=(HP_PTRS*) my_malloc(*alloc_length,MYF(0))))
return 1;
@@ -60,21 +89,33 @@ int hp_get_new_block(HP_BLOCK *block, ulong *alloc_length)
dont_break(); /* Dont allow SIGHUP or SIGINT */
if ((uint) i == block->levels)
{
+ /* Adding a new level on top of the existing ones. */
block->levels=i+1;
+ /*
+ Use first allocated HP_PTRS as a top-level block. Put the current
+ block tree into the first slot of a new top-level block.
+ */
block->level_info[i].free_ptrs_in_block=HP_PTRS_IN_NOD-1;
((HP_PTRS**) root)[0]= block->root;
block->root=block->level_info[i].last_blocks= root++;
}
+ /* Occupy the free slot we've found at level i */
block->level_info[i].last_blocks->
blocks[HP_PTRS_IN_NOD - block->level_info[i].free_ptrs_in_block--]=
(byte*) root;
-
+
+ /* Add a block subtree with each node having one left-most child */
for (j=i-1 ; j >0 ; j--)
{
block->level_info[j].last_blocks= root++;
block->level_info[j].last_blocks->blocks[0]=(byte*) root;
block->level_info[j].free_ptrs_in_block=HP_PTRS_IN_NOD-1;
}
+
+ /*
+ root now points to last (block->records_in_block* block->recbuffer)
+ allocated bytes. Use it as a leaf block.
+ */
block->level_info[0].last_blocks= root;
allow_break(); /* Allow SIGHUP & SIGINT */
}
diff --git a/heap/hp_clear.c b/heap/hp_clear.c
index 4440344f990..596d71ebe9c 100644
--- a/heap/hp_clear.c
+++ b/heap/hp_clear.c
@@ -97,6 +97,7 @@ void hp_clear_keys(HP_SHARE *info)
VOID(hp_free_level(block,block->levels,block->root,(byte*) 0));
block->levels=0;
block->last_allocated=0;
+ keyinfo->hash_buckets= 0;
}
}
info->index_length=0;
diff --git a/heap/hp_create.c b/heap/hp_create.c
index 02725576c8f..d1783118c0d 100644
--- a/heap/hp_create.c
+++ b/heap/hp_create.c
@@ -128,6 +128,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
max_records);
keyinfo->delete_key= hp_delete_key;
keyinfo->write_key= hp_write_key;
+ keyinfo->hash_buckets= 0;
}
}
share->min_records= min_records;
diff --git a/heap/hp_delete.c b/heap/hp_delete.c
index c918cf37f05..9cf8b8936b6 100644
--- a/heap/hp_delete.c
+++ b/heap/hp_delete.c
@@ -97,8 +97,8 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
flag Is set if we want's to correct info->current_ptr
RETURN
- 0 ok
- # error number
+ 0 Ok
+ other Error code
*/
int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
@@ -151,6 +151,8 @@ int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
pos->ptr_to_rec=empty->ptr_to_rec;
pos->next_key=empty->next_key;
}
+ else
+ keyinfo->hash_buckets--;
if (empty == lastpos) /* deleted last hash key */
DBUG_RETURN (0);
@@ -187,7 +189,11 @@ int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
}
pos3= pos; /* Link pos->next after lastpos */
}
- else pos3= 0; /* Different positions merge */
+ else
+ {
+ pos3= 0; /* Different positions merge */
+ keyinfo->hash_buckets--;
+ }
empty[0]=lastpos[0];
hp_movelink(pos3, empty, pos->next_key);
diff --git a/heap/hp_hash.c b/heap/hp_hash.c
index b54e76d79fe..ee5b4958e62 100644
--- a/heap/hp_hash.c
+++ b/heap/hp_hash.c
@@ -196,7 +196,18 @@ byte *hp_search_next(HP_INFO *info, HP_KEYDEF *keyinfo, const byte *key,
}
- /* Calculate pos according to keys */
+/*
+ Calculate position number for hash value.
+ SYNOPSIS
+ hp_mask()
+ hashnr Hash value
+ buffmax Value such that
+ 2^(n-1) < maxlength <= 2^n = buffmax
+ maxlength
+
+ RETURN
+ Array index, in [0..maxlength)
+*/
ulong hp_mask(ulong hashnr, ulong buffmax, ulong maxlength)
{
@@ -205,7 +216,12 @@ ulong hp_mask(ulong hashnr, ulong buffmax, ulong maxlength)
}
- /* Change link from pos to new_link */
+/*
+ Change
+ next_link -> ... -> X -> pos
+ to
+ next_link -> ... -> X -> newlink
+*/
void hp_movelink(HASH_INFO *pos, HASH_INFO *next_link, HASH_INFO *newlink)
{
diff --git a/heap/hp_rfirst.c b/heap/hp_rfirst.c
index 1668376ed1c..85548fea212 100644
--- a/heap/hp_rfirst.c
+++ b/heap/hp_rfirst.c
@@ -52,6 +52,7 @@ int heap_rfirst(HP_INFO *info, byte *record, int inx)
my_errno=HA_ERR_END_OF_FILE;
DBUG_RETURN(my_errno);
}
+ DBUG_ASSERT(0); /* TODO fix it */
info->current_record=0;
info->current_hash_ptr=0;
info->update=HA_STATE_PREV_FOUND;
diff --git a/heap/hp_write.c b/heap/hp_write.c
index 3b0ec76d616..43cee67b39c 100644
--- a/heap/hp_write.c
+++ b/heap/hp_write.c
@@ -36,7 +36,6 @@ int heap_write(HP_INFO *info, const byte *record)
byte *pos;
HP_SHARE *share=info->s;
DBUG_ENTER("heap_write");
-
#ifndef DBUG_OFF
if (info->mode & O_RDONLY)
{
@@ -160,7 +159,31 @@ static byte *next_free_record_pos(HP_SHARE *info)
block_pos*info->block.recbuffer);
}
- /* Write a hash-key to the hash-index */
+
+/*
+ Write a hash-key to the hash-index
+ SYNOPSIS
+ info Heap table info
+ keyinfo Key info
+ record Table record to added
+ recpos Memory buffer where the table record will be stored if added
+ successfully
+ NOTE
+ Hash index uses HP_BLOCK structure as a 'growable array' of HASH_INFO
+ structs. Array size == number of entries in hash index.
+ hp_mask(hp_rec_hashnr()) maps hash entries values to hash array positions.
+ If there are several hash entries with the same hash array position P,
+ they are connected in a linked list via HASH_INFO::next_key. The first
+ list element is located at position P, next elements are located at
+ positions for which there is no record that should be located at that
+ position. The order of elements in the list is arbitrary.
+
+ RETURN
+ 0 - OK
+ -1 - Out of memory
+ HA_ERR_FOUND_DUPP_KEY - Duplicate record on unique key. The record was
+ still added and the caller must call hp_delete_key for it.
+*/
int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
const byte *record, byte *recpos)
@@ -180,19 +203,54 @@ int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
DBUG_RETURN(-1); /* No more memory */
halfbuff= (long) share->blength >> 1;
pos= hp_find_hash(&keyinfo->block,(first_index=share->records-halfbuff));
-
+
+ /*
+ We're about to add one more hash array position, with hash_mask=#records.
+ The number of hash positions will change and some entries might need to
+ be relocated to the newly added position. Those entries are currently
+ members of the list that starts at #first_index position (this is
+ guaranteed by properties of hp_mask(hp_rec_hashnr(X)) mapping function)
+ At #first_index position currently there may be either:
+ a) An entry with hashnr != first_index. We don't need to move it.
+ or
+ b) A list of items with hash_mask=first_index. The list contains entries
+ of 2 types:
+ 1) entries that should be relocated to the list that starts at new
+ position we're adding ('uppper' list)
+ 2) entries that should be left in the list starting at #first_index
+ position ('lower' list)
+ */
if (pos != empty) /* If some records */
{
do
{
hashnr = hp_rec_hashnr(keyinfo, pos->ptr_to_rec);
- if (flag == 0) /* First loop; Check if ok */
+ if (flag == 0)
+ {
+ /*
+ First loop, bail out if we're dealing with case a) from above
+ comment
+ */
if (hp_mask(hashnr, share->blength, share->records) != first_index)
break;
+ }
+ /*
+ flag & LOWFIND - found a record that should be put into lower position
+ flag & LOWUSED - lower position occupied by the record
+ Same for HIGHFIND and HIGHUSED and 'upper' position
+
+ gpos - ptr to last element in lower position's list
+ gpos2 - ptr to last element in upper position's list
+
+ ptr_to_rec - ptr to last entry that should go into lower list.
+ ptr_to_rec2 - same for upper list.
+ */
if (!(hashnr & halfbuff))
- { /* Key will not move */
+ {
+ /* Key should be put into 'lower' list */
if (!(flag & LOWFIND))
{
+ /* key is the first element to go into lower position */
if (flag & HIGHFIND)
{
flag=LOWFIND | HIGHFIND;
@@ -203,16 +261,21 @@ int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
}
else
{
- flag=LOWFIND | LOWUSED; /* key isn't changed */
+ /*
+ We can only get here at first iteration: key is at 'lower'
+ position pos and should be left here.
+ */
+ flag=LOWFIND | LOWUSED;
gpos=pos;
ptr_to_rec=pos->ptr_to_rec;
}
}
else
- {
+ {
+ /* Already have another key for lower position */
if (!(flag & LOWUSED))
{
- /* Change link of previous LOW-key */
+ /* Change link of previous lower-list key */
gpos->ptr_to_rec=ptr_to_rec;
gpos->next_key=pos;
flag= (flag & HIGHFIND) | (LOWFIND | LOWUSED);
@@ -222,19 +285,21 @@ int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
}
}
else
- { /* key will be moved */
+ {
+ /* key will be put into 'higher' list */
if (!(flag & HIGHFIND))
{
flag= (flag & LOWFIND) | HIGHFIND;
/* key shall be moved to the last (empty) position */
- gpos2 = empty; empty=pos;
+ gpos2= empty;
+ empty= pos;
ptr_to_rec2=pos->ptr_to_rec;
}
else
{
if (!(flag & HIGHUSED))
{
- /* Change link of previous hash-key and save */
+ /* Change link of previous upper-list key and save */
gpos2->ptr_to_rec=ptr_to_rec2;
gpos2->next_key=pos;
flag= (flag & LOWFIND) | (HIGHFIND | HIGHUSED);
@@ -245,6 +310,15 @@ int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
}
}
while ((pos=pos->next_key));
+
+ if ((flag & (LOWFIND | HIGHFIND)) == (LOWFIND | HIGHFIND))
+ {
+ /*
+ If both 'higher' and 'lower' list have at least one element, now
+ there are two hash buckets instead of one.
+ */
+ keyinfo->hash_buckets++;
+ }
if ((flag & (LOWFIND | LOWUSED)) == LOWFIND)
{
@@ -265,6 +339,7 @@ int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
{
pos->ptr_to_rec=recpos;
pos->next_key=0;
+ keyinfo->hash_buckets++;
}
else
{
@@ -280,6 +355,7 @@ int hp_write_key(HP_INFO *info, HP_KEYDEF *keyinfo,
}
else
{
+ keyinfo->hash_buckets++;
pos->ptr_to_rec=recpos;
pos->next_key=0;
hp_movelink(pos, gpos, empty);
diff --git a/include/config-win.h b/include/config-win.h
index d28bb25cd09..946a91d7d42 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -175,6 +175,8 @@ typedef uint rf_SetTimer;
#define sigset(A,B) signal((A),(B))
#define finite(A) _finite(A)
#define sleep(A) Sleep((A)*1000)
+#define popen(A) popen(A,B) _popen((A),(B))
+#define pclose(A) _pclose(A)
#ifndef __BORLANDC__
#define access(A,B) _access(A,B)
diff --git a/include/heap.h b/include/heap.h
index 63f2abbabc7..5e83a6e2cb5 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -63,18 +63,48 @@ typedef struct st_heap_ptrs
struct st_level_info
{
- uint free_ptrs_in_block,records_under_level;
- HP_PTRS *last_blocks; /* pointers to HP_PTRS or records */
+ /* Number of unused slots in *last_blocks HP_PTRS block (0 for 0th level) */
+ uint free_ptrs_in_block;
+
+ /*
+ Maximum number of records that can be 'contained' inside of each element
+ of last_blocks array. For level 0 - 1, for level 1 - HP_PTRS_IN_NOD, for
+ level 2 - HP_PTRS_IN_NOD^2 and so forth.
+ */
+ uint records_under_level;
+
+ /*
+ Ptr to last allocated HP_PTRS (or records buffer for level 0) on this
+ level.
+ */
+ HP_PTRS *last_blocks;
};
-typedef struct st_heap_block /* The data is saved in blocks */
+
+/*
+ Heap table records and hash index entries are stored in HP_BLOCKs.
+ HP_BLOCK is used as a 'growable array' of fixed-size records. Size of record
+ is recbuffer bytes.
+ The internal representation is as follows:
+ HP_BLOCK is a hierarchical structure of 'blocks'.
+ A block at level 0 is an array records_in_block records.
+ A block at higher level is an HP_PTRS structure with pointers to blocks at
+ lower levels.
+ At the highest level there is one top block. It is stored in HP_BLOCK::root.
+
+ See hp_find_block for a description of how record pointer is obtained from
+ its index.
+ See hp_get_new_block
+*/
+
+typedef struct st_heap_block
{
- HP_PTRS *root;
+ HP_PTRS *root; /* Top-level block */
struct st_level_info level_info[HP_MAX_LEVELS+1];
- uint levels;
- uint records_in_block; /* Records in a heap-block */
+ uint levels; /* number of used levels */
+ uint records_in_block; /* Records in one heap-block */
uint recbuffer; /* Length of one saved record */
- ulong last_allocated; /* Blocks allocated, used by keys */
+ ulong last_allocated; /* number of records there is allocated space for */
} HP_BLOCK;
struct st_heap_info; /* For referense */
@@ -87,6 +117,11 @@ typedef struct st_hp_keydef /* Key definition with open */
uint8 algorithm; /* HASH / BTREE */
HA_KEYSEG *seg;
HP_BLOCK block; /* Where keys are saved */
+ /*
+ Number of buckets used in hash table. Used only to provide
+ #records estimates for heap key scans.
+ */
+ ha_rows hash_buckets;
TREE rb_tree;
int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
const byte *record, byte *recpos);
@@ -102,7 +137,7 @@ typedef struct st_heap_share
ulong min_records,max_records; /* Params to open */
ulong data_length,index_length;
uint records; /* records */
- uint blength;
+ uint blength; /* records rounded up to 2^n */
uint deleted; /* Deleted records in database */
uint reclength; /* Length of one record */
uint changed;
diff --git a/include/m_ctype.h b/include/m_ctype.h
index ddc21070547..26e285b9683 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -63,7 +63,7 @@ typedef struct unicase_info_st
#define MY_CS_UNICODE 128 /* is a charset is full unicode */
#define MY_CS_READY 256 /* if a charset is initialized */
#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/
-
+#define MY_CS_CSSORT 1024 /* if case sensitive sort order */
#define MY_CHARSET_UNDEFINED 0
diff --git a/include/my_dbug.h b/include/my_dbug.h
index 9174a8b1ef9..711ece4335c 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -38,6 +38,7 @@ extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...));
extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
uint length);
+extern void _db_output_();
extern void _db_lock_file();
extern void _db_unlock_file();
@@ -66,6 +67,7 @@ extern void _db_unlock_file();
#define DEBUGGER_ON _no_db_=0
#define DBUG_LOCK_FILE { _db_lock_file(); }
#define DBUG_UNLOCK_FILE { _db_unlock_file(); }
+#define DBUG_OUTPUT(A) { _db_output_(A); }
#define DBUG_ASSERT(A) assert(A)
#else /* No debugger */
@@ -86,6 +88,7 @@ extern void _db_unlock_file();
#define DEBUGGER_ON
#define DBUG_LOCK_FILE
#define DBUG_UNLOCK_FILE
+#define DBUG_OUTPUT(A)
#define DBUG_ASSERT(A) {}
#endif
#ifdef __cplusplus
diff --git a/include/my_global.h b/include/my_global.h
index f6200830ee3..ff59f7bfc55 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -194,10 +194,10 @@ C_MODE_END
/* Fix problem when linking c++ programs with gcc 3.x */
#ifdef DEFINE_CXA_PURE_VIRTUAL
#define FIX_GCC_LINKING_PROBLEM \
-extern "C" { int __cxa_pure_virtual() {\
+C_MODE_START int __cxa_pure_virtual() {\
DBUG_ASSERT("Pure virtual method called." == "Aborted");\
return 0;\
-} }
+} C_MODE_END
#else
#define FIX_GCC_LINKING_PROBLEM
#endif
@@ -370,6 +370,12 @@ int __void__;
#define LINT_INIT(var)
#endif
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify)
+#define PURIFY_OR_LINT_INIT(var) var=0
+#else
+#define PURIFY_OR_LINT_INIT(var)
+#endif
+
/* Define some useful general macros */
#if defined(__cplusplus) && defined(__GNUC__)
#define max(a, b) ((a) >? (b))
diff --git a/include/my_sys.h b/include/my_sys.h
index 01a7482e4d0..a8e21ea2f98 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -214,6 +214,7 @@ extern ulong my_cache_w_requests, my_cache_write, my_cache_r_requests,
my_cache_read;
extern ulong my_blocks_used, my_blocks_changed;
extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
+extern uint mysys_usage_id;
extern my_bool my_init_done;
/* Point to current my_message() */
diff --git a/include/my_time.h b/include/my_time.h
index dab17904b2d..94701e159c4 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -58,14 +58,15 @@ void init_time(void);
my_time_t
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap);
-void set_zero_time(MYSQL_TIME *tm);
+void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
/*
Required buffer length for my_time_to_str, my_date_to_str,
my_datetime_to_str and TIME_to_string functions. Note, that the
caller is still responsible to check that given TIME structure
has values in valid ranges, otherwise size of the buffer could
- be not enough.
+ be not enough. We also rely on the fact that even wrong values
+ sent using binary protocol fit in this buffer.
*/
#define MAX_DATE_STRING_REP_LENGTH 30
diff --git a/include/mysql.h b/include/mysql.h
index 156d749234b..2c0197e2300 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -490,6 +490,8 @@ MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
const char *wild);
unsigned long STDCALL mysql_escape_string(char *to,const char *from,
unsigned long from_length);
+unsigned long STDCALL mysql_hex_string(char *to,const char *from,
+ unsigned long from_length);
unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
char *to,const char *from,
unsigned long length);
diff --git a/include/mysql_time.h b/include/mysql_time.h
index ec67d60dea5..5f4fc12c005 100644
--- a/include/mysql_time.h
+++ b/include/mysql_time.h
@@ -33,6 +33,18 @@ enum enum_mysql_timestamp_type
};
+/*
+ Structure which is used to represent datetime values inside MySQL.
+
+ We assume that values in this structure are normalized, i.e. year <= 9999,
+ month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions
+ in server such as my_system_gmt_sec() or make_time() family of functions
+ rely on this (actually now usage of make_*() family relies on a bit weaker
+ restriction). Also functions that produce MYSQL_TIME as result ensure this.
+ There is one exception to this rule though if this structure holds time
+ value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold
+ bigger values.
+*/
typedef struct st_mysql_time
{
unsigned int year, month, day, hour, minute, second;
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index bc08fc2437e..183c547ab2b 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -2266,8 +2266,8 @@ dict_foreign_add_to_cache(
/*************************************************************************
Scans from pointer onwards. Stops if is at the start of a copy of
-'string' where characters are compared without case sensitivity. Stops
-also at '\0'. */
+'string' where characters are compared without case sensitivity, and
+only outside `` or "" quotes. Stops also at '\0'. */
const char*
dict_scan_to(
@@ -2276,31 +2276,34 @@ dict_scan_to(
const char* ptr, /* in: scan from */
const char* string) /* in: look for this */
{
- ibool success;
- ulint i;
-loop:
- if (*ptr == '\0') {
- return(ptr);
- }
-
- success = TRUE;
-
- for (i = 0; i < ut_strlen(string); i++) {
- if (toupper((ulint)(ptr[i])) != toupper((ulint)(string[i]))) {
- success = FALSE;
+ char quote = '\0';
+ for (; *ptr; ptr++) {
+ if (*ptr == quote) {
+ /* Closing quote character: do not look for
+ starting quote or the keyword. */
+ quote = '\0';
+ } else if (quote) {
+ /* Within quotes: do nothing. */
+ } else if (*ptr == '`' || *ptr == '"') {
+ /* Starting quote: remember the quote character. */
+ quote = *ptr;
+ } else {
+ /* Outside quotes: look for the keyword. */
+ ulint i;
+ for (i = 0; string[i]; i++) {
+ if (toupper((ulint)(ptr[i]))
+ != toupper((ulint)(string[i]))) {
+ goto nomatch;
+ }
+ }
break;
+ nomatch:
+ ;
}
}
- if (success) {
-
- return(ptr);
- }
-
- ptr++;
-
- goto loop;
+ return(ptr);
}
/*************************************************************************
@@ -2877,13 +2880,13 @@ loop:
ut_a(success);
- if (!isspace(*ptr)) {
+ if (!isspace(*ptr) && *ptr != '"' && *ptr != '`') {
goto loop;
}
- do {
+ while (isspace(*ptr)) {
ptr++;
- } while (isspace(*ptr));
+ }
/* read constraint name unless got "CONSTRAINT FOREIGN" */
if (ptr != ptr2) {
diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c
index 7d57468f632..de528355182 100644
--- a/innobase/fil/fil0fil.c
+++ b/innobase/fil/fil0fil.c
@@ -106,7 +106,7 @@ struct fil_node_struct {
device or a raw disk partition */
ulint size; /* size of the file in database pages, 0 if
not known yet; the possible last incomplete
- megabyte is ignored if space == 0 */
+ megabyte may be ignored if space == 0 */
ulint n_pending;
/* count of pending i/o's on this file;
closing of the file is not allowed if
@@ -160,7 +160,9 @@ struct fil_space_struct {
UT_LIST_BASE_NODE_T(fil_node_t) chain;
/* base node for the file chain */
ulint size; /* space size in pages; 0 if a single-table
- tablespace whose size we do not know yet */
+ tablespace whose size we do not know yet;
+ last incomplete megabytes in data files may be
+ ignored if space == 0 */
ulint n_reserved_extents;
/* number of reserved free extents for
ongoing operations like B-tree page split */
@@ -3255,7 +3257,7 @@ fil_extend_space_to_desired_size(
ulint* actual_size, /* out: size of the space after extension;
if we ran out of disk space this may be lower
than the desired size */
- ulint space_id, /* in: space id, must be != 0 */
+ ulint space_id, /* in: space id */
ulint size_after_extend)/* in: desired size in pages after the
extension; if the current space size is bigger
than this already, the function does nothing */
@@ -3352,6 +3354,17 @@ fil_extend_space_to_desired_size(
fil_node_complete_io(node, system, OS_FILE_WRITE);
*actual_size = space->size;
+
+ if (space_id == 0) {
+ ulint pages_per_mb = (1024 * 1024) / UNIV_PAGE_SIZE;
+
+ /* Keep the last data file size info up to date, rounded to
+ full megabytes */
+
+ srv_data_file_sizes[srv_n_data_files - 1] =
+ (node->size / pages_per_mb) * pages_per_mb;
+ }
+
/*
printf("Extended %s to %lu, actual size %lu pages\n", space->name,
size_after_extend, *actual_size); */
diff --git a/innobase/include/dict0dict.ic b/innobase/include/dict0dict.ic
index 0f7cc8973db..85e4aaf1a05 100644
--- a/innobase/include/dict0dict.ic
+++ b/innobase/include/dict0dict.ic
@@ -342,13 +342,16 @@ dict_index_rec_get_sys_col(
ut_ad(len == 7);
return(trx_read_roll_ptr(field));
- } else if ((type == DATA_ROW_ID) || (type == DATA_MIX_ID)) {
+ } else if (type == DATA_TRX_ID) {
+
+ return(trx_read_trx_id(field));
+ } else if (type == DATA_MIX_ID) {
return(mach_dulint_read_compressed(field));
} else {
- ut_ad(type == DATA_TRX_ID);
+ ut_a(type == DATA_ROW_ID);
- return(trx_read_trx_id(field));
+ return(mach_read_from_6(field));
}
}
diff --git a/innobase/include/fil0fil.h b/innobase/include/fil0fil.h
index 5a5db77073a..43327aab9d2 100644
--- a/innobase/include/fil0fil.h
+++ b/innobase/include/fil0fil.h
@@ -478,7 +478,7 @@ fil_extend_space_to_desired_size(
ulint* actual_size, /* out: size of the space after extension;
if we ran out of disk space this may be lower
than the desired size */
- ulint space_id, /* in: space id, must be != 0 */
+ ulint space_id, /* in: space id */
ulint size_after_extend);/* in: desired size in pages after the
extension; if the current space size is bigger
than this already, the function does nothing */
diff --git a/innobase/include/lock0lock.h b/innobase/include/lock0lock.h
index 9f525042dcc..f8435e14d97 100644
--- a/innobase/include/lock0lock.h
+++ b/innobase/include/lock0lock.h
@@ -463,6 +463,14 @@ lock_rec_hash(
ulint space, /* in: space */
ulint page_no);/* in: page number */
/*************************************************************************
+Gets the table covered by an IX table lock. */
+
+dict_table_t*
+lock_get_ix_table(
+/*==============*/
+ /* out: the table covered by the lock */
+ lock_t* lock); /* in: table lock */
+/*************************************************************************
Checks that a transaction id is sensible, i.e., not in the future. */
ibool
diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h
index 9437ed4b6ee..73f41dea0da 100644
--- a/innobase/include/row0mysql.h
+++ b/innobase/include/row0mysql.h
@@ -175,8 +175,12 @@ int
row_lock_table_for_mysql(
/*=====================*/
/* out: error code or DB_SUCCESS */
- row_prebuilt_t* prebuilt); /* in: prebuilt struct in the MySQL
+ row_prebuilt_t* prebuilt, /* in: prebuilt struct in the MySQL
table handle */
+ dict_table_t* table); /* in: table to LOCK_IX, or NULL
+ if prebuilt->table should be
+ locked as LOCK_TABLE_EXP |
+ prebuilt->select_lock_type */
/*************************************************************************
Does an insert for MySQL. */
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 68073647248..78a78c9dd95 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -395,6 +395,19 @@ lock_rec_get_nth_bit(
return(ut_bit_get_nth(b, bit_index));
}
+/*************************************************************************
+Gets the table covered by an IX table lock. */
+
+dict_table_t*
+lock_get_ix_table(
+/*==============*/
+ /* out: the table covered by the lock */
+ lock_t* lock) /* in: table lock */
+{
+ ut_a(lock->type_mode == (LOCK_TABLE | LOCK_IX));
+ return(lock->un_member.tab_lock.table);
+}
+
/*************************************************************************/
#define lock_mutex_enter_kernel() mutex_enter(&kernel_mutex)
@@ -4051,6 +4064,9 @@ lock_print_info(
(ulong) ut_dulint_get_low(purge_sys->purge_undo_no));
fprintf(file,
+ "History list length %lu\n", (ulong) trx_sys->rseg_history_len);
+
+ fprintf(file,
"Total number of lock structs in row lock hash table %lu\n",
(ulong) lock_get_n_rec_locks());
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index c45818ddd26..6d1482b6720 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -1509,7 +1509,6 @@ row_ins_scan_sec_index_for_duplicate(
ibool moved;
mtr_t mtr;
trx_t* trx;
- const char* ptr;
n_unique = dict_index_get_n_unique(index);
@@ -1630,7 +1629,6 @@ row_ins_duplicate_error_in_clust(
page_t* page;
ulint n_unique;
trx_t* trx = thr_get_trx(thr);
- const char* ptr;
UT_NOT_USED(mtr);
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index f356ef8081e..17747ae2a8e 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -779,8 +779,12 @@ int
row_lock_table_for_mysql(
/*=====================*/
/* out: error code or DB_SUCCESS */
- row_prebuilt_t* prebuilt) /* in: prebuilt struct in the MySQL
+ row_prebuilt_t* prebuilt, /* in: prebuilt struct in the MySQL
table handle */
+ dict_table_t* table) /* in: table to LOCK_IX, or NULL
+ if prebuilt->table should be
+ locked as LOCK_TABLE_EXP |
+ prebuilt->select_lock_type */
{
trx_t* trx = prebuilt->trx;
que_thr_t* thr;
@@ -813,8 +817,12 @@ run_again:
trx_start_if_not_started(trx);
- err = lock_table(LOCK_TABLE_EXP, prebuilt->table,
- prebuilt->select_lock_type, thr);
+ if (table) {
+ err = lock_table(0, table, LOCK_IX, thr);
+ } else {
+ err = lock_table(LOCK_TABLE_EXP, prebuilt->table,
+ prebuilt->select_lock_type, thr);
+ }
trx->error_state = err;
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index 740241fa210..5b7d068d0c1 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -638,23 +638,24 @@ row_sel_get_clust_rec(
if (!node->read_view) {
/* Try to place a lock on the index record */
- /* If innodb_locks_unsafe_for_binlog option is used,
- we lock only the record, i.e. next-key locking is
- not used.
- */
- if ( srv_locks_unsafe_for_binlog )
- {
- err = lock_clust_rec_read_check_and_lock(0, clust_rec,
- index,node->row_lock_mode, LOCK_REC_NOT_GAP, thr);
- }
- else
- {
- err = lock_clust_rec_read_check_and_lock(0, clust_rec, index,
- node->row_lock_mode, LOCK_ORDINARY, thr);
-
- }
-
- if (err != DB_SUCCESS) {
+ /* If innodb_locks_unsafe_for_binlog option is used,
+ we lock only the record, i.e. next-key locking is
+ not used.
+ */
+
+ if (srv_locks_unsafe_for_binlog) {
+ err = lock_clust_rec_read_check_and_lock(0,
+ clust_rec,
+ index, node->row_lock_mode,
+ LOCK_REC_NOT_GAP, thr);
+ } else {
+ err = lock_clust_rec_read_check_and_lock(0,
+ clust_rec,
+ index, node->row_lock_mode,
+ LOCK_ORDINARY, thr);
+ }
+
+ if (err != DB_SUCCESS) {
return(err);
}
@@ -1205,22 +1206,24 @@ rec_loop:
if (!consistent_read) {
- /* If innodb_locks_unsafe_for_binlog option is used,
- we lock only the record, i.e. next-key locking is
- not used.
- */
-
- if ( srv_locks_unsafe_for_binlog )
- {
- err = sel_set_rec_lock(page_rec_get_next(rec), index,
- node->row_lock_mode, LOCK_REC_NOT_GAP, thr);
- }
- else
- {
- err = sel_set_rec_lock(page_rec_get_next(rec), index,
- node->row_lock_mode, LOCK_ORDINARY, thr);
- }
- if (err != DB_SUCCESS) {
+ /* If innodb_locks_unsafe_for_binlog option is used,
+ we lock only the record, i.e. next-key locking is
+ not used.
+ */
+
+ if (srv_locks_unsafe_for_binlog) {
+ err = sel_set_rec_lock(page_rec_get_next(rec),
+ index,
+ node->row_lock_mode,
+ LOCK_REC_NOT_GAP, thr);
+ } else {
+ err = sel_set_rec_lock(page_rec_get_next(rec),
+ index,
+ node->row_lock_mode,
+ LOCK_ORDINARY, thr);
+ }
+
+ if (err != DB_SUCCESS) {
/* Note that in this case we will store in pcur
the PREDECESSOR of the record we are waiting
the lock for */
@@ -1245,21 +1248,18 @@ rec_loop:
if (!consistent_read) {
/* Try to place a lock on the index record */
- /* If innodb_locks_unsafe_for_binlog option is used,
- we lock only the record, i.e. next-key locking is
- not used.
- */
+ /* If innodb_locks_unsafe_for_binlog option is used,
+ we lock only the record, i.e. next-key locking is
+ not used.
+ */
- if ( srv_locks_unsafe_for_binlog )
- {
- err = sel_set_rec_lock(rec, index, node->row_lock_mode,
+ if (srv_locks_unsafe_for_binlog) {
+ err = sel_set_rec_lock(rec, index, node->row_lock_mode,
LOCK_REC_NOT_GAP, thr);
- }
- else
- {
- err = sel_set_rec_lock(rec, index, node->row_lock_mode,
+ } else {
+ err = sel_set_rec_lock(rec, index, node->row_lock_mode,
LOCK_ORDINARY, thr);
- }
+ }
if (err != DB_SUCCESS) {
@@ -3209,8 +3209,7 @@ rec_loop:
we do not lock gaps. Supremum record is really
a gap and therefore we do not set locks there. */
- if ( srv_locks_unsafe_for_binlog == FALSE )
- {
+ if (srv_locks_unsafe_for_binlog == FALSE) {
err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type,
LOCK_ORDINARY, thr);
@@ -3312,11 +3311,18 @@ rec_loop:
if (prebuilt->select_lock_type != LOCK_NONE
&& set_also_gap_locks) {
- /* Try to place a lock on the index record */
- err = sel_set_rec_lock(rec, index,
+ /* Try to place a gap lock on the index
+ record only if innodb_locks_unsafe_for_binlog
+ option is not set */
+
+ if (srv_locks_unsafe_for_binlog == FALSE) {
+
+ err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type,
LOCK_GAP, thr);
+ }
+
if (err != DB_SUCCESS) {
goto lock_wait_or_error;
@@ -3338,11 +3344,18 @@ rec_loop:
if (prebuilt->select_lock_type != LOCK_NONE
&& set_also_gap_locks) {
- /* Try to place a lock on the index record */
- err = sel_set_rec_lock(rec, index,
+ /* Try to place a gap lock on the index
+ record only if innodb_locks_unsafe_for_binlog
+ option is not set */
+
+ if (srv_locks_unsafe_for_binlog == FALSE) {
+
+ err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type,
LOCK_GAP, thr);
+ }
+
if (err != DB_SUCCESS) {
goto lock_wait_or_error;
@@ -3376,19 +3389,16 @@ rec_loop:
prebuilt->select_lock_type,
LOCK_REC_NOT_GAP, thr);
} else {
- /* If innodb_locks_unsafe_for_binlog option is used,
- we lock only the record, i.e. next-key locking is
- not used.
- */
- if ( srv_locks_unsafe_for_binlog )
- {
- err = sel_set_rec_lock(rec, index,
+ /* If innodb_locks_unsafe_for_binlog option is used,
+ we lock only the record, i.e. next-key locking is
+ not used. */
+
+ if (srv_locks_unsafe_for_binlog) {
+ err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type,
LOCK_REC_NOT_GAP, thr);
- }
- else
- {
- err = sel_set_rec_lock(rec, index,
+ } else {
+ err = sel_set_rec_lock(rec, index,
prebuilt->select_lock_type,
LOCK_ORDINARY, thr);
}
diff --git a/innobase/trx/trx0purge.c b/innobase/trx/trx0purge.c
index 6726d7ca609..3df34111281 100644
--- a/innobase/trx/trx0purge.c
+++ b/innobase/trx/trx0purge.c
@@ -289,7 +289,7 @@ trx_purge_add_update_undo_to_history(
flst_get_len(seg_header + TRX_UNDO_PAGE_LIST, mtr));
mlog_write_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
- hist_size + undo->size, MLOG_4BYTES, mtr);
+ hist_size + undo->size, MLOG_4BYTES, mtr);
}
/* Add the log as the first in the history list */
@@ -646,6 +646,27 @@ trx_purge_rseg_get_next_history_log(
mutex_exit(&(rseg->mutex));
mtr_commit(&mtr);
+ mutex_enter(&kernel_mutex);
+
+ /* Add debug code to track history list corruption reported
+ on the MySQL mailing list on Nov 9, 2004. The fut0lst.c
+ file-based list was corrupt. The prev node pointer was
+ FIL_NULL, even though the list length was over 8 million nodes!
+ We assume that purge truncates the history list in moderate
+ size pieces, and if we here reach the head of the list, the
+ list cannot be longer than 20 000 undo logs now. */
+
+ if (trx_sys->rseg_history_len > 20000) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+" InnoDB: Warning: purge reached the head of the history list,\n"
+"InnoDB: but its length is still reported as %lu! Make a detailed bug\n"
+"InnoDB: report, and post it to bugs.mysql.com\n",
+ (ulong)trx_sys->rseg_history_len);
+ }
+
+ mutex_exit(&kernel_mutex);
+
return;
}
@@ -1069,30 +1090,6 @@ trx_purge(void)
}
}
- /* Determine how much data manipulation language (DML) statements
- need to be delayed in order to reduce the lagging of the purge
- thread. */
- srv_dml_needed_delay = 0; /* in microseconds; default: no delay */
-
- /* If we cannot advance the 'purge view' because of an old
- 'consistent read view', then the DML statements cannot be delayed.
- Also, srv_max_purge_lag <= 0 means 'infinity'. */
- if (srv_max_purge_lag > 0
- && !UT_LIST_GET_LAST(trx_sys->view_list)) {
- float ratio = (float) trx_sys->rseg_history_len
- / srv_max_purge_lag;
- if (ratio > ULINT_MAX / 10000) {
- /* Avoid overflow: maximum delay is 4295 seconds */
- srv_dml_needed_delay = ULINT_MAX;
- } else if (ratio > 1) {
- /* If the history list length exceeds the
- innodb_max_purge_lag, the
- data manipulation statements are delayed
- by at least 5000 microseconds. */
- srv_dml_needed_delay = (ulint) ((ratio - .5) * 10000);
- }
- }
-
purge_sys->view = read_view_oldest_copy_or_open_new(NULL,
purge_sys->heap);
mutex_exit(&kernel_mutex);
diff --git a/innobase/trx/trx0undo.c b/innobase/trx/trx0undo.c
index c1edc223cbc..8d1518753dd 100644
--- a/innobase/trx/trx0undo.c
+++ b/innobase/trx/trx0undo.c
@@ -1241,7 +1241,7 @@ trx_undo_lists_init(
if (page_no != FIL_NULL
&& srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN) {
-
+
undo = trx_undo_mem_create_at_db_start(rseg, i,
page_no, &mtr);
size += undo->size;
diff --git a/libmysql/Makefile.am b/libmysql/Makefile.am
index 5c2dc9c7ba6..72ff44ecef3 100644
--- a/libmysql/Makefile.am
+++ b/libmysql/Makefile.am
@@ -30,7 +30,7 @@ include $(srcdir)/Makefile.shared
libmysqlclient_la_SOURCES = $(target_sources)
libmysqlclient_la_LIBADD = $(target_libadd)
libmysqlclient_la_LDFLAGS = $(target_ldflags)
-EXTRA_DIST = Makefile.shared
+EXTRA_DIST = Makefile.shared libmysql.def
noinst_HEADERS = client_settings.h
# This is called from the toplevel makefile
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 88f46ce19e7..cb20c5181a8 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1563,7 +1563,8 @@ void my_net_local_init(NET *net)
trailing '. The caller must supply whichever of those is desired.
*/
-ulong mysql_hex_string(char *to, const char *from, ulong length)
+ulong STDCALL
+mysql_hex_string(char *to, const char *from, ulong length)
{
char *to0= to;
const char *end;
@@ -3256,11 +3257,12 @@ static void read_binary_time(MYSQL_TIME *tm, uchar **pos)
tm->hour+= tm->day*24;
tm->day= 0;
}
+ tm->time_type= MYSQL_TIMESTAMP_TIME;
+
*pos+= length;
}
else
- set_zero_time(tm);
- tm->time_type= MYSQL_TIMESTAMP_TIME;
+ set_zero_time(tm, MYSQL_TIMESTAMP_TIME);
}
static void read_binary_datetime(MYSQL_TIME *tm, uchar **pos)
@@ -3285,12 +3287,12 @@ static void read_binary_datetime(MYSQL_TIME *tm, uchar **pos)
else
tm->hour= tm->minute= tm->second= 0;
tm->second_part= (length > 7) ? (ulong) sint4korr(to+7) : 0;
+ tm->time_type= MYSQL_TIMESTAMP_DATETIME;
*pos+= length;
}
else
- set_zero_time(tm);
- tm->time_type= MYSQL_TIMESTAMP_DATETIME;
+ set_zero_time(tm, MYSQL_TIMESTAMP_DATETIME);
}
static void read_binary_date(MYSQL_TIME *tm, uchar **pos)
@@ -3307,12 +3309,12 @@ static void read_binary_date(MYSQL_TIME *tm, uchar **pos)
tm->hour= tm->minute= tm->second= 0;
tm->second_part= 0;
tm->neg= 0;
+ tm->time_type= MYSQL_TIMESTAMP_DATE;
*pos+= length;
}
else
- set_zero_time(tm);
- tm->time_type= MYSQL_TIMESTAMP_DATE;
+ set_zero_time(tm, MYSQL_TIMESTAMP_DATE);
}
diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def
index bc91e90a41c..c9ff70f208d 100644
--- a/libmysql/libmysql.def
+++ b/libmysql/libmysql.def
@@ -47,6 +47,7 @@ EXPORTS
mysql_errno
mysql_error
mysql_escape_string
+ mysql_hex_string
mysql_stmt_execute
mysql_stmt_fetch
mysql_stmt_fetch_column
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c
index 196cb5c21fb..c432ac5a16c 100644
--- a/myisam/ft_boolean_search.c
+++ b/myisam/ft_boolean_search.c
@@ -164,9 +164,9 @@ static void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
if (param.trunc) ftbw->flags|=FTB_FLAG_TRUNC;
ftbw->weight=weight;
ftbw->up=up;
- ftbw->docid[0]=ftbw->docid[1]=HA_POS_ERROR;
+ ftbw->docid[0]=ftbw->docid[1]=HA_OFFSET_ERROR;
ftbw->ndepth= (param.yesno<0) + depth;
- ftbw->key_root=HA_POS_ERROR;
+ ftbw->key_root=HA_OFFSET_ERROR;
memcpy(ftbw->word+1, w.pos, w.len);
ftbw->word[0]=w.len;
if (param.yesno > 0) up->ythresh++;
@@ -181,7 +181,7 @@ static void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
ftbe->weight=weight;
ftbe->up=up;
ftbe->ythresh=ftbe->yweaks=0;
- ftbe->docid[0]=ftbe->docid[1]=HA_POS_ERROR;
+ ftbe->docid[0]=ftbe->docid[1]=HA_OFFSET_ERROR;
if ((ftbe->quot=param.quot)) ftb->with_scan|=2;
if (param.yesno > 0) up->ythresh++;
_ftb_parse_query(ftb, start, end, ftbe, depth+1);
@@ -259,7 +259,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
{
if (!ftbw->off || !(ftbw->flags & FTB_FLAG_TRUNC))
{
- ftbw->docid[0]=HA_POS_ERROR;
+ ftbw->docid[0]=HA_OFFSET_ERROR;
if ((ftbw->flags & FTB_FLAG_YES) && ftbw->up->up==0)
{
/*
@@ -346,9 +346,9 @@ static void _ftb_init_index_search(FT_INFO *ftb)
ftbe->up->ythresh - ftbe->up->yweaks >1) /* 1 */
{
FTB_EXPR *top_ftbe=ftbe->up->up;
- ftbw->docid[0]=HA_POS_ERROR;
+ ftbw->docid[0]=HA_OFFSET_ERROR;
for (ftbe=ftbw->up; ftbe != top_ftbe; ftbe=ftbe->up)
- if (ftbe->flags & FTB_FLAG_YES)
+ if (!(ftbe->flags & FTB_FLAG_NO))
ftbe->yweaks++;
ftbe=0;
break;
@@ -356,7 +356,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
}
if (!ftbe)
continue;
- /* 3 */
+ /* 4 */
if (!is_tree_inited(& ftb->no_dupes))
init_tree(& ftb->no_dupes,0,0,sizeof(my_off_t),
_ftb_no_dupes_cmp,0,0,0);
@@ -387,7 +387,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
ftb->charset= ((keynr==NO_SUCH_KEY) ?
default_charset_info : info->s->keyinfo[keynr].seg->charset);
ftb->with_scan=0;
- ftb->lastpos=HA_POS_ERROR;
+ ftb->lastpos=HA_OFFSET_ERROR;
bzero(& ftb->no_dupes, sizeof(TREE));
init_alloc_root(&ftb->mem_root, 1024, 1024);
@@ -410,7 +410,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
ftbe->quot=0;
ftbe->up=0;
ftbe->ythresh=ftbe->yweaks=0;
- ftbe->docid[0]=ftbe->docid[1]=HA_POS_ERROR;
+ ftbe->docid[0]=ftbe->docid[1]=HA_OFFSET_ERROR;
ftb->root=ftbe;
_ftb_parse_query(ftb, &query, query+query_len, ftbe, 0);
ftb->list=(FTB_WORD **)alloc_root(&ftb->mem_root,
@@ -561,7 +561,7 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
while (ftb->state == INDEX_SEARCH &&
(curdoc=((FTB_WORD *)queue_top(& ftb->queue))->docid[0]) !=
- HA_POS_ERROR)
+ HA_OFFSET_ERROR)
{
while (curdoc == (ftbw=(FTB_WORD *)queue_top(& ftb->queue))->docid[0])
{
@@ -615,7 +615,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
const byte *end;
my_off_t docid=ftb->info->lastpos;
- if (docid == HA_POS_ERROR)
+ if (docid == HA_OFFSET_ERROR)
return -2.0;
if (!ftb->queue.elements)
return 0;
@@ -627,9 +627,9 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
for (i=0; i < ftb->queue.elements; i++)
{
- ftb->list[i]->docid[1]=HA_POS_ERROR;
+ ftb->list[i]->docid[1]=HA_OFFSET_ERROR;
for (x=ftb->list[i]->up; x; x=x->up)
- x->docid[1]=HA_POS_ERROR;
+ x->docid[1]=HA_OFFSET_ERROR;
}
}
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 1df518a2712..2999482549c 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -656,6 +656,15 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
if (chk_index_down(param,info,&info->s->ft2_keyinfo,record,
temp_buff,&tmp_keys,key_checksum,1))
goto err;
+ if (tmp_keys + subkeys)
+ {
+ mi_check_print_error(param,
+ "Number of words in the 2nd level tree "
+ "does not match the number in the header. "
+ "Parent word in on the page %s, offset %u",
+ llstr(page,llbuff), (uint) (old_keypos-buff));
+ goto err;
+ }
(*keys)+=tmp_keys-1;
continue;
}
diff --git a/myisam/mi_write.c b/myisam/mi_write.c
index dc596672a84..e059bbb569f 100644
--- a/myisam/mi_write.c
+++ b/myisam/mi_write.c
@@ -372,6 +372,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
/* popular word. two-level tree. going down */
my_off_t root=info->dupp_key_pos;
keyinfo=&info->s->ft2_keyinfo;
+ get_key_full_length_rdonly(off, key);
key+=off;
keypos-=keyinfo->keylength+nod_flag; /* we'll modify key entry 'in vivo' */
error=_mi_ck_real_write_btree(info, keyinfo, key, 0,
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index c3f9eea875d..c4b3fae40f9 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -36,12 +36,19 @@ test_SCRIPTS = mysql-test-run install_test_db
test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem
CLEANFILES = $(test_SCRIPTS) $(test_DATA)
+INCLUDES = -I$(srcdir)/../include -I../include -I..
+EXTRA_PROGRAMS = mysql_test_run_new
+noinst_HEADERS = my_manage.h
+mysql_test_run_new_SOURCES= mysql_test_run_new.c my_manage.c
+
+
dist-hook:
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
$(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
+ $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
@@ -64,6 +71,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
std_data/%.pem:
diff --git a/mysql-test/include/ctype_common.inc b/mysql-test/include/ctype_common.inc
new file mode 100644
index 00000000000..77937bdb854
--- /dev/null
+++ b/mysql-test/include/ctype_common.inc
@@ -0,0 +1,56 @@
+#
+# Common tests for all character sets and collations.
+# Include this file from a test with @test_characrer_set
+# and @test_collation set to desired values.
+#
+# Please don't use SHOW CREATE TABLE in this file,
+# we want it to be HANDLER independent. You can
+# use SHOW FULL COLUMNS instead.
+#
+# Please surround all CREATE TABLE with --disable_warnings
+# and --enable_warnings to be able to set storage_engine
+# without having to check if the hanlder exists.
+
+SET @safe_character_set_server= @@character_set_server;
+SET @safe_collation_server= @@collation_server;
+SET character_set_server= @test_character_set;
+SET collation_server= @test_collation;
+CREATE DATABASE d1;
+USE d1;
+
+#
+# Bug 1883: LIKE did not work in some cases with a key.
+#
+--disable_warnings
+CREATE TABLE t1 (c CHAR(10), KEY(c));
+--enable_warnings
+# check the column was created with the expected charset/collation
+SHOW FULL COLUMNS FROM t1;
+INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
+SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
+DROP TABLE t1;
+
+#
+# Bug 6643 incorrect response with partial utf8 index
+#
+--disable_warnings
+CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
+--enable_warnings
+# check the column was created with the expected charset/collation
+SHOW FULL COLUMNS FROM t1;
+INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
+SELECT c1 as want3results from t1 where c1 like 'l%';
+SELECT c1 as want3results from t1 where c1 like 'lo%';
+SELECT c1 as want1result from t1 where c1 like 'loc%';
+SELECT c1 as want1result from t1 where c1 like 'loca%';
+SELECT c1 as want1result from t1 where c1 like 'locat%';
+SELECT c1 as want1result from t1 where c1 like 'locati%';
+SELECT c1 as want1result from t1 where c1 like 'locatio%';
+SELECT c1 as want1result from t1 where c1 like 'location%';
+DROP TABLE t1;
+
+DROP DATABASE d1;
+# Restore settings
+USE test;
+SET character_set_server= @safe_character_set_server;
+SET collation_server= @safe_collation_server;
diff --git a/mysql-test/init_db.sql b/mysql-test/init_db.sql
new file mode 100644
index 00000000000..63483af00d6
--- /dev/null
+++ b/mysql-test/init_db.sql
@@ -0,0 +1,58 @@
+CREATE DATABASE mysql;
+CREATE DATABASE test;
+
+USE mysql;
+
+
+CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db,User),KEY User (User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
+
+INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+
+
+CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
+
+CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Password char(41) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,File_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,ssl_cipher BLOB NOT NULL,x509_issuer BLOB NOT NULL,x509_subject BLOB NOT NULL,max_questions int(11) unsigned DEFAULT 0 NOT NULL,max_updates int(11) unsigned DEFAULT 0 NOT NULL,max_connections int(11) unsigned DEFAULT 0 NOT NULL,PRIMARY KEY Host (Host,User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+
+INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0);
+
+CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL,ret tinyint(1) DEFAULT '0' NOT NULL,dl char(128) DEFAULT '' NOT NULL,type enum ('function','aggregate') NOT NULL,PRIMARY KEY (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
+
+CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Grantor char(77) DEFAULT '' NOT NULL,Timestamp timestamp(14),Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name),KEY Grantor (Grantor)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
+
+CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Column_name char(64) binary DEFAULT '' NOT NULL,Timestamp timestamp(14),Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name,Column_name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
+
+CREATE TABLE help_topic (help_topic_id int unsigned not null,name varchar(64) not null,help_category_id smallint unsigned not null,description text not null,example text not null,url varchar(128) not null,primary key (help_topic_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help topics';
+
+CREATE TABLE help_category (help_category_id smallint unsigned not null,name varchar(64) not null,parent_category_id smallint unsigned null,url varchar(128) not null,primary key (help_category_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help categories';
+
+CREATE TABLE help_keyword (help_keyword_id int unsigned not null,name varchar(64) not null,primary key (help_keyword_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
+
+CREATE TABLE help_relation (help_topic_id int unsigned not null references help_topic,help_keyword_id int unsigned not null references help_keyword,primary key (help_keyword_id, help_topic_id)) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
+
+CREATE TABLE time_zone_name (Name char(64) NOT NULL,Time_zone_id int unsigned NOT NULL,PRIMARY KEY Name (Name)) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
+
+INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES ('MET', 1), ('UTC', 2), ('Universal', 2), ('Europe/Moscow',3), ('leap/Europe/Moscow',4), ('Japan', 5);
+
+
+CREATE TABLE time_zone (Time_zone_id int unsigned NOT NULL auto_increment,Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,PRIMARY KEY TzId (Time_zone_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
+
+INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');
+
+
+CREATE TABLE time_zone_transition (Time_zone_id int unsigned NOT NULL,Transition_time bigint signed NOT NULL,Transition_type_id int unsigned NOT NULL,PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
+
+INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES (1, -1693706400, 0) ,(1, -1680483600, 1),(1, -1663455600, 2) ,(1, -1650150000, 3),(1, -1632006000, 2) ,(1, -1618700400, 3),(1, -938905200, 2) ,(1, -857257200, 3),(1, -844556400, 2) ,(1, -828226800, 3),(1, -812502000, 2) ,(1, -796777200, 3),(1, 228877200, 2) ,(1, 243997200, 3),(1, 260326800, 2) ,(1, 276051600, 3),(1, 291776400, 2) ,(1, 307501200, 3),(1, 323830800, 2) ,(1, 338950800, 3),(1, 354675600, 2) ,(1, 370400400, 3),(1, 386125200, 2) ,(1, 401850000, 3),(1, 417574800, 2) ,(1, 433299600, 3),(1, 449024400, 2) ,(1, 465354000, 3),(1, 481078800, 2) ,(1, 496803600, 3),(1, 512528400, 2) ,(1, 528253200, 3),(1, 543978000, 2) ,(1, 559702800, 3),(1, 575427600, 2) ,(1, 591152400, 3),(1, 606877200, 2) ,(1, 622602000, 3),(1, 638326800, 2) ,(1, 654656400, 3),(1, 670381200, 2) ,(1, 686106000, 3),(1, 701830800, 2) ,(1, 717555600, 3),(1, 733280400, 2) ,(1, 749005200, 3),(1, 764730000, 2) ,(1, 780454800, 3),(1, 796179600, 2) ,(1, 811904400, 3),(1, 828234000, 2) ,(1, 846378000, 3),(1, 859683600, 2) ,(1, 877827600, 3),(1, 891133200, 2) ,(1, 909277200, 3),(1, 922582800, 2) ,(1, 941331600, 3),(1, 954032400, 2) ,(1, 972781200, 3),(1, 985482000, 2) ,(1, 1004230800, 3),(1, 1017536400, 2) ,(1, 1035680400, 3),(1, 1048986000, 2) ,(1, 1067130000, 3),(1, 1080435600, 2) ,(1, 1099184400, 3),(1, 1111885200, 2) ,(1, 1130634000, 3),(1, 1143334800, 2) ,(1, 1162083600, 3),(1, 1174784400, 2) ,(1, 1193533200, 3),(1, 1206838800, 2) ,(1, 1224982800, 3),(1, 1238288400, 2) ,(1, 1256432400, 3),(1, 1269738000, 2) ,(1, 1288486800, 3),(1, 1301187600, 2) ,(1, 1319936400, 3),(1, 1332637200, 2) ,(1, 1351386000, 3),(1, 1364691600, 2) ,(1, 1382835600, 3),(1, 1396141200, 2) ,(1, 1414285200, 3),(1, 1427590800, 2) ,(1, 1445734800, 3),(1, 1459040400, 2) ,(1, 1477789200, 3),(1, 1490490000, 2) ,(1, 1509238800, 3),(1, 1521939600, 2) ,(1, 1540688400, 3),(1, 1553994000, 2) ,(1, 1572138000, 3),(1, 1585443600, 2) ,(1, 1603587600, 3),(1, 1616893200, 2) ,(1, 1635642000, 3),(1, 1648342800, 2) ,(1, 1667091600, 3),(1, 1679792400, 2) ,(1, 1698541200, 3),(1, 1711846800, 2) ,(1, 1729990800, 3),(1, 1743296400, 2) ,(1, 1761440400, 3),(1, 1774746000, 2) ,(1, 1792890000, 3),(1, 1806195600, 2) ,(1, 1824944400, 3),(1, 1837645200, 2) ,(1, 1856394000, 3),(1, 1869094800, 2) ,(1, 1887843600, 3),(1, 1901149200, 2) ,(1, 1919293200, 3),(1, 1932598800, 2) ,(1, 1950742800, 3),(1, 1964048400, 2) ,(1, 1982797200, 3),(1, 1995498000, 2) ,(1, 2014246800, 3),(1, 2026947600, 2) ,(1, 2045696400, 3),(1, 2058397200, 2) ,(1, 2077146000, 3),(1, 2090451600, 2) ,(1, 2108595600, 3),(1, 2121901200, 2) ,(1, 2140045200, 3),(3, -1688265000, 2) ,(3, -1656819048, 1),(3, -1641353448, 2) ,(3, -1627965048, 3),(3, -1618716648, 1) ,(3, -1596429048, 3),(3, -1593829848, 5) ,(3, -1589860800, 4),(3, -1542427200, 5) ,(3, -1539493200, 6),(3, -1525323600, 5) ,(3, -1522728000, 4),(3, -1491188400, 7) ,(3, -1247536800, 4),(3, 354920400, 5) ,(3, 370728000, 4),(3, 386456400, 5) ,(3, 402264000, 4),(3, 417992400, 5) ,(3, 433800000, 4),(3, 449614800, 5) ,(3, 465346800, 8),(3, 481071600, 9) ,(3, 496796400, 8),(3, 512521200, 9) ,(3, 528246000, 8),(3, 543970800, 9) ,(3, 559695600, 8),(3, 575420400, 9) ,(3, 591145200, 8),(3, 606870000, 9) ,(3, 622594800, 8),(3, 638319600, 9) ,(3, 654649200, 8),(3, 670374000, 10) ,(3, 686102400, 11),(3, 695779200, 8) ,(3, 701812800, 5),(3, 717534000, 4) ,(3, 733273200, 9),(3, 748998000, 8) ,(3, 764722800, 9),(3, 780447600, 8) ,(3, 796172400, 9),(3, 811897200, 8) ,(3, 828226800, 9),(3, 846370800, 8) ,(3, 859676400, 9),(3, 877820400, 8) ,(3, 891126000, 9),(3, 909270000, 8) ,(3, 922575600, 9),(3, 941324400, 8) ,(3, 954025200, 9),(3, 972774000, 8) ,(3, 985474800, 9),(3, 1004223600, 8) ,(3, 1017529200, 9),(3, 1035673200, 8) ,(3, 1048978800, 9),(3, 1067122800, 8) ,(3, 1080428400, 9),(3, 1099177200, 8) ,(3, 1111878000, 9),(3, 1130626800, 8) ,(3, 1143327600, 9),(3, 1162076400, 8) ,(3, 1174777200, 9),(3, 1193526000, 8) ,(3, 1206831600, 9),(3, 1224975600, 8) ,(3, 1238281200, 9),(3, 1256425200, 8) ,(3, 1269730800, 9),(3, 1288479600, 8) ,(3, 1301180400, 9),(3, 1319929200, 8) ,(3, 1332630000, 9),(3, 1351378800, 8) ,(3, 1364684400, 9),(3, 1382828400, 8) ,(3, 1396134000, 9),(3, 1414278000, 8) ,(3, 1427583600, 9),(3, 1445727600, 8) ,(3, 1459033200, 9),(3, 1477782000, 8) ,(3, 1490482800, 9),(3, 1509231600, 8) ,(3, 1521932400, 9),(3, 1540681200, 8) ,(3, 1553986800, 9),(3, 1572130800, 8) ,(3, 1585436400, 9),(3, 1603580400, 8) ,(3, 1616886000, 9),(3, 1635634800, 8) ,(3, 1648335600, 9),(3, 1667084400, 8) ,(3, 1679785200, 9),(3, 1698534000, 8) ,(3, 1711839600, 9),(3, 1729983600, 8) ,(3, 1743289200, 9),(3, 1761433200, 8) ,(3, 1774738800, 9),(3, 1792882800, 8) ,(3, 1806188400, 9),(3, 1824937200, 8) ,(3, 1837638000, 9),(3, 1856386800, 8) ,(3, 1869087600, 9),(3, 1887836400, 8) ,(3, 1901142000, 9),(3, 1919286000, 8) ,(3, 1932591600, 9),(3, 1950735600, 8) ,(3, 1964041200, 9),(3, 1982790000, 8) ,(3, 1995490800, 9),(3, 2014239600, 8) ,(3, 2026940400, 9),(3, 2045689200, 8) ,(3, 2058390000, 9),(3, 2077138800, 8) ,(3, 2090444400, 9),(3, 2108588400, 8) ,(3, 2121894000, 9),(3, 2140038000, 8),(4, -1688265000, 2) ,(4, -1656819048, 1),(4, -1641353448, 2) ,(4, -1627965048, 3),(4, -1618716648, 1) ,(4, -1596429048, 3),(4, -1593829848, 5) ,(4, -1589860800, 4),(4, -1542427200, 5) ,(4, -1539493200, 6),(4, -1525323600, 5) ,(4, -1522728000, 4),(4, -1491188400, 7) ,(4, -1247536800, 4),(4, 354920409, 5) ,(4, 370728010, 4),(4, 386456410, 5) ,(4, 402264011, 4),(4, 417992411, 5) ,(4, 433800012, 4),(4, 449614812, 5) ,(4, 465346812, 8),(4, 481071612, 9) ,(4, 496796413, 8),(4, 512521213, 9) ,(4, 528246013, 8),(4, 543970813, 9) ,(4, 559695613, 8),(4, 575420414, 9) ,(4, 591145214, 8),(4, 606870014, 9) ,(4, 622594814, 8),(4, 638319615, 9) ,(4, 654649215, 8),(4, 670374016, 10) ,(4, 686102416, 11),(4, 695779216, 8) ,(4, 701812816, 5),(4, 717534017, 4) ,(4, 733273217, 9),(4, 748998018, 8) ,(4, 764722818, 9),(4, 780447619, 8) ,(4, 796172419, 9),(4, 811897219, 8) ,(4, 828226820, 9),(4, 846370820, 8) ,(4, 859676420, 9),(4, 877820421, 8) ,(4, 891126021, 9),(4, 909270021, 8) ,(4, 922575622, 9),(4, 941324422, 8) ,(4, 954025222, 9),(4, 972774022, 8) ,(4, 985474822, 9),(4, 1004223622, 8) ,(4, 1017529222, 9),(4, 1035673222, 8) ,(4, 1048978822, 9),(4, 1067122822, 8) ,(4, 1080428422, 9),(4, 1099177222, 8) ,(4, 1111878022, 9),(4, 1130626822, 8) ,(4, 1143327622, 9),(4, 1162076422, 8) ,(4, 1174777222, 9),(4, 1193526022, 8) ,(4, 1206831622, 9),(4, 1224975622, 8) ,(4, 1238281222, 9),(4, 1256425222, 8) ,(4, 1269730822, 9),(4, 1288479622, 8) ,(4, 1301180422, 9),(4, 1319929222, 8) ,(4, 1332630022, 9),(4, 1351378822, 8) ,(4, 1364684422, 9),(4, 1382828422, 8) ,(4, 1396134022, 9),(4, 1414278022, 8) ,(4, 1427583622, 9),(4, 1445727622, 8) ,(4, 1459033222, 9),(4, 1477782022, 8) ,(4, 1490482822, 9),(4, 1509231622, 8) ,(4, 1521932422, 9),(4, 1540681222, 8) ,(4, 1553986822, 9),(4, 1572130822, 8) ,(4, 1585436422, 9),(4, 1603580422, 8) ,(4, 1616886022, 9),(4, 1635634822, 8) ,(4, 1648335622, 9),(4, 1667084422, 8) ,(4, 1679785222, 9),(4, 1698534022, 8) ,(4, 1711839622, 9),(4, 1729983622, 8) ,(4, 1743289222, 9),(4, 1761433222, 8) ,(4, 1774738822, 9),(4, 1792882822, 8) ,(4, 1806188422, 9),(4, 1824937222, 8) ,(4, 1837638022, 9),(4, 1856386822, 8) ,(4, 1869087622, 9),(4, 1887836422, 8) ,(4, 1901142022, 9),(4, 1919286022, 8) ,(4, 1932591622, 9),(4, 1950735622, 8) ,(4, 1964041222, 9),(4, 1982790022, 8) ,(4, 1995490822, 9),(4, 2014239622, 8) ,(4, 2026940422, 9),(4, 2045689222, 8) ,(4, 2058390022, 9),(4, 2077138822, 8) ,(4, 2090444422, 9),(4, 2108588422, 8) ,(4, 2121894022, 9),(4, 2140038022, 8);
+
+
+CREATE TABLE time_zone_transition_type (Time_zone_id int unsigned NOT NULL,Transition_type_id int unsigned NOT NULL,Offset int signed DEFAULT 0 NOT NULL,Is_DST tinyint unsigned DEFAULT 0 NOT NULL,Abbreviation char(8) DEFAULT '' NOT NULL,PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
+
+INSERT INTO time_zone_transition_type (Time_zone_id,Transition_type_id, Offset, Is_DST, Abbreviation) VALUES (1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET') ,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET') ,(2, 0, 0, 0, 'UTC') ,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST') ,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST') ,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD') ,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET') ,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD') ,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET') ,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST') ,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST') ,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD') ,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET') ,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD') ,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET') ,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');
+
+CREATE TABLE time_zone_leap_second (Transition_time bigint signed NOT NULL,Correction int signed NOT NULL,PRIMARY KEY TranTime (Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
+
+INSERT INTO time_zone_leap_second (Transition_time, Correction) VALUES (78796800, 1) ,(94694401, 2) ,(126230402, 3) ,(157766403, 4) ,(189302404, 5) ,(220924805, 6) ,(252460806, 7) ,(283996807, 8) ,(315532808, 9) ,(362793609, 10) ,(394329610, 11) ,(425865611, 12) ,(489024012, 13) ,(567993613, 14) ,(631152014, 15) ,(662688015, 16) ,(709948816, 17) ,(741484817, 18) ,(773020818, 19) ,(820454419, 20) ,(867715220, 21) ,(915148821, 22);
+
+
diff --git a/mysql-test/my_manage.c b/mysql-test/my_manage.c
new file mode 100644
index 00000000000..cc27558f131
--- /dev/null
+++ b/mysql-test/my_manage.c
@@ -0,0 +1,877 @@
+/*
+ Copyright (c) 2003 Novell, Inc. All Rights Reserved.
+
+ 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 <stdio.h>
+#include <errno.h>
+#ifndef __WIN__
+#include <dirent.h>
+#endif
+#include <string.h>
+#ifdef __NETWARE__
+#include <screen.h>
+#include <proc.h>
+#else
+#include <sys/types.h>
+#ifndef __WIN__
+#include <sys/wait.h>
+#include <unistd.h>
+#include <signal.h>
+#include <fnmatch.h> /* FIXME HAVE_FNMATCH_H or something */
+#else
+#include <direct.h>
+#include <stdlib.h>
+#include <stdio.h>
+#endif
+#endif
+#include <ctype.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <assert.h>
+
+#include "my_manage.h"
+
+#ifndef __NETWARE__
+#define ASSERT assert
+extern char **environ;
+#endif
+
+
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
+/******************************************************************************
+
+ global variables
+
+******************************************************************************/
+
+/******************************************************************************
+
+ functions
+
+******************************************************************************/
+
+/******************************************************************************
+
+ init_args()
+
+ Init an argument list.
+
+******************************************************************************/
+
+void init_args(arg_list_t *al)
+{
+ ASSERT(al != NULL);
+
+ al->argc= 0;
+ al->size= ARG_BUF;
+ al->argv= malloc(al->size * sizeof(char *));
+ ASSERT(al->argv != NULL);
+
+ return;
+}
+
+/******************************************************************************
+
+ add_arg()
+
+ Add an argument to a list.
+
+******************************************************************************/
+
+void add_arg(arg_list_t *al, const char *format, ...)
+{
+ va_list ap;
+ char temp[FN_REFLEN];
+
+ ASSERT(al != NULL);
+
+ /* increase size */
+ if (al->argc >= (int)al->size)
+ {
+ al->size+= ARG_BUF;
+ al->argv= realloc(al->argv, al->size * sizeof(char *));
+ ASSERT(al->argv != NULL);
+ }
+
+ if (format)
+ {
+ va_start(ap, format);
+ vsprintf(temp, format, ap);
+ va_end(ap);
+
+ al->argv[al->argc]= malloc(strlen(temp)+1);
+ ASSERT(al->argv[al->argc] != NULL);
+ strcpy(al->argv[al->argc], temp);
+
+ ++(al->argc);
+ }
+ else
+ {
+ al->argv[al->argc]= NULL;
+ }
+
+ return;
+}
+
+/******************************************************************************
+
+ free_args()
+
+ Free an argument list.
+
+******************************************************************************/
+
+void free_args(arg_list_t *al)
+{
+ int i;
+
+ ASSERT(al != NULL);
+
+ for (i= 0; i < al->argc; i++)
+ {
+ ASSERT(al->argv[i] != NULL);
+ free(al->argv[i]);
+ al->argv[i]= NULL;
+ }
+
+ free(al->argv);
+ al->argc= 0;
+ al->argv= NULL;
+
+ return;
+}
+
+/******************************************************************************
+
+ sleep_until_file_deleted()
+
+ Sleep until the given file is no longer found.
+
+******************************************************************************/
+
+#ifndef __WIN__
+int sleep_until_file_deleted(char *pid_file)
+#else
+int sleep_until_file_deleted(HANDLE pid_file)
+#endif
+{
+ int err= 0; /* Initiate to supress warning */
+#ifndef __WIN__
+ struct stat buf;
+ int i;
+
+ for (i= 0; (i < TRY_MAX) && (err= !stat(pid_file, &buf)); i++) sleep(1);
+
+ if (err != 0) err= errno;
+#else
+ err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT);
+#endif
+ return err;
+}
+
+/******************************************************************************
+
+ sleep_until_file_exists()
+
+ Sleep until the given file exists.
+
+******************************************************************************/
+
+#ifndef __WIN__
+int sleep_until_file_exists(char *pid_file)
+#else
+int sleep_until_file_exists(HANDLE pid_file)
+#endif
+{
+ int err= 0; /* Initiate to supress warning */
+#ifndef __WIN__
+ struct stat buf;
+ int i;
+
+ for (i= 0; (i < TRY_MAX) && (err= stat(pid_file, &buf)); i++) sleep(1);
+
+ if (err != 0) err= errno;
+#else
+ err= (WaitForSingleObject(pid_file, TRY_MAX*1000) == WAIT_TIMEOUT);
+#endif
+ return err;
+}
+
+/******************************************************************************
+
+ wait_for_server_start()
+
+ Wait for the server on the given port to start.
+
+******************************************************************************/
+
+int wait_for_server_start(char *bin_dir __attribute__((unused)),
+ char *mysqladmin_file,
+ char *user, char *password, int port,char *tmp_dir)
+{
+ arg_list_t al;
+ int err= 0, i;
+ char trash[FN_REFLEN];
+
+ /* mysqladmin file */
+ snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqladmin_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", port);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "--silent");
+
+/* #ifdef NOT_USED */
+#ifndef __NETWARE__
+ add_arg(&al, "-O");
+ add_arg(&al, "connect_timeout=10");
+ add_arg(&al, "-w");
+#endif
+
+ add_arg(&al, "--host=localhost");
+#ifndef __NETWARE__
+ add_arg(&al, "--protocol=tcp");
+#endif
+ add_arg(&al, "ping");
+
+ /*
+ NetWare does not support the connect timeout in the TCP/IP stack
+ -- we will try the ping multiple times
+ */
+#ifndef __WIN__
+ for (i= 0; (i < TRY_MAX)
+ && (err= spawn(mysqladmin_file, &al, TRUE, NULL,
+ trash, NULL, NULL)); i++) sleep(1);
+#else
+ err= spawn(mysqladmin_file, &al, TRUE, NULL,trash, NULL, NULL);
+#endif
+
+ /* free args */
+ free_args(&al);
+
+ return err;
+}
+
+/******************************************************************************
+
+ spawn()
+
+ Spawn the given path with the given arguments.
+
+******************************************************************************/
+
+#ifdef __NETWARE__
+int spawn(char *path, arg_list_t *al, int join, char *input,
+ char *output, char *error, char *pid_file)
+{
+ pid_t pid;
+ int result= 0;
+ wiring_t wiring= { FD_UNUSED, FD_UNUSED, FD_UNUSED };
+ unsigned long flags= PROC_CURRENT_SPACE | PROC_INHERIT_CWD;
+
+ /* open wiring */
+ if (input)
+ wiring.infd= open(input, O_RDONLY);
+
+ if (output)
+ wiring.outfd= open(output, O_WRONLY | O_CREAT | O_TRUNC);
+
+ if (error)
+ wiring.errfd= open(error, O_WRONLY | O_CREAT | O_TRUNC);
+
+ /* procve requires a NULL */
+ add_arg(al, NULL);
+
+ /* go */
+ pid= procve(path, flags, NULL, &wiring, NULL, NULL, 0,
+ NULL, (const char **)al->argv);
+
+ /* close wiring */
+ if (wiring.infd != -1)
+ close(wiring.infd);
+
+ if (wiring.outfd != -1)
+ close(wiring.outfd);
+
+ if (wiring.errfd != -1)
+ close(wiring.errfd);
+
+ return result;
+}
+#elif __WIN__
+
+int spawn(char *path, arg_list_t *al, int join, char *input,
+ char *output, char *error, HANDLE *pid)
+{
+ intptr_t result;
+ int i;
+ STARTUPINFO startup_info;
+ PROCESS_INFORMATION process_information;
+ DWORD exit_code;
+ char win_args[1024]= "";
+ char command_line[1024]= "";
+
+ /* Skip the first parameter */
+ for (i= 1; i < al->argc; i++)
+ {
+ ASSERT(al->argv[i] != NULL);
+ strcat(win_args,al->argv[i]);
+ strcat(win_args," ");
+ }
+
+ memset(&startup_info,0,sizeof(STARTUPINFO));
+ startup_info.cb= sizeof(STARTUPINFO);
+
+ if (input)
+ freopen(input, "rb", stdin);
+
+ if (output)
+ freopen(output, "wb", stdout);
+
+ if (error)
+ freopen(error, "wb", stderr);
+
+ result= CreateProcess(
+ path,
+ (LPSTR)&win_args,
+ NULL,
+ NULL,
+ TRUE,
+ 0,
+ NULL,
+ NULL,
+ &startup_info,
+ &process_information
+ );
+
+ if (result && process_information.hProcess)
+ {
+ if (join)
+ {
+ if (WaitForSingleObject(process_information.hProcess, mysqld_timeout)
+ == WAIT_TIMEOUT)
+ {
+ exit_code= -1;
+ }
+ else
+ {
+ GetExitCodeProcess(process_information.hProcess, &exit_code);
+ }
+ CloseHandle(process_information.hProcess);
+ }
+ else
+ {
+ exit_code= 0;
+ }
+ if (pid != NULL)
+ *pid= process_information.hProcess;
+ }
+ else
+ {
+ exit_code= -1;
+ }
+ if (input)
+ freopen("CONIN$","rb",stdin);
+ if (output)
+ freopen("CONOUT$","wb",stdout);
+ if (error)
+ freopen("CONOUT$","wb",stderr);
+
+ return exit_code;
+}
+#else
+int spawn(char *path, arg_list_t *al, int join, char *input,
+ char *output, char *error, char *pid_file __attribute__((unused)))
+{
+ pid_t pid;
+ int res_exec= 0;
+ int result= 0;
+
+ pid= fork();
+
+ if (pid == -1)
+ {
+ fprintf(stderr, "fork was't created\n");
+ /* We can't create the fork...exit with error */
+ return EXIT_FAILURE;
+ }
+
+ if (pid > 0)
+ {
+ /* The parent process is waiting for child process if join is not zero */
+ if (join)
+ {
+ waitpid(pid, &result, 0);
+ if (WIFEXITED(result) != 0)
+ {
+ result= WEXITSTATUS(result);
+ }
+ else
+ {
+ result= EXIT_FAILURE;
+ }
+ }
+ }
+ else
+ {
+
+ /* Child process */
+ add_arg(al, NULL);
+
+ /* Reassign streams */
+ if (input)
+ freopen(input, "r", stdin);
+
+ if (output)
+ freopen(output, "w", stdout);
+
+ if (error)
+ freopen(error, "w", stderr);
+
+ /* Spawn the process */
+ if ((res_exec= execve(path, al->argv, environ)) < 0)
+ exit(EXIT_FAILURE);
+
+ /* Restore streams */
+ if (input)
+ freopen("/dev/tty", "r", stdin);
+
+ if (output)
+ freopen("/dev/tty", "w", stdout);
+
+ if (error)
+ freopen("/dev/tty", "w", stderr);
+
+ exit(0);
+ }
+
+ return result;
+}
+#endif
+/******************************************************************************
+
+ stop_server()
+
+ Stop the server with the given port and pid file.
+
+******************************************************************************/
+
+int stop_server(char *bin_dir __attribute__((unused)), char *mysqladmin_file,
+ char *user, char *password, int port,
+#ifndef __WIN__
+ char *pid_file,
+#else
+ HANDLE pid_file,
+#endif
+ char *tmp_dir)
+{
+ arg_list_t al;
+ int err= 0;
+ char trash[FN_REFLEN];
+
+ snprintf(trash, FN_REFLEN, "%s/trash.out",tmp_dir);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqladmin_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", port);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "-O");
+ add_arg(&al, "shutdown_timeout=20");
+#ifndef __NETWARE__
+ add_arg(&al, "--protocol=tcp");
+#endif
+ add_arg(&al, "shutdown");
+
+ /* spawn */
+ if ((err= spawn(mysqladmin_file, &al, TRUE, NULL,
+ trash, NULL, NULL)) == 0)
+ {
+ sleep_until_file_deleted(pid_file);
+ }
+ else
+ {
+#ifndef __WIN__
+ pid_t pid= get_server_pid(pid_file);
+
+ /* shutdown failed - kill server */
+ kill_server(pid);
+
+ sleep(TRY_MAX);
+
+ /* remove pid file if possible */
+ err= remove(pid_file);
+#else
+ TerminateProcess(pid_file,err);
+#endif
+ }
+
+ /* free args */
+ free_args(&al);
+
+ return err;
+}
+
+/******************************************************************************
+
+ get_server_pid()
+
+ Get the VM id with the given pid file.
+
+******************************************************************************/
+
+#ifndef __WIN__
+pid_t get_server_pid(char *pid_file)
+{
+ char buf[FN_REFLEN];
+ int fd, err;
+ char *p;
+ pid_t id= 0;
+
+ /* discover id */
+ fd= open(pid_file, O_RDONLY);
+
+ err= read(fd, buf, FN_REFLEN);
+
+ close(fd);
+
+ if (err > 0)
+ {
+ /* terminate string */
+ if ((p= strchr(buf, '\n')) != NULL)
+ {
+ *p= '\0';
+
+ /* check for a '\r' */
+ if ((p= strchr(buf, '\r')) != NULL)
+ {
+ *p= '\0';
+ }
+ }
+ else
+ {
+ buf[err]= '\0';
+ }
+
+ id= strtol(buf, NULL, 0);
+ }
+
+ return id;
+}
+
+/******************************************************************************
+
+ kill_server()
+
+ Force a kill of the server with the given pid.
+
+******************************************************************************/
+
+void kill_server(pid_t pid)
+{
+ if (pid > 0)
+ {
+#if !defined(__NETWARE__)
+ /* Send SIGTERM to pid */
+ kill(pid, SIGTERM);
+#else /* __NETWARE__ */
+ /* destroy vm */
+ NXVmDestroy(pid);
+#endif
+ }
+}
+#endif
+/******************************************************************************
+
+ del_tree()
+
+ Delete the directory and subdirectories.
+
+******************************************************************************/
+
+void del_tree(char *dir)
+{
+#ifndef __WIN__
+ DIR *parent= opendir(dir);
+ struct dirent *entry;
+ char temp[FN_REFLEN];
+
+ if (parent == NULL)
+ {
+ return;
+ }
+
+ while ((entry= readdir(parent)) != NULL)
+ {
+ /* create long name */
+ snprintf(temp, FN_REFLEN, "%s/%s", dir, entry->d_name);
+
+ if (entry->d_name[0] == '.')
+ {
+ /* Skip */
+ }
+ else
+ {
+/* FIXME missing test in acinclude.m4 */
+#ifndef STRUCT_DIRENT_HAS_D_TYPE
+ struct stat st;
+
+ if (lstat(entry->d_name, &st) == -1)
+ {
+ /* FIXME error */
+ return;
+ }
+ if (S_ISDIR(st.st_mode))
+#else
+ if (S_ISDIR(entry->d_type))
+#endif
+ {
+ /* delete subdirectory */
+ del_tree(temp);
+ }
+ else
+ {
+ /* remove file */
+ remove(temp);
+ }
+ }
+ }
+ /* remove directory */
+ rmdir(dir);
+#else
+ struct _finddata_t parent;
+ intptr_t handle;
+ char temp[FN_REFLEN];
+ char mask[FN_REFLEN];
+
+ snprintf(mask,FN_REFLEN,"%s/*.*",dir);
+
+ if ((handle=_findfirst(mask,&parent)) == -1L)
+ {
+ return;
+ }
+
+ do
+ {
+ /* create long name */
+ snprintf(temp, FN_REFLEN, "%s/%s", dir, parent.name);
+ if (parent.name[0] == '.')
+ {
+ /* Skip */
+ }
+ else
+ if (parent.attrib & _A_SUBDIR)
+ {
+ /* delete subdirectory */
+ del_tree(temp);
+ }
+ else
+ {
+ /* remove file */
+ remove(temp);
+ }
+ } while (_findnext(handle,&parent) == 0);
+
+ _findclose(handle);
+
+ /* remove directory */
+ _rmdir(dir);
+#endif
+}
+
+/******************************************************************************
+
+ removef()
+
+******************************************************************************/
+
+int removef(const char *format, ...)
+{
+#ifdef __NETWARE__
+ va_list ap;
+ char path[FN_REFLEN];
+
+ va_start(ap, format);
+
+ vsnprintf(path, FN_REFLEN, format, ap);
+
+ va_end(ap);
+ return remove(path);
+
+#eldef __WIN__
+ {
+ va_list ap;
+ char path[FN_REFLEN];
+ struct _finddata_t parent;
+ intptr_t handle;
+ char temp[FN_REFLEN];
+ char *p;
+
+ va_start(ap, format);
+
+ vsnprintf(path, FN_REFLEN, format, ap);
+
+ va_end(ap);
+
+ p= path + strlen(path);
+ while (*p != '\\' && *p != '/' && p > path) p--;
+
+ if ((handle=_findfirst(path,&parent)) == -1L)
+ {
+ /* if there is not files....it's ok */
+ return 0;
+ }
+
+ *p= '\0';
+
+ do
+ {
+ if (! (parent.attrib & _A_SUBDIR))
+ {
+ snprintf(temp, FN_REFLEN, "%s/%s", path, parent.name);
+ remove(temp);
+ }
+ }while (_findnext(handle,&parent) == 0);
+
+ _findclose(handle);
+ }
+#else
+ DIR *parent;
+ struct dirent *entry;
+ char temp[FN_REFLEN];
+ va_list ap;
+ char path[FN_REFLEN];
+ char *p;
+ /* Get path with mask */
+ va_start(ap, format);
+
+ vsnprintf(path, FN_REFLEN, format, ap);
+
+ va_end(ap);
+
+ p= path + strlen(path);
+ while (*p != '\\' && *p != '/' && p > path) p--;
+ *p= '\0';
+ p++;
+
+ parent= opendir(path);
+
+ if (parent == NULL)
+ {
+ return 1; /* Error, directory missing */
+ }
+
+ while ((entry= readdir(parent)) != NULL)
+ {
+ /* entry is not directory and entry matches with mask */
+#ifndef STRUCT_DIRENT_HAS_D_TYPE
+ struct stat st;
+
+ if (lstat(entry->d_name, &st) == -1)
+ {
+ return 1;
+ }
+
+ if (!S_ISDIR(st.st_mode) && !fnmatch(p, entry->d_name,0))
+#else
+ if (!S_ISDIR(entry->d_type) && !fnmatch(p, entry->d_name,0))
+#endif
+ {
+ /* create long name */
+ snprintf(temp, FN_REFLEN, "%s/%s", path, entry->d_name);
+ /* Delete only files */
+ remove(temp);
+ }
+ }
+#endif
+ return 0;
+}
+
+/******************************************************************************
+
+ get_basedir()
+
+******************************************************************************/
+
+void get_basedir(char *argv0, char *basedir)
+{
+ char temp[FN_REFLEN];
+ char *p;
+ int position;
+
+ ASSERT(argv0 != NULL);
+ ASSERT(basedir != NULL);
+
+ strcpy(temp, strlwr(argv0));
+ while ((p= strchr(temp, '\\')) != NULL) *p= '/';
+
+ if ((position= strinstr(temp, "/bin/")) != 0)
+ {
+ p= temp + position;
+ *p= '\0';
+ strcpy(basedir, temp);
+ }
+}
+
+uint strinstr(reg1 const char *str,reg4 const char *search)
+{
+ reg2 my_string i,j;
+ my_string start= (my_string) str;
+
+ skipp:
+ while (*str != '\0')
+ {
+ if (*str++ == *search)
+ {
+ i=(my_string) str;
+ j= (my_string) search+1;
+ while (*j)
+ if (*i++ != *j++) goto skipp;
+ return ((uint) (str - start));
+ }
+ }
+ return (0);
+}
+
+/******************************************************************************
+
+ remove_empty_file()
+
+******************************************************************************/
+
+void remove_empty_file(const char *file_name)
+{
+ struct stat file;
+
+ if (!stat(file_name,&file))
+ {
+ if (!file.st_size)
+ remove(file_name);
+ }
+}
diff --git a/mysql-test/my_manage.h b/mysql-test/my_manage.h
new file mode 100644
index 00000000000..7e371d36ab1
--- /dev/null
+++ b/mysql-test/my_manage.h
@@ -0,0 +1,133 @@
+/*
+ Copyright (c) 2002 Novell, Inc. All Rights Reserved.
+
+ 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 _MY_MANAGE
+#define _MY_MANAGE
+
+/******************************************************************************
+
+ includes
+
+******************************************************************************/
+
+#include <stdlib.h>
+#ifndef __WIN__
+#include <unistd.h>
+#endif
+#ifndef __NETWARE__
+#include <string.h>
+#include <my_global.h>
+#include <m_string.h>
+
+#ifndef __WIN__
+#define strnicmp strncasecmp
+#define strlwr(STRARG) (STRARG)
+#else
+int my_vsnprintf_(char *to, size_t n, const char* value, ...);
+#endif
+#endif
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
+#define ARG_BUF 10
+#define TRY_MAX 5
+
+#ifdef __WIN__
+#define kill(A,B) TerminateProcess((HANDLE)A,0)
+#define NOT_NEED_PID 0
+#define MASTER_PID 1
+#define SLAVE_PID 2
+#define mysqld_timeout 60000
+
+int pid_mode;
+bool run_server;
+bool skip_first_param;
+
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#endif
+
+
+/******************************************************************************
+
+ structures
+
+******************************************************************************/
+
+typedef struct
+{
+
+ int argc;
+ char **argv;
+
+ size_t size;
+
+} arg_list_t;
+
+#ifdef __WIN__
+typedef int pid_t;
+#endif
+/******************************************************************************
+
+ global variables
+
+******************************************************************************/
+
+/******************************************************************************
+
+ prototypes
+
+******************************************************************************/
+
+void init_args(arg_list_t *);
+void add_arg(arg_list_t *, const char *, ...);
+void free_args(arg_list_t *);
+
+#ifndef __WIN__
+int sleep_until_file_exists(char *);
+int sleep_until_file_deleted(char *);
+#else
+int sleep_until_file_exists(HANDLE);
+int sleep_until_file_deleted(HANDLE);
+#endif
+int wait_for_server_start(char *, char *, char *, char *, int,char *);
+
+#ifndef __WIN__
+int spawn(char *, arg_list_t *, int, char *, char *, char *, char *);
+#else
+int spawn(char *, arg_list_t *, int , char *, char *, char *, HANDLE *);
+#endif
+
+#ifndef __WIN__
+int stop_server(char *, char *, char *, char *, int, char *,char *);
+pid_t get_server_pid(char *);
+void kill_server(pid_t pid);
+#else
+int stop_server(char *, char *, char *, char *, int, HANDLE,char *);
+#endif
+void del_tree(char *);
+int removef(const char *, ...);
+
+void get_basedir(char *, char *);
+void remove_empty_file(const char *file_name);
+
+#endif /* _MY_MANAGE */
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 65be9bf9c8e..27eae89922c 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -227,7 +227,7 @@ DO_CLIENT_GDB=""
SLEEP_TIME_AFTER_RESTART=1
SLEEP_TIME_FOR_DELETE=10
SLEEP_TIME_FOR_FIRST_MASTER=400 # Enough time to create innodb tables
-SLEEP_TIME_FOR_SECOND_MASTER=30
+SLEEP_TIME_FOR_SECOND_MASTER=400
SLEEP_TIME_FOR_FIRST_SLAVE=400
SLEEP_TIME_FOR_SECOND_SLAVE=30
CHARACTER_SET=latin1
@@ -457,6 +457,9 @@ SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
export MASTER_MYPORT MASTER_MYPORT1 SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
+NDBCLUSTER_BASE_PORT=`expr $NDBCLUSTER_PORT + 2`
+NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --port-base=$NDBCLUSTER_BASE_PORT --data-dir=$MYSQL_TEST_DIR/var"
+
if [ x$SOURCE_DIST = x1 ] ; then
MY_BASEDIR=$MYSQL_TEST_DIR
else
@@ -939,11 +942,11 @@ start_ndbcluster()
echo "Starting ndbcluster"
if [ "$DO_BENCH" = 1 ]
then
- NDBCLUSTER_OPTS=""
+ NDBCLUSTER_EXTRA_OPTS=""
else
- NDBCLUSTER_OPTS="--small"
+ NDBCLUSTER_EXTRA_OPTS="--small"
fi
- ./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT $NDBCLUSTER_OPTS --diskless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
+ ./ndb/ndbcluster $NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --diskless --initial || exit 1
NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT"
else
NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
@@ -961,7 +964,7 @@ stop_ndbcluster()
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
# Kill any running ndbcluster stuff
- ./ndb/ndbcluster --data-dir=$MYSQL_TEST_DIR/var --port-base=$NDBCLUSTER_PORT --stop
+ ./ndb/ndbcluster $NDBCLUSTER_OPTS --stop
fi
fi
}
diff --git a/mysql-test/mysql_test_run.c b/mysql-test/mysql_test_run.c
new file mode 100644
index 00000000000..6f388fc4a45
--- /dev/null
+++ b/mysql-test/mysql_test_run.c
@@ -0,0 +1,1728 @@
+/*
+ Copyright (c) 2002, 2003 Novell, Inc. All Rights Reserved.
+
+ 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 <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#ifndef __WIN__
+#include <dirent.h>
+#endif
+#include <string.h>
+#ifdef __NETWARE__
+#include <screen.h>
+#include <nks/vm.h>
+#endif
+#include <ctype.h>
+#include <sys/stat.h>
+#ifndef __WIN__
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+#ifdef __NETWARE__
+#include <sys/mode.h>
+#endif
+#ifdef __WIN__
+#include <Shlwapi.h>
+#include <direct.h>
+#endif
+
+#include "my_manage.h"
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
+#define HEADER "TEST RESULT \n"
+#define DASH "-------------------------------------------------------\n"
+
+#define NW_TEST_SUFFIX ".nw-test"
+#define NW_RESULT_SUFFIX ".nw-result"
+#define TEST_SUFFIX ".test"
+#define RESULT_SUFFIX ".result"
+#define REJECT_SUFFIX ".reject"
+#define OUT_SUFFIX ".out"
+#define ERR_SUFFIX ".err"
+
+const char *TEST_PASS = "[ pass ]";
+const char *TEST_SKIP = "[ skip ]";
+const char *TEST_FAIL = "[ fail ]";
+const char *TEST_BAD = "[ bad ]";
+const char *TEST_IGNORE = "[ignore]";
+
+/******************************************************************************
+
+ global variables
+
+******************************************************************************/
+#ifdef __NETWARE__
+static char base_dir[PATH_MAX] = "sys:/mysql";
+#else
+static char base_dir[PATH_MAX] = "..";
+#endif
+static char db[PATH_MAX] = "test";
+static char user[PATH_MAX] = "root";
+static char password[PATH_MAX] = "";
+
+int master_port = 9306;
+int slave_port = 9307;
+
+#if !defined(__NETWARE__) && !defined(__WIN__)
+static char master_socket[PATH_MAX] = "./var/tmp/master.sock";
+static char slave_socket[PATH_MAX] = "./var/tmp/slave.sock";
+#endif
+
+// comma delimited list of tests to skip or empty string
+#ifndef __WIN__
+static char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix ";
+#else
+/*
+ The most ignore testes contain the calls of system command
+*/
+#define MAX_COUNT_TESTES 1024
+/*
+ lowercase_table3 is disabled by Gerg
+ system_mysql_db_fix is disabled by Gerg
+ sp contains a command system
+ rpl_EE_error contains a command system
+ rpl_loaddatalocal contains a command system
+ ndb_autodiscover contains a command system
+ rpl_rotate_logs contains a command system
+ repair contains a command system
+ rpl_trunc_binlog contains a command system
+ mysqldump contains a command system
+ rpl000001 makes non-exit loop...temporary skiped
+*/
+static char skip_test[PATH_MAX] = " lowercase_table3 , system_mysql_db_fix , sp , rpl_EE_error , rpl_loaddatalocal , ndb_autodiscover , rpl_rotate_logs , repair , rpl_trunc_binlog , mysqldump , rpl000001 ";
+#endif
+static char ignore_test[PATH_MAX] = "";
+
+static char bin_dir[PATH_MAX];
+static char mysql_test_dir[PATH_MAX];
+static char test_dir[PATH_MAX];
+static char mysql_tmp_dir[PATH_MAX];
+static char result_dir[PATH_MAX];
+static char master_dir[PATH_MAX];
+static char slave_dir[PATH_MAX];
+static char lang_dir[PATH_MAX];
+static char char_dir[PATH_MAX];
+
+static char mysqladmin_file[PATH_MAX];
+static char mysqld_file[PATH_MAX];
+static char mysqltest_file[PATH_MAX];
+#ifndef __WIN__
+static char master_pid[PATH_MAX];
+static char slave_pid[PATH_MAX];
+static char sh_file[PATH_MAX] = "/bin/sh";
+#else
+static HANDLE master_pid;
+static HANDLE slave_pid;
+#endif
+
+static char master_opt[PATH_MAX] = "";
+static char slave_opt[PATH_MAX] = "";
+
+static char slave_master_info[PATH_MAX] = "";
+
+static char master_init_script[PATH_MAX] = "";
+static char slave_init_script[PATH_MAX] = "";
+
+// OpenSSL
+static char ca_cert[PATH_MAX];
+static char server_cert[PATH_MAX];
+static char server_key[PATH_MAX];
+static char client_cert[PATH_MAX];
+static char client_key[PATH_MAX];
+
+int total_skip = 0;
+int total_pass = 0;
+int total_fail = 0;
+int total_test = 0;
+
+int total_ignore = 0;
+
+int use_openssl = FALSE;
+int master_running = FALSE;
+int slave_running = FALSE;
+int skip_slave = TRUE;
+int single_test = TRUE;
+
+int restarts = 0;
+
+FILE *log_fd = NULL;
+
+/******************************************************************************
+
+ functions
+
+******************************************************************************/
+
+/******************************************************************************
+
+ prototypes
+
+******************************************************************************/
+
+void report_stats();
+void install_db(char *);
+void mysql_install_db();
+void start_master();
+void start_slave();
+void mysql_start();
+void stop_slave();
+void stop_master();
+void mysql_stop();
+void mysql_restart();
+int read_option(char *, char *);
+void run_test(char *);
+void setup(char *);
+void vlog(const char *, va_list);
+void mlog(const char *, ...);
+void log_info(const char *, ...);
+void log_error(const char *, ...);
+void log_errno(const char *, ...);
+void die(const char *);
+char *str_tok(char *string, const char *delim);
+#ifndef __WIN__
+void run_init_script(const char *script_name);
+#endif
+/******************************************************************************
+
+ report_stats()
+
+ Report the gathered statistics.
+
+******************************************************************************/
+void report_stats()
+{
+ if (total_fail == 0)
+ {
+ mlog("\nAll %d test(s) were successful.\n", total_test);
+ }
+ else
+ {
+ double percent = ((double)total_pass / total_test) * 100;
+
+ mlog("\nFailed %u/%u test(s), %.02f%% successful.\n",
+ total_fail, total_test, percent);
+ mlog("\nThe .out and .err files in %s may give you some\n", result_dir);
+ mlog("hint of what when wrong.\n");
+ mlog("\nIf you want to report this error, please first read the documentation\n");
+ mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n");
+ }
+}
+
+/******************************************************************************
+
+ install_db()
+
+ Install the a database.
+
+******************************************************************************/
+void install_db(char *datadir)
+{
+ arg_list_t al;
+ int err;
+ char input[PATH_MAX];
+ char output[PATH_MAX];
+ char error[PATH_MAX];
+
+ // input file
+#ifdef __NETWARE__
+ snprintf(input, PATH_MAX, "%s/bin/init_db.sql", base_dir);
+#else
+ snprintf(input, PATH_MAX, "%s/mysql-test/init_db.sql", base_dir);
+#endif
+ snprintf(output, PATH_MAX, "%s/install.out", datadir);
+ snprintf(error, PATH_MAX, "%s/install.err", datadir);
+
+ // args
+ init_args(&al);
+ add_arg(&al, mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--bootstrap");
+ add_arg(&al, "--skip-grant-tables");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--datadir=%s", datadir);
+ add_arg(&al, "--skip-innodb");
+ add_arg(&al, "--skip-bdb");
+#ifndef __NETWARE__
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+#endif
+
+ // spawn
+ if ((err = spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0)
+ {
+ die("Unable to create database.");
+ }
+
+ // free args
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ mysql_install_db()
+
+ Install the test databases.
+
+******************************************************************************/
+void mysql_install_db()
+{
+ char temp[PATH_MAX];
+
+ // var directory
+ snprintf(temp, PATH_MAX, "%s/var", mysql_test_dir);
+
+ // clean up old direcotry
+ del_tree(temp);
+
+ // create var directory
+#ifndef __WIN__
+ mkdir(temp, S_IRWXU);
+ // create subdirectories
+ mlog("Creating test-suite folders...\n");
+ snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+#else
+ mkdir(temp);
+ // create subdirectories
+ mlog("Creating test-suite folders...\n");
+ snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/mysql", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/master-data/test", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/mysql", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, PATH_MAX, "%s/var/slave-data/test", mysql_test_dir);
+ mkdir(temp);
+#endif
+
+ // install databases
+ mlog("Creating test databases for master... \n");
+ install_db(master_dir);
+ mlog("Creating test databases for slave... \n");
+ install_db(slave_dir);
+}
+
+/******************************************************************************
+
+ start_master()
+
+ Start the master server.
+
+******************************************************************************/
+void start_master()
+{
+ arg_list_t al;
+ int err;
+ char master_out[PATH_MAX];
+ char master_err[PATH_MAX];
+// char temp[PATH_MAX];
+ char temp2[PATH_MAX];
+
+ // remove old berkeley db log files that can confuse the server
+ removef("%s/log.*", master_dir);
+
+ // remove stale binary logs
+ removef("%s/var/log/*-bin.*", mysql_test_dir);
+
+ // remove stale binary logs
+ removef("%s/var/log/*.index", mysql_test_dir);
+
+ // remove master.info file
+ removef("%s/master.info", master_dir);
+
+ // remove relay files
+ removef("%s/var/log/*relay*", mysql_test_dir);
+
+ // remove relay-log.info file
+ removef("%s/relay-log.info", master_dir);
+
+ // init script
+ if (master_init_script[0] != 0)
+ {
+#ifdef __NETWARE__
+ // TODO: use the scripts
+ if (strinstr(master_init_script, "repair_part2-master.sh") != 0)
+ {
+ FILE *fp;
+
+ // create an empty index file
+ snprintf(temp, PATH_MAX, "%s/test/t1.MYI", master_dir);
+ fp = fopen(temp, "wb+");
+
+ fputs("1", fp);
+
+ fclose(fp);
+ }
+#elif !defined(__WIN__)
+ run_init_script(master_init_script);
+#endif
+ }
+
+ // redirection files
+ snprintf(master_out, PATH_MAX, "%s/var/run/master%u.out",
+ mysql_test_dir, restarts);
+ snprintf(master_err, PATH_MAX, "%s/var/run/master%u.err",
+ mysql_test_dir, restarts);
+#ifndef __WIN__
+ snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir);
+ mkdir(temp2,S_IRWXU);
+ snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir);
+ mkdir(temp2,S_IRWXU);
+#else
+ snprintf(temp2,PATH_MAX,"%s/var",mysql_test_dir);
+ mkdir(temp2);
+ snprintf(temp2,PATH_MAX,"%s/var/log",mysql_test_dir);
+ mkdir(temp2);
+#endif
+ // args
+ init_args(&al);
+ add_arg(&al, "%s", mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir);
+ add_arg(&al, "--server-id=1");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--port=%u", master_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s",master_socket);
+#endif
+ add_arg(&al, "--local-infile");
+ add_arg(&al, "--core");
+ add_arg(&al, "--datadir=%s", master_dir);
+#ifndef __WIN__
+ add_arg(&al, "--pid-file=%s", master_pid);
+#endif
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+#ifdef DEBUG //only for debug builds
+ add_arg(&al, "--debug");
+#endif
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ // $MASTER_40_ARGS
+ add_arg(&al, "--rpl-recovery-rank=1");
+ add_arg(&al, "--init-rpl-role=master");
+
+ // $SMALL_SERVER
+ add_arg(&al, "-O");
+ add_arg(&al, "key_buffer_size=1M");
+ add_arg(&al, "-O");
+ add_arg(&al, "sort_buffer=256K");
+ add_arg(&al, "-O");
+ add_arg(&al, "max_heap_table_size=1M");
+
+ // $EXTRA_MASTER_OPT
+ if (master_opt[0] != 0)
+ {
+ char *p;
+
+ p = (char *)str_tok(master_opt, " \t");
+ if (!strstr(master_opt, "timezone"))
+ {
+ while (p)
+ {
+ add_arg(&al, "%s", p);
+ p = (char *)str_tok(NULL, " \t");
+ }
+ }
+ }
+
+ // remove the pid file if it exists
+#ifndef __WIN__
+ remove(master_pid);
+#endif
+
+ // spawn
+#ifdef __WIN__
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err, &master_pid)) == 0)
+#else
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err, master_pid)) == 0)
+#endif
+ {
+ sleep_until_file_exists(master_pid);
+
+ if ((err = wait_for_server_start(bin_dir, mysqladmin_file, user, password, master_port,
+ mysql_tmp_dir)) == 0)
+ {
+ master_running = TRUE;
+ }
+ else
+ {
+ log_error("The master server went down early.");
+ }
+ }
+ else
+ {
+ log_error("Unable to start master server.");
+ }
+
+ // free_args
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ start_slave()
+
+ Start the slave server.
+
+******************************************************************************/
+void start_slave()
+{
+ arg_list_t al;
+ int err;
+ char slave_out[PATH_MAX];
+ char slave_err[PATH_MAX];
+
+ // skip?
+ if (skip_slave) return;
+
+ // remove stale binary logs
+ removef("%s/*-bin.*", slave_dir);
+
+ // remove stale binary logs
+ removef("%s/*.index", slave_dir);
+
+ // remove master.info file
+ removef("%s/master.info", slave_dir);
+
+ // remove relay files
+ removef("%s/var/log/*relay*", mysql_test_dir);
+
+ // remove relay-log.info file
+ removef("%s/relay-log.info", slave_dir);
+
+ // init script
+ if (slave_init_script[0] != 0)
+ {
+#ifdef __NETWARE__
+ // TODO: use the scripts
+ if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0)
+ {
+ // create empty master.info file
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
+ }
+ else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0)
+ {
+ FILE *fp;
+
+ // create a master.info file
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ fp = fopen(temp, "wb+");
+
+ fputs("master-bin.000001\n", fp);
+ fputs("4\n", fp);
+ fputs("127.0.0.1\n", fp);
+ fputs("replicate\n", fp);
+ fputs("aaaaaaaaaaaaaaab\n", fp);
+ fputs("9306\n", fp);
+ fputs("1\n", fp);
+ fputs("0\n", fp);
+
+ fclose(fp);
+ }
+ else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0)
+ {
+ // create empty master.info file
+ snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
+ }
+#elif !defined(__WIN__)
+ run_init_script(slave_init_script);
+#endif
+ }
+
+ // redirection files
+ snprintf(slave_out, PATH_MAX, "%s/var/run/slave%u.out",
+ mysql_test_dir, restarts);
+ snprintf(slave_err, PATH_MAX, "%s/var/run/slave%u.err",
+ mysql_test_dir, restarts);
+
+ // args
+ init_args(&al);
+ add_arg(&al, "%s", mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--log-bin=slave-bin");
+ add_arg(&al, "--relay_log=slave-relay-bin");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--port=%u", slave_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s",slave_socket);
+#endif
+ add_arg(&al, "--datadir=%s", slave_dir);
+#ifndef __WIN__
+ add_arg(&al, "--pid-file=%s", slave_pid);
+#endif
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--core");
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+
+ add_arg(&al, "--exit-info=256");
+ add_arg(&al, "--log-slave-updates");
+ add_arg(&al, "--init-rpl-role=slave");
+ add_arg(&al, "--skip-innodb");
+ add_arg(&al, "--skip-slave-start");
+ add_arg(&al, "--slave-load-tmpdir=../../var/tmp");
+
+ add_arg(&al, "--report-user=%s", user);
+ add_arg(&al, "--report-host=127.0.0.1");
+ add_arg(&al, "--report-port=%u", slave_port);
+
+ add_arg(&al, "--master-retry-count=10");
+ add_arg(&al, "-O");
+ add_arg(&al, "slave_net_timeout=10");
+#ifdef DEBUG //only for debug builds
+ add_arg(&al, "--debug");
+#endif
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ // slave master info
+ if (slave_master_info[0] != 0)
+ {
+ char *p;
+
+ p = (char *)str_tok(slave_master_info, " \t");
+
+ while(p)
+ {
+ add_arg(&al, "%s", p);
+
+ p = (char *)str_tok(NULL, " \t");
+ }
+ }
+ else
+ {
+ add_arg(&al, "--master-user=%s", user);
+ add_arg(&al, "--master-password=%s", password);
+ add_arg(&al, "--master-host=127.0.0.1");
+ add_arg(&al, "--master-port=%u", master_port);
+ add_arg(&al, "--master-connect-retry=1");
+ add_arg(&al, "--server-id=2");
+ add_arg(&al, "--rpl-recovery-rank=2");
+ }
+
+ // small server
+ add_arg(&al, "-O");
+ add_arg(&al, "key_buffer_size=1M");
+ add_arg(&al, "-O");
+ add_arg(&al, "sort_buffer=256K");
+ add_arg(&al, "-O");
+ add_arg(&al, "max_heap_table_size=1M");
+
+
+ // opt args
+ if (slave_opt[0] != 0)
+ {
+ char *p;
+
+ p = (char *)str_tok(slave_opt, " \t");
+
+ while(p)
+ {
+ add_arg(&al, "%s", p);
+
+ p = (char *)str_tok(NULL, " \t");
+ }
+ }
+
+ // remove the pid file if it exists
+#ifndef __WIN__
+ remove(slave_pid);
+#endif
+ // spawn
+#ifdef __WIN__
+ if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err, &slave_pid)) == 0)
+#else
+ if ((err = spawn(mysqld_file, &al, FALSE, NULL, slave_out, slave_err, slave_pid)) == 0)
+#endif
+ {
+ sleep_until_file_exists(slave_pid);
+
+ if ((err = wait_for_server_start(bin_dir, mysqladmin_file, user, password, slave_port,
+ mysql_tmp_dir)) == 0)
+ {
+ slave_running = TRUE;
+ }
+ else
+ {
+ log_error("The slave server went down early.");
+ }
+ }
+ else
+ {
+ log_error("Unable to start slave server.");
+ }
+
+ // free args
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ mysql_start()
+
+ Start the mysql servers.
+
+******************************************************************************/
+void mysql_start()
+{
+// log_info("Starting the MySQL server(s): %u", ++restarts);
+ start_master();
+
+ start_slave();
+
+ // activate the test screen
+#ifdef __NETWARE__
+ ActivateScreen(getscreenhandle());
+#endif
+}
+
+/******************************************************************************
+
+ stop_slave()
+
+ Stop the slave server.
+
+******************************************************************************/
+void stop_slave()
+{
+ int err;
+
+ // running?
+ if (!slave_running) return;
+
+ // stop
+ if ((err = stop_server(bin_dir, mysqladmin_file, user, password, slave_port, slave_pid,
+ mysql_tmp_dir)) == 0)
+ {
+ slave_running = FALSE;
+ }
+ else
+ {
+ log_error("Unable to stop slave server.");
+ }
+}
+
+/******************************************************************************
+
+ stop_master()
+
+ Stop the master server.
+
+******************************************************************************/
+void stop_master()
+{
+ int err;
+
+ // running?
+ if (!master_running) return;
+
+ if ((err = stop_server(bin_dir, mysqladmin_file, user, password, master_port, master_pid,
+ mysql_tmp_dir)) == 0)
+ {
+ master_running = FALSE;
+ }
+ else
+ {
+ log_error("Unable to stop master server.");
+ }
+}
+
+/******************************************************************************
+
+ mysql_stop()
+
+ Stop the mysql servers.
+
+******************************************************************************/
+void mysql_stop()
+{
+
+ stop_master();
+
+ stop_slave();
+
+ // activate the test screen
+#ifdef __NETWARE__
+ ActivateScreen(getscreenhandle());
+#endif
+}
+
+/******************************************************************************
+
+ mysql_restart()
+
+ Restart the mysql servers.
+
+******************************************************************************/
+void mysql_restart()
+{
+// log_info("Restarting the MySQL server(s): %u", ++restarts);
+
+ mysql_stop();
+
+ mlog(DASH);
+
+ mysql_start();
+}
+
+/******************************************************************************
+
+ read_option()
+
+ Read the option file.
+
+******************************************************************************/
+int read_option(char *opt_file, char *opt)
+{
+ int fd, err;
+ char *p;
+ char buf[PATH_MAX];
+
+ // copy current option
+ strncpy(buf, opt, PATH_MAX);
+
+ // open options file
+ fd = open(opt_file, O_RDONLY);
+
+ err = read(fd, opt, PATH_MAX);
+
+ close(fd);
+
+ if (err > 0)
+ {
+ // terminate string
+ if ((p = strchr(opt, '\n')) != NULL)
+ {
+ *p = 0;
+
+ // check for a '\r'
+ if ((p = strchr(opt, '\r')) != NULL)
+ {
+ *p = 0;
+ }
+ }
+ else
+ {
+ opt[err] = 0;
+ }
+
+ // check for $MYSQL_TEST_DIR
+ if ((p = strstr(opt, "$MYSQL_TEST_DIR")) != NULL)
+ {
+ char temp[PATH_MAX];
+
+ *p = 0;
+
+ strcpy(temp, p + strlen("$MYSQL_TEST_DIR"));
+
+ strcat(opt, mysql_test_dir);
+
+ strcat(opt, temp);
+ }
+ // Check for double backslash and replace it with single bakslash
+ if ((p = strstr(opt, "\\\\")) != NULL)
+ {
+ /* bmove is guranteed to work byte by byte */
+ bmove(p, p+1, strlen(p+1));
+ }
+ }
+ else
+ {
+ // clear option
+ *opt = 0;
+ }
+
+ // compare current option with previous
+ return strcmp(opt, buf);
+}
+
+/******************************************************************************
+
+ run_test()
+
+ Run the given test case.
+
+******************************************************************************/
+void run_test(char *test)
+{
+ char temp[PATH_MAX];
+ const char *rstr;
+ int skip = FALSE, ignore=FALSE;
+ int restart = FALSE;
+ int flag = FALSE;
+ struct stat info;
+
+ // skip tests in the skip list
+ snprintf(temp, PATH_MAX, " %s ", test);
+ skip = (strinstr(skip_test, temp) != 0);
+ if (skip == FALSE)
+ ignore = (strinstr(ignore_test, temp) != 0);
+
+ snprintf(master_init_script, PATH_MAX, "%s/%s-master.sh", test_dir, test);
+ snprintf(slave_init_script, PATH_MAX, "%s/%s-slave.sh", test_dir, test);
+#ifdef __WIN__
+ if (! stat(master_init_script, &info))
+ skip = TRUE;
+ if (!stat(slave_init_script, &info))
+ skip = TRUE;
+#endif
+ if (ignore)
+ {
+ // show test
+ mlog("%-46s ", test);
+
+ // ignore
+ rstr = TEST_IGNORE;
+ ++total_ignore;
+ }
+ else if (!skip) // skip test?
+ {
+ char test_file[PATH_MAX];
+ char master_opt_file[PATH_MAX];
+ char slave_opt_file[PATH_MAX];
+ char slave_master_info_file[PATH_MAX];
+ char result_file[PATH_MAX];
+ char reject_file[PATH_MAX];
+ char out_file[PATH_MAX];
+ char err_file[PATH_MAX];
+ int err;
+ arg_list_t al;
+#ifdef __WIN__
+ /*
+ Clean test database
+ */
+ removef("%s/test/*.*", master_dir);
+ removef("%s/test/*.*", slave_dir);
+ removef("%s/mysqltest/*.*", master_dir);
+ removef("%s/mysqltest/*.*", slave_dir);
+
+#endif
+ // skip slave?
+ flag = skip_slave;
+ skip_slave = (strncmp(test, "rpl", 3) != 0);
+ if (flag != skip_slave) restart = TRUE;
+
+ // create files
+ snprintf(master_opt_file, PATH_MAX, "%s/%s-master.opt", test_dir, test);
+ snprintf(slave_opt_file, PATH_MAX, "%s/%s-slave.opt", test_dir, test);
+ snprintf(slave_master_info_file, PATH_MAX, "%s/%s.slave-mi", test_dir, test);
+ snprintf(reject_file, PATH_MAX, "%s/%s%s", result_dir, test, REJECT_SUFFIX);
+ snprintf(out_file, PATH_MAX, "%s/%s%s", result_dir, test, OUT_SUFFIX);
+ snprintf(err_file, PATH_MAX, "%s/%s%s", result_dir, test, ERR_SUFFIX);
+
+ // netware specific files
+ snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX);
+ if (stat(test_file, &info))
+ {
+ snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX);
+ if (access(test_file,0))
+ {
+ printf("Invalid test name %s, %s file not found\n",test,test_file);
+ return;
+ }
+ }
+
+ snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, NW_RESULT_SUFFIX);
+ if (stat(result_file, &info))
+ {
+ snprintf(result_file, PATH_MAX, "%s/%s%s", result_dir, test, RESULT_SUFFIX);
+ }
+
+ // init scripts
+ if (stat(master_init_script, &info))
+ master_init_script[0] = 0;
+ else
+ restart = TRUE;
+
+ if (stat(slave_init_script, &info))
+ slave_init_script[0] = 0;
+ else
+ restart = TRUE;
+
+ // read options
+ if (read_option(master_opt_file, master_opt)) restart = TRUE;
+ if (read_option(slave_opt_file, slave_opt)) restart = TRUE;
+ if (read_option(slave_master_info_file, slave_master_info)) restart = TRUE;
+
+ // cleanup previous run
+ remove(reject_file);
+ remove(out_file);
+ remove(err_file);
+
+ // start or restart?
+ if (!master_running) mysql_start();
+ else if (restart) mysql_restart();
+
+ // let the system stabalize
+ sleep(1);
+
+ // show test
+ mlog("%-46s ", test);
+
+
+ // args
+ init_args(&al);
+ add_arg(&al, "%s", mysqltest_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", master_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s", master_socket);
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+#endif
+ add_arg(&al, "--database=%s", db);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "--silent");
+ add_arg(&al, "--basedir=%s/", mysql_test_dir);
+ add_arg(&al, "--host=127.0.0.1");
+ add_arg(&al, "-v");
+ add_arg(&al, "-R");
+ add_arg(&al, "%s", result_file);
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", client_cert);
+ add_arg(&al, "--ssl-key=%s", client_key);
+ }
+
+ // spawn
+ err = spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL);
+
+ // free args
+ free_args(&al);
+
+ remove_empty_file(out_file);
+ remove_empty_file(err_file);
+
+ if (err == 0)
+ {
+ // pass
+ rstr = TEST_PASS;
+ ++total_pass;
+
+ // increment total
+ ++total_test;
+ }
+ else if (err == 2)
+ {
+ // skip
+ rstr = TEST_SKIP;
+ ++total_skip;
+ }
+ else if (err == 1)
+ {
+ // fail
+ rstr = TEST_FAIL;
+ ++total_fail;
+
+ // increment total
+ ++total_test;
+ }
+ else
+ {
+ rstr = TEST_BAD;
+ }
+ }
+ else // early skips
+ {
+ // show test
+ mlog("%-46s ", test);
+
+ // skip
+ rstr = TEST_SKIP;
+ ++total_skip;
+ }
+
+ // result
+ mlog("%-14s\n", rstr);
+}
+
+/******************************************************************************
+
+ vlog()
+
+ Log the message.
+
+******************************************************************************/
+void vlog(const char *format, va_list ap)
+{
+ vfprintf(stdout, format, ap);
+ fflush(stdout);
+
+ if (log_fd)
+ {
+ vfprintf(log_fd, format, ap);
+ fflush(log_fd);
+ }
+}
+
+/******************************************************************************
+
+ log()
+
+ Log the message.
+
+******************************************************************************/
+void mlog(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vlog(format, ap);
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_info()
+
+ Log the given information.
+
+******************************************************************************/
+void log_info(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- INFO : ");
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_error()
+
+ Log the given error.
+
+******************************************************************************/
+void log_error(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- ERROR: ");
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_errno()
+
+ Log the given error and errno.
+
+******************************************************************************/
+void log_errno(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- ERROR: (%003u) ", errno);
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ die()
+
+ Exit the application.
+
+******************************************************************************/
+void die(const char *msg)
+{
+ log_error(msg);
+#ifdef __NETWARE__
+ pressanykey();
+#endif
+ exit(-1);
+}
+
+/******************************************************************************
+
+ setup()
+
+ Setup the mysql test enviornment.
+
+******************************************************************************/
+void setup(char *file)
+{
+ char temp[PATH_MAX];
+ char file_path[PATH_MAX*2];
+ char *p;
+ int position;
+
+ // set the timezone for the timestamp test
+#ifdef __WIN__
+ _putenv( "TZ=GMT-3" );
+#else
+ setenv("TZ", "GMT-3", TRUE);
+#endif
+ // find base dir
+#ifdef __NETWARE__
+ strcpy(temp, strlwr(file));
+ while((p = strchr(temp, '\\')) != NULL) *p = '/';
+#else
+ getcwd(temp, PATH_MAX);
+ position = strlen(temp);
+ temp[position] = '/';
+ temp[position+1] = 0;
+#ifdef __WIN__
+ while((p = strchr(temp, '\\')) != NULL) *p = '/';
+#endif
+#endif
+
+ if ((position = strinstr(temp, "/mysql-test/")) != 0)
+ {
+ p = temp + position - 1;
+ *p = 0;
+ strcpy(base_dir, temp);
+ }
+
+ log_info("Currect directory: %s",base_dir);
+
+#ifdef __NETWARE__
+ // setup paths
+ snprintf(bin_dir, PATH_MAX, "%s/bin", base_dir);
+ snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
+ snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
+ snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir);
+ snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl = TRUE;
+#endif // HAVE_OPENSSL
+
+ // OpenSSL paths
+ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir);
+
+ // setup files
+ snprintf(mysqld_file, PATH_MAX, "%s/mysqld", bin_dir);
+ snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir);
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
+ snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir);
+ snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir);
+#elif __WIN__
+ // setup paths
+#ifdef _DEBUG
+ snprintf(bin_dir, PATH_MAX, "%s/client_debug", base_dir);
+#else
+ snprintf(bin_dir, PATH_MAX, "%s/client_release", base_dir);
+#endif
+ snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
+ snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
+ snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, PATH_MAX, "%s/share/english", base_dir);
+ snprintf(char_dir, PATH_MAX, "%s/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl = TRUE;
+#endif // HAVE_OPENSSL
+
+ // OpenSSL paths
+ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir);
+
+ // setup files
+ snprintf(mysqld_file, PATH_MAX, "%s/mysqld.exe", bin_dir);
+ snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest.exe", bin_dir);
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin.exe", bin_dir);
+#else
+ // setup paths
+ snprintf(bin_dir, PATH_MAX, "%s/client", base_dir);
+ snprintf(mysql_test_dir, PATH_MAX, "%s/mysql-test", base_dir);
+ snprintf(test_dir, PATH_MAX, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, PATH_MAX, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, PATH_MAX, "%s/r", mysql_test_dir);
+ snprintf(master_dir, PATH_MAX, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, PATH_MAX, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, PATH_MAX, "%s/sql/share/english", base_dir);
+ snprintf(char_dir, PATH_MAX, "%s/sql/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl = TRUE;
+#endif // HAVE_OPENSSL
+
+ // OpenSSL paths
+ snprintf(ca_cert, PATH_MAX, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, PATH_MAX, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, PATH_MAX, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, PATH_MAX, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, PATH_MAX, "%s/SSL/client-key.pem", base_dir);
+
+ // setup files
+ snprintf(mysqld_file, PATH_MAX, "%s/sql/mysqld", base_dir);
+ snprintf(mysqltest_file, PATH_MAX, "%s/mysqltest", bin_dir);
+ snprintf(mysqladmin_file, PATH_MAX, "%s/mysqladmin", bin_dir);
+ snprintf(master_pid, PATH_MAX, "%s/var/run/master.pid", mysql_test_dir);
+ snprintf(slave_pid, PATH_MAX, "%s/var/run/slave.pid", mysql_test_dir);
+
+ snprintf(master_socket,PATH_MAX, "%s/var/tmp/master.sock", mysql_test_dir);
+ snprintf(slave_socket,PATH_MAX, "%s/var/tmp/slave.sock", mysql_test_dir);
+
+#endif
+ // create log file
+ snprintf(temp, PATH_MAX, "%s/mysql-test-run.log", mysql_test_dir);
+ if ((log_fd = fopen(temp, "w+")) == NULL)
+ {
+ log_errno("Unable to create log file.");
+ }
+
+ // prepare skip test list
+ while((p = strchr(skip_test, ',')) != NULL) *p = ' ';
+ strcpy(temp, strlwr(skip_test));
+ snprintf(skip_test, PATH_MAX, " %s ", temp);
+
+ // environment
+#ifdef __NETWARE__
+ setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
+ snprintf(file_path, PATH_MAX*2, "%s/client/mysqldump --no-defaults -u root --port=%u", bin_dir, master_port);
+ setenv("MYSQL_DUMP", file_path, 1);
+ snprintf(file_path, PATH_MAX*2, "%s/client/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir);
+ setenv("MYSQL_BINLOG", file_path, 1);
+#elif __WIN__
+ snprintf(file_path,MAX_PATH,"MYSQL_TEST_DIR=%s",mysql_test_dir);
+ _putenv(file_path);
+ snprintf(file_path, PATH_MAX*2, "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -u root --port=%u", bin_dir, master_port);
+ _putenv(file_path);
+ snprintf(file_path, PATH_MAX*2, "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir);
+ _putenv(file_path);
+#else
+ setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
+ snprintf(file_path, PATH_MAX*2, "%s/mysqldump --no-defaults -u root --port=%u --socket=%s", bin_dir, master_port, master_socket);
+ setenv("MYSQL_DUMP", file_path, 1);
+ snprintf(file_path, PATH_MAX*2, "%s/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir);
+ setenv("MYSQL_BINLOG", file_path, 1);
+#endif
+
+#ifndef __WIN__
+ setenv("MASTER_MYPORT", "9306", 1);
+ setenv("SLAVE_MYPORT", "9307", 1);
+ setenv("MYSQL_TCP_PORT", "3306", 1);
+#else
+ _putenv("MASTER_MYPORT=9306");
+ _putenv("SLAVE_MYPORT=9307");
+ _putenv("MYSQL_TCP_PORT=3306");
+#endif
+
+}
+
+/******************************************************************************
+
+ main()
+
+******************************************************************************/
+int main(int argc, char **argv)
+{
+ int is_ignore_list = 0;
+ // setup
+ setup(argv[0]);
+
+ /* The --ignore option is comma saperated list of test cases to skip and
+ should be very first command line option to the test suite.
+
+ The usage is now:
+ mysql_test_run --ignore=test1,test2 test3 test4
+ where test1 and test2 are test cases to ignore
+ and test3 and test4 are test cases to run.
+ */
+ if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1))
+ {
+ char *temp, *token;
+ temp= strdup(strchr(argv[1],'=') + 1);
+ for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ","))
+ {
+ if (strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1)
+ sprintf(ignore_test+strlen(ignore_test), " %s ", token);
+ else
+ {
+ free(temp);
+ die("ignore list too long.");
+ }
+ }
+ free(temp);
+ is_ignore_list = 1;
+ }
+ // header
+#ifndef __WIN__
+ mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+#else
+ mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE);
+#endif
+
+ mlog("Initializing Tests...\n");
+
+ // install test databases
+ mysql_install_db();
+
+ mlog("Starting Tests...\n");
+
+ mlog("\n");
+ mlog(HEADER);
+ mlog(DASH);
+
+ if ( argc > 1 + is_ignore_list )
+ {
+ int i;
+
+ // single test
+ single_test = TRUE;
+
+ for (i = 1 + is_ignore_list; i < argc; i++)
+ {
+ // run given test
+ run_test(argv[i]);
+ }
+ }
+ else
+ {
+ // run all tests
+#ifndef __WIN__
+ struct dirent **namelist;
+ int i,n;
+ char test[NAME_MAX];
+ char *p;
+ int position;
+
+ n = scandir(test_dir, &namelist, 0, alphasort);
+ if (n < 0)
+ die("Unable to open tests directory.");
+ else
+ {
+ for (i = 0; i < n; i++)
+ {
+ strcpy(test, strlwr(namelist[i]->d_name));
+ // find the test suffix
+ if ((position = strinstr(test, TEST_SUFFIX)) != 0)
+ {
+ p = test + position - 1;
+ // null terminate at the suffix
+ *p = 0;
+ // run test
+ run_test(test);
+ }
+ free(namelist[n]);
+ }
+ free(namelist);
+ }
+#else
+ struct _finddata_t dir;
+ intptr_t handle;
+ char test[NAME_MAX];
+ char mask[PATH_MAX];
+ char *p;
+ int position;
+ char **names = 0;
+ char **testes = 0;
+ int name_index;
+ int index;
+
+ // single test
+ single_test = FALSE;
+
+ snprintf(mask,MAX_PATH,"%s/*.test",test_dir);
+
+ if ((handle=_findfirst(mask,&dir)) == -1L)
+ {
+ die("Unable to open tests directory.");
+ }
+
+ names = malloc(MAX_COUNT_TESTES*4);
+ testes = names;
+ name_index = 0;
+
+ do
+ {
+ if (!(dir.attrib & _A_SUBDIR))
+ {
+ strcpy(test, strlwr(dir.name));
+
+ // find the test suffix
+ if ((position = strinstr(test, TEST_SUFFIX)) != 0)
+ {
+ p = test + position - 1;
+ // null terminate at the suffix
+ *p = 0;
+
+ // insert test
+ *names = malloc(PATH_MAX);
+ strcpy(*names,test);
+ names++;
+ name_index++;
+ }
+ }
+ }while (_findnext(handle,&dir) == 0);
+
+ _findclose(handle);
+
+ qsort( (void *)testes, name_index, sizeof( char * ), compare );
+
+ for (index = 0; index <= name_index; index++)
+ {
+ run_test(testes[index]);
+ free(testes[index]);
+ }
+
+ free(testes);
+#endif
+ }
+
+ // stop server
+ mysql_stop();
+
+ mlog(DASH);
+ mlog("\n");
+
+ mlog("Ending Tests...\n");
+
+ // report stats
+ report_stats();
+
+ // close log
+ if (log_fd) fclose(log_fd);
+
+ // keep results up
+#ifdef __NETWARE__
+ pressanykey();
+#endif
+ return 0;
+}
+
+
+/*
+ Synopsis:
+ This function breaks the string into a sequence of tokens. The difference
+ between this function and strtok is that it respects the quoted string i.e.
+ it skips any delimiter character within the quoted part of the string.
+ It return tokens by eliminating quote character. It modifies the input string
+ passed. It will work with whitespace delimeter but may not work properly with
+ other delimeter. If the delimeter will contain any quote character, then
+ function will not tokenize and will return null string.
+ e.g. if input string is
+ --init-slave="set global max_connections=500" --skip-external-locking
+ then the output will two string i.e.
+ --init-slave=set global max_connections=500
+ --skip-external-locking
+
+Arguments:
+ string: input string
+ delim: set of delimiter character
+Output:
+ return the null terminated token of NULL.
+*/
+
+
+char *str_tok(char *string, const char *delim)
+{
+ char *token; /* current token received from strtok */
+ char *qt_token; /* token delimeted by the matching pair of quote */
+ /*
+ if there are any quote chars found in the token then this variable
+ will hold the concatenated string to return to the caller
+ */
+ char *ptr_token=NULL;
+ /* pointer to the quote character in the token from strtok */
+ char *ptr_quote=NULL;
+
+ /* See if the delimeter contains any quote character */
+ if (strchr(delim,'\'') || strchr(delim,'\"'))
+ return NULL;
+
+ /* repeate till we are getting some token from strtok */
+ while ((token = (char*)strtok(string, delim) ) != NULL)
+ {
+ /*
+ make the input string NULL so that next time onward strtok can
+ be called with NULL input string.
+ */
+ string = NULL;
+ /*
+ We don't need to remove any quote character for Windows version
+ */
+#ifndef __WIN__
+ /* check if the current token contain double quote character*/
+ if ((ptr_quote = (char*)strchr(token,'\"')) != NULL)
+ {
+ /*
+ get the matching the matching double quote in the remaining
+ input string
+ */
+ qt_token = (char*)strtok(NULL,"\"");
+ }
+ /* check if the current token contain single quote character*/
+ else if ((ptr_quote = (char*)strchr(token,'\'')) != NULL)
+ {
+ /*
+ get the matching the matching single quote in the remaining
+ input string
+ */
+ qt_token = (char*)strtok(NULL,"\'");
+ }
+#endif
+ /*
+ if the current token does not contains any quote character then
+ return to the caller.
+ */
+ if (ptr_quote == NULL)
+ {
+ /*
+ if there is any earlier token i.e. ptr_token then append the
+ current token in it and return it else return the current
+ token directly
+ */
+ return ptr_token ? strcat(ptr_token,token) : token;
+ }
+
+ /*
+ remove the quote character i.e. make NULL so that the token will
+ be devided in two part and later both part can be concatenated
+ and hence quote will be removed
+ */
+ *ptr_quote= 0;
+
+ /* check if ptr_token has been initialized or not */
+ if (ptr_token == NULL)
+ {
+ /* initialize the ptr_token with current token */
+ ptr_token= token;
+ /* copy entire string between matching pair of quote*/
+ sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token);
+ }
+ else
+ {
+ /*
+ copy the current token and entire string between matching pair
+ of quote
+ */
+ if (qt_token == NULL)
+ {
+ sprintf(ptr_token+strlen(ptr_token),"%s%s", token, ptr_quote+1);
+ }
+ else
+ {
+ sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1,
+ qt_token );
+ }
+ }
+ }
+
+ /* return the concatenated token */
+ return ptr_token;
+}
+
+#ifndef __WIN__
+
+/*
+ Synopsis:
+ This function run scripts files on Linux and Netware
+
+Arguments:
+ script_name: name of script file
+
+Output:
+ nothing
+*/
+void run_init_script(const char *script_name)
+{
+ arg_list_t al;
+ int err;
+
+ // args
+ init_args(&al);
+ add_arg(&al, sh_file);
+ add_arg(&al, script_name);
+
+ // spawn
+ if ((err = spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0)
+ {
+ die("Unable to run script.");
+ }
+
+ // free args
+ free_args(&al);
+}
+#endif
diff --git a/mysql-test/mysql_test_run_new.c b/mysql-test/mysql_test_run_new.c
new file mode 100644
index 00000000000..d8bf731b398
--- /dev/null
+++ b/mysql-test/mysql_test_run_new.c
@@ -0,0 +1,1769 @@
+/*
+ Copyright (c) 2002, 2003 Novell, Inc. All Rights Reserved.
+
+ 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 <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#ifndef __WIN__
+#include <dirent.h>
+#endif
+#include <string.h>
+#ifdef __NETWARE__
+#include <screen.h>
+#include <nks/vm.h>
+#endif
+#include <ctype.h>
+#include <sys/stat.h>
+#ifndef __WIN__
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+#ifdef __NETWARE__
+#include <sys/mode.h>
+#endif
+#ifdef __WIN__
+#include <Shlwapi.h>
+#include <direct.h>
+#endif
+
+#include "my_manage.h"
+
+/******************************************************************************
+
+ macros
+
+******************************************************************************/
+
+#define HEADER "TEST RESULT \n"
+#define DASH "-------------------------------------------------------\n"
+
+#define NW_TEST_SUFFIX ".nw-test"
+#define NW_RESULT_SUFFIX ".nw-result"
+#define TEST_SUFFIX ".test"
+#define RESULT_SUFFIX ".result"
+#define REJECT_SUFFIX ".reject"
+#define OUT_SUFFIX ".out"
+#define ERR_SUFFIX ".err"
+
+const char *TEST_PASS= "[ pass ]";
+const char *TEST_SKIP= "[ skip ]";
+const char *TEST_FAIL= "[ fail ]";
+const char *TEST_BAD= "[ bad ]";
+const char *TEST_IGNORE= "[ignore]";
+
+/******************************************************************************
+
+ global variables
+
+******************************************************************************/
+
+#ifdef __NETWARE__
+static char base_dir[FN_REFLEN]= "sys:/mysql";
+#else
+static char base_dir[FN_REFLEN]= "..";
+#endif
+static char db[FN_LEN]= "test";
+static char user[FN_LEN]= "root";
+static char password[FN_LEN]= "";
+
+int master_port= 9306;
+int slave_port= 9307;
+
+#if !defined(__NETWARE__) && !defined(__WIN__)
+static char master_socket[FN_REFLEN]= "./var/tmp/master.sock";
+static char slave_socket[FN_REFLEN]= "./var/tmp/slave.sock";
+#endif
+
+/* comma delimited list of tests to skip or empty string */
+#ifndef __WIN__
+static char skip_test[FN_REFLEN]= " lowercase_table3 , system_mysql_db_fix ";
+#else
+/*
+ The most ignore testes contain the calls of system command
+*/
+#define MAX_COUNT_TESTES 1024
+/*
+ lowercase_table3 is disabled by Gerg
+ system_mysql_db_fix is disabled by Gerg
+ sp contains a command system
+ rpl_EE_error contains a command system
+ rpl_loaddatalocal contains a command system
+ ndb_autodiscover contains a command system
+ rpl_rotate_logs contains a command system
+ repair contains a command system
+ rpl_trunc_binlog contains a command system
+ mysqldump contains a command system
+ rpl000001 makes non-exit loop...temporary skiped
+*/
+static char skip_test[FN_REFLEN]=
+" lowercase_table3 ,"
+" system_mysql_db_fix ,"
+" sp ,"
+" rpl_EE_error ,"
+" rpl_loaddatalocal ,"
+" ndb_autodiscover ,"
+" rpl_rotate_logs ,"
+" repair ,"
+" rpl_trunc_binlog ,"
+" mysqldump ,"
+" rpl000001 ";
+#endif
+static char ignore_test[FN_REFLEN]= "";
+
+static char bin_dir[FN_REFLEN];
+static char mysql_test_dir[FN_REFLEN];
+static char test_dir[FN_REFLEN];
+static char mysql_tmp_dir[FN_REFLEN];
+static char result_dir[FN_REFLEN];
+static char master_dir[FN_REFLEN];
+static char slave_dir[FN_REFLEN];
+static char lang_dir[FN_REFLEN];
+static char char_dir[FN_REFLEN];
+
+static char mysqladmin_file[FN_REFLEN];
+static char mysqld_file[FN_REFLEN];
+static char mysqltest_file[FN_REFLEN];
+#ifndef __WIN__
+static char master_pid[FN_REFLEN];
+static char slave_pid[FN_REFLEN];
+static char sh_file[FN_REFLEN]= "/bin/sh";
+#else
+static HANDLE master_pid;
+static HANDLE slave_pid;
+#endif
+
+static char master_opt[FN_REFLEN]= "";
+static char slave_opt[FN_REFLEN]= "";
+
+static char slave_master_info[FN_REFLEN]= "";
+
+static char master_init_script[FN_REFLEN]= "";
+static char slave_init_script[FN_REFLEN]= "";
+
+/* OpenSSL */
+static char ca_cert[FN_REFLEN];
+static char server_cert[FN_REFLEN];
+static char server_key[FN_REFLEN];
+static char client_cert[FN_REFLEN];
+static char client_key[FN_REFLEN];
+
+int total_skip= 0;
+int total_pass= 0;
+int total_fail= 0;
+int total_test= 0;
+
+int total_ignore= 0;
+
+int use_openssl= FALSE;
+int master_running= FALSE;
+int slave_running= FALSE;
+int skip_slave= TRUE;
+int single_test= TRUE;
+
+int restarts= 0;
+
+FILE *log_fd= NULL;
+
+/******************************************************************************
+
+ functions
+
+******************************************************************************/
+
+/******************************************************************************
+
+ prototypes
+
+******************************************************************************/
+
+void report_stats();
+void install_db(char *);
+void mysql_install_db();
+void start_master();
+void start_slave();
+void mysql_start();
+void stop_slave();
+void stop_master();
+void mysql_stop();
+void mysql_restart();
+int read_option(char *, char *);
+void run_test(char *);
+void setup(char *);
+void vlog(const char *, va_list);
+void mlog(const char *, ...);
+void log_info(const char *, ...);
+void log_error(const char *, ...);
+void log_errno(const char *, ...);
+void die(const char *);
+char *str_tok(char *string, const char *delim);
+#ifndef __WIN__
+void run_init_script(const char *script_name);
+#endif
+/******************************************************************************
+
+ report_stats()
+
+ Report the gathered statistics.
+
+******************************************************************************/
+
+void report_stats()
+{
+ if (total_fail == 0)
+ {
+ mlog("\nAll %d test(s) were successful.\n", total_test);
+ }
+ else
+ {
+ double percent= ((double)total_pass / total_test) * 100;
+
+ mlog("\nFailed %u/%u test(s), %.02f%% successful.\n",
+ total_fail, total_test, percent);
+ mlog("\nThe .out and .err files in %s may give you some\n", result_dir);
+ mlog("hint of what when wrong.\n");
+ mlog("\nIf you want to report this error, please first read "
+ "the documentation\n");
+ mlog("at: http://www.mysql.com/doc/M/y/MySQL_test_suite.html\n");
+ }
+}
+
+/******************************************************************************
+
+ install_db()
+
+ Install the a database.
+
+******************************************************************************/
+
+void install_db(char *datadir)
+{
+ arg_list_t al;
+ int err;
+ char input[FN_REFLEN];
+ char output[FN_REFLEN];
+ char error[FN_REFLEN];
+
+ /* input file */
+#ifdef __NETWARE__
+ snprintf(input, FN_REFLEN, "%s/bin/init_db.sql", base_dir);
+#else
+ snprintf(input, FN_REFLEN, "%s/mysql-test/init_db.sql", base_dir);
+#endif
+ snprintf(output, FN_REFLEN, "%s/install.out", datadir);
+ snprintf(error, FN_REFLEN, "%s/install.err", datadir);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--bootstrap");
+ add_arg(&al, "--skip-grant-tables");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--datadir=%s", datadir);
+ add_arg(&al, "--skip-innodb");
+ add_arg(&al, "--skip-bdb");
+#ifndef __NETWARE__
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+#endif
+
+ /* spawn */
+ if ((err= spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0)
+ {
+ die("Unable to create database.");
+ }
+
+ /* free args */
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ mysql_install_db()
+
+ Install the test databases.
+
+******************************************************************************/
+
+void mysql_install_db()
+{
+ char temp[FN_REFLEN];
+
+ /* var directory */
+ snprintf(temp, FN_REFLEN, "%s/var", mysql_test_dir);
+
+ /* clean up old direcotry */
+ del_tree(temp);
+
+ /* create var directory */
+#ifndef __WIN__
+ mkdir(temp, S_IRWXU);
+ /* create subdirectories */
+ mlog("Creating test-suite folders...\n");
+ snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir);
+ mkdir(temp, S_IRWXU);
+#else
+ mkdir(temp);
+ /* create subdirectories */
+ mlog("Creating test-suite folders...\n");
+ snprintf(temp, FN_REFLEN, "%s/var/run", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data/mysql", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir);
+ mkdir(temp);
+ snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir);
+ mkdir(temp);
+#endif
+
+ /* install databases */
+ mlog("Creating test databases for master... \n");
+ install_db(master_dir);
+ mlog("Creating test databases for slave... \n");
+ install_db(slave_dir);
+}
+
+/******************************************************************************
+
+ start_master()
+
+ Start the master server.
+
+******************************************************************************/
+
+void start_master()
+{
+ arg_list_t al;
+ int err;
+ char master_out[FN_REFLEN];
+ char master_err[FN_REFLEN];
+/* char temp[FN_REFLEN]; */
+ char temp2[FN_REFLEN];
+
+ /* remove old berkeley db log files that can confuse the server */
+ removef("%s/log.*", master_dir);
+
+ /* remove stale binary logs */
+ removef("%s/var/log/*-bin.*", mysql_test_dir);
+
+ /* remove stale binary logs */
+ removef("%s/var/log/*.index", mysql_test_dir);
+
+ /* remove master.info file */
+ removef("%s/master.info", master_dir);
+
+ /* remove relay files */
+ removef("%s/var/log/*relay*", mysql_test_dir);
+
+ /* remove relay-log.info file */
+ removef("%s/relay-log.info", master_dir);
+
+ /* init script */
+ if (master_init_script[0] != 0)
+ {
+#ifdef __NETWARE__
+ /* TODO: use the scripts */
+ if (strinstr(master_init_script, "repair_part2-master.sh") != 0)
+ {
+ FILE *fp;
+
+ /* create an empty index file */
+ snprintf(temp, FN_REFLEN, "%s/test/t1.MYI", master_dir);
+ fp= fopen(temp, "wb+");
+
+ fputs("1", fp);
+
+ fclose(fp);
+ }
+#elif !defined(__WIN__)
+ run_init_script(master_init_script);
+#endif
+ }
+
+ /* redirection files */
+ snprintf(master_out, FN_REFLEN, "%s/var/run/master%u.out",
+ mysql_test_dir, restarts);
+ snprintf(master_err, FN_REFLEN, "%s/var/run/master%u.err",
+ mysql_test_dir, restarts);
+#ifndef __WIN__
+ snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir);
+ mkdir(temp2,S_IRWXU);
+ snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir);
+ mkdir(temp2,S_IRWXU);
+#else
+ snprintf(temp2,FN_REFLEN,"%s/var",mysql_test_dir);
+ mkdir(temp2);
+ snprintf(temp2,FN_REFLEN,"%s/var/log",mysql_test_dir);
+ mkdir(temp2);
+#endif
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--log-bin=%s/var/log/master-bin",mysql_test_dir);
+ add_arg(&al, "--server-id=1");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--port=%u", master_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s",master_socket);
+#endif
+ add_arg(&al, "--local-infile");
+ add_arg(&al, "--core");
+ add_arg(&al, "--datadir=%s", master_dir);
+#ifndef __WIN__
+ add_arg(&al, "--pid-file=%s", master_pid);
+#endif
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+#ifdef DEBUG /* only for debug builds */
+ add_arg(&al, "--debug");
+#endif
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ /* $MASTER_40_ARGS */
+ add_arg(&al, "--rpl-recovery-rank=1");
+ add_arg(&al, "--init-rpl-role=master");
+
+ /* $SMALL_SERVER */
+ add_arg(&al, "-O");
+ add_arg(&al, "key_buffer_size=1M");
+ add_arg(&al, "-O");
+ add_arg(&al, "sort_buffer=256K");
+ add_arg(&al, "-O");
+ add_arg(&al, "max_heap_table_size=1M");
+
+ /* $EXTRA_MASTER_OPT */
+ if (master_opt[0] != 0)
+ {
+ char *p;
+
+ p= (char *)str_tok(master_opt, " \t");
+ if (!strstr(master_opt, "timezone"))
+ {
+ while (p)
+ {
+ add_arg(&al, "%s", p);
+ p= (char *)str_tok(NULL, " \t");
+ }
+ }
+ }
+
+ /* remove the pid file if it exists */
+#ifndef __WIN__
+ remove(master_pid);
+#endif
+
+ /* spawn */
+#ifdef __WIN__
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ master_out, master_err, &master_pid)) == 0)
+#else
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ master_out, master_err, master_pid)) == 0)
+#endif
+ {
+ sleep_until_file_exists(master_pid);
+
+ if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password,
+ master_port, mysql_tmp_dir)) == 0)
+ {
+ master_running= TRUE;
+ }
+ else
+ {
+ log_error("The master server went down early.");
+ }
+ }
+ else
+ {
+ log_error("Unable to start master server.");
+ }
+
+ /* free_args */
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ start_slave()
+
+ Start the slave server.
+
+******************************************************************************/
+
+void start_slave()
+{
+ arg_list_t al;
+ int err;
+ char slave_out[FN_REFLEN];
+ char slave_err[FN_REFLEN];
+
+ /* skip? */
+ if (skip_slave) return;
+
+ /* remove stale binary logs */
+ removef("%s/*-bin.*", slave_dir);
+
+ /* remove stale binary logs */
+ removef("%s/*.index", slave_dir);
+
+ /* remove master.info file */
+ removef("%s/master.info", slave_dir);
+
+ /* remove relay files */
+ removef("%s/var/log/*relay*", mysql_test_dir);
+
+ /* remove relay-log.info file */
+ removef("%s/relay-log.info", slave_dir);
+
+ /* init script */
+ if (slave_init_script[0] != 0)
+ {
+#ifdef __NETWARE__
+ /* TODO: use the scripts */
+ if (strinstr(slave_init_script, "rpl000016-slave.sh") != 0)
+ {
+ /* create empty master.info file */
+ snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
+ }
+ else if (strinstr(slave_init_script, "rpl000017-slave.sh") != 0)
+ {
+ FILE *fp;
+
+ /* create a master.info file */
+ snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
+ fp= fopen(temp, "wb+");
+
+ fputs("master-bin.000001\n", fp);
+ fputs("4\n", fp);
+ fputs("127.0.0.1\n", fp);
+ fputs("replicate\n", fp);
+ fputs("aaaaaaaaaaaaaaab\n", fp);
+ fputs("9306\n", fp);
+ fputs("1\n", fp);
+ fputs("0\n", fp);
+
+ fclose(fp);
+ }
+ else if (strinstr(slave_init_script, "rpl_rotate_logs-slave.sh") != 0)
+ {
+ /* create empty master.info file */
+ snprintf(temp, FN_REFLEN, "%s/master.info", slave_dir);
+ close(open(temp, O_WRONLY | O_CREAT,S_IRWXU|S_IRWXG|S_IRWXO));
+ }
+#elif !defined(__WIN__)
+ run_init_script(slave_init_script);
+#endif
+ }
+
+ /* redirection files */
+ snprintf(slave_out, FN_REFLEN, "%s/var/run/slave%u.out",
+ mysql_test_dir, restarts);
+ snprintf(slave_err, FN_REFLEN, "%s/var/run/slave%u.err",
+ mysql_test_dir, restarts);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqld_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--log-bin=slave-bin");
+ add_arg(&al, "--relay_log=slave-relay-bin");
+ add_arg(&al, "--basedir=%s", base_dir);
+ add_arg(&al, "--port=%u", slave_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s",slave_socket);
+#endif
+ add_arg(&al, "--datadir=%s", slave_dir);
+#ifndef __WIN__
+ add_arg(&al, "--pid-file=%s", slave_pid);
+#endif
+ add_arg(&al, "--character-sets-dir=%s", char_dir);
+ add_arg(&al, "--core");
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+ add_arg(&al, "--language=%s", lang_dir);
+
+ add_arg(&al, "--exit-info=256");
+ add_arg(&al, "--log-slave-updates");
+ add_arg(&al, "--init-rpl-role=slave");
+ add_arg(&al, "--skip-innodb");
+ add_arg(&al, "--skip-slave-start");
+ add_arg(&al, "--slave-load-tmpdir=../../var/tmp");
+
+ add_arg(&al, "--report-user=%s", user);
+ add_arg(&al, "--report-host=127.0.0.1");
+ add_arg(&al, "--report-port=%u", slave_port);
+
+ add_arg(&al, "--master-retry-count=10");
+ add_arg(&al, "-O");
+ add_arg(&al, "slave_net_timeout=10");
+#ifdef DEBUG /* only for debug builds */
+ add_arg(&al, "--debug");
+#endif
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", server_cert);
+ add_arg(&al, "--ssl-key=%s", server_key);
+ }
+
+ /* slave master info */
+ if (slave_master_info[0] != 0)
+ {
+ char *p;
+
+ p= (char *)str_tok(slave_master_info, " \t");
+
+ while (p)
+ {
+ add_arg(&al, "%s", p);
+ p= (char *)str_tok(NULL, " \t");
+ }
+ }
+ else
+ {
+ add_arg(&al, "--master-user=%s", user);
+ add_arg(&al, "--master-password=%s", password);
+ add_arg(&al, "--master-host=127.0.0.1");
+ add_arg(&al, "--master-port=%u", master_port);
+ add_arg(&al, "--master-connect-retry=1");
+ add_arg(&al, "--server-id=2");
+ add_arg(&al, "--rpl-recovery-rank=2");
+ }
+
+ /* small server */
+ add_arg(&al, "-O");
+ add_arg(&al, "key_buffer_size=1M");
+ add_arg(&al, "-O");
+ add_arg(&al, "sort_buffer=256K");
+ add_arg(&al, "-O");
+ add_arg(&al, "max_heap_table_size=1M");
+
+
+ /* opt args */
+ if (slave_opt[0] != 0)
+ {
+ char *p;
+
+ p= (char *)str_tok(slave_opt, " \t");
+
+ while (p)
+ {
+ add_arg(&al, "%s", p);
+ p= (char *)str_tok(NULL, " \t");
+ }
+ }
+
+ /* remove the pid file if it exists */
+#ifndef __WIN__
+ remove(slave_pid);
+#endif
+ /* spawn */
+#ifdef __WIN__
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ slave_out, slave_err, &slave_pid)) == 0)
+#else
+ if ((err= spawn(mysqld_file, &al, FALSE, NULL,
+ slave_out, slave_err, slave_pid)) == 0)
+#endif
+ {
+ sleep_until_file_exists(slave_pid);
+
+ if ((err= wait_for_server_start(bin_dir, mysqladmin_file, user, password,
+ slave_port, mysql_tmp_dir)) == 0)
+ {
+ slave_running= TRUE;
+ }
+ else
+ {
+ log_error("The slave server went down early.");
+ }
+ }
+ else
+ {
+ log_error("Unable to start slave server.");
+ }
+
+ /* free args */
+ free_args(&al);
+}
+
+/******************************************************************************
+
+ mysql_start()
+
+ Start the mysql servers.
+
+******************************************************************************/
+
+void mysql_start()
+{
+/* log_info("Starting the MySQL server(s): %u", ++restarts); */
+ start_master();
+
+ start_slave();
+
+ /* activate the test screen */
+#ifdef __NETWARE__
+ ActivateScreen(getscreenhandle());
+#endif
+}
+
+/******************************************************************************
+
+ stop_slave()
+
+ Stop the slave server.
+
+******************************************************************************/
+
+void stop_slave()
+{
+ int err;
+
+ /* running? */
+ if (!slave_running) return;
+
+ /* stop */
+ if ((err= stop_server(bin_dir, mysqladmin_file, user, password,
+ slave_port, slave_pid, mysql_tmp_dir)) == 0)
+ {
+ slave_running= FALSE;
+ }
+ else
+ {
+ log_error("Unable to stop slave server.");
+ }
+}
+
+/******************************************************************************
+
+ stop_master()
+
+ Stop the master server.
+
+******************************************************************************/
+
+void stop_master()
+{
+ int err;
+
+ /* running? */
+ if (!master_running) return;
+
+ if ((err= stop_server(bin_dir, mysqladmin_file, user, password,
+ master_port, master_pid, mysql_tmp_dir)) == 0)
+ {
+ master_running= FALSE;
+ }
+ else
+ {
+ log_error("Unable to stop master server.");
+ }
+}
+
+/******************************************************************************
+
+ mysql_stop()
+
+ Stop the mysql servers.
+
+******************************************************************************/
+
+void mysql_stop()
+{
+
+ stop_master();
+
+ stop_slave();
+
+ /* activate the test screen */
+#ifdef __NETWARE__
+ ActivateScreen(getscreenhandle());
+#endif
+}
+
+/******************************************************************************
+
+ mysql_restart()
+
+ Restart the mysql servers.
+
+******************************************************************************/
+
+void mysql_restart()
+{
+/* log_info("Restarting the MySQL server(s): %u", ++restarts); */
+
+ mysql_stop();
+
+ mlog(DASH);
+
+ mysql_start();
+}
+
+/******************************************************************************
+
+ read_option()
+
+ Read the option file.
+
+******************************************************************************/
+
+int read_option(char *opt_file, char *opt)
+{
+ int fd, err;
+ char *p;
+ char buf[FN_REFLEN];
+
+ /* copy current option */
+ strncpy(buf, opt, FN_REFLEN);
+
+ /* open options file */
+ fd= open(opt_file, O_RDONLY);
+ err= read(fd, opt, FN_REFLEN);
+ close(fd);
+
+ if (err > 0)
+ {
+ /* terminate string */
+ if ((p= strchr(opt, '\n')) != NULL)
+ {
+ *p= 0;
+
+ /* check for a '\r' */
+ if ((p= strchr(opt, '\r')) != NULL)
+ {
+ *p= 0;
+ }
+ }
+ else
+ {
+ opt[err]= 0;
+ }
+
+ /* check for $MYSQL_TEST_DIR */
+ if ((p= strstr(opt, "$MYSQL_TEST_DIR")) != NULL)
+ {
+ char temp[FN_REFLEN];
+
+ *p= 0;
+
+ strcpy(temp, p + strlen("$MYSQL_TEST_DIR"));
+ strcat(opt, mysql_test_dir);
+ strcat(opt, temp);
+ }
+ /* Check for double backslash and replace it with single bakslash */
+ if ((p= strstr(opt, "\\\\")) != NULL)
+ {
+ /* bmove is guranteed to work byte by byte */
+ bmove(p, p+1, strlen(p+1));
+ }
+ }
+ else
+ {
+ /* clear option */
+ *opt= 0;
+ }
+
+ /* compare current option with previous */
+ return strcmp(opt, buf);
+}
+
+/******************************************************************************
+
+ run_test()
+
+ Run the given test case.
+
+******************************************************************************/
+
+void run_test(char *test)
+{
+ char temp[FN_REFLEN];
+ const char *rstr;
+ int skip= FALSE, ignore=FALSE;
+ int restart= FALSE;
+ int flag= FALSE;
+ struct stat info;
+
+ /* skip tests in the skip list */
+ snprintf(temp, FN_REFLEN, " %s ", test);
+ skip= (strinstr(skip_test, temp) != 0);
+ if (skip == FALSE)
+ ignore= (strinstr(ignore_test, temp) != 0);
+
+ snprintf(master_init_script, FN_REFLEN, "%s/%s-master.sh", test_dir, test);
+ snprintf(slave_init_script, FN_REFLEN, "%s/%s-slave.sh", test_dir, test);
+#ifdef __WIN__
+ if (! stat(master_init_script, &info))
+ skip= TRUE;
+ if (!stat(slave_init_script, &info))
+ skip= TRUE;
+#endif
+ if (ignore)
+ {
+ /* show test */
+ mlog("%-46s ", test);
+
+ /* ignore */
+ rstr= TEST_IGNORE;
+ ++total_ignore;
+ }
+ else if (!skip) /* skip test? */
+ {
+ char test_file[FN_REFLEN];
+ char master_opt_file[FN_REFLEN];
+ char slave_opt_file[FN_REFLEN];
+ char slave_master_info_file[FN_REFLEN];
+ char result_file[FN_REFLEN];
+ char reject_file[FN_REFLEN];
+ char out_file[FN_REFLEN];
+ char err_file[FN_REFLEN];
+ int err;
+ arg_list_t al;
+#ifdef __WIN__
+ /* Clean test database */
+ removef("%s/test/*.*", master_dir);
+ removef("%s/test/*.*", slave_dir);
+ removef("%s/mysqltest/*.*", master_dir);
+ removef("%s/mysqltest/*.*", slave_dir);
+
+#endif
+ /* skip slave? */
+ flag= skip_slave;
+ skip_slave= (strncmp(test, "rpl", 3) != 0);
+ if (flag != skip_slave) restart= TRUE;
+
+ /* create files */
+ snprintf(master_opt_file, FN_REFLEN, "%s/%s-master.opt", test_dir, test);
+ snprintf(slave_opt_file, FN_REFLEN, "%s/%s-slave.opt", test_dir, test);
+ snprintf(slave_master_info_file, FN_REFLEN, "%s/%s.slave-mi",
+ test_dir, test);
+ snprintf(reject_file, FN_REFLEN, "%s/%s%s",
+ result_dir, test, REJECT_SUFFIX);
+ snprintf(out_file, FN_REFLEN, "%s/%s%s", result_dir, test, OUT_SUFFIX);
+ snprintf(err_file, FN_REFLEN, "%s/%s%s", result_dir, test, ERR_SUFFIX);
+
+ /* netware specific files */
+ snprintf(test_file, FN_REFLEN, "%s/%s%s", test_dir, test, NW_TEST_SUFFIX);
+ if (stat(test_file, &info))
+ {
+ snprintf(test_file, FN_REFLEN, "%s/%s%s", test_dir, test, TEST_SUFFIX);
+ if (access(test_file,0))
+ {
+ printf("Invalid test name %s, %s file not found\n",test,test_file);
+ return;
+ }
+ }
+
+ snprintf(result_file, FN_REFLEN, "%s/%s%s",
+ result_dir, test, NW_RESULT_SUFFIX);
+ if (stat(result_file, &info))
+ {
+ snprintf(result_file, FN_REFLEN, "%s/%s%s",
+ result_dir, test, RESULT_SUFFIX);
+ }
+
+ /* init scripts */
+ if (stat(master_init_script, &info))
+ master_init_script[0]= 0;
+ else
+ restart= TRUE;
+
+ if (stat(slave_init_script, &info))
+ slave_init_script[0]= 0;
+ else
+ restart= TRUE;
+
+ /* read options */
+ if (read_option(master_opt_file, master_opt)) restart= TRUE;
+ if (read_option(slave_opt_file, slave_opt)) restart= TRUE;
+ if (read_option(slave_master_info_file, slave_master_info)) restart= TRUE;
+
+ /* cleanup previous run */
+ remove(reject_file);
+ remove(out_file);
+ remove(err_file);
+
+ /* start or restart? */
+ if (!master_running) mysql_start();
+ else if (restart) mysql_restart();
+
+ /* let the system stabalize */
+ sleep(1);
+
+ /* show test */
+ mlog("%-46s ", test);
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, "%s", mysqltest_file);
+ add_arg(&al, "--no-defaults");
+ add_arg(&al, "--port=%u", master_port);
+#if !defined(__NETWARE__) && !defined(__WIN__)
+ add_arg(&al, "--socket=%s", master_socket);
+ add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
+#endif
+ add_arg(&al, "--database=%s", db);
+ add_arg(&al, "--user=%s", user);
+ add_arg(&al, "--password=%s", password);
+ add_arg(&al, "--silent");
+ add_arg(&al, "--basedir=%s/", mysql_test_dir);
+ add_arg(&al, "--host=127.0.0.1");
+ add_arg(&al, "-v");
+ add_arg(&al, "-R");
+ add_arg(&al, "%s", result_file);
+
+ if (use_openssl)
+ {
+ add_arg(&al, "--ssl-ca=%s", ca_cert);
+ add_arg(&al, "--ssl-cert=%s", client_cert);
+ add_arg(&al, "--ssl-key=%s", client_key);
+ }
+
+ /* spawn */
+ err= spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL);
+
+ /* free args */
+ free_args(&al);
+
+ remove_empty_file(out_file);
+ remove_empty_file(err_file);
+
+ if (err == 0)
+ {
+ /* pass */
+ rstr= TEST_PASS;
+ ++total_pass;
+
+ /* increment total */
+ ++total_test;
+ }
+ else if (err == 2)
+ {
+ /* skip */
+ rstr= TEST_SKIP;
+ ++total_skip;
+ }
+ else if (err == 1)
+ {
+ /* fail */
+ rstr= TEST_FAIL;
+ ++total_fail;
+
+ /* increment total */
+ ++total_test;
+ }
+ else
+ {
+ rstr= TEST_BAD;
+ }
+ }
+ else /* early skips */
+ {
+ /* show test */
+ mlog("%-46s ", test);
+
+ /* skip */
+ rstr= TEST_SKIP;
+ ++total_skip;
+ }
+
+ /* result */
+ mlog("%-14s\n", rstr);
+}
+
+/******************************************************************************
+
+ vlog()
+
+ Log the message.
+
+******************************************************************************/
+
+void vlog(const char *format, va_list ap)
+{
+ vfprintf(stdout, format, ap);
+ fflush(stdout);
+
+ if (log_fd)
+ {
+ vfprintf(log_fd, format, ap);
+ fflush(log_fd);
+ }
+}
+
+/******************************************************************************
+
+ log()
+
+ Log the message.
+
+******************************************************************************/
+
+void mlog(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ vlog(format, ap);
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_info()
+
+ Log the given information.
+
+******************************************************************************/
+
+void log_info(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- INFO : ");
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_error()
+
+ Log the given error.
+
+******************************************************************************/
+
+void log_error(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- ERROR: ");
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ log_errno()
+
+ Log the given error and errno.
+
+******************************************************************************/
+
+void log_errno(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+
+ mlog("-- ERROR: (%003u) ", errno);
+ vlog(format, ap);
+ mlog("\n");
+
+ va_end(ap);
+}
+
+/******************************************************************************
+
+ die()
+
+ Exit the application.
+
+******************************************************************************/
+
+void die(const char *msg)
+{
+ log_error(msg);
+#ifdef __NETWARE__
+ pressanykey();
+#endif
+ exit(-1);
+}
+
+/******************************************************************************
+
+ setup()
+
+ Setup the mysql test enviornment.
+
+******************************************************************************/
+
+void setup(char *file __attribute__((unused)))
+{
+ char temp[FN_REFLEN];
+ char file_path[FN_REFLEN*2];
+ char *p;
+ int position;
+
+ /* set the timezone for the timestamp test */
+#ifdef __WIN__
+ _putenv( "TZ=GMT-3" );
+#else
+ putenv((char *)"TZ=GMT-3");
+#endif
+ /* find base dir */
+#ifdef __NETWARE__
+ strcpy(temp, strlwr(file));
+ while ((p= strchr(temp, '\\')) != NULL) *p= '/';
+#else
+ getcwd(temp, FN_REFLEN);
+ position= strlen(temp);
+ temp[position]= '/';
+ temp[position+1]= 0;
+#ifdef __WIN__
+ while ((p= strchr(temp, '\\')) != NULL) *p= '/';
+#endif
+#endif
+
+ if ((position= strinstr(temp, "/mysql-test/")) != 0)
+ {
+ p= temp + position - 1;
+ *p= 0;
+ strcpy(base_dir, temp);
+ }
+
+ log_info("Currect directory: %s",base_dir);
+
+#ifdef __NETWARE__
+ /* setup paths */
+ snprintf(bin_dir, FN_REFLEN, "%s/bin", base_dir);
+ snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
+ snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
+ snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir);
+ snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl= TRUE;
+#endif /* HAVE_OPENSSL */
+
+ /* OpenSSL paths */
+ snprintf(ca_cert, FN_REFLEN, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, FN_REFLEN, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, FN_REFLEN, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, FN_REFLEN, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, FN_REFLEN, "%s/SSL/client-key.pem", base_dir);
+
+ /* setup files */
+ snprintf(mysqld_file, FN_REFLEN, "%s/mysqld", bin_dir);
+ snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir);
+ snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir);
+ snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir);
+ snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir);
+#elif __WIN__
+ /* setup paths */
+#ifdef _DEBUG
+ snprintf(bin_dir, FN_REFLEN, "%s/client_debug", base_dir);
+#else
+ snprintf(bin_dir, FN_REFLEN, "%s/client_release", base_dir);
+#endif
+ snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
+ snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
+ snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, FN_REFLEN, "%s/share/english", base_dir);
+ snprintf(char_dir, FN_REFLEN, "%s/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl= TRUE;
+#endif /* HAVE_OPENSSL */
+
+ /* OpenSSL paths */
+ snprintf(ca_cert, FN_REFLEN, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, FN_REFLEN, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, FN_REFLEN, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, FN_REFLEN, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, FN_REFLEN, "%s/SSL/client-key.pem", base_dir);
+
+ /* setup files */
+ snprintf(mysqld_file, FN_REFLEN, "%s/mysqld.exe", bin_dir);
+ snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest.exe", bin_dir);
+ snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin.exe", bin_dir);
+#else
+ /* setup paths */
+ snprintf(bin_dir, FN_REFLEN, "%s/client", base_dir);
+ snprintf(mysql_test_dir, FN_REFLEN, "%s/mysql-test", base_dir);
+ snprintf(test_dir, FN_REFLEN, "%s/t", mysql_test_dir);
+ snprintf(mysql_tmp_dir, FN_REFLEN, "%s/var/tmp", mysql_test_dir);
+ snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
+ snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
+ snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
+ snprintf(lang_dir, FN_REFLEN, "%s/sql/share/english", base_dir);
+ snprintf(char_dir, FN_REFLEN, "%s/sql/share/charsets", base_dir);
+
+#ifdef HAVE_OPENSSL
+ use_openssl= TRUE;
+#endif /* HAVE_OPENSSL */
+
+ /* OpenSSL paths */
+ snprintf(ca_cert, FN_REFLEN, "%s/SSL/cacert.pem", base_dir);
+ snprintf(server_cert, FN_REFLEN, "%s/SSL/server-cert.pem", base_dir);
+ snprintf(server_key, FN_REFLEN, "%s/SSL/server-key.pem", base_dir);
+ snprintf(client_cert, FN_REFLEN, "%s/SSL/client-cert.pem", base_dir);
+ snprintf(client_key, FN_REFLEN, "%s/SSL/client-key.pem", base_dir);
+
+ /* setup files */
+ snprintf(mysqld_file, FN_REFLEN, "%s/sql/mysqld", base_dir);
+ snprintf(mysqltest_file, FN_REFLEN, "%s/mysqltest", bin_dir);
+ snprintf(mysqladmin_file, FN_REFLEN, "%s/mysqladmin", bin_dir);
+ snprintf(master_pid, FN_REFLEN, "%s/var/run/master.pid", mysql_test_dir);
+ snprintf(slave_pid, FN_REFLEN, "%s/var/run/slave.pid", mysql_test_dir);
+
+ snprintf(master_socket,FN_REFLEN, "%s/var/tmp/master.sock", mysql_test_dir);
+ snprintf(slave_socket,FN_REFLEN, "%s/var/tmp/slave.sock", mysql_test_dir);
+
+#endif
+ /* create log file */
+ snprintf(temp, FN_REFLEN, "%s/mysql-test-run.log", mysql_test_dir);
+ if ((log_fd= fopen(temp, "w+")) == NULL)
+ {
+ log_errno("Unable to create log file.");
+ }
+
+ /* prepare skip test list */
+ while ((p= strchr(skip_test, ',')) != NULL) *p= ' ';
+ strcpy(temp, strlwr(skip_test));
+ snprintf(skip_test, FN_REFLEN, " %s ", temp);
+
+ /* environment */
+#ifdef __NETWARE__
+ setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
+ snprintf(file_path, FN_REFLEN*2,
+ "%s/client/mysqldump --no-defaults -u root --port=%u",
+ bin_dir, master_port);
+ setenv("MYSQL_DUMP", file_path, 1);
+ snprintf(file_path, FN_REFLEN*2,
+ "%s/client/mysqlbinlog --no-defaults --local-load=%s",
+ bin_dir, mysql_tmp_dir);
+ setenv("MYSQL_BINLOG", file_path, 1);
+#elif __WIN__
+ snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir);
+ _putenv(file_path);
+ snprintf(file_path, FN_REFLEN*2,
+ "MYSQL_DUMP=%s/mysqldump.exe --no-defaults -u root --port=%u",
+ bin_dir, master_port);
+ _putenv(file_path);
+ snprintf(file_path, FN_REFLEN*2,
+ "MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s",
+ bin_dir, mysql_tmp_dir);
+ _putenv(file_path);
+#else
+ snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir);
+ putenv(file_path);
+ snprintf(file_path, FN_REFLEN*2,
+ "MYSQL_DUMP=%s/mysqldump --no-defaults -u root --port=%u --socket=%s",
+ bin_dir, master_port, master_socket);
+ putenv(file_path);
+ snprintf(file_path, FN_REFLEN*2,
+ "MYSQL_BINLOG=%s/mysqlbinlog --no-defaults --local-load=%s",
+ bin_dir, mysql_tmp_dir);
+ putenv(file_path);
+#endif
+
+#ifndef __WIN__
+ putenv((char *)"MASTER_MYPORT=9306");
+ putenv((char *)"SLAVE_MYPORT=9307");
+ putenv((char *)"MYSQL_TCP_PORT=3306");
+#else
+ _putenv("MASTER_MYPORT=9306");
+ _putenv("SLAVE_MYPORT=9307");
+ _putenv("MYSQL_TCP_PORT=3306");
+#endif
+
+}
+
+/******************************************************************************
+
+ main()
+
+******************************************************************************/
+
+int main(int argc, char **argv)
+{
+ int is_ignore_list= 0;
+ /* setup */
+ setup(argv[0]);
+
+ /*
+ The --ignore option is comma saperated list of test cases to skip and
+ should be very first command line option to the test suite.
+
+ The usage is now:
+ mysql_test_run --ignore=test1,test2 test3 test4
+ where test1 and test2 are test cases to ignore
+ and test3 and test4 are test cases to run.
+ */
+ if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1))
+ {
+ char *temp, *token;
+ temp= strdup(strchr(argv[1],'=') + 1);
+ for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ","))
+ {
+ if (strlen(ignore_test) + strlen(token) + 2 <= FN_REFLEN-1)
+ sprintf(ignore_test+strlen(ignore_test), " %s ", token);
+ else
+ {
+ free(temp);
+ die("ignore list too long.");
+ }
+ }
+ free(temp);
+ is_ignore_list= 1;
+ }
+ /* header */
+#ifndef __WIN__
+ mlog("MySQL Server %s, for %s (%s)\n\n", VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+#else
+ mlog("MySQL Server ---, for %s (%s)\n\n", SYSTEM_TYPE, MACHINE_TYPE);
+#endif
+
+ mlog("Initializing Tests...\n");
+
+ /* install test databases */
+ mysql_install_db();
+
+ mlog("Starting Tests...\n");
+
+ mlog("\n");
+ mlog(HEADER);
+ mlog(DASH);
+
+ if ( argc > 1 + is_ignore_list )
+ {
+ int i;
+
+ /* single test */
+ single_test= TRUE;
+
+ for (i= 1 + is_ignore_list; i < argc; i++)
+ {
+ /* run given test */
+ run_test(argv[i]);
+ }
+ }
+ else
+ {
+ /* run all tests */
+#ifndef __WIN__
+ struct dirent *entry;
+ DIR *parent;
+ char test[FN_LEN];
+ int position;
+
+ /* FIXME are we sure the list is sorted if using readdir()? */
+ if ((parent= opendir(test_dir)) == NULL) /* Not thread safe */
+ die("Unable to open tests directory.");
+ else
+ {
+ while ((entry= readdir(parent)) != NULL) /* Not thread safe */
+ {
+ strcpy(test, strlwr(entry->d_name));
+ /* find the test suffix */
+ if ((position= strinstr(test, TEST_SUFFIX)) != 0)
+ {
+ /* null terminate at the suffix */
+ *(test + position - 1)= '\0';
+ /* run test */
+ run_test(test);
+ }
+ }
+ closedir(parent);
+ }
+#else
+ struct _finddata_t dir;
+ intptr_t handle;
+ char test[FN_LEN];
+ char mask[FN_REFLEN];
+ char *p;
+ int position;
+ char **names= 0;
+ char **testes= 0;
+ int name_index;
+ int index;
+
+ /* single test */
+ single_test= FALSE;
+
+ snprintf(mask,FN_REFLEN,"%s/*.test",test_dir);
+
+ if ((handle=_findfirst(mask,&dir)) == -1L)
+ {
+ die("Unable to open tests directory.");
+ }
+
+ names= malloc(MAX_COUNT_TESTES*4);
+ testes= names;
+ name_index= 0;
+
+ do
+ {
+ if (!(dir.attrib & _A_SUBDIR))
+ {
+ strcpy(test, strlwr(dir.name));
+
+ /* find the test suffix */
+ if ((position= strinstr(test, TEST_SUFFIX)) != 0)
+ {
+ p= test + position - 1;
+ /* null terminate at the suffix */
+ *p= 0;
+
+ /* insert test */
+ *names= malloc(FN_REFLEN);
+ strcpy(*names,test);
+ names++;
+ name_index++;
+ }
+ }
+ }while (_findnext(handle,&dir) == 0);
+
+ _findclose(handle);
+
+ qsort( (void *)testes, name_index, sizeof( char * ), compare );
+
+ for (index= 0; index <= name_index; index++)
+ {
+ run_test(testes[index]);
+ free(testes[index]);
+ }
+
+ free(testes);
+#endif
+ }
+
+ /* stop server */
+ mysql_stop();
+
+ mlog(DASH);
+ mlog("\n");
+
+ mlog("Ending Tests...\n");
+
+ /* report stats */
+ report_stats();
+
+ /* close log */
+ if (log_fd) fclose(log_fd);
+
+ /* keep results up */
+#ifdef __NETWARE__
+ pressanykey();
+#endif
+ return 0;
+}
+
+
+/*
+ Synopsis:
+ This function breaks the string into a sequence of tokens. The difference
+ between this function and strtok is that it respects the quoted string i.e.
+ it skips any delimiter character within the quoted part of the string.
+ It return tokens by eliminating quote character. It modifies the input string
+ passed. It will work with whitespace delimeter but may not work properly with
+ other delimeter. If the delimeter will contain any quote character, then
+ function will not tokenize and will return null string.
+ e.g. if input string is
+ --init-slave="set global max_connections=500" --skip-external-locking
+ then the output will two string i.e.
+ --init-slave=set global max_connections=500
+ --skip-external-locking
+
+Arguments:
+ string: input string
+ delim: set of delimiter character
+Output:
+ return the null terminated token of NULL.
+*/
+
+char *str_tok(char *string, const char *delim)
+{
+ char *token; /* current token received from strtok */
+ char *qt_token; /* token delimeted by the matching pair of quote */
+ /*
+ if there are any quote chars found in the token then this variable
+ will hold the concatenated string to return to the caller
+ */
+ char *ptr_token=NULL;
+ /* pointer to the quote character in the token from strtok */
+ char *ptr_quote=NULL;
+
+ /* See if the delimeter contains any quote character */
+ if (strchr(delim,'\'') || strchr(delim,'\"'))
+ return NULL;
+
+ /* repeate till we are getting some token from strtok */
+ while ((token= (char*)strtok(string, delim) ) != NULL)
+ {
+ /*
+ make the input string NULL so that next time onward strtok can
+ be called with NULL input string.
+ */
+ string= NULL;
+ /* We don't need to remove any quote character for Windows version */
+#ifndef __WIN__
+ /* check if the current token contain double quote character*/
+ if ((ptr_quote= (char*)strchr(token,'\"')) != NULL)
+ {
+ /*
+ get the matching the matching double quote in the remaining
+ input string
+ */
+ qt_token= (char*)strtok(NULL,"\"");
+ }
+ /* check if the current token contain single quote character*/
+ else if ((ptr_quote= (char*)strchr(token,'\'')) != NULL)
+ {
+ /*
+ get the matching the matching single quote in the remaining
+ input string
+ */
+ qt_token= (char*)strtok(NULL,"\'");
+ }
+#endif
+ /*
+ if the current token does not contains any quote character then
+ return to the caller.
+ */
+ if (ptr_quote == NULL)
+ {
+ /*
+ if there is any earlier token i.e. ptr_token then append the
+ current token in it and return it else return the current
+ token directly
+ */
+ return ptr_token ? strcat(ptr_token,token) : token;
+ }
+
+ /*
+ remove the quote character i.e. make NULL so that the token will
+ be devided in two part and later both part can be concatenated
+ and hence quote will be removed
+ */
+ *ptr_quote= 0;
+
+ /* check if ptr_token has been initialized or not */
+ if (ptr_token == NULL)
+ {
+ /* initialize the ptr_token with current token */
+ ptr_token= token;
+ /* copy entire string between matching pair of quote*/
+ sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token);
+ }
+ else
+ {
+ /*
+ copy the current token and entire string between matching pair
+ of quote
+ */
+ if (qt_token == NULL)
+ {
+ sprintf(ptr_token+strlen(ptr_token),"%s%s", token, ptr_quote+1);
+ }
+ else
+ {
+ sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1,
+ qt_token );
+ }
+ }
+ }
+
+ /* return the concatenated token */
+ return ptr_token;
+}
+
+#ifndef __WIN__
+
+/*
+ Synopsis:
+ This function run scripts files on Linux and Netware
+
+Arguments:
+ script_name: name of script file
+
+Output:
+ nothing
+*/
+
+void run_init_script(const char *script_name)
+{
+ arg_list_t al;
+ int err;
+
+ /* args */
+ init_args(&al);
+ add_arg(&al, sh_file);
+ add_arg(&al, script_name);
+
+ /* spawn */
+ if ((err= spawn(sh_file, &al, TRUE, NULL, NULL, NULL, NULL)) != 0)
+ {
+ die("Unable to run script.");
+ }
+
+ /* free args */
+ free_args(&al);
+}
+#endif
diff --git a/mysql-test/ndb/Makefile.am b/mysql-test/ndb/Makefile.am
index 3ed222344a6..502ccee099e 100644
--- a/mysql-test/ndb/Makefile.am
+++ b/mysql-test/ndb/Makefile.am
@@ -13,6 +13,8 @@ SUFFIXES = .sh
.sh:
@RM@ -f $@ $@-t
@SED@ \
+ -e 's!@''ndb_port''@!$(ndb_port)!g' \
+ -e 's!@''ndb_port_base''@!$(ndb_port_base)!g' \
-e 's!@''ndbbindir''@!$(ndbbindir)!g' \
-e 's!@''ndbtoolsdir''@!$(ndbtoolsdir)!g' \
$< > $@-t
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
index 9c6b6093b93..60188705857 100644
--- a/mysql-test/ndb/ndbcluster.sh
+++ b/mysql-test/ndb/ndbcluster.sh
@@ -5,7 +5,8 @@
# This scripts starts the table handler ndbcluster
# configurable parameters, make sure to change in mysqlcluterd as well
-port_base="2200"
+port=@ndb_port@
+port_base=@ndb_port_base@
fsdir=`pwd`
# end configurable parameters
@@ -22,6 +23,7 @@ if [ -d ../sql ] ; then
exec_ndb=$ndbtop/src/kernel/ndbd
exec_mgmtsrvr=$ndbtop/src/mgmsrv/ndb_mgmd
exec_waiter=$ndbtop/tools/ndb_waiter
+ exec_test=$ndbtop/tools/ndb_test_platform
exec_mgmtclient=$ndbtop/src/mgmclient/ndb_mgm
else
BINARY_DIST=1
@@ -34,9 +36,15 @@ else
exec_mgmtsrvr=$BASEDIR/bin/ndb_mgmd
fi
exec_waiter=$BASEDIR/bin/ndb_waiter
+ exec_test=$BASEDIR/bin/ndb_test_platform
exec_mgmtclient=$BASEDIR/bin/ndb_mgm
fi
+if $exec_test ; then :; else
+ echo "ndb not correctly compiled to support this platform"
+ exit 1
+fi
+
pidfile=ndbcluster.pid
cfgfile=Ndb.cfg
stop_ndb=
@@ -77,6 +85,9 @@ while test $# -gt 0; do
--data-dir=*)
fsdir=`echo "$1" | sed -e "s;--data-dir=;;"`
;;
+ --port=*)
+ port=`echo "$1" | sed -e "s;--port=;;"`
+ ;;
--port-base=*)
port_base=`echo "$1" | sed -e "s;--port-base=;;"`
;;
@@ -87,7 +98,7 @@ while test $# -gt 0; do
shift
done
-fs_ndb="$fsdir/ndbcluster-$port_base"
+fs_ndb="$fsdir/ndbcluster-$port"
NDB_HOME=
if [ ! -x "$fsdir" ]; then
@@ -113,7 +124,7 @@ exec_ndb="$exec_ndb --no-defaults"
exec_waiter="$exec_waiter --no-defaults"
ndb_host="localhost"
-ndb_mgmd_port=$port_base
+ndb_mgmd_port=$port
NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port"
export NDB_CONNECTSTRING
@@ -151,10 +162,6 @@ if [ -d "$fs_ndb" ]; then :; else
exit 1
fi
-# set som help variables
-
-port_transporter=`expr $ndb_mgmd_port + 2`
-
# Start management server as deamon
# Edit file system path and ports in config file
@@ -169,7 +176,7 @@ sed \
-e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \
-e s,"CHOOSE_FILESYSTEM","$fs_ndb",g \
-e s,"CHOOSE_PORT_MGM","$ndb_mgmd_port",g \
- -e s,"CHOOSE_PORT_TRANSPORTER","$port_transporter",g \
+ -e s,"CHOOSE_PORT_TRANSPORTER","$port_base",g \
< ndb/ndb_config_2_node.ini \
> "$fs_ndb/config.ini"
fi
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 89b8bd66848..9e14ca85a29 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -483,3 +483,13 @@ ERROR 42000: Incorrect table name 't1\\'
rename table t1 to `t1\\`;
ERROR 42000: Incorrect table name 't1\\'
drop table t1;
+create table t1 (a text) character set koi8r;
+insert into t1 values (_koi8r'ÔÅÓÔ');
+select hex(a) from t1;
+hex(a)
+D4C5D3D4
+alter table t1 convert to character set cp1251;
+select hex(a) from t1;
+hex(a)
+F2E5F1F2
+drop table t1;
diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result
index 405de1158d6..5b5f673b071 100644
--- a/mysql-test/r/binary.result
+++ b/mysql-test/r/binary.result
@@ -134,3 +134,10 @@ select * from t1 where firstname='john' and firstname like binary 'John';
firstname lastname
John Doe
drop table t1;
+create table t1 (a binary);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` binary(1) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/consistent_snapshot.result b/mysql-test/r/consistent_snapshot.result
new file mode 100644
index 00000000000..90606abbe4e
--- /dev/null
+++ b/mysql-test/r/consistent_snapshot.result
@@ -0,0 +1,15 @@
+drop table if exists t1;
+create table t1 (a int) engine=innodb;
+start transaction with consistent snapshot;
+insert into t1 values(1);
+select * from t1;
+a
+commit;
+delete from t1;
+start transaction;
+insert into t1 values(1);
+select * from t1;
+a
+1
+commit;
+drop table t1;
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index 44fad0cd96a..789b6e586ad 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -1,10 +1,58 @@
drop table if exists t1;
-SET NAMES big5;
-CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
+SET @test_character_set= 'big5';
+SET @test_collation= 'big5_chinese_ci';
+SET @safe_character_set_server= @@character_set_server;
+SET @safe_collation_server= @@collation_server;
+SET character_set_server= @test_character_set;
+SET collation_server= @test_collation;
+CREATE DATABASE d1;
+USE d1;
+CREATE TABLE t1 (c CHAR(10), KEY(c));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c char(10) big5_chinese_ci YES MUL NULL select,insert,update,references
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
-SELECT * FROM t1 WHERE c LIKE 'aaa%';
-c
+SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
+want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
+CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c1 varchar(15) big5_chinese_ci YES MUL NULL select,insert,update,references
+INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
+SELECT c1 as want3results from t1 where c1 like 'l%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want3results from t1 where c1 like 'lo%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want1result from t1 where c1 like 'loc%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'loca%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locat%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locati%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locatio%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'location%';
+want1result
+location
+DROP TABLE t1;
+DROP DATABASE d1;
+USE test;
+SET character_set_server= @safe_character_set_server;
+SET collation_server= @safe_collation_server;
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index a8182438ac4..355f53b63a5 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -296,3 +296,12 @@ FD C3BD FD 1
FE C3BE FE 1
FF C3BF FF 1
DROP TABLE t1;
+select 'a' regexp 'A' collate latin1_general_ci;
+'a' regexp 'A' collate latin1_general_ci
+1
+select 'a' regexp 'A' collate latin1_general_cs;
+'a' regexp 'A' collate latin1_general_cs
+0
+select 'a' regexp 'A' collate latin1_bin;
+'a' regexp 'A' collate latin1_bin
+0
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
index 1fece515f9f..fa99c2d1318 100644
--- a/mysql-test/r/ctype_tis620.result
+++ b/mysql-test/r/ctype_tis620.result
@@ -2899,3 +2899,41 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
6109 -1 -1
61 0 0
DROP TABLE t1;
+CREATE TABLE t1 (
+`id` int(11) NOT NULL auto_increment,
+`url` varchar(200) NOT NULL default '',
+`name` varchar(250) NOT NULL default '',
+`type` int(11) NOT NULL default '0',
+`website` varchar(250) NOT NULL default '',
+`adddate` date NOT NULL default '0000-00-00',
+`size` varchar(20) NOT NULL default '',
+`movieid` int(11) NOT NULL default '0',
+`musicid` int(11) NOT NULL default '0',
+`star` varchar(20) NOT NULL default '',
+`download` int(11) NOT NULL default '0',
+`lastweek` int(11) NOT NULL default '0',
+`thisweek` int(11) NOT NULL default '0',
+`page` varchar(250) NOT NULL default '',
+PRIMARY KEY (`id`),
+UNIQUE KEY `url` (`url`)
+) CHARACTER SET tis620;
+INSERT INTO t1 VALUES
+(1,'http://www.siamzone.com/download/download/000001-frodo_1024.jpg','The Lord
+of the Rings
+Wallpapers',1,'http://www.lordoftherings.net','2002-01-22','',448,0,'',3805,0,0,
+'');
+INSERT INTO t1 VALUES (2,'http://www.othemovie.com/OScreenSaver1.EXE','O
+Screensaver',2,'','2002-01-22','',491,0,'',519,0,0,'');
+INSERT INTO t1 VALUES
+(3,'http://www.siamzone.com/download/download/000003-jasonx2(800x600).jpg','Jaso
+n X Wallpapers',1,'','2002-05-31','',579,0,'',1091,0,0,'');
+select * from t1 order by id;
+id url name type website adddate size movieid musicid star download lastweek thisweek page
+1 http://www.siamzone.com/download/download/000001-frodo_1024.jpg The Lord
+of the Rings
+Wallpapers 1 http://www.lordoftherings.net 2002-01-22 448 0 3805 0 0
+2 http://www.othemovie.com/OScreenSaver1.EXE O
+Screensaver 2 2002-01-22 491 0 519 0 0
+3 http://www.siamzone.com/download/download/000003-jasonx2(800x600).jpg Jaso
+n X Wallpapers 1 2002-05-31 579 0 1091 0 0
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index 90681795513..7620b18eea6 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -2315,3 +2315,60 @@ HEX(CONVERT(col1 USING ucs2))
064A06A9062F064A06AF0631
064A06A9064A
DROP TABLE t1;
+SET @test_character_set= 'utf8';
+SET @test_collation= 'utf8_swedish_ci';
+SET @safe_character_set_server= @@character_set_server;
+SET @safe_collation_server= @@collation_server;
+SET character_set_server= @test_character_set;
+SET collation_server= @test_collation;
+CREATE DATABASE d1;
+USE d1;
+CREATE TABLE t1 (c CHAR(10), KEY(c));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c char(10) utf8_swedish_ci YES MUL NULL select,insert,update,references
+INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
+SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
+want3results
+aaa
+aaaa
+aaaaa
+DROP TABLE t1;
+CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c1 varchar(15) utf8_swedish_ci YES MUL NULL select,insert,update,references
+INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
+SELECT c1 as want3results from t1 where c1 like 'l%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want3results from t1 where c1 like 'lo%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want1result from t1 where c1 like 'loc%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'loca%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locat%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locati%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locatio%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'location%';
+want1result
+location
+DROP TABLE t1;
+DROP DATABASE d1;
+USE test;
+SET character_set_server= @safe_character_set_server;
+SET collation_server= @safe_collation_server;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 1d3deb0b09a..6394bc28c6e 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -480,3 +480,25 @@ a 0061
b 0062
c 0063
drop table t1;
+set @ivar= 1234;
+set @str1 = 'select ?';
+set @str2 = convert(@str1 using ucs2);
+prepare stmt1 from @str2;
+execute stmt1 using @ivar;
+?
+1234
+SET TIMESTAMP=10000;
+create table t2 (c char(30)) charset=ucs2;
+set @v=convert('abc' using ucs2);
+reset master;
+insert into t2 values (@v);
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 User var 1 79 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
+master-bin.000001 119 Query 1 119 use `test`; insert into t2 values (@v)
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
+use test;
+SET TIMESTAMP=10000;
+insert into t2 values (@v);
+drop table t2;
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 7c3ae52cbc9..d02ac0062f8 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -126,3 +126,43 @@ Field Type Null Key Default Extra
a char(1)
b enum('¤¢','¤¤') YES NULL
DROP TABLE t1;
+CREATE TABLE t1
+(
+a INTEGER NOT NULL,
+b VARCHAR(50) NOT NULL DEFAULT '',
+PRIMARY KEY (a),
+KEY b (b(10))
+) TYPE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
+INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
+INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
+SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
+a b
+0 aaabbbcccddd
+SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
+a b
+1 eeefffggghhh
+SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
+a b
+2 iiijjjkkkl
+DROP TABLE t1;
+CREATE TABLE t1
+(
+a INTEGER NOT NULL,
+b VARCHAR(50) NOT NULL DEFAULT '',
+PRIMARY KEY (a),
+KEY b (b(10))
+) TYPE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
+INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
+INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
+SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
+a b
+0 aaabbbcccddd
+SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
+a b
+1 eeefffggghhh
+SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
+a b
+2 iiijjjkkkl
+DROP TABLE t1;
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index 5575ee1bf98..f1fba87c70b 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -16,12 +16,34 @@ SET AUTOCOMMIT=0;
DELETE from t1;
SET AUTOCOMMIT=1;
drop table t1;
-create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
-insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
+create table t1 (
+a bigint not null,
+b bigint not null default 0,
+c bigint not null default 0,
+d bigint not null default 0,
+e bigint not null default 0,
+f bigint not null default 0,
+g bigint not null default 0,
+h bigint not null default 0,
+i bigint not null default 0,
+j bigint not null default 0,
+primary key (a,b,c,d,e,f,g,h,i,j));
+insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
delete from t1 where a=26;
drop table t1;
-create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
-insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
+create table t1 (
+a bigint not null,
+b bigint not null default 0,
+c bigint not null default 0,
+d bigint not null default 0,
+e bigint not null default 0,
+f bigint not null default 0,
+g bigint not null default 0,
+h bigint not null default 0,
+i bigint not null default 0,
+j bigint not null default 0,
+primary key (a,b,c,d,e,f,g,h,i,j));
+insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27;
drop table t1;
CREATE TABLE `t1` (
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 0a26f545ab0..cff43a821b3 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -190,6 +190,14 @@ a
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
a
aaa10 bbb20
+select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
+a
+aaa20 bbb15
+aaa30 bbb10
+select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
+a
+aaa20 bbb15
+aaa30 bbb10
drop table t1;
CREATE TABLE t1 (
id int(11),
@@ -355,9 +363,9 @@ t collation(t)
aus Osnabrück utf8_general_ci
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
t collation(t)
-SELECT t, collation(t),MATCH t AGAINST ('Osnabruck') FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
-t collation(t) MATCH t AGAINST ('Osnabruck')
-aus Osnabrück utf8_general_ci 1.591139793396
+SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
+t collation(t) FORMAT(MATCH t AGAINST ('Osnabruck'),6)
+aus Osnabrück utf8_general_ci 1.591140
alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
Warnings:
Warning 1265 Data truncated for column 't' at row 3
@@ -382,3 +390,12 @@ s
pära para para
para para para
DROP TABLE t1;
+CREATE TABLE t1 (h text, FULLTEXT (h));
+INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing');
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+select count(*) from t1;
+count(*)
+1
+drop table t1;
diff --git a/mysql-test/r/fulltext_order_by.result b/mysql-test/r/fulltext_order_by.result
index bfee9eba280..c6c42fa2e8b 100644
--- a/mysql-test/r/fulltext_order_by.result
+++ b/mysql-test/r/fulltext_order_by.result
@@ -6,53 +6,53 @@ FULLTEXT(message)
) comment = 'original testcase by sroussey@network54.com';
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
("steve"),("is"),("cool"),("steve is cool");
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve');
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
-a MATCH (message) AGAINST ('steve')
-7 0.89568990468979
-4 0.90587323904037
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+7 0.895690
+4 0.905873
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
7 1
4 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
-a MATCH (message) AGAINST ('steve')
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
7 1
-SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
a rel
-1 0
-2 0
-3 0
-5 0
-6 0
-7 0.89568990468979
-4 0.90587323904037
+1 0.000000
+2 0.000000
+3 0.000000
+5 0.000000
+6 0.000000
+7 0.895690
+4 0.905873
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
a rel
1 0
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index c25f89d4df3..4bb79a1cb41 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -637,8 +637,22 @@ create table t1 (a char(10));
insert into t1 values ('a'),('b'),('c');
select coercibility(max(a)) from t1;
coercibility(max(a))
-3
+2
drop table t1;
+create table t1 (a char character set latin2);
+insert into t1 values ('a'),('b');
+select charset(max(a)), coercibility(max(a)),
+charset(min(a)), coercibility(min(a)) from t1;
+charset(max(a)) coercibility(max(a)) charset(min(a)) coercibility(min(a))
+latin2 2 latin2 2
+create table t2 select max(a),min(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `max(a)` char(1) character set latin2 default NULL,
+ `min(a)` char(1) character set latin2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t2,t1;
create table t1 (a int);
insert into t1 values (1);
select max(a) as b from t1 having b=1;
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index 374affce8c5..daeda51a12a 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -179,3 +179,9 @@ select 1 in ('1.1',2);
select 1 in ('1.1',2.0);
1 in ('1.1',2.0)
0
+create table t1 (a char(20) character set binary);
+insert into t1 values ('aa'), ('bb');
+select * from t1 where a in (NULL, 'aa');
+a
+aa
+drop table t1;
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 4a3a70274fd..8d49d55be39 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -201,6 +201,9 @@ hex(unhex("1")) hex(unhex("12")) hex(unhex("123")) hex(unhex("1234")) hex(unhex(
select length(unhex(md5("abrakadabra")));
length(unhex(md5("abrakadabra")))
16
+select concat('a', quote(NULL));
+concat('a', quote(NULL))
+aNULL
select reverse("");
reverse("")
@@ -312,7 +315,7 @@ insert into t1 values ('one'),(NULL),('two'),('four');
select a, quote(a), isnull(quote(a)), quote(a) is null, ifnull(quote(a), 'n') from t1;
a quote(a) isnull(quote(a)) quote(a) is null ifnull(quote(a), 'n')
one 'one' 0 0 'one'
-NULL NULL 1 1 n
+NULL NULL 0 0 NULL
two 'two' 0 0 'two'
four 'four' 0 0 'four'
drop table t1;
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 2dc6bffd071..c78b16aed8a 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -474,6 +474,12 @@ unix_timestamp(@a)
select unix_timestamp('1969-12-01 19:00:01');
unix_timestamp('1969-12-01 19:00:01')
0
+select from_unixtime(0);
+from_unixtime(0)
+NULL
+select from_unixtime(2145916800);
+from_unixtime(2145916800)
+NULL
CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
SELECT * from t1;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 141e96c8424..f903e35fa1f 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -134,6 +134,31 @@ ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
select 1;
1
1
+insert into mysql.user (host, user) values ('localhost', 'test11');
+insert into mysql.db (host, db, user, select_priv) values
+('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
+alter table mysql.db order by db asc;
+flush privileges;
+show grants for test11@localhost;
+Grants for test11@localhost
+GRANT USAGE ON *.* TO 'test11'@'localhost'
+GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
+GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
+alter table mysql.db order by db desc;
+flush privileges;
+show grants for test11@localhost;
+Grants for test11@localhost
+GRANT USAGE ON *.* TO 'test11'@'localhost'
+GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
+GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
+delete from mysql.user where user='test11';
+delete from mysql.db where user='test11';
+create database mysqltest1;
+grant usage on mysqltest1.* to test6123 identified by 'magic123';
+select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
+host db user select_priv insert_priv
+delete from mysql.user where user='test6123';
+drop database mysqltest1;
create table t1 (a int);
grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
show grants for drop_user2@localhost;
@@ -229,25 +254,6 @@ GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
DROP DATABASE ÂÄ;
SET NAMES latin1;
-insert into mysql.user (host, user) values ('localhost', 'test11');
-insert into mysql.db (host, db, user, select_priv) values
-('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
-alter table mysql.db order by db asc;
-flush privileges;
-show grants for test11@localhost;
-Grants for test11@localhost
-GRANT USAGE ON *.* TO 'test11'@'localhost'
-GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
-GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
-alter table mysql.db order by db desc;
-flush privileges;
-show grants for test11@localhost;
-Grants for test11@localhost
-GRANT USAGE ON *.* TO 'test11'@'localhost'
-GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
-GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
-delete from mysql.user where user='test11';
-delete from mysql.db where user='test11';
USE test;
CREATE TABLE t1 (a int );
CREATE TABLE t2 LIKE t1;
diff --git a/mysql-test/r/have_moscow_leap_timezone.require b/mysql-test/r/have_moscow_leap_timezone.require
new file mode 100644
index 00000000000..f27452d7770
--- /dev/null
+++ b/mysql-test/r/have_moscow_leap_timezone.require
@@ -0,0 +1,2 @@
+from_unixtime(1072904422)
+2004-01-01 00:00:00
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 92b694b5117..1f994b100e2 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -4,7 +4,7 @@ insert into t1 values(1,1),(2,2),(3,3),(4,4);
delete from t1 where a=1 or a=0;
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 0 PRIMARY 1 a NULL NULL NULL NULL HASH
+t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH
select * from t1;
a b
2 2
@@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref btn btn 11 const,const 10 Using where
+1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 5 const 10 Using where
+1 SIMPLE t1 ref a a 5 const 1 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
@@ -204,7 +204,7 @@ key a (a)
INSERT INTO t1 VALUES (10), (10), (10);
EXPLAIN SELECT * FROM t1 WHERE a=10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 5 const 10 Using where
+1 SIMPLE t1 ref a a 5 const 3 Using where
SELECT * FROM t1 WHERE a=10;
a
10
@@ -233,3 +233,10 @@ SELECT * FROM t1 WHERE B is not null;
a B
1 1
DROP TABLE t1;
+CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int(10) unsigned NOT NULL) ENGINE=HEAP;
+INSERT INTO t1 VALUES ('massecot',1101106491),('altec',1101106492),('stitch+',1101106304),('Seb Corgan',1101106305),('beerfilou',1101106263),('flaker',1101106529),('joce8',5),('M4vrick',1101106418),('gabay008',1101106525),('Vamp irX',1101106291),('ZoomZip',1101106546),('rip666',1101106502),('CBP ',1101106397),('guezpard',1101106496);
+DELETE FROM t1 WHERE date<1101106546;
+SELECT * FROM t1;
+pseudo date
+ZoomZip 1101106546
+DROP TABLE t1;
diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result
index 7affbf788fb..4f5de197858 100644
--- a/mysql-test/r/heap_hash.result
+++ b/mysql-test/r/heap_hash.result
@@ -1,10 +1,10 @@
-drop table if exists t1;
+drop table if exists t1,t2;
create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
insert into t1 values(1,1),(2,2),(3,3),(4,4);
delete from t1 where a=1 or a=0;
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 0 PRIMARY 1 a NULL NULL NULL NULL HASH
+t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH
select * from t1;
a b
2 2
@@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref btn btn 11 const,const 10 Using where
+1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 5 const 10 Using where
+1 SIMPLE t1 ref a a 5 const 1 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
@@ -203,3 +203,155 @@ DELETE from t1 where a < 100;
SELECT * from t1;
a
DROP TABLE t1;
+create table t1
+(
+a char(8) not null,
+b char(20) not null,
+c int not null,
+key (a)
+) engine=heap;
+insert into t1 values ('aaaa', 'prefill-hash=5',0);
+insert into t1 values ('aaab', 'prefill-hash=0',0);
+insert into t1 values ('aaac', 'prefill-hash=7',0);
+insert into t1 values ('aaad', 'prefill-hash=2',0);
+insert into t1 values ('aaae', 'prefill-hash=1',0);
+insert into t1 values ('aaaf', 'prefill-hash=4',0);
+insert into t1 values ('aaag', 'prefill-hash=3',0);
+insert into t1 values ('aaah', 'prefill-hash=6',0);
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+insert into t1 select * from t1;
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+flush tables;
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+create table t2 as select * from t1;
+delete from t1;
+insert into t1 select * from t2;
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+drop table t1, t2;
+create table t1 (
+id int unsigned not null primary key auto_increment,
+name varchar(20) not null,
+index heap_idx(name),
+index btree_idx using btree(name)
+) engine=heap;
+create table t2 (
+id int unsigned not null primary key auto_increment,
+name varchar(20) not null,
+index btree_idx using btree(name),
+index heap_idx(name)
+) engine=heap;
+insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'),
+('Suzy'), ('Hoppy'), ('Burrito'), ('Mimi'), ('Sherry'), ('Ben'), ('Phil'),
+('Emily'), ('Mike');
+insert into t2 select * from t1;
+explain select * from t1 where name='matt';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='matt';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+explain select * from t1 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+explain select * from t1 where name='Phil';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='Phil';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+explain select * from t1 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+flush tables;
+select count(*) from t1 where name='Matt';
+count(*)
+7
+explain select * from t1 ignore index (btree_idx) where name='matt';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx heap_idx 20 const 7 Using where
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 id NULL 91 NULL NULL HASH
+t1 1 heap_idx 1 name NULL 13 NULL NULL HASH
+t1 1 btree_idx 1 name A NULL NULL NULL BTREE
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 0 PRIMARY 1 id NULL 91 NULL NULL HASH
+t1 1 heap_idx 1 name NULL 13 NULL NULL HASH
+t1 1 btree_idx 1 name A NULL NULL NULL BTREE
+create table t3
+(
+a varchar(20) not null,
+b varchar(20) not null,
+key (a,b)
+) engine=heap;
+insert into t3 select name, name from t1;
+show index from t3;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t3 1 a 1 a NULL NULL NULL NULL HASH
+t3 1 a 2 b NULL 15 NULL NULL HASH
+show index from t3;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t3 1 a 1 a NULL NULL NULL NULL HASH
+t3 1 a 2 b NULL 15 NULL NULL HASH
+explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx heap_idx 20 const 7 Using where
+1 SIMPLE t3 ref a a 40 func,const 6 Using where
+drop table t1, t2, t3;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 9d830367745..009432ec3ab 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1630,3 +1630,21 @@ show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
drop table t1;
+create table t1 (c char(10), index (c,c)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c'
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10)) engine=innodb;
+alter table t1 add key (c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c2,c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c2,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c1,c2);
+ERROR 42S21: Duplicate column name 'c1'
+drop table t1;
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 75bf96cb401..c045aa0d00a 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -751,3 +751,68 @@ player_id match_1_h * match_id home UUX
7 4 * 1 2 2
3 3 * 1 2 1
drop table t1, t2;
+create table t1 (a int, b int, unique index idx (a, b));
+create table t2 (a int, b int, c int, unique index idx (a, b));
+insert into t1 values (1, 10), (1,11), (2,10), (2,11);
+insert into t2 values (1,10,3);
+select t1.a, t1.b, t2.c from t1 left join t2
+on t1.a=t2.a and t1.b=t2.b and t2.c=3
+where t1.a=1 and t2.c is null;
+a b c
+1 11 NULL
+drop table t1, t2;
+CREATE TABLE t1 (
+ts_id bigint(20) default NULL,
+inst_id tinyint(4) default NULL,
+flag_name varchar(64) default NULL,
+flag_value text,
+UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ts_id bigint(20) default NULL,
+inst_id tinyint(4) default NULL,
+flag_name varchar(64) default NULL,
+flag_value text,
+UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+(111056548820001, 0, 'flag1', NULL),
+(111056548820001, 0, 'flag2', NULL),
+(2, 0, 'other_flag', NULL);
+INSERT INTO t2 VALUES
+(111056548820001, 3, 'flag1', 'sss');
+SELECT t1.flag_name,t2.flag_value
+FROM t1 LEFT JOIN t2
+ON (t1.ts_id = t2.ts_id AND t1.flag_name = t2.flag_name AND
+t2.inst_id = 3)
+WHERE t1.inst_id = 0 AND t1.ts_id=111056548820001 AND
+t2.flag_value IS NULL;
+flag_name flag_value
+flag2 NULL
+DROP TABLE t1,t2;
+CREATE TABLE invoice (
+id int(11) unsigned NOT NULL auto_increment,
+text_id int(10) unsigned default NULL,
+PRIMARY KEY (id)
+);
+INSERT INTO invoice VALUES("1", "0");
+INSERT INTO invoice VALUES("2", "10");
+CREATE TABLE text_table (
+text_id char(3) NOT NULL default '',
+language_id char(3) NOT NULL default '',
+text_data text,
+PRIMARY KEY (text_id,language_id)
+);
+INSERT INTO text_table VALUES("0", "EN", "0-EN");
+INSERT INTO text_table VALUES("0", "SV", "0-SV");
+INSERT INTO text_table VALUES("10", "EN", "10-EN");
+INSERT INTO text_table VALUES("10", "SV", "10-SV");
+SELECT invoice.id, invoice.text_id, text_table.text_data
+FROM invoice LEFT JOIN text_table
+ON invoice.text_id = text_table.text_id
+AND text_table.language_id = 'SV'
+ WHERE (invoice.id LIKE '%' OR text_table.text_data LIKE '%');
+id text_id text_data
+1 0 0-SV
+2 10 10-SV
+DROP TABLE invoice, text_table;
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index e74bda23da9..cceaf393a60 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -307,3 +307,21 @@ test.t1 check status OK
drop table t1;
create table t1 (c char(10), index (c(0)));
ERROR HY000: Key part 'c' length cannot be 0
+create table t1 (c char(10), index (c,c));
+ERROR 42S21: Duplicate column name 'c'
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1));
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2));
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1));
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10));
+alter table t1 add key (c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c2,c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c2,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c1,c2);
+ERROR 42S21: Duplicate column name 'c1'
+drop table t1;
diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result
index fe8708f882d..79b5a6e84b2 100644
--- a/mysql-test/r/key_cache.result
+++ b/mysql-test/r/key_cache.result
@@ -277,3 +277,13 @@ Key_blocks_unused KEY_BLOCKS_UNUSED
set global keycache2.key_buffer_size=0;
set global keycache3.key_buffer_size=100;
set global keycache3.key_buffer_size=0;
+create table t1 (mytext text, FULLTEXT (mytext));
+insert t1 values ('aaabbb');
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+set GLOBAL key_cache_block_size=2048;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result
index ced3ca61f80..2321a8998ac 100644
--- a/mysql-test/r/metadata.result
+++ b/mysql-test/r/metadata.result
@@ -5,7 +5,7 @@ def 1 8 1 1 N 32769 0 8
def 1.0 5 3 3 N 32769 1 8
def -1 8 1 2 N 32769 0 8
def hello 254 5 5 N 1 31 8
-def NULL 6 0 0 Y 32768 0 8
+def NULL 6 0 0 Y 32896 0 63
1 1.0 -1 hello NULL
1 1.0 -1 hello NULL
create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10));
diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result
index 54d99d5609e..72288d1027b 100644
--- a/mysql-test/r/mix_innodb_myisam_binlog.result
+++ b/mysql-test/r/mix_innodb_myisam_binlog.result
@@ -180,4 +180,25 @@ master-bin.000001 79 Query 1 79 use `test`; BEGIN
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(16)
master-bin.000001 179 Query 1 79 use `test`; insert into t1 values(18)
master-bin.000001 239 Query 1 239 use `test`; COMMIT
+delete from t1;
+delete from t2;
+alter table t2 type=MyISAM;
+insert into t1 values (1);
+begin;
+select * from t1 for update;
+a
+1
+select (@before:=unix_timestamp())*0;
+(@before:=unix_timestamp())*0
+0
+begin;
+ select * from t1 for update;
+insert into t2 values (20);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select (@after:=unix_timestamp())*0;
+(@after:=unix_timestamp())*0
+0
+select (@after-@before) >= 2;
+(@after-@before) >= 2
+1
drop table t1,t2;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 26dcce43d08..d155a14bb60 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -529,6 +529,7 @@ show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
create table t2 (a int);
+set @@rand_seed1=31415926,@@rand_seed2=2718281828;
insert t1 select * from t2;
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
@@ -543,7 +544,7 @@ Warnings:
Note 1031 Table storage engine for 't1' doesn't have this option
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 1 a 1 a NULL NULL NULL NULL YES HASH
+t1 1 a 1 a NULL 1000 NULL NULL YES HASH
drop table t1,t2;
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
insert into t1 values (null,''), (null,'');
diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result
index 23f089b9bc0..b7afb5918a4 100644
--- a/mysql-test/r/ndb_autodiscover.result
+++ b/mysql-test/r/ndb_autodiscover.result
@@ -1,4 +1,4 @@
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
flush status;
create table t1(
id int not null primary key,
@@ -363,3 +363,8 @@ a int NOT NULL PRIMARY KEY,
b int
) engine=ndb;
insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
+create table t10 (
+a int not null primary key,
+b blob
+) engine=ndb;
+insert into t10 values (1, 'kalle');
diff --git a/mysql-test/r/ndb_autodiscover2.result b/mysql-test/r/ndb_autodiscover2.result
index 08803d997a5..91f018b5d02 100644
--- a/mysql-test/r/ndb_autodiscover2.result
+++ b/mysql-test/r/ndb_autodiscover2.result
@@ -8,3 +8,6 @@ show status like 'handler_discover%';
Variable_name Value
Handler_discover 1
drop table t9;
+select * from t10;
+ERROR HY000: Got error 4263 'Invalid blob attributes or invalid blob parts table' from ndbcluster
+drop table t10;
diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result
index 604084a72c2..6ec5338acbe 100644
--- a/mysql-test/r/ndb_basic.result
+++ b/mysql-test/r/ndb_basic.result
@@ -40,6 +40,11 @@ SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3
3 1 NULL 9412
9412 9413 17 9413
+UPDATE t1 SET pk1=4 WHERE pk1 = 3;
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+4 1 NULL 9412
+9412 9413 17 9413
DELETE FROM t1;
SELECT * FROM t1;
pk1 attr1 attr2 attr3
@@ -395,6 +400,13 @@ b attr1
9413 9412
drop table test.t1, t2;
drop database mysqltest;
+drop database if exists ndbtest1;
+create database ndbtest1;
+use ndbtest1;
+create table t1(id int) engine=ndbcluster;
+drop database ndbtest1;
+drop database ndbtest1;
+ERROR HY000: Can't drop database 'ndbtest1'; database doesn't exist
use test;
create table t1 (a int primary key, b char(0));
insert into t1 values (1,"");
diff --git a/mysql-test/r/ndb_charset.result b/mysql-test/r/ndb_charset.result
index 93429a1fcb0..501bec99ea3 100644
--- a/mysql-test/r/ndb_charset.result
+++ b/mysql-test/r/ndb_charset.result
@@ -78,9 +78,9 @@ unique key(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
-ERROR 23000: Can't write, because of unique constraint, to table 't1'
+ERROR 23000: Duplicate entry '2' for key 1
insert into t1 values(3, 'AAA');
-ERROR 23000: Can't write, because of unique constraint, to table 't1'
+ERROR 23000: Duplicate entry '3' for key 1
select * from t1 order by p;
p a
1 aAa
diff --git a/mysql-test/r/ndb_grant.result b/mysql-test/r/ndb_grant.result
new file mode 100644
index 00000000000..6583065a0c4
--- /dev/null
+++ b/mysql-test/r/ndb_grant.result
@@ -0,0 +1,416 @@
+drop table if exists t1;
+SET NAMES binary;
+use mysql;
+alter table columns_priv engine=ndb;
+alter table db engine=ndb;
+alter table func engine=ndb;
+alter table help_category engine=ndb;
+alter table help_keyword engine=ndb;
+alter table help_relation engine=ndb;
+alter table help_topic engine=ndb;
+alter table host engine=ndb;
+alter table tables_priv engine=ndb;
+alter table time_zone engine=ndb;
+alter table time_zone_leap_second engine=ndb;
+alter table time_zone_name engine=ndb;
+alter table time_zone_transition engine=ndb;
+alter table time_zone_transition_type engine=ndb;
+alter table user engine=ndb;
+use test;
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+flush privileges;
+begin;
+grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant delete on mysqltest.* to mysqltest_1@localhost;
+commit;
+select * from mysql.user where user="mysqltest_1";
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT, DELETE ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+revoke delete on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant select on mysqltest.* to mysqltest_1@localhost require NONE;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+begin;
+grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+flush privileges;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
+commit;
+flush privileges;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+begin;
+revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+begin;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+commit;
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+begin;
+grant usage on test.* to mysqltest_1@localhost with grant option;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT USAGE ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+GRANT USAGE ON `test`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+delete from mysql.tables_priv where user='mysqltest_1';
+delete from mysql.columns_priv where user='mysqltest_1';
+flush privileges;
+show grants for mysqltest_1@localhost;
+ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host 'localhost'
+create table t1 (a int);
+begin;
+GRANT select,update,insert on t1 to mysqltest_1@localhost;
+GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, SELECT (a), INSERT, INSERT (a), UPDATE, UPDATE (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
+table_priv column_priv
+Select,Insert,Update Select,Insert,Update,References
+begin;
+REVOKE select (a), update on t1 from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, INSERT, INSERT (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+begin;
+REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+begin;
+GRANT select,references on t1 to mysqltest_1@localhost;
+commit;
+select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
+table_priv column_priv
+Select,References References
+begin;
+grant all on test.* to mysqltest_3@localhost with grant option;
+revoke all on test.* from mysqltest_3@localhost;
+commit;
+show grants for mysqltest_3@localhost;
+Grants for mysqltest_3@localhost
+GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
+GRANT USAGE ON `test`.* TO 'mysqltest_3'@'localhost' WITH GRANT OPTION
+begin;
+revoke grant option on test.* from mysqltest_3@localhost;
+commit;
+show grants for mysqltest_3@localhost;
+Grants for mysqltest_3@localhost
+GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
+begin;
+grant all on test.t1 to mysqltest_2@localhost with grant option;
+revoke all on test.t1 from mysqltest_2@localhost;
+commit;
+show grants for mysqltest_2@localhost;
+Grants for mysqltest_2@localhost
+GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
+GRANT USAGE ON `test`.`t1` TO 'mysqltest_2'@'localhost' WITH GRANT OPTION
+begin;
+revoke grant option on test.t1 from mysqltest_2@localhost;
+commit;
+show grants for mysqltest_2@localhost;
+Grants for mysqltest_2@localhost
+GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
+delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+flush privileges;
+drop table t1;
+begin;
+GRANT FILE on mysqltest.* to mysqltest_1@localhost;
+ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
+commit;
+select 1;
+1
+1
+create database mysqltest1;
+begin;
+grant usage on mysqltest1.* to test6123 identified by 'magic123';
+commit;
+select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
+host db user select_priv insert_priv
+delete from mysql.user where user='test6123';
+drop database mysqltest1;
+create table t1 (a int);
+begin;
+grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
+commit;
+show grants for drop_user2@localhost;
+Grants for drop_user2@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user2'@'localhost' WITH GRANT OPTION
+begin;
+revoke all privileges, grant option from drop_user2@localhost;
+commit;
+drop user drop_user2@localhost;
+begin;
+grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
+grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
+grant select(a) on test.t1 to drop_user@localhost;
+commit;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
+set sql_mode=ansi_quotes;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
+set sql_mode=default;
+set sql_quote_show_create=0;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
+set sql_mode="ansi_quotes";
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
+set sql_quote_show_create=1;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
+set sql_mode="";
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
+revoke all privileges, grant option from drop_user@localhost;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT USAGE ON *.* TO 'drop_user'@'localhost'
+drop user drop_user@localhost;
+begin;
+revoke all privileges, grant option from drop_user@localhost;
+ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
+commit;
+begin;
+grant select(a) on test.t1 to drop_user1@localhost;
+commit;
+flush privileges;
+begin;
+grant select on test.t1 to drop_user2@localhost;
+grant select on test.* to drop_user3@localhost;
+grant select on *.* to drop_user4@localhost;
+commit;
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+ERROR HY000: Can't drop one or more of the requested users
+begin;
+revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
+drop_user3@localhost, drop_user4@localhost;
+commit;
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+drop table t1;
+begin;
+grant usage on *.* to mysqltest_1@localhost identified by "password";
+grant select, update, insert on test.* to mysqltest@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'
+drop user mysqltest_1@localhost;
+SET NAMES koi8r;
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ int);
+begin;
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.* TO 'ÀÚÅÒ'@'localhost'
+begin;
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
+commit;
+begin;
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+begin;
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+commit;
+begin;
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+begin;
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+commit;
+DROP DATABASE ÂÄ;
+SET NAMES latin1;
+USE test;
+CREATE TABLE t1 (a int );
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+CREATE TABLE t4 LIKE t1;
+CREATE TABLE t5 LIKE t1;
+CREATE TABLE t6 LIKE t1;
+CREATE TABLE t7 LIKE t1;
+CREATE TABLE t8 LIKE t1;
+CREATE TABLE t9 LIKE t1;
+CREATE TABLE t10 LIKE t1;
+CREATE DATABASE testdb1;
+CREATE DATABASE testdb2;
+CREATE DATABASE testdb3;
+CREATE DATABASE testdb4;
+CREATE DATABASE testdb5;
+CREATE DATABASE testdb6;
+CREATE DATABASE testdb7;
+CREATE DATABASE testdb8;
+CREATE DATABASE testdb9;
+CREATE DATABASE testdb10;
+begin;
+GRANT ALL ON testdb1.* TO testuser@localhost;
+GRANT ALL ON testdb2.* TO testuser@localhost;
+GRANT ALL ON testdb3.* TO testuser@localhost;
+GRANT ALL ON testdb4.* TO testuser@localhost;
+GRANT ALL ON testdb5.* TO testuser@localhost;
+GRANT ALL ON testdb6.* TO testuser@localhost;
+GRANT ALL ON testdb7.* TO testuser@localhost;
+GRANT ALL ON testdb8.* TO testuser@localhost;
+GRANT ALL ON testdb9.* TO testuser@localhost;
+GRANT ALL ON testdb10.* TO testuser@localhost;
+GRANT SELECT ON test.t1 TO testuser@localhost;
+GRANT SELECT ON test.t2 TO testuser@localhost;
+GRANT SELECT ON test.t3 TO testuser@localhost;
+GRANT SELECT ON test.t4 TO testuser@localhost;
+GRANT SELECT ON test.t5 TO testuser@localhost;
+GRANT SELECT ON test.t6 TO testuser@localhost;
+GRANT SELECT ON test.t7 TO testuser@localhost;
+GRANT SELECT ON test.t8 TO testuser@localhost;
+GRANT SELECT ON test.t9 TO testuser@localhost;
+GRANT SELECT ON test.t10 TO testuser@localhost;
+GRANT SELECT (a) ON test.t1 TO testuser@localhost;
+GRANT SELECT (a) ON test.t2 TO testuser@localhost;
+GRANT SELECT (a) ON test.t3 TO testuser@localhost;
+GRANT SELECT (a) ON test.t4 TO testuser@localhost;
+GRANT SELECT (a) ON test.t5 TO testuser@localhost;
+GRANT SELECT (a) ON test.t6 TO testuser@localhost;
+GRANT SELECT (a) ON test.t7 TO testuser@localhost;
+GRANT SELECT (a) ON test.t8 TO testuser@localhost;
+GRANT SELECT (a) ON test.t9 TO testuser@localhost;
+GRANT SELECT (a) ON test.t10 TO testuser@localhost;
+commit;
+begin;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
+commit;
+SHOW GRANTS FOR testuser@localhost;
+Grants for testuser@localhost
+GRANT USAGE ON *.* TO 'testuser'@'localhost'
+DROP USER testuser@localhost;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+DROP DATABASE testdb1;
+DROP DATABASE testdb2;
+DROP DATABASE testdb3;
+DROP DATABASE testdb4;
+DROP DATABASE testdb5;
+DROP DATABASE testdb6;
+DROP DATABASE testdb7;
+DROP DATABASE testdb8;
+DROP DATABASE testdb9;
+DROP DATABASE testdb10;
+use mysql;
+alter table columns_priv engine=myisam;
+alter table db engine=myisam;
+alter table func engine=myisam;
+alter table help_category engine=myisam;
+alter table help_keyword engine=myisam;
+alter table help_relation engine=myisam;
+alter table help_topic engine=myisam;
+alter table host engine=myisam;
+alter table tables_priv engine=myisam;
+alter table time_zone engine=myisam;
+alter table time_zone_leap_second engine=myisam;
+alter table time_zone_name engine=myisam;
+alter table time_zone_transition engine=myisam;
+alter table time_zone_transition_type engine=myisam;
+alter table user engine=myisam;
+use test;
+flush privileges;
diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result
index 2dc260ec43d..50f904af750 100644
--- a/mysql-test/r/ndb_index_ordered.result
+++ b/mysql-test/r/ndb_index_ordered.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1, test1, test2;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
@@ -275,3 +275,38 @@ a b c
1 1 1
4 4 NULL
drop table t1;
+CREATE TABLE test1 (
+SubscrID int(11) NOT NULL auto_increment,
+UsrID int(11) NOT NULL default '0',
+PRIMARY KEY (SubscrID),
+KEY idx_usrid (UsrID)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO test1 VALUES (2,224),(3,224),(1,224);
+CREATE TABLE test2 (
+SbclID int(11) NOT NULL auto_increment,
+SbcrID int(11) NOT NULL default '0',
+PRIMARY KEY (SbclID),
+KEY idx_sbcrid (SbcrID)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO test2 VALUES (3,2),(1,1),(2,1),(4,2);
+select * from test1 order by 1;
+SubscrID UsrID
+1 224
+2 224
+3 224
+select * from test2 order by 1;
+SbclID SbcrID
+1 1
+2 1
+3 2
+4 2
+SELECT s.SubscrID,l.SbclID FROM test1 s left JOIN test2 l ON
+l.SbcrID=s.SubscrID WHERE s.UsrID=224 order by 1, 2;
+SubscrID SbclID
+1 1
+1 2
+2 3
+2 4
+3 NULL
+drop table test1;
+drop table test2;
diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result
index f1407dfe78d..31b258c0a6f 100644
--- a/mysql-test/r/ndb_index_unique.result
+++ b/mysql-test/r/ndb_index_unique.result
@@ -22,7 +22,7 @@ select * from t1 where b = 4 order by a;
a b c
3 4 6
insert into t1 values(8, 2, 3);
-ERROR 23000: Can't write, because of unique constraint, to table 't1'
+ERROR 23000: Duplicate entry '8' for key 1
select * from t1 order by a;
a b c
1 2 3
@@ -44,6 +44,51 @@ a b c
7 8 3
8 2 3
drop table t1;
+CREATE TABLE t1 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned,
+c int unsigned,
+UNIQUE bc(b,c)
+) engine = ndb;
+insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
+select * from t1 use index (bc) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc)order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+select * from t1 use index (bc) order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+select * from t1 use index (PRIMARY) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
+a b c
+select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
+a b c
+select * from t1 use index (bc) where b < 4 order by a;
+a b c
+1 1 1
+select * from t1 use index (bc) where b IS NOT NULL order by a;
+a b c
+1 1 1
+4 4 NULL
+insert into t1 values(5,1,1);
+ERROR 23000: Duplicate entry '5' for key 1
+drop table t1;
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
@@ -65,7 +110,7 @@ select * from t2 where b = 4 order by a;
a b c
3 4 6
insert into t2 values(8, 2, 3);
-ERROR 23000: Can't write, because of unique constraint, to table 't2'
+ERROR 23000: Duplicate entry '8' for key 1
select * from t2 order by a;
a b c
1 2 3
@@ -87,6 +132,13 @@ a b c
7 8 3
8 2 3
drop table t2;
+CREATE TABLE t2 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned,
+UNIQUE USING HASH (b, c)
+) engine=ndbcluster;
+ERROR 42000: Column 'c' is used with UNIQUE or INDEX but is not defined as NOT NULL
CREATE TABLE t3 (
a int unsigned NOT NULL,
b int unsigned not null,
@@ -123,7 +175,7 @@ pk a
3 NULL
4 4
insert into t1 values (5,0);
-ERROR 23000: Can't write, because of unique constraint, to table 't1'
+ERROR 23000: Duplicate entry '5' for key 1
select * from t1 order by pk;
pk a
-1 NULL
@@ -156,7 +208,7 @@ pk a b c
0 NULL 18 NULL
1 3 19 abc
insert into t2 values(2,3,19,'abc');
-ERROR 23000: Can't write, because of unique constraint, to table 't2'
+ERROR 23000: Duplicate entry '2' for key 1
select * from t2 order by pk;
pk a b c
-1 1 17 NULL
diff --git a/mysql-test/r/ndb_insert.result b/mysql-test/r/ndb_insert.result
index 16c76f39680..7503010a66b 100644
--- a/mysql-test/r/ndb_insert.result
+++ b/mysql-test/r/ndb_insert.result
@@ -535,27 +535,46 @@ count(*)
2000
insert into t1 select * from t1 where b < 10 order by pk1;
ERROR 23000: Duplicate entry '9' for key 1
+DELETE FROM t1 WHERE pk1=2;
begin;
-INSERT IGNORE INTO t1 VALUES(1,2,3);
-ERROR HY000: Table storage engine for 't1' doesn't have this option
-commit;
-select * from t1 where pk1=1;
+INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
+select * from t1 where pk1 < 3 order by pk1;
pk1 b c
+0 0 0
1 1 1
-INSERT IGNORE INTO t1 VALUES(1,2,3);
-ERROR HY000: Table storage engine for 't1' doesn't have this option
-select * from t1 where pk1=1;
+2 3 4
+rollback;
+INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
+select * from t1 where pk1 < 3 order by pk1;
pk1 b c
+0 0 0
1 1 1
-REPLACE INTO t1 values(1, 2, 3);
+2 3 4
+REPLACE INTO t1 values(1, 78, 3);
select * from t1 where pk1=1;
pk1 b c
-1 2 3
-INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
-select * from t1 where pk1=1;
+1 78 3
+INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=79;
+select * from t1 where pk1 < 4 order by pk1;
+pk1 b c
+0 0 0
+1 79 3
+2 3 4
+3 79 3
+INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=pk1+c;
+select * from t1 where pk1 < 4 order by pk1;
+pk1 b c
+0 0 0
+1 4 3
+2 3 4
+3 6 3
+DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
+INSERT INTO t1 VALUES(1,1,1),(2,2,17),(3,4,5) ON DUPLICATE KEY UPDATE pk1=b;
+select * from t1 where pk1 = b and b != c order by pk1;
pk1 b c
-1 2 3
+2 2 17
+4 4 3
+6 6 3
DROP TABLE t1;
CREATE TABLE t1(a INT) ENGINE=ndb;
INSERT IGNORE INTO t1 VALUES (1);
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index bd90b3fe3f3..3e233eb512a 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -175,3 +175,97 @@ explain select * from t1 where i=2 or i is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref i i 4 const 7 Using where; Using index
drop table t1;
+set names latin2;
+create table t1 select
+null as c00,
+if(1, null, 'string') as c01,
+if(0, null, 'string') as c02,
+ifnull(null, 'string') as c03,
+ifnull('string', null) as c04,
+case when 0 then null else 'string' end as c05,
+case when 1 then null else 'string' end as c06,
+coalesce(null, 'string') as c07,
+coalesce('string', null) as c08,
+least('string',null) as c09,
+least(null, 'string') as c10,
+greatest('string',null) as c11,
+greatest(null, 'string') as c12,
+nullif('string', null) as c13,
+nullif(null, 'string') as c14,
+trim('string' from null) as c15,
+trim(null from 'string') as c16,
+substring_index('string', null, 1) as c17,
+substring_index(null, 'string', 1) as c18,
+elt(1, null, 'string') as c19,
+elt(1, 'string', null) as c20,
+concat('string', null) as c21,
+concat(null, 'string') as c22,
+concat_ws('sep', 'string', null) as c23,
+concat_ws('sep', null, 'string') as c24,
+concat_ws(null, 'string', 'string') as c25,
+make_set(3, 'string', null) as c26,
+make_set(3, null, 'string') as c27,
+export_set(3, null, 'off', 'sep') as c29,
+export_set(3, 'on', null, 'sep') as c30,
+export_set(3, 'on', 'off', null) as c31,
+replace(null, 'from', 'to') as c32,
+replace('str', null, 'to') as c33,
+replace('str', 'from', null) as c34,
+insert('str', 1, 2, null) as c35,
+insert(null, 1, 2, 'str') as c36,
+lpad('str', 10, null) as c37,
+rpad(null, 10, 'str') as c38;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c00` binary(0) default NULL,
+ `c01` varchar(6) character set latin2 default NULL,
+ `c02` varchar(6) character set latin2 default NULL,
+ `c03` varchar(6) character set latin2 NOT NULL default '',
+ `c04` varchar(6) character set latin2 default NULL,
+ `c05` varchar(6) character set latin2 default NULL,
+ `c06` varchar(6) character set latin2 default NULL,
+ `c07` varchar(6) character set latin2 default NULL,
+ `c08` varchar(6) character set latin2 default NULL,
+ `c09` varchar(6) character set latin2 NOT NULL default '',
+ `c10` varchar(6) character set latin2 NOT NULL default '',
+ `c11` varchar(6) character set latin2 NOT NULL default '',
+ `c12` varchar(6) character set latin2 NOT NULL default '',
+ `c13` varchar(6) character set latin2 default NULL,
+ `c14` char(0) character set latin2 default NULL,
+ `c15` char(0) character set latin2 default NULL,
+ `c16` varchar(6) character set latin2 default NULL,
+ `c17` varchar(6) character set latin2 default NULL,
+ `c18` char(0) character set latin2 default NULL,
+ `c19` varchar(6) character set latin2 default NULL,
+ `c20` varchar(6) character set latin2 default NULL,
+ `c21` varchar(6) character set latin2 default NULL,
+ `c22` varchar(6) character set latin2 default NULL,
+ `c23` varchar(9) character set latin2 default NULL,
+ `c24` varchar(9) character set latin2 default NULL,
+ `c25` varchar(12) character set latin2 default NULL,
+ `c26` varchar(7) character set latin2 default NULL,
+ `c27` varchar(7) character set latin2 default NULL,
+ `c29` longtext character set latin2,
+ `c30` longtext character set latin2,
+ `c31` varchar(192) character set latin2 default NULL,
+ `c32` char(0) character set latin2 default NULL,
+ `c33` char(3) character set latin2 default NULL,
+ `c34` char(3) character set latin2 default NULL,
+ `c35` char(3) character set latin2 default NULL,
+ `c36` char(3) character set latin2 default NULL,
+ `c37` varchar(10) character set latin2 default NULL,
+ `c38` varchar(10) character set latin2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select
+case 'str' when 'STR' then 'str' when null then 'null' end as c01,
+case 'str' when null then 'null' when 'STR' then 'str' end as c02,
+field(null, 'str1', 'str2') as c03,
+field('str1','STR1', null) as c04,
+field('str1', null, 'STR1') as c05,
+'string' in ('STRING', null) as c08,
+'string' in (null, 'STRING') as c09;
+c01 c02 c03 c04 c05 c08 c09
+str str 0 1 2 1 1
+set names latin1;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 6cad58282a2..4a4c8fe22e4 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -106,12 +106,6 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
set @fvar= 123.4567;
prepare stmt1 from @fvar;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123.4567' at line 1
-set @str1 = 'select ?';
-set @str2 = convert(@str1 using ucs2);
-prepare stmt1 from @str2;
-execute stmt1 using @ivar;
-?
-1234
drop table t1,t2;
PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
set @var='A';
@@ -456,3 +450,24 @@ PREPARE stmt FROM 'UPDATE t1 AS P1 INNER JOIN (SELECT N FROM t1 GROUP BY N HAVIN
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
+prepare stmt from "select ? is null, ? is not null, ?";
+select @no_such_var is null, @no_such_var is not null, @no_such_var;
+@no_such_var is null @no_such_var is not null @no_such_var
+1 0 NULL
+execute stmt using @no_such_var, @no_such_var, @no_such_var;
+? is null ? is not null ?
+1 0 NULL
+set @var='abc';
+select @var is null, @var is not null, @var;
+@var is null @var is not null @var
+0 1 abc
+execute stmt using @var, @var, @var;
+? is null ? is not null ?
+0 1 abc
+set @var=null;
+select @var is null, @var is not null, @var;
+@var is null @var is not null @var
+1 0 NULL
+execute stmt using @var, @var, @var;
+? is null ? is not null ?
+1 0 NULL
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index ccf2945d488..5f8cb2597c6 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -1,4 +1,5 @@
-use test;
+drop table if exists t5, t6, t7, t8;
+drop database if exists mysqltest ;
test_sequence
------ basic tests ------
drop table if exists t1, t9 ;
@@ -558,7 +559,6 @@ execute stmt3;
ERROR 42S01: Table 'new_t2' already exists
rename table new_t2 to t2;
drop table t2;
-drop table if exists t5, t6, t7, t8 ;
prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ;
execute stmt1 ;
@@ -810,21 +810,24 @@ test_sequence
------ grant/revoke/drop affects a parallel session test ------
show grants for second_user@localhost ;
ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
-grant usage on test.* to second_user@localhost
+create database mysqltest;
+use mysqltest;
+use test;
+grant usage on mysqltest.* to second_user@localhost
identified by 'looser' ;
-grant select on test.t9 to second_user@localhost
+grant select on mysqltest.t9 to second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
select current_user();
current_user()
second_user@localhost
show grants for current_user();
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
prepare s_t9 from 'select c1 as my_col
from t9 where c1= 1' ;
execute s_t9 ;
@@ -832,24 +835,24 @@ my_col
1
select a as my_col from t1;
ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
-grant select on test.t1 to second_user@localhost
+grant select on mysqltest.t1 to second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
-drop table t9 ;
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
+drop table mysqltest.t9 ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
prepare s_t1 from 'select a as my_col from t1' ;
execute s_t1 ;
my_col
@@ -858,17 +861,17 @@ my_col
3
4
execute s_t9 ;
-ERROR 42S02: Table 'test.t9' doesn't exist
-revoke all privileges on test.t1 from second_user@localhost
+ERROR 42S02: Table 'mysqltest.t9' doesn't exist
+revoke all privileges on mysqltest.t1 from second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
execute s_t1 ;
ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
revoke all privileges, grant option from second_user@localhost ;
@@ -879,4 +882,5 @@ drop user second_user@localhost ;
commit ;
show grants for second_user@localhost ;
ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
-drop table t1 ;
+drop table t1,t9 ;
+drop database mysqltest;
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index efb12561950..42b4580643e 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -1790,10 +1790,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1820,10 +1820,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1976,19 +1976,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2066,19 +2066,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2158,19 +2158,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2242,19 +2242,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index cb096882d13..bb001fe9e02 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -1773,10 +1773,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1803,10 +1803,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1959,19 +1959,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2049,19 +2049,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2141,19 +2141,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2225,19 +2225,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index ac9946ef070..263b389ffa4 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -1774,10 +1774,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1804,10 +1804,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1960,19 +1960,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2050,19 +2050,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2142,19 +2142,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2226,19 +2226,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index 15e707959ca..0ec296717e0 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -1713,10 +1713,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1743,10 +1743,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1899,19 +1899,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -1989,19 +1989,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2081,19 +2081,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2165,19 +2165,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -4723,10 +4723,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -4753,10 +4753,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -4909,19 +4909,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -4999,19 +4999,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -5091,19 +5091,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -5175,19 +5175,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result
index 3dd9c200510..bb28abeda69 100644
--- a/mysql-test/r/ps_6bdb.result
+++ b/mysql-test/r/ps_6bdb.result
@@ -1773,10 +1773,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1803,10 +1803,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1959,19 +1959,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2049,19 +2049,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2141,19 +2141,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2225,19 +2225,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result
index 85e51df776f..70118509d0b 100644
--- a/mysql-test/r/ps_7ndb.result
+++ b/mysql-test/r/ps_7ndb.result
@@ -1749,10 +1749,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1779,10 +1779,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1935,19 +1935,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2025,19 +2025,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2117,19 +2117,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2201,19 +2201,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 17ed9513653..fc2b4a78469 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -221,7 +221,7 @@ update t1 set y=x;
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where
-1 SIMPLE t2 range x x 5 NULL 4 Using where
+1 SIMPLE t2 range x x 5 NULL 4 Range checked for each record (index map: 0x1)
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where
@@ -237,7 +237,7 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where
-1 SIMPLE t2 ALL x NULL NULL NULL 9 Using where
+1 SIMPLE t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 0x1)
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where
diff --git a/mysql-test/r/rpl_rewrite_db.result b/mysql-test/r/rpl_rewrite_db.result
new file mode 100644
index 00000000000..a2c8706e3e1
--- /dev/null
+++ b/mysql-test/r/rpl_rewrite_db.result
@@ -0,0 +1,92 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+create database mysqltest1;
+use mysqltest1;
+create table t1 (a int);
+insert into t1 values(9);
+select * from mysqltest1.t1;
+a
+9
+show databases like 'mysqltest1';
+Database (mysqltest1)
+mysqltest1
+select * from test.t1;
+a
+9
+drop table t1;
+drop database mysqltest1;
+drop database if exists rewrite;
+create database rewrite;
+use test;
+create table t1 (a date, b date, c date not null, d date);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'd' at row 2
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
+select * from rewrite.t1;
+a b c d
+0000-00-00 NULL 0000-00-00 0000-00-00
+0000-00-00 0000-00-00 0000-00-00 0000-00-00
+2003-03-03 2003-03-03 2003-03-03 NULL
+2003-03-03 2003-03-03 2003-03-03 NULL
+truncate table t1;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'd' at row 2
+select * from rewrite.t1;
+a b c d
+NULL NULL 0000-00-00 0000-00-00
+NULL 0000-00-00 0000-00-00 0000-00-00
+NULL 2003-03-03 2003-03-03 NULL
+drop table t1;
+create table t1 (a text, b text);
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+Warnings:
+Warning 1261 Row 3 doesn't contain data for all columns
+select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
+concat('|',a,'|') concat('|',b,'|')
+|Field A| |Field B|
+|Field 1| |Field 2'
+Field 3,'Field 4|
+|Field 5' ,'Field 6| NULL
+|Field 6| | 'Field 7'|
+drop table t1;
+create table t1 (a int, b char(10));
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 3
+Warning 1262 Row 3 was truncated; it contained more data than there were input columns
+Warning 1265 Data truncated for column 'a' at row 5
+Warning 1262 Row 5 was truncated; it contained more data than there were input columns
+select * from rewrite.t1;
+a b
+1 row 1
+2 row 2
+0 1234567890
+3 row 3
+0 1234567890
+truncate table t1;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 4
+Warning 1261 Row 4 doesn't contain data for all columns
+select * from rewrite.t1;
+a b
+1 row 1
+2 row 2
+3 row 3
+0
+drop table t1;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index ba0a80331b1..3417c7ecb85 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2057,6 +2057,10 @@ t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
drop table t4, t3, t2, t1;
DO 1;
DO benchmark(100,1+1),1,1;
+do default;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+do foobar;
+ERROR 42S22: Unknown column 'foobar' in 'field list'
CREATE TABLE t1 (
id mediumint(8) unsigned NOT NULL auto_increment,
pseudo varchar(35) NOT NULL default '',
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 32d482f5a32..53b92fe50f1 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1990,3 +1990,18 @@ ac
700
NULL
drop tables t1,t2;
+create table t1 (a int not null, b int not null, c int, primary key (a,b));
+insert into t1 values (1,1,1), (2,2,2), (3,3,3);
+set @b:= 0;
+explain select sum(a) from t1 where b > @b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index
+set @a:= (select sum(a) from t1 where b > @b);
+explain select a from t1 where c=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+do @a:= (select sum(a) from t1 where b > @b);
+explain select a from t1 where c=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+drop table t1;
diff --git a/mysql-test/r/timezone3.result b/mysql-test/r/timezone3.result
new file mode 100644
index 00000000000..ec0b6045f93
--- /dev/null
+++ b/mysql-test/r/timezone3.result
@@ -0,0 +1,41 @@
+drop table if exists t1;
+create table t1 (i int, c varchar(20));
+insert into t1 values
+(unix_timestamp("2004-01-01 00:00:00"), "2004-01-01 00:00:00");
+insert into t1 values
+(unix_timestamp("2004-03-28 01:59:59"), "2004-03-28 01:59:59"),
+(unix_timestamp("2004-03-28 02:30:00"), "2004-03-28 02:30:00"),
+(unix_timestamp("2004-03-28 03:00:00"), "2004-03-28 03:00:00");
+insert into t1 values
+(unix_timestamp('2004-05-01 00:00:00'),'2004-05-01 00:00:00');
+insert into t1 values
+(unix_timestamp('2004-10-31 01:00:00'),'2004-10-31 01:00:00'),
+(unix_timestamp('2004-10-31 02:00:00'),'2004-10-31 02:00:00'),
+(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59'),
+(unix_timestamp('2004-10-31 04:00:00'),'2004-10-31 04:00:00'),
+(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59');
+insert into t1 values
+(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
+(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
+select i, from_unixtime(i), c from t1;
+i from_unixtime(i) c
+1072904422 2004-01-01 00:00:00 2004-01-01 00:00:00
+1080428421 2004-03-28 01:59:59 2004-03-28 01:59:59
+1080428422 2004-03-28 03:00:00 2004-03-28 02:30:00
+1080428422 2004-03-28 03:00:00 2004-03-28 03:00:00
+1083355222 2004-05-01 00:00:00 2004-05-01 00:00:00
+1099170022 2004-10-31 01:00:00 2004-10-31 01:00:00
+1099177222 2004-10-31 02:00:00 2004-10-31 02:00:00
+1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
+1099184422 2004-10-31 04:00:00 2004-10-31 04:00:00
+1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
+362793608 1981-07-01 03:59:59 1981-07-01 03:59:59
+362793610 1981-07-01 04:00:00 1981-07-01 04:00:00
+drop table t1;
+create table t1 (ts timestamp);
+insert into t1 values (19730101235900), (20040101235900);
+select * from t1;
+ts
+1973-01-01 23:59:00
+2004-01-01 23:59:00
+drop table t1;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 95bba1d4ec7..8a0c74b3ae5 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -682,8 +682,8 @@ id txt
3 NULL
1 Chevy
drop table t1;
-CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1)));
-INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
+CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
+INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = '';
max(i)
4
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 524bc9c50d4..127a54e087b 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -97,13 +97,15 @@ select * from t1 where a is null or b is null;
a b
drop table t1;
create table t1 (t datetime);
-insert into t1 values (20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
+insert into t1 values (20030102030460),(20030102036301),(20030102240401),
+(20030132030401),(20031302030401),(100001202030401);
Warnings:
Warning 1265 Data truncated for column 't' at row 1
Warning 1265 Data truncated for column 't' at row 2
Warning 1265 Data truncated for column 't' at row 3
Warning 1265 Data truncated for column 't' at row 4
Warning 1265 Data truncated for column 't' at row 5
+Warning 1265 Data truncated for column 't' at row 6
select * from t1;
t
0000-00-00 00:00:00
@@ -111,14 +113,18 @@ t
0000-00-00 00:00:00
0000-00-00 00:00:00
0000-00-00 00:00:00
+0000-00-00 00:00:00
delete from t1;
-insert into t1 values ("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
+insert into t1 values
+("2003-01-02 03:04:60"),("2003-01-02 03:63:01"),("2003-01-02 24:04:01"),
+("2003-01-32 03:04:01"),("2003-13-02 03:04:01"), ("10000-12-02 03:04:00");
Warnings:
Warning 1264 Data truncated; out of range for column 't' at row 1
Warning 1264 Data truncated; out of range for column 't' at row 2
Warning 1264 Data truncated; out of range for column 't' at row 3
Warning 1264 Data truncated; out of range for column 't' at row 4
Warning 1264 Data truncated; out of range for column 't' at row 5
+Warning 1264 Data truncated; out of range for column 't' at row 6
select * from t1;
t
0000-00-00 00:00:00
@@ -126,6 +132,7 @@ t
0000-00-00 00:00:00
0000-00-00 00:00:00
0000-00-00 00:00:00
+0000-00-00 00:00:00
delete from t1;
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
Warnings:
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 75f0298797a..2f996382586 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -22,14 +22,14 @@ select * from t1;
f1 f2
10 10
100000 100000
-1.23457e+09 1234567890
+1.23457e+9 1234567890
1e+10 10000000000
1e+15 1e+15
1e+20 1e+20
3.40282e+38 1e+50
3.40282e+38 1e+150
-10 -10
-1e-05 1e-05
+1e-5 1e-5
1e-10 1e-10
1e-15 1e-15
1e-20 1e-20
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 7820cd1d6ff..49a2907f571 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1110,4 +1110,14 @@ t1 CREATE TABLE `t1` (
`a` char(1) character set latin1 collate latin1_german1_ci default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+create table t1 as
+(select a from t2) union
+(select b from t2) union
+(select 'c' collate latin1_german1_ci from t2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) character set latin1 collate latin1_german1_ci default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
drop table t2;
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 2750478c1c5..4f521143d97 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -169,18 +169,12 @@ SET @`a b`='hello';
INSERT INTO t1 VALUES(@`a b`);
set @var1= "';aaa";
insert into t1 values (@var1);
-create table t2 (c char(30)) charset=ucs2;
-set @v=convert('abc' using ucs2);
-insert into t2 values (@v);
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 User var 1 79 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
master-bin.000001 120 Query 1 120 use `test`; INSERT INTO t1 VALUES(@`a b`)
master-bin.000001 184 User var 1 184 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
master-bin.000001 226 Query 1 226 use `test`; insert into t1 values (@var1)
-master-bin.000001 290 Query 1 290 use `test`; create table t2 (c char(30)) charset=ucs2
-master-bin.000001 366 User var 1 366 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
-master-bin.000001 406 Query 1 406 use `test`; insert into t2 values (@v)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci;
use test;
@@ -189,9 +183,8 @@ INSERT INTO t1 VALUES(@`a b`);
SET @`var1`:=_latin1 0x273B616161 COLLATE latin1_swedish_ci;
SET TIMESTAMP=10000;
insert into t1 values (@var1);
-SET TIMESTAMP=10000;
-create table t2 (c char(30)) charset=ucs2;
-SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
-SET TIMESTAMP=10000;
-insert into t2 values (@v);
-drop table t1, t2;
+drop table t1;
+set @var= NULL ;
+select FIELD( @var,'1it','Hit') as my_column;
+my_column
+0
diff --git a/mysql-test/std_data/Moscow_leap b/mysql-test/std_data/Moscow_leap
new file mode 100644
index 00000000000..4994c005595
--- /dev/null
+++ b/mysql-test/std_data/Moscow_leap
Binary files differ
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index e46027ae8d9..66a4adc90fe 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -324,3 +324,15 @@ alter table t1 rename to `t1\\`;
rename table t1 to `t1\\`;
drop table t1;
+#
+# Bug #6479 ALTER TABLE ... changing charset fails for TEXT columns
+#
+# The column's character set was changed but the actual data was not
+# modified. In other words, the values were reinterpreted
+# as UTF8 instead of being converted.
+create table t1 (a text) character set koi8r;
+insert into t1 values (_koi8r'ÔÅÓÔ');
+select hex(a) from t1;
+alter table t1 convert to character set cp1251;
+select hex(a) from t1;
+drop table t1;
diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test
index 3e702fd5257..54ad8e92237 100644
--- a/mysql-test/t/binary.test
+++ b/mysql-test/t/binary.test
@@ -80,3 +80,10 @@ select * from t1 where firstname='john' and firstname = binary 'john';
select * from t1 where firstname='John' and firstname like binary 'john';
select * from t1 where firstname='john' and firstname like binary 'John';
drop table t1;
+
+#
+# Bug #6552 CHAR column w/o length is legal, BINARY w/o length is not
+#
+create table t1 (a binary);
+show create table t1;
+drop table t1;
diff --git a/mysql-test/t/client_test.test b/mysql-test/t/client_test.test
index 830c5f1b8a2..66f5e69eb36 100644
--- a/mysql-test/t/client_test.test
+++ b/mysql-test/t/client_test.test
@@ -1,2 +1,2 @@
--disable_result_log
---exec $TESTS_BINDIR/client_test --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent
+--exec $TESTS_BINDIR/client_test --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent
diff --git a/mysql-test/t/consistent_snapshot.test b/mysql-test/t/consistent_snapshot.test
new file mode 100644
index 00000000000..7afdae36325
--- /dev/null
+++ b/mysql-test/t/consistent_snapshot.test
@@ -0,0 +1,41 @@
+-- source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+### Test 1:
+### - While a consistent snapshot transaction is executed,
+### no external inserts should be visible to the transaction.
+
+connection con1;
+create table t1 (a int) engine=innodb;
+start transaction with consistent snapshot;
+
+connection con2;
+insert into t1 values(1);
+
+connection con1;
+select * from t1; # if consistent snapshot was set as expected, we
+# should see nothing.
+commit;
+
+### Test 2:
+### - For any non-consistent snapshot transaction, external
+### committed inserts should be visible to the transaction.
+
+delete from t1;
+start transaction; # Now we omit WITH CONSISTENT SNAPSHOT
+
+connection con2;
+insert into t1 values(1);
+
+connection con1;
+select * from t1; # if consistent snapshot was not set, as expected, we
+# should see 1.
+commit;
+
+drop table t1;
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index 9bf1808636e..b1d71a6af15 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -7,12 +7,6 @@
drop table if exists t1;
--enable_warnings
-SET NAMES big5;
-
-#
-# Bug 1883: LIKE did not work in some cases with a key.
-#
-CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
-INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
-SELECT * FROM t1 WHERE c LIKE 'aaa%';
-DROP TABLE t1;
+SET @test_character_set= 'big5';
+SET @test_collation= 'big5_chinese_ci';
+-- source include/ctype_common.inc
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
index 14062437428..677acd9faa9 100644
--- a/mysql-test/t/ctype_latin1.test
+++ b/mysql-test/t/ctype_latin1.test
@@ -53,3 +53,10 @@ SELECT
hex(@l:=convert(@u using latin1)),
a=@l FROM t1;
DROP TABLE t1;
+
+#
+# Bug #6737: REGEXP gives wrong result with case sensitive collation
+#
+select 'a' regexp 'A' collate latin1_general_ci;
+select 'a' regexp 'A' collate latin1_general_cs;
+select 'a' regexp 'A' collate latin1_bin;
diff --git a/mysql-test/t/ctype_tis620.test b/mysql-test/t/ctype_tis620.test
index 92a9eada05f..21ec314dca7 100644
--- a/mysql-test/t/ctype_tis620.test
+++ b/mysql-test/t/ctype_tis620.test
@@ -116,3 +116,38 @@ CREATE TABLE t1 (a char(10) not null) CHARACTER SET tis620;
INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
DROP TABLE t1;
+
+#
+# Bug#6608
+#
+CREATE TABLE t1 (
+ `id` int(11) NOT NULL auto_increment,
+ `url` varchar(200) NOT NULL default '',
+ `name` varchar(250) NOT NULL default '',
+ `type` int(11) NOT NULL default '0',
+ `website` varchar(250) NOT NULL default '',
+ `adddate` date NOT NULL default '0000-00-00',
+ `size` varchar(20) NOT NULL default '',
+ `movieid` int(11) NOT NULL default '0',
+ `musicid` int(11) NOT NULL default '0',
+ `star` varchar(20) NOT NULL default '',
+ `download` int(11) NOT NULL default '0',
+ `lastweek` int(11) NOT NULL default '0',
+ `thisweek` int(11) NOT NULL default '0',
+ `page` varchar(250) NOT NULL default '',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `url` (`url`)
+) CHARACTER SET tis620;
+
+INSERT INTO t1 VALUES
+(1,'http://www.siamzone.com/download/download/000001-frodo_1024.jpg','The Lord
+of the Rings
+Wallpapers',1,'http://www.lordoftherings.net','2002-01-22','',448,0,'',3805,0,0,
+'');
+INSERT INTO t1 VALUES (2,'http://www.othemovie.com/OScreenSaver1.EXE','O
+Screensaver',2,'','2002-01-22','',491,0,'',519,0,0,'');
+INSERT INTO t1 VALUES
+(3,'http://www.siamzone.com/download/download/000003-jasonx2(800x600).jpg','Jaso
+n X Wallpapers',1,'','2002-05-31','',579,0,'',1091,0,0,'');
+select * from t1 order by id;
+DROP TABLE t1;
diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test
index 708a31d637e..e640e6b53dc 100644
--- a/mysql-test/t/ctype_uca.test
+++ b/mysql-test/t/ctype_uca.test
@@ -435,3 +435,7 @@ INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F0646062F USING utf8));
INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450647064506270646 USING utf8));
SELECT HEX(CONVERT(col1 USING ucs2)) FROM t1 ORDER BY col1 COLLATE utf8_persian_ci, col1 COLLATE utf8_bin;
DROP TABLE t1;
+
+SET @test_character_set= 'utf8';
+SET @test_collation= 'utf8_swedish_ci';
+-- source include/ctype_common.inc
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index d9ef91496e9..0b8678ef59b 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -315,3 +315,27 @@ alter table t1 modify a char(5);
select a, hex(a) from t1;
drop table t1;
+#
+# Check prepare statement from an UCS2 string
+#
+set @ivar= 1234;
+set @str1 = 'select ?';
+set @str2 = convert(@str1 using ucs2);
+prepare stmt1 from @str2;
+execute stmt1 using @ivar;
+
+#
+# Check correct binlogging of UCS2 user variables (BUG#3875)
+#
+SET TIMESTAMP=10000;
+create table t2 (c char(30)) charset=ucs2;
+set @v=convert('abc' using ucs2);
+reset master;
+insert into t2 values (@v);
+show binlog events from 79;
+# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
+# absolutely need variables names to be quoted and strings to be
+# escaped).
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
+drop table t2;
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
index e5405d9f1bd..9cfb6b14d7e 100644
--- a/mysql-test/t/ctype_ujis.test
+++ b/mysql-test/t/ctype_ujis.test
@@ -83,3 +83,39 @@ CREATE TABLE t1 (
SHOW CREATE TABLE t1;
SHOW COLUMNS FROM t1;
DROP TABLE t1;
+
+#
+# Bug #6345 Unexpected behaviour with partial indices
+#
+--disable_warnings
+CREATE TABLE t1
+(
+ a INTEGER NOT NULL,
+ b VARCHAR(50) NOT NULL DEFAULT '',
+ PRIMARY KEY (a),
+ KEY b (b(10))
+) TYPE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+--enable_warnings
+INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
+INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
+INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
+SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
+SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
+SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
+DROP TABLE t1;
+--disable_warnings
+CREATE TABLE t1
+(
+ a INTEGER NOT NULL,
+ b VARCHAR(50) NOT NULL DEFAULT '',
+ PRIMARY KEY (a),
+ KEY b (b(10))
+) TYPE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+--enable_warnings
+INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
+INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
+INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
+SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
+SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
+SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
+DROP TABLE t1;
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 5f60445d765..0bf7187865d 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -29,12 +29,34 @@ drop table t1;
# (This assumes a block size of 1024)
#
-create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
-insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
+create table t1 (
+ a bigint not null,
+ b bigint not null default 0,
+ c bigint not null default 0,
+ d bigint not null default 0,
+ e bigint not null default 0,
+ f bigint not null default 0,
+ g bigint not null default 0,
+ h bigint not null default 0,
+ i bigint not null default 0,
+ j bigint not null default 0,
+ primary key (a,b,c,d,e,f,g,h,i,j));
+insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
delete from t1 where a=26;
drop table t1;
-create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
-insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
+create table t1 (
+ a bigint not null,
+ b bigint not null default 0,
+ c bigint not null default 0,
+ d bigint not null default 0,
+ e bigint not null default 0,
+ f bigint not null default 0,
+ g bigint not null default 0,
+ h bigint not null default 0,
+ i bigint not null default 0,
+ j bigint not null default 0,
+ primary key (a,b,c,d,e,f,g,h,i,j));
+insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27;
drop table t1;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 5af2575ddc4..41fbf3f27ac 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -98,6 +98,8 @@ select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
+select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
+select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
drop table t1;
#
@@ -279,7 +281,7 @@ SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
SET NAMES latin1;
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
-SELECT t, collation(t),MATCH t AGAINST ('Osnabruck') FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
+SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
#alter table t1 modify t text character set latin1 collate latin1_german2_ci not null;
alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
@@ -295,3 +297,14 @@ insert into t1 (s) values ('pära para para'),('para para para');
select * from t1 where match(s) against('para' in boolean mode);
select * from t1 where match(s) against('par*' in boolean mode);
DROP TABLE t1;
+
+#
+# icc -ip bug (ip = interprocedural optimization)
+# bug#5528
+#
+CREATE TABLE t1 (h text, FULLTEXT (h));
+INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing');
+REPAIR TABLE t1;
+select count(*) from t1;
+drop table t1;
+
diff --git a/mysql-test/t/fulltext_order_by.test b/mysql-test/t/fulltext_order_by.test
index f8afe49d95d..5856f68ec9e 100644
--- a/mysql-test/t/fulltext_order_by.test
+++ b/mysql-test/t/fulltext_order_by.test
@@ -10,25 +10,25 @@ CREATE TABLE t1 (
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
("steve"),("is"),("cool"),("steve is cool");
# basic MATCH
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve');
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
# MATCH + ORDER BY (with ft-ranges)
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
# MATCH + ORDER BY (with normal ranges) + UNIQUE
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
# MATCH + ORDER BY + UNIQUE (const_table)
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
# ORDER BY MATCH
-SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
drop table t1;
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 8d8779e9d1b..79d6112e6de 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -384,6 +384,17 @@ select coercibility(max(a)) from t1;
drop table t1;
#
+# Bug #6658 MAX(column) returns incorrect coercibility
+#
+create table t1 (a char character set latin2);
+insert into t1 values ('a'),('b');
+select charset(max(a)), coercibility(max(a)),
+ charset(min(a)), coercibility(min(a)) from t1;
+create table t2 select max(a),min(a) from t1;
+show create table t2;
+drop table t2,t1;
+
+#
# aggregate functions on static tables
#
create table t1 (a int);
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 22079377ad2..3cd8c064817 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -89,3 +89,10 @@ select 1 in ('1.0',2.0);
select 1 in (1.0,'2.0');
select 1 in ('1.1',2);
select 1 in ('1.1',2.0);
+
+# Test case for bug #6365
+
+create table t1 (a char(20) character set binary);
+insert into t1 values ('aa'), ('bb');
+select * from t1 where a in (NULL, 'aa');
+drop table t1;
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 3eab694ee05..d5a3e80c417 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -83,6 +83,12 @@ select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")),
select length(unhex(md5("abrakadabra")));
#
+# Bug #6564: QUOTE(NULL
+#
+
+select concat('a', quote(NULL));
+
+#
# Wrong usage of functions
#
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 67192c55ef9..b9e592fc5d9 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -230,6 +230,13 @@ select unix_timestamp(@a);
select unix_timestamp('1969-12-01 19:00:01');
#
+# Test for bug #6439 "unix_timestamp() function returns wrong datetime
+# values for too big argument". It should return error instead.
+#
+select from_unixtime(0);
+select from_unixtime(2145916800);
+
+#
# Test types from + INTERVAL
#
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index d9c281cfebc..963b9ae5080 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -98,6 +98,30 @@ GRANT FILE on mysqltest.* to mysqltest_1@localhost;
select 1; -- To test that the previous command didn't cause problems
#
+# Bug #4898: User privileges depending on ORDER BY Settings of table db
+#
+insert into mysql.user (host, user) values ('localhost', 'test11');
+insert into mysql.db (host, db, user, select_priv) values
+('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
+alter table mysql.db order by db asc;
+flush privileges;
+show grants for test11@localhost;
+alter table mysql.db order by db desc;
+flush privileges;
+show grants for test11@localhost;
+delete from mysql.user where user='test11';
+delete from mysql.db where user='test11';
+
+#
+# Bug#6123: GRANT USAGE inserts useless Db row
+#
+create database mysqltest1;
+grant usage on mysqltest1.* to test6123 identified by 'magic123';
+select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
+delete from mysql.user where user='test6123';
+drop database mysqltest1;
+
+#
# Test for 'drop user', 'revoke privileges, grant'
#
@@ -175,21 +199,6 @@ DROP DATABASE ÂÄ;
SET NAMES latin1;
#
-# Bug #4898: User privileges depending on ORDER BY Settings of table db
-#
-insert into mysql.user (host, user) values ('localhost', 'test11');
-insert into mysql.db (host, db, user, select_priv) values
-('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
-alter table mysql.db order by db asc;
-flush privileges;
-show grants for test11@localhost;
-alter table mysql.db order by db desc;
-flush privileges;
-show grants for test11@localhost;
-delete from mysql.user where user='test11';
-delete from mysql.db where user='test11';
-
-#
# Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
#
USE test;
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index e1776245d9e..2eff36f3317 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -174,3 +174,14 @@ CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
INSERT INTO t1 VALUES(1,1), (1,NULL);
SELECT * FROM t1 WHERE B is not null;
DROP TABLE t1;
+
+#
+# Bug #6748
+# heap_rfirst() doesn't work (and never did!)
+#
+CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int(10) unsigned NOT NULL) ENGINE=HEAP;
+INSERT INTO t1 VALUES ('massecot',1101106491),('altec',1101106492),('stitch+',1101106304),('Seb Corgan',1101106305),('beerfilou',1101106263),('flaker',1101106529),('joce8',5),('M4vrick',1101106418),('gabay008',1101106525),('Vamp irX',1101106291),('ZoomZip',1101106546),('rip666',1101106502),('CBP ',1101106397),('guezpard',1101106496);
+DELETE FROM t1 WHERE date<1101106546;
+SELECT * FROM t1;
+DROP TABLE t1;
+
diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test
index 412b6f2e705..6d8fdec4b9e 100644
--- a/mysql-test/t/heap_hash.test
+++ b/mysql-test/t/heap_hash.test
@@ -3,7 +3,7 @@
#
--disable_warnings
-drop table if exists t1;
+drop table if exists t1,t2;
--enable_warnings
create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
@@ -141,3 +141,113 @@ INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
DELETE from t1 where a < 100;
SELECT * from t1;
DROP TABLE t1;
+
+
+#
+# Hash index # records estimate test
+#
+create table t1
+(
+ a char(8) not null,
+ b char(20) not null,
+ c int not null,
+ key (a)
+) engine=heap;
+
+insert into t1 values ('aaaa', 'prefill-hash=5',0);
+insert into t1 values ('aaab', 'prefill-hash=0',0);
+insert into t1 values ('aaac', 'prefill-hash=7',0);
+insert into t1 values ('aaad', 'prefill-hash=2',0);
+insert into t1 values ('aaae', 'prefill-hash=1',0);
+insert into t1 values ('aaaf', 'prefill-hash=4',0);
+insert into t1 values ('aaag', 'prefill-hash=3',0);
+insert into t1 values ('aaah', 'prefill-hash=6',0);
+
+explain select * from t1 where a='aaaa';
+explain select * from t1 where a='aaab';
+explain select * from t1 where a='aaac';
+explain select * from t1 where a='aaad';
+insert into t1 select * from t1;
+
+explain select * from t1 where a='aaaa';
+explain select * from t1 where a='aaab';
+explain select * from t1 where a='aaac';
+explain select * from t1 where a='aaad';
+
+# a known effect: table reload causes statistics to be updated:
+flush tables;
+explain select * from t1 where a='aaaa';
+explain select * from t1 where a='aaab';
+explain select * from t1 where a='aaac';
+explain select * from t1 where a='aaad';
+
+# Check if delete_all_rows() updates #hash_buckets
+create table t2 as select * from t1;
+delete from t1;
+insert into t1 select * from t2;
+explain select * from t1 where a='aaaa';
+explain select * from t1 where a='aaab';
+explain select * from t1 where a='aaac';
+explain select * from t1 where a='aaad';
+drop table t1, t2;
+
+
+# Btree and hash index use costs.
+create table t1 (
+ id int unsigned not null primary key auto_increment,
+ name varchar(20) not null,
+ index heap_idx(name),
+ index btree_idx using btree(name)
+) engine=heap;
+
+create table t2 (
+ id int unsigned not null primary key auto_increment,
+ name varchar(20) not null,
+ index btree_idx using btree(name),
+ index heap_idx(name)
+) engine=heap;
+
+insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'),
+ ('Suzy'), ('Hoppy'), ('Burrito'), ('Mimi'), ('Sherry'), ('Ben'), ('Phil'),
+ ('Emily'), ('Mike');
+insert into t2 select * from t1;
+explain select * from t1 where name='matt';
+explain select * from t2 where name='matt';
+
+explain select * from t1 where name='Lilu';
+explain select * from t2 where name='Lilu';
+
+explain select * from t1 where name='Phil';
+explain select * from t2 where name='Phil';
+
+explain select * from t1 where name='Lilu';
+explain select * from t2 where name='Lilu';
+
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+flush tables;
+select count(*) from t1 where name='Matt';
+explain select * from t1 ignore index (btree_idx) where name='matt';
+show index from t1;
+
+show index from t1;
+
+create table t3
+(
+ a varchar(20) not null,
+ b varchar(20) not null,
+ key (a,b)
+) engine=heap;
+insert into t3 select name, name from t1;
+show index from t3;
+show index from t3;
+
+# test rec_per_key use for joins.
+explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name;
+
+drop table t1, t2, t3;
+
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 50ab3bdb8bd..cf7be4f882c 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1110,6 +1110,7 @@ show create table t2;
drop table t2;
# Test error handling
+--replace_result \\ /
--error 1005
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
@@ -1157,3 +1158,25 @@ show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
drop table t1;
+
+#
+# Bug #6126: Duplicate columns in keys gives misleading error message
+#
+--error 1060
+create table t1 (c char(10), index (c,c)) engine=innodb;
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
+create table t1 (c1 char(10), c2 char(10)) engine=innodb;
+--error 1060
+alter table t1 add key (c1,c1);
+--error 1060
+alter table t1 add key (c2,c1,c1);
+--error 1060
+alter table t1 add key (c1,c2,c1);
+--error 1060
+alter table t1 add key (c1,c1,c2);
+drop table t1;
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index 54379685731..f5acab05108 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -99,46 +99,57 @@ create table t1(number int auto_increment primary key, original_value varchar(50
set @value= "aa";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= "1aa";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= "aa1";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= "1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= "-1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= 1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= -1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= 1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= -1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= 1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
set @value= -1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
+--replace_result e-0 e- e+0 e+
--query_vertical select * from t1 where number =last_insert_id()
drop table t1;
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index bc96318ae2e..d177a68e685 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -506,3 +506,79 @@ select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
order by UUX desc;
drop table t1, t2;
+
+# Tests for bugs #6307 and 6460
+
+create table t1 (a int, b int, unique index idx (a, b));
+create table t2 (a int, b int, c int, unique index idx (a, b));
+
+insert into t1 values (1, 10), (1,11), (2,10), (2,11);
+insert into t2 values (1,10,3);
+
+select t1.a, t1.b, t2.c from t1 left join t2
+ on t1.a=t2.a and t1.b=t2.b and t2.c=3
+ where t1.a=1 and t2.c is null;
+
+drop table t1, t2;
+
+CREATE TABLE t1 (
+ ts_id bigint(20) default NULL,
+ inst_id tinyint(4) default NULL,
+ flag_name varchar(64) default NULL,
+ flag_value text,
+ UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+CREATE TABLE t2 (
+ ts_id bigint(20) default NULL,
+ inst_id tinyint(4) default NULL,
+ flag_name varchar(64) default NULL,
+ flag_value text,
+ UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES
+ (111056548820001, 0, 'flag1', NULL),
+ (111056548820001, 0, 'flag2', NULL),
+ (2, 0, 'other_flag', NULL);
+
+INSERT INTO t2 VALUES
+ (111056548820001, 3, 'flag1', 'sss');
+
+SELECT t1.flag_name,t2.flag_value
+ FROM t1 LEFT JOIN t2
+ ON (t1.ts_id = t2.ts_id AND t1.flag_name = t2.flag_name AND
+ t2.inst_id = 3)
+ WHERE t1.inst_id = 0 AND t1.ts_id=111056548820001 AND
+ t2.flag_value IS NULL;
+
+DROP TABLE t1,t2;
+
+CREATE TABLE invoice (
+ id int(11) unsigned NOT NULL auto_increment,
+ text_id int(10) unsigned default NULL,
+ PRIMARY KEY (id)
+);
+
+INSERT INTO invoice VALUES("1", "0");
+INSERT INTO invoice VALUES("2", "10");
+
+CREATE TABLE text_table (
+ text_id char(3) NOT NULL default '',
+ language_id char(3) NOT NULL default '',
+ text_data text,
+ PRIMARY KEY (text_id,language_id)
+);
+
+INSERT INTO text_table VALUES("0", "EN", "0-EN");
+INSERT INTO text_table VALUES("0", "SV", "0-SV");
+INSERT INTO text_table VALUES("10", "EN", "10-EN");
+INSERT INTO text_table VALUES("10", "SV", "10-SV");
+
+SELECT invoice.id, invoice.text_id, text_table.text_data
+ FROM invoice LEFT JOIN text_table
+ ON invoice.text_id = text_table.text_id
+ AND text_table.language_id = 'SV'
+ WHERE (invoice.id LIKE '%' OR text_table.text_data LIKE '%');
+
+DROP TABLE invoice, text_table;
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index 5ee2f68ab83..a0a291fdf3c 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -297,3 +297,26 @@ drop table t1;
--error 1105
create table t1 (c char(10), index (c(0)));
+
+#
+# Bug #6126: Duplicate columns in keys should fail
+# Bug #6252: (dup)
+#
+--error 1060
+create table t1 (c char(10), index (c,c));
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1));
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2));
+--error 1060
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1));
+create table t1 (c1 char(10), c2 char(10));
+--error 1060
+alter table t1 add key (c1,c1);
+--error 1060
+alter table t1 add key (c2,c1,c1);
+--error 1060
+alter table t1 add key (c1,c2,c1);
+--error 1060
+alter table t1 add key (c1,c1,c2);
+drop table t1;
diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test
index 9d3125efa61..6dee87ec5a6 100644
--- a/mysql-test/t/key_cache.test
+++ b/mysql-test/t/key_cache.test
@@ -156,3 +156,14 @@ set global keycache2.key_buffer_size=0;
# Test to set up a too small size for a key cache (bug #2064)
set global keycache3.key_buffer_size=100;
set global keycache3.key_buffer_size=0;
+
+# Test case for buf 6447
+
+create table t1 (mytext text, FULLTEXT (mytext));
+insert t1 values ('aaabbb');
+
+check table t1;
+set GLOBAL key_cache_block_size=2048;
+check table t1;
+
+drop table t1;
diff --git a/mysql-test/t/mix_innodb_myisam_binlog-master.opt b/mysql-test/t/mix_innodb_myisam_binlog-master.opt
new file mode 100644
index 00000000000..cb48f1aaf60
--- /dev/null
+++ b/mysql-test/t/mix_innodb_myisam_binlog-master.opt
@@ -0,0 +1 @@
+--loose-innodb_lock_wait_timeout=2
diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test
index 9c576b080ca..89a7f8f3036 100644
--- a/mysql-test/t/mix_innodb_myisam_binlog.test
+++ b/mysql-test/t/mix_innodb_myisam_binlog.test
@@ -172,4 +172,36 @@ select a from t1 order by a; # check that savepoints work :)
show binlog events from 79;
+# Test for BUG#5714, where a MyISAM update in the transaction used to
+# release row-level locks in InnoDB
+
+connect (con3,localhost,root,,);
+
+connection con3;
+delete from t1;
+delete from t2;
+--disable_warnings
+alter table t2 type=MyISAM;
+--enable_warnings
+insert into t1 values (1);
+begin;
+select * from t1 for update;
+
+connection con2;
+select (@before:=unix_timestamp())*0; # always give repeatable output
+begin;
+send select * from t1 for update;
+
+connection con3;
+insert into t2 values (20);
+
+connection con2;
+--error 1205
+reap;
+select (@after:=unix_timestamp())*0; # always give repeatable output
+# verify that innodb_lock_wait_timeout was exceeded. When there was
+# the bug, the reap would return immediately after the insert into t2.
+select (@after-@before) >= 2;
+
+# cleanup
drop table t1,t2;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index f9081e8769b..c8ed7910b76 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -498,11 +498,12 @@ alter table t1 disable keys;
show keys from t1;
create table t2 (a int);
let $i=1000;
+set @@rand_seed1=31415926,@@rand_seed2=2718281828;
--disable_query_log
while ($i)
{
dec $i;
- eval insert t2 values (rand()*100000);
+ insert t2 values (rand()*100000);
}
--enable_query_log
insert t1 select * from t2;
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
index 95b616fc7b2..6551732adba 100644
--- a/mysql-test/t/ndb_autodiscover.test
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -1,7 +1,7 @@
-- source include/have_ndb.inc
--disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
--enable_warnings
################################################
@@ -199,7 +199,7 @@ insert into t4 values (1, "Automatic");
select * from t4;
# Remove the table from NDB
-system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t4 > /dev/null ;
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 > /dev/null ;
#
# Test that correct error is returned
@@ -230,7 +230,7 @@ select * from t4;
flush tables;
# Remove the table from NDB
-system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t4 > /dev/null ;
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 > /dev/null ;
SHOW TABLES;
@@ -264,8 +264,8 @@ insert into t8 values (8, "myisam table 8");
insert into t9 values (9);
# Remove t3, t5 from NDB
-system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t3 > /dev/null ;
-system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t5 > /dev/null ;
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
# Remove t6, t7 from disk
system rm var/master-data/test/t6.frm > /dev/null ;
system rm var/master-data/test/t7.frm > /dev/null ;
@@ -306,8 +306,8 @@ insert into t8 values (8, "myisam table 8");
insert into t9 values (9);
# Remove t3, t5 from NDB
-system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t3 > /dev/null ;
-system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t5 > /dev/null ;
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
+system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
# Remove t6, t7 from disk
system rm var/master-data/test/t6.frm > /dev/null ;
system rm var/master-data/test/t7.frm > /dev/null ;
@@ -472,5 +472,11 @@ system rm var/master-data/test/t9.frm ;
# MySQL Server will have been restarted because it has a
# ndb_autodiscover2-master.opt file.
+create table t10 (
+ a int not null primary key,
+ b blob
+) engine=ndb;
+insert into t10 values (1, 'kalle');
+--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB` > /dev/null 2>&1 || true
diff --git a/mysql-test/t/ndb_autodiscover2.test b/mysql-test/t/ndb_autodiscover2.test
index cce75d5ca4f..11e1cc204f7 100644
--- a/mysql-test/t/ndb_autodiscover2.test
+++ b/mysql-test/t/ndb_autodiscover2.test
@@ -13,4 +13,7 @@ show status like 'handler_discover%';
drop table t9;
+--error 1296
+select * from t10;
+drop table t10;
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
index f5bed3dcdff..2671223ada8 100644
--- a/mysql-test/t/ndb_basic.test
+++ b/mysql-test/t/ndb_basic.test
@@ -36,6 +36,8 @@ UPDATE t1 SET pk1=2 WHERE attr1=1;
SELECT * FROM t1 ORDER BY pk1;
UPDATE t1 SET pk1=pk1 + 1;
SELECT * FROM t1 ORDER BY pk1;
+UPDATE t1 SET pk1=4 WHERE pk1 = 3;
+SELECT * FROM t1 ORDER BY pk1;
# Delete the record
DELETE FROM t1;
@@ -359,6 +361,21 @@ drop table test.t1, t2;
drop database mysqltest;
#
+# BUG#6031 - DROP DATABASE doesn't drop database on first try
+#
+
+--disable_warnings
+drop database if exists ndbtest1;
+--enable_warnings
+
+create database ndbtest1;
+use ndbtest1;
+create table t1(id int) engine=ndbcluster;
+drop database ndbtest1;
+--error 1008
+drop database ndbtest1;
+
+#
# test support of char(0)
#
diff --git a/mysql-test/t/ndb_charset.test b/mysql-test/t/ndb_charset.test
index b9f28ed0faf..f1ec0485e12 100644
--- a/mysql-test/t/ndb_charset.test
+++ b/mysql-test/t/ndb_charset.test
@@ -86,9 +86,9 @@ create table t1 (
# ok
insert into t1 values(1, 'aAa');
# fail
---error 1169
+--error 1062
insert into t1 values(2, 'aaa');
---error 1169
+--error 1062
insert into t1 values(3, 'AAA');
# 1
select * from t1 order by p;
diff --git a/mysql-test/t/ndb_grant.test b/mysql-test/t/ndb_grant.test
new file mode 100644
index 00000000000..d3899d9972f
--- /dev/null
+++ b/mysql-test/t/ndb_grant.test
@@ -0,0 +1,374 @@
+-- source include/have_ndb.inc
+# Test of GRANT commands
+
+# Cleanup
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+SET NAMES binary;
+
+#
+# Alter mysql system tables to ndb
+# make sure you alter all back in the end
+#
+use mysql;
+alter table columns_priv engine=ndb;
+alter table db engine=ndb;
+alter table func engine=ndb;
+alter table help_category engine=ndb;
+alter table help_keyword engine=ndb;
+alter table help_relation engine=ndb;
+alter table help_topic engine=ndb;
+alter table host engine=ndb;
+alter table tables_priv engine=ndb;
+alter table time_zone engine=ndb;
+alter table time_zone_leap_second engine=ndb;
+alter table time_zone_name engine=ndb;
+alter table time_zone_transition engine=ndb;
+alter table time_zone_transition_type engine=ndb;
+alter table user engine=ndb;
+use test;
+
+#
+# Test that SSL options works properly
+#
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+flush privileges;
+begin;
+grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+grant delete on mysqltest.* to mysqltest_1@localhost;
+commit;
+select * from mysql.user where user="mysqltest_1";
+show grants for mysqltest_1@localhost;
+begin;
+revoke delete on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+grant select on mysqltest.* to mysqltest_1@localhost require NONE;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+
+#
+# Test that the new db privileges are stored/retrieved correctly
+#
+
+begin;
+grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+flush privileges;
+show grants for mysqltest_1@localhost;
+begin;
+revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
+commit;
+flush privileges;
+show grants for mysqltest_1@localhost;
+begin;
+revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+commit;
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+begin;
+grant usage on test.* to mysqltest_1@localhost with grant option;
+commit;
+show grants for mysqltest_1@localhost;
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+delete from mysql.tables_priv where user='mysqltest_1';
+delete from mysql.columns_priv where user='mysqltest_1';
+flush privileges;
+--error 1141
+show grants for mysqltest_1@localhost;
+
+#
+# Test what happens when you have same table and colum level grants
+#
+
+create table t1 (a int);
+begin;
+GRANT select,update,insert on t1 to mysqltest_1@localhost;
+GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
+begin;
+REVOKE select (a), update on t1 from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+begin;
+GRANT select,references on t1 to mysqltest_1@localhost;
+commit;
+select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
+begin;
+grant all on test.* to mysqltest_3@localhost with grant option;
+revoke all on test.* from mysqltest_3@localhost;
+commit;
+show grants for mysqltest_3@localhost;
+begin;
+revoke grant option on test.* from mysqltest_3@localhost;
+commit;
+show grants for mysqltest_3@localhost;
+begin;
+grant all on test.t1 to mysqltest_2@localhost with grant option;
+revoke all on test.t1 from mysqltest_2@localhost;
+commit;
+show grants for mysqltest_2@localhost;
+begin;
+revoke grant option on test.t1 from mysqltest_2@localhost;
+commit;
+show grants for mysqltest_2@localhost;
+delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+flush privileges;
+drop table t1;
+
+#
+# Test some error conditions
+#
+begin;
+--error 1221
+GRANT FILE on mysqltest.* to mysqltest_1@localhost;
+commit;
+select 1; -- To test that the previous command didn't cause problems
+
+#
+# Bug#6123: GRANT USAGE inserts useless Db row
+#
+create database mysqltest1;
+begin;
+grant usage on mysqltest1.* to test6123 identified by 'magic123';
+commit;
+select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
+delete from mysql.user where user='test6123';
+drop database mysqltest1;
+
+#
+# Test for 'drop user', 'revoke privileges, grant'
+#
+
+create table t1 (a int);
+begin;
+grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
+commit;
+show grants for drop_user2@localhost;
+begin;
+revoke all privileges, grant option from drop_user2@localhost;
+commit;
+drop user drop_user2@localhost;
+
+begin;
+grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
+grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
+grant select(a) on test.t1 to drop_user@localhost;
+commit;
+show grants for drop_user@localhost;
+
+#
+# Bug3086
+#
+set sql_mode=ansi_quotes;
+show grants for drop_user@localhost;
+set sql_mode=default;
+
+set sql_quote_show_create=0;
+show grants for drop_user@localhost;
+set sql_mode="ansi_quotes";
+show grants for drop_user@localhost;
+set sql_quote_show_create=1;
+show grants for drop_user@localhost;
+set sql_mode="";
+show grants for drop_user@localhost;
+
+revoke all privileges, grant option from drop_user@localhost;
+show grants for drop_user@localhost;
+drop user drop_user@localhost;
+begin;
+--error 1269
+revoke all privileges, grant option from drop_user@localhost;
+commit;
+
+begin;
+grant select(a) on test.t1 to drop_user1@localhost;
+commit;
+flush privileges;
+begin;
+grant select on test.t1 to drop_user2@localhost;
+grant select on test.* to drop_user3@localhost;
+grant select on *.* to drop_user4@localhost;
+commit;
+--error 1268
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+begin;
+revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
+drop_user3@localhost, drop_user4@localhost;
+commit;
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+drop table t1;
+begin;
+grant usage on *.* to mysqltest_1@localhost identified by "password";
+grant select, update, insert on test.* to mysqltest@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+drop user mysqltest_1@localhost;
+
+#
+# Bug #3403 Wrong encodin in SHOW GRANTS output
+#
+SET NAMES koi8r;
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ int);
+
+begin;
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+begin;
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
+commit;
+
+begin;
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+begin;
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+commit;
+
+begin;
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+begin;
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+commit;
+
+DROP DATABASE ÂÄ;
+SET NAMES latin1;
+
+#
+# Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
+#
+USE test;
+CREATE TABLE t1 (a int );
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+CREATE TABLE t4 LIKE t1;
+CREATE TABLE t5 LIKE t1;
+CREATE TABLE t6 LIKE t1;
+CREATE TABLE t7 LIKE t1;
+CREATE TABLE t8 LIKE t1;
+CREATE TABLE t9 LIKE t1;
+CREATE TABLE t10 LIKE t1;
+CREATE DATABASE testdb1;
+CREATE DATABASE testdb2;
+CREATE DATABASE testdb3;
+CREATE DATABASE testdb4;
+CREATE DATABASE testdb5;
+CREATE DATABASE testdb6;
+CREATE DATABASE testdb7;
+CREATE DATABASE testdb8;
+CREATE DATABASE testdb9;
+CREATE DATABASE testdb10;
+begin;
+GRANT ALL ON testdb1.* TO testuser@localhost;
+GRANT ALL ON testdb2.* TO testuser@localhost;
+GRANT ALL ON testdb3.* TO testuser@localhost;
+GRANT ALL ON testdb4.* TO testuser@localhost;
+GRANT ALL ON testdb5.* TO testuser@localhost;
+GRANT ALL ON testdb6.* TO testuser@localhost;
+GRANT ALL ON testdb7.* TO testuser@localhost;
+GRANT ALL ON testdb8.* TO testuser@localhost;
+GRANT ALL ON testdb9.* TO testuser@localhost;
+GRANT ALL ON testdb10.* TO testuser@localhost;
+GRANT SELECT ON test.t1 TO testuser@localhost;
+GRANT SELECT ON test.t2 TO testuser@localhost;
+GRANT SELECT ON test.t3 TO testuser@localhost;
+GRANT SELECT ON test.t4 TO testuser@localhost;
+GRANT SELECT ON test.t5 TO testuser@localhost;
+GRANT SELECT ON test.t6 TO testuser@localhost;
+GRANT SELECT ON test.t7 TO testuser@localhost;
+GRANT SELECT ON test.t8 TO testuser@localhost;
+GRANT SELECT ON test.t9 TO testuser@localhost;
+GRANT SELECT ON test.t10 TO testuser@localhost;
+GRANT SELECT (a) ON test.t1 TO testuser@localhost;
+GRANT SELECT (a) ON test.t2 TO testuser@localhost;
+GRANT SELECT (a) ON test.t3 TO testuser@localhost;
+GRANT SELECT (a) ON test.t4 TO testuser@localhost;
+GRANT SELECT (a) ON test.t5 TO testuser@localhost;
+GRANT SELECT (a) ON test.t6 TO testuser@localhost;
+GRANT SELECT (a) ON test.t7 TO testuser@localhost;
+GRANT SELECT (a) ON test.t8 TO testuser@localhost;
+GRANT SELECT (a) ON test.t9 TO testuser@localhost;
+GRANT SELECT (a) ON test.t10 TO testuser@localhost;
+commit;
+begin;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
+commit;
+SHOW GRANTS FOR testuser@localhost;
+DROP USER testuser@localhost;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+DROP DATABASE testdb1;
+DROP DATABASE testdb2;
+DROP DATABASE testdb3;
+DROP DATABASE testdb4;
+DROP DATABASE testdb5;
+DROP DATABASE testdb6;
+DROP DATABASE testdb7;
+DROP DATABASE testdb8;
+DROP DATABASE testdb9;
+DROP DATABASE testdb10;
+
+#
+# Alter mysql system tables back to myisam
+#
+use mysql;
+alter table columns_priv engine=myisam;
+alter table db engine=myisam;
+alter table func engine=myisam;
+alter table help_category engine=myisam;
+alter table help_keyword engine=myisam;
+alter table help_relation engine=myisam;
+alter table help_topic engine=myisam;
+alter table host engine=myisam;
+alter table tables_priv engine=myisam;
+alter table time_zone engine=myisam;
+alter table time_zone_leap_second engine=myisam;
+alter table time_zone_name engine=myisam;
+alter table time_zone_transition engine=myisam;
+alter table time_zone_transition_type engine=myisam;
+alter table user engine=myisam;
+use test;
+flush privileges;
diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test
index 64291c8ab97..53177511bc6 100644
--- a/mysql-test/t/ndb_index_ordered.test
+++ b/mysql-test/t/ndb_index_ordered.test
@@ -1,7 +1,7 @@
-- source include/have_ndb.inc
--disable_warnings
-drop table if exists t1;
+drop table if exists t1, test1, test2;
--enable_warnings
#
@@ -146,3 +146,29 @@ select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
select * from t1 use index (bc) where b < 4 order by a;
select * from t1 use index (bc) where b IS NOT NULL order by a;
drop table t1;
+
+#
+# Bug #6435
+CREATE TABLE test1 (
+SubscrID int(11) NOT NULL auto_increment,
+UsrID int(11) NOT NULL default '0',
+PRIMARY KEY (SubscrID),
+KEY idx_usrid (UsrID)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+
+INSERT INTO test1 VALUES (2,224),(3,224),(1,224);
+
+CREATE TABLE test2 (
+SbclID int(11) NOT NULL auto_increment,
+SbcrID int(11) NOT NULL default '0',
+PRIMARY KEY (SbclID),
+KEY idx_sbcrid (SbcrID)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+
+INSERT INTO test2 VALUES (3,2),(1,1),(2,1),(4,2);
+select * from test1 order by 1;
+select * from test2 order by 1;
+SELECT s.SubscrID,l.SbclID FROM test1 s left JOIN test2 l ON
+l.SbcrID=s.SubscrID WHERE s.UsrID=224 order by 1, 2;
+drop table test1;
+drop table test2;
diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test
index 4a0c689bafb..397a2c45a9f 100644
--- a/mysql-test/t/ndb_index_unique.test
+++ b/mysql-test/t/ndb_index_unique.test
@@ -21,7 +21,7 @@ select * from t1 where b = 4 order by b;
insert into t1 values(7,8,3);
select * from t1 where b = 4 order by a;
--- error 1169
+-- error 1062
insert into t1 values(8, 2, 3);
select * from t1 order by a;
delete from t1 where a = 1;
@@ -30,6 +30,32 @@ select * from t1 order by a;
drop table t1;
+#
+# Indexing NULL values
+#
+
+CREATE TABLE t1 (
+ a int unsigned NOT NULL PRIMARY KEY,
+ b int unsigned,
+ c int unsigned,
+ UNIQUE bc(b,c)
+) engine = ndb;
+
+insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
+select * from t1 use index (bc) where b IS NULL order by a;
+
+select * from t1 use index (bc)order by a;
+select * from t1 use index (bc) order by a;
+select * from t1 use index (PRIMARY) where b IS NULL order by a;
+select * from t1 use index (bc) where b IS NULL order by a;
+select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
+select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
+select * from t1 use index (bc) where b < 4 order by a;
+select * from t1 use index (bc) where b IS NOT NULL order by a;
+-- error 1062
+insert into t1 values(5,1,1);
+drop table t1;
+
#
# Show use of UNIQUE USING HASH indexes
@@ -49,7 +75,7 @@ select * from t2 where c = 6;
insert into t2 values(7,8,3);
select * from t2 where b = 4 order by a;
--- error 1169
+-- error 1062
insert into t2 values(8, 2, 3);
select * from t2 order by a;
delete from t2 where a = 1;
@@ -58,6 +84,14 @@ select * from t2 order by a;
drop table t2;
+-- error 1121
+CREATE TABLE t2 (
+ a int unsigned NOT NULL PRIMARY KEY,
+ b int unsigned not null,
+ c int unsigned,
+ UNIQUE USING HASH (b, c)
+) engine=ndbcluster;
+
#
# Show use of PRIMARY KEY USING HASH indexes
#
@@ -92,7 +126,7 @@ insert into t1 values (-1,NULL), (0,0), (1,NULL),(2,2),(3,NULL),(4,4);
select * from t1 order by pk;
---error 1169
+--error 1062
insert into t1 values (5,0);
select * from t1 order by pk;
delete from t1 where a = 0;
@@ -111,7 +145,7 @@ insert into t2 values (-1,1,17,NULL),(0,NULL,18,NULL),(1,3,19,'abc');
select * from t2 order by pk;
---error 1169
+--error 1062
insert into t2 values(2,3,19,'abc');
select * from t2 order by pk;
delete from t2 where c IS NOT NULL;
diff --git a/mysql-test/t/ndb_insert.test b/mysql-test/t/ndb_insert.test
index c3da4641014..611df3d84e9 100644
--- a/mysql-test/t/ndb_insert.test
+++ b/mysql-test/t/ndb_insert.test
@@ -564,23 +564,37 @@ select count(*) from t1;
--error 1062
insert into t1 select * from t1 where b < 10 order by pk1;
+DELETE FROM t1 WHERE pk1=2;
begin;
---error 1031
-INSERT IGNORE INTO t1 VALUES(1,2,3);
-commit;
-select * from t1 where pk1=1;
+INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
+select * from t1 where pk1 < 3 order by pk1;
+rollback;
---error 1031
-INSERT IGNORE INTO t1 VALUES(1,2,3);
-select * from t1 where pk1=1;
+INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
+select * from t1 where pk1 < 3 order by pk1;
-REPLACE INTO t1 values(1, 2, 3);
+REPLACE INTO t1 values(1, 78, 3);
select * from t1 where pk1=1;
---error 1031
-INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79;
-select * from t1 where pk1=1;
+INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=79;
+select * from t1 where pk1 < 4 order by pk1;
+
+INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=pk1+c;
+select * from t1 where pk1 < 4 order by pk1;
+
+DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
+INSERT INTO t1 VALUES(1,1,1),(2,2,17),(3,4,5) ON DUPLICATE KEY UPDATE pk1=b;
+select * from t1 where pk1 = b and b != c order by pk1;
+
+# The following test case currently does not work
+#DELETE FROM t1;
+#CREATE UNIQUE INDEX bi ON t1(b);
+#INSERT INTO t1 VALUES
+#(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
+#(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
+#INSERT INTO t1 VALUES(0,1,0),(21,21,21) ON DUPLICATE KEY UPDATE pk1=b+10,c=b+10;
+#select * from t1 order by pk1;
DROP TABLE t1;
diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test
index 7d30fd06ba7..9ddef252d67 100644
--- a/mysql-test/t/null.test
+++ b/mysql-test/t/null.test
@@ -119,3 +119,70 @@ alter table t1 change i i int not null;
explain select * from t1 where i=2 or i is null;
drop table t1;
+#
+# NULL has its own type BINARY(0) by default.
+# But NULL should be weaker than a constant
+# when mixing charsets/collations
+#
+set names latin2;
+# Check that result type is taken from a non-null string
+create table t1 select
+ null as c00,
+ if(1, null, 'string') as c01,
+ if(0, null, 'string') as c02,
+ ifnull(null, 'string') as c03,
+ ifnull('string', null) as c04,
+ case when 0 then null else 'string' end as c05,
+ case when 1 then null else 'string' end as c06,
+ coalesce(null, 'string') as c07,
+ coalesce('string', null) as c08,
+ least('string',null) as c09,
+ least(null, 'string') as c10,
+ greatest('string',null) as c11,
+ greatest(null, 'string') as c12,
+ nullif('string', null) as c13,
+ nullif(null, 'string') as c14,
+ trim('string' from null) as c15,
+ trim(null from 'string') as c16,
+ substring_index('string', null, 1) as c17,
+ substring_index(null, 'string', 1) as c18,
+ elt(1, null, 'string') as c19,
+ elt(1, 'string', null) as c20,
+ concat('string', null) as c21,
+ concat(null, 'string') as c22,
+ concat_ws('sep', 'string', null) as c23,
+ concat_ws('sep', null, 'string') as c24,
+ concat_ws(null, 'string', 'string') as c25,
+ make_set(3, 'string', null) as c26,
+ make_set(3, null, 'string') as c27,
+ export_set(3, null, 'off', 'sep') as c29,
+ export_set(3, 'on', null, 'sep') as c30,
+ export_set(3, 'on', 'off', null) as c31,
+ replace(null, 'from', 'to') as c32,
+ replace('str', null, 'to') as c33,
+ replace('str', 'from', null) as c34,
+ insert('str', 1, 2, null) as c35,
+ insert(null, 1, 2, 'str') as c36,
+ lpad('str', 10, null) as c37,
+ rpad(null, 10, 'str') as c38;
+
+show create table t1;
+drop table t1;
+
+#
+# Check that comparison is done according to
+# non-null string collation, i.e. case insensitively,
+# rather than according to NULL's collation, i.e. case sensitively
+#
+-- in field
+select
+ case 'str' when 'STR' then 'str' when null then 'null' end as c01,
+ case 'str' when null then 'null' when 'STR' then 'str' end as c02,
+ field(null, 'str1', 'str2') as c03,
+ field('str1','STR1', null) as c04,
+ field('str1', null, 'STR1') as c05,
+ 'string' in ('STRING', null) as c08,
+ 'string' in (null, 'STRING') as c09;
+
+# Restore charset to the default value.
+set names latin1;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 978ce2bc2c3..7fe88ad0ddc 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -110,10 +110,6 @@ set @fvar= 123.4567;
--error 1064
prepare stmt1 from @fvar;
-set @str1 = 'select ?';
-set @str2 = convert(@str1 using ucs2);
-prepare stmt1 from @str2;
-execute stmt1 using @ivar;
drop table t1,t2;
#
@@ -462,3 +458,17 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
+#
+# Bug#6297 "prepared statement, wrong handling of <parameter> IS NULL"
+# Test that placeholders work with IS NULL/IS NOT NULL clauses.
+#
+prepare stmt from "select ? is null, ? is not null, ?";
+select @no_such_var is null, @no_such_var is not null, @no_such_var;
+execute stmt using @no_such_var, @no_such_var, @no_such_var;
+set @var='abc';
+select @var is null, @var is not null, @var;
+execute stmt using @var, @var, @var;
+set @var=null;
+select @var is null, @var is not null, @var;
+execute stmt using @var, @var, @var;
+
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index 9e4acc2bf24..baa37dbf41d 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -8,7 +8,11 @@
# NOTE: PLEASE SEE THE DETAILED DESCRIPTION AT THE BOTTOM OF THIS FILE
# BEFORE ADDING NEW TEST CASES HERE !!!
-use test;
+--disable_warnings
+drop table if exists t5, t6, t7, t8;
+drop database if exists mysqltest ;
+--enable_warnings
+
--disable_query_log
select '------ basic tests ------' as test_sequence ;
--enable_query_log
@@ -590,12 +594,9 @@ rename table new_t2 to t2;
drop table t2;
## RENAME more than on TABLE within one statement
# cases derived from client_test.c: test_rename()
---disable_warnings
-drop table if exists t5, t6, t7, t8 ;
---enable_warnings
prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ;
-# rename must fail, tc does not exist
+# rename must fail, t7 does not exist
--error 1017
execute stmt1 ;
create table t7 (a int) ;
@@ -864,15 +865,23 @@ select '------ grant/revoke/drop affects a parallel session test ------'
--error 1141
show grants for second_user@localhost ;
## create a new user account by using GRANT statements on t9
-grant usage on test.* to second_user@localhost
+create database mysqltest;
+# create the tables (t1 and t9) used in many tests
+use mysqltest;
+--disable_query_log
+--source include/ps_create.inc
+--source include/ps_renew.inc
+--enable_query_log
+eval use $DB;
+grant usage on mysqltest.* to second_user@localhost
identified by 'looser' ;
-grant select on test.t9 to second_user@localhost
+grant select on mysqltest.t9 to second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
#### establish a second session to the new user account
-connect (con3,localhost,second_user,looser,test);
+connect (con3,localhost,second_user,looser,mysqltest);
## switch to the second session
connection con3;
# Who am I ?
@@ -890,10 +899,10 @@ select a as my_col from t1;
#### give access rights to t1 and drop table t9
## switch back to the first session
connection default;
-grant select on test.t1 to second_user@localhost
+grant select on mysqltest.t1 to second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
-drop table t9 ;
+drop table mysqltest.t9 ;
show grants for second_user@localhost ;
@@ -912,7 +921,7 @@ execute s_t9 ;
#### revoke the access rights to t1
## switch back to the first session
connection default;
-revoke all privileges on test.t1 from second_user@localhost
+revoke all privileges on mysqltest.t1 from second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
@@ -937,8 +946,8 @@ commit ;
--error 1141
show grants for second_user@localhost ;
-
-drop table t1 ;
+drop table t1,t9 ;
+drop database mysqltest;
##### RULES OF THUMB TO PRESERVE THE SYSTEMATICS OF THE PS TEST CASES #####
diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test
index 2e0ba2fff25..835af92186f 100644
--- a/mysql-test/t/rpl000001.test
+++ b/mysql-test/t/rpl000001.test
@@ -98,7 +98,7 @@ wait_for_slave_to_stop;
# The following test can't be done because the result of Pos will differ
# on different computers
-# --replace_result 9306 9999 3334 9999 3335 9999
+# --replace_result $MASTER_MYPORT MASTER_PORT
# show slave status;
set global sql_slave_skip_counter=1;
diff --git a/mysql-test/t/rpl_failed_optimize-master.opt b/mysql-test/t/rpl_failed_optimize-master.opt
index a6ef074a120..3f82baff598 100644
--- a/mysql-test/t/rpl_failed_optimize-master.opt
+++ b/mysql-test/t/rpl_failed_optimize-master.opt
@@ -1 +1 @@
---innodb-lock-wait-timeout=1
+--loose-innodb-lock-wait-timeout=1
diff --git a/mysql-test/t/rpl_rewrite_db-slave.opt b/mysql-test/t/rpl_rewrite_db-slave.opt
new file mode 100644
index 00000000000..a462ad19ba0
--- /dev/null
+++ b/mysql-test/t/rpl_rewrite_db-slave.opt
@@ -0,0 +1 @@
+"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1->test"
diff --git a/mysql-test/t/rpl_rewrite_db.test b/mysql-test/t/rpl_rewrite_db.test
new file mode 100644
index 00000000000..b6118854037
--- /dev/null
+++ b/mysql-test/t/rpl_rewrite_db.test
@@ -0,0 +1,77 @@
+source include/master-slave.inc;
+--disable_warnings
+drop database if exists mysqltest1;
+--enable_warnings
+create database mysqltest1;
+
+use mysqltest1;
+create table t1 (a int);
+insert into t1 values(9);
+select * from mysqltest1.t1;
+sync_slave_with_master;
+show databases like 'mysqltest1'; # should be empty
+select * from test.t1;
+# cleanup
+connection master;
+drop table t1;
+drop database mysqltest1;
+sync_slave_with_master;
+
+#
+# BUG#6353:
+# Option --replicate-rewrite-db should work together with LOAD DATA INFILE
+#
+
+connection slave;
+--disable_warnings
+drop database if exists rewrite;
+--enable_warnings
+create database rewrite;
+
+connection master;
+use test;
+create table t1 (a date, b date, c date not null, d date);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
+sync_slave_with_master;
+
+connection slave;
+select * from rewrite.t1;
+
+connection master;
+truncate table t1;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+sync_slave_with_master;
+
+connection slave;
+select * from rewrite.t1;
+
+connection master;
+drop table t1;
+create table t1 (a text, b text);
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+sync_slave_with_master;
+
+connection slave;
+select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
+
+connection master;
+drop table t1;
+create table t1 (a int, b char(10));
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+sync_slave_with_master;
+
+connection slave;
+select * from rewrite.t1;
+
+connection master;
+truncate table t1;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+sync_slave_with_master;
+
+connection slave;
+# The empty line last comes from the end line field in the file
+select * from rewrite.t1;
+
+connection master;
+drop table t1;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 5bae44796dc..3b36ba6bfb2 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -1757,6 +1757,15 @@ DO 1;
DO benchmark(100,1+1),1,1;
#
+# Bug #6449: do default;
+#
+
+--error 1064
+do default;
+--error 1054
+do foobar;
+
+#
# random in WHERE clause
#
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index e0f6fcbf515..19bfaa6194a 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1282,3 +1282,22 @@ INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
drop tables t1,t2;
+
+#
+# Test for bug #6462. "Same request on same data returns different
+# results." a.k.a. "Proper cleanup of subqueries is missing for
+# SET and DO statements".
+#
+create table t1 (a int not null, b int not null, c int, primary key (a,b));
+insert into t1 values (1,1,1), (2,2,2), (3,3,3);
+set @b:= 0;
+# Let us check that subquery will use covering index
+explain select sum(a) from t1 where b > @b;
+# This should not crash -debug server due to failing assertion
+set @a:= (select sum(a) from t1 where b > @b);
+# And this should not falsely report index usage
+explain select a from t1 where c=2;
+# Same for DO statement
+do @a:= (select sum(a) from t1 where b > @b);
+explain select a from t1 where c=2;
+drop table t1;
diff --git a/mysql-test/t/timezone3-master.opt b/mysql-test/t/timezone3-master.opt
new file mode 100644
index 00000000000..6910e6e6e8d
--- /dev/null
+++ b/mysql-test/t/timezone3-master.opt
@@ -0,0 +1 @@
+--timezone=:$MYSQL_TEST_DIR/std_data/Moscow_leap
diff --git a/mysql-test/t/timezone3.test b/mysql-test/t/timezone3.test
new file mode 100644
index 00000000000..8910783cd85
--- /dev/null
+++ b/mysql-test/t/timezone3.test
@@ -0,0 +1,59 @@
+#
+# Test of handling time zone with leap seconds.
+#
+# This test should be run with TZ=:$MYSQL_TEST_DIR/std_data/Moscow_leap
+# This implies that this test should be run only on systems that interpret
+# characters after colon in TZ variable as path to zoneinfo file.
+#
+# Check that we have successfully set time zone with leap seconds.
+--require r/have_moscow_leap_timezone.require
+disable_query_log;
+select from_unixtime(1072904422);
+enable_query_log;
+
+# Initial clean-up
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Let us check behavior of conversion from broken-down representation
+# to time_t representation, for normal, non-existent and ambigious dates
+# (This check is similar to the one in timezone2.test in 4.1)
+#
+create table t1 (i int, c varchar(20));
+# Normal value without DST
+insert into t1 values
+ (unix_timestamp("2004-01-01 00:00:00"), "2004-01-01 00:00:00");
+# Values around and in spring time-gap
+insert into t1 values
+ (unix_timestamp("2004-03-28 01:59:59"), "2004-03-28 01:59:59"),
+ (unix_timestamp("2004-03-28 02:30:00"), "2004-03-28 02:30:00"),
+ (unix_timestamp("2004-03-28 03:00:00"), "2004-03-28 03:00:00");
+# Normal value with DST
+insert into t1 values
+ (unix_timestamp('2004-05-01 00:00:00'),'2004-05-01 00:00:00');
+# Ambiguos values (also check for determenism)
+insert into t1 values
+ (unix_timestamp('2004-10-31 01:00:00'),'2004-10-31 01:00:00'),
+ (unix_timestamp('2004-10-31 02:00:00'),'2004-10-31 02:00:00'),
+ (unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59'),
+ (unix_timestamp('2004-10-31 04:00:00'),'2004-10-31 04:00:00'),
+ (unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59');
+# Test of leap
+insert into t1 values
+ (unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
+ (unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
+
+select i, from_unixtime(i), c from t1;
+drop table t1;
+
+#
+# Test for bug #6387 "Queried timestamp values do not match the
+# inserted". my_gmt_sec() function was not working properly if we
+# had time zone with leap seconds
+#
+create table t1 (ts timestamp);
+insert into t1 values (19730101235900), (20040101235900);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index b67fa7a552d..f70193ddbe0 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -369,8 +369,8 @@ explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
select * from t1 where txt='Chevy' or txt is NULL order by txt;
drop table t1;
-CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1)));
-INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
+CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
+INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = '';
drop table t1;
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 47866058524..04e4a73554a 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -77,10 +77,13 @@ drop table t1;
# warnings (for both strings and numbers)
#
create table t1 (t datetime);
-insert into t1 values (20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
+insert into t1 values (20030102030460),(20030102036301),(20030102240401),
+ (20030132030401),(20031302030401),(100001202030401);
select * from t1;
delete from t1;
-insert into t1 values ("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
+insert into t1 values
+ ("2003-01-02 03:04:60"),("2003-01-02 03:63:01"),("2003-01-02 24:04:01"),
+ ("2003-01-32 03:04:01"),("2003-13-02 03:04:01"), ("10000-12-02 03:04:00");
select * from t1;
delete from t1;
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 216d5bbd286..26ac272c6d4 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -6,7 +6,9 @@
drop table if exists t1;
--enable_warnings
+--replace_result e-0 e- e+0 e+
SELECT 10,10.0,10.,.1e+2,100.0e-1;
+--replace_result e-00 e-0
SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
@@ -14,6 +16,7 @@ create table t1 (f1 float(24),f2 float(52));
show full columns from t1;
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
+--replace_result e-0 e- e+0 e+
select * from t1;
drop table t1;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 36027e8c4cb..468a88b83db 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -652,5 +652,11 @@ create table t1 as
(select b collate latin1_german1_ci from t2);
show create table t1;
drop table t1;
+create table t1 as
+(select a from t2) union
+(select b from t2) union
+(select 'c' collate latin1_german1_ci from t2);
+show create table t1;
+drop table t1;
drop table t2;
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index 601724e68c8..d985be05b94 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -108,15 +108,18 @@ SET @`a b`='hello';
INSERT INTO t1 VALUES(@`a b`);
set @var1= "';aaa";
insert into t1 values (@var1);
-create table t2 (c char(30)) charset=ucs2;
-set @v=convert('abc' using ucs2);
-insert into t2 values (@v);
show binlog events from 79;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
-drop table t1, t2;
+drop table t1;
+#
+# Bug #6321 strange error:
+# string function FIELD(<uservariable content NULL>, ...)
+#
+set @var= NULL ;
+select FIELD( @var,'1it','Hit') as my_column;
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index fd6ab4d6405..d0a78c157c3 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -8,6 +8,7 @@ drop table if exists t1,t2;
set @`test`=1,@TEST=3,@select=2,@t5=1.23456;
select @test,@`select`,@TEST,@not_used;
set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
+--replace_result e-0 e- e+0 e+
select @test_int,@test_double,@test_string,@test_string2,@select;
set @test_int="hello",@test_double="hello",@test_string="hello",@test_string2="hello";
select @test_int,@test_double,@test_string,@test_string2;
diff --git a/mysys/charset.c b/mysys/charset.c
index 1388fc40c6d..cb2379f8723 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -228,6 +228,7 @@ static int add_collation(CHARSET_INFO *cs)
}
else
{
+ uchar *sort_order= all_charsets[cs->number]->sort_order;
simple_cs_init_functions(all_charsets[cs->number]);
new->mbminlen= 1;
new->mbmaxlen= 1;
@@ -236,6 +237,16 @@ static int add_collation(CHARSET_INFO *cs)
all_charsets[cs->number]->state |= MY_CS_LOADED;
}
all_charsets[cs->number]->state|= MY_CS_AVAILABLE;
+
+ /*
+ Check if case sensitive sort order: A < a < B.
+ We need MY_CS_FLAG for regex library, and for
+ case sensitivity flag for 5.0 client protocol,
+ to support isCaseSensitive() method in JDBC driver
+ */
+ if (sort_order && sort_order['A'] < sort_order['a'] &&
+ sort_order['a'] < sort_order['B'])
+ all_charsets[cs->number]->state|= MY_CS_CSSORT;
}
}
else
diff --git a/mysys/default.c b/mysys/default.c
index 792233ed10d..ea23bbb6693 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -60,15 +60,20 @@ DATADIR,
NullS,
};
-#define default_ext ".cnf" /* extension for config file */
#ifdef __WIN__
-#include <winbase.h>
-#define windows_ext ".ini"
+static const char *f_extensions[]= { ".ini", ".cnf", 0 };
+#else
+static const char *f_extensions[]= { ".cnf", 0 };
#endif
static int search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc,
const char *dir, const char *config_file,
- const char *ext, TYPELIB *group);
+ TYPELIB *group);
+
+static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
+ const char *dir, const char *ext,
+ const char *config_file,
+ TYPELIB *group);
static char *remove_end_comment(char *ptr);
@@ -115,7 +120,8 @@ int load_defaults(const char *conf_file, const char **groups,
uint args_used=0;
int error= 0;
MEM_ROOT alloc;
- char *ptr,**res;
+ char *ptr, **res;
+
DBUG_ENTER("load_defaults");
init_alloc_root(&alloc,512,0);
@@ -163,8 +169,9 @@ int load_defaults(const char *conf_file, const char **groups,
goto err;
if (forced_default_file)
{
- if ((error= search_default_file(&args, &alloc, "",
- forced_default_file, "", &group)) < 0)
+ if ((error= search_default_file_with_ext(&args, &alloc, "", "",
+ forced_default_file,
+ &group)) < 0)
goto err;
if (error > 0)
{
@@ -176,7 +183,7 @@ int load_defaults(const char *conf_file, const char **groups,
else if (dirname_length(conf_file))
{
if ((error= search_default_file(&args, &alloc, NullS, conf_file,
- default_ext, &group)) < 0)
+ &group)) < 0)
goto err;
}
else
@@ -184,28 +191,30 @@ int load_defaults(const char *conf_file, const char **groups,
#ifdef __WIN__
char system_dir[FN_REFLEN];
GetWindowsDirectory(system_dir,sizeof(system_dir));
- if ((search_default_file(&args, &alloc, system_dir, conf_file,
- windows_ext, &group)))
+ if ((search_default_file(&args, &alloc, system_dir, conf_file, &group)))
goto err;
#endif
#if defined(__EMX__) || defined(OS2)
- if (getenv("ETC") &&
- (search_default_file(&args, &alloc, getenv("ETC"), conf_file,
- default_ext, &group)) < 0)
+ {
+ const char *etc;
+ if ((etc= getenv("ETC")) &&
+ (search_default_file(&args, &alloc, etc, conf_file,
+ &group)) < 0)
goto err;
+ }
#endif
for (dirs=default_directories ; *dirs; dirs++)
{
if (**dirs)
{
if (search_default_file(&args, &alloc, *dirs, conf_file,
- default_ext, &group) < 0)
+ &group) < 0)
goto err;
}
else if (defaults_extra_file)
{
if (search_default_file(&args, &alloc, NullS, defaults_extra_file,
- default_ext, &group) < 0)
+ &group) < 0)
goto err; /* Fatal error */
}
}
@@ -269,11 +278,28 @@ void free_defaults(char **argv)
}
+static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
+ const char *dir,
+ const char *config_file, TYPELIB *group)
+{
+ char **ext;
+
+ for (ext= (char**) f_extensions; *ext; *ext++)
+ {
+ int error;
+ if ((error= search_default_file_with_ext(args, alloc, dir, *ext,
+ config_file, group)) < 0)
+ return error;
+ }
+ return 0;
+}
+
+
/*
Open a configuration file (if exists) and read given options from it
SYNOPSIS
- search_default_file()
+ search_default_file_with_ext()
args Store pointer to found options here
alloc Allocate strings in this object
dir directory to read
@@ -288,9 +314,10 @@ void free_defaults(char **argv)
2 File is not a regular file (Warning)
*/
-static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
- const char *dir, const char *config_file,
- const char *ext, TYPELIB *group)
+static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
+ const char *dir, const char *ext,
+ const char *config_file,
+ TYPELIB *group)
{
char name[FN_REFLEN+10],buff[4096],*ptr,*end,*value,*tmp;
FILE *fp;
@@ -484,10 +511,11 @@ static char *remove_end_comment(char *ptr)
void print_defaults(const char *conf_file, const char **groups)
{
#ifdef __WIN__
- bool have_ext=fn_ext(conf_file)[0] != 0;
+ my_bool have_ext= fn_ext(conf_file)[0] != 0;
#endif
- char name[FN_REFLEN];
+ char name[FN_REFLEN], **ext;
const char **dirs;
+
puts("\nDefault options are read from the following files in the given order:");
if (dirname_length(conf_file))
@@ -496,27 +524,43 @@ void print_defaults(const char *conf_file, const char **groups)
{
#ifdef __WIN__
GetWindowsDirectory(name,sizeof(name));
- printf("%s\\%s%s ",name,conf_file,have_ext ? "" : windows_ext);
+ if (!have_ext)
+ {
+ for (ext= (char**) f_extensions; *ext; *ext++)
+ printf("%s\\%s%s ", name, conf_file, *ext);
+ }
+ else
+ printf("%s\\%s ", name, conf_file);
#endif
#if defined(__EMX__) || defined(OS2)
- if (getenv("ETC"))
- printf("%s\\%s%s ", getenv("ETC"), conf_file, default_ext);
+ {
+ const char *etc;
+
+ if ((etc= getenv("ETC")))
+ {
+ for (ext= (char**) f_extensions; *ext; *ext++)
+ printf("%s\\%s%s ", etc, conf_file, *ext);
+ }
+ }
#endif
for (dirs=default_directories ; *dirs; dirs++)
{
- const char *pos;
- char *end;
- if (**dirs)
- pos= *dirs;
- else if (defaults_extra_file)
- pos= defaults_extra_file;
- else
- continue;
- end=convert_dirname(name, pos, NullS);
- if (name[0] == FN_HOMELIB) /* Add . to filenames in home */
- *end++='.';
- strxmov(end,conf_file,default_ext," ",NullS);
- fputs(name,stdout);
+ for (ext= (char**) f_extensions; *ext; *ext++)
+ {
+ const char *pos;
+ char *end;
+ if (**dirs)
+ pos= *dirs;
+ else if (defaults_extra_file)
+ pos= defaults_extra_file;
+ else
+ continue;
+ end= convert_dirname(name, pos, NullS);
+ if (name[0] == FN_HOMELIB) /* Add . to filenames in home */
+ *end++='.';
+ strxmov(end, conf_file, *ext, " ", NullS);
+ fputs(name,stdout);
+ }
}
puts("");
}
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 11aadbed6c1..052d6c79ab9 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -1699,11 +1699,12 @@ byte *key_cache_read(KEY_CACHE *keycache,
keycache_pthread_mutex_unlock(&keycache->cache_lock);
goto no_key_cache;
}
- read_length= length > keycache->key_cache_block_size ?
- keycache->key_cache_block_size : length;
- KEYCACHE_DBUG_ASSERT(read_length > 0);
offset= (uint) (filepos & (keycache->key_cache_block_size-1));
filepos-= offset;
+ read_length= length;
+ set_if_smaller(read_length, keycache->key_cache_block_size-offset);
+ KEYCACHE_DBUG_ASSERT(read_length > 0);
+
#ifndef THREAD
if (block_length > keycache->key_cache_block_size || offset)
return_buffer=0;
@@ -1773,7 +1774,7 @@ byte *key_cache_read(KEY_CACHE *keycache,
return (block->buffer);
#endif
buff+= read_length;
- filepos+= read_length;
+ filepos+= read_length+offset;
} while ((length-= read_length));
DBUG_RETURN(start);
@@ -1835,12 +1836,12 @@ int key_cache_insert(KEY_CACHE *keycache,
keycache_pthread_mutex_unlock(&keycache->cache_lock);
DBUG_RETURN(0);
}
- read_length= length > keycache->key_cache_block_size ?
- keycache->key_cache_block_size : length;
- KEYCACHE_DBUG_ASSERT(read_length > 0);
offset= (uint) (filepos & (keycache->key_cache_block_size-1));
/* Read data into key cache from buff in key_cache_block_size incr. */
filepos-= offset;
+ read_length= length;
+ set_if_smaller(read_length, keycache->key_cache_block_size-offset);
+ KEYCACHE_DBUG_ASSERT(read_length > 0);
inc_counter_for_resize_op(keycache);
keycache->global_cache_r_requests++;
@@ -1882,7 +1883,7 @@ int key_cache_insert(KEY_CACHE *keycache,
DBUG_RETURN(1);
buff+= read_length;
- filepos+= read_length;
+ filepos+= read_length+offset;
} while ((length-= read_length));
}
@@ -1959,12 +1960,12 @@ int key_cache_write(KEY_CACHE *keycache,
keycache_pthread_mutex_unlock(&keycache->cache_lock);
goto no_key_cache;
}
- read_length= length > keycache->key_cache_block_size ?
- keycache->key_cache_block_size : length;
- KEYCACHE_DBUG_ASSERT(read_length > 0);
offset= (uint) (filepos & (keycache->key_cache_block_size-1));
/* Write data in key_cache_block_size increments */
filepos-= offset;
+ read_length= length;
+ set_if_smaller(read_length, keycache->key_cache_block_size-offset);
+ KEYCACHE_DBUG_ASSERT(read_length > 0);
inc_counter_for_resize_op(keycache);
keycache->global_cache_w_requests++;
@@ -2032,7 +2033,7 @@ int key_cache_write(KEY_CACHE *keycache,
next_block:
buff+= read_length;
- filepos+= read_length;
+ filepos+= read_length+offset;
offset= 0;
} while ((length-= read_length));
diff --git a/mysys/mf_keycaches.c b/mysys/mf_keycaches.c
index 20465f3d23b..8bf203e249f 100644
--- a/mysys/mf_keycaches.c
+++ b/mysys/mf_keycaches.c
@@ -309,7 +309,7 @@ void multi_keycache_free(void)
Get a key cache to be used for a specific table.
SYNOPSIS
- multi_key_cache_get()
+ multi_key_cache_search()
key key to find (usually table path)
uint length Length of key.
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 0ef938b434c..c32fcfe6a09 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -42,8 +42,8 @@ static void netware_init();
#define netware_init()
#endif
-
-my_bool my_init_done=0;
+my_bool my_init_done= 0;
+uint mysys_usage_id= 0; /* Incremented for each my_init() */
static ulong atoi_octal(const char *str)
{
@@ -51,7 +51,7 @@ static ulong atoi_octal(const char *str)
while (*str && my_isspace(&my_charset_latin1, *str))
str++;
str2int(str,
- (*str == '0' ? 8 : 10), /* Octalt or decimalt */
+ (*str == '0' ? 8 : 10), /* Octalt or decimalt */
0, INT_MAX, &tmp);
return (ulong) tmp;
}
@@ -74,6 +74,9 @@ my_bool my_init(void)
if (my_init_done)
return 0;
my_init_done=1;
+ mysys_usage_id++;
+ my_umask= 0660; /* Default umask for new files */
+ my_umask_dir= 0700; /* Default umask for new directories */
#if defined(THREAD) && defined(SAFE_MUTEX)
safe_mutex_global_init(); /* Must be called early */
#endif
diff --git a/ndb/config/type_ndbapitools.mk.am b/ndb/config/type_ndbapitools.mk.am
index ed6d8699e05..d4eb090112d 100644
--- a/ndb/config/type_ndbapitools.mk.am
+++ b/ndb/config/type_ndbapitools.mk.am
@@ -11,4 +11,5 @@ INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \
-I$(top_srcdir)/ndb/include/util \
-I$(top_srcdir)/ndb/include/portlib \
-I$(top_srcdir)/ndb/test/include \
- -I$(top_srcdir)/ndb/include/mgmapi
+ -I$(top_srcdir)/ndb/include/mgmapi \
+ -I$(top_srcdir)/ndb/include/kernel
diff --git a/ndb/home/bin/cvschk b/ndb/home/bin/cvschk
deleted file mode 100755
index 4510cc30888..00000000000
--- a/ndb/home/bin/cvschk
+++ /dev/null
@@ -1,569 +0,0 @@
-#!/usr/bin/perl -w
-#
-# cvschk -- fast offline check for new files and modifications of files
-
-# cvschk : A perl program which checks the status of the CVS controlled
-# files and gives an ASCII table sorted after the status of files.
-#
-# If you have used CVS, then you know that it is hard to
-# get a good overview the CVS-status of the files in you
-# directories. Any new files? Any files changes?
-# cvschk will help the programmer get the overview in the
-# situation, where we do not have access to the CVS repository.
-#
-# Note that the program does only local checks of the files
-# If you have fast access to the CVS repositiory, then consider
-# the cvsstat-program - which additionally can tell if other
-# people have made newer versions of the files.
-#
-# The program requires Perl 5.004 (maybe previous versions also work).
-#
-# It is tuned to parse the output of cvs(1) version 1.9.
-# Earlier and later versions may require modifications to the script.
-#
-# ** Note that the first line might be wrong depending **
-# ** on the location of your perl program. **
-#
-# Sample output:
-# The directory ./mytempdir is not under CVS control
-#
-# Changed files
-# ---------------
-# ./cvs2html
-# ./cvschk
-# ./cvsstat
-#
-# New files
-# ---------------
-# ./.#cvschk
-# ./XX
-# ./cvs2html.ok
-#
-# Deleted files
-# ---------------
-# (none)
-
-# Changelog:
-#
-# Ver Date Author Changelog
-# --- ---------- -------------------- -------------------------------------
-# 1.12 2002-01-04 Michael Kohne Fixed a $foo=<> warning for
-# 5.004_01 with defined($foo=<>)
-# Added a --tabular|-t switch
-#
-# 1.11 2001-12-27 Michael Kohne Added cvsignore functionality
-# Handling of 'dummy timestamp'
-# Handling of 'Result of Merge'
-#
-# 1.10 2001-11-06 Michael Kohne Added -r and -l options
-#
-# 1.9 2001-08-03 Lars G. T. Jørgensen Hack to allow special entry-line
-#
-# 1.8 2001-06-07 Peter Toft Back to the same as 1.6
-# CVS is my friend
-#
-# 1.7 2001-06-04 Peter Toft Peter was very tired and
-# applied a wrong patch -
-# version 1.7 is crap
-#
-# 1.6 2000-12-17 Peter Toft Better description added
-#
-# 1.5 2000-11-04 Peter Toft URL of cvsstat changed
-#
-# 1.4 2000-09-20 Peter Toft Must show deleted files also
-# as the default
-#
-# 1.3 2000-08-08 Ole Tange and Initial version
-# Peter Toft
-# ---- ---------- -------------------- -------------------------------------
-#
-# -----------------------------------------------------------------------------
-#
-# This program is protected by the GPL, and all modifications of
-# general interest should be emailed to the maintainer (pto@sslug.dk).
-#
-# This program also uses code parts from cvsstat
-# (same homepage as cvschk)
-#
-# Copyright 2000,2001 by Peter Toft <pto@sslug.dk> and Ole Tange <ole@tange.dk>
-# as well as
-# Lars G. T. Jørgensen <larsj@diku.dk>
-#
-# The URL of the home page of cvschk is shown below.
-
-
-use Time::Local;
-use strict;
-use Getopt::Long;
-
-my $startdir = ".";
-
-my $debug = 0;
-my (%files,%filesok,%seen,%skip);
-
-
-# Michael Kohne 12/16/01
-#
-# Simulation of .cvsignore as CVS does it...
-#
-# using .cvsignore handling makes cvschk take from 2 to 3 times
-# longer to run over the same set of files.
-# in my tests, disabling cvsignore altogether, cvschk takes .2
-# seconds on my working directory. Adding cvsignore,takes
-# .4 seconds.
-# Note that I do not use individual .cvsignore files - if there
-# are a lot of them in your directory tree, it will add run time
-#
-# variables used for .cvsignore handling
-my $initcvsignoreregex;# regex holding all startup cvsignore pattersn (no ())
-my $cvsignoreregex;# one regex holding all current cvsignore patterns
-my $disable_cvsignore=0;# set to 1 to disable cvsignore emulation
- # (available in case it's REALLY screwed up)
-my $disable_ind_cvsignore=0;# set to 1 to disable finding .cvsignore files
- # in each directory.
-my $debug_cvsignore = 0; # For debugging .cvsignore problems
-
-my %mon;
-@mon{qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)}=
- 0..11; # Perl months are 0 .. 11
-
-my ($version) = ('$Revision: 1.12 $ ' =~ /^\$\w+: (.*) \$ $/);
-my $URL = "http://cvs.sslug.dk/cvs2html";
-my $version_line = "cvschk version $version (see $URL)\n";
-
-my $opt_all;
-my $restrict;
-my $local;
-my $tabular;
-
-my $opt_restrict;
-
-sub show_version {print $version_line}
-
-sub die_version {die $version_line}
-
-sub die_usage {
- my $bundled = ($] > 5.00399
- ? "can be bundled"
- : "can't be bundled, because your Perl is too old");
- die <<END_OF_USAGE; # Help in the style of GNU `ls --help' or `make --help'
-Usage: $0 [OPTION]...
- Show the CVS status of FILEs (the current directory by default),
- traversing directories recursively and telling if new files exist
- in the repository.
-Options:
- -a, --all Show all statistics, including the names of files that
- are up to date, used tags, ignored patterns and more
- -r, --restrict Don't show the names of the unknown files
- (useful if you have many temporary files)
- -t, --tabular Show one file per line, each preceeded with a status word,
- Sorted by filename.
- -l, --local Don't descend into sub-directories
- -d, --debug Debug info
- -h, --help Show this help end exit immediately
- -V, --version Show the version line and exit immediately
-The one-letter options $bundled.
-END_OF_USAGE
-}
-
-sub die_help {show_version; die_usage}
-
-# Let `-ar' mean `-a -r' and require `--all' (or -a) instead of `-all'.
-if ($] > 5.00399) { # This requires 5.004, so silently skip it for older Perls.
- eval {Getopt::Long::config("bundling")}; # avoid 5.003 compilation error
- warn $@ if $@; # For Perl 5.004+ we do want to see any compilation error
-}
-
-
-GetOptions( "all|a" => \$opt_all,
- "tabular|t" => \$tabular,
- "restrict|r" => \$restrict,
- "local|l" => \$local,
- "help|h" => \&die_help,
- "debug|d" => \$debug,
- "version|V" => \&die_version,
- ) or die_usage;
-
-sub cvs_changed_in_dir($); #define prototype (for recursion)
-
-# functions for .cvsignore handling
-
-# converts a given filename pattern
-# (of the sort that sh(1) takes) to
-# a perl regex of similar meaning.
-#
-# It works by doing the following:
-#
-# change:
-# . to \.
-# $ to \$
-# * to .*
-# ? to .
-#
-sub fpat_to_regex($)
-{
- my $fexp;
- $fexp = shift;
- $fexp =~ s/\./\\\./g;#change . to \.
- $fexp =~ s/\$/\\\$/g;#change dollar sign to \dollar sign
- $fexp =~ s/\*/.*/g;# change * to .*
- $fexp =~ s/\?/./g; # change ? to .
- return $fexp;
-}
-
-# copy the input list to one single regex,
-# items seperated by | symbols.
-# return the regex string
-sub do_regex_convert
-{
- my $rx = "";
- my $first = 1;#true for first element only
-
-
- # convert each element of cvsignore into a regex
- # this makes the patterns usable in perl
- my $cp;
- foreach $cp (@_) {
- if (not $first) { $rx = $rx . "|"; }
- if ($first) { $first = 0; }
- $rx = $rx . fpat_to_regex($cp);
- }
-
- return $rx;
-}
-
-# first parameter is a reference to the array
-# to be loaded
-# the rest of the parameters are just items
-# that need to be loaded into the array.
-# Note that if a ! is found, the list is
-# emptied, then further items are added.
-# returns true if a ! was found
-sub load_list_from_list
-{
- my $arref = shift;# get reference to array from front
- my $item;
- my $ret=0;#false means no ! found
-
- chomp @_;#kill newlines
- foreach $item (@_) {
- $item =~ s/^\s*(.*?)\s*$/$1/;#kill leading/trailing whitespace
- if ($item) { # empty string is false
- push @$arref,$item;
- }
- if ($item eq "!") {
- @$arref = ();# '!' causes list to clear
- $ret = 1;# ! found
- }
- }
-
- return $ret;
-}
-
-# loads the given list with lines from the
-# specified file. Note that if a '!' is found
-# all prior patterns are removed from the list
-# before the following patterns are loaded
-# first param is the filename,
-# second param is a reference to an array
-# that the data is to go into
-# returns true if a ! was found
-sub load_list_from_file
-{
- my @inlist;
- my $fname = shift;#filename to read from
- #if (not -e $fname) { return; }
- my $arref = shift;#array to store into
- open CVSIGNORE,"$fname" or return;#file might not exist, that's OK
- @inlist = <CVSIGNORE>;
- close CVSIGNORE;
- return load_list_from_list($arref,@inlist);
-}
-
-# loads $cvsignoreregex from
-# $initcvsignoreregex and the .cvsignore file
-# in the local directory
-sub load_cvsignore
-{
- if ($disable_ind_cvsignore) {return;}#don't look for local .cvsignore files
- if ($disable_cvsignore) {return;}#don't do anything
-
- my $dir = shift;
- my @cvsignore;
-
- # bang will be true if a ! was found. In such cases, I need
- # to not use the pre-exisitng regex list.
- my $bang = load_list_from_file("$dir/.cvsignore",\@cvsignore);
-
- # if we get a local cvsignore list, then...
- my $rx = do_regex_convert(@cvsignore);
- if ($rx) {
- $cvsignoreregex = "(";
- if (not $bang) {$cvsignoreregex = $cvsignoreregex . $initcvsignoreregex . "|";}
- $cvsignoreregex = $cvsignoreregex . $rx . ")";
- } else {
- if ($bang) {$cvsignoreregex = "";}
- else {$cvsignoreregex = "(" . $initcvsignoreregex . ")";}
- }
-
- if ($debug_cvsignore) {print $dir,":",$cvsignoreregex, "\n";}
-}
-
-
-# loads all of the cvsignore patterns that
-# can be loaded at script startup
-sub load_initial_cvsignore()
-{
- #load the default patterns
- # (taken from http://www.gnu.org/manual/cvs-1.9/html_node/cvs_141.html#IDX399)
- #
- # this gives you the patterns that cvs normally starts with
- my @initcvsignore;
- push @initcvsignore,("RCS");
- push @initcvsignore,("SCCS");
- push @initcvsignore,("CVS");
- push @initcvsignore,("CVS.adm");
- push @initcvsignore,("RCSLOG");
- push @initcvsignore,("cvslog.*");
- push @initcvsignore,("tags");
- push @initcvsignore,("TAGS");
- push @initcvsignore,(".make.state");
- push @initcvsignore,(".nse_depinfo");
- push @initcvsignore,("*~");
- push @initcvsignore,("\#*");
- push @initcvsignore,(".\#*");
- push @initcvsignore,("\,*");
- push @initcvsignore,("_\$\*");
- push @initcvsignore,("*\$");
- push @initcvsignore,("*.old");
- push @initcvsignore,("*.bak");
- push @initcvsignore,("*.BAK");
- push @initcvsignore,("*.orig");
- push @initcvsignore,("*.rej");
- push @initcvsignore,(".del-*");
- push @initcvsignore,("*.a");
- push @initcvsignore,("*.olb");
- push @initcvsignore,("*.o");
- push @initcvsignore,("*.obj");
- push @initcvsignore,("*.so");
- push @initcvsignore,("*.exe");
- push @initcvsignore,("*.Z");
- push @initcvsignore,("*.elc");
- push @initcvsignore,("*.ln");
- push @initcvsignore,("core");
-
-
- # now, load (in proper order!)
- # each of the possible cvsignore files
-
- # there are 4 possible .cvsignore files:
-
- # $CVSROOT/CVSROOT/cvsignore
- # ~/.cvsignore
- # $CVSIGNORE environment variable
- # .cvsignore in current directory
-
- # The first (CVSROOT/cvsignore) would require calling cvs, so
- # we won't do that one.
- # The last (.cvsignore in current directory) is done
- # for each directory. It's handled in the load_cvsignore routine.
-
- # ~/.cvsignore
- my @inlist;
- my $item;
- my $HOME=$ENV{"HOME"};
- if (not $HOME) {$HOME = ".";}
- load_list_from_file("$HOME/.cvsignore",\@initcvsignore);
-
- # $CVSIGNORE environment variable
- my $igstr = $ENV{"CVSIGNORE"}; # get env var
- if ($igstr) {
- my @iglist = split(/\s+/, $igstr); #if it exists, convert to list
- load_list_from_list(\@initcvsignore,@iglist);
- }
-
- # now that @initcvsignore is setup,
- # turn it into a regex string
- $initcvsignoreregex = do_regex_convert(@initcvsignore);
-
- # now preset the cvsignore regex string to match
- # @initcvsignore. That way, if we aren't using local
- # cvsignore files, we do nothing.
- $cvsignoreregex = "(" . $initcvsignoreregex . ")";
-}
-# routine to see if the given name is in the cvsignore regex
-# returns true if it is, false if it's not
-sub ignore_file($)
-{
- #allow user to disable the cvsignore stuff
- if ($disable_cvsignore) {return 0;}
- if (not $cvsignoreregex) {return 0;}# if regex is empty, nothing matches the regex
- my $filename = shift;
-
- if ($debug_cvsignore) {print "ignore_file:",$filename,"\n";}
-
- if ($filename =~ $cvsignoreregex) {
- if ($debug_cvsignore) {print $filename," matches\n";}
- return 1;
- }
-
- if ($debug_cvsignore) {print $filename," doesn't match\n";}
- return 0;
-}
-
-sub cvs_changed_in_dir($) {
- my $dir = shift;
-
- my ($line,$filename,$version,$mtime,$date,
- $dir_filename,$cvstime,@subdirs,
- @new_in_dir,$i);
-
- # Examine status of files in CVS/Entries
- if(not open(ENTRIES,"$dir/CVS/Entries")) {
- if ($tabular) {
- push @{$files{Unknown}}, $dir;
- }
- else {
- warn "The directory $dir is not under CVS control\n";
- }
- } else {
- load_cvsignore($dir);#load up proper cvsignore for given directory
-
- while(defined ($line=<ENTRIES>)) {
- # Parse CVS/Entries-line
- $line=~m!^/(.*)/(.*)/(.*)/.*/! or do {
- $debug and warn("Skipping entry-line $line");
- next;
- };
- ($filename,$version,$date) = ($1,$2,$3);
- $dir_filename=$dir."/".$filename;
-
- # Mark this file as seen
- $seen{$dir_filename}=1;
-
- # if not exists: Deleted
- if(not -e $dir_filename) {
- push @{$files{Deleted}}, $dir_filename; next;
- }
- # if dir: save name for recursion
- -d $dir_filename and do {
- push @subdirs, $dir_filename; next;
- };
-
- # modification time of $dir_filename
- $mtime= (stat $dir_filename)[9];
-
-
- if($date eq "dummy timestamp") {
- # dummy timestamp means it's new to the repository.
- push @{$files{Changed}}, $dir_filename;
- if ($debug) {
- print "$dir_filename is changed\n";
- }
- }
- elsif($date eq "Result of merge") {
- # result of merge means it's changed, then updated.
- push @{$files{Changed}}, $dir_filename;
- if ($debug) {
- print "$dir_filename is changed\n";
- }
- }
- elsif(not
- $date=~/... (...)\s+(\d+)\s+(\d+):(\d+):(\d+) (\d{4})/)
- {
- #bogus entry in Entires
- warn "Warning: $dir_filename -> '$date' ".
- "not in ctime(3) format\n";
- } else {
- $cvstime=timegm($5,$4,$3,$2,$mon{$1},$6);
- if($cvstime != $mtime) {
- push @{$files{Changed}}, $dir_filename;
- if ($debug) {
- print "$dir_filename is changed\n";
- }
- } else {
- push @{$files{Unchanged}}, $dir_filename;
- if ($debug) {
- print "$dir_filename is Unchanged\n";
- }
- }
- }
- }
- close ENTRIES;
-
- # Locate any new files/dirs
- if(not opendir(D,$dir)) {
- warn("Cannot open $dir");
- @new_in_dir= ();
- } else {
- @skip{qw(. .. CVS)}=1..3; # Filenames that that we want to ignore
- #(note: these are exact filenames)
- @new_in_dir=
- (grep { not $seen{$_} } # files we have not already processed
- map { $dir."/".$_ } # map from file to dir/file
- grep { not ignore_file($_) } # ignore files in the cvsignore list
- grep { not $skip{$_} } # skip files to be ignored
- readdir(D));
- closedir(D);
- }
-
- # Remember new files (actually non-directories)
- push @{$files{New}}, grep { not -d $_ } @new_in_dir;
- if ($debug) { print "@{$files{New}} are new in $dir\n"; }
-
- # Remember new subdirs
- push @subdirs, grep { -d $_ } @new_in_dir;
-
- # Recurse all subdirs
- if (not $local) {
- for $i (@subdirs) { cvs_changed_in_dir($i); }
- }
- }
-}
-
-sub print_status()
-{
- my $k;
- my %show_these_states = ("Changed" => 1);
- if(not $restrict) {
- $show_these_states{"New"} = 1;
- $show_these_states{"Deleted"} = 1;
- }
-
- if($opt_all) { $show_these_states{"Unchanged"} = 1; }
-
- if ($tabular) {
- my %allfiles; # key: filesname, value: state
- my ($file, $state, $statefiles);
-
- $show_these_states{"Unknown"} = 1;
- while (($state, $statefiles) = each %files) {
- for my $f (@{$statefiles}) {
- $allfiles{$f} = $state;
- }
- }
- for $file (sort keys %allfiles) {
- $state = $allfiles{$file};
- printf("%-10s %s\n", $state, $file) if $show_these_states{$state};
- }
- }
- else {
- print "\n";
- for $k (keys %show_these_states) {
- if(not $files{$k} or not @{$files{$k}}) {
- # no files
- $files{$k}=["(none)"];
- }
- print("$k files\n",
- "---------------\n",
- map { "$_\n" } sort @{$files{$k}});
- print "\n";
- }
- }
-}
-
-load_initial_cvsignore();
-if ($debug_cvsignore) {print "initial regex:",$cvsignoreregex,"\n";}
-cvs_changed_in_dir($startdir);
-print_status();
-
diff --git a/ndb/include/Makefile.am b/ndb/include/Makefile.am
index 7b3f80b5560..ca2e8152352 100644
--- a/ndb/include/Makefile.am
+++ b/ndb/include/Makefile.am
@@ -28,6 +28,7 @@ ndbapi/NdbIndexScanOperation.hpp \
ndbapi/ndberror.h
mgmapiinclude_HEADERS = \
+mgmapi/LocalConfig.hpp \
mgmapi/mgmapi.h \
mgmapi/mgmapi_debug.h
diff --git a/ndb/include/kernel/signaldata/ArbitSignalData.hpp b/ndb/include/kernel/signaldata/ArbitSignalData.hpp
index f255b8dcbbe..34b73644a13 100644
--- a/ndb/include/kernel/signaldata/ArbitSignalData.hpp
+++ b/ndb/include/kernel/signaldata/ArbitSignalData.hpp
@@ -94,13 +94,14 @@ public:
// arbitration result
LoseNodes = 41, // lose on ndb node count
- WinGroups = 42, // we win, no need for arbitration
- LoseGroups = 43, // we lose, missing node group
- Partitioning = 44, // possible network partitioning
- WinChoose = 45, // positive reply
- LoseChoose = 46, // negative reply
- LoseNorun = 47, // arbitrator required but not running
- LoseNocfg = 48, // arbitrator required but none configured
+ WinNodes = 42, // win on ndb node count
+ WinGroups = 43, // we win, no need for arbitration
+ LoseGroups = 44, // we lose, missing node group
+ Partitioning = 45, // possible network partitioning
+ WinChoose = 46, // positive reply
+ LoseChoose = 47, // negative reply
+ LoseNorun = 48, // arbitrator required but not running
+ LoseNocfg = 49, // arbitrator required but none configured
// general error codes
ErrTicket = 91, // invalid arbitrator-ticket
diff --git a/ndb/include/kernel/signaldata/TupFrag.hpp b/ndb/include/kernel/signaldata/TupFrag.hpp
index c1e861c5dff..c132b19c50a 100644
--- a/ndb/include/kernel/signaldata/TupFrag.hpp
+++ b/ndb/include/kernel/signaldata/TupFrag.hpp
@@ -132,9 +132,10 @@ class TupAddAttrConf {
friend class Dblqh;
friend class Dbtup;
public:
- STATIC_CONST( SignalLength = 1 );
+ STATIC_CONST( SignalLength = 2 );
private:
Uint32 userPtr;
+ Uint32 lastAttr; // bool: got last attr and closed frag op
};
class TupAddAttrRef {
@@ -171,9 +172,10 @@ class TuxAddAttrConf {
friend class Dblqh;
friend class Dbtux;
public:
- STATIC_CONST( SignalLength = 1 );
+ STATIC_CONST( SignalLength = 2 );
private:
Uint32 userPtr;
+ Uint32 lastAttr; // bool: got last attr and closed frag op
};
class TuxAddAttrRef {
diff --git a/ndb/include/mgmcommon/LocalConfig.hpp b/ndb/include/mgmapi/LocalConfig.hpp
index 9ceeffdba36..9ceeffdba36 100644
--- a/ndb/include/mgmcommon/LocalConfig.hpp
+++ b/ndb/include/mgmapi/LocalConfig.hpp
diff --git a/ndb/include/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h
index 6dcf58b44e2..f1ef357421b 100644
--- a/ndb/include/mgmapi/mgmapi.h
+++ b/ndb/include/mgmapi/mgmapi.h
@@ -733,6 +733,7 @@ extern "C" {
int param, unsigned long long * value);
int ndb_mgm_get_string_parameter(const ndb_mgm_configuration_iterator*,
int param, const char ** value);
+ int ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **);
#ifdef __cplusplus
}
#endif
diff --git a/ndb/include/ndb_types.h b/ndb/include/ndb_types.h
index a2988dbae78..64b3f517934 100644
--- a/ndb/include/ndb_types.h
+++ b/ndb/include/ndb_types.h
@@ -21,11 +21,11 @@
#ifndef NDB_TYPES_H
#define NDB_TYPES_H
-typedef char Int8;
+typedef signed char Int8;
typedef unsigned char Uint8;
-typedef short Int16;
+typedef signed short Int16;
typedef unsigned short Uint16;
-typedef int Int32;
+typedef signed int Int32;
typedef unsigned int Uint32;
typedef unsigned int UintR;
@@ -45,10 +45,10 @@ typedef uintptr_t UintPtr;
#if defined(WIN32) || defined(NDB_WIN32)
typedef unsigned __int64 Uint64;
-typedef __int64 Int64;
+typedef signed __int64 Int64;
#else
typedef unsigned long long Uint64;
-typedef long long Int64;
+typedef signed long long Int64;
#endif
#endif
diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp
index 7af5d27b922..256199dced7 100644
--- a/ndb/include/ndbapi/NdbConnection.hpp
+++ b/ndb/include/ndbapi/NdbConnection.hpp
@@ -607,8 +607,8 @@ private:
NdbOperation* theLastExecOpInList; // Last executing operation in list.
- NdbOperation* theCompletedFirstOp; // First operation in completed
- // operation list.
+ NdbOperation* theCompletedFirstOp; // First & last operation in completed
+ NdbOperation* theCompletedLastOp; // operation list.
Uint32 theNoOfOpSent; // How many operations have been sent
Uint32 theNoOfOpCompleted; // How many operations have completed
diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp
index 51a6895648f..a3115076624 100644
--- a/ndb/include/ndbapi/NdbDictionary.hpp
+++ b/ndb/include/ndbapi/NdbDictionary.hpp
@@ -369,7 +369,7 @@ public:
*/
bool getDistributionKey() const;
/** @} *******************************************************************/
-
+
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
void setTupleKey(bool);
bool getTupleKey() const;
@@ -490,6 +490,18 @@ public:
* Get column definition via index in table.
* @return null if none existing name
*/
+ Column* getColumn(const int attributeId);
+
+ /**
+ * Get column definition via name.
+ * @return null if none existing name
+ */
+ Column* getColumn(const char * name);
+
+ /**
+ * Get column definition via index in table.
+ * @return null if none existing name
+ */
const Column* getColumn(const int attributeId) const;
/** @} *******************************************************************/
diff --git a/ndb/include/mgmcommon/NdbConfig.h b/ndb/include/portlib/NdbConfig.h
index 1bca825ab8d..1bca825ab8d 100644
--- a/ndb/include/mgmcommon/NdbConfig.h
+++ b/ndb/include/portlib/NdbConfig.h
diff --git a/ndb/include/util/Bitmask.hpp b/ndb/include/util/Bitmask.hpp
index bb217adab5f..19aa604e4a1 100644
--- a/ndb/include/util/Bitmask.hpp
+++ b/ndb/include/util/Bitmask.hpp
@@ -105,6 +105,11 @@ public:
static void bitXOR(unsigned size, Uint32 data[], const Uint32 data2[]);
/**
+ * bitXORC - Bitwise (x ^ ~y) into first operand.
+ */
+ static void bitXORC(unsigned size, Uint32 data[], const Uint32 data2[]);
+
+ /**
* contains - Check if all bits set in data2 are set in data
*/
static bool contains(unsigned size, Uint32 data[], const Uint32 data2[]);
@@ -261,6 +266,14 @@ BitmaskImpl::bitXOR(unsigned size, Uint32 data[], const Uint32 data2[])
}
}
+inline void
+BitmaskImpl::bitXORC(unsigned size, Uint32 data[], const Uint32 data2[])
+{
+ for (unsigned i = 0; i < size; i++) {
+ data[i] ^= ~data2[i];
+ }
+}
+
inline bool
BitmaskImpl::contains(unsigned size, Uint32 data[], const Uint32 data2[])
{
@@ -452,6 +465,12 @@ public:
BitmaskPOD<size>& bitXOR(const BitmaskPOD<size>& mask2);
/**
+ * bitXORC - Bitwise (x ^ ~y) into first operand.
+ */
+ static void bitXORC(Uint32 data[], const Uint32 data2[]);
+ BitmaskPOD<size>& bitXORC(const BitmaskPOD<size>& mask2);
+
+ /**
* contains - Check if all bits set in data2 (that) are also set in data (this)
*/
static bool contains(Uint32 data[], const Uint32 data2[]);
@@ -713,6 +732,21 @@ BitmaskPOD<size>::bitXOR(const BitmaskPOD<size>& mask2)
}
template <unsigned size>
+inline void
+BitmaskPOD<size>::bitXORC(Uint32 data[], const Uint32 data2[])
+{
+ BitmaskImpl::bitXORC(size,data, data2);
+}
+
+template <unsigned size>
+inline BitmaskPOD<size>&
+BitmaskPOD<size>::bitXORC(const BitmaskPOD<size>& mask2)
+{
+ BitmaskPOD<size>::bitXORC(rep.data, mask2.rep.data);
+ return *this;
+}
+
+template <unsigned size>
char *
BitmaskPOD<size>::getText(const Uint32 data[], char* buf)
{
diff --git a/ndb/include/util/SocketServer.hpp b/ndb/include/util/SocketServer.hpp
index 3860b9ca84b..2fad991e5f8 100644
--- a/ndb/include/util/SocketServer.hpp
+++ b/ndb/include/util/SocketServer.hpp
@@ -37,7 +37,7 @@ public:
public:
virtual ~Session() {}
virtual void runSession(){}
- virtual void stopSession(){}
+ virtual void stopSession(){ m_stop = true; }
protected:
friend class SocketServer;
friend void* sessionThread_C(void*);
@@ -98,6 +98,8 @@ public:
*/
void stopSessions(bool wait = false);
+ void foreachSession(void (*f)(SocketServer::Session*, void*), void *data);
+
private:
struct SessionInstance {
Service * m_service;
diff --git a/ndb/src/Makefile.am b/ndb/src/Makefile.am
index bed43438e91..36a4c3f247f 100644
--- a/ndb/src/Makefile.am
+++ b/ndb/src/Makefile.am
@@ -11,8 +11,8 @@ libndbclient_la_LIBADD = \
common/transporter/libtransporter.la \
common/debugger/libtrace.la \
common/debugger/signaldata/libsignaldataprint.la \
- common/mgmcommon/libmgmsrvcommon.la \
mgmapi/libmgmapi.la \
+ common/mgmcommon/libmgmsrvcommon.la \
common/logger/liblogger.la \
common/portlib/libportlib.la \
common/util/libgeneral.la
diff --git a/ndb/src/common/Makefile.am b/ndb/src/common/Makefile.am
index 7fcf2cab636..8733205eca2 100644
--- a/ndb/src/common/Makefile.am
+++ b/ndb/src/common/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = portlib debugger util logger transporter mgmcommon editline
+SUBDIRS = portlib debugger util logger transporter mgmcommon
noinst_LTLIBRARIES = libcommon.la
diff --git a/ndb/src/common/Makefile_old b/ndb/src/common/Makefile_old
deleted file mode 100644
index ebde75bf3ec..00000000000
--- a/ndb/src/common/Makefile_old
+++ /dev/null
@@ -1,15 +0,0 @@
-include .defs.mk
-
-LIB_DIRS := \
- portlib \
- debugger \
- util \
- logger
-
-ifneq ($(USE_EDITLINE), N)
-LIB_DIRS += editline
-endif
-
-DIRS := transporter mgmcommon
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/common/debugger/EventLogger.cpp b/ndb/src/common/debugger/EventLogger.cpp
index 8a09be9a0a7..59be0affcb4 100644
--- a/ndb/src/common/debugger/EventLogger.cpp
+++ b/ndb/src/common/debugger/EventLogger.cpp
@@ -421,6 +421,11 @@ EventLogger::getText(char * m_text, size_t m_text_len,
"%sArbitration check lost - less than 1/2 nodes left",
theNodeId);
break;
+ case ArbitCode::WinNodes:
+ BaseString::snprintf(m_text, m_text_len,
+ "%sArbitration check won - all node groups and more than 1/2 nodes left",
+ theNodeId);
+ break;
case ArbitCode::WinGroups:
BaseString::snprintf(m_text, m_text_len,
"%sArbitration check won - node group majority",
diff --git a/ndb/src/common/debugger/Makefile_old b/ndb/src/common/debugger/Makefile_old
deleted file mode 100644
index ac3a4475a54..00000000000
--- a/ndb/src/common/debugger/Makefile_old
+++ /dev/null
@@ -1,11 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-DIRS := signaldata
-
-PIC_ARCHIVE := Y
-ARCHIVE_TARGET := trace
-
-SOURCES = SignalLoggerManager.cpp DebuggerNames.cpp BlockNames.cpp LogLevel.cpp EventLogger.cpp GrepError.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/common/debugger/signaldata/Makefile_old b/ndb/src/common/debugger/signaldata/Makefile_old
deleted file mode 100644
index bd00667b482..00000000000
--- a/ndb/src/common/debugger/signaldata/Makefile_old
+++ /dev/null
@@ -1,33 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapi
-
-PIC_ARCHIVE := Y
-ARCHIVE_TARGET := signaldataprint
-
-SOURCES = TcKeyReq.cpp TcKeyConf.cpp TcKeyRef.cpp \
- TcRollbackRep.cpp \
- TupKey.cpp TupCommit.cpp LqhKey.cpp \
- FsOpenReq.cpp FsCloseReq.cpp FsRef.cpp FsConf.cpp FsReadWriteReq.cpp\
- SignalDataPrint.cpp SignalNames.cpp \
- ContinueB.cpp DihContinueB.cpp NdbfsContinueB.cpp \
- CloseComReqConf.cpp PackedSignal.cpp PrepFailReqRef.cpp \
- GCPSave.cpp DictTabInfo.cpp \
- AlterTable.cpp AlterTab.cpp \
- CreateTrig.cpp AlterTrig.cpp DropTrig.cpp \
- FireTrigOrd.cpp TrigAttrInfo.cpp \
- CreateIndx.cpp AlterIndx.cpp DropIndx.cpp TcIndx.cpp \
- IndxKeyInfo.cpp IndxAttrInfo.cpp \
- FsAppendReq.cpp ScanTab.cpp \
- BackupImpl.cpp BackupSignalData.cpp \
- UtilSequence.cpp UtilPrepare.cpp UtilDelete.cpp UtilExecute.cpp \
- LqhFrag.cpp DropTab.cpp PrepDropTab.cpp LCP.cpp MasterLCP.cpp \
- CopyGCI.cpp SystemError.cpp StartRec.cpp NFCompleteRep.cpp \
- FailRep.cpp DisconnectRep.cpp SignalDroppedRep.cpp \
- SumaImpl.cpp NdbSttor.cpp CreateFragmentation.cpp \
- CntrStart.cpp ReadNodesConf.cpp \
- UtilLock.cpp TuxMaint.cpp TupAccess.cpp AccLock.cpp \
- LqhTrans.cpp
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp b/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp
index 3314f0bd097..a4cee38e06f 100644
--- a/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp
+++ b/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp
@@ -16,65 +16,9 @@
-#include "GlobalSignalNumbers.h"
-#include "signaldata/SignalDataPrint.hpp"
-#include "signaldata/TcKeyReq.hpp"
-#include "signaldata/TcKeyConf.hpp"
-#include "signaldata/TcKeyRef.hpp"
-#include "signaldata/LqhKey.hpp"
-#include "signaldata/TupKey.hpp"
-#include "signaldata/TupCommit.hpp"
-#include "signaldata/FsOpenReq.hpp"
-#include "signaldata/FsCloseReq.hpp"
-#include "signaldata/FsReadWriteReq.hpp"
-#include "signaldata/FsRef.hpp"
-#include "signaldata/FsConf.hpp"
-#include "signaldata/CloseComReqConf.hpp"
-#include "signaldata/PackedSignal.hpp"
-#include "signaldata/PrepFailReqRef.hpp"
-#include "signaldata/DictTabInfo.hpp"
-#include "signaldata/AlterTable.hpp"
-#include "signaldata/AlterTab.hpp"
-#include "signaldata/CreateTrig.hpp"
-#include "signaldata/AlterTrig.hpp"
-#include "signaldata/DropTrig.hpp"
-#include "signaldata/FireTrigOrd.hpp"
-#include "signaldata/TrigAttrInfo.hpp"
-#include "signaldata/CreateIndx.hpp"
-#include "signaldata/AlterIndx.hpp"
-#include "signaldata/DropIndx.hpp"
-#include "signaldata/TcIndx.hpp"
-#include "signaldata/IndxKeyInfo.hpp"
-#include "signaldata/IndxAttrInfo.hpp"
-#include <signaldata/FsAppendReq.hpp>
-#include <signaldata/BackupSignalData.hpp>
-#include <signaldata/BackupImpl.hpp>
-#include <signaldata/UtilSequence.hpp>
-#include <signaldata/UtilPrepare.hpp>
-#include <signaldata/UtilExecute.hpp>
-#include <signaldata/ScanTab.hpp>
-#include <signaldata/ScanFrag.hpp>
-#include <signaldata/LqhFrag.hpp>
-#include <signaldata/LqhTransConf.hpp>
-#include <signaldata/DropTab.hpp>
-#include <signaldata/PrepDropTab.hpp>
-#include <signaldata/LCP.hpp>
-#include <signaldata/MasterLCP.hpp>
-#include <signaldata/CopyGCIReq.hpp>
-#include <signaldata/SystemError.hpp>
-#include <signaldata/StartRec.hpp>
-#include <signaldata/NFCompleteRep.hpp>
-#include <signaldata/SignalDroppedRep.hpp>
-#include <signaldata/FailRep.hpp>
-#include <signaldata/DisconnectRep.hpp>
-#include <signaldata/SumaImpl.hpp>
-#include <signaldata/NdbSttor.hpp>
-#include <signaldata/CreateFragmentation.hpp>
-#include <signaldata/UtilLock.hpp>
-#include <signaldata/CntrStart.hpp>
-#include <signaldata/ReadNodesConf.hpp>
-#include <signaldata/TuxMaint.hpp>
-#include <signaldata/AccLock.hpp>
+#include <GlobalSignalNumbers.h>
+#include <signaldata/SignalData.hpp>
+#include <signaldata/SignalDataPrint.hpp>
/**
* This is the register
@@ -254,9 +198,11 @@ SignalDataPrintFunctions[] = {
,{ 0, 0 }
};
-template class Bitmask<1>;
-template class Bitmask<2>;
-template class Bitmask<4>;
+#include <Bitmask.hpp>
+
template struct BitmaskPOD<1>;
template struct BitmaskPOD<2>;
template struct BitmaskPOD<4>;
+template class Bitmask<1>;
+template class Bitmask<2>;
+template class Bitmask<4>;
diff --git a/ndb/src/common/editline/MANIFEST b/ndb/src/common/editline/MANIFEST
deleted file mode 100644
index dc8b4b36f88..00000000000
--- a/ndb/src/common/editline/MANIFEST
+++ /dev/null
@@ -1,15 +0,0 @@
-File Name Description
---------------------------------------------------------
-README Release notes and copyright
-MANIFEST This shipping list
-Make.os9 OS-9 makefile
-Makefile Unix makefile
-complete.c Filename completion routines
-editline.3 Manual page for editline library
-editline.c Line-editing routines
-editline_internal.h Internal library header file
-os9.h OS-9-specific declarations
-sysos9.c OS-9-specific routines
-sysunix.c Unix-specific routines
-testit.c Test driver
-unix.h Unix-specific declarations
diff --git a/ndb/src/common/editline/Makefile.am b/ndb/src/common/editline/Makefile.am
deleted file mode 100644
index 4f53bdc6326..00000000000
--- a/ndb/src/common/editline/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-
-noinst_LIBRARIES = libeditline.a
-
-libeditline_a_SOURCES = complete.c editline.c sysunix.c
-
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/ndb/include
-DEFS = -DANSI_ARROWS -DHAVE_TCGETATTR -DSYS_UNIX
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
diff --git a/ndb/src/common/editline/Makefile_old b/ndb/src/common/editline/Makefile_old
deleted file mode 100644
index 800df8f0f31..00000000000
--- a/ndb/src/common/editline/Makefile_old
+++ /dev/null
@@ -1,18 +0,0 @@
-include .defs.mk
-
-TYPE :=
-
-ARCHIVE_TARGET := editline
-
-CFLAGS += -DANSI_ARROWS -DHAVE_TCGETATTR -DSYS_UNIX
-
-ifeq ($(NDB_OS), WIN32)
-SOURCES = editline_win32.c
-else
-SOURCES = complete.c editline.c sysunix.c
-endif
-
-DIRS := test
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/src/common/editline/README b/ndb/src/common/editline/README
deleted file mode 100644
index 537c7bd8611..00000000000
--- a/ndb/src/common/editline/README
+++ /dev/null
@@ -1,53 +0,0 @@
---
-NOTE: This version has been modified by Ericsson/Alzato. Please
-see the cvs changelog for more details.
---
-
-$Revision: 1.2 $
-
-This is a line-editing library. It can be linked into almost any
-program to provide command-line editing and recall.
-
-It is call-compatible with the FSF readline library, but it is a
-fraction of the size (and offers fewer features). It does not use
-standard I/O. It is distributed under a "C News-like" copyright.
-
-Configuration is done in the Makefile. Type "make testit" to get
-a small slow shell for testing.
-
-This contains some changes since the posting to comp.sources.misc:
- - Bugfix for completion on absolute pathnames.
- - Better handling of M-n versus showing raw 8bit chars.
- - Better signal handling.
- - Now supports termios/termio/sgttyb ioctl's.
- - Add M-m command to toggle how 8bit data is displayed.
-The following changes, made since the last public release, come from
-J.G. Vons <vons@cesar.crbca1.sinet.slb.com>:
- - History-searching no longer redraws the line wrong
- - Added ESC-ESC as synonym for ESC-?
- - SIGQUIT (normally ^\) now sends a signal, not indicating EOF.
- - Fixed some typo's and unclear wording in the manpage.
- - Fixed completion when all entries shared a common prefix.
- - Fixed some meta-char line-redrawing bugs.
-
-Enjoy,
- Rich $alz
- <rsalz@osf.org>
-
- Copyright 1992,1993 Simmule Turner and Rich Salz. All rights reserved.
-
- This software is not subject to any license of the American Telephone
- and Telegraph Company or of the Regents of the University of California.
-
- Permission is granted to anyone to use this software for any purpose on
- any computer system, and to alter it and redistribute it freely, subject
- to the following restrictions:
- 1. The authors are not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
- 2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits must appear in the documentation.
- 3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits must appear in the documentation.
- 4. This notice may not be removed or altered.
diff --git a/ndb/src/common/editline/complete.c b/ndb/src/common/editline/complete.c
deleted file mode 100644
index d1f8b1d3ff4..00000000000
--- a/ndb/src/common/editline/complete.c
+++ /dev/null
@@ -1,211 +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 */
-
-/* -*- c-basic-offset: 4; -*-
-** $Revision: 1.8 $
-**
-** History and file completion functions for editline library.
-*/
-#include "editline_internal.h"
-
-
-/*
-** strcmp-like sorting predicate for qsort.
-*/
-static int
-compare(const void *p1, const void *p2)
-{
- const char **v1;
- const char **v2;
-
- v1 = (const char **)p1;
- v2 = (const char **)p2;
- return strcmp(*v1, *v2);
-}
-
-/*
-** Fill in *avp with an array of names that match file, up to its length.
-** Ignore . and .. .
-*/
-static int
-FindMatches(char *dir, char *file, char ***avp)
-{
- char **av;
- char **new;
- char *p;
- DIR *dp;
- struct dirent *ep;
- size_t ac;
- size_t len;
-
- if ((dp = opendir(dir)) == NULL)
- return 0;
-
- av = NULL;
- ac = 0;
- len = strlen(file);
- while ((ep = readdir(dp)) != NULL) {
- p = ep->d_name;
- if (p[0] == '.' && (p[1] == '\0' || (p[1] == '.' && p[2] == '\0')))
- continue;
- if (len && strncmp(p, file, len) != 0)
- continue;
-
- if ((ac % MEM_INC) == 0) {
- if ((new = malloc(sizeof(char*) * (ac + MEM_INC))) == NULL)
- break;
- if (ac) {
- memcpy(new, av, ac * sizeof (char **));
- free(av);
- }
- *avp = av = new;
- }
-
- if ((av[ac] = strdup(p)) == NULL) {
- if (ac == 0)
- free(av);
- break;
- }
- ac++;
- }
-
- /* Clean up and return. */
- (void)closedir(dp);
- if (ac)
- qsort(av, ac, sizeof (char **), compare);
- return ac;
-}
-
-/*
-** Split a pathname into allocated directory and trailing filename parts.
-*/
-static int
-SplitPath(char *path, char **dirpart, char ** filepart)
-{
- static char DOT[] = ".";
- char *dpart;
- char *fpart;
-
- if ((fpart = strrchr(path, '/')) == NULL) {
- if ((dpart = strdup(DOT)) == NULL)
- return -1;
- if ((fpart = strdup(path)) == NULL) {
- free(dpart);
- return -1;
- }
- }
- else {
- if ((dpart = strdup(path)) == NULL)
- return -1;
- dpart[fpart - path + 1] = '\0';
- if ((fpart = strdup(++fpart)) == NULL) {
- free(dpart);
- return -1;
- }
- }
- *dirpart = dpart;
- *filepart = fpart;
- return 0;
-}
-
-/*
-** Attempt to complete the pathname, returning an allocated copy.
-** Fill in *unique if we completed it, or set it to 0 if ambiguous.
-*/
-char *
-rl_complete(char *pathname,int *unique)
-{
- char **av;
- char *dir;
- char *file;
- char *new;
- char *p;
- size_t ac;
- size_t end;
- size_t i;
- size_t j;
- size_t len;
- size_t new_len;
- size_t p_len;
-
- if (SplitPath(pathname, &dir, &file) < 0)
- return NULL;
- if ((ac = FindMatches(dir, file, &av)) == 0) {
- free(dir);
- free(file);
- return NULL;
- }
-
- p = NULL;
- len = strlen(file);
- if (ac == 1) {
- /* Exactly one match -- finish it off. */
- *unique = 1;
- j = strlen(av[0]) - len + 2;
- p_len = sizeof(char) * (j + 1);
- if ((p = malloc(p_len)) != NULL) {
- memcpy(p, av[0] + len, j);
- new_len = sizeof(char) * (strlen(dir) + strlen(av[0]) + 2);
- new = malloc(new_len);
- if(new != NULL) {
- snprintf(new, new_len, "%s/%s", dir, av[0]);
- rl_add_slash(new, p, p_len);
- free(new);
- }
- }
- }
- else {
- /* Find largest matching substring. */
- for (*unique = 0, i = len, end = strlen(av[0]); i < end; i++)
- for (j = 1; j < ac; j++)
- if (av[0][i] != av[j][i])
- goto breakout;
-breakout:
- if (i > len) {
- j = i - len + 1;
- if ((p = malloc(sizeof(char) * j)) != NULL) {
- memcpy(p, av[0] + len, j);
- p[j - 1] = '\0';
- }
- }
- }
-
- /* Clean up and return. */
- free(dir);
- free(file);
- for (i = 0; i < ac; i++)
- free(av[i]);
- free(av);
- return p;
-}
-
-/*
-** Return all possible completions.
-*/
-int
-rl_list_possib(char *pathname, char ***avp)
-{
- char *dir;
- char *file;
- int ac;
-
- if (SplitPath(pathname, &dir, &file) < 0)
- return 0;
- ac = FindMatches(dir, file, avp);
- free(dir);
- free(file);
- return ac;
-}
diff --git a/ndb/src/common/editline/editline.3 b/ndb/src/common/editline/editline.3
deleted file mode 100644
index 159cc7f87bb..00000000000
--- a/ndb/src/common/editline/editline.3
+++ /dev/null
@@ -1,178 +0,0 @@
-.\" $Revision: 1.1 $
-.TH EDITLINE 3
-.SH NAME
-editline \- command-line editing library with history
-.SH SYNOPSIS
-.nf
-.B "char *"
-.B "readline(prompt)"
-.B " char *prompt;"
-
-.B "void"
-.B "add_history(line)"
-.B " char *line;"
-.fi
-.SH DESCRIPTION
-.I Editline
-is a library that provides an line-editing interface with text recall.
-It is intended to be compatible with the
-.I readline
-library provided by the Free Software Foundation, but much smaller.
-The bulk of this manual page describes the user interface.
-.PP
-The
-.I readline
-routine returns a line of text with the trailing newline removed.
-The data is returned in a buffer allocated with
-.IR malloc (3),
-so the space should be released with
-.IR free (3)
-when the calling program is done with it.
-Before accepting input from the user, the specified
-.I prompt
-is displayed on the terminal.
-.PP
-The
-.I add_history
-routine makes a copy of the specified
-.I line
-and adds it to the internal history list.
-.SS "User Interface"
-A program that uses this library provides a simple emacs-like editing
-interface to its users.
-A line may be edited before it is sent to the calling program by typing either
-control characters or escape sequences.
-A control character, shown as a caret followed by a letter, is typed by
-holding down the ``control'' key while the letter is typed.
-For example, ``^A'' is a control-A.
-An escape sequence is entered by typing the ``escape'' key followed by one or
-more characters.
-The escape key is abbreviated as ``ESC''.
-Note that unlike control keys, case matters in escape sequences; ``ESC\ F''
-is not the same as ``ESC\ f''.
-.PP
-An editing command may be typed anywhere on the line, not just at the
-beginning.
-In addition, a return may also be typed anywhere on the line, not just at
-the end.
-.PP
-Most editing commands may be given a repeat count,
-.IR n ,
-where
-.I n
-is a number.
-To enter a repeat count, type the escape key, the number, and then
-the command to execute.
-For example, ``ESC\ 4\ ^f'' moves forward four characters.
-If a command may be given a repeat count then the text ``[n]'' is given at the
-end of its description.
-.PP
-The following control characters are accepted:
-.RS
-.nf
-.ta \w'ESC DEL 'u
-^A Move to the beginning of the line
-^B Move left (backwards) [n]
-^D Delete character [n]
-^E Move to end of line
-^F Move right (forwards) [n]
-^G Ring the bell
-^H Delete character before cursor (backspace key) [n]
-^I Complete filename (tab key); see below
-^J Done with line (return key)
-^K Kill to end of line (or column [n])
-^L Redisplay line
-^M Done with line (alternate return key)
-^N Get next line from history [n]
-^P Get previous line from history [n]
-^R Search backward (forward if [n]) through history for text;
-\& prefixing the string with a caret (^) forces it to
-\& match only at the beginning of a history line
-^T Transpose characters
-^V Insert next character, even if it is an edit command
-^W Wipe to the mark
-^X^X Exchange current location and mark
-^Y Yank back last killed text
-^[ Start an escape sequence (escape key)
-^]c Move forward to next character ``c''
-^? Delete character before cursor (delete key) [n]
-.fi
-.RE
-.PP
-The following escape sequences are provided.
-.RS
-.nf
-.ta \w'ESC DEL 'u
-ESC\ ^H Delete previous word (backspace key) [n]
-ESC\ DEL Delete previous word (delete key) [n]
-ESC\ ESC Show possible completions; see below
-ESC\ SP Set the mark (space key); see ^X^X and ^Y above
-ESC\ . Get the last (or [n]'th) word from previous line
-ESC\ ? Show possible completions; see below
-ESC\ < Move to start of history
-ESC\ > Move to end of history
-ESC\ b Move backward a word [n]
-ESC\ d Delete word under cursor [n]
-ESC\ f Move forward a word [n]
-ESC\ l Make word lowercase [n]
-ESC\ m Toggle if 8bit chars display as themselves or with
-\& an ``M\-'' prefix
-ESC\ u Make word uppercase [n]
-ESC\ y Yank back last killed text
-ESC\ w Make area up to mark yankable
-ESC\ nn Set repeat count to the number nn
-ESC\ C Read from environment variable ``_C_'', where C is
-\& an uppercase letter
-.fi
-.RE
-.PP
-The
-.I editline
-library has a small macro facility.
-If you type the escape key followed by an uppercase letter,
-.IR C ,
-then the contents of the environment variable
-.I _C_
-are read in as if you had typed them at the keyboard.
-For example, if the variable
-.I _L_
-contains the following:
-.RS
-^A^Kecho '^V^[[H^V^[[2J'^M
-.RE
-Then typing ``ESC L'' will move to the beginning of the line, kill the
-entire line, enter the echo command needed to clear the terminal (if your
-terminal is like a VT-100), and send the line back to the shell.
-.PP
-The
-.I editline
-library also does filename completion.
-Suppose the root directory has the following files in it:
-.RS
-.nf
-.ta \w'core 'u
-bin vmunix
-core vmunix.old
-.fi
-.RE
-If you type ``rm\ /v'' and then the tab key.
-.I Editline
-will then finish off as much of the name as possible by adding ``munix''.
-Because the name is not unique, it will then beep.
-If you type the escape key followed by either a question mark or another
-escape, it will display the two choices.
-If you then type a period and a tab, the library will finish off the filename
-for you:
-.RS
-.nf
-.RI "rm /v[TAB]" munix ".[TAB]" old
-.fi
-.RE
-The tab key is shown by ``[TAB]'' and the automatically-entered text
-is shown in italics.
-.SH "BUGS AND LIMITATIONS"
-Cannot handle lines more than 80 columns.
-.SH AUTHORS
-Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy>
-and Rich $alz <rsalz@osf.org>.
-Original manual page by DaviD W. Sanderson <dws@ssec.wisc.edu>.
diff --git a/ndb/src/common/editline/editline.c b/ndb/src/common/editline/editline.c
deleted file mode 100644
index 1e4c1ecba76..00000000000
--- a/ndb/src/common/editline/editline.c
+++ /dev/null
@@ -1,1514 +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 */
-
-/* -*- c-basic-offset: 4; -*-
-** $Revision: 1.6 $
-**
-** Main editing routines for editline library.
-*/
-#include <ndb_global.h>
-
-#include "editline_internal.h"
-#include <signal.h>
-
-/*
-** Manifest constants.
-*/
-#define SCREEN_WIDTH 80
-#define SCREEN_ROWS 24
-#define NO_ARG (-1)
-#define DEL 127
-#define TAB '\t'
-#define CTL(x) ((x) & 0x1F)
-#define ISCTL(x) ((x) && (x) < ' ')
-#define UNCTL(x) ((x) + 64)
-#define META(x) ((x) | 0x80)
-#define ISMETA(x) ((x) & 0x80)
-#define UNMETA(x) ((x) & 0x7F)
-#define MAPSIZE 32
-#define METAMAPSIZE 16
-#if !defined(HIST_SIZE)
-#define HIST_SIZE 20
-#endif /* !defined(HIST_SIZE) */
-
-/*
-** Command status codes.
-*/
-typedef enum _STATUS {
- CSdone, CSeof, CSmove, CSdispatch, CSstay, CSsignal
-} STATUS;
-
-/*
-** The type of case-changing to perform.
-*/
-typedef enum _CASE {
- TOupper, TOlower
-} CASE;
-
-/*
-** Key to command mapping.
-*/
-typedef struct _KEYMAP {
- char Key;
- char Active;
- STATUS (*Function)();
-} KEYMAP;
-
-/*
-** Command history structure.
-*/
-typedef struct _HISTORY {
- int Size;
- int Pos;
- char *Lines[HIST_SIZE];
-} HISTORY;
-
-/*
-** Globals.
-*/
-int rl_eof;
-int rl_erase;
-int rl_intr;
-int rl_kill;
-int rl_quit;
-#if defined(DO_SIGTSTP)
-int rl_susp;
-#endif /* defined(DO_SIGTSTP) */
-
-static char NIL[] = "";
-static const char *Input = NIL;
-static char *Line;
-static const char *Prompt;
-static char *Yanked;
-static char *Screen;
-static char NEWLINE[]= CRLF;
-static HISTORY H;
-static int Repeat;
-static int End;
-static int Mark;
-static int OldPoint;
-static int Point;
-static int PushBack;
-static int Pushed;
-static int Signal;
-static KEYMAP Map[MAPSIZE];
-static KEYMAP MetaMap[METAMAPSIZE];
-static size_t Length;
-static size_t ScreenCount;
-static size_t ScreenSize;
-static char *backspace;
-static int TTYwidth;
-static int TTYrows;
-
-/* Display print 8-bit chars as `M-x' or as the actual 8-bit char? */
-int rl_meta_chars = 1;
-
-/*
-** Declarations.
-*/
-static char *editinput();
-
-#if defined(USE_TERMCAP)
-extern char *getenv();
-extern char *tgetstr();
-extern int tgetent();
-extern int tgetnum();
-#endif /* defined(USE_TERMCAP) */
-
-/*
-** TTY input/output functions.
-*/
-
-static void
-TTYflush()
-{
- if (ScreenCount) {
- (void)write(1, Screen, ScreenCount);
- ScreenCount = 0;
- }
-}
-
-static void
-TTYput(const char c)
-{
- Screen[ScreenCount] = c;
- if (++ScreenCount >= ScreenSize - 1) {
- ScreenSize += SCREEN_INC;
- Screen = realloc(Screen, sizeof(char) * ScreenSize);
- /* XXX what to do if realloc failes? */
- }
-}
-
-static void
-TTYputs(const char *p)
-{
- while (*p)
- TTYput(*p++);
-}
-
-static void
-TTYshow(char c)
-{
- if (c == DEL) {
- TTYput('^');
- TTYput('?');
- }
- else if (c == TAB) {
- /* XXX */
- }
- else if (ISCTL(c)) {
- TTYput('^');
- TTYput(UNCTL(c));
- }
- else if (rl_meta_chars && ISMETA(c)) {
- TTYput('M');
- TTYput('-');
- TTYput(UNMETA(c));
- }
- else
- TTYput(c);
-}
-
-static void
-TTYstring(char *p)
-{
- while (*p)
- TTYshow(*p++);
-}
-
-static int
-TTYget()
-{
- char c;
-
- TTYflush();
- if (Pushed) {
- Pushed = 0;
- return PushBack;
- }
- if (*Input)
- return *Input++;
- return read(0, &c, (size_t)1) == 1 ? c : EOF;
-}
-
-#define TTYback() (backspace ? TTYputs((const char *)backspace) : TTYput('\b'))
-
-static void
-TTYbackn(int n)
-{
- while (--n >= 0)
- TTYback();
-}
-
-static void
-TTYinfo()
-{
- static int init;
-#if defined(USE_TERMCAP)
- char *term;
- char buff[2048];
- char *bp;
- char *p;
-#endif /* defined(USE_TERMCAP) */
-#if defined(TIOCGWINSZ)
- struct winsize W;
-#endif /* defined(TIOCGWINSZ) */
-
- if (init) {
-#if defined(TIOCGWINSZ)
- /* Perhaps we got resized. */
- if (ioctl(0, TIOCGWINSZ, &W) >= 0
- && W.ws_col > 0 && W.ws_row > 0) {
- TTYwidth = (int)W.ws_col;
- TTYrows = (int)W.ws_row;
- }
-#endif /* defined(TIOCGWINSZ) */
- return;
- }
- init++;
-
- TTYwidth = TTYrows = 0;
-#if defined(USE_TERMCAP)
- bp = &buff[0];
- if ((term = getenv("TERM")) == NULL)
- term = "dumb";
- if (tgetent(buff, term) < 0) {
- TTYwidth = SCREEN_WIDTH;
- TTYrows = SCREEN_ROWS;
- return;
- }
- p = tgetstr("le", &bp);
- backspace = p ? strdup(p) : NULL;
- TTYwidth = tgetnum("co");
- TTYrows = tgetnum("li");
-#endif /* defined(USE_TERMCAP) */
-
-#if defined(TIOCGWINSZ)
- if (ioctl(0, TIOCGWINSZ, &W) >= 0) {
- TTYwidth = (int)W.ws_col;
- TTYrows = (int)W.ws_row;
- }
-#endif /* defined(TIOCGWINSZ) */
-
- if (TTYwidth <= 0 || TTYrows <= 0) {
- TTYwidth = SCREEN_WIDTH;
- TTYrows = SCREEN_ROWS;
- }
-}
-
-
-/*
-** Print an array of words in columns.
-*/
-static void
-columns(int ac, char **av)
-{
- char *p;
- int i;
- int j;
- int k;
- int len;
- int skip;
- int longest;
- int cols;
-
- /* Find longest name, determine column count from that. */
- for (longest = 0, i = 0; i < ac; i++)
- if ((j = strlen((char *)av[i])) > longest)
- longest = j;
- cols = TTYwidth / (longest + 3);
-
- TTYputs((const char *)NEWLINE);
- for (skip = ac / cols + 1, i = 0; i < skip; i++) {
- for (j = i; j < ac; j += skip) {
- for (p = av[j], len = strlen((char *)p), k = len; --k >= 0; p++)
- TTYput(*p);
- if (j + skip < ac)
- while (++len < longest + 3)
- TTYput(' ');
- }
- TTYputs((const char *)NEWLINE);
- }
-}
-
-static void
-reposition()
-{
- int i;
- char *p;
-
- TTYput('\r');
- TTYputs((const char *)Prompt);
- for (i = Point, p = Line; --i >= 0; p++)
- TTYshow(*p);
-}
-
-static void
-left(STATUS Change)
-{
- char c;
-
- TTYback();
- if (Point) {
- c = Line[Point - 1];
- if (c == TAB) {
- /* XXX */
- }
- else if (ISCTL(c))
- TTYback();
- else if (rl_meta_chars && ISMETA(c)) {
- TTYback();
- TTYback();
- }
- }
- if (Change == CSmove)
- Point--;
-}
-
-static void
-right(STATUS Change)
-{
- TTYshow(Line[Point]);
- if (Change == CSmove)
- Point++;
-}
-
-static STATUS
-ring_bell()
-{
- TTYput('\07');
- TTYflush();
- return CSstay;
-}
-
-static STATUS
-do_macro(int c)
-{
- char name[4];
-
- name[0] = '_';
- name[1] = c;
- name[2] = '_';
- name[3] = '\0';
-
- if ((Input = (char *)getenv((char *)name)) == NULL) {
- Input = NIL;
- return ring_bell();
- }
- return CSstay;
-}
-
-static STATUS
-do_forward(STATUS move)
-{
- int i;
- char *p;
-
- i = 0;
- do {
- p = &Line[Point];
- for ( ; Point < End && (*p == ' ' || !isalnum((int)*p)); Point++, p++)
- if (move == CSmove)
- right(CSstay);
-
- for (; Point < End && isalnum((int)*p); Point++, p++)
- if (move == CSmove)
- right(CSstay);
-
- if (Point == End)
- break;
- } while (++i < Repeat);
-
- return CSstay;
-}
-
-static STATUS
-do_case(CASE type)
-{
- int i;
- int end;
- int count;
- char *p;
-
- (void)do_forward(CSstay);
- if (OldPoint != Point) {
- if ((count = Point - OldPoint) < 0)
- count = -count;
- Point = OldPoint;
- if ((end = Point + count) > End)
- end = End;
- for (i = Point, p = &Line[i]; i < end; i++, p++) {
- if (type == TOupper) {
- if (islower((int)*p))
- *p = toupper((int)*p);
- }
- else if (isupper((int)*p))
- *p = tolower((int)*p);
- right(CSmove);
- }
- }
- return CSstay;
-}
-
-static STATUS
-case_down_word()
-{
- return do_case(TOlower);
-}
-
-static STATUS
-case_up_word()
-{
- return do_case(TOupper);
-}
-
-static void
-ceol()
-{
- int extras;
- int i;
- char *p;
-
- for (extras = 0, i = Point, p = &Line[i]; i <= End; i++, p++) {
- TTYput(' ');
- if (*p == TAB) {
- /* XXX */
- }
- else if (ISCTL(*p)) {
- TTYput(' ');
- extras++;
- }
- else if (rl_meta_chars && ISMETA(*p)) {
- TTYput(' ');
- TTYput(' ');
- extras += 2;
- }
- }
-
- for (i += extras; i > Point; i--)
- TTYback();
-}
-
-static void
-clear_line()
-{
- Point = -strlen(Prompt);
- TTYput('\r');
- ceol();
- Point = 0;
- End = 0;
- Line[0] = '\0';
-}
-
-static STATUS
-insert_string(char *p)
-{
- size_t len;
- int i;
- char *new;
- char *q;
-
- len = strlen((char *)p);
- if (End + len >= Length) {
- if ((new = malloc(sizeof(char) * (Length + len + MEM_INC))) == NULL)
- return CSstay;
- if (Length) {
- memcpy(new, Line, Length);
- free(Line);
- }
- Line = new;
- Length += len + MEM_INC;
- }
-
- for (q = &Line[Point], i = End - Point; --i >= 0; )
- q[len + i] = q[i];
- memcpy(&Line[Point], p, len);
- End += len;
- Line[End] = '\0';
- TTYstring(&Line[Point]);
- Point += len;
-
- return Point == End ? CSstay : CSmove;
-}
-
-static STATUS
-redisplay()
-{
- TTYputs((const char *)NEWLINE);
- TTYputs((const char *)Prompt);
- TTYstring(Line);
- return CSmove;
-}
-
-static STATUS
-redisplay_no_nl()
-{
- TTYput('\r');
- TTYputs((const char *)Prompt);
- TTYstring(Line);
- return CSmove;
-}
-
-static STATUS
-toggle_meta_mode()
-{
- rl_meta_chars = !rl_meta_chars;
- return redisplay();
-}
-
-
-static char *
-next_hist()
-{
- return H.Pos >= H.Size - 1 ? NULL : H.Lines[++H.Pos];
-}
-
-static char *
-prev_hist()
-{
- return H.Pos == 0 ? NULL : H.Lines[--H.Pos];
-}
-
-static STATUS
-do_insert_hist(char *p)
-{
- if (p == NULL)
- return ring_bell();
- Point = 0;
- reposition();
- ceol();
- End = 0;
- return insert_string(p);
-}
-
-static STATUS
-do_hist(char *(*move)())
-{
- char *p;
- int i;
-
- i = 0;
- do {
- if ((p = (*move)()) == NULL)
- return ring_bell();
- } while (++i < Repeat);
- return do_insert_hist(p);
-}
-
-static STATUS
-h_next()
-{
- return do_hist(next_hist);
-}
-
-static STATUS
-h_prev()
-{
- return do_hist(prev_hist);
-}
-
-static STATUS
-h_first()
-{
- return do_insert_hist(H.Lines[H.Pos = 0]);
-}
-
-static STATUS
-h_last()
-{
- return do_insert_hist(H.Lines[H.Pos = H.Size - 1]);
-}
-
-/*
-** Return zero if pat appears as a substring in text.
-*/
-static int
-substrcmp(char *text, char *pat,int len)
-{
- char c;
-
- if ((c = *pat) == '\0')
- return *text == '\0';
- for ( ; *text; text++)
- if (*text == c && strncmp(text, pat, len) == 0)
- return 0;
- return 1;
-}
-
-static char *
-search_hist(char *search,char *(*move)())
-{
- static char *old_search;
- int len;
- int pos;
- int (*match)();
- char *pat;
-
- /* Save or get remembered search pattern. */
- if (search && *search) {
- if (old_search)
- free(old_search);
- old_search = strdup(search);
- }
- else {
- if (old_search == NULL || *old_search == '\0')
- return NULL;
- search = old_search;
- }
-
- /* Set up pattern-finder. */
- if (*search == '^') {
- match = strncmp;
- pat = (char *)(search + 1);
- }
- else {
- match = substrcmp;
- pat = (char *)search;
- }
- len = strlen(pat);
-
- for (pos = H.Pos; (*move)() != NULL; )
- if ((*match)((char *)H.Lines[H.Pos], pat, len) == 0)
- return H.Lines[H.Pos];
- H.Pos = pos;
- return NULL;
-}
-
-static STATUS
-h_search()
-{
- static int Searching;
- const char *old_prompt;
- char *(*move)();
- char *p;
-
- if (Searching)
- return ring_bell();
- Searching = 1;
-
- clear_line();
- old_prompt = Prompt;
- Prompt = "Search: ";
- TTYputs((const char *)Prompt);
- move = Repeat == NO_ARG ? prev_hist : next_hist;
- p = editinput();
- Searching = 0;
- if (p == NULL && Signal > 0) {
- Signal = 0;
- clear_line();
- Prompt = old_prompt;
- return redisplay_no_nl();
- }
- p = search_hist(p, move);
- clear_line();
- Prompt = old_prompt;
- if (p == NULL) {
- (void)ring_bell();
- return redisplay_no_nl();
- }
- return do_insert_hist(p);
-}
-
-static STATUS
-fd_char()
-{
- int i;
-
- i = 0;
- do {
- if (Point >= End)
- break;
- right(CSmove);
- } while (++i < Repeat);
- return CSstay;
-}
-
-static void
-save_yank(int begin, int i)
-{
- if (Yanked) {
- free(Yanked);
- Yanked = NULL;
- }
-
- if (i < 1)
- return;
-
- if ((Yanked = malloc(sizeof(char) * (i + 1))) != NULL) {
- memcpy(Yanked, &Line[begin], i);
- Yanked[i] = '\0';
- }
-}
-
-static STATUS
-delete_string(int count)
-{
- int i;
- char *p;
-
- if (count <= 0 || End == Point)
- return ring_bell();
-
- if (count == 1 && Point == End - 1) {
- /* Optimize common case of delete at end of line. */
- End--;
- p = &Line[Point];
- i = 1;
- TTYput(' ');
- if (*p == TAB) {
- /* XXX */
- }
- else if (ISCTL(*p)) {
- i = 2;
- TTYput(' ');
- }
- else if (rl_meta_chars && ISMETA(*p)) {
- i = 3;
- TTYput(' ');
- TTYput(' ');
- }
- TTYbackn(i);
- *p = '\0';
- return CSmove;
- }
- if (Point + count > End && (count = End - Point) <= 0)
- return CSstay;
-
- if (count > 1)
- save_yank(Point, count);
-
- ceol();
- for (p = &Line[Point], i = End - (Point + count) + 1; --i >= 0; p++)
- p[0] = p[count];
- End -= count;
- TTYstring(&Line[Point]);
- return CSmove;
-}
-
-static STATUS
-bk_char()
-{
- int i;
-
- i = 0;
- do {
- if (Point == 0)
- break;
- left(CSmove);
- } while (++i < Repeat);
-
- return CSstay;
-}
-
-static STATUS
-bk_del_char()
-{
- int i;
-
- i = 0;
- do {
- if (Point == 0)
- break;
- left(CSmove);
- } while (++i < Repeat);
-
- return delete_string(i);
-}
-
-static STATUS
-kill_line()
-{
- int i;
-
- if (Repeat != NO_ARG) {
- if (Repeat < Point) {
- i = Point;
- Point = Repeat;
- reposition();
- (void)delete_string(i - Point);
- }
- else if (Repeat > Point) {
- right(CSmove);
- (void)delete_string(Repeat - Point - 1);
- }
- return CSmove;
- }
-
- save_yank(Point, End - Point);
- ceol();
- Line[Point] = '\0';
- End = Point;
- return CSstay;
-}
-
-static STATUS
-insert_char(int c)
-{
- STATUS s;
- char buff[2];
- char *p;
- char *q;
- int i;
-
- if (Repeat == NO_ARG || Repeat < 2) {
- buff[0] = c;
- buff[1] = '\0';
- return insert_string(buff);
- }
-
- if ((p = malloc(sizeof(char) * (Repeat + 1))) == NULL)
- return CSstay;
- for (i = Repeat, q = p; --i >= 0; )
- *q++ = c;
- *q = '\0';
- Repeat = 0;
- s = insert_string(p);
- free(p);
- return s;
-}
-
-static STATUS
-meta()
-{
- int c;
- KEYMAP *kp;
-
- if ((c = TTYget()) == EOF)
- return CSeof;
-#if defined(ANSI_ARROWS)
- /* Also include VT-100 arrows. */
- if (c == '[' || c == 'O')
- switch ((int)(c = TTYget())) {
- default: return ring_bell();
- case EOF: return CSeof;
- case 'A': return h_prev();
- case 'B': return h_next();
- case 'C': return fd_char();
- case 'D': return bk_char();
- }
-#endif /* defined(ANSI_ARROWS) */
-
- if (isdigit(c)) {
- for (Repeat = c - '0'; (c = TTYget()) != EOF && isdigit(c); )
- Repeat = Repeat * 10 + c - '0';
- Pushed = 1;
- PushBack = c;
- return CSstay;
- }
-
- if (isupper(c))
- return do_macro(c);
- for (OldPoint = Point, kp = MetaMap; kp < &MetaMap[METAMAPSIZE]; kp++)
- if (kp->Key == c && kp->Active)
- return (*kp->Function)();
-
- return ring_bell();
-}
-
-static STATUS
-emacs(int c)
-{
- STATUS s;
- KEYMAP *kp;
-
-#if 0
- /* This test makes it impossible to enter eight-bit characters when
- * meta-char mode is enabled. */
- if (rl_meta_chars && ISMETA(c)) {
- Pushed = 1;
- PushBack = UNMETA(c);
- return meta();
- }
-#endif /* 0 */
- for (kp = Map; kp < &Map[MAPSIZE]; kp++)
- if (kp->Key == c && kp->Active)
- break;
- s = kp < &Map[MAPSIZE] ? (*kp->Function)() : insert_char((int)c);
- if (!Pushed)
- /* No pushback means no repeat count; hacky, but true. */
- Repeat = NO_ARG;
- return s;
-}
-
-static STATUS
-TTYspecial(int c)
-{
- if (rl_meta_chars && ISMETA(c))
- return CSdispatch;
-
- if (c == rl_erase || c == DEL)
- return bk_del_char();
- if (c == rl_kill) {
- if (Point != 0) {
- Point = 0;
- reposition();
- }
- Repeat = NO_ARG;
- return kill_line();
- }
- if (c == rl_eof && Point == 0 && End == 0)
- return CSeof;
- if (c == rl_intr) {
- Signal = SIGINT;
- return CSsignal;
- }
- if (c == rl_quit) {
- Signal = SIGQUIT;
- return CSsignal;
- }
-#if defined(DO_SIGTSTP)
- if (c == rl_susp) {
- Signal = SIGTSTP;
- return CSsignal;
- }
-#endif /* defined(DO_SIGTSTP) */
-
- return CSdispatch;
-}
-
-static char *
-editinput()
-{
- int c;
-
- Repeat = NO_ARG;
- OldPoint = Point = Mark = End = 0;
- Line[0] = '\0';
-
- Signal = -1;
- while ((c = TTYget()) != EOF)
- switch (TTYspecial(c)) {
- case CSdone:
- return Line;
- case CSeof:
- return NULL;
- case CSsignal:
- return (char *)"";
- case CSmove:
- reposition();
- break;
- case CSdispatch:
- switch (emacs(c)) {
- case CSdone:
- return Line;
- case CSeof:
- return NULL;
- case CSsignal:
- return (char *)"";
- case CSmove:
- reposition();
- break;
- case CSdispatch:
- case CSstay:
- break;
- }
- break;
- case CSstay:
- break;
- }
- return NULL;
-}
-
-static void
-hist_add(char *p)
-{
- int i;
-
- if ((p = strdup(p)) == NULL)
- return;
- if (H.Size < HIST_SIZE)
- H.Lines[H.Size++] = p;
- else {
- free(H.Lines[0]);
- for (i = 0; i < HIST_SIZE - 1; i++)
- H.Lines[i] = H.Lines[i + 1];
- H.Lines[i] = p;
- }
- H.Pos = H.Size - 1;
-}
-
-static char *
-read_redirected()
-{
- int size;
- char *p;
- char *line;
- char *end;
-
- for (size = MEM_INC, p = line = malloc(sizeof(char) * size), end = p + size; ; p++) {
- if (p == end) {
- size += MEM_INC;
- p = line = realloc(line, size);
- end = p + size;
- }
- if (read(0, p, 1) <= 0) {
- /* Ignore "incomplete" lines at EOF, just like we do for a tty. */
- free(line);
- return NULL;
- }
- if (*p == '\n')
- break;
- }
- *p = '\0';
- return line;
-}
-
-/*
-** For compatibility with FSF readline.
-*/
-/* ARGSUSED0 */
-void
-rl_reset_terminal(char *p)
-{
- (void)p; /* Suppress warning */
-}
-
-void
-rl_initialize()
-{
-}
-
-int
-rl_insert(int count, int c)
-{
- if (count > 0) {
- Repeat = count;
- (void)insert_char(c);
- (void)redisplay_no_nl();
- }
- return 0;
-}
-
-int (*rl_event_hook)();
-
-int
-rl_key_action(int c, char flag)
-{
- KEYMAP *kp;
- int size;
-
- (void)flag; /* Suppress warning */
-
- if (ISMETA(c)) {
- kp = MetaMap;
- size = METAMAPSIZE;
- }
- else {
- kp = Map;
- size = MAPSIZE;
- }
- for ( ; --size >= 0; kp++)
- if (kp->Key == c) {
- kp->Active = c ? 1 : 0;
- return 1;
- }
- return -1;
-}
-
-char *
-readline(const char *prompt)
-{
- char *line;
- int s;
-
- if (!isatty(0)) {
- TTYflush();
- return read_redirected();
- }
-
- if (Line == NULL) {
- Length = MEM_INC;
- if ((Line = malloc(sizeof(char) * Length)) == NULL)
- return NULL;
- }
-
- TTYinfo();
- rl_ttyset(0);
- hist_add(NIL);
- ScreenSize = SCREEN_INC;
- Screen = malloc(sizeof(char) * ScreenSize);
- Prompt = prompt ? prompt : (char *)NIL;
- TTYputs((const char *)Prompt);
- if ((line = editinput()) != NULL) {
- line = strdup(line);
- TTYputs((const char *)NEWLINE);
- TTYflush();
- }
- rl_ttyset(1);
- free(Screen);
- free(H.Lines[--H.Size]);
- if (Signal > 0) {
- s = Signal;
- Signal = 0;
- (void)kill(getpid(), s);
- }
- return (char *)line;
-}
-
-void
-add_history(char *p)
-{
- if (p == NULL || *p == '\0')
- return;
-
-#if defined(UNIQUE_HISTORY)
- if (H.Size && strcmp(p, H.Lines[H.Size - 1]) == 0)
- return;
-#endif /* defined(UNIQUE_HISTORY) */
- hist_add((char *)p);
-}
-
-
-static STATUS
-beg_line()
-{
- if (Point) {
- Point = 0;
- return CSmove;
- }
- return CSstay;
-}
-
-static STATUS
-del_char()
-{
- return delete_string(Repeat == NO_ARG ? 1 : Repeat);
-}
-
-static STATUS
-end_line()
-{
- if (Point != End) {
- Point = End;
- return CSmove;
- }
- return CSstay;
-}
-
-/*
-** Return allocated copy of word under cursor, moving cursor after the
-** word.
-*/
-static char *
-find_word()
-{
- static char SEPS[] = "\"#;&|^$=`'{}()<>\n\t ";
- char *p;
- char *new;
- size_t len;
-
- /* Move forward to end of word. */
- p = &Line[Point];
- for ( ; Point < End && strchr(SEPS, (char)*p) == NULL; Point++, p++)
- right(CSstay);
-
- /* Back up to beginning of word. */
- for (p = &Line[Point]; p > Line && strchr(SEPS, (char)p[-1]) == NULL; p--)
- continue;
- len = Point - (p - Line) + 1;
- if ((new = malloc(sizeof(char) * len)) == NULL)
- return NULL;
- memcpy(new, p, len);
- new[len - 1] = '\0';
- return new;
-}
-
-static STATUS
-c_complete()
-{
- char *p;
- char *word;
- int unique;
-
- word = find_word();
- p = (char *)rl_complete((char *)word, &unique);
- if (word)
- free(word);
- if (p && *p) {
- (void)insert_string(p);
- if (!unique)
- (void)ring_bell();
- free(p);
- return redisplay_no_nl();
- }
- return ring_bell();
-}
-
-static STATUS
-c_possible()
-{
- char **av;
- char *word;
- int ac;
-
- word = find_word();
- ac = rl_list_possib((char *)word, (char ***)&av);
- if (word)
- free(word);
- if (ac) {
- columns(ac, av);
- while (--ac >= 0)
- free(av[ac]);
- free(av);
- return redisplay_no_nl();
- }
- return ring_bell();
-}
-
-static STATUS
-accept_line()
-{
- Line[End] = '\0';
- return CSdone;
-}
-
-static STATUS
-transpose()
-{
- char c;
-
- if (Point) {
- if (Point == End)
- left(CSmove);
- c = Line[Point - 1];
- left(CSstay);
- Line[Point - 1] = Line[Point];
- TTYshow(Line[Point - 1]);
- Line[Point++] = c;
- TTYshow(c);
- }
- return CSstay;
-}
-
-static STATUS
-quote()
-{
- int c;
-
- return (c = TTYget()) == EOF ? CSeof : insert_char((int)c);
-}
-
-static STATUS
-wipe()
-{
- int i;
-
- if (Mark > End)
- return ring_bell();
-
- if (Point > Mark) {
- i = Point;
- Point = Mark;
- Mark = i;
- reposition();
- }
-
- return delete_string(Mark - Point);
-}
-
-static STATUS
-mk_set()
-{
- Mark = Point;
- return CSstay;
-}
-
-static STATUS
-exchange()
-{
- int c;
-
- if ((c = TTYget()) != CTL('X'))
- return c == EOF ? CSeof : ring_bell();
-
- if ((c = Mark) <= End) {
- Mark = Point;
- Point = c;
- return CSmove;
- }
- return CSstay;
-}
-
-static STATUS
-yank()
-{
- if (Yanked && *Yanked)
- return insert_string(Yanked);
- return CSstay;
-}
-
-static STATUS
-copy_region()
-{
- if (Mark > End)
- return ring_bell();
-
- if (Point > Mark)
- save_yank(Mark, Point - Mark);
- else
- save_yank(Point, Mark - Point);
-
- return CSstay;
-}
-
-static STATUS
-move_to_char()
-{
- int c;
- int i;
- char *p;
-
- if ((c = TTYget()) == EOF)
- return CSeof;
- for (i = Point + 1, p = &Line[i]; i < End; i++, p++)
- if (*p == c) {
- Point = i;
- return CSmove;
- }
- return CSstay;
-}
-
-static STATUS
-fd_word()
-{
- return do_forward(CSmove);
-}
-
-static STATUS
-fd_kill_word()
-{
- int i;
-
- (void)do_forward(CSstay);
- if (OldPoint != Point) {
- i = Point - OldPoint;
- Point = OldPoint;
- return delete_string(i);
- }
- return CSstay;
-}
-
-static STATUS
-bk_word()
-{
- int i;
- char *p;
-
- i = 0;
- do {
- for (p = &Line[Point]; p > Line && !isalnum((int)p[-1]); p--)
- left(CSmove);
-
- for (; p > Line && p[-1] != ' ' && isalnum((int)p[-1]); p--)
- left(CSmove);
-
- if (Point == 0)
- break;
- } while (++i < Repeat);
-
- return CSstay;
-}
-
-static STATUS
-bk_kill_word()
-{
- (void)bk_word();
- if (OldPoint != Point)
- return delete_string(OldPoint - Point);
- return CSstay;
-}
-
-static int
-argify(char *line, char ***avp)
-{
- char *c;
- char **p;
- char **new;
- int ac;
- int i;
-
- i = MEM_INC;
- if ((*avp = p = malloc(sizeof(char*) * i))== NULL)
- return 0;
-
- for (c = line; isspace((int)*c); c++)
- continue;
- if (*c == '\n' || *c == '\0')
- return 0;
-
- for (ac = 0, p[ac++] = c; *c && *c != '\n'; ) {
- if (isspace((int)*c)) {
- *c++ = '\0';
- if (*c && *c != '\n') {
- if (ac + 1 == i) {
- new = malloc(sizeof(char*) * (i + MEM_INC));
- if (new == NULL) {
- p[ac] = NULL;
- return ac;
- }
- memcpy(new, p, i * sizeof (char **));
- i += MEM_INC;
- free(p);
- *avp = p = new;
- }
- p[ac++] = c;
- }
- }
- else
- c++;
- }
- *c = '\0';
- p[ac] = NULL;
- return ac;
-}
-
-static STATUS
-last_argument()
-{
- char **av;
- char *p;
- STATUS s;
- int ac;
-
- if (H.Size == 1 || (p = H.Lines[H.Size - 2]) == NULL)
- return ring_bell();
-
- if ((p = strdup(p)) == NULL)
- return CSstay;
- ac = argify(p, &av);
-
- if (Repeat != NO_ARG)
- s = Repeat < ac ? insert_string(av[Repeat]) : ring_bell();
- else
- s = ac ? insert_string(av[ac - 1]) : CSstay;
-
- if (ac)
- free(av);
- free(p);
- return s;
-}
-
-static KEYMAP Map[MAPSIZE] = {
- { CTL('@'), 1, ring_bell },
- { CTL('A'), 1, beg_line },
- { CTL('B'), 1, bk_char },
- { CTL('D'), 1, del_char },
- { CTL('E'), 1, end_line },
- { CTL('F'), 1, fd_char },
- { CTL('G'), 1, ring_bell },
- { CTL('H'), 1, bk_del_char },
- { CTL('I'), 1, c_complete },
- { CTL('J'), 1, accept_line },
- { CTL('K'), 1, kill_line },
- { CTL('L'), 1, redisplay },
- { CTL('M'), 1, accept_line },
- { CTL('N'), 1, h_next },
- { CTL('O'), 1, ring_bell },
- { CTL('P'), 1, h_prev },
- { CTL('Q'), 1, ring_bell },
- { CTL('R'), 1, h_search },
- { CTL('S'), 1, ring_bell },
- { CTL('T'), 1, transpose },
- { CTL('U'), 1, ring_bell },
- { CTL('V'), 1, quote },
- { CTL('W'), 1, wipe },
- { CTL('X'), 1, exchange },
- { CTL('Y'), 1, yank },
- { CTL('Z'), 1, ring_bell },
- { CTL('['), 1, meta },
- { CTL(']'), 1, move_to_char },
- { CTL('^'), 1, ring_bell },
- { CTL('_'), 1, ring_bell },
-};
-
-static KEYMAP MetaMap[16]= {
- { CTL('H'), 1, bk_kill_word },
- { CTL('['), 1, c_possible },
- { DEL, 1, bk_kill_word },
- { ' ', 1, mk_set },
- { '.', 1, last_argument },
- { '<', 1, h_first },
- { '>', 1, h_last },
- { '?', 1, c_possible },
- { 'b', 1, bk_word },
- { 'd', 1, fd_kill_word },
- { 'f', 1, fd_word },
- { 'l', 1, case_down_word },
- { 'm', 1, toggle_meta_mode},
- { 'u', 1, case_up_word },
- { 'y', 1, yank },
- { 'w', 1, copy_region },
-};
diff --git a/ndb/src/common/editline/editline_internal.h b/ndb/src/common/editline/editline_internal.h
deleted file mode 100644
index 5ed2b32a873..00000000000
--- a/ndb/src/common/editline/editline_internal.h
+++ /dev/null
@@ -1,46 +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 */
-
-/* $Revision: 1.2 $
-**
-** Internal header file for editline library.
-*/
-
-#include <ndb_global.h>
-
-#if defined(SYS_UNIX)
-#include "unix.h"
-#endif /* defined(SYS_UNIX) */
-
-#define MEM_INC 64
-#define SCREEN_INC 256
-
-/*
-** Variables and routines internal to this package.
-*/
-extern int rl_eof;
-extern int rl_erase;
-extern int rl_intr;
-extern int rl_kill;
-extern int rl_quit;
-#if defined(DO_SIGTSTP)
-extern int rl_susp;
-#endif /* defined(DO_SIGTSTP) */
-extern char *rl_complete();
-extern int rl_list_possib();
-extern void rl_ttyset();
-extern void rl_add_slash();
-
diff --git a/ndb/src/common/editline/sysunix.c b/ndb/src/common/editline/sysunix.c
deleted file mode 100644
index d7437f6a9c7..00000000000
--- a/ndb/src/common/editline/sysunix.c
+++ /dev/null
@@ -1,148 +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 */
-
-/* $Revision: 1.4 $
-**
-** Unix system-dependant routines for editline library.
-*/
-#include "editline_internal.h"
-
-#if defined(HAVE_TCGETATTR)
-#include <termios.h>
-
-void
-rl_ttyset(int Reset)
-{
- static struct termios old;
- struct termios new;
-
- if (Reset == 0) {
- if (tcgetattr(0, &old) < 0) perror("tcgetattr");
- rl_erase = old.c_cc[VERASE];
- rl_kill = old.c_cc[VKILL];
- rl_eof = old.c_cc[VEOF];
- rl_intr = old.c_cc[VINTR];
- rl_quit = old.c_cc[VQUIT];
-#if defined(DO_SIGTSTP)
- rl_susp = old.c_cc[VSUSP];
-#endif /* defined(DO_SIGTSTP) */
-
- new = old;
- new.c_lflag &= ~(ECHO | ICANON | ISIG);
- new.c_iflag &= ~(ISTRIP | INPCK);
- new.c_cc[VMIN] = 1;
- new.c_cc[VTIME] = 0;
- if (tcsetattr(0, TCSADRAIN, &new) < 0) perror("tcsetattr");
- }
- else
- (void)tcsetattr(0, TCSADRAIN, &old);
-}
-
-#else
-#if defined(HAVE_TERMIO)
-#include <termio.h>
-
-void
-rl_ttyset(int Reset)
-{
- static struct termio old;
- struct termio new;
-
- if (Reset == 0) {
- (void)ioctl(0, TCGETA, &old);
- rl_erase = old.c_cc[VERASE];
- rl_kill = old.c_cc[VKILL];
- rl_eof = old.c_cc[VEOF];
- rl_intr = old.c_cc[VINTR];
- rl_quit = old.c_cc[VQUIT];
-#if defined(DO_SIGTSTP)
- rl_susp = old.c_cc[VSUSP];
-#endif /* defined(DO_SIGTSTP) */
-
- new = old;
- new.c_lflag &= ~(ECHO | ICANON | ISIG);
- new.c_iflag &= ~(ISTRIP | INPCK);
- new.c_cc[VMIN] = 1;
- new.c_cc[VTIME] = 0;
- (void)ioctl(0, TCSETAW, &new);
- }
- else
- (void)ioctl(0, TCSETAW, &old);
-}
-
-#else
-#include <sgtty.h>
-
-void
-rl_ttyset(int Reset)
-{
- static struct sgttyb old_sgttyb;
- static struct tchars old_tchars;
- struct sgttyb new_sgttyb;
- struct tchars new_tchars;
-#if defined(DO_SIGTSTP)
- struct ltchars old_ltchars;
-#endif /* defined(DO_SIGTSTP) */
-
- if (Reset == 0) {
- (void)ioctl(0, TIOCGETP, &old_sgttyb);
- rl_erase = old_sgttyb.sg_erase;
- rl_kill = old_sgttyb.sg_kill;
-
- (void)ioctl(0, TIOCGETC, &old_tchars);
- rl_eof = old_tchars.t_eofc;
- rl_intr = old_tchars.t_intrc;
- rl_quit = old_tchars.t_quitc;
-
-#if defined(DO_SIGTSTP)
- (void)ioctl(0, TIOCGLTC, &old_ltchars);
- rl_susp = old_ltchars.t_suspc;
-#endif /* defined(DO_SIGTSTP) */
-
- new_sgttyb = old_sgttyb;
- new_sgttyb.sg_flags &= ~ECHO;
- new_sgttyb.sg_flags |= RAW;
-#if defined(PASS8)
- new_sgttyb.sg_flags |= PASS8;
-#endif /* defined(PASS8) */
- (void)ioctl(0, TIOCSETP, &new_sgttyb);
-
- new_tchars = old_tchars;
- new_tchars.t_intrc = -1;
- new_tchars.t_quitc = -1;
- (void)ioctl(0, TIOCSETC, &new_tchars);
- }
- else {
- (void)ioctl(0, TIOCSETP, &old_sgttyb);
- (void)ioctl(0, TIOCSETC, &old_tchars);
- }
-}
-#endif /* defined(HAVE_TERMIO) */
-#endif /* defined(HAVE_TCGETATTR) */
-
-void
-rl_add_slash(char *path, char *p, size_t p_len)
-{
- struct stat Sb;
-
- if (stat(path, &Sb) >= 0) {
- size_t len= strlen(p);
- if (len+1 < p_len) {
- p[len]= S_ISDIR(Sb.st_mode) ? '/' : ' ';
- p[len+1]= 0;
- }
- }
-}
diff --git a/ndb/src/common/editline/test/Makefile b/ndb/src/common/editline/test/Makefile
deleted file mode 100644
index 20229d0aa62..00000000000
--- a/ndb/src/common/editline/test/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-include .defs.mk
-
-TYPE := util
-
-BIN_TARGET := editline_test
-BIN_TARGET_ARCHIVES := editline
-
-SOURCES = testit.c
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/common/editline/test/testit.c b/ndb/src/common/editline/test/testit.c
deleted file mode 100644
index 4058f8ae660..00000000000
--- a/ndb/src/common/editline/test/testit.c
+++ /dev/null
@@ -1,55 +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 */
-
-/* -*- c-basic-offset: 4; -*-
-** $Revision: 1.5 $
-**
-** A "micro-shell" to test editline library.
-** If given any arguments, commands aren't executed.
-*/
-#include <ndb_global.h>
-#include <editline/editline.h>
-
-int
-main(int argc, char **argv)
-{
- char *prompt;
- char *p;
- int doit;
-
- (void)argv; /* Suppress warning */
-
- doit = argc == 1;
- if ((prompt = getenv("TESTPROMPT")) == NULL)
- prompt = "testit> ";
-
- while ((p = readline(prompt)) != NULL) {
- (void)printf("\t\t\t|%s|\n", p);
- if (doit) {
- if (strncmp(p, "cd ", 3) == 0) {
- if (chdir(&p[3]) < 0)
- perror(&p[3]);
- } else {
- if (system(p) != 0)
- perror(p);
- }
- }
- add_history(p);
- free(p);
- }
-
- return 0;
-}
diff --git a/ndb/src/common/logger/Makefile_old b/ndb/src/common/logger/Makefile_old
deleted file mode 100644
index 994eb86ba35..00000000000
--- a/ndb/src/common/logger/Makefile_old
+++ /dev/null
@@ -1,27 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapi
-
-PIC_ARCHIVE := Y
-ARCHIVE_TARGET := logger
-
-DIRS := loggertest
-
-SOURCES := Logger.cpp LogHandlerList.cpp LogHandler.cpp \
- ConsoleLogHandler.cpp FileLogHandler.cpp
-
-ifeq ($(NDB_OS), OSE)
-NO_SYSLOG := Y
-endif
-
-ifeq ($(NDB_OS), WIN32)
-NO_SYSLOG := Y
-endif
-
-ifneq ($(NO_SYSLOG), Y)
-SOURCES += SysLogHandler.cpp
-endif
-
-include $(NDB_TOP)/Epilogue.mk
-
-
diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp
index d8417ac146a..a1b979f62d8 100644
--- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp
+++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp
@@ -238,7 +238,8 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32
char buf[255];
ndb_mgm_configuration_iterator * it;
- it = ndb_mgm_create_configuration_iterator((struct ndb_mgm_configuration *)conf, CFG_SECTION_NODE);
+ it = ndb_mgm_create_configuration_iterator((struct ndb_mgm_configuration *)conf,
+ CFG_SECTION_NODE);
if(it == 0){
BaseString::snprintf(buf, 255, "Unable to create config iterator");
@@ -284,8 +285,14 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32
}
if(_type != m_node_type){
- BaseString::snprintf(buf, 255, "Supplied node type(%d) and config node type(%d) "
- " don't match", m_node_type, _type);
+ const char *type_s, *alias_s, *type_s2, *alias_s2;
+ alias_s= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type)m_node_type,
+ &type_s);
+ alias_s2= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type)_type,
+ &type_s2);
+ BaseString::snprintf(buf, 255, "This node type %s(%s) and config "
+ "node type %s(%s) don't match for nodeid %d",
+ alias_s, type_s, alias_s2, type_s2, nodeid);
setError(CR_ERROR, buf);
return false;
}
diff --git a/ndb/src/common/mgmcommon/Makefile.am b/ndb/src/common/mgmcommon/Makefile.am
index ed6a526eb47..a0aca3e68f1 100644
--- a/ndb/src/common/mgmcommon/Makefile.am
+++ b/ndb/src/common/mgmcommon/Makefile.am
@@ -1,14 +1,11 @@
noinst_LTLIBRARIES = libmgmsrvcommon.la
libmgmsrvcommon_la_SOURCES = \
- LocalConfig.cpp \
ConfigRetriever.cpp \
- IPCConfig.cpp NdbConfig.c
+ IPCConfig.cpp
INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi -I$(top_srcdir)/ndb/src/mgmsrv
-DEFS_LOC = -DNDB_BASE_PORT="\"@ndb_port_base@\""
-
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am
diff --git a/ndb/src/common/mgmcommon/Makefile_old b/ndb/src/common/mgmcommon/Makefile_old
deleted file mode 100644
index c7bfda7e3bf..00000000000
--- a/ndb/src/common/mgmcommon/Makefile_old
+++ /dev/null
@@ -1,29 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapi mgmapiclient
-
-PIC_ARCHIVE := Y
-ARCHIVE_TARGET := mgmsrvcommon
-
-# Removed temporary
-DIRS := printConfig
-
-SOURCES = \
- LocalConfig.cpp \
- Config.cpp \
- ConfigInfo.cpp \
- ConfigRetriever.cpp \
- InitConfigFileParser.cpp \
- IPCConfig.cpp
-
-SOURCES.c = NdbConfig.c
-
-CFLAGS_IPCConfig.cpp := -I$(call fixpath,$(NDB_TOP)/src/mgmapi)
-
-include $(NDB_TOP)/Epilogue.mk
-
-
-
-
-
-
diff --git a/ndb/src/common/portlib/Makefile.am b/ndb/src/common/portlib/Makefile.am
index 6f3a3fe01a9..73125ad918d 100644
--- a/ndb/src/common/portlib/Makefile.am
+++ b/ndb/src/common/portlib/Makefile.am
@@ -5,7 +5,8 @@ noinst_LTLIBRARIES = libportlib.la
libportlib_la_SOURCES = \
NdbCondition.c NdbMutex.c NdbSleep.c NdbTick.c \
NdbEnv.c NdbThread.c NdbHost.c NdbTCP.cpp \
- NdbDaemon.c NdbMem.c
+ NdbDaemon.c NdbMem.c \
+ NdbConfig.c
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_util.mk.am
diff --git a/ndb/src/common/portlib/Makefile_old b/ndb/src/common/portlib/Makefile_old
deleted file mode 100644
index 48f4929a839..00000000000
--- a/ndb/src/common/portlib/Makefile_old
+++ /dev/null
@@ -1,21 +0,0 @@
-include .defs.mk
-
-DIRS :=
-
-ifeq ($(NDB_OS), SOFTOSE)
-DIRS += ose
-else
-ifeq ($(NDB_OS), OSE)
-DIRS += ose
-else
-ifeq ($(NDB_OS), WIN32)
-DIRS += win32
-else
-DIRS += unix
-endif
-endif
-endif
-
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/src/common/mgmcommon/NdbConfig.c b/ndb/src/common/portlib/NdbConfig.c
index e92f8fa8392..8adc4c20dff 100644
--- a/ndb/src/common/mgmcommon/NdbConfig.c
+++ b/ndb/src/common/portlib/NdbConfig.c
@@ -74,7 +74,7 @@ NdbConfig_NdbCfgName(int with_ndb_home){
static
char *get_prefix_buf(int len, int node_id)
{
- char tmp_buf[sizeof("ndb_pid#########")+1];
+ char tmp_buf[sizeof("ndb_pid#############")+1];
char *buf;
if (node_id > 0)
snprintf(tmp_buf, sizeof(tmp_buf), "ndb_%u", node_id);
diff --git a/ndb/src/common/portlib/NdbDaemon.c b/ndb/src/common/portlib/NdbDaemon.c
index c73b5927ff4..3f1c1998501 100644
--- a/ndb/src/common/portlib/NdbDaemon.c
+++ b/ndb/src/common/portlib/NdbDaemon.c
@@ -55,18 +55,21 @@ NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags)
"%s: lseek failed: %s", lockfile, strerror(errno));
return -1;
}
+#ifdef F_TLOCK
/* Test for lock before becoming daemon */
- if (lockf(lockfd, F_TEST, 0) == -1) {
- if (errno == EACCES || errno == EAGAIN) { /* results may vary */
+ if (lockf(lockfd, F_TLOCK, 0) == -1)
+ {
+ if (errno == EACCES || errno == EAGAIN) { /* results may vary */
snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
- "%s: already locked by pid=%ld", lockfile, NdbDaemon_DaemonPid);
+ "%s: already locked by pid=%ld", lockfile, NdbDaemon_DaemonPid);
return -1;
}
NdbDaemon_ErrorCode = errno;
snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
- "%s: lock test failed: %s", lockfile, strerror(errno));
+ "%s: lock test failed: %s", lockfile, strerror(errno));
return -1;
}
+#endif
/* Test open log file before becoming daemon */
if (logfile != NULL) {
logfd = open(logfile, O_CREAT|O_WRONLY|O_APPEND, 0644);
@@ -77,6 +80,15 @@ NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags)
return -1;
}
}
+#ifdef F_TLOCK
+ if (lockf(lockfd, F_ULOCK, 0) == -1)
+ {
+ snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize,
+ "%s: fail to unlock", lockfile);
+ return -1;
+ }
+#endif
+
/* Fork */
n = fork();
if (n == -1) {
diff --git a/ndb/src/common/portlib/old_dirs/unix/Makefile_old b/ndb/src/common/portlib/old_dirs/unix/Makefile_old
deleted file mode 100644
index 452196d9f08..00000000000
--- a/ndb/src/common/portlib/old_dirs/unix/Makefile_old
+++ /dev/null
@@ -1,27 +0,0 @@
-include .defs.mk
-
-TYPE := util
-
-PIC_ARCHIVE := Y
-ARCHIVE_TARGET := portlib
-
-SOURCES.c = NdbCondition.c \
- NdbMutex.c \
- NdbSleep.c \
- NdbTick.c \
- NdbEnv.c \
- NdbThread.c \
- NdbHost.c \
- NdbTCP.c \
- NdbDaemon.c
-
-ifeq ($(NDB_OS), SOFTOSE)
- SOURCES += NdbMem_SoftOse.cpp
-else
- SOURCES.c += NdbMem.c
-endif
-
-include $(NDB_TOP)/Epilogue.mk
-
-testNdbDaemon: NdbDaemon.c
- $(CC) -o $@ NdbDaemon.c $(CCFLAGS) -DNDB_DAEMON_TEST -L$(NDB_TOP)/lib
diff --git a/ndb/src/common/transporter/Makefile_old b/ndb/src/common/transporter/Makefile_old
deleted file mode 100644
index 372bf640566..00000000000
--- a/ndb/src/common/transporter/Makefile_old
+++ /dev/null
@@ -1,43 +0,0 @@
-include .defs.mk
-
-TYPE := util
-
-PIC_ARCHIVE := Y
-ARCHIVE_TARGET := transporter
-DIRS := basictest perftest
-
-# Source files of non-templated classes (.cpp files)
-SOURCES = \
- Transporter.cpp \
- SendBuffer.cpp \
- TCP_Transporter.cpp \
- TransporterRegistry.cpp \
- Packer.cpp
-
-DIRS := basictest perftest
-
-CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/kernel) \
- -I$(call fixpath,$(NDB_TOP)/include/transporter)
-
-
-ifeq ($(NDB_SHM), Y)
-SOURCES += SHM_Transporter.cpp
-ifeq ($(NDB_OS), WIN32)
-SOURCES += SHM_Transporter.win32.cpp
-else
-SOURCES += SHM_Transporter.unix.cpp
-endif
-endif
-
-ifeq ($(NDB_SCI), Y)
-SOURCES += SCI_Transporter.cpp
-endif
-
-ifneq ($(findstring OSE, $(NDB_OS)),)
- SOURCES += OSE_Transporter.cpp
- SOURCES += OSE_Receiver.cpp
-endif
-
-
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp
index cacbbed00f1..a2fab8f9806 100644
--- a/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -467,8 +467,9 @@ TransporterRegistry::prepareSend(const SignalHeader * const signalHeader,
Transporter *t = theTransporters[nodeId];
if(t != NULL &&
(((ioStates[nodeId] != HaltOutput) && (ioStates[nodeId] != HaltIO)) ||
- (signalHeader->theReceiversBlockNumber == 252))) {
-
+ ((signalHeader->theReceiversBlockNumber == 252) ||
+ (signalHeader->theReceiversBlockNumber == 4002)))) {
+
if(t->isConnected()){
Uint32 lenBytes = t->m_packer.getMessageLength(signalHeader, ptr);
if(lenBytes <= MAX_MESSAGE_SIZE){
@@ -538,8 +539,9 @@ TransporterRegistry::prepareSend(const SignalHeader * const signalHeader,
Transporter *t = theTransporters[nodeId];
if(t != NULL &&
(((ioStates[nodeId] != HaltOutput) && (ioStates[nodeId] != HaltIO)) ||
- (signalHeader->theReceiversBlockNumber == 252))) {
-
+ ((signalHeader->theReceiversBlockNumber == 252)||
+ (signalHeader->theReceiversBlockNumber == 4002)))) {
+
if(t->isConnected()){
Uint32 lenBytes = t->m_packer.getMessageLength(signalHeader, ptr);
if(lenBytes <= MAX_MESSAGE_SIZE){
@@ -550,7 +552,7 @@ TransporterRegistry::prepareSend(const SignalHeader * const signalHeader,
return SEND_OK;
}
-
+
/**
* @note: on linux/i386 the granularity is 10ms
* so sleepTime = 2 generates a 10 ms sleep.
diff --git a/ndb/src/common/util/Makefile_old b/ndb/src/common/util/Makefile_old
deleted file mode 100644
index 65093396246..00000000000
--- a/ndb/src/common/util/Makefile_old
+++ /dev/null
@@ -1,28 +0,0 @@
-include .defs.mk
-
-TYPE := util
-
-PIC_ARCHIVE := Y
-ARCHIVE_TARGET := general
-
-SOURCES = File.cpp md5_hash.cpp Properties.cpp socket_io.cpp \
- SimpleProperties.cpp Parser.cpp InputStream.cpp SocketServer.cpp \
- OutputStream.cpp NdbOut.cpp BaseString.cpp Base64.cpp \
- NdbSqlUtil.cpp ConfigValues.cpp new.cpp
-
-SOURCES.c = uucode.c random.c getarg.c version.c
-
-ifeq ($(NDB_OS), OSE)
- SOURCES += NdbErrHnd.cpp
-endif
-ifeq ($(NDB_OS), OSE)
- SOURCES += NdbErrHnd.cpp
-endif
- SOURCES.c += strdup.c strlcat.c strlcpy.c
-
-DIRS := testSimpleProperties testProperties testConfigValues
-
-include $(NDB_TOP)/Epilogue.mk
-
-testNdbSqlUtil: NdbSqlUtil.cpp
- $(CC) -o $@ NdbSqlUtil.cpp $(CCFLAGS) -DNDB_SQL_UTIL_TEST -L$(NDB_TOP)/lib -lportlib -lgeneral
diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp
index 6e4e5919e43..5b2381df50a 100644
--- a/ndb/src/common/util/NdbSqlUtil.cpp
+++ b/ndb/src/common/util/NdbSqlUtil.cpp
@@ -582,7 +582,7 @@ NdbSqlUtil::usable_in_pk(Uint32 typeId, const void* info)
cs->cset != 0 &&
cs->coll != 0 &&
cs->coll->strnxfrm != 0 &&
- cs->strxfrm_multiply == 1; // current limitation
+ cs->strxfrm_multiply <= 1; // current limitation
}
break;
case Type::Varchar:
@@ -618,7 +618,7 @@ NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info)
cs->coll != 0 &&
cs->coll->strnxfrm != 0 &&
cs->coll->strnncollsp != 0 &&
- cs->strxfrm_multiply == 1; // current limitation
+ cs->strxfrm_multiply <= 1; // current limitation
}
break;
case Type::Varchar:
@@ -633,7 +633,7 @@ NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info)
cs->coll != 0 &&
cs->coll->strnxfrm != 0 &&
cs->coll->strnncollsp != 0 &&
- cs->strxfrm_multiply == 1; // current limitation
+ cs->strxfrm_multiply <= 1; // current limitation
}
break;
default:
diff --git a/ndb/src/common/util/SocketServer.cpp b/ndb/src/common/util/SocketServer.cpp
index c3cffa1399b..8bee256684d 100644
--- a/ndb/src/common/util/SocketServer.cpp
+++ b/ndb/src/common/util/SocketServer.cpp
@@ -259,6 +259,15 @@ transfer(NDB_SOCKET_TYPE sock){
}
void
+SocketServer::foreachSession(void (*func)(SocketServer::Session*, void *), void *data)
+{
+ for(int i = m_sessions.size() - 1; i >= 0; i--){
+ (*func)(m_sessions[i].m_session, data);
+ }
+ checkSessions();
+}
+
+void
SocketServer::checkSessions(){
for(int i = m_sessions.size() - 1; i >= 0; i--){
if(m_sessions[i].m_session->m_stopped){
@@ -278,8 +287,10 @@ void
SocketServer::stopSessions(bool wait){
int i;
for(i = m_sessions.size() - 1; i>=0; i--)
- m_sessions[i].m_session->m_stop = true;
-
+ {
+ m_sessions[i].m_session->stopSession();
+ m_sessions[i].m_session->m_stop = true; // to make sure
+ }
for(i = m_services.size() - 1; i>=0; i--)
m_services[i].m_service->stopSessions();
diff --git a/ndb/src/common/util/basestring_vsnprintf.c b/ndb/src/common/util/basestring_vsnprintf.c
index 7307279f345..8a58ca0fe5c 100644
--- a/ndb/src/common/util/basestring_vsnprintf.c
+++ b/ndb/src/common/util/basestring_vsnprintf.c
@@ -20,6 +20,10 @@
#include <basestring_vsnprintf.h>
#include <my_config.h>
+
+/*
+ #define SNPRINTF_RETURN_TRUNC
+*/
int
basestring_snprintf(char *str, size_t size, const char *format, ...)
{
@@ -40,7 +44,6 @@ basestring_snprintf(char *str, size_t size, const char *format, ...)
* Let's hope vsnprintf works anyways
*/
#define BASESTRING_VSNPRINTF_FUNC(a,b,c,d) vsnprintf(a,b,c,d)
- extern int my_vsnprintf(char *str, size_t size, const char *format, va_list ap);
#endif
#ifdef SNPRINTF_RETURN_TRUNC
static char basestring_vsnprintf_buf[16*1024];
@@ -48,13 +51,27 @@ static char basestring_vsnprintf_buf[16*1024];
int
basestring_vsnprintf(char *str, size_t size, const char *format, va_list ap)
{
- int ret= BASESTRING_VSNPRINTF_FUNC(str, size, format, ap);
+ if (size == 0)
+ {
#ifdef SNPRINTF_RETURN_TRUNC
- if (ret == size-1 || ret == -1) {
- ret= BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf,
- sizeof(basestring_vsnprintf_buf),
- format, ap);
+ return BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf,
+ sizeof(basestring_vsnprintf_buf),
+ format, ap);
+#else
+ char buf[1];
+ return BASESTRING_VSNPRINTF_FUNC(buf, 1, format, ap);
+#endif
}
+ {
+ int ret= BASESTRING_VSNPRINTF_FUNC(str, size, format, ap);
+#ifdef SNPRINTF_RETURN_TRUNC
+ if (ret == size-1 || ret == -1)
+ {
+ ret= BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf,
+ sizeof(basestring_vsnprintf_buf),
+ format, ap);
+ }
#endif
- return ret;
+ return ret;
+ }
}
diff --git a/ndb/src/common/util/getarg.3 b/ndb/src/common/util/getarg.3
deleted file mode 100644
index 43aae5d7b31..00000000000
--- a/ndb/src/common/util/getarg.3
+++ /dev/null
@@ -1,315 +0,0 @@
-.\" Copyright (c) 1999 Kungliga Tekniska Högskolan
-.\" $KTH: getarg.3,v 1.1.4.1 2001/07/26 19:54:45 lha Exp $
-.Dd September 24, 1999
-.Dt GETARG 3
-.Os ROKEN
-.Sh NAME
-.Nm getarg ,
-.Nm arg_printusage
-.Nd collect command line options
-.Sh SYNOPSIS
-.Fd #include <getarg.h>
-
-.Ft int
-.Fn getarg "struct getargs *args" "size_t num_args" "int argc" "char **argv" "int *optind"
-
-.Ft void
-.Fn arg_printusage "struct getargs *args" "size_t num_args" "const char *progname" "const char *extra_string"
-
-.Sh DESCRIPTION
-.Fn getarg
-collects any command line options given to a program in an easily used way.
-.Fn arg_printusage
-pretty-prints the available options, with a short help text.
-.Pp
-.Fa args
-is the option specification to use, and it's an array of
-.Fa struct getargs
-elements.
-.Fa num_args
-is the size of
-.Fa args
-(in elements).
-.Fa argc
-and
-.Fa argv
-are the argument count and argument vector to extract option from.
-.Fa optind
-is a pointer to an integer where the index to the last processed
-argument is stored, it must be initialised to the first index (minus
-one) to process (normally 0) before the first call.
-.Pp
-.Fa arg_printusage
-take the same
-.Fa args
-and
-.Fa num_args
-as getarg;
-.Fa progname is the name of the program (to be used in the help text), and
-.Fa extra_string
-is a string to print after the actual options to indicate more
-arguments. The usefulness of this function is realised only be people
-who has used programs that has help strings that doesn't match what
-the code does.
-.Pp
-The
-.Fa getargs
-struct has the following elements.
-
-.Bd -literal
-struct getargs{
- const char *long_name;
- char short_name;
- enum { arg_integer,
- arg_string,
- arg_flag,
- arg_negative_flag,
- arg_strings,
- arg_double,
- arg_collect
- } type;
- void *value;
- const char *help;
- const char *arg_help;
-};
-.Ed
-.Pp
-.Fa long_name
-is the long name of the option, it can be
-.Dv NULL ,
-if you don't want a long name.
-.Fa short_name
-is the characted to use as short option, it can be zero. If the option
-has a value the
-.Fa value
-field gets filled in with that value interpreted as specified by the
-.Fa type
-field.
-.Fa help
-is a longer help string for the option as a whole, if it's
-.Dv NULL
-the help text for the option is omitted (but it's still displayed in
-the synopsis).
-.Fa arg_help
-is a description of the argument, if
-.Dv NULL
-a default value will be used, depending on the type of the option:
-.Pp
-.Bl -hang -width arg_negative_flag
-.It arg_integer
-the argument is a signed integer, and
-.Fa value
-should point to an
-.Fa int .
-.It Fa arg_string
-the argument is a string, and
-.Fa value
-should point to a
-.Fa char* .
-.It Fa arg_flag
-the argument is a flag, and
-.Fa value
-should point to a
-.Fa int .
-It gets filled in with either zero or one, depending on how the option
-is given, the normal case beeing one. Note that if the option isn't
-given, the value isn't altered, so it should be initialised to some
-useful default.
-.It Fa arg_negative_flag
-this is the same as
-.Fa arg_flag
-but it reverses the meaning of the flag (a given short option clears
-the flag), and the synopsis of a long option is negated.
-.It Fa arg_strings
-the argument can be given multiple times, and the values are collected
-in an array;
-.Fa value
-should be a pointer to a
-.Fa struct getarg_strings
-structure, which holds a length and a string pointer.
-.It Fa arg_double
-argument is a double precision floating point value, and
-.Fa value
-should point to a
-.Fa double .
-.It Fa arg_collect
-allows more fine-grained control of the option parsing process.
-.Fa value
-should be a pointer to a
-.Fa getarg_collect_info
-structure:
-.Bd -literal
-typedef int (*getarg_collect_func)(int short_opt,
- int argc,
- char **argv,
- int *optind,
- int *optarg,
- void *data);
-
-typedef struct getarg_collect_info {
- getarg_collect_func func;
- void *data;
-} getarg_collect_info;
-.Ed
-.Pp
-With the
-.Fa func
-member set to a function to call, and
-.Fa data
-to some application specific data. The parameters to the collect function are:
-.Bl -inset
-.It Fa short_flag
-non-zero if this call is via a short option flag, zero otherwise
-.It Fa argc , argv
-the whole argument list
-.It Fa optind
-pointer to the index in argv where the flag is
-.It Fa optarg
-pointer to the index in argv[*optind] where the flag name starts
-.It Fa data
-application specific data
-.El
-.Pp
-You can modify
-.Fa *optind ,
-and
-.Fa *optarg ,
-but to do this correct you (more or less) have to know about the inner
-workings of getarg.
-
-You can skip parts of arguments by increasing
-.Fa *optarg
-(you could
-implement the
-.Fl z Ns Ar 3
-set of flags from
-.Nm gzip
-with this), or whole argument strings by increasing
-.Fa *optind
-(let's say you want a flag
-.Fl c Ar x y z
-to specify a coordinate); if you also have to set
-.Fa *optarg
-to a sane value.
-.Pp
-The collect function should return one of
-.Dv ARG_ERR_NO_MATCH , ARG_ERR_BAD_ARG , ARG_ERR_NO_ARG
-on error, zero otherwise.
-.Pp
-For your convenience there is a function,
-.Fn getarg_optarg ,
-that returns the traditional argument string, and you pass it all
-arguments, sans data, that where given to the collection function.
-.Pp
-Don't use this more this unless you absolutely have to.
-.El
-.Pp
-Option parsing is similar to what
-.Xr getopt
-uses. Short options without arguments can be compressed
-.Pf ( Fl xyz
-is the same as
-.Fl x y z ) ,
-and short
-options with arguments take these as either the rest of the
-argv-string or as the next option
-.Pf ( Fl o Ns Ar foo ,
-or
-.Fl o Ar foo ) .
-.Pp
-Long option names are prefixed with -- (double dash), and the value
-with a = (equal),
-.Fl -foo= Ns Ar bar .
-Long option flags can either be specified as they are
-.Pf ( Fl -help ) ,
-or with an (boolean parsable) option
-.Pf ( Fl -help= Ns Ar yes ,
-.Fl -help= Ns Ar true ,
-or similar), or they can also be negated
-.Pf ( Fl -no-help
-is the same as
-.Fl -help= Ns no ) ,
-and if you're really confused you can do it multiple times
-.Pf ( Fl -no-no-help= Ns Ar false ,
-or even
-.Fl -no-no-help= Ns Ar maybe ) .
-.Sh EXAMPLE
-.Bd -literal
-#include <stdio.h>
-#include <string.h>
-#include <getarg.h>
-
-char *source = "Ouagadougou";
-char *destination;
-int weight;
-int include_catalog = 1;
-int help_flag;
-
-struct getargs args[] = {
- { "source", 's', arg_string, &source,
- "source of shippment", "city" },
- { "destination", 'd', arg_string, &destination,
- "destination of shippment", "city" },
- { "weight", 'w', arg_integer, &weight,
- "weight of shippment", "tons" },
- { "catalog", 'c', arg_negative_flag, &include_catalog,
- "include product catalog" },
- { "help", 'h', arg_flag, &help_flag }
-};
-
-int num_args = sizeof(args) / sizeof(args[0]); /* number of elements in args */
-
-const char *progname = "ship++";
-
-int
-main(int argc, char **argv)
-{
- int optind = 0;
- if (getarg(args, num_args, argc, argv, &optind)) {
- arg_printusage(args, num_args, progname, "stuff...");
- exit (1);
- }
- if (help_flag) {
- arg_printusage(args, num_args, progname, "stuff...");
- exit (0);
- }
- if (destination == NULL) {
- fprintf(stderr, "%s: must specify destination\n", progname);
- exit(1);
- }
- if (strcmp(source, destination) == 0) {
- fprintf(stderr, "%s: destination must be different from source\n");
- exit(1);
- }
- /* include more stuff here ... */
- exit(2);
-}
-.Ed
-.Pp
-The output help output from this program looks like this:
-.Bd -literal
-$ ship++ --help
-Usage: ship++ [--source=city] [-s city] [--destination=city] [-d city]
- [--weight=tons] [-w tons] [--no-catalog] [-c] [--help] [-h] stuff...
--s city, --source=city source of shippment
--d city, --destination=city destination of shippment
--w tons, --weight=tons weight of shippment
--c, --no-catalog include product catalog
-.Ed
-
-.Sh BUGS
-It should be more flexible, so it would be possible to use other more
-complicated option syntaxes, such as what
-.Xr ps 1 ,
-and
-.Xr tar 1 ,
-uses, or the AFS model where you can skip the flag names as long as
-the options come in the correct order.
-.Pp
-Options with multiple arguments should be handled better.
-.Pp
-Should be integreated with SL.
-.Pp
-It's very confusing that the struct you pass in is called getargS.
-.Sh SEE ALSO
-.Xr getopt 3
diff --git a/ndb/src/common/util/getarg.3.ps b/ndb/src/common/util/getarg.3.ps
deleted file mode 100644
index 146fb8e4961..00000000000
--- a/ndb/src/common/util/getarg.3.ps
+++ /dev/null
@@ -1,458 +0,0 @@
-%!PS-Adobe-3.0
-%%Creator: groff version 1.15
-%%CreationDate: Thu Nov 7 12:53:13 2002
-%%DocumentNeededResources: font Times-Roman
-%%+ font Times-Bold
-%%+ font Courier-Bold
-%%+ font Courier-Oblique
-%%+ font Symbol
-%%+ font Courier
-%%DocumentSuppliedResources: procset grops 1.15 0
-%%Pages: 4
-%%PageOrder: Ascend
-%%Orientation: Portrait
-%%EndComments
-%%BeginProlog
-%%BeginResource: procset grops 1.15 0
-/setpacking where{
-pop
-currentpacking
-true setpacking
-}if
-/grops 120 dict dup begin
-/SC 32 def
-/A/show load def
-/B{0 SC 3 -1 roll widthshow}bind def
-/C{0 exch ashow}bind def
-/D{0 exch 0 SC 5 2 roll awidthshow}bind def
-/E{0 rmoveto show}bind def
-/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
-/G{0 rmoveto 0 exch ashow}bind def
-/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/I{0 exch rmoveto show}bind def
-/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
-/K{0 exch rmoveto 0 exch ashow}bind def
-/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/M{rmoveto show}bind def
-/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
-/O{rmoveto 0 exch ashow}bind def
-/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/Q{moveto show}bind def
-/R{moveto 0 SC 3 -1 roll widthshow}bind def
-/S{moveto 0 exch ashow}bind def
-/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/SF{
-findfont exch
-[exch dup 0 exch 0 exch neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/MF{
-findfont
-[5 2 roll
-0 3 1 roll
-neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/level0 0 def
-/RES 0 def
-/PL 0 def
-/LS 0 def
-/MANUAL{
-statusdict begin/manualfeed true store end
-}bind def
-/PLG{
-gsave newpath clippath pathbbox grestore
-exch pop add exch pop
-}bind def
-/BP{
-/level0 save def
-1 setlinecap
-1 setlinejoin
-72 RES div dup scale
-LS{
-90 rotate
-}{
-0 PL translate
-}ifelse
-1 -1 scale
-}bind def
-/EP{
-level0 restore
-showpage
-}bind def
-/DA{
-newpath arcn stroke
-}bind def
-/SN{
-transform
-.25 sub exch .25 sub exch
-round .25 add exch round .25 add exch
-itransform
-}bind def
-/DL{
-SN
-moveto
-SN
-lineto stroke
-}bind def
-/DC{
-newpath 0 360 arc closepath
-}bind def
-/TM matrix def
-/DE{
-TM currentmatrix pop
-translate scale newpath 0 0 .5 0 360 arc closepath
-TM setmatrix
-}bind def
-/RC/rcurveto load def
-/RL/rlineto load def
-/ST/stroke load def
-/MT/moveto load def
-/CL/closepath load def
-/FL{
-currentgray exch setgray fill setgray
-}bind def
-/BL/fill load def
-/LW/setlinewidth load def
-/RE{
-findfont
-dup maxlength 1 index/FontName known not{1 add}if dict begin
-{
-1 index/FID ne{def}{pop pop}ifelse
-}forall
-/Encoding exch def
-dup/FontName exch def
-currentdict end definefont pop
-}bind def
-/DEFS 0 def
-/EBEGIN{
-moveto
-DEFS begin
-}bind def
-/EEND/end load def
-/CNT 0 def
-/level1 0 def
-/PBEGIN{
-/level1 save def
-translate
-div 3 1 roll div exch scale
-neg exch neg exch translate
-0 setgray
-0 setlinecap
-1 setlinewidth
-0 setlinejoin
-10 setmiterlimit
-[]0 setdash
-/setstrokeadjust where{
-pop
-false setstrokeadjust
-}if
-/setoverprint where{
-pop
-false setoverprint
-}if
-newpath
-/CNT countdictstack def
-userdict begin
-/showpage{}def
-}bind def
-/PEND{
-clear
-countdictstack CNT sub{end}repeat
-level1 restore
-}bind def
-end def
-/setpacking where{
-pop
-setpacking
-}if
-%%EndResource
-%%IncludeResource: font Times-Roman
-%%IncludeResource: font Times-Bold
-%%IncludeResource: font Courier-Bold
-%%IncludeResource: font Courier-Oblique
-%%IncludeResource: font Symbol
-%%IncludeResource: font Courier
-grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
-def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron
-/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
-/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
-/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
-/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
-/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
-/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
-/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
-/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
-/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
-/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
-/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
-/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
-/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
-/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
-/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
-/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
-/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
-/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
-/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
-/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
-/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
-/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
-/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
-/Courier@0 ENC0/Courier RE/Courier-Oblique@0 ENC0/Courier-Oblique RE
-/Courier-Bold@0 ENC0/Courier-Bold RE/Times-Bold@0 ENC0/Times-Bold RE
-/Times-Roman@0 ENC0/Times-Roman RE
-%%EndProlog
-%%Page: 1 1
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F
-(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F
--.834(ARG \( 3 \))-.93 F/F1 10/Times-Bold@0 SF -.2(NA)72 108 S(ME).2 E
-/F2 10/Courier-Bold@0 SF(getarg)102 120 Q F0(,)A F2(arg_printusage)2.5 E
-F0 2.5<ad63>2.5 G(ollect command line options)-2.5 E F1(SYNOPSIS)72 144
-Q F2(#include <getarg.h>)102 156 Q/F3 10/Courier-Oblique@0 SF(int)102
-186 Q F2(getarg)102 198 Q F0(\()A F3(struct getargs)A/F4 10/Symbol SF(*)
-6 E F3(args)A F0(,)1.666 E F3(size_t num_args)4.166 E F0(,)1.666 E F3
-(int argc)4.166 E F0(,)1.666 E F3(char)4.166 E F4(**)6 E F3(argv)A F0(,)
-1.666 E F3(int)151.666 210 Q F4(*)6 E F3(optind)A F0(\);)A F3(void)102
-240 Q F2(arg_printusage)102 252 Q F0(\()A F3(struct getargs)A F4(*)6 E
-F3(args)A F0(,)1.666 E F3(size_t num_args)4.166 E F0(,)1.666 E F3
-(const char)4.166 E F4(*)6 E F3(progname)A F0(,)1.666 E F3(const char)
-151.666 264 Q F4(*)6 E F3(extra_string)A F0(\);)A F1(DESCRIPTION)72 300
-Q F2(getarg)102 312 Q F0 2.721 1.666(\(\) c)D 6.053(ollects an)-1.666 F
-8.553(yc)-.15 G 6.053(ommand line options gi)-8.553 F -.15(ve)-.25 G
-8.552(nt).15 G 8.552(oap)-8.552 G 6.052(rogram in an easily used w)
--8.552 F(ay)-.1 E(.)-.65 E F2(arg_printusage)102 324 Q F0 -3.332 1.666
-(\(\) p)D(retty-prints the a)-1.666 E -.25(va)-.2 G
-(ilable options, with a short help te).25 E(xt.)-.15 E F3(args)102 342 Q
-F0 .855(is the option speci\214cation to use, and it')3.355 F 3.356(sa)
--.55 G 3.356(na)-3.356 G .856(rray of)-3.356 F F3 .856(struct getargs)
-3.356 F F0(elements.)3.356 E F3(num_args)5.856 E F0(is)3.356 E .344
-(the size of)102 354 R F3(args)2.844 E F0 .344(\(in elements\).)2.844 F
-F3(argc)5.344 E F0(and)2.844 E F3(argv)2.844 E F0 .344(are the ar)2.844
-F .344(gument count and ar)-.18 F .344(gument v)-.18 F .344(ector to e)
--.15 F .343(xtract op-)-.15 F 1.127(tion from.)102 366 R F3(optind)6.127
-E F0 1.127(is a pointer to an inte)3.627 F 1.127(ger where the inde)-.15
-F 3.627(xt)-.15 G 3.628(ot)-3.627 G 1.128(he last processed ar)-3.628 F
-1.128(gument is stored, it)-.18 F
-(must be initialised to the \214rst inde)102 378 Q 2.5(x\()-.15 G
-(minus one\) to process \(normally 0\) before the \214rst call.)-2.5 E
-F3(arg_printusage)102 396 Q F0(tak)4.178 E 4.178(et)-.1 G 1.678(he same)
--4.178 F F3(args)4.178 E F0(and)4.178 E F3(num_args)4.178 E F0 1.678
-(as getar)4.178 F(g;)-.18 E F3 1.677(progname is the name of)4.178 F
-6.381(the program \(to be)102 408 R F0(progname0)12.381 E F3(0)12.381 E
-F0(progname1)A F3(1)12.381 E F0(progname2)A F3(2)12.382 E F0(progname3)A
-F3(3)12.382 E F0(progname4)A F3(4)102 420 Q F0(progname5)A F3
-(extra_string)3.404 E F0 .904
-(is a string to print after the actual options to indicate more ar)3.404
-F .904(guments. The)-.18 F .025(usefulness of this function is realised\
- only be people who has used programs that has help strings that doesn')
-102 432 R(t)-.18 E(match what the code does.)102 444 Q(The)102 462 Q F3
-(getargs)2.5 E F0(struct has the follo)2.5 E(wing elements.)-.25 E/F5 10
-/Courier@0 SF(struct getargs{)102 504 Q(const char)126 516 Q F4(*)6 E F5
-(long_name;)A(char short_name;)126 528 Q(enum { arg_integer,)126 540 Q
-(arg_string,)165 552 Q(arg_flag,)165 564 Q(arg_negative_flag,)165 576 Q
-(arg_strings,)165 588 Q(arg_double,)165 600 Q(arg_collect)168 612 Q 6
-(}t)126 624 S(ype;)-6 E(void)126 636 Q F4(*)6 E F5(value;)A(const char)
-126 648 Q F4(*)6 E F5(help;)A(const char)126 660 Q F4(*)6 E F5
-(arg_help;)A(};)102 672 Q F3(long_name)102 690 Q F0 .207
-(is the long name of the option, it can be)2.707 F F5(NULL)2.706 E F0
-2.706(,i)C 2.706(fy)-2.706 G .206(ou don')-2.706 F 2.706(tw)-.18 G .206
-(ant a long name.)-2.806 F F3(short_name)5.206 E F0 .397(is the charact\
-ed to use as short option, it can be zero. If the option has a v)102 702
-R .398(alue the)-.25 F F3(value)2.898 E F0 .398
-(\214eld gets \214lled in)2.898 F -.4(RO)77 750 S 152.325(KEN September)
-.4 F(24, 1999)2.5 E(1)188.865 E EP
-%%Page: 2 2
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F
-(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F
--.834(ARG \( 3 \))-.93 F .737(with that v)102 96 R .737
-(alue interpreted as speci\214ed by the)-.25 F/F1 10/Courier-Oblique@0
-SF(type)3.237 E F0(\214eld.)3.237 E F1(help)5.737 E F0 .737
-(is a longer help string for the option as a)3.237 F 2.833
-(whole, if it')102 108 R(s)-.55 E/F2 10/Courier@0 SF(NULL)5.333 E F0
-2.833(the help te)5.333 F 2.833(xt for the option is omitted \(b)-.15 F
-2.834(ut it')-.2 F 5.334(ss)-.55 G 2.834
-(till displayed in the synopsis\).)-5.334 F F1(arg_help)102 120 Q F0
-.391(is a description of the ar)2.891 F .391(gument, if)-.18 F F2(NULL)
-2.891 E F0 2.891(ad)2.891 G(ef)-2.891 E .39(ault v)-.1 F .39
-(alue will be used, depending on the type of)-.25 F(the option:)102 132
-Q(ar)102 150 Q(g_inte)-.18 E 59.29(ger the)-.15 F(ar)2.5 E
-(gument is a signed inte)-.18 E(ger)-.15 E 2.5(,a)-.4 G(nd)-2.5 E F1
-(value)2.5 E F0(should point to an)2.5 E F1(int)2.5 E F0(.)A F1
-(arg_string)102 168 Q F0(the ar)47 E(gument is a string, and)-.18 E F1
-(value)2.5 E F0(should point to a)2.5 E F1(char)2.5 E/F3 10/Symbol SF(*)
-A F0(.)A F1(arg_flag)102 186 Q F0 .4(the ar)59 F .4
-(gument is a \215ag, and)-.18 F F1(value)2.9 E F0 .4(should point to a)
-2.9 F F1(int)2.9 E F0 2.9(.I)C 2.9(tg)-2.9 G .4
-(ets \214lled in with ei-)-2.9 F 1.154
-(ther zero or one, depending on ho)209 198 R 3.654(wt)-.25 G 1.153
-(he option is gi)-3.654 F -.15(ve)-.25 G 1.153
-(n, the normal case beeing).15 F .526(one. Note that if the option isn')
-209 210 R 3.026(tg)-.18 G -2.15 -.25(iv e)-3.026 H .526(n, the v).25 F
-.526(alue isn')-.25 F 3.026(ta)-.18 G .527(ltered, so it should be ini-)
--3.026 F(tialised to some useful def)209 222 Q(ault.)-.1 E F1
-(arg_negative_flag)102 240 Q F0 .058(this is the same as)2.558 F F1
-(arg_flag)2.558 E F0 -.2(bu)2.558 G 2.558(ti).2 G 2.558(tr)-2.558 G
--2.15 -.25(ev e)-2.558 H .057(rses the meaning of the \215ag \(a gi).25
-F -.15(ve)-.25 G 2.557(ns).15 G(hort)-2.557 E
-(option clears the \215ag\), and the synopsis of a long option is ne)209
-252 Q -.05(ga)-.15 G(ted.).05 E F1(arg_strings)102 270 Q F0 .195(the ar)
-41 F .195(gument can be gi)-.18 F -.15(ve)-.25 G 2.695(nm).15 G .195
-(ultiple times, and the v)-2.695 F .195
-(alues are collected in an array;)-.25 F F1(value)209 282 Q F0 .947
-(should be a pointer to a)3.447 F F1 .947(struct getarg_strings)3.447 F
-F0 .947(structure, which)3.447 F(holds a length and a string pointer)209
-294 Q(.)-.55 E F1(arg_double)102 312 Q F0(ar)47 E .538
-(gument is a double precision \215oating point v)-.18 F .539(alue, and)
--.25 F F1(value)3.039 E F0 .539(should point to a)3.039 F F1(double)209
-324 Q F0(.)A F1(arg_collect)102 342 Q F0(allo)41 E .345
-(ws more \214ne-grained control of the option parsing process.)-.25 F F1
-(value)5.344 E F0 .344(should be)2.844 F 2.5(ap)209 354 S(ointer to a)
--2.5 E F1(getarg_collect_info)2.5 E F0(structure:)2.5 E F2
-(typedef int \()209 372 Q F3(*)A F2
-(getarg_collect_func\)\(int short_opt,)A(int argc,)407 384 Q(char)407
-396 Q F3(**)6 E F2(argv,)A(int)407 408 Q F3(*)6 E F2(optind,)A(int)407
-420 Q F3(*)6 E F2(optarg,)A(void)407 432 Q F3(*)6 E F2(data\);)A
-(typedef struct getarg_collect_info {)209 456 Q
-(getarg_collect_func func;)233 468 Q(void)233 480 Q F3(*)6 E F2(data;)A
-6(}g)209 492 S(etarg_collect_info;)-6 E F0 -.4(Wi)209 510 S 1.018
-(th the).4 F F1(func)3.518 E F0 1.019
-(member set to a function to call, and)3.518 F F1(data)3.519 E F0 1.019
-(to some application)3.519 F
-(speci\214c data. The parameters to the collect function are:)209 522 Q
-F1(short_flag)209 540 Q F0
-(non-zero if this call is via a short option \215ag, zero otherwise)2.5
-E F1(argc)209 558 Q F0(,)A F1(argv)6 E F0(the whole ar)2.5 E
-(gument list)-.18 E F1(optind)209 576 Q F0(pointer to the inde)2.5 E 2.5
-(xi)-.15 G 2.5(na)-2.5 G -.18(rg)-2.5 G 2.5(vw).18 G(here the \215ag is)
--2.5 E F1(optarg)209 594 Q F0(pointer to the inde)2.5 E 2.5(xi)-.15 G
-2.5(na)-2.5 G -.18(rg)-2.5 G(v[).18 E F3(*)A F0
-(optind] where the \215ag name starts)A F1(data)209 612 Q F0
-(application speci\214c data)2.5 E -1.1(Yo)209 630 S 3.915(uc)1.1 G
-1.415(an modify)-3.915 F F3(*)3.915 E F1(optind)A F0 3.915(,a)C(nd)
--3.915 E F3(*)3.915 E F1(optarg)A F0 3.915(,b)C 1.414
-(ut to do this correct you \(more or)-4.115 F(less\) ha)209 642 Q .3
--.15(ve t)-.2 H 2.5(ok).15 G(no)-2.5 E 2.5(wa)-.25 G(bout the inner w)
--2.5 E(orkings of getar)-.1 E(g.)-.18 E -1.1(Yo)209 666 S 3.604(uc)1.1 G
-1.104(an skip parts of ar)-3.604 F 1.105(guments by increasing)-.18 F F3
-(*)3.605 E F1(optarg)A F0 1.105(\(you could implement)3.605 F(the)209
-678 Q/F4 10/Courier-Bold@0 SF<ad7a>4.567 E F1(3)A F0 .401
-(set of \215ags from)2.901 F F4(gzip)2.9 E F0 .4
-(with this\), or whole ar)2.9 F .4(gument strings by increas-)-.18 F
-(ing)209 690 Q F3(*)3.275 E F1(optind)A F0(\(let')3.275 E 3.276(ss)-.55
-G .776(ay you w)-3.276 F .776(ant a \215ag)-.1 F F4<ad63>4.942 E F1
-6.776(xyz)6.776 G F0 .776(to specify a coordinate\); if)-3.5 F
-(you also ha)209 702 Q .3 -.15(ve t)-.2 H 2.5(os).15 G(et)-2.5 E F3(*)
-2.5 E F1(optarg)A F0(to a sane v)2.5 E(alue.)-.25 E -.4(RO)77 750 S
-152.325(KEN September).4 F(24, 1999)2.5 E(2)188.865 E EP
-%%Page: 3 3
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F
-(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F
--.834(ARG \( 3 \))-.93 F 9.449
-(The collect function should return one of)209 96 R/F1 10/Courier@0 SF
-(ARG_ERR_NO_MATCH)11.948 E F0(,)A F1(ARG_ERR_BAD_ARG)209 108 Q F0(,)A F1
-(ARG_ERR_NO_ARG)6 E F0(on error)2.5 E 2.5(,z)-.4 G(ero otherwise.)-2.5 E
--.15(Fo)209 126 S 4.042(ry).15 G 1.542(our con)-4.042 F -.15(ve)-.4 G
-1.542(nience there is a function,).15 F/F2 10/Courier-Bold@0 SF
-(getarg_optarg)4.042 E F0 1.542(\(\), that returns the)B 1.251
-(traditional ar)209 138 R 1.251(gument string, and you pass it all ar)
--.18 F 1.251(guments, sans data, that where)-.18 F(gi)209 150 Q -.15(ve)
--.25 G 2.5(nt).15 G 2.5(ot)-2.5 G(he collection function.)-2.5 E(Don')
-209 168 Q 2.5(tu)-.18 G(se this more this unless you absolutely ha)-2.5
-E .3 -.15(ve t)-.2 H(o.).15 E .213(Option parsing is similar to what)102
-186 R F1(getopt)2.713 E F0 .214(uses. Short options without ar)2.714 F
-.214(guments can be compressed \()-.18 F F2(\255xyz)1.666 E F0 .207
-(is the same as)102 198 R F2 1.873<ad7820ad7920ad7a>4.373 F F0 .207
-(\), and short options with ar)B .207(guments tak)-.18 F 2.706(et)-.1 G
-.206(hese as either the rest of the ar)-2.706 F(gv-string)-.18 E
-(or as the ne)102 210 Q(xt option \()-.15 E F2<ad6f>1.666 E/F3 10
-/Courier-Oblique@0 SF(foo)A F0 2.5(,o)C(r)-2.5 E F2<ad6f>4.166 E F3(foo)
-6 E F0(\).)A .78(Long option names are pre\214x)102 228 R .781
-(ed with -- \(double dash\), and the v)-.15 F .781
-(alue with a = \(equal\),)-.25 F F2(\255-foo=)4.947 E F3(bar)A F0 3.281
-(.L)C(ong)-3.281 E 3.815
-(option \215ags can either be speci\214ed as the)102 240 R 6.315(ya)-.15
-G 3.815(re \()-6.315 F F2(\255-help)1.666 E F0 3.815
-(\), or with an \(boolean parsable\) option)B(\()102 252 Q F2
-(\255-help=)1.666 E F3(yes)A F0(,)A F2(\255-help=)5.659 E F3(true)A F0
-3.993(,o)C 3.993(rs)-3.993 G 1.493(imilar\), or the)-3.993 F 3.993(yc)
--.15 G 1.493(an also be ne)-3.993 F -.05(ga)-.15 G 1.493(ted \().05 F F2
-(\255-no-help)1.666 E F0 1.493(is the same as)3.993 F F2(\255-help=)
-103.666 264 Q F0 1.363(no\), and if you')B 1.362
-(re really confused you can do it multiple times \()-.5 F F2
-(\255-no-no-help=)1.666 E F3(false)A F0 3.862(,o)C(r)-3.862 E -2.15 -.25
-(ev e)102 276 T(n).25 E F2(\255-no-no-help=)4.166 E F3(maybe)A F0(\).)A
-/F4 10/Times-Bold@0 SF(EXAMPLE)72 300 Q F1(#include <stdio.h>)102 330 Q
-(#include <string.h>)102 342 Q(#include <getarg.h>)102 354 Q(char)102
-378 Q/F5 10/Symbol SF(*)6 E F1(source = "Ouagadougou";)A(char)102 390 Q
-F5(*)6 E F1(destination;)A(int weight;)102 402 Q
-(int include_catalog = 1;)102 414 Q(int help_flag;)102 426 Q
-(struct getargs args[] = {)102 450 Q 6({")126 462 S 30(source", 's',)-6
-F 6(arg_string, &source,)6 F("source of shippment", "city" },)138 474 Q
-6({")126 486 S(destination", 'd', arg_string,)-6 E(&destination,)12 E
-("destination of shippment", "city" },)138 498 Q 6({")126 510 S 30
-(weight", 'w',)-6 F(arg_integer, &weight,)6 E
-("weight of shippment", "tons" },)138 522 Q 6({")126 534 S 24
-(catalog", 'c',)-6 F(arg_negative_flag, &include_catalog,)6 E
-("include product catalog" },)138 546 Q 6({")126 558 S 42(help", 'h',)-6
-F(arg_flag, &help_flag })6 E(};)102 570 Q
-(int num_args = sizeof\(args\) / sizeof\(args[0]\); /)102 594 Q F5(*)A
-F1(number of elements in args)6 E F5(*)6 E F1(/)A(const char)102 618 Q
-F5(*)6 E F1(progname = "ship++";)A(int)102 642 Q(main\(int argc, char)
-102 654 Q F5(**)6 E F1(argv\))A({)102 666 Q(int optind = 0;)126 678 Q
-(if \(getarg\(args, num_args, argc, argv, &optind\)\) {)126 690 Q
-(arg_printusage\(args, num_args, progname, "stuff..."\);)147 702 Q F0
--.4(RO)77 750 S 152.325(KEN September).4 F(24, 1999)2.5 E(3)188.865 E EP
-%%Page: 4 4
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF(GET)72 48 Q -.834(ARG \( 3 \))-.93 F
-(OpenBSD Programmer')111.062 E 2.5(sM)-.55 G 108.562(anual GET)-2.5 F
--.834(ARG \( 3 \))-.93 F/F1 10/Courier@0 SF(exit \(1\);)147 96 Q(})126
-108 Q(if \(help_flag\) {)126 120 Q
-(arg_printusage\(args, num_args, progname, "stuff..."\);)147 132 Q
-(exit \(0\);)147 144 Q(})126 156 Q(if \(destination == NULL\) {)126 168
-Q(fprintf\(stderr, "%s: must specify destination0, progname\);)147 180 Q
-(exit\(1\);)147 192 Q(})126 204 Q
-(if \(strcmp\(source, destination\) == 0\) {)126 216 Q
-(fprintf\(stderr, "%s: destination must be different from source0\);)147
-228 Q(exit\(1\);)147 240 Q(})126 252 Q(/)126 264 Q/F2 10/Symbol SF(*)A
-F1(include more stuff here ...)6 E F2(*)6 E F1(/)A(exit\(2\);)126 276 Q
-(})102 288 Q F0(The output help output from this program looks lik)102
-306 Q 2.5(et)-.1 G(his:)-2.5 E F1 6($s)102 324 S(hip++ --help)-6 E
-(Usage: ship++ [--source=city] [-s city] [--destination=city] [-d city])
-102 336 Q
-([--weight=tons] [-w tons] [--no-catalog] [-c] [--help] [-h] stuff...)
-120 348 Q(-s city, --source=city)102 360 Q(source of shippment)36 E
-(-d city, --destination=city destination of shippment)102 372 Q
-(-w tons, --weight=tons)102 384 Q(weight of shippment)36 E
-(-c, --no-catalog)102 396 Q(include product catalog)72 E/F3 10
-/Times-Bold@0 SF -.1(BU)72 432 S(GS).1 E F0 .9(It should be more \215e)
-102 444 R .9(xible, so it w)-.15 F .901
-(ould be possible to use other more complicated option syntax)-.1 F .901
-(es, such as)-.15 F(what)102 456 Q F1(ps)3.167 E F0 .667(\(1\), and)B F1
-(tar)3.167 E F0 .666(\(1\), uses, or the AFS model where you can skip t\
-he \215ag names as long as the options)B(come in the correct order)102
-468 Q(.)-.55 E(Options with multiple ar)102 486 Q
-(guments should be handled better)-.18 E(.)-.55 E(Should be inte)102 504
-Q(greated with SL.)-.15 E(It')102 522 Q 2.5(sv)-.55 G
-(ery confusing that the struct you pass in is called getar)-2.65 E(gS.)
--.18 E F3 1.666(SEE ALSO)72 546 R F1(getopt)102 558 Q F0(\(3\))A -.4(RO)
-77 750 S 152.325(KEN September).4 F(24, 1999)2.5 E(4)188.865 E EP
-%%Trailer
-end
-%%EOF
diff --git a/ndb/src/common/util/md5-rfc1321.txt b/ndb/src/common/util/md5-rfc1321.txt
deleted file mode 100644
index c9e09e00cce..00000000000
--- a/ndb/src/common/util/md5-rfc1321.txt
+++ /dev/null
@@ -1,1179 +0,0 @@
-
-
-
-
-
-
-Network Working Group R. Rivest
-Request for Comments: 1321 MIT Laboratory for Computer Science
- and RSA Data Security, Inc.
- April 1992
-
-
- The MD5 Message-Digest Algorithm
-
-Status of this Memo
-
- This memo provides information for the Internet community. It does
- not specify an Internet standard. Distribution of this memo is
- unlimited.
-
-Acknowlegements
-
- We would like to thank Don Coppersmith, Burt Kaliski, Ralph Merkle,
- David Chaum, and Noam Nisan for numerous helpful comments and
- suggestions.
-
-Table of Contents
-
- 1. Executive Summary 1
- 2. Terminology and Notation 2
- 3. MD5 Algorithm Description 3
- 4. Summary 6
- 5. Differences Between MD4 and MD5 6
- References 7
- APPENDIX A - Reference Implementation 7
- Security Considerations 21
- Author's Address 21
-
-1. Executive Summary
-
- This document describes the MD5 message-digest algorithm. The
- algorithm takes as input a message of arbitrary length and produces
- as output a 128-bit "fingerprint" or "message digest" of the input.
- It is conjectured that it is computationally infeasible to produce
- two messages having the same message digest, or to produce any
- message having a given prespecified target message digest. The MD5
- algorithm is intended for digital signature applications, where a
- large file must be "compressed" in a secure manner before being
- encrypted with a private (secret) key under a public-key cryptosystem
- such as RSA.
-
-
-
-
-
-
-
-Rivest [Page 1]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- The MD5 algorithm is designed to be quite fast on 32-bit machines. In
- addition, the MD5 algorithm does not require any large substitution
- tables; the algorithm can be coded quite compactly.
-
- The MD5 algorithm is an extension of the MD4 message-digest algorithm
- 1,2]. MD5 is slightly slower than MD4, but is more "conservative" in
- design. MD5 was designed because it was felt that MD4 was perhaps
- being adopted for use more quickly than justified by the existing
- critical review; because MD4 was designed to be exceptionally fast,
- it is "at the edge" in terms of risking successful cryptanalytic
- attack. MD5 backs off a bit, giving up a little in speed for a much
- greater likelihood of ultimate security. It incorporates some
- suggestions made by various reviewers, and contains additional
- optimizations. The MD5 algorithm is being placed in the public domain
- for review and possible adoption as a standard.
-
- For OSI-based applications, MD5's object identifier is
-
- md5 OBJECT IDENTIFIER ::=
- iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 5}
-
- In the X.509 type AlgorithmIdentifier [3], the parameters for MD5
- should have type NULL.
-
-2. Terminology and Notation
-
- In this document a "word" is a 32-bit quantity and a "byte" is an
- eight-bit quantity. A sequence of bits can be interpreted in a
- natural manner as a sequence of bytes, where each consecutive group
- of eight bits is interpreted as a byte with the high-order (most
- significant) bit of each byte listed first. Similarly, a sequence of
- bytes can be interpreted as a sequence of 32-bit words, where each
- consecutive group of four bytes is interpreted as a word with the
- low-order (least significant) byte given first.
-
- Let x_i denote "x sub i". If the subscript is an expression, we
- surround it in braces, as in x_{i+1}. Similarly, we use ^ for
- superscripts (exponentiation), so that x^i denotes x to the i-th
- power.
-
- Let the symbol "+" denote addition of words (i.e., modulo-2^32
- addition). Let X <<< s denote the 32-bit value obtained by circularly
- shifting (rotating) X left by s bit positions. Let not(X) denote the
- bit-wise complement of X, and let X v Y denote the bit-wise OR of X
- and Y. Let X xor Y denote the bit-wise XOR of X and Y, and let XY
- denote the bit-wise AND of X and Y.
-
-
-
-
-
-Rivest [Page 2]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-3. MD5 Algorithm Description
-
- We begin by supposing that we have a b-bit message as input, and that
- we wish to find its message digest. Here b is an arbitrary
- nonnegative integer; b may be zero, it need not be a multiple of
- eight, and it may be arbitrarily large. We imagine the bits of the
- message written down as follows:
-
- m_0 m_1 ... m_{b-1}
-
- The following five steps are performed to compute the message digest
- of the message.
-
-3.1 Step 1. Append Padding Bits
-
- The message is "padded" (extended) so that its length (in bits) is
- congruent to 448, modulo 512. That is, the message is extended so
- that it is just 64 bits shy of being a multiple of 512 bits long.
- Padding is always performed, even if the length of the message is
- already congruent to 448, modulo 512.
-
- Padding is performed as follows: a single "1" bit is appended to the
- message, and then "0" bits are appended so that the length in bits of
- the padded message becomes congruent to 448, modulo 512. In all, at
- least one bit and at most 512 bits are appended.
-
-3.2 Step 2. Append Length
-
- A 64-bit representation of b (the length of the message before the
- padding bits were added) is appended to the result of the previous
- step. In the unlikely event that b is greater than 2^64, then only
- the low-order 64 bits of b are used. (These bits are appended as two
- 32-bit words and appended low-order word first in accordance with the
- previous conventions.)
-
- At this point the resulting message (after padding with bits and with
- b) has a length that is an exact multiple of 512 bits. Equivalently,
- this message has a length that is an exact multiple of 16 (32-bit)
- words. Let M[0 ... N-1] denote the words of the resulting message,
- where N is a multiple of 16.
-
-3.3 Step 3. Initialize MD Buffer
-
- A four-word buffer (A,B,C,D) is used to compute the message digest.
- Here each of A, B, C, D is a 32-bit register. These registers are
- initialized to the following values in hexadecimal, low-order bytes
- first):
-
-
-
-
-Rivest [Page 3]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- word A: 01 23 45 67
- word B: 89 ab cd ef
- word C: fe dc ba 98
- word D: 76 54 32 10
-
-3.4 Step 4. Process Message in 16-Word Blocks
-
- We first define four auxiliary functions that each take as input
- three 32-bit words and produce as output one 32-bit word.
-
- F(X,Y,Z) = XY v not(X) Z
- G(X,Y,Z) = XZ v Y not(Z)
- H(X,Y,Z) = X xor Y xor Z
- I(X,Y,Z) = Y xor (X v not(Z))
-
- In each bit position F acts as a conditional: if X then Y else Z.
- The function F could have been defined using + instead of v since XY
- and not(X)Z will never have 1's in the same bit position.) It is
- interesting to note that if the bits of X, Y, and Z are independent
- and unbiased, the each bit of F(X,Y,Z) will be independent and
- unbiased.
-
- The functions G, H, and I are similar to the function F, in that they
- act in "bitwise parallel" to produce their output from the bits of X,
- Y, and Z, in such a manner that if the corresponding bits of X, Y,
- and Z are independent and unbiased, then each bit of G(X,Y,Z),
- H(X,Y,Z), and I(X,Y,Z) will be independent and unbiased. Note that
- the function H is the bit-wise "xor" or "parity" function of its
- inputs.
-
- This step uses a 64-element table T[1 ... 64] constructed from the
- sine function. Let T[i] denote the i-th element of the table, which
- is equal to the integer part of 4294967296 times abs(sin(i)), where i
- is in radians. The elements of the table are given in the appendix.
-
- Do the following:
-
- /* Process each 16-word block. */
- For i = 0 to N/16-1 do
-
- /* Copy block i into X. */
- For j = 0 to 15 do
- Set X[j] to M[i*16+j].
- end /* of loop on j */
-
- /* Save A as AA, B as BB, C as CC, and D as DD. */
- AA = A
- BB = B
-
-
-
-Rivest [Page 4]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- CC = C
- DD = D
-
- /* Round 1. */
- /* Let [abcd k s i] denote the operation
- a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- [ABCD 0 7 1] [DABC 1 12 2] [CDAB 2 17 3] [BCDA 3 22 4]
- [ABCD 4 7 5] [DABC 5 12 6] [CDAB 6 17 7] [BCDA 7 22 8]
- [ABCD 8 7 9] [DABC 9 12 10] [CDAB 10 17 11] [BCDA 11 22 12]
- [ABCD 12 7 13] [DABC 13 12 14] [CDAB 14 17 15] [BCDA 15 22 16]
-
- /* Round 2. */
- /* Let [abcd k s i] denote the operation
- a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- [ABCD 1 5 17] [DABC 6 9 18] [CDAB 11 14 19] [BCDA 0 20 20]
- [ABCD 5 5 21] [DABC 10 9 22] [CDAB 15 14 23] [BCDA 4 20 24]
- [ABCD 9 5 25] [DABC 14 9 26] [CDAB 3 14 27] [BCDA 8 20 28]
- [ABCD 13 5 29] [DABC 2 9 30] [CDAB 7 14 31] [BCDA 12 20 32]
-
- /* Round 3. */
- /* Let [abcd k s t] denote the operation
- a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- [ABCD 5 4 33] [DABC 8 11 34] [CDAB 11 16 35] [BCDA 14 23 36]
- [ABCD 1 4 37] [DABC 4 11 38] [CDAB 7 16 39] [BCDA 10 23 40]
- [ABCD 13 4 41] [DABC 0 11 42] [CDAB 3 16 43] [BCDA 6 23 44]
- [ABCD 9 4 45] [DABC 12 11 46] [CDAB 15 16 47] [BCDA 2 23 48]
-
- /* Round 4. */
- /* Let [abcd k s t] denote the operation
- a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
- /* Do the following 16 operations. */
- [ABCD 0 6 49] [DABC 7 10 50] [CDAB 14 15 51] [BCDA 5 21 52]
- [ABCD 12 6 53] [DABC 3 10 54] [CDAB 10 15 55] [BCDA 1 21 56]
- [ABCD 8 6 57] [DABC 15 10 58] [CDAB 6 15 59] [BCDA 13 21 60]
- [ABCD 4 6 61] [DABC 11 10 62] [CDAB 2 15 63] [BCDA 9 21 64]
-
- /* Then perform the following additions. (That is increment each
- of the four registers by the value it had before this block
- was started.) */
- A = A + AA
- B = B + BB
- C = C + CC
- D = D + DD
-
- end /* of loop on i */
-
-
-
-Rivest [Page 5]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-3.5 Step 5. Output
-
- The message digest produced as output is A, B, C, D. That is, we
- begin with the low-order byte of A, and end with the high-order byte
- of D.
-
- This completes the description of MD5. A reference implementation in
- C is given in the appendix.
-
-4. Summary
-
- The MD5 message-digest algorithm is simple to implement, and provides
- a "fingerprint" or message digest of a message of arbitrary length.
- It is conjectured that the difficulty of coming up with two messages
- having the same message digest is on the order of 2^64 operations,
- and that the difficulty of coming up with any message having a given
- message digest is on the order of 2^128 operations. The MD5 algorithm
- has been carefully scrutinized for weaknesses. It is, however, a
- relatively new algorithm and further security analysis is of course
- justified, as is the case with any new proposal of this sort.
-
-5. Differences Between MD4 and MD5
-
- The following are the differences between MD4 and MD5:
-
- 1. A fourth round has been added.
-
- 2. Each step now has a unique additive constant.
-
- 3. The function g in round 2 was changed from (XY v XZ v YZ) to
- (XZ v Y not(Z)) to make g less symmetric.
-
- 4. Each step now adds in the result of the previous step. This
- promotes a faster "avalanche effect".
-
- 5. The order in which input words are accessed in rounds 2 and
- 3 is changed, to make these patterns less like each other.
-
- 6. The shift amounts in each round have been approximately
- optimized, to yield a faster "avalanche effect." The shifts in
- different rounds are distinct.
-
-
-
-
-
-
-
-
-
-
-Rivest [Page 6]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-References
-
- [1] Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT and
- RSA Data Security, Inc., April 1992.
-
- [2] Rivest, R., "The MD4 message digest algorithm", in A.J. Menezes
- and S.A. Vanstone, editors, Advances in Cryptology - CRYPTO '90
- Proceedings, pages 303-311, Springer-Verlag, 1991.
-
- [3] CCITT Recommendation X.509 (1988), "The Directory -
- Authentication Framework."
-
-APPENDIX A - Reference Implementation
-
- This appendix contains the following files taken from RSAREF: A
- Cryptographic Toolkit for Privacy-Enhanced Mail:
-
- global.h -- global header file
-
- md5.h -- header file for MD5
-
- md5c.c -- source code for MD5
-
- For more information on RSAREF, send email to <rsaref@rsa.com>.
-
- The appendix also includes the following file:
-
- mddriver.c -- test driver for MD2, MD4 and MD5
-
- The driver compiles for MD5 by default but can compile for MD2 or MD4
- if the symbol MD is defined on the C compiler command line as 2 or 4.
-
- The implementation is portable and should work on many different
- plaforms. However, it is not difficult to optimize the implementation
- on particular platforms, an exercise left to the reader. For example,
- on "little-endian" platforms where the lowest-addressed byte in a 32-
- bit word is the least significant and there are no alignment
- restrictions, the call to Decode in MD5Transform can be replaced with
- a typecast.
-
-A.1 global.h
-
-/* GLOBAL.H - RSAREF types and constants
- */
-
-/* PROTOTYPES should be set to one if and only if the compiler supports
- function argument prototyping.
-The following makes PROTOTYPES default to 0 if it has not already
-
-
-
-Rivest [Page 7]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- been defined with C compiler flags.
- */
-#ifndef PROTOTYPES
-#define PROTOTYPES 0
-#endif
-
-/* POINTER defines a generic pointer type */
-typedef unsigned char *POINTER;
-
-/* UINT2 defines a two byte word */
-typedef unsigned short int UINT2;
-
-/* UINT4 defines a four byte word */
-typedef unsigned long int UINT4;
-
-/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
-If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
- returns an empty list.
- */
-#if PROTOTYPES
-#define PROTO_LIST(list) list
-#else
-#define PROTO_LIST(list) ()
-#endif
-
-A.2 md5.h
-
-/* MD5.H - header file for MD5C.C
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-
-
-
-Rivest [Page 8]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-/* MD5 context. */
-typedef struct {
- UINT4 state[4]; /* state (ABCD) */
- UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} MD5_CTX;
-
-void MD5Init PROTO_LIST ((MD5_CTX *));
-void MD5Update PROTO_LIST
- ((MD5_CTX *, unsigned char *, unsigned int));
-void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
-
-A.3 md5c.c
-
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-#include "global.h"
-#include "md5.h"
-
-/* Constants for MD5Transform routine.
- */
-
-
-
-Rivest [Page 9]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
-static void Encode PROTO_LIST
- ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
- ((UINT4 *, unsigned char *, unsigned int));
-static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
-
-static unsigned char PADDING[64] = {
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
-Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
-
-
-
-Rivest [Page 10]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-/* MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-void MD5Init (context)
-MD5_CTX *context; /* context */
-{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
-*/
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
-}
-
-/* MD5 block update operation. Continues an MD5 message-digest
- operation, processing another message block, and updating the
- context.
- */
-void MD5Update (context, input, inputLen)
-MD5_CTX *context; /* context */
-unsigned char *input; /* input block */
-unsigned int inputLen; /* length of input block */
-{
- unsigned int i, index, partLen;
-
- /* Compute number of bytes mod 64 */
- index = (unsigned int)((context->count[0] >> 3) & 0x3F);
-
- /* Update number of bits */
- if ((context->count[0] += ((UINT4)inputLen << 3))
-
-
-
-Rivest [Page 11]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- < ((UINT4)inputLen << 3))
- context->count[1]++;
- context->count[1] += ((UINT4)inputLen >> 29);
-
- partLen = 64 - index;
-
- /* Transform as many times as possible.
-*/
- if (inputLen >= partLen) {
- MD5_memcpy
- ((POINTER)&context->buffer[index], (POINTER)input, partLen);
- MD5Transform (context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- MD5Transform (context->state, &input[i]);
-
- index = 0;
- }
- else
- i = 0;
-
- /* Buffer remaining input */
- MD5_memcpy
- ((POINTER)&context->buffer[index], (POINTER)&input[i],
- inputLen-i);
-}
-
-/* MD5 finalization. Ends an MD5 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
-void MD5Final (digest, context)
-unsigned char digest[16]; /* message digest */
-MD5_CTX *context; /* context */
-{
- unsigned char bits[8];
- unsigned int index, padLen;
-
- /* Save number of bits */
- Encode (bits, context->count, 8);
-
- /* Pad out to 56 mod 64.
-*/
- index = (unsigned int)((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- MD5Update (context, PADDING, padLen);
-
- /* Append length (before padding) */
- MD5Update (context, bits, 8);
-
-
-
-Rivest [Page 12]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- /* Store state in digest */
- Encode (digest, context->state, 16);
-
- /* Zeroize sensitive information.
-*/
- MD5_memset ((POINTER)context, 0, sizeof (*context));
-}
-
-/* MD5 basic transformation. Transforms state based on block.
- */
-static void MD5Transform (state, block)
-UINT4 state[4];
-unsigned char block[64];
-{
- UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
- Decode (x, block, 64);
-
- /* Round 1 */
- FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
- FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
- FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
- FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
- FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
- FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
- FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
- FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
- FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
- FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
- FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
- FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
- FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
- FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
- FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
- FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
- /* Round 2 */
- GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
- GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
- GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
- GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
- GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
- GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
- GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
- GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
- GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
- GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
- GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
-
-
-
-Rivest [Page 13]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
- GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
- GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
- GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
- GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
- /* Round 3 */
- HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
- HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
- HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
- HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
- HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
- HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
- HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
- HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
- HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
- HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
- HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
- HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
- HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
- HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
- HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
- HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
-
- /* Round 4 */
- II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
- II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
- II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
- II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
- II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
- II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
- II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
- II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
- II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
- II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
- II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
- II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
- II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
- II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
- II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
- II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
-
- /* Zeroize sensitive information.
-
-
-
-Rivest [Page 14]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-*/
- MD5_memset ((POINTER)x, 0, sizeof (x));
-}
-
-/* Encodes input (UINT4) into output (unsigned char). Assumes len is
- a multiple of 4.
- */
-static void Encode (output, input, len)
-unsigned char *output;
-UINT4 *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (unsigned char)(input[i] & 0xff);
- output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
- output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
- output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
- }
-}
-
-/* Decodes input (unsigned char) into output (UINT4). Assumes len is
- a multiple of 4.
- */
-static void Decode (output, input, len)
-UINT4 *output;
-unsigned char *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
- (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
-}
-
-/* Note: Replace "for loop" with standard memcpy if possible.
- */
-
-static void MD5_memcpy (output, input, len)
-POINTER output;
-POINTER input;
-unsigned int len;
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
-
-
-
-Rivest [Page 15]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- output[i] = input[i];
-}
-
-/* Note: Replace "for loop" with standard memset if possible.
- */
-static void MD5_memset (output, value, len)
-POINTER output;
-int value;
-unsigned int len;
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- ((char *)output)[i] = (char)value;
-}
-
-A.4 mddriver.c
-
-/* MDDRIVER.C - test driver for MD2, MD4 and MD5
- */
-
-/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All
-rights reserved.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-/* The following makes MD default to MD5 if it has not already been
- defined with C compiler flags.
- */
-#ifndef MD
-#define MD MD5
-#endif
-
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-#include "global.h"
-#if MD == 2
-#include "md2.h"
-#endif
-#if MD == 4
-
-
-
-Rivest [Page 16]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-#include "md4.h"
-#endif
-#if MD == 5
-#include "md5.h"
-#endif
-
-/* Length of test block, number of test blocks.
- */
-#define TEST_BLOCK_LEN 1000
-#define TEST_BLOCK_COUNT 1000
-
-static void MDString PROTO_LIST ((char *));
-static void MDTimeTrial PROTO_LIST ((void));
-static void MDTestSuite PROTO_LIST ((void));
-static void MDFile PROTO_LIST ((char *));
-static void MDFilter PROTO_LIST ((void));
-static void MDPrint PROTO_LIST ((unsigned char [16]));
-
-#if MD == 2
-#define MD_CTX MD2_CTX
-#define MDInit MD2Init
-#define MDUpdate MD2Update
-#define MDFinal MD2Final
-#endif
-#if MD == 4
-#define MD_CTX MD4_CTX
-#define MDInit MD4Init
-#define MDUpdate MD4Update
-#define MDFinal MD4Final
-#endif
-#if MD == 5
-#define MD_CTX MD5_CTX
-#define MDInit MD5Init
-#define MDUpdate MD5Update
-#define MDFinal MD5Final
-#endif
-
-/* Main driver.
-
-Arguments (may be any combination):
- -sstring - digests string
- -t - runs time trial
- -x - runs test script
- filename - digests file
- (none) - digests standard input
- */
-int main (argc, argv)
-int argc;
-
-
-
-Rivest [Page 17]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
-char *argv[];
-{
- int i;
-
- if (argc > 1)
- for (i = 1; i < argc; i++)
- if (argv[i][0] == '-' && argv[i][1] == 's')
- MDString (argv[i] + 2);
- else if (strcmp (argv[i], "-t") == 0)
- MDTimeTrial ();
- else if (strcmp (argv[i], "-x") == 0)
- MDTestSuite ();
- else
- MDFile (argv[i]);
- else
- MDFilter ();
-
- return (0);
-}
-
-/* Digests a string and prints the result.
- */
-static void MDString (string)
-char *string;
-{
- MD_CTX context;
- unsigned char digest[16];
- unsigned int len = strlen (string);
-
- MDInit (&context);
- MDUpdate (&context, string, len);
- MDFinal (digest, &context);
-
- printf ("MD%d (\"%s\") = ", MD, string);
- MDPrint (digest);
- printf ("\n");
-}
-
-/* Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte
- blocks.
- */
-static void MDTimeTrial ()
-{
- MD_CTX context;
- time_t endTime, startTime;
- unsigned char block[TEST_BLOCK_LEN], digest[16];
- unsigned int i;
-
-
-
-
-Rivest [Page 18]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- printf
- ("MD%d time trial. Digesting %d %d-byte blocks ...", MD,
- TEST_BLOCK_LEN, TEST_BLOCK_COUNT);
-
- /* Initialize block */
- for (i = 0; i < TEST_BLOCK_LEN; i++)
- block[i] = (unsigned char)(i & 0xff);
-
- /* Start timer */
- time (&startTime);
-
- /* Digest blocks */
- MDInit (&context);
- for (i = 0; i < TEST_BLOCK_COUNT; i++)
- MDUpdate (&context, block, TEST_BLOCK_LEN);
- MDFinal (digest, &context);
-
- /* Stop timer */
- time (&endTime);
-
- printf (" done\n");
- printf ("Digest = ");
- MDPrint (digest);
- printf ("\nTime = %ld seconds\n", (long)(endTime-startTime));
- printf
- ("Speed = %ld bytes/second\n",
- (long)TEST_BLOCK_LEN * (long)TEST_BLOCK_COUNT/(endTime-startTime));
-}
-
-/* Digests a reference suite of strings and prints the results.
- */
-static void MDTestSuite ()
-{
- printf ("MD%d test suite:\n", MD);
-
- MDString ("");
- MDString ("a");
- MDString ("abc");
- MDString ("message digest");
- MDString ("abcdefghijklmnopqrstuvwxyz");
- MDString
- ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
- MDString
- ("1234567890123456789012345678901234567890\
-1234567890123456789012345678901234567890");
-}
-
-/* Digests a file and prints the result.
-
-
-
-Rivest [Page 19]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- */
-static void MDFile (filename)
-char *filename;
-{
- FILE *file;
- MD_CTX context;
- int len;
- unsigned char buffer[1024], digest[16];
-
- if ((file = fopen (filename, "rb")) == NULL)
- printf ("%s can't be opened\n", filename);
-
- else {
- MDInit (&context);
- while (len = fread (buffer, 1, 1024, file))
- MDUpdate (&context, buffer, len);
- MDFinal (digest, &context);
-
- fclose (file);
-
- printf ("MD%d (%s) = ", MD, filename);
- MDPrint (digest);
- printf ("\n");
- }
-}
-
-/* Digests the standard input and prints the result.
- */
-static void MDFilter ()
-{
- MD_CTX context;
- int len;
- unsigned char buffer[16], digest[16];
-
- MDInit (&context);
- while (len = fread (buffer, 1, 16, stdin))
- MDUpdate (&context, buffer, len);
- MDFinal (digest, &context);
-
- MDPrint (digest);
- printf ("\n");
-}
-
-/* Prints a message digest in hexadecimal.
- */
-static void MDPrint (digest)
-unsigned char digest[16];
-{
-
-
-
-Rivest [Page 20]
-
-RFC 1321 MD5 Message-Digest Algorithm April 1992
-
-
- unsigned int i;
-
- for (i = 0; i < 16; i++)
- printf ("%02x", digest[i]);
-}
-
-A.5 Test suite
-
- The MD5 test suite (driver option "-x") should print the following
- results:
-
-MD5 test suite:
-MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
-MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
-MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
-MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0
-MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b
-MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =
-d174ab98d277d9f5a5611c2c9f419d9f
-MD5 ("123456789012345678901234567890123456789012345678901234567890123456
-78901234567890") = 57edf4a22be3c955ac49da2e2107b67a
-
-Security Considerations
-
- The level of security discussed in this memo is considered to be
- sufficient for implementing very high security hybrid digital-
- signature schemes based on MD5 and a public-key cryptosystem.
-
-Author's Address
-
- Ronald L. Rivest
- Massachusetts Institute of Technology
- Laboratory for Computer Science
- NE43-324
- 545 Technology Square
- Cambridge, MA 02139-1986
-
- Phone: (617) 253-5880
- EMail: rivest@theory.lcs.mit.edu
-
-
-
-
-
-
-
-
-
-
-
-
-Rivest [Page 21]
-
diff --git a/ndb/src/cw/Makefile_old b/ndb/src/cw/Makefile_old
deleted file mode 100644
index e710c1e244d..00000000000
--- a/ndb/src/cw/Makefile_old
+++ /dev/null
@@ -1,6 +0,0 @@
-include .defs.mk
-
-DIRS := cpcd
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs b/ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs
deleted file mode 100644
index 9f89a3282c5..00000000000
--- a/ndb/src/cw/cpcc-win32/csharp/AssemblyInfo.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly: AssemblyTitle("")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly: AssemblyVersion("1.0.*")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/ndb/src/cw/cpcc-win32/vb6/frmSplash.frm b/ndb/src/cw/cpcc-win32/vb6/frmSplash.frm
deleted file mode 100644
index 56ccbd79876..00000000000
--- a/ndb/src/cw/cpcc-win32/vb6/frmSplash.frm
+++ /dev/null
@@ -1,159 +0,0 @@
-VERSION 5.00
-Begin VB.Form frmSplash
- BorderStyle = 3 'Fixed Dialog
- ClientHeight = 4710
- ClientLeft = 45
- ClientTop = 45
- ClientWidth = 7455
- ControlBox = 0 'False
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4710
- ScaleWidth = 7455
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- Visible = 0 'False
- Begin VB.Frame fraMainFrame
- Height = 4590
- Left = 45
- TabIndex = 0
- Top = -15
- Width = 7380
- Begin VB.PictureBox picLogo
- Height = 2385
- Left = 510
- Picture = "frmSplash.frx":0000
- ScaleHeight = 2325
- ScaleWidth = 1755
- TabIndex = 2
- Top = 855
- Width = 1815
- End
- Begin VB.Label lblLicenseTo
- Alignment = 1 'Right Justify
- Caption = "LicenseTo"
- Height = 255
- Left = 270
- TabIndex = 1
- Tag = "LicenseTo"
- Top = 300
- Width = 6855
- End
- Begin VB.Label lblProductName
- AutoSize = -1 'True
- Caption = "Product"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 29.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 720
- Left = 2670
- TabIndex = 9
- Tag = "Product"
- Top = 1200
- Width = 2190
- End
- Begin VB.Label lblCompanyProduct
- AutoSize = -1 'True
- Caption = "CompanyProduct"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 18
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 435
- Left = 2505
- TabIndex = 8
- Tag = "CompanyProduct"
- Top = 765
- Width = 3000
- End
- Begin VB.Label lblPlatform
- Alignment = 1 'Right Justify
- AutoSize = -1 'True
- Caption = "Platform"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 360
- Left = 5865
- TabIndex = 7
- Tag = "Platform"
- Top = 2400
- Width = 1140
- End
- Begin VB.Label lblVersion
- Alignment = 1 'Right Justify
- AutoSize = -1 'True
- Caption = "Version"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 6075
- TabIndex = 6
- Tag = "Version"
- Top = 2760
- Width = 930
- End
- Begin VB.Label lblWarning
- Caption = "Warning"
- Height = 195
- Left = 300
- TabIndex = 3
- Tag = "Warning"
- Top = 3720
- Width = 6855
- End
- Begin VB.Label lblCompany
- Caption = "Company"
- Height = 255
- Left = 4710
- TabIndex = 5
- Tag = "Company"
- Top = 3330
- Width = 2415
- End
- Begin VB.Label lblCopyright
- Caption = "Copyright"
- Height = 255
- Left = 4710
- TabIndex = 4
- Tag = "Copyright"
- Top = 3120
- Width = 2415
- End
- End
-End
-Attribute VB_Name = "frmSplash"
-Attribute VB_GlobalNameSpace = False
-Attribute VB_Creatable = False
-Attribute VB_PredeclaredId = True
-Attribute VB_Exposed = False
-Private Sub Form_Load()
- lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
- lblProductName.Caption = App.Title
-End Sub
-
diff --git a/ndb/src/cw/cpcd/Makefile_old b/ndb/src/cw/cpcd/Makefile_old
deleted file mode 100644
index f214fb087d2..00000000000
--- a/ndb/src/cw/cpcd/Makefile_old
+++ /dev/null
@@ -1,11 +0,0 @@
-include .defs.mk
-
-TYPE := util
-BIN_TARGET := ndb_cpcd
-
-# Source files of non-templated classes (.cpp files)
-SOURCES = main.cpp CPCD.cpp Process.cpp APIService.cpp Monitor.cpp common.cpp
-
-BIN_TARGET_LIBS += logger
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/external/LINUX.x86/sci/include/list.h b/ndb/src/external/LINUX.x86/sci/include/list.h
deleted file mode 100644
index 81c467a461b..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/list.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $Id: list.h,v 1.1 2002/12/13 12:17:20 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _LIST_H
-#define _LIST_H
-#include "sci_types.h"
-
-
-typedef struct ListElement *ListElement_t;
-typedef struct List *List_t;
-
-struct ListElement {
- void *element;
- u_vkaddr_t key;
- ListElement_t prev,next;
-};
-
-void *Get_Element(ListElement_t el);
-void Set_Element(ListElement_t el,void *elptr,u_vkaddr_t key);
-void Create_Element(ListElement_t *el);
-void Destroy_Element(ListElement_t *el);
-void Create_List(List_t *list);
-void Destroy_List(List_t *list);
-void Add_Element(List_t list,ListElement_t el);
-void Remove_Element(List_t list,ListElement_t el);
-ListElement_t Find_Element(List_t list,u_vkaddr_t key);
-scibool List_Empty(List_t);
-scibool List_Elements(List_t);
-ListElement_t First_Element(List_t list);
-ListElement_t Last_Element(List_t list);
-ListElement_t Next_Element(ListElement_t el);
-
-#endif /* _LIST_H */
diff --git a/ndb/src/external/LINUX.x86/sci/include/os/inttypes.h b/ndb/src/external/LINUX.x86/sci/include/os/inttypes.h
deleted file mode 100644
index b9e5a6cb19f..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/os/inttypes.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $Id: inttypes.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SCI_OS_INTTYPES_H_
-#define _SCI_OS_INTTYPES_H_
-
-/*
- * --------------------------------------------------------------------------------------
- * Basic types of various sizes.
- * --------------------------------------------------------------------------------------
- */
-typedef unsigned char unsigned8;
-typedef unsigned short unsigned16;
-typedef unsigned int unsigned32;
-typedef unsigned long long unsigned64;
-
-typedef signed char signed8;
-typedef signed short signed16;
-typedef signed int signed32;
-typedef signed long long signed64;
-
-
-#ifdef CPU_WORD_IS_64_BIT
-typedef unsigned64 uptr_t;
-typedef signed64 iptr_t;
-#else
-typedef unsigned32 uptr_t;
-typedef signed32 iptr_t;
-#endif
-
-#endif /* _SCI_OS_INTTYPES_H_ */
diff --git a/ndb/src/external/LINUX.x86/sci/include/rmlib.h b/ndb/src/external/LINUX.x86/sci/include/rmlib.h
deleted file mode 100644
index 9d2722e9798..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/rmlib.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $Id: rmlib.h,v 1.1 2002/12/13 12:17:20 hin Exp $ */
-
-/*********************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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. *
- * *
- * *
- *********************************************************************************/
-
-/********************************************************************************/
-/* This header file contains the declarations of the SCI Reflective Memory */
-/* library rmlib. The implementation of the library functions is in rmlib.c. */
-/* The library contains all the functions that operate on the reflective */
-/* memory. */
-/* */
-/* NB! */
-/* */
-/* DOLPHIN'S SCI REFLECTIVE MEMORY FILES ARE UNDER DEVELOPMENT AND MAY CHANGE. */
-/* PLEASE CONTACT DOLPHIN FOR FURTHER INFORMATION. */
-/* */
-/* */
-/********************************************************************************/
-
-#include "sisci_error.h"
-#include "sisci_api.h"
-#include "sisci_demolib.h"
-#include "sisci_types.h"
-
-unsigned int seqerr, syncseqerr;
-
-#ifndef _RMLIB_H
-#define _RMLIB_H
-
-
-#if defined(_REENTRANT)
-
-#define _RMLIB_EXPAND_NAME(name) _RMLIB_MT_ ## name
-
-#else
-
-#define _RMLIB_EXPAND_NAME(name) _RMLIB_ST_ ## name
-
-#endif
-
-#ifdef __sparc
-#define CACHE_SIZE 2097152
-#else
-#define CACHE_SIZE 8192
-#endif
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define REFLECT_ERRCHECK 0x2
-
-struct ReflectiveMemorySpace {
- unsigned int localAdapterNo;
- unsigned int localNodeId;
- unsigned int remoteNodeId;
- sci_desc_t sd;
- sci_desc_t syncsd;
- sci_map_t localMap;
- sci_map_t remoteMap;
- unsigned int localSegmentId;
- unsigned int remoteSegmentId;
- unsigned int syncSegmentId;
- unsigned int sync_rSegmentId;
- unsigned int segmentSize;
- unsigned int *localMapAddr;
- volatile unsigned int *remoteMapAddr;
- sci_local_segment_t localSegment;
- sci_remote_segment_t remoteSegment;
- sci_local_segment_t syncSegment;
- sci_remote_segment_t sync_rSegment;
- sci_map_t syncMap;
- sci_map_t sync_rMap;
- sci_sequence_t syncsequence;
- sci_sequence_t sequence;
- unsigned int protection;
- unsigned int retry_value;
- sci_sequence_status_t sequenceStatus, syncsequenceStatus;
- volatile unsigned int *syncMapAddr;
- volatile unsigned int *sync_rMapAddr;
-};
-
-/*********************************************************************************/
-/* P R I N T R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectPrintParameters _RMLIB_EXPAND_NAME(ReflectPrintParameters)
-void ReflectPrintParameters(FILE *stream, struct ReflectiveMemorySpace RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T D M A S E T U P */
-/* */
-/*********************************************************************************/
-#define ReflectDmaSetup _RMLIB_EXPAND_NAME(ReflectDmaSetup)
-sci_error_t ReflectDmaSetup(struct ReflectiveMemorySpace RM_space, sci_dma_queue_t *dmaQueue);
-
-/*********************************************************************************/
-/* R E F L E C T D M A R E M O V E */
-/* */
-/*********************************************************************************/
-#define ReflectDmaRemove _RMLIB_EXPAND_NAME(ReflectDmaRemove)
-sci_error_t ReflectDmaRemove(sci_dma_queue_t dmaQueue);
-
-/*********************************************************************************/
-/* R E F L E C T D M A R U N */
-/* */
-/*********************************************************************************/
-#define ReflectDmaRun _RMLIB_EXPAND_NAME(ReflectDmaRun)
-sci_error_t ReflectDmaRun(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset,
- sci_dma_queue_t dmaQueue);
-/*********************************************************************************/
-/* C L O S E R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectClose _RMLIB_EXPAND_NAME(ReflectClose)
-sci_error_t ReflectClose(struct ReflectiveMemorySpace RM_space, unsigned int segment_no);
-
-/*********************************************************************************/
-/* O P E N R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectOpen _RMLIB_EXPAND_NAME(ReflectOpen)
-sci_error_t ReflectOpen(struct ReflectiveMemorySpace *RM_space,
- unsigned int size,
- unsigned int segment_no,
- unsigned int localAdapterNo,
- unsigned int remoteNodeId,
- unsigned int protection,
- unsigned int retry_value);
-
-/*********************************************************************************/
-/* R E F L E C T G E T A C C E S S */
-/* */
-/*********************************************************************************/
-#define ReflectGetAccess _RMLIB_EXPAND_NAME(ReflectGetAccess)
-sci_error_t ReflectGetAccess(struct ReflectiveMemorySpace *RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T R E L E A S E A C C E S S */
-/* */
-/*********************************************************************************/
-#define ReflectReleaseAccess _RMLIB_EXPAND_NAME(ReflectReleaseAccess)
-sci_error_t ReflectReleaseAccess(struct ReflectiveMemorySpace *RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T D M A */
-/* */
-/*********************************************************************************/
-#define ReflectDma _RMLIB_EXPAND_NAME(ReflectDma)
-sci_error_t ReflectDma(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset);
-
-/*********************************************************************************/
-/* R E F L E C T M E M C O P Y */
-/* */
-/*********************************************************************************/
-#define ReflectMemCopy _RMLIB_EXPAND_NAME(ReflectMemCopy)
-sci_error_t ReflectMemCopy(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset,
- unsigned int flags);
-
-/*********************************************************************************/
-/* R E F L E C T S E T */
-/* */
-/*********************************************************************************/
-#define ReflectSet _RMLIB_EXPAND_NAME(ReflectSet)
-sci_error_t ReflectSet(struct ReflectiveMemorySpace RM_space,
- unsigned int value,
- unsigned int size,
- unsigned int offset,
- unsigned int flags
- );
-
-/*********************************************************************************/
-/* R E F L E C T P R I N T */
-/* */
-/*********************************************************************************/
-#define ReflectPrint _RMLIB_EXPAND_NAME(ReflectPrint)
-sci_error_t ReflectPrint(FILE *stream,
- struct ReflectiveMemorySpace RM_space,
- unsigned int size,
- unsigned int offset
- );
-
-
-#endif
diff --git a/ndb/src/external/LINUX.x86/sci/include/sci_errno.h b/ndb/src/external/LINUX.x86/sci/include/sci_errno.h
deleted file mode 100644
index 03f3256a86f..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sci_errno.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/* $Id: sci_errno.h,v 1.1 2002/12/13 12:17:20 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SCI_ERRNO_H_
-#define _SCI_ERRNO_H_
-
-
-/*
- * SCI Error return values always have 30 bit set
- * Remote errors should have bit 0 set
- */
-#define SCI_ERR_MASK 0x40000000
-#define ESCI_REMOTE_MASK 0x01000000
-
-#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF )
-#define _SCI_ERROR(x) ((x) | SCI_ERR_MASK)
-#define _SCI_REMOTE_ERROR(x) ( _SCI_ERROR(x) | ESCI_REMOTE_MASK )
-
-/*
- * Error codes
- */
-typedef enum {
- ESCI_OK = 0x000,
- ESCI_STILL_EXPORTED = _SCI_ERROR(0x800),
-
- ESCI_BUS_ERR = _SCI_ERROR(0x900),
- ESCI_PEND_SCIERR = _SCI_ERROR(0x901),
- ESCI_SCI_ERR = _SCI_ERROR(0x902),
-
- /*
- * Specific SCI error responses:
- */
- ESCI_SCI_ERR_DATA = _SCI_ERROR(0x9021),
- ESCI_SCI_ERR_TYPE = _SCI_ERROR(0x9022),
- ESCI_SCI_ERR_ADDR = _SCI_ERROR(0x9023),
-
- ESCI_LINK_TIMEOUT = _SCI_ERROR(0x903),
- ESCI_EXDEV_TIMEOUT = _SCI_ERROR(0x904),
- ESCI_REMOTE_ERR = _SCI_ERROR(0x905),
- ESCI_MBX_BUSY = _SCI_ERROR(0x906),
- ESCI_DMAERR = _SCI_ERROR(0x907),
- ESCI_DMA_DISABLED = _SCI_ERROR(0x908),
- ESCI_SW_MBX_SEND_FAILED = _SCI_ERROR(0x909),
- ESCI_HW_MBX_SEND_FAILED = _SCI_ERROR(0x90A),
- ESCI_HAS_NO_SESSION = _SCI_ERROR(0xA00),
- ESCI_CONNREFUSED_SESSION = _SCI_ERROR(0xA01),
- ESCI_SESSION_NOT_ESTABLISHED = _SCI_ERROR(0xA11),
- ESCI_REMOTE_NO_VALID_SESSION = _SCI_ERROR(0xA02),
- ESCI_SESSION_DISABLED = _SCI_ERROR(0xA03),
- ESCI_NODE_CLOSED = _SCI_ERROR(0xA04),
- ESCI_NODE_DISABLED = _SCI_ERROR(0xA05),
-
- ESCI_LOCAL_MASTER_ERR = _SCI_ERROR(0xA06),
- ESCI_REMOTE_MASTER_ERR = _SCI_REMOTE_ERROR(0xA06),
-
- ESCI_ILLEGAL_CMD_RECEIVED = _SCI_ERROR(0xA08),
- ESCI_ILLEGAL_CMD_SENT = _SCI_ERROR(0xA09),
-
- /* used above: ESCI_SESSION_NOT_ESTABLISHED = _SCI_ERROR(0xA11), */
-
- /*
- * Remote error codes
- */
- ESCI_CONNREFUSED = _SCI_ERROR(0xB00),
- ESCI_NODE_NOT_RESPONDING = _SCI_ERROR(0xB01),
- ESCI_ISCONN = _SCI_ERROR(0xB02),
- ESCI_HOSTUNREACH = _SCI_ERROR(0xB03),
- ESCI_NO_SUCH_USER_ID = _SCI_ERROR(0xB04),
- ESCI_REMOTE_NO_SUCH_USER_ID = _SCI_REMOTE_ERROR(0xB04), /* ESCI_NO_SUCH_USER_ID */
- ESCI_NO_SUCH_KEY = _SCI_ERROR(0xB04), /* ESCI_NO_SUCH_USER_ID */
- ESCI_REMOTE_NO_SUCH_KEY = _SCI_REMOTE_ERROR(0xB04), /* ESCI_REMOTE_NO_SUCH_USER_ID */
- ESCI_NODE_ERR = _SCI_ERROR(0xB06),
- ESCI_REMOTE_NODE_ERR = _SCI_REMOTE_ERROR(0xB06), /* ESCI_NODE_ERR */
- ESCI_NOSPC = _SCI_ERROR(0xB08),
- ESCI_REMOTE_NOSPC = _SCI_REMOTE_ERROR(0xB08), /* ESCI_NOSPC */
- ESCI_NODMASPC = _SCI_ERROR(0xB0A),
- ESCI_REMOTE_NODMASPC = _SCI_REMOTE_ERROR(0xB0A), /* ESCI_NODMASPC */
- ESCI_NOTMAP = _SCI_ERROR(0xC00),
- ESCI_ISMAP = _SCI_ERROR(0xC01),
- ESCI_NOT_INITIALIZED = _SCI_ERROR(0xD00),
- ESCI_REMOTE_NOT_INITIALIZED = _SCI_REMOTE_ERROR(ESCI_NOT_INITIALIZED),
- /*
- * ???
- */
- ESCI_PARAM_ERR = _SCI_ERROR(0xD01),
- ESCI_NO_FREE_VC = _SCI_ERROR(0xD02),
- ESCI_REMOTE_NO_FREE_VC = _SCI_REMOTE_ERROR(0xD02), /* ESCI_NO_FREE_VC */
-
- /*
- * Adapter state related error codes:
- */
- ESCI_SUSPENDED = _SCI_ERROR(0xD03),
- ESCI_NOT_SUSPENDED = _SCI_ERROR(0xD04),
- ESCI_NOT_READY = _SCI_ERROR(0xD05),
- ESCI_NOT_CONFIGURED = _SCI_ERROR(0xD06),
- ESCI_INVALID_ADAPTERID = _SCI_ERROR(0xD07), /* if an adapter-id is out of range */
- ESCI_NONEXIST_ADAPTERID = _SCI_ERROR(0xD08), /* if adapter-id is valid but no adapter matches */
- ESCI_ADAPTERID_INUSE = _SCI_ERROR(0xD09),
-
- ESCI_INVALID_INSTANCE = _SCI_ERROR(0xD0A),
- ESCI_NONEXIST_INSTANCE = _SCI_ERROR(0xD0B),
-
- ESCI_ADAPTER_INIT_FAILURE = _SCI_ERROR(0xD0C),
-
- ESCI_PAUSED = _SCI_ERROR(0xD0D),
- ESCI_NOT_PAUSED = _SCI_ERROR(0xD0E),
- ESCI_ADAPTER_NEED_RESET = _SCI_ERROR(0xD0F),
-
- ESCI_NONEXIST_SERIAL_NUMBER = _SCI_ERROR(0xD10),
- ESCI_NOT_AVAILABLE = _SCI_ERROR(0xD11),
-
- ESCI_EACCESS = _SCI_ERROR(0xD12),
-
- /*
- * Local error codes
- */
- ESCI_NO_LOCAL_ACCESS = _SCI_ERROR(0xE00),
- ESCI_LRESOURCE_BUSY = _SCI_ERROR(0xE01),
- ESCI_LRESOURCE_EXIST = _SCI_ERROR(0xE02),
- ESCI_NO_LRESOURCE = _SCI_ERROR(0xE03),
- ESCI_NOTCONN = _SCI_ERROR(0xE04),
- ESCI_LOCAL_ERR = _SCI_ERROR(0xE05),
- ESCI_NOVAL_NODEID = _SCI_ERROR(0xE06),
- ESCI_NOT_SUPPORTED = _SCI_ERROR(0xE07),
- ESCI_TIMEOUT = _SCI_ERROR(0xE08),
- ESCI_NO_LOCAL_LC_ACCESS = _SCI_ERROR(0xE0A),
- ESCI_INVALID_ATT = _SCI_ERROR(0xE0B),
- ESCI_BAD_CHECKSUM = _SCI_ERROR(0xE0C),
- ESCI_INTERRUPT_FLAG_DISABLED = _SCI_ERROR(0xE0D),
- ESCI_COND_INT_RACE_PROBLEM = _SCI_ERROR(0xE0E),
- ESCI_OVERFLOW = _SCI_ERROR(0xE0F),
- ESCI_BLINK_PARITY_ERROR = _SCI_ERROR(0xE10),
- ESCI_FIRMWARE_VERSION_MISMATCH = _SCI_ERROR(0xE11),
-
- /*
- * Link error codes
- */
- ESCI_NO_LINK_ACCESS = _SCI_ERROR(0xF00),
- ESCI_NO_REMOTE_LINK_ACCESS = _SCI_REMOTE_ERROR(0xF00), /* ESCI_NO_LINK_ACCESS */
-
- ESCI_NO_SUCH_NODE = _SCI_ERROR(0xF02),
- ESCI_USR_ACCESS_DISABLED = _SCI_ERROR(0xF03),
- ESCI_HW_AVOID_DEADLOCK = _SCI_ERROR(0xF04),
- ESCI_POTENTIAL_ERROR = _SCI_ERROR(0xF05),
-
- ESCI_FENCED = _SCI_ERROR(0xF06),
- ESCI_SWITCH_HW_FAILURE = _SCI_ERROR(0xF07),
- ESCI_SWITCH_WRONG_BLINK_ID = _SCI_ERROR(0xF08),
- ESCI_SWITCH_WRONG_PORT_NUMB = _SCI_ERROR(0xF09),
- ESCI_SWITCH_WRONG_INIT_TYPE = _SCI_ERROR(0xF0A), /* It is determined that the swith initialization
- * do not match the local adapter initialization
- */
- ESCI_SWITCH_WRONG_SWITCH_NUMB = _SCI_ERROR(0xF0B), /* It is determined that we are operationg on the
- * wrong switch port
- */
- ESCI_SWITCH_NOT_CONNECTED = _SCI_ERROR(0xF0C),
- ESCI_SWITCH_NOT_RECOGNIZED = _SCI_ERROR(0xF0D),
- ESCI_SWITCH_INIT_IN_PROGRESS = _SCI_ERROR(0xF0E), /* Switch TINI initialization in progress */
-
-
- ESCI_NO_BACKBONE_LINK_ACCESS = _SCI_ERROR(0xF20),
- ESCI_BACKBONE_FENCED = _SCI_ERROR(0xF21),
- ESCI_NO_BACKBONE_ACCESS = _SCI_ERROR(0xF22),
- ESCI_BACKBONE_CABLE_PROBLEM = _SCI_ERROR(0xF23),
- ESCI_BACKBONE_BLINK_PROBLEM = _SCI_ERROR(0xF24),
- ESCI_BACKBONE_HWINIT_PROBLEM = _SCI_ERROR(0xF25),
- ESCI_BACKBONE_ID_PROBLEM = _SCI_ERROR(0xF26),
- ESCI_BACKBONE_STATE_PROBLEM = _SCI_ERROR(0xF27),
- ESCI_BACKBONE_REQ_LINK_PROBLEM = _SCI_ERROR(0xF28),
- ESCI_BACKBONE_UNFENCING = _SCI_ERROR(0xF29), /* Unfencing in progress */
-
- /*
- * added for pci port
- */
- ESCI_AGAIN = _SCI_ERROR(0xF15),
- ESCI_ORANGE = _SCI_ERROR(0xF16), /* Out of range */
- ESCI_NOSYS = _SCI_ERROR(0xF17), /* Used instead of ENOSYS. Means function not implemented */
- ESCI_REMOTE_NOSYS = _SCI_REMOTE_ERROR(ESCI_NOSYS),
- ESCI_INTR = _SCI_ERROR(0xF18), /* Used instead of EINTR from sys/errno.h */
- ESCI_IO = _SCI_ERROR(0xF19), /* Used instead of EIO from sys/errno.h */
- ESCI_FAULT = _SCI_ERROR(0xF1A), /* Used instead of EFAULT from sys/errno.h */
- ESCI_BUSY = _SCI_ERROR(0xF1B), /* Used instead of EBUST from sys/errno.h */
- ESCI_INVAL = _SCI_ERROR(0xF1C), /* Used instead of EINVAL from sys/errno.h */
- ESCI_NXIO = _SCI_ERROR(0xF1D), /* Used instead of ENXIO from sys/errno.h */
- ESCI_EXIST = _SCI_ERROR(0xF1E) /* Used instead of EEXIST from sys/errno.h */
-
-} scierror_t;
-
-#endif /* _SCI_ERRNO_H_ */
-
-
-
-
diff --git a/ndb/src/external/LINUX.x86/sci/include/sci_types.h b/ndb/src/external/LINUX.x86/sci/include/sci_types.h
deleted file mode 100644
index 740b3a45cfd..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sci_types.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/* $Id: sci_types.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SCI_TYPES_H_
-#define _SCI_TYPES_H_
-
-/*
- * Remains for the time being for backward compatibility ....
- */
-
-/* #define UNIQUE(type) struct { type x; } * */
-#ifndef UNIQUE
-#define UNIQUE(type) type
-#endif
-#include "os/inttypes.h"
-
-#if defined(WIN32)
-#if defined(_KERNEL)
-#include <ntddk.h>
-#else
-#include <WTYPES.H>
-#endif /* _KERNEL */
-#else
-#if defined(Linux)
-#if defined(__KERNEL__)
-#include <linux/types.h>
-#else
-#include <sys/types.h>
-#endif
-#else
-#include <sys/types.h>
-#endif
-#ifdef SUNOS5
-#include <sys/ddi.h>
-#include <sys/sunddi.h>
-#endif
-#ifdef OS_IS_TRU64
-#include <io/common/devdriver.h>
-#endif
-#ifdef OS_IS_HP_UX11
-#if defined(_KERNEL)
-#include <../wsio/wsio.h>
-#else
-#include <sys/wsio.h>
-#endif
-#endif
-#endif
-
-/* See comments about "UNCONFIGURED_ADAPTERS" in config.h */
-#define UNCONFIGURED_ADAPTERS 100
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef IN
-#define IN
-#endif
-
-#ifndef NOT
-#define NOT !
-#endif
-
-/*
- * --------------------------------------------------------------------------------------
- * Basic types of various sizes.
- * --------------------------------------------------------------------------------------
- */
-
-typedef signed32 scibool;
-#ifndef OS_IS_VXWORKS
-typedef signed32 BOOL;
-#else
-/* VXWORKS has already defined BOOL */
-#endif
-typedef unsigned32 node_t; /* This is the logical nodeid */
-typedef unsigned32 sciNodeId_t; /* This is the physical 16 bit SCI nodeid */
-
-/*
- * --------------------------------------------------------------------------------------
- * Various register types.
- * --------------------------------------------------------------------------------------
- */
-typedef volatile unsigned32 register32;
-
-
-/*
-Temporary for Windows NT, until we use only the above types.
-*/
-
-#ifdef WIN32
-
-typedef unsigned char u_char;
-typedef unsigned short u_short;
-typedef unsigned long u_long;
-typedef unsigned int u_int;
-typedef char * caddr_t;
-
-typedef long off_t;
-typedef unsigned int size_t;
-
-#endif
-#ifdef OS_IS_VXWORKS
-#include <vxWorks.h>
-#endif
-
-/*
- * --------------------------------------------------------------------------------------
- * Various address types.
- *
- * We are using a struct * instead of unsigned long (int) inorder to enforce strong
- * type checking
- *
- * --------------------------------------------------------------------------------------
- */
-typedef UNIQUE(void *) vkaddr_t; /* Virtual kernel address */
-typedef UNIQUE(uptr_t) vuaddr_t; /* Virtual user address */
-
-typedef UNIQUE(unsigned32) remaddr_t; /* Remote IO address (physical address on PCs) */
-typedef UNIQUE(unsigned32) sciofs_lo_t; /* Lower 32 bits of an SCI offset. */
-typedef UNIQUE(unsigned32) sciofs_hi_t; /* The upper 16 bits of an SCI offset. */
-
-typedef UNIQUE(unsigned32) ioaddr_t; /* Local IO address (physical address on PCs) */
-typedef unsigned32 u_ioaddr_t;
-typedef unsigned32 iooffset_t;
-typedef unsigned32 iosize_t;
-
-typedef uptr_t vkoffset_t;
-typedef uptr_t u_vkaddr_t;
-typedef uptr_t u_vuaddr_t;
-typedef unsigned32 u_sciofs_lo_t;
-typedef unsigned32 u_sciofs_hi_t;
-typedef unsigned32 u_remaddr_t;
-typedef unsigned32 attOffset_t; /* Address displacement from start of ATT entry */
-
-typedef unsigned32 adapterNo_t;
-
-typedef enum {
- NO_NODE = 0,
- AD_MEM_NODE = 1,
- AD_ALT_NODE = 2,
- AD_MBX_NODE = 3,
- AD_LC_NODE = 4,
- AD_LC_PORT_0 = 5,
- AD_LC_PORT_1 = 6,
- AD_LC_PORT_2 = 7,
- PHYS_NODE = 8
-} node_type_t;
-
-
-/*
- * Currently we don't support more than 32 bit sizes.
- */
-#define SIZEOF(x) ((unsigned32)sizeof(x))
-
-#if defined(_KERNEL)
-
-/*
- * --------------------------------------------------------------------------------------
- * Some small macros intended to ease the transition to more strongly typed address
- * types. The intention is that they in the long run shall be removed ...
- * --------------------------------------------------------------------------------------
- */
-#define P2SIZE_T(x) ((size_t)((uptr_t)(x))) /* Pointer to size_t */
-#define P2U32(x) ((unsigned32)((uptr_t)(x))) /* Pointer to Unsigned 32-bit int */
-#ifdef WIN32
-#define PHADDR(x) ((ioaddr_t)(x))
-#define HASV(x) (x)
-#endif
-#if 0
-static vkaddr_t VKPTR (void * ptr) { return (vkaddr_t)ptr; }
-static vkaddr_t VKADDR(volatile void * ptr) { return (vkaddr_t)ptr; }
-#else
-#define VKPTR(ptr) (vkaddr_t)ptr
-#define VKADDR(ptr) (vkaddr_t)ptr
-#endif
-
-#ifdef KLOG
-#define KLOG_LOG(n,m,v) ts_log((n),(m),(v))
-#else
-#define KLOG_LOG(n,m,v)
-#endif /* KLOG */
-
-
-/*
- * --------------------------------------------------------------------------------------
- *
- * M E M A R E A T
- *
- * Memory area descriptor.
- *
- * paddr -- Physical address (aligned) of memory area
- * ual_vaddr -- (Kernel )Virtual address of the unaligned memory area
- * vaddr -- (Kernel) Virtual address of memory area
- * rsize -- Real (Physical) Size of memory area
- * msize -- Mapped (Virtual) Size of memory area (Size of area mapped
- * into virtual) memory
- *
- * --------------------------------------
- * | | <----- msize ----->| |
- * |<------|------- rsize ------|------>|
- * --------------------------------------
- * /|\ /|\
- * | |
- * ual_vaddr vaddr/paddr
- *
- * --------------------------------------------------------------------------------------
- */
-struct _memarea_ {
- ioaddr_t ioaddr;
- vkaddr_t vaddr;
- vkaddr_t ual_vaddr;
- size_t rsize;
- size_t msize;
- char *id;
- unsigned32 cookie;
-
-
-#ifdef SUNOS5
-#ifdef _USE_NEW_SOLARIS_DDI_INTERFACE
- ddi_acc_handle_t mem_handle;
- ddi_dma_handle_t dma_handle;
-#else
- ddi_dma_handle_t handle;
-#endif
-#endif
-#ifdef OS_IS_TRU64
- dma_handle_t dma_handle;
-#endif
-
-#if OS_IS_LINUX
- unsigned long ph_base_addr;
-#endif
-
-#ifdef OS_IS_HP_UX11
- struct isc_table_type * isc;
- wsio_shmem_attr_t type;
-#endif
-};
-
-typedef struct _memarea_ memarea_t;
-
-#ifdef SCI_MALLOC_DEBUG
-struct _maddr_ {
- char *id;
- size_t size;
- struct _maddr_ *next;
- struct _maddr_ **prev;
- unsigned32 cookie;
-};
-
-typedef struct _maddr_ maddr_t;
-
-#define MALLOC_COOKIE 0xc3c3c3c3
-
-#else
-
-typedef struct { void *p; } *maddr_t;
-
-#endif /* SCI_MALLOC_DEBUG */
-
-
-typedef struct {
- scibool disabled;
- unsigned32 disable_cnt;
-} disable_info_t;
-
-#endif /* _KERNEL */
-
-#endif /* _SCI_TYPES_H_ */
diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_api.h b/ndb/src/external/LINUX.x86/sci/include/sisci_api.h
deleted file mode 100644
index 38fdf54125f..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sisci_api.h
+++ /dev/null
@@ -1,2170 +0,0 @@
-/* $Id: sisci_api.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2001 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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 _SISCI_API_H
-#define _SISCI_API_H
-
-#include "sisci_types.h"
-#include "sisci_error.h"
-
-
-#ifdef WIN32
-#ifdef API_DLL
-#define DLL __declspec(dllexport)
-#elif CLIENT_DLL
-#define DLL __declspec(dllimport)
-#endif
-#endif /* WIN32 */
-
-
-#ifndef DLL
-#define DLL
-#endif
-
-#if defined(_REENTRANT)
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_MT_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_MT_ ## name
-#else
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_ST_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_ST_ ## name
-#endif
-#define _SISCI_EXPANDE_CONSTANT_NAME(name) _SISCI_PUBLIC_CONST_ ## name
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-extern "C" {
-#endif
-
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define SCI_FLAG_FIXED_INTNO _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_INTNO)
-extern const unsigned int SCI_FLAG_FIXED_INTNO;
-
-#define SCI_FLAG_SHARED_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_INT)
-extern const unsigned int SCI_FLAG_SHARED_INT;
-
-#define SCI_FLAG_FIXED_MAP_ADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_MAP_ADDR)
-extern const unsigned int SCI_FLAG_FIXED_MAP_ADDR;
-
-#define SCI_FLAG_READONLY_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READONLY_MAP)
-extern const unsigned int SCI_FLAG_READONLY_MAP;
-
-#define SCI_FLAG_USE_CALLBACK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_USE_CALLBACK)
-extern const unsigned int SCI_FLAG_USE_CALLBACK;
-
-#define SCI_FLAG_BLOCK_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_BLOCK_READ)
-extern const unsigned int SCI_FLAG_BLOCK_READ;
-
-#define SCI_FLAG_THREAD_SAFE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_THREAD_SAFE)
-extern const unsigned int SCI_FLAG_THREAD_SAFE;
-
-#define SCI_FLAG_ASYNCHRONOUS_CONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ASYNCHRONOUS_CONNECT)
-extern const unsigned int SCI_FLAG_ASYNCHRONOUS_CONNECT;
-
-#define SCI_FLAG_EMPTY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_EMPTY)
-extern const unsigned int SCI_FLAG_EMPTY;
-
-#define SCI_FLAG_PRIVATE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_PRIVATE)
-extern const unsigned int SCI_FLAG_PRIVATE;
-
-#define SCI_FLAG_FORCE_DISCONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FORCE_DISCONNECT)
-extern const unsigned int SCI_FLAG_FORCE_DISCONNECT;
-
-#define SCI_FLAG_NOTIFY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NOTIFY)
-extern const unsigned int SCI_FLAG_NOTIFY;
-
-#define SCI_FLAG_DMA_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_READ)
-extern const unsigned int SCI_FLAG_DMA_READ;
-
-#define SCI_FLAG_DMA_POST _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_POST)
-extern const unsigned int SCI_FLAG_DMA_POST;
-
-#define SCI_FLAG_DMA_WAIT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_WAIT)
-extern const unsigned int SCI_FLAG_DMA_WAIT;
-
-#define SCI_FLAG_DMA_RESET _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_RESET)
-extern const unsigned int SCI_FLAG_DMA_RESET;
-
-#define SCI_FLAG_NO_FLUSH _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_FLUSH)
-extern const unsigned int SCI_FLAG_NO_FLUSH;
-
-#define SCI_FLAG_NO_STORE_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_STORE_BARRIER)
-extern const unsigned int SCI_FLAG_NO_STORE_BARRIER;
-
-#define SCI_FLAG_FAST_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FAST_BARRIER)
-extern const unsigned int SCI_FLAG_FAST_BARRIER;
-
-#define SCI_FLAG_ERROR_CHECK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ERROR_CHECK)
-extern const unsigned int SCI_FLAG_ERROR_CHECK;
-
-#define SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-extern const unsigned int SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY;
-
-/* the FLUSH_CPU_BUFFERS_ONLY flag is for backwards compabillity only and should never be used */
-#define FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-
-#define SCI_FLAG_LOCK_OPERATION _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_LOCK_OPERATION)
-extern const unsigned int SCI_FLAG_LOCK_OPERATION;
-
-#define SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP;
-
-#define SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP;
-
-#define SCI_FLAG_IO_MAP_IOSPACE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_IO_MAP_IOSPACE)
-extern const unsigned int SCI_FLAG_IO_MAP_IOSPACE;
-
-#define SCI_FLAG_DMOVE_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMOVE_MAP)
-extern const unsigned int SCI_FLAG_DMOVE_MAP;
-
-#define SCI_FLAG_WRITES_DISABLE_GATHER_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_WRITES_DISABLE_GATHER_MAP)
-extern const unsigned int SCI_FLAG_WRITES_DISABLE_GATHER_MAP;
-
-#define SCI_FLAG_DISABLE_128_BYTES_PACKETS _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DISABLE_128_BYTES_PACKETS)
-extern const unsigned int SCI_FLAG_DISABLE_128_BYTES_PACKETS;
-
-#define SCI_FLAG_SHARED_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_MAP)
-extern const unsigned int SCI_FLAG_SHARED_MAP;
-
-#define SCI_FLAG_DMA_SOURCE_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_SOURCE_ONLY)
-extern const unsigned int SCI_FLAG_DMA_SOURCE_ONLY;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT_MAP;
-
-#define SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP;
-
-#define SCI_FLAG_NO_MEMORY_LOOPBACK_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_MEMORY_LOOPBACK_MAP)
-extern const unsigned int SCI_FLAG_NO_MEMORY_LOOPBACK_MAP;
-
-#if defined(OS_IS_LYNXOS) || defined(OS_IS_VXWORKS)
-#define SCI_FLAG_WRITE_BACK_CACHE_MAP _SISCI_EXPANDE_CONSTANT_NAME(WRITE_BACK_CACHE_MAP)
-extern const unsigned int SCI_FLAG_WRITE_BACK_CACHE_MAP;
-#endif
-
-#define SCI_FLAG_DMA_PHDMA _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_PHDMA)
-extern const unsigned int SCI_FLAG_DMA_PHDMA;
-
-/*********************************************************************************/
-/* GENERAL VALUES */
-/*********************************************************************************/
-#define SCI_LOCAL_HOST _SISCI_EXPANDE_CONSTANT_NAME(SCI_LOCAL_HOST)
-extern const unsigned int SCI_LOCAL_HOST;
-
-#define SCI_INFINITE_TIMEOUT _SISCI_EXPANDE_CONSTANT_NAME(SCI_INFINITE_TIMEOUT)
-extern const unsigned int SCI_INFINITE_TIMEOUT;
-
-/*********************************************************************************/
-/* GENERAL ERROR CODES */
-/* */
-/* SCI_ERR_ILLEGAL_FLAG - Illegal flag value. */
-/* SCI_ERR_FLAG_NOT_IMPLEMENTED - Flag legal but flag feature not implemented. */
-/* SCI_ERR_NOT_IMPLEMENTED - Function not implemented. */
-/* SCI_ERR_SYSTEM - A system error. Check errno. */
-/* SCI_ERR_NOSPC - Unable to allocate OS resources. */
-/* SCI_ERR_API_NOSPC - Unable to allocate API resources. */
-/* SCI_ERR_HW_NOSPC - Unable to allocate HW resources (Hardware) */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "ADAPTER" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_ADAPTERNO - Adapter number is legal but does not exist. */
-/* SCI_ERR_ILLEGAL_ADAPTERNO - Illegal local adapter number (i.e. outside */
-/* legal range). */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "NODEID" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_NODEID - The remote adapter identified by nodeId does */
-/* not respond, but the intermediate link(s) */
-/* seem(s) to be operational. */
-/* SCI_ERR_ILLEGAL_NODEID - Illegal NodeId. */
-/* */
-/*********************************************************************************/
-
-
-
-/*********************************************************************************
- * *
- * S C I I N I T I A L I Z E *
- * *
- * This function initializes the SISCI library. *
- * The function must be called before SCIOpen(). *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCIInitialize _SISCI_EXPANDE_FUNCTION_NAME(SCIInitialize)
-DLL void SCIInitialize(unsigned int flags,
- sci_error_t *error);
-#if 0
-unsigned int __Internal_SISCI_version_var;
-#endif
-
-/*********************************************************************************
- * *
- * S C I T E R M I N A T E *
- * *
- * This function terminates the SISCI library. *
- * The function must be called after SCIClose(). *
- * *
- * *
- *********************************************************************************/
-#define SCITerminate _SISCI_EXPANDE_FUNCTION_NAME(SCITerminate)
-DLL void SCITerminate(void);
-
-/*********************************************************************************
- * *
- * S C I O P E N *
- * *
- * *
- * Opens a SCI virtual device. *
- * Caller must supply a pointer to a variable of type sci_desc_t to be *
- * initialized. *
- * *
- * Flags *
- * SCI_FLAG_THREAD_SAFE - Operations on resources associated with this *
- * descriptor will be performed in a multithread-safe *
- * manner. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INCONSISTENT_VERSIONS - Inconsistency between the SISCI library *
- * and the SISCI driver versions. *
- * *
- * *
- *********************************************************************************/
-#define SCIOpen _SISCI_EXPANDE_FUNCTION_NAME(SCIOpen)
-DLL void SCIOpen(sci_desc_t *sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C L O S E *
- * *
- * This function closes an open SCI virtual device. *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - All resources are not deallocated. *
- * *
- *********************************************************************************/
-#define SCIClose _SISCI_EXPANDE_FUNCTION_NAME(SCIClose)
-DLL void SCIClose(sci_desc_t sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S E G M E N T *
- * *
- * Connects to a remote shared memory segment located at <nodeId> with the *
- * identifier <segmentId>. *
- * The user may then call SCIMapRemoteSegment() to map shared memory *
- * into user space. *
- * *
- * Flags *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_ASYNCHRONOUS_CONNECT *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_SEGMENT - Could not find the remote segment with the *
- * given segmentId. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIConnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSegment)
-DLL void SCIConnectSegment(sci_desc_t sd,
- sci_remote_segment_t *segment,
- unsigned int nodeId,
- unsigned int segmentId,
- unsigned int localAdapterNo,
- sci_cb_remote_segment_t callback,
- void *callbackArg,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T S E G M E N T *
- * *
- * Disconnects from the give mapped shared memory segment *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The segment is currently mapped or in use. *
- * *
- *********************************************************************************/
-#define SCIDisconnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectSegment)
-DLL void SCIDisconnectSegment(sci_remote_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T R E M O T E S E G M E N T S I Z E *
- * *
- *********************************************************************************/
-#define SCIGetRemoteSegmentSize _SISCI_EXPANDE_FUNCTION_NAME(SCIGetRemoteSegmentSize)
-DLL unsigned int SCIGetRemoteSegmentSize(sci_remote_segment_t segment);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R R E M O T E S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du *
- * to a SCIDisconnectSegment() on the same *
- * handle. The handle is invalid when this *
- * error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForRemoteSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForRemoteSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForRemoteSegmentEvent(
- sci_remote_segment_t segment,
- sci_error_t *status,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P R E M O T E S E G M E N T *
- * *
- * This function is used to include a shared memory segment in the virtual *
- * address space of the application. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_SHARED_MAP - The low level physical map may be shared by *
- * other applications. *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR - Map at the suggested virtual address *
- * SCI_FLAG_READONLY_MAP - The segment is mapped in read-only mode *
- * SCI_FLAG_LOCK_OPERATION - Enable Lock operations (fetch and add) *
- * SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP *
- * - Enable aggressive prefetch with speculative *
- * hold. *
- * *
- * SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP *
- * - The PSB66 will prefetch 64 bytes. As soon *
- * as the PCI read retry has been accepted, *
- * the stream will change state to FREE, even *
- * if less than 64 bytes were actually read. *
- * *
- * SCI_FLAG_IO_MAP_IOSPACE - Enable No Prefetch, no speculative hold. *
- * *
- * SCI_FLAG_DMOVE_MAP - Enable DMOVE packet type. The stream will be *
- * set into FREE state immediately. *
- * *
- * SCI_FLAG_WRITES_DISABLE_GATHER_MAP *
- * - Disable use of gather. *
- * *
- * SCI_FLAG_DISABLE_128_BYTES_PACKETS *
- * - Disable use of 128-Byte packets *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an atomic "fetch-and-add-one" operation on *
- * remote memory, but in addition an interrupt *
- * will be generated if the target memory *
- * location contained a "null value" before the *
- * add operation was carried out. *
- * The conditional interrupt flag must also be *
- * specified in the SCIRegisterInterruptFlag() *
- * function. *
- * *
- * SCI_FLAG_UNCONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an interrupt for the remote adapter *
- * "in addition to" updating the corresponding *
- * remote memory location with the data being *
- * written. *
- * The unconditional interrupt flag must also *
- * be specified in the *
- * SCIRegisterInterruptFlag() function. *
- * *
- * SCI_FLAG_WRITE_BACK_CACHE_MAP *
- * - Enable cacheing of the mapped region. *
- * Writes through this map will be written to a *
- * write back cache, hence no remote SCI updates*
- * until the cache line is flushed. The *
- * application is responsible for the cache *
- * flush operation. *
- * The SCImemCopy() function will handle this *
- * correctly by doing cache flushes internally. *
- * This feature is architechture dependent and *
- * not be available on all plattforms. *
- * *
- * SCI_FLAG_NO_MEMORY_LOOPBACK_MAP *
- * - Forces a map to a remote segment located *
- * in the local machine to be mapped using *
- * SCI loopback. This is useful i.e. if you *
- * want to use a regular map access to be *
- * serialized with lock operations. *
- * The default behaviour is to access a remte *
- * segment located in the local machine as a *
- * local MMU operation. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapRemoteSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapRemoteSegment)
-DLL volatile void *SCIMapRemoteSegment(
- sci_remote_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P L O C A L S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR *
- * SCI_FLAG_READONLY_MAP *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapLocalSegment)
-DLL void *SCIMapLocalSegment(sci_local_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I U N M A P S E G M E N T *
- * *
- * This function unmaps pages of shared memory from the callers virtual *
- * address space. *
- * *
- * Flags *
- * None. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The map is currently in use. *
- * *
- *********************************************************************************/
-#define SCIUnmapSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIUnmapSegment)
-DLL void SCIUnmapSegment(sci_map_t map,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E S E G M E N T *
- * *
- * Make the specified segment available for connections via the specified *
- * adapter. If successful, the segment can be accessed from remote nodes *
- * via the specified adapter. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events *
- * on this segment. *
- * SCI_FLAG_EMPTY - No memory will be allocated for the segment. *
- * SCI_FLAG_PRIVATE - The segment will be private meaning it will never *
- * be any connections to it. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SEGMENTID_USED - The segment with this segmentId is already used *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * *
- *********************************************************************************/
-#define SCICreateSegment _SISCI_EXPANDE_FUNCTION_NAME(SCICreateSegment)
-DLL void SCICreateSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R L O C A L S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du to a *
- * SCIRemoveSegment() on the same handle. *
- * The handle is invalid when this error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForLocalSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForLocalSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForLocalSegmentEvent(
- sci_local_segment_t segment,
- unsigned int *sourcenodeId,
- unsigned int *localAdapterNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P R E P A R E S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_SOURCE_ONLY - The segment will be used as a source segment *
- * for DMA operations. On some system types this *
- * will enable the SISCI driver to use performance *
- * improving features. *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIPrepareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIPrepareSegment)
-DLL void SCIPrepareSegment(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E G M E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - Unable to remove the segment. The segment is currently *
- * in use. *
- * *
- *********************************************************************************/
-#define SCIRemoveSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSegment)
-DLL void SCIRemoveSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T A V A I L A B L E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The segment has not been prepared for access *
- * from this adapter. *
- * SCI_ERR_ILLEGAL_OPERATION - The segment is created with the *
- * SCI_FLAG_PRIVATE flag specified and *
- * therefore has no segmentId. *
- * *
- *********************************************************************************/
-#define SCISetSegmentAvailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentAvailable)
-DLL void SCISetSegmentAvailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T U N A V A I L A B L E *
- * *
- * Flags *
- * *
- * SCI_FLAG_FORCE_DISCONNECT *
- * SCI_FLAG_NOTIFY *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * *
- *********************************************************************************/
-#define SCISetSegmentUnavailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentUnavailable)
-DLL void SCISetSegmentUnavailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E M A P S E Q U E N C E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_FAST_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateMapSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICreateMapSequence)
-DLL void SCICreateMapSequence(sci_map_t map,
- sci_sequence_t *sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E Q U E N C E *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSequence)
-DLL void SCIRemoveSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T A R T S E Q U E N C E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIStartSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIStartSequence)
-DLL sci_sequence_status_t SCIStartSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I C H E C K S E Q U E N CE *
- * *
- * Flags *
- * *
- * SCI_FLAG_NO_FLUSH *
- * SCI_FLAG_NO_STORE_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICheckSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICheckSequence)
-DLL sci_sequence_status_t SCICheckSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T O R E B A R R I E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * *
- *********************************************************************************/
-#define SCIStoreBarrier _SISCI_EXPANDE_FUNCTION_NAME(SCIStoreBarrier)
-DLL void SCIStoreBarrier(sci_sequence_t sequence,
- unsigned int flags);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H R E A D B U F F E R S *
- * *
- *********************************************************************************/
-#define SCIFlushReadBuffers _SISCI_EXPANDE_FUNCTION_NAME(SCIFlushReadBuffers)
-DLL void SCIFlushReadBuffers(sci_sequence_t sequence);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P R O B E N O D E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIProbeNode _SISCI_EXPANDE_FUNCTION_NAME(SCIProbeNode)
-DLL int SCIProbeNode(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int nodeId,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIGetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCIGetCSRRegister)
-DLL unsigned int SCIGetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCISetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCISetCSRRegister)
-DLL void SCISetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I G E T L O C A L C S R *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIGetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCIGetLocalCSR)
-DLL unsigned int SCIGetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T L O C A L C S R *
- * *
- * SISCI Priveleged function
- *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCISetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCISetLocalCSR)
-DLL void SCISetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A T T A C H P H Y S I C A L M E M O R Y *
- * *
- * SISCI Priveleged function *
- * *
- * Description: *
- * *
- * This function enables usage of physical devices and memory regions where the *
- * Physical PCI bus address ( and mapped CPU address ) are already known. *
- * The function will register the physical memory as a SISCI segment which can *
- * be connected and mapped as a regular SISCI segment. *
- * *
- * Requirements: *
- * *
- * SCICreateSegment() with flag SCI_FLAG_EMPTY must have been called in advance *
- * *
- * Parameter description: *
- * sci_ioaddr_t ioaddress : This is the address on the PCI bus that a PCI bus *
- * master has to use to write to the specified memory *
- * void * address : This is the (mapped) virtual address that the *
- * application has to use to access the device. *
- * This means that the device has to be mapped in *
- * advance bye the devices own driver. *
- * If the device is not to be accessed by the local *
- * CPU, the address pointer shold be set to NULL *
- * Flags *
- * *
- * None *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIAttachPhysicalMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachPhysicalMemory)
-DLL void SCIAttachPhysicalMemory(sci_ioaddr_t ioaddress,
- void *address,
- unsigned int busNo,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I Q U E R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_QUERY - Unrecognized command. *
- * *
- *********************************************************************************/
-#define SCIQuery _SISCI_EXPANDE_FUNCTION_NAME(SCIQuery)
-DLL void SCIQuery(unsigned int command,
- void *data,
- unsigned int flags,
- sci_error_t *error);
-
-
-/* MAJOR QUERY COMMANDS */
-
-/* This command requires a pointer to a structure of type */
-/* "sci_query_string". The string will be filled in by the query. */
-#define SCI_Q_VENDORID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_VENDORID)
-extern const unsigned int SCI_Q_VENDORID;
-
-
-/* Same as for SCI_VENDOR_ID */
-#define SCI_Q_API _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_API)
-extern const unsigned int SCI_Q_API;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_adapter" struct. */
-#define SCI_Q_ADAPTER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER)
-extern const unsigned int SCI_Q_ADAPTER;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_system" struct. */
-#define SCI_Q_SYSTEM _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM)
-extern const unsigned int SCI_Q_SYSTEM;
-
-#define SCI_Q_LOCAL_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT;
-
-#define SCI_Q_REMOTE_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT;
-
-#define SCI_Q_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP)
-extern const unsigned int SCI_Q_MAP;
-
-typedef struct {
- char *str; /* Pointer to a string of minimum "length" characters */
- unsigned int length;
-} sci_query_string_t;
-
-
-typedef struct {
- unsigned int localAdapterNo; /* The adapter no. that the query concern. */
- unsigned int portNo; /* The SCI Link port number that the query concern. */
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_adapter_t;
-
-
-typedef struct {
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_system_t;
-
-typedef struct {
- sci_local_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_local_segment_t;
-
-typedef struct {
- sci_remote_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_remote_segment_t;
-
-typedef struct {
- sci_map_t map;
- unsigned int subcommand;
- unsigned int data;
-} sci_query_map_t;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_ADAPTER */
-#define SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_MTU _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_MTU)
-extern const unsigned int SCI_Q_ADAPTER_DMA_MTU;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE;
-
-#define SCI_Q_ADAPTER_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_NODEID;
-
-#define SCI_Q_ADAPTER_SERIAL_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SERIAL_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_SERIAL_NUMBER;
-
-#define SCI_Q_ADAPTER_CARD_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CARD_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_CARD_TYPE;
-
-#define SCI_Q_ADAPTER_NUMBER_OF_STREAMS _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER_OF_STREAMS)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER_OF_STREAMS;
-
-#define SCI_Q_ADAPTER_STREAM_BUFFER_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_STREAM_BUFFER_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_STREAM_BUFFER_SIZE;
-
-#define SCI_Q_ADAPTER_CONFIGURED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONFIGURED)
-extern const unsigned int SCI_Q_ADAPTER_CONFIGURED;
-
-#define SCI_Q_ADAPTER_LINK_OPERATIONAL _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LINK_OPERATIONAL)
-extern const unsigned int SCI_Q_ADAPTER_LINK_OPERATIONAL;
-
-#define SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK)
-extern const unsigned int SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK;
-
-#define SCI_Q_ADAPTER_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER;
-
-#define SCI_Q_ADAPTER_INSTANCE_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_INSTANCE_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_INSTANCE_NUMBER;
-
-#define SCI_Q_ADAPTER_FIRMWARE_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_FIRMWARE_OK)
-extern const unsigned int SCI_Q_ADAPTER_FIRMWARE_OK;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_SWITCH _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_SWITCH)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_SWITCH;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT;
-
-#define SCI_Q_ADAPTER_ATT_PAGE_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_PAGE_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_ATT_PAGE_SIZE;
-
-#define SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES;
-
-#define SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES;
-
-#define SCI_Q_ADAPTER_PHYS_MEM_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MEM_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MEM_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_MBX_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MBX_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MBX_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID;
-
-#define SCI_Q_ADAPTER_SCI_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SCI_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_SCI_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_B_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_B_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_B_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_IO_BUS_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_IO_BUS_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_IO_BUS_FREQUENCY;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_SYSTEM */
-#define SCI_Q_SYSTEM_HOSTBRIDGE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_HOSTBRIDGE)
-extern const unsigned int SCI_Q_SYSTEM_HOSTBRIDGE;
-
-#define SCI_Q_SYSTEM_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_POSTING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_POSTING_ENABLED;
-
-#define SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED;
-
-#define SCI_Q_LOCAL_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT_IOADDR;
-
-#define SCI_Q_REMOTE_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT_IOADDR;
-
-#define SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET;
-
-#define SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET;
-
-#define HOSTBRIDGE_NOT_AVAILABLE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_NOT_AVAILABLE)
-extern const unsigned int HOSTBRIDGE_NOT_AVAILABLE;
-
-#define HOSTBRIDGE_UNKNOWN _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_UNKNOWN)
-extern const unsigned int HOSTBRIDGE_UNKNOWN;
-
-#define HOSTBRIDGE_440FX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440FX)
-extern const unsigned int HOSTBRIDGE_440FX;
-
-#define HOSTBRIDGE_440LX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440LX)
-extern const unsigned int HOSTBRIDGE_440LX;
-
-#define HOSTBRIDGE_440BX_A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_A)
-extern const unsigned int HOSTBRIDGE_440BX_A;
-
-#define HOSTBRIDGE_440BX_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_B)
-extern const unsigned int HOSTBRIDGE_440BX_B;
-
-#define HOSTBRIDGE_440GX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440GX)
-extern const unsigned int HOSTBRIDGE_440GX;
-
-#define HOSTBRIDGE_450KX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450KX)
-extern const unsigned int HOSTBRIDGE_450KX;
-
-#define HOSTBRIDGE_430NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_430NX)
-extern const unsigned int HOSTBRIDGE_430NX;
-
-#define HOSTBRIDGE_450NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX)
-extern const unsigned int HOSTBRIDGE_450NX;
-
-#define HOSTBRIDGE_450NX_MICO _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_MICO)
-extern const unsigned int HOSTBRIDGE_450NX_MICO;
-
-#define HOSTBRIDGE_450NX_PXB _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_PXB)
-extern const unsigned int HOSTBRIDGE_450NX_PXB;
-
-#define HOSTBRIDGE_I810 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810)
-extern const unsigned int HOSTBRIDGE_I810;
-
-#define HOSTBRIDGE_I810_DC100 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810_DC100)
-extern const unsigned int HOSTBRIDGE_I810_DC100;
-
-#define HOSTBRIDGE_I810E _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810E)
-extern const unsigned int HOSTBRIDGE_I810E;
-
-#define HOSTBRIDGE_I815 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I815)
-extern const unsigned int HOSTBRIDGE_I815;
-
-#define HOSTBRIDGE_I840 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I840)
-extern const unsigned int HOSTBRIDGE_I840;
-
-#define HOSTBRIDGE_I850 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I850)
-extern const unsigned int HOSTBRIDGE_I850;
-
-#define HOSTBRIDGE_I860 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I860)
-extern const unsigned int HOSTBRIDGE_I860;
-
-#define HOSTBRIDGE_INTEL_E7500 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_INTEL_E7500)
-extern const unsigned int HOSTBRIDGE_INTEL_E7500;
-
-#define HOSTBRIDGE_VIA_KT133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KT133)
-extern const unsigned int HOSTBRIDGE_VIA_KT133;
-
-#define HOSTBRIDGE_VIA_KX133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KX133)
-extern const unsigned int HOSTBRIDGE_VIA_KX133;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_133A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_133A)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_133A;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_266 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_266)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_266;
-
-#define HOSTBRIDGE_AMD_760_MP _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_760_MP)
-extern const unsigned int HOSTBRIDGE_AMD_760_MP;
-
-#define HOSTBRIDGE_AMD_HAMMER _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_HAMMER)
-extern const unsigned int HOSTBRIDGE_AMD_HAMMER;
-
-#define HOSTBRIDGE_SERVERWORKS_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE;
-
-#define HOSTBRIDGE_SERVERWORKS_HE_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE_B)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE_B;
-
-#define HOSTBRIDGE_SERVERWORKS_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_LE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_LE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_HE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_HE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_LE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_LE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_WS _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_WS)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_WS;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_SL _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_SL)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_SL;
-
-
-#define HOSTBRIDGE_WRITE_POSTING_DISABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_DISABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_DISABLED;
-
-#define HOSTBRIDGE_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_ENABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_ENABLED;
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E D M A Q U E U E *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_PHDMA : Create physical DMA queue. Please note that this is an *
- * priveleged operation. *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCICreateDMAQueue)
-DLL void SCICreateDMAQueue(sci_desc_t sd,
- sci_dma_queue_t *dq,
- unsigned int localAdapterNo,
- unsigned int maxEntries,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Not allowed in this queue state. *
- * *
- *********************************************************************************/
-#define SCIRemoveDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveDMAQueue)
-DLL void SCIRemoveDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I E N Q U E U E D M A T R A N S F E R *
- * *
- * Flags: *
- * *
- * SCI_FLAG_DMA_READ - The DMA will be remote --> local *
- * (default is local --> remote) *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is larger *
- * than the segment size or larger than max *
- * DMA size. *
- * SCI_ERR_MAX_ENTRIES - The DMA queue is full *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The local segment has not been prepared for *
- * access from the adapter associated with the *
- * queue. *
- * SCI_ERR_SEGMENT_NOT_CONNECTED - The remote segment is not connected through *
- * the adapter associated with the queue. *
- *********************************************************************************/
-#define SCIEnqueueDMATransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIEnqueueDMATransfer)
-DLL sci_dma_queue_state_t SCIEnqueueDMATransfer(sci_dma_queue_t dq,
- sci_local_segment_t localSegment,
- sci_remote_segment_t remoteSegment,
- unsigned int localOffset,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P O S T D M A Q U E U E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The end of the transfer will cause the callback *
- * function to be invoked. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIPostDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIPostDMAQueue)
-DLL void SCIPostDMAQueue(sci_dma_queue_t dq,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortDMAQueue)
-DLL void SCIAbortDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I R E S E T D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIResetDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIResetDMAQueue)
-DLL void SCIResetDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I D M A Q U E U E S T A T E *
- * *
- *********************************************************************************/
-#define SCIDMAQueueState _SISCI_EXPANDE_FUNCTION_NAME(SCIDMAQueueState)
-DLL sci_dma_queue_state_t SCIDMAQueueState(sci_dma_queue_t dq);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForDMAQueue)
-DLL sci_dma_queue_state_t SCIWaitForDMAQueue(sci_dma_queue_t dq,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P H D M A E N Q U E U E *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_READ *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaEnqueue _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaEnqueue)
-DLL void SCIphDmaEnqueue(sci_dma_queue_t dmaqueue,
- unsigned int size,
- sci_ioaddr_t localBusAddr,
- unsigned int remote_nodeid,
- unsigned int remote_highaddr,
- unsigned int remote_lowaddr,
- unsigned int flags,
- sci_error_t *error);
-
-/*********************************************************************************
- * *
- * S C I P H D M A S T A R T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_WAIT *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_DMA_RESET *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaStart _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaStart)
-DLL sci_dma_queue_state_t SCIphDmaStart(sci_dma_queue_t dmaqueue,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-/*********************************************************************************
- * *
- * S C I C R E A T E I N T E R R U P T *
- * *
- * Flags *
- * *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_FIXED_INTNO *
- * SCI_FLAG_SHARED_INT *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INTNO_USED - This interrupt number is already used. *
- * *
- *********************************************************************************/
-#define SCICreateInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateInterrupt)
-DLL void SCICreateInterrupt(sci_desc_t sd,
- sci_local_interrupt_t *interrupt,
- unsigned int localAdapterNo,
- unsigned int *interruptNo,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveInterrupt)
-DLL void SCIRemoveInterrupt(sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait was interrupted by a call to *
- * SCIRemoveInterrupt. *
- * The handle is invalid when this error code is returned.*
- * *
- *********************************************************************************/
-#define SCIWaitForInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForInterrupt)
-DLL void SCIWaitForInterrupt(sci_local_interrupt_t interrupt,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_INTNO - No such interrupt number. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIConnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectInterrupt)
-DLL void SCIConnectInterrupt(sci_desc_t sd,
- sci_remote_interrupt_t *interrupt,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- unsigned int interruptNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisconnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectInterrupt)
-DLL void SCIDisconnectInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R I G G E R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCITriggerInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCITriggerInterrupt)
-DLL void SCITriggerInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R I N T E R R U P T F L A G *
- * *
- * *
- * This function register an "interrupt flag" that is identified as an unique *
- * location within a local segment. If successful, the resulting interrupt *
- * handle will have been associated with the specified local segment. *
- * *
- * It is up to the (remote) client(s) to set up an "interrupt mapping" for the *
- * corresponding segment offset using either the *
- * *
- * - SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * *
- * or the *
- * *
- * - SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP *
- * *
- * option to "SCIMapRemoteSegment()". - I.e. after having established a *
- * connection to the corresponding segment. A trigger operation can then *
- * be implemented using a store operation via the relevant "interrupt map". *
- * *
- * *
- * *
- * *
- * *
- * Flags: *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT - Triggering is to take place using *
- * "conditional interrupts". *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * None. *
- * *
- *********************************************************************************/
-#define SCIRegisterInterruptFlag _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterInterruptFlag)
-DLL void SCIRegisterInterruptFlag(
- unsigned int localAdapterNo,
- sci_local_interrupt_t *interrupt,
- sci_local_segment_t segment,
- unsigned int offset,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I E N A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * This function make sure that another HW interrupt will take place the next *
- * time the corresponding interrupt flag is triggered by a *
- * "conditional interrupt" operation. *
- * *
- * Default semantics: *
- * *
- * When successful, the client can rely on that the first subsequent trigger *
- * operation will cause a HW interrupt and subsequently cause the client *
- * handler function to be invoked. *
- * *
- * If an interrupt was triggered in parallell with the enable operation, then *
- * the operation will fail (SCI_ERR_COND_INT_RACE_PROBLEM), and the client can *
- * not rely on another trigger operation will lead to handler invocation. *
- * Hence, any state checking normally associated with handling the *
- * corresponding interrupt should take place before attempting to enable *
- * again. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_COND_INT_RACE_PROBLEM - The enable operation failed because an *
- * incomming trigger operation happened *
- * concurrently. *
- * *
- *********************************************************************************/
-#define SCIEnableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIEnableConditionalInterrupt)
-DLL void SCIEnableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I D I S A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * Prevent subsequent "conditional interrupt"trigger operations for *
- * the specified interupt flag from causing HW interrupt and handler *
- * invocations. *
- * *
- * *
- * Default semantics: *
- * *
- * If successful, no subsequent HW interrupts will take place, but handler *
- * invocations that have already been scheduled may still take place. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisableConditionalInterrupt)
-DLL void SCIDisableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C O N D I T I O N A L I N T E R R U P T C O U N T E R *
- * *
- * *
- * Returns a value that indicates the number of times this flag has *
- * been trigged since the last time it was enabled or disabled. *
- * Calling the SCIEnableConditionalInterrupt / SCIDisableConditionalInterrupt *
- * functions will reset the counter value. *
- * *
- * Default semantics: *
- * *
- * If successful, the current trig count is returned in the *
- * interruptTrigCounter parameter. *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OVERFLOW - The number of trig operations have exceeded the range *
- * that can be counted. *
- *********************************************************************************/
-#define SCIGetConditionalInterruptTrigCounter _SISCI_EXPANDE_FUNCTION_NAME(SCIGetConditionalInterruptTrigCounter)
-DLL void SCIGetConditionalInterruptTrigCounter(
- sci_local_interrupt_t interrupt,
- unsigned int *interruptTrigCounter,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlock _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlock)
-DLL void SCITransferBlock(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K A S Y N C *
- * *
- * Flags *
- * *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_USE_CALLBACK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger than *
- * the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlockAsync _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlockAsync)
-DLL void SCITransferBlockAsync(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- sci_block_transfer_t *block,
- sci_cb_block_transfer_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForBlockTransfer)
-DLL void SCIWaitForBlockTransfer(sci_block_transfer_t block,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortBlockTransfer)
-DLL void SCIAbortBlockTransfer(sci_block_transfer_t block,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-#define SCIMemCpy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCpy)
-DLL void SCIMemCpy(sci_sequence_t sequence,
- void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C O P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-
-#define SCIMemCopy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCopy)
-DLL void SCIMemCopy(void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R S E G M E N T M E M O R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_ILLEGAL_ADDRESS - Illegal address. *
- * SCI_ERR_OUT_OF_RANGE - Size is larger than the maximum size for the *
- * local segment. *
- * *
- *********************************************************************************/
-#define SCIRegisterSegmentMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterSegmentMemory)
-DLL void SCIRegisterSegmentMemory(void *address,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S C I S P A C E *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * *
- *********************************************************************************/
-#define SCIConnectSCISpace _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSCISpace)
-DLL void SCIConnectSCISpace(sci_desc_t sd,
- unsigned int localAdapterNo,
- sci_remote_segment_t *segment,
- sci_address_t address,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*
- * =====================================================================================
- *
- * S C I A T T A C H L O C A L S E G M E N T
- * Description:
- *
- * SCIAttachLocalSegment() permits an application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events
- * on this segment.
- *
- *
- * Specific error codes for this function:
- *
- * SCI_ERR_ACCESS - No such shared segment
- * SCI_ERR_NO_SUCH_SEGMENT - No such segment
- * Note: Current implenentation will return SCI_ERR_ACCESS for both cases. This will
- * change from next release. Application should handle both cases.
- *
- * =====================================================================================
- */
-#define SCIAttachLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachLocalSegment)
-
-DLL void
-SCIAttachLocalSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int *size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-/*
- * =====================================================================================
- *
- * S C I S H A R E S E G M E N T
- *
- * Description:
- *
- * SCIShareSegment() permits other application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- * none
- *
- * Specific error codes for this function:
- *
- *
- *
- * =====================================================================================
- */
-#define SCIShareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIShareSegment)
-
-DLL void
-SCIShareSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H *
- * *
- * This function will flush the CPU buffers and the PSB buffers. *
- * *
- * Flags *
- * SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY : *
- * Only flush CPU buffers ( Write combining *
- * etc buffers). *
- * *
- *********************************************************************************/
-
-#define SCIFlush _SISCI_EXPANDE_FUNCTION_NAME(SCIFlush)
-DLL void SCIFlush(sci_sequence_t sequence,
- unsigned int flags);
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-}
-#endif
-
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h b/ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h
deleted file mode 100644
index 4284fc5585c..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sisci_demolib.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/* $Id: sisci_demolib.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_DEMOLIB_H
-#define _SISCI_DEMOLIB_H
-
-
-#if defined(_REENTRANT)
-
-#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_MT_ ## name
-
-#else
-
-#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_ST_ ## name
-
-#endif
-
-/*********************************************************************************/
-/* Q U E R Y A D A P T E R */
-/* */
-/*********************************************************************************/
-
-#define QueryAdapter _SISCI_DEMOLIB_EXPAND_NAME(QueryAdapter)
-
-sci_error_t QueryAdapter(
- unsigned int subcommand,
- unsigned int localAdapterNo,
- unsigned int portNo,
- unsigned int *data);
-
-
-/*********************************************************************************/
-/* Q U E R Y S Y S T E M */
-/* */
-/*********************************************************************************/
-
-#define QuerySystem _SISCI_DEMOLIB_EXPAND_NAME(QuerySystem)
-
-sci_error_t QuerySystem(
- unsigned int subcommand,
- unsigned int *data);
-
-
-/*********************************************************************************/
-/* D E T E C T F I R S T A D A P T E R C A R D */
-/* */
-/*********************************************************************************/
-
-#define DetectFirstAdapterCard _SISCI_DEMOLIB_EXPAND_NAME(DetectFirstAdapterCard)
-
-sci_error_t DetectFirstAdapterCard(
- unsigned int *localAdapterNo,
- unsigned int *localNodeId);
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R T Y P E */
-/* */
-/*********************************************************************************/
-
-#define GetAdapterType _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterType)
-
-sci_error_t GetAdapterType(unsigned int localAdapterNo,
- unsigned int *adapterType);
-
-
-/*********************************************************************************/
-/* G E T L O C A L N O D E I D */
-/* */
-/*********************************************************************************/
-
-#define GetLocalNodeId _SISCI_DEMOLIB_EXPAND_NAME(GetLocalNodeId)
-
-sci_error_t GetLocalNodeId(
- unsigned int localAdapterNo,
- unsigned int *localNodeId);
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R S E R I A L N U M B E R */
-/* */
-/*********************************************************************************/
-
-#define GetAdapterSerialNumber _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterSerialNumber)
-
-sci_error_t GetAdapterSerialNumber(
- unsigned int localAdapterNo,
- unsigned int *serialNo);
-
-
-
-/*********************************************************************************/
-/* G E T H O S T B R I D G E T Y P E */
-/* */
-/*********************************************************************************/
-
-#define GetHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(GetHostbridgeType)
-
-sci_error_t GetHostbridgeType(unsigned int *hostbridgeType);
-
-
-
-/*********************************************************************************/
-/* P R I N T H O S T B R I D G E T Y P E */
-/* */
-/*********************************************************************************/
-
-#define PrintHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(PrintHostbridgeType)
-
-void PrintHostbridgeType(unsigned int hostbridge);
-
-
-
-/*********************************************************************************/
-/* G E T A P I V E R S I O N S T R I N G */
-/* */
-/*********************************************************************************/
-
-#define GetAPIVersionString _SISCI_DEMOLIB_EXPAND_NAME(GetAPIVersionString)
-
-sci_error_t GetAPIVersionString(char str[], unsigned int strLength);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R I O B U S F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterIoBusFrequency(unsigned int localAdapterNo,
- unsigned int *ioBusFrequency);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R S C I L I N K F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterSciLinkFrequency(unsigned int localAdapterNo,
- unsigned int *sciLinkFrequency);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R B L I N K F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterBlinkFrequency(unsigned int localAdapterNo,
- unsigned int *bLinkFrequency);
-
-
-/*********************************************************************************/
-/* S E N D I N T E R R U P T */
-/* */
-/*********************************************************************************/
-
-#define SendInterrupt _SISCI_DEMOLIB_EXPAND_NAME(SendInterrupt)
-
-sci_error_t SendInterrupt(
- sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int localNodeId,
- unsigned int remoteNodeId,
- unsigned int interruptNo);
-
-
-/*********************************************************************************/
-/* R E C E I V E I N T E R R U P T */
-/* */
-/*********************************************************************************/
-
-#define ReceiveInterrupt _SISCI_DEMOLIB_EXPAND_NAME(ReceiveInterrupt)
-
-sci_error_t ReceiveInterrupt(
- sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int localNodeId,
- unsigned int interruptNo);
-
-
-/*********************************************************************************/
-/* E N D I A N S W A P */
-/* */
-/*********************************************************************************/
-
-#define EndianSwap _SISCI_DEMOLIB_EXPAND_NAME(EndianSwap)
-
-unsigned int EndianSwap (unsigned int value);
-
-
-/*********************************************************************************/
-/* S L E E P M I L L I S E C O N D S */
-/* */
-/*********************************************************************************/
-
-#define SleepMilliseconds _SISCI_DEMOLIB_EXPAND_NAME(SleepMilliseconds)
-
-void SleepMilliseconds(int milliseconds);
-
-
-
-
-#endif
diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_error.h b/ndb/src/external/LINUX.x86/sci/include/sisci_error.h
deleted file mode 100644
index c53fe8ad5d9..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sisci_error.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $Id: sisci_error.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_ERROR_H_
-#define _SISCI_ERROR_H_
-
-
-/* SCI Error return values always have 30 bit set */
-#define SCI_ERR_MASK 0x40000000
-#define SCI_ERR_REMOTE_MASK 0x01 /* Remote errors should have bit 0 set */
-
-#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF )
-
-/* Error codes */
-typedef enum {
- SCI_ERR_OK = 0x000,
-
-
- SCI_ERR_BUSY = (0x900 | SCI_ERR_MASK),
- SCI_ERR_FLAG_NOT_IMPLEMENTED = (0x901 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_FLAG = (0x902 | SCI_ERR_MASK),
- SCI_ERR_NOSPC = (0x904 | SCI_ERR_MASK),
- SCI_ERR_API_NOSPC = (0x905 | SCI_ERR_MASK),
- SCI_ERR_HW_NOSPC = (0x906 | SCI_ERR_MASK),
- SCI_ERR_NOT_IMPLEMENTED = (0x907 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADAPTERNO = (0x908 | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_ADAPTERNO = (0x909 | SCI_ERR_MASK),
- SCI_ERR_TIMEOUT = (0x90A | SCI_ERR_MASK),
- SCI_ERR_OUT_OF_RANGE = (0x90B | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_SEGMENT = (0x90C | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_NODEID = (0x90D | SCI_ERR_MASK),
- SCI_ERR_CONNECTION_REFUSED = (0x90E | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_CONNECTED = (0x90F | SCI_ERR_MASK),
- SCI_ERR_SIZE_ALIGNMENT = (0x910 | SCI_ERR_MASK),
- SCI_ERR_OFFSET_ALIGNMENT = (0x911 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_PARAMETER = (0x912 | SCI_ERR_MASK),
- SCI_ERR_MAX_ENTRIES = (0x913 | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_PREPARED = (0x914 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADDRESS = (0x915 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_OPERATION = (0x916 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_QUERY = (0x917 | SCI_ERR_MASK),
- SCI_ERR_SEGMENTID_USED = (0x918 | SCI_ERR_MASK),
- SCI_ERR_SYSTEM = (0x919 | SCI_ERR_MASK),
- SCI_ERR_CANCELLED = (0x91A | SCI_ERR_MASK),
- SCI_ERR_NOT_CONNECTED = (0x91B | SCI_ERR_MASK),
- SCI_ERR_NOT_AVAILABLE = (0x91C | SCI_ERR_MASK),
- SCI_ERR_INCONSISTENT_VERSIONS = (0x91D | SCI_ERR_MASK),
- SCI_ERR_COND_INT_RACE_PROBLEM = (0x91E | SCI_ERR_MASK),
- SCI_ERR_OVERFLOW = (0x91F | SCI_ERR_MASK),
- SCI_ERR_NOT_INITIALIZED = (0x920 | SCI_ERR_MASK),
-
- SCI_ERR_ACCESS = (0x921 | SCI_ERR_MASK),
-
- SCI_ERR_NO_SUCH_NODEID = (0xA00 | SCI_ERR_MASK),
- SCI_ERR_NODE_NOT_RESPONDING = (0xA02 | SCI_ERR_MASK),
- SCI_ERR_NO_REMOTE_LINK_ACCESS = (0xA04 | SCI_ERR_MASK),
- SCI_ERR_NO_LINK_ACCESS = (0xA05 | SCI_ERR_MASK),
- SCI_ERR_TRANSFER_FAILED = (0xA06 | SCI_ERR_MASK)
-} sci_error_t;
-
-
-#endif /* _SCI_ERROR_H_ */
-
-
-
diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_types.h b/ndb/src/external/LINUX.x86/sci/include/sisci_types.h
deleted file mode 100644
index f4125fdec69..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sisci_types.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $Id: sisci_types.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_TYPES_H
-#define _SISCI_TYPES_H
-
-#include "sisci_error.h"
-
-#ifndef IN
-#define IN
-#endif
-
-#ifndef OUT
-#define OUT
-#endif
-
-#ifndef IN_OUT
-#define IN_OUT
-#endif
-
-/* Opaque data types for descriptors/handles */
-typedef struct sci_desc *sci_desc_t;
-typedef struct sci_local_segment *sci_local_segment_t;
-typedef struct sci_remote_segment *sci_remote_segment_t;
-
-typedef struct sci_map *sci_map_t;
-typedef struct sci_sequence *sci_sequence_t;
-#ifndef KERNEL
-typedef struct sci_dma_queue *sci_dma_queue_t;
-#endif
-typedef struct sci_remote_interrupt *sci_remote_interrupt_t;
-typedef struct sci_local_interrupt *sci_local_interrupt_t;
-typedef struct sci_block_transfer *sci_block_transfer_t;
-
-/*
- * Constants defining reasons for segment callbacks:
- */
-
-typedef enum {
- SCI_CB_CONNECT = 1,
- SCI_CB_DISCONNECT,
- SCI_CB_NOT_OPERATIONAL,
- SCI_CB_OPERATIONAL,
- SCI_CB_LOST
-} sci_segment_cb_reason_t;
-
-#define MAX_CB_REASON SCI_CB_LOST
-
-/* dma_queue_states is identical to the dma_queue_state_t in genif.h, they must be consistent.*/
-typedef enum {
- SCI_DMAQUEUE_IDLE,
- SCI_DMAQUEUE_GATHER,
- SCI_DMAQUEUE_POSTED,
- SCI_DMAQUEUE_DONE,
- SCI_DMAQUEUE_ABORTED,
- SCI_DMAQUEUE_ERROR
-} sci_dma_queue_state_t;
-
-
-typedef enum {
- SCI_SEQ_OK,
- SCI_SEQ_RETRIABLE,
- SCI_SEQ_NOT_RETRIABLE,
- SCI_SEQ_PENDING
-} sci_sequence_status_t;
-
-
-typedef struct {
- unsigned short nodeId; /* SCI Address bit 63 - 48 */
- unsigned short offsHi; /* SCI Address bit 47 - 32 */
- unsigned int offsLo; /* SCI Address bit 31 - 0 */
-} sci_address_t;
-
-
-typedef unsigned int sci_ioaddr_t;
-
-typedef enum {
- SCI_CALLBACK_CANCEL = 1,
- SCI_CALLBACK_CONTINUE
-} sci_callback_action_t;
-
-#ifndef KERNEL
-typedef sci_callback_action_t (*sci_cb_local_segment_t)(void *arg,
- sci_local_segment_t segment,
- sci_segment_cb_reason_t reason,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- sci_error_t error);
-
-typedef sci_callback_action_t (*sci_cb_remote_segment_t)(void *arg,
- sci_remote_segment_t segment,
- sci_segment_cb_reason_t reason,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_dma_t)(void IN *arg,
- sci_dma_queue_t queue,
- sci_error_t status);
-
-
-typedef int (*sci_cb_block_transfer_t)(void *arg,
- sci_block_transfer_t block,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_interrupt_t)(void *arg,
- sci_local_interrupt_t interrupt,
- sci_error_t status);
-
-#endif /* KERNEL */
-#endif
diff --git a/ndb/src/external/LINUX.x86/sci/include/sisci_version.h b/ndb/src/external/LINUX.x86/sci/include/sisci_version.h
deleted file mode 100644
index f1807c33aa5..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/sisci_version.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $Id: sisci_version.h,v 1.1 2002/12/13 12:17:21 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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 SISCI_VERSION_H
-#define SISCI_VERSION_H
-
-
-#define SISCI_API_VER_MAJOR 0x01
-#define SISCI_API_VER_MAJORC "1"
-
-#define SISCI_API_VER_MINOR 0x010
-#define SISCI_API_VER_MINORC "10"
-#define SISCI_API_VER_MICRO 0x005
-#define SISCI_API_VER_MICROC "5"
-
-#define SISCI_SIGN_VERSION_MASK 0xfffff000 /* used to mask off API_VER_MICRO */
-
-#define SISCI_API_VERSION (SISCI_API_VER_MAJOR << 24 | SISCI_API_VER_MINOR << 12 | SISCI_API_VER_MICRO)
-
-/* the rules are:
- *
- * Changes in API_VER_MICRO should be binary compatible, New flags, functions added. No changes to user code
- * required if new features is not needed.
- *
- * Changes in API_VER_MINOR requires recompilation of user code.
- *
- * Changes in the API_VER_MAJOR will most likely require changes to user code. This should not happen very
- * often...
- *
- */
-
-#ifndef BUILD_DATE
-#define BUILD_DATE __DATE__
-#endif
-
-#ifndef BUILD_NAME
-#define BUILD_NAME ""
-#endif
-
-#define API_VERSION "SISCI API version " SISCI_API_VER_MAJORC "." SISCI_API_VER_MINORC "."SISCI_API_VER_MICROC " ( "BUILD_NAME" "BUILD_DATE" )"
-
-#endif
-
-
-/* Version info: */
-/* */
-/* 1.5.2 First SISCI version */
-/* 1.5.3 Some bug fixes */
-/* 1.5.4 Some bug fixes */
-/* 1.5.5 No release */
-/* 1.5.6 Lock flag implemented in function SCIConnectSegment */
-/* 1.5.7 Expanded query functionality */
-/* 1.5.8 Updated error checking (sequence) functionality for D320 */
-/* 1.6.0 Updated error checking (sequence) D320 and IRM 1.9 support */
-/* 1.9.0 Ported to Solaris_sparc, Solaris_x86 and Linux. IRM 1.9. */
-/* 1.9.1 Some bug fixes */
-/* 1.9.2 Added more adapter queries */
-/* 1.9.3 Bug fix in SCIMapLocalSegment and SCIMapRemoteSegment */
-/* 1.9.4 NT Release Developers Kit 2.40 */
-/* 1.9.5 Added flush after data transfer in SCIMemCopy() */
-/* 1.9.5 NT Release Developers Kit 2.44 */
-/* 1.10.0:
- * New SCIInitialize(), SCITerminate() functions.
- * Support for D330
- *
- *
- */
-
-
diff --git a/ndb/src/external/LINUX.x86/sci/include/version.h b/ndb/src/external/LINUX.x86/sci/include/version.h
deleted file mode 100644
index a0e1fa6c5cd..00000000000
--- a/ndb/src/external/LINUX.x86/sci/include/version.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _VERSION_H
-#define _VERSION_H
-
-
-/*
-#define DEMO_VER_MAJOR "1"
-#define DEMO_VER_MINOR "5"
-#define DEMO_VER_MICRO "0"
-*/
-
-#ifndef BUILD_DATE
-#define BUILD_DATE __DATE__
-#endif
-
-#ifndef BUILD_NAME
-#define BUILD_NAME ""
-#endif
-
-/*
-#define DEMO_VERSION "version " DEMO_VER_MAJOR "." DEMO_VER_MINOR "."DEMO_VER_MICRO " ("BUILD_NAME" "BUILD_DATE" )"
-*/
-#define DEMO_VERSION " ("BUILD_NAME" "BUILD_DATE" )"
-
-
-#endif
diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h
deleted file mode 100644
index d02d3aafe7f..00000000000
--- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_api.h
+++ /dev/null
@@ -1,2148 +0,0 @@
-/* $Id: sisci_api.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2001 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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 _SISCI_API_H
-#define _SISCI_API_H
-
-#include "sisci_types.h"
-#include "sisci_error.h"
-
-
-#ifdef WIN32
-#ifdef API_DLL
-#define DLL __declspec(dllexport)
-#elif CLIENT_DLL
-#define DLL __declspec(dllimport)
-#endif
-#endif /* WIN32 */
-
-
-#ifndef DLL
-#define DLL
-#endif
-
-#if defined(_REENTRANT)
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_MT_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_MT_ ## name
-#else
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_ST_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_ST_ ## name
-#endif
-#define _SISCI_EXPANDE_CONSTANT_NAME(name) _SISCI_PUBLIC_CONST_ ## name
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-extern "C" {
-#endif
-
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define SCI_FLAG_FIXED_INTNO _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_INTNO)
-extern const unsigned int SCI_FLAG_FIXED_INTNO;
-
-#define SCI_FLAG_SHARED_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_INT)
-extern const unsigned int SCI_FLAG_SHARED_INT;
-
-#define SCI_FLAG_FIXED_MAP_ADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_MAP_ADDR)
-extern const unsigned int SCI_FLAG_FIXED_MAP_ADDR;
-
-#define SCI_FLAG_READONLY_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READONLY_MAP)
-extern const unsigned int SCI_FLAG_READONLY_MAP;
-
-#define SCI_FLAG_USE_CALLBACK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_USE_CALLBACK)
-extern const unsigned int SCI_FLAG_USE_CALLBACK;
-
-#define SCI_FLAG_BLOCK_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_BLOCK_READ)
-extern const unsigned int SCI_FLAG_BLOCK_READ;
-
-#define SCI_FLAG_THREAD_SAFE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_THREAD_SAFE)
-extern const unsigned int SCI_FLAG_THREAD_SAFE;
-
-#define SCI_FLAG_ASYNCHRONOUS_CONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ASYNCHRONOUS_CONNECT)
-extern const unsigned int SCI_FLAG_ASYNCHRONOUS_CONNECT;
-
-#define SCI_FLAG_EMPTY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_EMPTY)
-extern const unsigned int SCI_FLAG_EMPTY;
-
-#define SCI_FLAG_PRIVATE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_PRIVATE)
-extern const unsigned int SCI_FLAG_PRIVATE;
-
-#define SCI_FLAG_FORCE_DISCONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FORCE_DISCONNECT)
-extern const unsigned int SCI_FLAG_FORCE_DISCONNECT;
-
-#define SCI_FLAG_NOTIFY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NOTIFY)
-extern const unsigned int SCI_FLAG_NOTIFY;
-
-#define SCI_FLAG_DMA_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_READ)
-extern const unsigned int SCI_FLAG_DMA_READ;
-
-#define SCI_FLAG_DMA_POST _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_POST)
-extern const unsigned int SCI_FLAG_DMA_POST;
-
-#define SCI_FLAG_DMA_WAIT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_WAIT)
-extern const unsigned int SCI_FLAG_DMA_WAIT;
-
-#define SCI_FLAG_DMA_RESET _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_RESET)
-extern const unsigned int SCI_FLAG_DMA_RESET;
-
-#define SCI_FLAG_NO_FLUSH _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_FLUSH)
-extern const unsigned int SCI_FLAG_NO_FLUSH;
-
-#define SCI_FLAG_NO_STORE_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_STORE_BARRIER)
-extern const unsigned int SCI_FLAG_NO_STORE_BARRIER;
-
-#define SCI_FLAG_FAST_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FAST_BARRIER)
-extern const unsigned int SCI_FLAG_FAST_BARRIER;
-
-#define SCI_FLAG_ERROR_CHECK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ERROR_CHECK)
-extern const unsigned int SCI_FLAG_ERROR_CHECK;
-
-#define SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-extern const unsigned int SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY;
-
-/* the FLUSH_CPU_BUFFERS_ONLY flag is for backwards compabillity only and should never be used */
-#define FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-
-#define SCI_FLAG_LOCK_OPERATION _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_LOCK_OPERATION)
-extern const unsigned int SCI_FLAG_LOCK_OPERATION;
-
-#define SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP;
-
-#define SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP;
-
-#define SCI_FLAG_IO_MAP_IOSPACE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_IO_MAP_IOSPACE)
-extern const unsigned int SCI_FLAG_IO_MAP_IOSPACE;
-
-#define SCI_FLAG_DMOVE_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMOVE_MAP)
-extern const unsigned int SCI_FLAG_DMOVE_MAP;
-
-#define SCI_FLAG_WRITES_DISABLE_GATHER_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_WRITES_DISABLE_GATHER_MAP)
-extern const unsigned int SCI_FLAG_WRITES_DISABLE_GATHER_MAP;
-
-#define SCI_FLAG_DISABLE_128_BYTES_PACKETS _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DISABLE_128_BYTES_PACKETS)
-extern const unsigned int SCI_FLAG_DISABLE_128_BYTES_PACKETS;
-
-#define SCI_FLAG_DMA_SOURCE_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_SOURCE_ONLY)
-extern const unsigned int SCI_FLAG_DMA_SOURCE_ONLY;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT_MAP;
-
-#define SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP;
-
-#define SCI_FLAG_NO_MEMORY_LOOPBACK_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_MEMORY_LOOPBACK_MAP)
-extern const unsigned int SCI_FLAG_NO_MEMORY_LOOPBACK_MAP;
-
-#if defined(OS_IS_LYNXOS) || defined(OS_IS_VXWORKS)
-#define SCI_FLAG_WRITE_BACK_CACHE_MAP _SISCI_EXPANDE_CONSTANT_NAME(WRITE_BACK_CACHE_MAP)
-extern const unsigned int SCI_FLAG_WRITE_BACK_CACHE_MAP;
-#endif
-
-#define SCI_FLAG_DMA_PHDMA _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_PHDMA)
-extern const unsigned int SCI_FLAG_DMA_PHDMA;
-
-/*********************************************************************************/
-/* GENERAL VALUES */
-/*********************************************************************************/
-#define SCI_LOCAL_HOST _SISCI_EXPANDE_CONSTANT_NAME(SCI_LOCAL_HOST)
-extern const unsigned int SCI_LOCAL_HOST;
-
-#define SCI_INFINITE_TIMEOUT _SISCI_EXPANDE_CONSTANT_NAME(SCI_INFINITE_TIMEOUT)
-extern const unsigned int SCI_INFINITE_TIMEOUT;
-
-/*********************************************************************************/
-/* GENERAL ERROR CODES */
-/* */
-/* SCI_ERR_ILLEGAL_FLAG - Illegal flag value. */
-/* SCI_ERR_FLAG_NOT_IMPLEMENTED - Flag legal but flag feature not implemented. */
-/* SCI_ERR_NOT_IMPLEMENTED - Function not implemented. */
-/* SCI_ERR_SYSTEM - A system error. Check errno. */
-/* SCI_ERR_NOSPC - Unable to allocate OS resources. */
-/* SCI_ERR_API_NOSPC - Unable to allocate API resources. */
-/* SCI_ERR_HW_NOSPC - Unable to allocate HW resources (Hardware) */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "ADAPTER" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_ADAPTERNO - Adapter number is legal but does not exist. */
-/* SCI_ERR_ILLEGAL_ADAPTERNO - Illegal local adapter number (i.e. outside */
-/* legal range). */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "NODEID" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_NODEID - The remote adapter identified by nodeId does */
-/* not respond, but the intermediate link(s) */
-/* seem(s) to be operational. */
-/* SCI_ERR_ILLEGAL_NODEID - Illegal NodeId. */
-/* */
-/*********************************************************************************/
-
-
-
-/*********************************************************************************
- * *
- * S C I I N I T I A L I Z E *
- * *
- * This function initializes the SISCI library. *
- * The function must be called before SCIOpen(). *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCIInitialize _SISCI_EXPANDE_FUNCTION_NAME(SCIInitialize)
-DLL void SCIInitialize(unsigned int flags,
- sci_error_t *error);
-#if 0
-unsigned int __Internal_SISCI_version_var;
-#endif
-
-/*********************************************************************************
- * *
- * S C I T E R M I N A T E *
- * *
- * This function terminates the SISCI library. *
- * The function must be called after SCIClose(). *
- * *
- * *
- *********************************************************************************/
-#define SCITerminate _SISCI_EXPANDE_FUNCTION_NAME(SCITerminate)
-DLL void SCITerminate(void);
-
-/*********************************************************************************
- * *
- * S C I O P E N *
- * *
- * *
- * Opens a SCI virtual device. *
- * Caller must supply a pointer to a variable of type sci_desc_t to be *
- * initialized. *
- * *
- * Flags *
- * SCI_FLAG_THREAD_SAFE - Operations on resources associated with this *
- * descriptor will be performed in a multithread-safe *
- * manner. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INCONSISTENT_VERSIONS - Inconsistency between the SISCI library *
- * and the SISCI driver versions. *
- * *
- * *
- *********************************************************************************/
-#define SCIOpen _SISCI_EXPANDE_FUNCTION_NAME(SCIOpen)
-DLL void SCIOpen(sci_desc_t *sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C L O S E *
- * *
- * This function closes an open SCI virtual device. *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - All resources are not deallocated. *
- * *
- *********************************************************************************/
-#define SCIClose _SISCI_EXPANDE_FUNCTION_NAME(SCIClose)
-DLL void SCIClose(sci_desc_t sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S E G M E N T *
- * *
- * Connects to a remote shared memory segment located at <nodeId> with the *
- * identifier <segmentId>. *
- * The user may then call SCIMapRemoteSegment() to map shared memory *
- * into user space. *
- * *
- * Flags *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_ASYNCHRONOUS_CONNECT *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_SEGMENT - Could not find the remote segment with the *
- * given segmentId. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIConnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSegment)
-DLL void SCIConnectSegment(sci_desc_t sd,
- sci_remote_segment_t *segment,
- unsigned int nodeId,
- unsigned int segmentId,
- unsigned int localAdapterNo,
- sci_cb_remote_segment_t callback,
- void *callbackArg,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T S E G M E N T *
- * *
- * Disconnects from the give mapped shared memory segment *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The segment is currently mapped or in use. *
- * *
- *********************************************************************************/
-#define SCIDisconnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectSegment)
-DLL void SCIDisconnectSegment(sci_remote_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T R E M O T E S E G M E N T S I Z E *
- * *
- *********************************************************************************/
-#define SCIGetRemoteSegmentSize _SISCI_EXPANDE_FUNCTION_NAME(SCIGetRemoteSegmentSize)
-DLL unsigned int SCIGetRemoteSegmentSize(sci_remote_segment_t segment);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R R E M O T E S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du *
- * to a SCIDisconnectSegment() on the same *
- * handle. The handle is invalid when this *
- * error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForRemoteSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForRemoteSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForRemoteSegmentEvent(
- sci_remote_segment_t segment,
- sci_error_t *status,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P R E M O T E S E G M E N T *
- * *
- * This function is used to include a shared memory segment in the virtual *
- * address space of the application. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR - Map at the suggested virtual address *
- * SCI_FLAG_READONLY_MAP - The segment is mapped in read-only mode *
- * SCI_FLAG_LOCK_OPERATION - Enable Lock operations (fetch and add) *
- * SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP *
- * - Enable aggressive prefetch with speculative *
- * hold. *
- * *
- * SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP *
- * - The PSB66 will prefetch 64 bytes. As soon *
- * as the PCI read retry has been accepted, *
- * the stream will change state to FREE, even *
- * if less than 64 bytes were actually read. *
- * *
- * SCI_FLAG_IO_MAP_IOSPACE - Enable No Prefetch, no speculative hold. *
- * *
- * SCI_FLAG_DMOVE_MAP - Enable DMOVE packet type. The stream will be *
- * set into FREE state immediately. *
- * *
- * SCI_FLAG_WRITES_DISABLE_GATHER_MAP *
- * - Disable use of gather. *
- * *
- * SCI_FLAG_DISABLE_128_BYTES_PACKETS *
- * - Disable use of 128-Byte packets *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an atomic "fetch-and-add-one" operation on *
- * remote memory, but in addition an interrupt *
- * will be generated if the target memory *
- * location contained a "null value" before the *
- * add operation was carried out. *
- * The conditional interrupt flag must also be *
- * specified in the SCIRegisterInterruptFlag() *
- * function. *
- * *
- * SCI_FLAG_UNCONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an interrupt for the remote adapter *
- * "in addition to" updating the corresponding *
- * remote memory location with the data being *
- * written. *
- * The unconditional interrupt flag must also *
- * be specified in the *
- * SCIRegisterInterruptFlag() function. *
- * *
- * SCI_FLAG_WRITE_BACK_CACHE_MAP *
- * - Enable cacheing of the mapped region. *
- * Writes through this map will be written to a *
- * write back cache, hence no remote SCI updates*
- * until the cache line is flushed. The *
- * application is responsible for the cache *
- * flush operation. *
- * The SCImemCopy() function will handle this *
- * correctly by doing cache flushes internally. *
- * This feature is architechture dependent and *
- * not be available on all plattforms. *
- * *
- * SCI_FLAG_NO_MEMORY_LOOPBACK_MAP *
- * - Forces a map to a remote segment located *
- * in the local machine to be mapped using *
- * SCI loopback. This is useful i.e. if you *
- * want to use a regular map access to be *
- * serialized with lock operations. *
- * The default behaviour is to access a remte *
- * segment located in the local machine as a *
- * local MMU operation. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapRemoteSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapRemoteSegment)
-DLL volatile void *SCIMapRemoteSegment(
- sci_remote_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P L O C A L S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR *
- * SCI_FLAG_READONLY_MAP *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapLocalSegment)
-DLL void *SCIMapLocalSegment(sci_local_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I U N M A P S E G M E N T *
- * *
- * This function unmaps pages of shared memory from the callers virtual *
- * address space. *
- * *
- * Flags *
- * None. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The map is currently in use. *
- * *
- *********************************************************************************/
-#define SCIUnmapSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIUnmapSegment)
-DLL void SCIUnmapSegment(sci_map_t map,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E S E G M E N T *
- * *
- * Make the specified segment available for connections via the specified *
- * adapter. If successful, the segment can be accessed from remote nodes *
- * via the specified adapter. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events *
- * on this segment. *
- * SCI_FLAG_EMPTY - No memory will be allocated for the segment. *
- * SCI_FLAG_PRIVATE - The segment will be private meaning it will never *
- * be any connections to it. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SEGMENTID_USED - The segment with this segmentId is already used *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * *
- *********************************************************************************/
-#define SCICreateSegment _SISCI_EXPANDE_FUNCTION_NAME(SCICreateSegment)
-DLL void SCICreateSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R L O C A L S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du to a *
- * SCIRemoveSegment() on the same handle. *
- * The handle is invalid when this error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForLocalSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForLocalSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForLocalSegmentEvent(
- sci_local_segment_t segment,
- unsigned int *sourcenodeId,
- unsigned int *localAdapterNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P R E P A R E S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_SOURCE_ONLY - The segment will be used as a source segment *
- * for DMA operations. On some system types this *
- * will enable the SISCI driver to use performance *
- * improving features. *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIPrepareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIPrepareSegment)
-DLL void SCIPrepareSegment(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E G M E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - Unable to remove the segment. The segment is currently *
- * in use. *
- * *
- *********************************************************************************/
-#define SCIRemoveSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSegment)
-DLL void SCIRemoveSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T A V A I L A B L E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The segment has not been prepared for access *
- * from this adapter. *
- * SCI_ERR_ILLEGAL_OPERATION - The segment is created with the *
- * SCI_FLAG_PRIVATE flag specified and *
- * therefore has no segmentId. *
- * *
- *********************************************************************************/
-#define SCISetSegmentAvailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentAvailable)
-DLL void SCISetSegmentAvailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T U N A V A I L A B L E *
- * *
- * Flags *
- * *
- * SCI_FLAG_FORCE_DISCONNECT *
- * SCI_FLAG_NOTIFY *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * *
- *********************************************************************************/
-#define SCISetSegmentUnavailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentUnavailable)
-DLL void SCISetSegmentUnavailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E M A P S E Q U E N C E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_FAST_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateMapSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICreateMapSequence)
-DLL void SCICreateMapSequence(sci_map_t map,
- sci_sequence_t *sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E Q U E N C E *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSequence)
-DLL void SCIRemoveSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T A R T S E Q U E N C E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIStartSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIStartSequence)
-DLL sci_sequence_status_t SCIStartSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I C H E C K S E Q U E N CE *
- * *
- * Flags *
- * *
- * SCI_FLAG_NO_FLUSH *
- * SCI_FLAG_NO_STORE_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICheckSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICheckSequence)
-DLL sci_sequence_status_t SCICheckSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T O R E B A R R I E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * *
- *********************************************************************************/
-#define SCIStoreBarrier _SISCI_EXPANDE_FUNCTION_NAME(SCIStoreBarrier)
-DLL void SCIStoreBarrier(sci_sequence_t sequence,
- unsigned int flags);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H R E A D B U F F E R S *
- * *
- *********************************************************************************/
-#define SCIFlushReadBuffers _SISCI_EXPANDE_FUNCTION_NAME(SCIFlushReadBuffers)
-DLL void SCIFlushReadBuffers(sci_sequence_t sequence);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P R O B E N O D E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIProbeNode _SISCI_EXPANDE_FUNCTION_NAME(SCIProbeNode)
-DLL int SCIProbeNode(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int nodeId,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIGetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCIGetCSRRegister)
-DLL unsigned int SCIGetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCISetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCISetCSRRegister)
-DLL void SCISetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I G E T L O C A L C S R *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIGetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCIGetLocalCSR)
-DLL unsigned int SCIGetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T L O C A L C S R *
- * *
- * SISCI Priveleged function
- *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCISetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCISetLocalCSR)
-DLL void SCISetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A T T A C H P H Y S I C A L M E M O R Y *
- * *
- * SISCI Priveleged function *
- * *
- * Description: *
- * *
- * This function enables usage of physical devices and memory regions where the *
- * Physical PCI bus address ( and mapped CPU address ) are already known. *
- * The function will register the physical memory as a SISCI segment which can *
- * be connected and mapped as a regular SISCI segment. *
- * *
- * Requirements: *
- * *
- * SCICreateSegment() with flag SCI_FLAG_EMPTY must have been called in advance *
- * *
- * Parameter description: *
- * sci_ioaddr_t ioaddress : This is the address on the PCI bus that a PCI bus *
- * master has to use to write to the specified memory *
- * void * address : This is the (mapped) virtual address that the *
- * application has to use to access the device. *
- * This means that the device has to be mapped in *
- * advance bye the devices own driver. *
- * If the device is not to be accessed by the local *
- * CPU, the address pointer shold be set to NULL *
- * Flags *
- * *
- * None *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIAttachPhysicalMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachPhysicalMemory)
-DLL void SCIAttachPhysicalMemory(sci_ioaddr_t ioaddress,
- void *address,
- unsigned int busNo,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I Q U E R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_QUERY - Unrecognized command. *
- * *
- *********************************************************************************/
-#define SCIQuery _SISCI_EXPANDE_FUNCTION_NAME(SCIQuery)
-DLL void SCIQuery(unsigned int command,
- void *data,
- unsigned int flags,
- sci_error_t *error);
-
-
-/* MAJOR QUERY COMMANDS */
-
-/* This command requires a pointer to a structure of type */
-/* "sci_query_string". The string will be filled in by the query. */
-#define SCI_Q_VENDORID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_VENDORID)
-extern const unsigned int SCI_Q_VENDORID;
-
-
-/* Same as for SCI_VENDOR_ID */
-#define SCI_Q_API _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_API)
-extern const unsigned int SCI_Q_API;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_adapter" struct. */
-#define SCI_Q_ADAPTER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER)
-extern const unsigned int SCI_Q_ADAPTER;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_system" struct. */
-#define SCI_Q_SYSTEM _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM)
-extern const unsigned int SCI_Q_SYSTEM;
-
-#define SCI_Q_LOCAL_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT;
-
-#define SCI_Q_REMOTE_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT;
-
-#define SCI_Q_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP)
-extern const unsigned int SCI_Q_MAP;
-
-typedef struct {
- char *str; /* Pointer to a string of minimum "length" characters */
- unsigned int length;
-} sci_query_string_t;
-
-
-typedef struct {
- unsigned int localAdapterNo; /* The adapter no. that the query concern. */
- unsigned int portNo; /* The SCI Link port number that the query concern. */
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_adapter_t;
-
-
-typedef struct {
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_system_t;
-
-typedef struct {
- sci_local_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_local_segment_t;
-
-typedef struct {
- sci_remote_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_remote_segment_t;
-
-typedef struct {
- sci_map_t map;
- unsigned int subcommand;
- unsigned int data;
-} sci_query_map_t;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_ADAPTER */
-#define SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_MTU _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_MTU)
-extern const unsigned int SCI_Q_ADAPTER_DMA_MTU;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE;
-
-#define SCI_Q_ADAPTER_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_NODEID;
-
-#define SCI_Q_ADAPTER_SERIAL_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SERIAL_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_SERIAL_NUMBER;
-
-#define SCI_Q_ADAPTER_CARD_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CARD_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_CARD_TYPE;
-
-#define SCI_Q_ADAPTER_NUMBER_OF_STREAMS _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER_OF_STREAMS)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER_OF_STREAMS;
-
-#define SCI_Q_ADAPTER_STREAM_BUFFER_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_STREAM_BUFFER_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_STREAM_BUFFER_SIZE;
-
-#define SCI_Q_ADAPTER_CONFIGURED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONFIGURED)
-extern const unsigned int SCI_Q_ADAPTER_CONFIGURED;
-
-#define SCI_Q_ADAPTER_LINK_OPERATIONAL _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LINK_OPERATIONAL)
-extern const unsigned int SCI_Q_ADAPTER_LINK_OPERATIONAL;
-
-#define SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK)
-extern const unsigned int SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK;
-
-#define SCI_Q_ADAPTER_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER;
-
-#define SCI_Q_ADAPTER_INSTANCE_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_INSTANCE_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_INSTANCE_NUMBER;
-
-#define SCI_Q_ADAPTER_FIRMWARE_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_FIRMWARE_OK)
-extern const unsigned int SCI_Q_ADAPTER_FIRMWARE_OK;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_SWITCH _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_SWITCH)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_SWITCH;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT;
-
-#define SCI_Q_ADAPTER_ATT_PAGE_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_PAGE_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_ATT_PAGE_SIZE;
-
-#define SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES;
-
-#define SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES;
-
-#define SCI_Q_ADAPTER_PHYS_MEM_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MEM_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MEM_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_MBX_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MBX_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MBX_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID;
-
-#define SCI_Q_ADAPTER_SCI_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SCI_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_SCI_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_B_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_B_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_B_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_IO_BUS_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_IO_BUS_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_IO_BUS_FREQUENCY;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_SYSTEM */
-#define SCI_Q_SYSTEM_HOSTBRIDGE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_HOSTBRIDGE)
-extern const unsigned int SCI_Q_SYSTEM_HOSTBRIDGE;
-
-#define SCI_Q_SYSTEM_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_POSTING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_POSTING_ENABLED;
-
-#define SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED;
-
-#define SCI_Q_LOCAL_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT_IOADDR;
-
-#define SCI_Q_REMOTE_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT_IOADDR;
-
-#define SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET;
-
-#define SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET;
-
-#define HOSTBRIDGE_NOT_AVAILABLE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_NOT_AVAILABLE)
-extern const unsigned int HOSTBRIDGE_NOT_AVAILABLE;
-
-#define HOSTBRIDGE_UNKNOWN _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_UNKNOWN)
-extern const unsigned int HOSTBRIDGE_UNKNOWN;
-
-#define HOSTBRIDGE_440FX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440FX)
-extern const unsigned int HOSTBRIDGE_440FX;
-
-#define HOSTBRIDGE_440LX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440LX)
-extern const unsigned int HOSTBRIDGE_440LX;
-
-#define HOSTBRIDGE_440BX_A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_A)
-extern const unsigned int HOSTBRIDGE_440BX_A;
-
-#define HOSTBRIDGE_440BX_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_B)
-extern const unsigned int HOSTBRIDGE_440BX_B;
-
-#define HOSTBRIDGE_440GX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440GX)
-extern const unsigned int HOSTBRIDGE_440GX;
-
-#define HOSTBRIDGE_450KX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450KX)
-extern const unsigned int HOSTBRIDGE_450KX;
-
-#define HOSTBRIDGE_430NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_430NX)
-extern const unsigned int HOSTBRIDGE_430NX;
-
-#define HOSTBRIDGE_450NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX)
-extern const unsigned int HOSTBRIDGE_450NX;
-
-#define HOSTBRIDGE_450NX_MICO _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_MICO)
-extern const unsigned int HOSTBRIDGE_450NX_MICO;
-
-#define HOSTBRIDGE_450NX_PXB _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_PXB)
-extern const unsigned int HOSTBRIDGE_450NX_PXB;
-
-#define HOSTBRIDGE_I810 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810)
-extern const unsigned int HOSTBRIDGE_I810;
-
-#define HOSTBRIDGE_I810_DC100 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810_DC100)
-extern const unsigned int HOSTBRIDGE_I810_DC100;
-
-#define HOSTBRIDGE_I810E _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810E)
-extern const unsigned int HOSTBRIDGE_I810E;
-
-#define HOSTBRIDGE_I815 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I815)
-extern const unsigned int HOSTBRIDGE_I815;
-
-#define HOSTBRIDGE_I840 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I840)
-extern const unsigned int HOSTBRIDGE_I840;
-
-#define HOSTBRIDGE_I850 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I850)
-extern const unsigned int HOSTBRIDGE_I850;
-
-#define HOSTBRIDGE_I860 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I860)
-extern const unsigned int HOSTBRIDGE_I860;
-
-#define HOSTBRIDGE_VIA_KT133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KT133)
-extern const unsigned int HOSTBRIDGE_VIA_KT133;
-
-#define HOSTBRIDGE_VIA_KX133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KX133)
-extern const unsigned int HOSTBRIDGE_VIA_KX133;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_133A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_133A)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_133A;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_266 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_266)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_266;
-
-#define HOSTBRIDGE_AMD_760_MP _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_760_MP)
-extern const unsigned int HOSTBRIDGE_AMD_760_MP;
-
-#define HOSTBRIDGE_SERVERWORKS_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE;
-
-#define HOSTBRIDGE_SERVERWORKS_HE_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE_B)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE_B;
-
-#define HOSTBRIDGE_SERVERWORKS_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_LE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_LE;
-
-
-
-#define HOSTBRIDGE_WRITE_POSTING_DISABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_DISABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_DISABLED;
-
-#define HOSTBRIDGE_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_ENABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_ENABLED;
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E D M A Q U E U E *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_PHDMA : Create physical DMA queue. Please note that this is an *
- * priveleged operation. *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCICreateDMAQueue)
-DLL void SCICreateDMAQueue(sci_desc_t sd,
- sci_dma_queue_t *dq,
- unsigned int localAdapterNo,
- unsigned int maxEntries,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Not allowed in this queue state. *
- * *
- *********************************************************************************/
-#define SCIRemoveDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveDMAQueue)
-DLL void SCIRemoveDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I E N Q U E U E D M A T R A N S F E R *
- * *
- * Flags: *
- * *
- * SCI_FLAG_DMA_READ - The DMA will be remote --> local *
- * (default is local --> remote) *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is larger *
- * than the segment size or larger than max *
- * DMA size. *
- * SCI_ERR_MAX_ENTRIES - The DMA queue is full *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The local segment has not been prepared for *
- * access from the adapter associated with the *
- * queue. *
- * SCI_ERR_SEGMENT_NOT_CONNECTED - The remote segment is not connected through *
- * the adapter associated with the queue. *
- *********************************************************************************/
-#define SCIEnqueueDMATransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIEnqueueDMATransfer)
-DLL sci_dma_queue_state_t SCIEnqueueDMATransfer(sci_dma_queue_t dq,
- sci_local_segment_t localSegment,
- sci_remote_segment_t remoteSegment,
- unsigned int localOffset,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P O S T D M A Q U E U E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The end of the transfer will cause the callback *
- * function to be invoked. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIPostDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIPostDMAQueue)
-DLL void SCIPostDMAQueue(sci_dma_queue_t dq,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortDMAQueue)
-DLL void SCIAbortDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I R E S E T D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIResetDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIResetDMAQueue)
-DLL void SCIResetDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I D M A Q U E U E S T A T E *
- * *
- *********************************************************************************/
-#define SCIDMAQueueState _SISCI_EXPANDE_FUNCTION_NAME(SCIDMAQueueState)
-DLL sci_dma_queue_state_t SCIDMAQueueState(sci_dma_queue_t dq);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForDMAQueue)
-DLL sci_dma_queue_state_t SCIWaitForDMAQueue(sci_dma_queue_t dq,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P H D M A E N Q U E U E *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_READ *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaEnqueue _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaEnqueue)
-DLL void SCIphDmaEnqueue(sci_dma_queue_t dmaqueue,
- unsigned int size,
- sci_ioaddr_t localBusAddr,
- unsigned int remote_nodeid,
- unsigned int remote_highaddr,
- unsigned int remote_lowaddr,
- unsigned int flags,
- sci_error_t *error);
-
-/*********************************************************************************
- * *
- * S C I P H D M A S T A R T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_WAIT *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_DMA_RESET *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaStart _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaStart)
-DLL sci_dma_queue_state_t SCIphDmaStart(sci_dma_queue_t dmaqueue,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-/*********************************************************************************
- * *
- * S C I C R E A T E I N T E R R U P T *
- * *
- * Flags *
- * *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_FIXED_INTNO *
- * SCI_FLAG_SHARED_INT *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INTNO_USED - This interrupt number is already used. *
- * *
- *********************************************************************************/
-#define SCICreateInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateInterrupt)
-DLL void SCICreateInterrupt(sci_desc_t sd,
- sci_local_interrupt_t *interrupt,
- unsigned int localAdapterNo,
- unsigned int *interruptNo,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveInterrupt)
-DLL void SCIRemoveInterrupt(sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait was interrupted by a call to *
- * SCIRemoveInterrupt. *
- * The handle is invalid when this error code is returned.*
- * *
- *********************************************************************************/
-#define SCIWaitForInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForInterrupt)
-DLL void SCIWaitForInterrupt(sci_local_interrupt_t interrupt,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_INTNO - No such interrupt number. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIConnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectInterrupt)
-DLL void SCIConnectInterrupt(sci_desc_t sd,
- sci_remote_interrupt_t *interrupt,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- unsigned int interruptNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisconnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectInterrupt)
-DLL void SCIDisconnectInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R I G G E R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCITriggerInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCITriggerInterrupt)
-DLL void SCITriggerInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R I N T E R R U P T F L A G *
- * *
- * *
- * This function register an "interrupt flag" that is identified as an unique *
- * location within a local segment. If successful, the resulting interrupt *
- * handle will have been associated with the specified local segment. *
- * *
- * It is up to the (remote) client(s) to set up an "interrupt mapping" for the *
- * corresponding segment offset using either the *
- * *
- * - SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * *
- * or the *
- * *
- * - SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP *
- * *
- * option to "SCIMapRemoteSegment()". - I.e. after having established a *
- * connection to the corresponding segment. A trigger operation can then *
- * be implemented using a store operation via the relevant "interrupt map". *
- * *
- * *
- * *
- * *
- * *
- * Flags: *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT - Triggering is to take place using *
- * "conditional interrupts". *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * None. *
- * *
- *********************************************************************************/
-#define SCIRegisterInterruptFlag _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterInterruptFlag)
-DLL void SCIRegisterInterruptFlag(
- unsigned int localAdapterNo,
- sci_local_interrupt_t *interrupt,
- sci_local_segment_t segment,
- unsigned int offset,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I E N A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * This function make sure that another HW interrupt will take place the next *
- * time the corresponding interrupt flag is triggered by a *
- * "conditional interrupt" operation. *
- * *
- * Default semantics: *
- * *
- * When successful, the client can rely on that the first subsequent trigger *
- * operation will cause a HW interrupt and subsequently cause the client *
- * handler function to be invoked. *
- * *
- * If an interrupt was triggered in parallell with the enable operation, then *
- * the operation will fail (SCI_ERR_COND_INT_RACE_PROBLEM), and the client can *
- * not rely on another trigger operation will lead to handler invocation. *
- * Hence, any state checking normally associated with handling the *
- * corresponding interrupt should take place before attempting to enable *
- * again. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_COND_INT_RACE_PROBLEM - The enable operation failed because an *
- * incomming trigger operation happened *
- * concurrently. *
- * *
- *********************************************************************************/
-#define SCIEnableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIEnableConditionalInterrupt)
-DLL void SCIEnableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I D I S A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * Prevent subsequent "conditional interrupt"trigger operations for *
- * the specified interupt flag from causing HW interrupt and handler *
- * invocations. *
- * *
- * *
- * Default semantics: *
- * *
- * If successful, no subsequent HW interrupts will take place, but handler *
- * invocations that have already been scheduled may still take place. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisableConditionalInterrupt)
-DLL void SCIDisableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C O N D I T I O N A L I N T E R R U P T C O U N T E R *
- * *
- * *
- * Returns a value that indicates the number of times this flag has *
- * been trigged since the last time it was enabled or disabled. *
- * Calling the SCIEnableConditionalInterrupt / SCIDisableConditionalInterrupt *
- * functions will reset the counter value. *
- * *
- * Default semantics: *
- * *
- * If successful, the current trig count is returned in the *
- * interruptTrigCounter parameter. *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OVERFLOW - The number of trig operations have exceeded the range *
- * that can be counted. *
- *********************************************************************************/
-#define SCIGetConditionalInterruptTrigCounter _SISCI_EXPANDE_FUNCTION_NAME(SCIGetConditionalInterruptTrigCounter)
-DLL void SCIGetConditionalInterruptTrigCounter(
- sci_local_interrupt_t interrupt,
- unsigned int *interruptTrigCounter,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlock _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlock)
-DLL void SCITransferBlock(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K A S Y N C *
- * *
- * Flags *
- * *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_USE_CALLBACK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger than *
- * the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlockAsync _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlockAsync)
-DLL void SCITransferBlockAsync(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- sci_block_transfer_t *block,
- sci_cb_block_transfer_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForBlockTransfer)
-DLL void SCIWaitForBlockTransfer(sci_block_transfer_t block,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortBlockTransfer)
-DLL void SCIAbortBlockTransfer(sci_block_transfer_t block,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-#define SCIMemCpy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCpy)
-DLL void SCIMemCpy(sci_sequence_t sequence,
- void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C O P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-
-#define SCIMemCopy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCopy)
-DLL void SCIMemCopy(void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R S E G M E N T M E M O R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_ILLEGAL_ADDRESS - Illegal address. *
- * SCI_ERR_OUT_OF_RANGE - Size is larger than the maximum size for the *
- * local segment. *
- * *
- *********************************************************************************/
-#define SCIRegisterSegmentMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterSegmentMemory)
-DLL void SCIRegisterSegmentMemory(void *address,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S C I S P A C E *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * *
- *********************************************************************************/
-#define SCIConnectSCISpace _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSCISpace)
-DLL void SCIConnectSCISpace(sci_desc_t sd,
- unsigned int localAdapterNo,
- sci_remote_segment_t *segment,
- sci_address_t address,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*
- * =====================================================================================
- *
- * S C I A T T A C H L O C A L S E G M E N T
- * Description:
- *
- * SCIAttachLocalSegment() permits an application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events
- * on this segment.
- *
- *
- * Specific error codes for this function:
- *
- * SCI_ERR_ACCESS - No such shared segment
- * SCI_ERR_NO_SUCH_SEGMENT - No such segment
- * Note: Current implenentation will return SCI_ERR_ACCESS for both cases. This will
- * change from next release. Application should handle both cases.
- *
- * =====================================================================================
- */
-#define SCIAttachLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachLocalSegment)
-
-DLL void
-SCIAttachLocalSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int *size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-/*
- * =====================================================================================
- *
- * S C I S H A R E S E G M E N T
- *
- * Description:
- *
- * SCIShareSegment() permits other application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- * none
- *
- * Specific error codes for this function:
- *
- *
- *
- * =====================================================================================
- */
-#define SCIShareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIShareSegment)
-
-DLL void
-SCIShareSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H *
- * *
- * This function will flush the CPU buffers and the PSB buffers. *
- * *
- * Flags *
- * SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY : *
- * Only flush CPU buffers ( Write combining *
- * etc buffers). *
- * *
- *********************************************************************************/
-
-#define SCIFlush _SISCI_EXPANDE_FUNCTION_NAME(SCIFlush)
-DLL void SCIFlush(sci_sequence_t sequence,
- unsigned int flags);
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-}
-#endif
-
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h
deleted file mode 100644
index aab7c136d3a..00000000000
--- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_error.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $Id: sisci_error.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_ERROR_H_
-#define _SISCI_ERROR_H_
-
-
-/* SCI Error return values always have 30 bit set */
-#define SCI_ERR_MASK 0x40000000
-#define SCI_ERR_REMOTE_MASK 0x01 /* Remote errors should have bit 0 set */
-
-#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF )
-
-/* Error codes */
-typedef enum {
- SCI_ERR_OK = 0x000,
-
-
- SCI_ERR_BUSY = (0x900 | SCI_ERR_MASK),
- SCI_ERR_FLAG_NOT_IMPLEMENTED = (0x901 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_FLAG = (0x902 | SCI_ERR_MASK),
- SCI_ERR_NOSPC = (0x904 | SCI_ERR_MASK),
- SCI_ERR_API_NOSPC = (0x905 | SCI_ERR_MASK),
- SCI_ERR_HW_NOSPC = (0x906 | SCI_ERR_MASK),
- SCI_ERR_NOT_IMPLEMENTED = (0x907 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADAPTERNO = (0x908 | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_ADAPTERNO = (0x909 | SCI_ERR_MASK),
- SCI_ERR_TIMEOUT = (0x90A | SCI_ERR_MASK),
- SCI_ERR_OUT_OF_RANGE = (0x90B | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_SEGMENT = (0x90C | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_NODEID = (0x90D | SCI_ERR_MASK),
- SCI_ERR_CONNECTION_REFUSED = (0x90E | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_CONNECTED = (0x90F | SCI_ERR_MASK),
- SCI_ERR_SIZE_ALIGNMENT = (0x910 | SCI_ERR_MASK),
- SCI_ERR_OFFSET_ALIGNMENT = (0x911 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_PARAMETER = (0x912 | SCI_ERR_MASK),
- SCI_ERR_MAX_ENTRIES = (0x913 | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_PREPARED = (0x914 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADDRESS = (0x915 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_OPERATION = (0x916 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_QUERY = (0x917 | SCI_ERR_MASK),
- SCI_ERR_SEGMENTID_USED = (0x918 | SCI_ERR_MASK),
- SCI_ERR_SYSTEM = (0x919 | SCI_ERR_MASK),
- SCI_ERR_CANCELLED = (0x91A | SCI_ERR_MASK),
- SCI_ERR_NOT_CONNECTED = (0x91B | SCI_ERR_MASK),
- SCI_ERR_NOT_AVAILABLE = (0x91C | SCI_ERR_MASK),
- SCI_ERR_INCONSISTENT_VERSIONS = (0x91D | SCI_ERR_MASK),
- SCI_ERR_COND_INT_RACE_PROBLEM = (0x91E | SCI_ERR_MASK),
- SCI_ERR_OVERFLOW = (0x91F | SCI_ERR_MASK),
- SCI_ERR_NOT_INITIALIZED = (0x920 | SCI_ERR_MASK),
-
- SCI_ERR_ACCESS = (0x921 | SCI_ERR_MASK),
-
- SCI_ERR_NO_SUCH_NODEID = (0xA00 | SCI_ERR_MASK),
- SCI_ERR_NODE_NOT_RESPONDING = (0xA02 | SCI_ERR_MASK),
- SCI_ERR_NO_REMOTE_LINK_ACCESS = (0xA04 | SCI_ERR_MASK),
- SCI_ERR_NO_LINK_ACCESS = (0xA05 | SCI_ERR_MASK),
- SCI_ERR_TRANSFER_FAILED = (0xA06 | SCI_ERR_MASK)
-} sci_error_t;
-
-
-#endif /* _SCI_ERROR_H_ */
-
-
-
diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h
deleted file mode 100644
index 77989ffca59..00000000000
--- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_types.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $Id: sisci_types.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_TYPES_H
-#define _SISCI_TYPES_H
-
-#include "sisci_error.h"
-
-#ifndef IN
-#define IN
-#endif
-
-#ifndef OUT
-#define OUT
-#endif
-
-#ifndef IN_OUT
-#define IN_OUT
-#endif
-
-/* Opaque data types for descriptors/handles */
-typedef struct sci_desc *sci_desc_t;
-typedef struct sci_local_segment *sci_local_segment_t;
-typedef struct sci_remote_segment *sci_remote_segment_t;
-
-typedef struct sci_map *sci_map_t;
-typedef struct sci_sequence *sci_sequence_t;
-#ifndef KERNEL
-typedef struct sci_dma_queue *sci_dma_queue_t;
-#endif
-typedef struct sci_remote_interrupt *sci_remote_interrupt_t;
-typedef struct sci_local_interrupt *sci_local_interrupt_t;
-typedef struct sci_block_transfer *sci_block_transfer_t;
-
-/*
- * Constants defining reasons for segment callbacks:
- */
-
-typedef enum {
- SCI_CB_CONNECT = 1,
- SCI_CB_DISCONNECT,
- SCI_CB_NOT_OPERATIONAL,
- SCI_CB_OPERATIONAL,
- SCI_CB_LOST
-} sci_segment_cb_reason_t;
-
-#define MAX_CB_REASON SCI_CB_LOST
-
-/* dma_queue_states is identical to the dma_queue_state_t in genif.h, they must be consistent.*/
-typedef enum {
- SCI_DMAQUEUE_IDLE,
- SCI_DMAQUEUE_GATHER,
- SCI_DMAQUEUE_POSTED,
- SCI_DMAQUEUE_DONE,
- SCI_DMAQUEUE_ABORTED,
- SCI_DMAQUEUE_ERROR
-} sci_dma_queue_state_t;
-
-
-typedef enum {
- SCI_SEQ_OK,
- SCI_SEQ_RETRIABLE,
- SCI_SEQ_NOT_RETRIABLE,
- SCI_SEQ_PENDING
-} sci_sequence_status_t;
-
-
-typedef struct {
- unsigned short nodeId; /* SCI Address bit 63 - 48 */
- unsigned short offsHi; /* SCI Address bit 47 - 32 */
- unsigned int offsLo; /* SCI Address bit 31 - 0 */
-} sci_address_t;
-
-
-typedef unsigned int sci_ioaddr_t;
-
-typedef enum {
- SCI_CALLBACK_CANCEL = 1,
- SCI_CALLBACK_CONTINUE
-} sci_callback_action_t;
-
-#ifndef KERNEL
-typedef sci_callback_action_t (*sci_cb_local_segment_t)(void *arg,
- sci_local_segment_t segment,
- sci_segment_cb_reason_t reason,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- sci_error_t error);
-
-typedef sci_callback_action_t (*sci_cb_remote_segment_t)(void *arg,
- sci_remote_segment_t segment,
- sci_segment_cb_reason_t reason,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_dma_t)(void IN *arg,
- sci_dma_queue_t queue,
- sci_error_t status);
-
-
-typedef int (*sci_cb_block_transfer_t)(void *arg,
- sci_block_transfer_t block,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_interrupt_t)(void *arg,
- sci_local_interrupt_t interrupt,
- sci_error_t status);
-
-#endif /* KERNEL */
-#endif
diff --git a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h b/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h
deleted file mode 100644
index c2fccb9ec33..00000000000
--- a/ndb/src/external/SOLARIS.SPARC/sci/include/sisci_version.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $Id: sisci_version.h,v 1.1 2002/12/13 12:17:22 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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 SISCI_VERSION_H
-#define SISCI_VERSION_H
-
-
-#define SISCI_API_VER_MAJOR 1
-#define SISCI_API_VER_MAJORC "1"
-
-#define SISCI_API_VER_MINOR 10
-#define SISCI_API_VER_MINORC "10"
-#define SISCI_API_VER_MICRO 4
-#define SISCI_API_VER_MICROC "4"
-
-#define SISCI_SIGN_VERSION_MASK 0xfffff000 /* used to mask off API_VER_MICRO */
-
-#define SISCI_API_VERSION (SISCI_API_VER_MAJOR << 24 | SISCI_API_VER_MINOR << 12 | SISCI_API_VER_MICRO)
-
-/* the rules are:
- *
- * Changes in API_VER_MICRO should be binary compatible, New flags, functions added. No changes to user code
- * required if new features is not needed.
- *
- * Changes in API_VER_MINOR requires recompilation of user code.
- *
- * Changes in the API_VER_MAJOR will most likely require changes to user code. This should not happen very
- * often...
- *
- */
-
-#ifndef BUILD_DATE
-#define BUILD_DATE __DATE__
-#endif
-
-#ifndef BUILD_NAME
-#define BUILD_NAME ""
-#endif
-
-#define API_VERSION "SISCI API version " SISCI_API_VER_MAJORC "." SISCI_API_VER_MINORC "."SISCI_API_VER_MICROC " ( "BUILD_NAME" "BUILD_DATE" )"
-
-#endif
-
-
-/* Version info: */
-/* */
-/* 1.5.2 First SISCI version */
-/* 1.5.3 Some bug fixes */
-/* 1.5.4 Some bug fixes */
-/* 1.5.5 No release */
-/* 1.5.6 Lock flag implemented in function SCIConnectSegment */
-/* 1.5.7 Expanded query functionality */
-/* 1.5.8 Updated error checking (sequence) functionality for D320 */
-/* 1.6.0 Updated error checking (sequence) D320 and IRM 1.9 support */
-/* 1.9.0 Ported to Solaris_sparc, Solaris_x86 and Linux. IRM 1.9. */
-/* 1.9.1 Some bug fixes */
-/* 1.9.2 Added more adapter queries */
-/* 1.9.3 Bug fix in SCIMapLocalSegment and SCIMapRemoteSegment */
-/* 1.9.4 NT Release Developers Kit 2.40 */
-/* 1.9.5 Added flush after data transfer in SCIMemCopy() */
-/* 1.9.5 NT Release Developers Kit 2.44 */
-/* 1.10.0:
- * New SCIInitialize(), SCITerminate() functions.
- * Support for D330
- *
- *
- */
-
-
diff --git a/ndb/src/external/WIN32.x86/sci/include/rmlib.h b/ndb/src/external/WIN32.x86/sci/include/rmlib.h
deleted file mode 100644
index 87ba20db99f..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/rmlib.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $Id: rmlib.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-
-/*********************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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. *
- * *
- * *
- *********************************************************************************/
-
-/********************************************************************************/
-/* This header file contains the declarations of the SCI Reflective Memory */
-/* library rmlib. The implementation of the library functions is in rmlib.c. */
-/* The library contains all the functions that operate on the reflective */
-/* memory. */
-/* */
-/* NB! */
-/* */
-/* DOLPHIN'S SCI REFLECTIVE MEMORY FILES ARE UNDER DEVELOPMENT AND MAY CHANGE. */
-/* PLEASE CONTACT DOLPHIN FOR FURTHER INFORMATION. */
-/* */
-/* */
-/********************************************************************************/
-
-#include "sisci_error.h"
-#include "sisci_api.h"
-#include "sisci_demolib.h"
-#include "sisci_types.h"
-
-unsigned int seqerr, syncseqerr;
-
-#ifndef _RMLIB_H
-#define _RMLIB_H
-
-
-#if defined(_REENTRANT)
-
-#define _RMLIB_EXPAND_NAME(name) _RMLIB_MT_ ## name
-
-#else
-
-#define _RMLIB_EXPAND_NAME(name) _RMLIB_ST_ ## name
-
-#endif
-
-#ifdef __sparc
-#define CACHE_SIZE 2097152
-#else
-#define CACHE_SIZE 8192
-#endif
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define REFLECT_ERRCHECK 0x2
-
-struct ReflectiveMemorySpace {
- unsigned int localAdapterNo;
- unsigned int localNodeId;
- unsigned int remoteNodeId;
- sci_desc_t sd;
- sci_desc_t syncsd;
- sci_map_t localMap;
- sci_map_t remoteMap;
- unsigned int localSegmentId;
- unsigned int remoteSegmentId;
- unsigned int syncSegmentId;
- unsigned int sync_rSegmentId;
- unsigned int segmentSize;
- unsigned int *localMapAddr;
- volatile unsigned int *remoteMapAddr;
- sci_local_segment_t localSegment;
- sci_remote_segment_t remoteSegment;
- sci_local_segment_t syncSegment;
- sci_remote_segment_t sync_rSegment;
- sci_map_t syncMap;
- sci_map_t sync_rMap;
- sci_sequence_t syncsequence;
- sci_sequence_t sequence;
- unsigned int protection;
- unsigned int retry_value;
- sci_sequence_status_t sequenceStatus, syncsequenceStatus;
- volatile unsigned int *syncMapAddr;
- volatile unsigned int *sync_rMapAddr;
-};
-
-/*********************************************************************************/
-/* P R I N T R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectPrintParameters _RMLIB_EXPAND_NAME(ReflectPrintParameters)
-void ReflectPrintParameters(FILE *stream, struct ReflectiveMemorySpace RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T D M A S E T U P */
-/* */
-/*********************************************************************************/
-#define ReflectDmaSetup _RMLIB_EXPAND_NAME(ReflectDmaSetup)
-sci_error_t ReflectDmaSetup(struct ReflectiveMemorySpace RM_space, sci_dma_queue_t *dmaQueue);
-
-/*********************************************************************************/
-/* R E F L E C T D M A R E M O V E */
-/* */
-/*********************************************************************************/
-#define ReflectDmaRemove _RMLIB_EXPAND_NAME(ReflectDmaRemove)
-sci_error_t ReflectDmaRemove(sci_dma_queue_t dmaQueue);
-
-/*********************************************************************************/
-/* R E F L E C T D M A R U N */
-/* */
-/*********************************************************************************/
-#define ReflectDmaRun _RMLIB_EXPAND_NAME(ReflectDmaRun)
-sci_error_t ReflectDmaRun(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset,
- sci_dma_queue_t dmaQueue);
-/*********************************************************************************/
-/* C L O S E R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectClose _RMLIB_EXPAND_NAME(ReflectClose)
-sci_error_t ReflectClose(struct ReflectiveMemorySpace RM_space, unsigned int segment_no);
-
-/*********************************************************************************/
-/* O P E N R E F L E C T I V E M E M O R Y S P A C E */
-/* */
-/*********************************************************************************/
-#define ReflectOpen _RMLIB_EXPAND_NAME(ReflectOpen)
-sci_error_t ReflectOpen(struct ReflectiveMemorySpace *RM_space,
- unsigned int size,
- unsigned int segment_no,
- unsigned int localAdapterNo,
- unsigned int remoteNodeId,
- unsigned int protection,
- unsigned int retry_value);
-
-/*********************************************************************************/
-/* R E F L E C T G E T A C C E S S */
-/* */
-/*********************************************************************************/
-#define ReflectGetAccess _RMLIB_EXPAND_NAME(ReflectGetAccess)
-sci_error_t ReflectGetAccess(struct ReflectiveMemorySpace *RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T R E L E A S E A C C E S S */
-/* */
-/*********************************************************************************/
-#define ReflectReleaseAccess _RMLIB_EXPAND_NAME(ReflectReleaseAccess)
-sci_error_t ReflectReleaseAccess(struct ReflectiveMemorySpace *RM_space);
-
-/*********************************************************************************/
-/* R E F L E C T D M A */
-/* */
-/*********************************************************************************/
-#define ReflectDma _RMLIB_EXPAND_NAME(ReflectDma)
-sci_error_t ReflectDma(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset);
-
-/*********************************************************************************/
-/* R E F L E C T M E M C O P Y */
-/* */
-/*********************************************************************************/
-#define ReflectMemCopy _RMLIB_EXPAND_NAME(ReflectMemCopy)
-sci_error_t ReflectMemCopy(struct ReflectiveMemorySpace RM_space,
- unsigned int* privateSrc,
- unsigned int size,
- unsigned int offset,
- unsigned int flags);
-
-/*********************************************************************************/
-/* R E F L E C T S E T */
-/* */
-/*********************************************************************************/
-#define ReflectSet _RMLIB_EXPAND_NAME(ReflectSet)
-sci_error_t ReflectSet(struct ReflectiveMemorySpace RM_space,
- unsigned int value,
- unsigned int size,
- unsigned int offset,
- unsigned int flags
- );
-
-/*********************************************************************************/
-/* R E F L E C T P R I N T */
-/* */
-/*********************************************************************************/
-#define ReflectPrint _RMLIB_EXPAND_NAME(ReflectPrint)
-sci_error_t ReflectPrint(FILE *stream,
- struct ReflectiveMemorySpace RM_space,
- unsigned int size,
- unsigned int offset
- );
-
-
-#endif
diff --git a/ndb/src/external/WIN32.x86/sci/include/scilib.h b/ndb/src/external/WIN32.x86/sci/include/scilib.h
deleted file mode 100644
index d1501082bab..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/scilib.h
+++ /dev/null
@@ -1,330 +0,0 @@
-/* $Id: scilib.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 2002 *
- * Dolphin Interconnect Solutions AS *
- * *
- *******************************************************************************/
-
-
-#if defined(_REENTRANT)
-#define _SCIL_EXPANDE_FUNCTION_NAME(name) _SCIL_PUBLIC_FUNC_MT_ ## name
-#define _SCIL_EXPANDE_VARIABLE_NAME(name) _SCIL_PUBLIC_VAR_MT_ ## name
-#else
-#define _SCIL_EXPANDE_FUNCTION_NAME(name) _SCIL_PUBLIC_FUNC_ST_ ## name
-#define _SCIL_EXPANDE_VARIABLE_NAME(name) _SCIL_PUBLIC_VAR_ST_ ## name
-#endif
-#define _SCIL_EXPANDE_CONSTANT_NAME(name) _SCIL_PUBLIC_CONST_ ## name
-
-#include "sisci_api.h"
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-extern "C" {
-#endif
-
-
-/*
- * SISCI segment id pollution:
- * ===========================
- * The SISCI library uses regular SISCI segmens internally.
- * The MSG_QUEUE_LIB_IDENTIFIER_MASK is a mask which is used by the SISCI
- * library to identify internal SISCI segments ids, from segments used directly
- * by the user.
- *
- * Future versions of the library may have its own namespace.
- *
- */
-
-#define MSG_QUEUE_LIB_IDENTIFIER_MASK 0x10000000
-
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define SCIL_FLAG_ERROR_CHECK_DATA _SCIL_EXPANDE_CONSTANT_NAME(SCIL_FLAG_ERROR_CHECK_DATA)
-extern const unsigned int SCIL_FLAG_ERROR_CHECK_DATA;
-
-#define SCIL_FLAG_ERROR_CHECK_PROT _SCIL_EXPANDE_CONSTANT_NAME(SCIL_FLAG_ERROR_CHECK_PROT)
-extern const unsigned int SCIL_FLAG_ERROR_CHECK_PROT;
-
-#define SCIL_FLAG_FULL_ERROR_CHECK _SCIL_EXPANDE_CONSTANT_NAME(SCIL_FLAG_FULL_ERROR_CHECK)
-extern const unsigned int SCIL_FLAG_FULL_ERROR_CHECK;
-
-
-
-
-
-typedef struct sci_msq_queue *sci_msq_queue_t;
-
-
-/*********************************************************************************
- * *
- * S C I L C r e a t e M s g Q u e u e *
- * *
- * Parameters: *
- * *
- * Creates a message queue. The message queue identifier object will be allocated*
- * if the sci_msq_queue_t * msg pointer is NULL. The function will create a *
- * remote connection. If this connection times out, the function shoud be *
- * repeated until connection is established. SCILRemoveMsgQueue() must be called *
- * to remove the connection and deallocate the message queue identifier. *
- * *
- * sci_msq_queue_t *msq : Message queue identifier *
- * The function must be called with a null pointer *
- * the first time. *
- * unsigned int localAdapterNo: Local Adapter Number *
- * unsigned int remoteNodeId : Remote nodeId *
- * unsigned int msqId : Message queue number *
- * unsigned int maxMsgCount : The maximum count of messages in queue *
- * unsigned int maxMsgSize, : The maximum size of each messages in queue *
- * unsigned int timeout : Time to wait for successful connection *
- * unsigned int flags : Flags. *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None. Normal SISIC error codes. *
- * *
- *********************************************************************************/
-#define SCILCreateMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILCreateMsgQueue)
-DLL sci_error_t SCILCreateMsgQueue(sci_msq_queue_t *msq,
- unsigned int localAdapterNo,
- unsigned int remoteNodeId,
- unsigned int msqId,
- unsigned int maxMsgCount,
- unsigned int maxMsgSize,
- unsigned int timeout,
- unsigned int flags);
-
-
-/*********************************************************************************
- * *
- * S C I L R e c e i v e M s g *
- * *
- * *
- * Receives a message from the queue. *
- * *
- * Paremeters *
- * *
- * sci_msq_queue_t msq : message queue identifier *
- * void *msg : Location to store received data *
- * unsigned int size : Size of message to read *
- * unsigned int *sizeLeft: Bytes left in buffer, after current receive. This is *
- * just a hint. There may be more. *
- * *
- * Flags *
- * *
- * SCIL_FLAG_ERROR_CHECK_PROT: The internal buffer management is done using full*
- * error checking.
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_EWOULD_BLOCK : There is not enough data in the message buffer *
- * to read the specified number of bytes. *
- * . *
- * SCI_ERR_NOT_CONNECTED : The connection is not established. *
- * *
- *********************************************************************************/
-#define SCILReceiveMsg _SCIL_EXPANDE_FUNCTION_NAME(SCILReceiveMsg)
-DLL sci_error_t SCILReceiveMsg(
- sci_msq_queue_t msq,
- void *msg,
- unsigned int size,
- unsigned int *sizeLeft,
- unsigned int flags);
-
-
-
-/*********************************************************************************
- * *
- * S C I L S e n d M s g *
- * *
- * *
- * Sends a message to the queue. *
- * *
- * Paremeters *
- * *
- * sci_msq_queue_t msq : Message queue identifier *
- * void *msg : Send data *
- * unsigned int size : Size of message to send *
- * unsigned int *sizeFree: Bytes free in buffer, after current send. This is *
- * just a hint. There may be more. *
- * *
- * Flags *
- * *
- * SCIL_FLAG_ERROR_CHECK_DATA: The data is transmitted using full error checking*
- * SCIL_FLAG_ERROR_CHECK_PROT: The internal buffer management is done using full*
- * error checking. *
- * SCIL_FLSG_FULL_ERROR_CHECK: This flag is an combination of both above. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_EWOULD_BLOCK : There is not enough data in the message buffer *
- * to send the specified number of bytes. *
- * . *
- * SCI_ERR_NOT_CONNECTED : The connection is not established. *
- * *
- *********************************************************************************/
-#define SCILSendMsg _SCIL_EXPANDE_FUNCTION_NAME(SCILSendMsg)
-DLL sci_error_t SCILSendMsg(
- sci_msq_queue_t msq,
- void *msg,
- unsigned int size,
- unsigned int *sizeFree,
- unsigned int flags);
-
-
-/*********************************************************************************
- * *
- * S C I L R e m o v e M s g Q u e ue *
- * *
- * *
- * Removes a message queue. *
- * *
- * sci_msq_queue_t msq : Message queue identifier *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCILRemoveMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILRemoveMsgQueue)
-DLL sci_error_t SCILRemoveMsgQueue(
- sci_msq_queue_t *msq,
- unsigned int flags);
-
-
-
-/*********************************************************************************
- * *
- * S C I L I n i t *
- * *
- * *
- * Initializes the SCI library. This function must be called before any other *
- * function in the library. *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * . *
- *********************************************************************************/
-#define SCILInit _SCIL_EXPANDE_FUNCTION_NAME(SCILInit)
-DLL sci_error_t SCILInit(unsigned int flags);
-
-
-
-/*********************************************************************************
- * *
- * S C I L D e s t r o y *
- * *
- * *
- * Removes internal resources allocated by the SCI Library. No other library *
- * function should be called after this function. *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCILDestroy _SCIL_EXPANDE_FUNCTION_NAME(SCILDestroy)
-DLL sci_error_t SCILDestroy(unsigned int flags);
-
-
-
-/*********************************************************************************
- * *
- * S C I L C o n n e c t M s g Q u e u e *
- * *
- * *
- * Makes a connection to a remote message queue. This must be done before *
- * SCILSendMsg() is called. *
- * *
- * Parameters: *
- * *
- * sci_msq_queue_t *msq : Message queue identifier *
- * unsigned int localAdapterNo: Local Adapter Number *
- * unsigned int remoteNodeId : Remote nodeId *
- * unsigned int msqId : Message queue number *
- * unsigned int maxMsgCount : The maximum count of messages in queue *
- * unsigned int maxMsgSize, : The maximum size of each messages in queue *
- * unsigned int timeout : Time to wait for successful connection *
- * unsigned int flags : Flags. *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None. Normal SISIC error codes. *
- * *
- *********************************************************************************/
-#define SCILConnectMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILConnectMsgQueue)
-DLL sci_error_t SCILConnectMsgQueue(sci_msq_queue_t *msq,
- unsigned int localAdapterNo,
- unsigned int remoteNodeId,
- unsigned int rmsgId,
- unsigned int maxMsgCount,
- unsigned int maxMsgSize,
- unsigned int timeout,
- unsigned int flags);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I L D i s c o n n e c t M s g Q u e u e *
- * *
- * *
- * Disconnects from a remote message queue. *
- * *
- * Parameters: *
- * *
- * sci_msq_queue_t *msq : Message queue identifier *
- * *
- * Flags *
- * *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCILDisconnectMsgQueue _SCIL_EXPANDE_FUNCTION_NAME(SCILDisconnectMsgQueue)
-DLL sci_error_t SCILDisconnectMsgQueue(sci_msq_queue_t *msq,
- unsigned int flags);
-
-
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-}
-#endif
-
-
-
-
-
-
-
-
-
-
diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_api.h b/ndb/src/external/WIN32.x86/sci/include/sisci_api.h
deleted file mode 100644
index 9f4a1ddffb3..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/sisci_api.h
+++ /dev/null
@@ -1,2217 +0,0 @@
-/* $Id: sisci_api.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2001 *
- * Dolphin Interconnect Solutions AS *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU Lesser General Public License as published by *
- * the Free Software Foundation; either version 2.1 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 Lesser 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 _SISCI_API_H
-#define _SISCI_API_H
-
-#include "sisci_types.h"
-#include "sisci_error.h"
-
-
-#ifdef WIN32
-#ifdef API_DLL
-#define DLL __declspec(dllexport)
-#elif CLIENT_DLL
-#define DLL __declspec(dllimport)
-#endif
-#endif /* WIN32 */
-
-
-#ifndef DLL
-#define DLL
-#endif
-
-#if defined(_REENTRANT)
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_MT_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_MT_ ## name
-#else
-#define _SISCI_EXPANDE_FUNCTION_NAME(name) _SISCI_PUBLIC_FUNC_ST_ ## name
-#define _SISCI_EXPANDE_VARIABLE_NAME(name) _SISCI_PUBLIC_VAR_ST_ ## name
-#endif
-#define _SISCI_EXPANDE_CONSTANT_NAME(name) _SISCI_PUBLIC_CONST_ ## name
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-extern "C" {
-#endif
-
-
-/*********************************************************************************/
-/* FLAG VALUES */
-/*********************************************************************************/
-
-#define SCI_FLAG_FIXED_INTNO _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_INTNO)
-extern const unsigned int SCI_FLAG_FIXED_INTNO;
-
-#define SCI_FLAG_SHARED_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_INT)
-extern const unsigned int SCI_FLAG_SHARED_INT;
-
-#define SCI_FLAG_COUNTING_INT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_COUNTING_INT)
-extern const unsigned int SCI_FLAG_COUNTING_INT;
-
-#define SCI_FLAG_FIXED_MAP_ADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FIXED_MAP_ADDR)
-extern const unsigned int SCI_FLAG_FIXED_MAP_ADDR;
-
-#define SCI_FLAG_READONLY_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READONLY_MAP)
-extern const unsigned int SCI_FLAG_READONLY_MAP;
-
-#define SCI_FLAG_USE_CALLBACK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_USE_CALLBACK)
-extern const unsigned int SCI_FLAG_USE_CALLBACK;
-
-#define SCI_FLAG_BLOCK_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_BLOCK_READ)
-extern const unsigned int SCI_FLAG_BLOCK_READ;
-
-#define SCI_FLAG_THREAD_SAFE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_THREAD_SAFE)
-extern const unsigned int SCI_FLAG_THREAD_SAFE;
-
-#define SCI_FLAG_ASYNCHRONOUS_CONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ASYNCHRONOUS_CONNECT)
-extern const unsigned int SCI_FLAG_ASYNCHRONOUS_CONNECT;
-
-#define SCI_FLAG_EMPTY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_EMPTY)
-extern const unsigned int SCI_FLAG_EMPTY;
-
-#define SCI_FLAG_PRIVATE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_PRIVATE)
-extern const unsigned int SCI_FLAG_PRIVATE;
-
-#define SCI_FLAG_FORCE_DISCONNECT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FORCE_DISCONNECT)
-extern const unsigned int SCI_FLAG_FORCE_DISCONNECT;
-
-#define SCI_FLAG_NOTIFY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NOTIFY)
-extern const unsigned int SCI_FLAG_NOTIFY;
-
-#define SCI_FLAG_DMA_READ _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_READ)
-extern const unsigned int SCI_FLAG_DMA_READ;
-
-#define SCI_FLAG_DMA_POST _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_POST)
-extern const unsigned int SCI_FLAG_DMA_POST;
-
-#define SCI_FLAG_DMA_WAIT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_WAIT)
-extern const unsigned int SCI_FLAG_DMA_WAIT;
-
-#define SCI_FLAG_DMA_RESET _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_RESET)
-extern const unsigned int SCI_FLAG_DMA_RESET;
-
-#define SCI_FLAG_NO_FLUSH _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_FLUSH)
-extern const unsigned int SCI_FLAG_NO_FLUSH;
-
-#define SCI_FLAG_NO_STORE_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_STORE_BARRIER)
-extern const unsigned int SCI_FLAG_NO_STORE_BARRIER;
-
-#define SCI_FLAG_FAST_BARRIER _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FAST_BARRIER)
-extern const unsigned int SCI_FLAG_FAST_BARRIER;
-
-#define SCI_FLAG_ERROR_CHECK _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_ERROR_CHECK)
-extern const unsigned int SCI_FLAG_ERROR_CHECK;
-
-#define SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-extern const unsigned int SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY;
-
-/* the FLUSH_CPU_BUFFERS_ONLY flag is for backwards compabillity only and should never be used */
-#define FLUSH_CPU_BUFFERS_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY)
-
-#define SCI_FLAG_LOCK_OPERATION _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_LOCK_OPERATION)
-extern const unsigned int SCI_FLAG_LOCK_OPERATION;
-
-#define SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP;
-
-#define SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP)
-extern const unsigned int SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP;
-
-#define SCI_FLAG_IO_MAP_IOSPACE _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_IO_MAP_IOSPACE)
-extern const unsigned int SCI_FLAG_IO_MAP_IOSPACE;
-
-#define SCI_FLAG_DMOVE_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMOVE_MAP)
-extern const unsigned int SCI_FLAG_DMOVE_MAP;
-
-#define SCI_FLAG_WRITES_DISABLE_GATHER_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_WRITES_DISABLE_GATHER_MAP)
-extern const unsigned int SCI_FLAG_WRITES_DISABLE_GATHER_MAP;
-
-#define SCI_FLAG_DISABLE_128_BYTES_PACKETS _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DISABLE_128_BYTES_PACKETS)
-extern const unsigned int SCI_FLAG_DISABLE_128_BYTES_PACKETS;
-
-#define SCI_FLAG_SHARED_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_SHARED_MAP)
-extern const unsigned int SCI_FLAG_SHARED_MAP;
-
-#define SCI_FLAG_DMA_SOURCE_ONLY _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_SOURCE_ONLY)
-extern const unsigned int SCI_FLAG_DMA_SOURCE_ONLY;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT;
-
-#define SCI_FLAG_CONDITIONAL_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_CONDITIONAL_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_CONDITIONAL_INTERRUPT_MAP;
-
-#define SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP)
-extern const unsigned int SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP;
-
-#define SCI_FLAG_NO_MEMORY_LOOPBACK_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_NO_MEMORY_LOOPBACK_MAP)
-extern const unsigned int SCI_FLAG_NO_MEMORY_LOOPBACK_MAP;
-
-#if defined(OS_IS_LYNXOS) || defined(OS_IS_VXWORKS)
-#define SCI_FLAG_WRITE_BACK_CACHE_MAP _SISCI_EXPANDE_CONSTANT_NAME(WRITE_BACK_CACHE_MAP)
-extern const unsigned int SCI_FLAG_WRITE_BACK_CACHE_MAP;
-#endif
-
-#define SCI_FLAG_DMA_PHDMA _SISCI_EXPANDE_CONSTANT_NAME(SCI_FLAG_DMA_PHDMA)
-extern const unsigned int SCI_FLAG_DMA_PHDMA;
-
-/*********************************************************************************/
-/* GENERAL VALUES */
-/*********************************************************************************/
-#define SCI_LOCAL_HOST _SISCI_EXPANDE_CONSTANT_NAME(SCI_LOCAL_HOST)
-extern const unsigned int SCI_LOCAL_HOST;
-
-#define SCI_INFINITE_TIMEOUT _SISCI_EXPANDE_CONSTANT_NAME(SCI_INFINITE_TIMEOUT)
-extern const unsigned int SCI_INFINITE_TIMEOUT;
-
-/*********************************************************************************/
-/* GENERAL ERROR CODES */
-/* */
-/* SCI_ERR_ILLEGAL_FLAG - Illegal flag value. */
-/* SCI_ERR_FLAG_NOT_IMPLEMENTED - Flag legal but flag feature not implemented. */
-/* SCI_ERR_NOT_IMPLEMENTED - Function not implemented. */
-/* SCI_ERR_SYSTEM - A system error. Check errno. */
-/* SCI_ERR_NOSPC - Unable to allocate OS resources. */
-/* SCI_ERR_API_NOSPC - Unable to allocate API resources. */
-/* SCI_ERR_HW_NOSPC - Unable to allocate HW resources (Hardware) */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "ADAPTER" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_ADAPTERNO - Adapter number is legal but does not exist. */
-/* SCI_ERR_ILLEGAL_ADAPTERNO - Illegal local adapter number (i.e. outside */
-/* legal range). */
-/* */
-/*********************************************************************************/
-
-
-/*********************************************************************************/
-/* GENERAL "NODEID" ERROR CODES */
-/* */
-/* SCI_ERR_NO_SUCH_NODEID - The remote adapter identified by nodeId does */
-/* not respond, but the intermediate link(s) */
-/* seem(s) to be operational. */
-/* SCI_ERR_ILLEGAL_NODEID - Illegal NodeId. */
-/* */
-/*********************************************************************************/
-
-
-
-/*********************************************************************************
- * *
- * S C I I N I T I A L I Z E *
- * *
- * This function initializes the SISCI library. *
- * The function must be called before SCIOpen(). *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * None *
- * *
- *********************************************************************************/
-#define SCIInitialize _SISCI_EXPANDE_FUNCTION_NAME(SCIInitialize)
-DLL void SCIInitialize(unsigned int flags,
- sci_error_t *error);
-#if 0
-unsigned int __Internal_SISCI_version_var;
-#endif
-
-/*********************************************************************************
- * *
- * S C I T E R M I N A T E *
- * *
- * This function terminates the SISCI library. *
- * The function must be called after SCIClose(). *
- * *
- * *
- *********************************************************************************/
-#define SCITerminate _SISCI_EXPANDE_FUNCTION_NAME(SCITerminate)
-DLL void SCITerminate(void);
-
-/*********************************************************************************
- * *
- * S C I O P E N *
- * *
- * *
- * Opens a SCI virtual device. *
- * Caller must supply a pointer to a variable of type sci_desc_t to be *
- * initialized. *
- * *
- * Flags *
- * SCI_FLAG_THREAD_SAFE - Operations on resources associated with this *
- * descriptor will be performed in a multithread-safe *
- * manner. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INCONSISTENT_VERSIONS - Inconsistency between the SISCI library *
- * and the SISCI driver versions. *
- * *
- * *
- *********************************************************************************/
-#define SCIOpen _SISCI_EXPANDE_FUNCTION_NAME(SCIOpen)
-DLL void SCIOpen(sci_desc_t *sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C L O S E *
- * *
- * This function closes an open SCI virtual device. *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - All resources are not deallocated. *
- * *
- *********************************************************************************/
-#define SCIClose _SISCI_EXPANDE_FUNCTION_NAME(SCIClose)
-DLL void SCIClose(sci_desc_t sd,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S E G M E N T *
- * *
- * Connects to a remote shared memory segment located at <nodeId> with the *
- * identifier <segmentId>. *
- * The user may then call SCIMapRemoteSegment() to map shared memory *
- * into user space. *
- * *
- * Flags *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_ASYNCHRONOUS_CONNECT *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_SEGMENT - Could not find the remote segment with the *
- * given segmentId. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIConnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSegment)
-DLL void SCIConnectSegment(sci_desc_t sd,
- sci_remote_segment_t *segment,
- unsigned int nodeId,
- unsigned int segmentId,
- unsigned int localAdapterNo,
- sci_cb_remote_segment_t callback,
- void *callbackArg,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T S E G M E N T *
- * *
- * Disconnects from the give mapped shared memory segment *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The segment is currently mapped or in use. *
- * *
- *********************************************************************************/
-#define SCIDisconnectSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectSegment)
-DLL void SCIDisconnectSegment(sci_remote_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T R E M O T E S E G M E N T S I Z E *
- * *
- *********************************************************************************/
-#define SCIGetRemoteSegmentSize _SISCI_EXPANDE_FUNCTION_NAME(SCIGetRemoteSegmentSize)
-DLL unsigned int SCIGetRemoteSegmentSize(sci_remote_segment_t segment);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R R E M O T E S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du *
- * to a SCIDisconnectSegment() on the same *
- * handle. The handle is invalid when this *
- * error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForRemoteSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForRemoteSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForRemoteSegmentEvent(
- sci_remote_segment_t segment,
- sci_error_t *status,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P R E M O T E S E G M E N T *
- * *
- * This function is used to include a shared memory segment in the virtual *
- * address space of the application. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_SHARED_MAP - The low level physical map may be shared by *
- * other applications. *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR - Map at the suggested virtual address *
- * SCI_FLAG_READONLY_MAP - The segment is mapped in read-only mode *
- * SCI_FLAG_LOCK_OPERATION - Enable Lock operations (fetch and add) *
- * SCI_FLAG_READ_PREFETCH_AGGR_HOLD_MAP *
- * - Enable aggressive prefetch with speculative *
- * hold. *
- * *
- * SCI_FLAG_READ_PREFETCH_NO_HOLD_MAP *
- * - The PSB66 will prefetch 64 bytes. As soon *
- * as the PCI read retry has been accepted, *
- * the stream will change state to FREE, even *
- * if less than 64 bytes were actually read. *
- * *
- * SCI_FLAG_IO_MAP_IOSPACE - Enable No Prefetch, no speculative hold. *
- * *
- * SCI_FLAG_DMOVE_MAP - Enable DMOVE packet type. The stream will be *
- * set into FREE state immediately. *
- * *
- * SCI_FLAG_WRITES_DISABLE_GATHER_MAP *
- * - Disable use of gather. *
- * *
- * SCI_FLAG_DISABLE_128_BYTES_PACKETS *
- * - Disable use of 128-Byte packets *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an atomic "fetch-and-add-one" operation on *
- * remote memory, but in addition an interrupt *
- * will be generated if the target memory *
- * location contained a "null value" before the *
- * add operation was carried out. *
- * The conditional interrupt flag must also be *
- * specified in the SCIRegisterInterruptFlag() *
- * function. *
- * *
- * SCI_FLAG_UNCONDITIONAL_INTERRUPT_MAP *
- * - Write operations through this map will cause *
- * an interrupt for the remote adapter *
- * "in addition to" updating the corresponding *
- * remote memory location with the data being *
- * written. *
- * The unconditional interrupt flag must also *
- * be specified in the *
- * SCIRegisterInterruptFlag() function. *
- * *
- * SCI_FLAG_WRITE_BACK_CACHE_MAP *
- * - Enable cacheing of the mapped region. *
- * Writes through this map will be written to a *
- * write back cache, hence no remote SCI updates*
- * until the cache line is flushed. The *
- * application is responsible for the cache *
- * flush operation. *
- * The SCImemCopy() function will handle this *
- * correctly by doing cache flushes internally. *
- * This feature is architechture dependent and *
- * not be available on all plattforms. *
- * *
- * SCI_FLAG_NO_MEMORY_LOOPBACK_MAP *
- * - Forces a map to a remote segment located *
- * in the local machine to be mapped using *
- * SCI loopback. This is useful i.e. if you *
- * want to use a regular map access to be *
- * serialized with lock operations. *
- * The default behaviour is to access a remte *
- * segment located in the local machine as a *
- * local MMU operation. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapRemoteSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapRemoteSegment)
-DLL volatile void *SCIMapRemoteSegment(
- sci_remote_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M A P L O C A L S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_FIXED_MAP_ADDR *
- * SCI_FLAG_READONLY_MAP *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is *
- * larger than the segment size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as *
- * required by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as *
- * required by the implementation. *
- * *
- *********************************************************************************/
-#define SCIMapLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIMapLocalSegment)
-DLL void *SCIMapLocalSegment(sci_local_segment_t segment,
- sci_map_t *map,
- unsigned int offset,
- unsigned int size,
- void *addr,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I U N M A P S E G M E N T *
- * *
- * This function unmaps pages of shared memory from the callers virtual *
- * address space. *
- * *
- * Flags *
- * None. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - The map is currently in use. *
- * *
- *********************************************************************************/
-#define SCIUnmapSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIUnmapSegment)
-DLL void SCIUnmapSegment(sci_map_t map,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E S E G M E N T *
- * *
- * Make the specified segment available for connections via the specified *
- * adapter. If successful, the segment can be accessed from remote nodes *
- * via the specified adapter. *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events *
- * on this segment. *
- * SCI_FLAG_EMPTY - No memory will be allocated for the segment. *
- * SCI_FLAG_PRIVATE - The segment will be private meaning it will never *
- * be any connections to it. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SEGMENTID_USED - The segment with this segmentId is already used *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * *
- *********************************************************************************/
-#define SCICreateSegment _SISCI_EXPANDE_FUNCTION_NAME(SCICreateSegment)
-DLL void SCICreateSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R L O C A L S E G M E N T E V E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait operation has been cancelled du to a *
- * SCIRemoveSegment() on the same handle. *
- * The handle is invalid when this error is returned. *
- * *
- *********************************************************************************/
-#define SCIWaitForLocalSegmentEvent _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForLocalSegmentEvent)
-DLL sci_segment_cb_reason_t SCIWaitForLocalSegmentEvent(
- sci_local_segment_t segment,
- unsigned int *sourcenodeId,
- unsigned int *localAdapterNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P R E P A R E S E G M E N T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_SOURCE_ONLY - The segment will be used as a source segment *
- * for DMA operations. On some system types this *
- * will enable the SISCI driver to use performance *
- * improving features. *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIPrepareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIPrepareSegment)
-DLL void SCIPrepareSegment(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E G M E N T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_BUSY - Unable to remove the segment. The segment is currently *
- * in use. *
- * *
- *********************************************************************************/
-#define SCIRemoveSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSegment)
-DLL void SCIRemoveSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T A V A I L A B L E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The segment has not been prepared for access *
- * from this adapter. *
- * SCI_ERR_ILLEGAL_OPERATION - The segment is created with the *
- * SCI_FLAG_PRIVATE flag specified and *
- * therefore has no segmentId. *
- * *
- *********************************************************************************/
-#define SCISetSegmentAvailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentAvailable)
-DLL void SCISetSegmentAvailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T S E G M E N T U N A V A I L A B L E *
- * *
- * Flags *
- * *
- * SCI_FLAG_FORCE_DISCONNECT *
- * SCI_FLAG_NOTIFY *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation. *
- * *
- *********************************************************************************/
-#define SCISetSegmentUnavailable _SISCI_EXPANDE_FUNCTION_NAME(SCISetSegmentUnavailable)
-DLL void SCISetSegmentUnavailable(sci_local_segment_t segment,
- unsigned int localAdapterNo,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E M A P S E Q U E N C E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_FAST_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateMapSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICreateMapSequence)
-DLL void SCICreateMapSequence(sci_map_t map,
- sci_sequence_t *sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E S E Q U E N C E *
- * *
- * Flags: *
- * None *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveSequence)
-DLL void SCIRemoveSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T A R T S E Q U E N C E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIStartSequence _SISCI_EXPANDE_FUNCTION_NAME(SCIStartSequence)
-DLL sci_sequence_status_t SCIStartSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I C H E C K S E Q U E N CE *
- * *
- * Flags *
- * *
- * SCI_FLAG_NO_FLUSH *
- * SCI_FLAG_NO_STORE_BARRIER *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICheckSequence _SISCI_EXPANDE_FUNCTION_NAME(SCICheckSequence)
-DLL sci_sequence_status_t SCICheckSequence(sci_sequence_t sequence,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S T O R E B A R R I E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * *
- *********************************************************************************/
-#define SCIStoreBarrier _SISCI_EXPANDE_FUNCTION_NAME(SCIStoreBarrier)
-DLL void SCIStoreBarrier(sci_sequence_t sequence,
- unsigned int flags);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H R E A D B U F F E R S *
- * *
- *********************************************************************************/
-#define SCIFlushReadBuffers _SISCI_EXPANDE_FUNCTION_NAME(SCIFlushReadBuffers)
-DLL void SCIFlushReadBuffers(sci_sequence_t sequence);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P R O B E N O D E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIProbeNode _SISCI_EXPANDE_FUNCTION_NAME(SCIProbeNode)
-DLL int SCIProbeNode(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int nodeId,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCIGetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCIGetCSRRegister)
-DLL unsigned int SCIGetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T C S R R E G I S T E R *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_LINK_ACCESS - It was not possible to communicate via the *
- * local adapter. *
- * SCI_ERR_NO_REMOTE_LINK_ACCESS - It was not possible to communicate via a *
- * remote switch port. *
- * *
- *********************************************************************************/
-#define SCISetCSRRegister _SISCI_EXPANDE_FUNCTION_NAME(SCISetCSRRegister)
-DLL void SCISetCSRRegister(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int SCINodeId,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I G E T L O C A L C S R *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIGetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCIGetLocalCSR)
-DLL unsigned int SCIGetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I S E T L O C A L C S R *
- * *
- * SISCI Priveleged function
- *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCISetLocalCSR _SISCI_EXPANDE_FUNCTION_NAME(SCISetLocalCSR)
-DLL void SCISetLocalCSR(sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int CSROffset,
- unsigned int CSRValue,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A T T A C H P H Y S I C A L M E M O R Y *
- * *
- * SISCI Priveleged function *
- * *
- * Description: *
- * *
- * This function enables usage of physical devices and memory regions where the *
- * Physical PCI bus address ( and mapped CPU address ) are already known. *
- * The function will register the physical memory as a SISCI segment which can *
- * be connected and mapped as a regular SISCI segment. *
- * *
- * Requirements: *
- * *
- * SCICreateSegment() with flag SCI_FLAG_EMPTY must have been called in advance *
- * *
- * Parameter description: *
- * sci_ioaddr_t ioaddress : This is the address on the PCI bus that a PCI bus *
- * master has to use to write to the specified memory *
- * void * address : This is the (mapped) virtual address that the *
- * application has to use to access the device. *
- * This means that the device has to be mapped in *
- * advance bye the devices own driver. *
- * If the device is not to be accessed by the local *
- * CPU, the address pointer shold be set to NULL *
- * Flags *
- * *
- * None *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIAttachPhysicalMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachPhysicalMemory)
-DLL void SCIAttachPhysicalMemory(sci_ioaddr_t ioaddress,
- void *address,
- unsigned int busNo,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I Q U E R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_QUERY - Unrecognized command. *
- * *
- *********************************************************************************/
-#define SCIQuery _SISCI_EXPANDE_FUNCTION_NAME(SCIQuery)
-DLL void SCIQuery(unsigned int command,
- void *data,
- unsigned int flags,
- sci_error_t *error);
-
-
-/* MAJOR QUERY COMMANDS */
-
-/* This command requires a pointer to a structure of type */
-/* "sci_query_string". The string will be filled in by the query. */
-#define SCI_Q_VENDORID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_VENDORID)
-extern const unsigned int SCI_Q_VENDORID;
-
-
-/* Same as for SCI_VENDOR_ID */
-#define SCI_Q_API _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_API)
-extern const unsigned int SCI_Q_API;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_adapter" struct. */
-#define SCI_Q_ADAPTER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER)
-extern const unsigned int SCI_Q_ADAPTER;
-
-
-/* User passes a pointer to an allocated object of the */
-/* "sci_query_system" struct. */
-#define SCI_Q_SYSTEM _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM)
-extern const unsigned int SCI_Q_SYSTEM;
-
-#define SCI_Q_LOCAL_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT;
-
-#define SCI_Q_REMOTE_SEGMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT;
-
-#define SCI_Q_MAP _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP)
-extern const unsigned int SCI_Q_MAP;
-
-typedef char* sci_semaphoreId_t;
-
-#ifdef WIN32
-struct _semaphoreid {
- char *semaphoreName;
-};
-#endif /*WIN32*/
-
-typedef struct {
- char *str; /* Pointer to a string of minimum "length" characters */
- unsigned int length;
-} sci_query_string_t;
-
-
-typedef struct {
- unsigned int localAdapterNo; /* The adapter no. that the query concern. */
- unsigned int portNo; /* The SCI Link port number that the query concern. */
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_adapter_t;
-
-
-typedef struct {
- unsigned int subcommand; /* A subcommand as specified below. */
- void *data; /* A pointer to an unsigned int that will return */
- /* the response to the query. */
-} sci_query_system_t;
-
-typedef struct {
- sci_local_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_local_segment_t;
-
-typedef struct {
- sci_remote_segment_t segment;
- unsigned int subcommand;
- union {
- sci_ioaddr_t ioaddr;
- } data;
-} sci_query_remote_segment_t;
-
-typedef struct {
- sci_map_t map;
- unsigned int subcommand;
- unsigned int data;
-} sci_query_map_t;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_ADAPTER */
-#define SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_SIZE_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT)
-extern const unsigned int SCI_Q_ADAPTER_DMA_OFFSET_ALIGNMENT;
-
-#define SCI_Q_ADAPTER_DMA_MTU _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_DMA_MTU)
-extern const unsigned int SCI_Q_ADAPTER_DMA_MTU;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_DMA_SIZE;
-
-#define SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_SUGGESTED_MIN_BLOCK_SIZE;
-
-#define SCI_Q_ADAPTER_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_NODEID;
-
-#define SCI_Q_ADAPTER_SERIAL_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SERIAL_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_SERIAL_NUMBER;
-
-#define SCI_Q_ADAPTER_CARD_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CARD_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_CARD_TYPE;
-
-#define SCI_Q_ADAPTER_NUMBER_OF_STREAMS _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER_OF_STREAMS)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER_OF_STREAMS;
-
-#define SCI_Q_ADAPTER_STREAM_BUFFER_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_STREAM_BUFFER_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_STREAM_BUFFER_SIZE;
-
-#define SCI_Q_ADAPTER_CONFIGURED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONFIGURED)
-extern const unsigned int SCI_Q_ADAPTER_CONFIGURED;
-
-#define SCI_Q_ADAPTER_LINK_OPERATIONAL _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LINK_OPERATIONAL)
-extern const unsigned int SCI_Q_ADAPTER_LINK_OPERATIONAL;
-
-#define SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK)
-extern const unsigned int SCI_Q_ADAPTER_HW_LINK_STATUS_IS_OK;
-
-#define SCI_Q_ADAPTER_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_NUMBER;
-
-#define SCI_Q_ADAPTER_INSTANCE_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_INSTANCE_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_INSTANCE_NUMBER;
-
-#define SCI_Q_ADAPTER_FIRMWARE_OK _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_FIRMWARE_OK)
-extern const unsigned int SCI_Q_ADAPTER_FIRMWARE_OK;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_SWITCH _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_SWITCH)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_SWITCH;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_TYPE;
-
-#define SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER)
-extern const unsigned int SCI_Q_ADAPTER_LOCAL_SWITCH_PORT_NUMBER;
-
-#define SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT)
-extern const unsigned int SCI_Q_ADAPTER_CONNECTED_TO_EXPECTED_SWITCH_PORT;
-
-#define SCI_Q_ADAPTER_ATT_PAGE_SIZE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_PAGE_SIZE)
-extern const unsigned int SCI_Q_ADAPTER_ATT_PAGE_SIZE;
-
-#define SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_NUMBER_OF_ENTRIES;
-
-#define SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES)
-extern const unsigned int SCI_Q_ADAPTER_ATT_AVAILABLE_ENTRIES;
-
-#define SCI_Q_ADAPTER_PHYS_MEM_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MEM_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MEM_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_MBX_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SCI_Q_ADAPTER_PHYS_MBX_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_MBX_NODEID;
-
-#define SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID)
-extern const unsigned int SCI_Q_ADAPTER_PHYS_LINK_PORT_NODEID;
-
-#define SCI_Q_ADAPTER_SCI_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_SCI_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_SCI_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_B_LINK_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_B_LINK_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_B_LINK_FREQUENCY;
-
-#define SCI_Q_ADAPTER_IO_BUS_FREQUENCY _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_ADAPTER_IO_BUS_FREQUENCY)
-extern const unsigned int SCI_Q_ADAPTER_IO_BUS_FREQUENCY;
-
-/* Minor query commands (sub-commands) for adapter specific information SCI_SYSTEM */
-#define SCI_Q_SYSTEM_HOSTBRIDGE _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_HOSTBRIDGE)
-extern const unsigned int SCI_Q_SYSTEM_HOSTBRIDGE;
-
-#define SCI_Q_SYSTEM_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_POSTING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_POSTING_ENABLED;
-
-#define SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED)
-extern const unsigned int SCI_Q_SYSTEM_WRITE_COMBINING_ENABLED;
-
-#define SCI_Q_LOCAL_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_LOCAL_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_LOCAL_SEGMENT_IOADDR;
-
-#define SCI_Q_REMOTE_SEGMENT_IOADDR _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_REMOTE_SEGMENT_IOADDR)
-extern const unsigned int SCI_Q_REMOTE_SEGMENT_IOADDR;
-
-#define SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_MAPPED_TO_LOCAL_TARGET;
-
-#define SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET _SISCI_EXPANDE_CONSTANT_NAME(SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET)
-extern const unsigned int SCI_Q_MAP_QUERY_REMOTE_MAPPED_TO_LOCAL_TARGET;
-
-#define HOSTBRIDGE_NOT_AVAILABLE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_NOT_AVAILABLE)
-extern const unsigned int HOSTBRIDGE_NOT_AVAILABLE;
-
-#define HOSTBRIDGE_UNKNOWN _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_UNKNOWN)
-extern const unsigned int HOSTBRIDGE_UNKNOWN;
-
-#define HOSTBRIDGE_440FX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440FX)
-extern const unsigned int HOSTBRIDGE_440FX;
-
-#define HOSTBRIDGE_440LX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440LX)
-extern const unsigned int HOSTBRIDGE_440LX;
-
-#define HOSTBRIDGE_440BX_A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_A)
-extern const unsigned int HOSTBRIDGE_440BX_A;
-
-#define HOSTBRIDGE_440BX_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440BX_B)
-extern const unsigned int HOSTBRIDGE_440BX_B;
-
-#define HOSTBRIDGE_440GX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_440GX)
-extern const unsigned int HOSTBRIDGE_440GX;
-
-#define HOSTBRIDGE_450KX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450KX)
-extern const unsigned int HOSTBRIDGE_450KX;
-
-#define HOSTBRIDGE_430NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_430NX)
-extern const unsigned int HOSTBRIDGE_430NX;
-
-#define HOSTBRIDGE_450NX _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX)
-extern const unsigned int HOSTBRIDGE_450NX;
-
-#define HOSTBRIDGE_450NX_MICO _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_MICO)
-extern const unsigned int HOSTBRIDGE_450NX_MICO;
-
-#define HOSTBRIDGE_450NX_PXB _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_450NX_PXB)
-extern const unsigned int HOSTBRIDGE_450NX_PXB;
-
-#define HOSTBRIDGE_I810 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810)
-extern const unsigned int HOSTBRIDGE_I810;
-
-#define HOSTBRIDGE_I810_DC100 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810_DC100)
-extern const unsigned int HOSTBRIDGE_I810_DC100;
-
-#define HOSTBRIDGE_I810E _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I810E)
-extern const unsigned int HOSTBRIDGE_I810E;
-
-#define HOSTBRIDGE_I815 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I815)
-extern const unsigned int HOSTBRIDGE_I815;
-
-#define HOSTBRIDGE_I840 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I840)
-extern const unsigned int HOSTBRIDGE_I840;
-
-#define HOSTBRIDGE_I850 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I850)
-extern const unsigned int HOSTBRIDGE_I850;
-
-#define HOSTBRIDGE_I860 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_I860)
-extern const unsigned int HOSTBRIDGE_I860;
-
-#define HOSTBRIDGE_INTEL_E7500 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_INTEL_E7500)
-extern const unsigned int HOSTBRIDGE_INTEL_E7500;
-
-#define HOSTBRIDGE_VIA_KT133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KT133)
-extern const unsigned int HOSTBRIDGE_VIA_KT133;
-
-#define HOSTBRIDGE_VIA_KX133 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_KX133)
-extern const unsigned int HOSTBRIDGE_VIA_KX133;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_133A _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_133A)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_133A;
-
-#define HOSTBRIDGE_VIA_APOLLO_PRO_266 _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_VIA_APOLLO_PRO_266)
-extern const unsigned int HOSTBRIDGE_VIA_APOLLO_PRO_266;
-
-#define HOSTBRIDGE_AMD_760_MP _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_760_MP)
-extern const unsigned int HOSTBRIDGE_AMD_760_MP;
-
-#define HOSTBRIDGE_AMD_HAMMER _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_AMD_HAMMER)
-extern const unsigned int HOSTBRIDGE_AMD_HAMMER;
-
-#define HOSTBRIDGE_SERVERWORKS_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE;
-
-#define HOSTBRIDGE_SERVERWORKS_HE_B _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_HE_B)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_HE_B;
-
-#define HOSTBRIDGE_SERVERWORKS_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_LE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_LE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_HE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_HE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_HE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_LE _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_LE)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_LE;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_WS _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_WS)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_WS;
-
-#define HOSTBRIDGE_SERVERWORKS_GC_SL _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_SERVERWORKS_GC_SL)
-extern const unsigned int HOSTBRIDGE_SERVERWORKS_GC_SL;
-
-
-#define HOSTBRIDGE_WRITE_POSTING_DISABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_DISABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_DISABLED;
-
-#define HOSTBRIDGE_WRITE_POSTING_ENABLED _SISCI_EXPANDE_CONSTANT_NAME(HOSTBRIDGE_WRITE_POSTING_ENABLED)
-extern const unsigned int HOSTBRIDGE_WRITE_POSTING_ENABLED;
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C R E A T E D M A Q U E U E *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_PHDMA : Create physical DMA queue. Please note that this is an *
- * priveleged operation. *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCICreateDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCICreateDMAQueue)
-DLL void SCICreateDMAQueue(sci_desc_t sd,
- sci_dma_queue_t *dq,
- unsigned int localAdapterNo,
- unsigned int maxEntries,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Not allowed in this queue state. *
- * *
- *********************************************************************************/
-#define SCIRemoveDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveDMAQueue)
-DLL void SCIRemoveDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I E N Q U E U E D M A T R A N S F E R *
- * *
- * Flags: *
- * *
- * SCI_FLAG_DMA_READ - The DMA will be remote --> local *
- * (default is local --> remote) *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the offset and size is larger *
- * than the segment size or larger than max *
- * DMA size. *
- * SCI_ERR_MAX_ENTRIES - The DMA queue is full *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_SEGMENT_NOT_PREPARED - The local segment has not been prepared for *
- * access from the adapter associated with the *
- * queue. *
- * SCI_ERR_SEGMENT_NOT_CONNECTED - The remote segment is not connected through *
- * the adapter associated with the queue. *
- *********************************************************************************/
-#define SCIEnqueueDMATransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIEnqueueDMATransfer)
-DLL sci_dma_queue_state_t SCIEnqueueDMATransfer(sci_dma_queue_t dq,
- sci_local_segment_t localSegment,
- sci_remote_segment_t remoteSegment,
- unsigned int localOffset,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I P O S T D M A Q U E U E *
- * *
- * Flags: *
- * *
- * SCI_FLAG_USE_CALLBACK - The end of the transfer will cause the callback *
- * function to be invoked. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIPostDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIPostDMAQueue)
-DLL void SCIPostDMAQueue(sci_dma_queue_t dq,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortDMAQueue)
-DLL void SCIAbortDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I R E S E T D M A Q U E U E *
- * *
- * Flags *
- * None. * *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIResetDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIResetDMAQueue)
-DLL void SCIResetDMAQueue(sci_dma_queue_t dq,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I D M A Q U E U E S T A T E *
- * *
- *********************************************************************************/
-#define SCIDMAQueueState _SISCI_EXPANDE_FUNCTION_NAME(SCIDMAQueueState)
-DLL sci_dma_queue_state_t SCIDMAQueueState(sci_dma_queue_t dq);
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R D M A Q U E U E *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForDMAQueue _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForDMAQueue)
-DLL sci_dma_queue_state_t SCIWaitForDMAQueue(sci_dma_queue_t dq,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I P H D M A E N Q U E U E *
- * *
- * SISCI Priveleged function *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_READ *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaEnqueue _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaEnqueue)
-DLL void SCIphDmaEnqueue(sci_dma_queue_t dmaqueue,
- unsigned int size,
- sci_ioaddr_t localBusAddr,
- unsigned int remote_nodeid,
- unsigned int remote_highaddr,
- unsigned int remote_lowaddr,
- unsigned int flags,
- sci_error_t *error);
-
-/*********************************************************************************
- * *
- * S C I P H D M A S T A R T *
- * *
- * Flags *
- * *
- * SCI_FLAG_DMA_WAIT *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_DMA_RESET *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIphDmaStart _SISCI_EXPANDE_FUNCTION_NAME(SCIphDmaStart)
-DLL sci_dma_queue_state_t SCIphDmaStart(sci_dma_queue_t dmaqueue,
- sci_cb_dma_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-#ifdef WIN32
-/*********************************************************************************
- * *
- * S C I C R E A T E N A M E D I N T E R R U P T *
- * *
- * Flags *
- * *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_FIXED_INTNO *
- * SCI_FLAG_SHARED_INT *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INTNO_USED - This interrupt number is already used. *
- * *
- *********************************************************************************/
-#define SCICreateNamedInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateNamedInterrupt)
-DLL void SCICreateNamedInterrupt(sci_desc_t sd,
- sci_local_interrupt_t *interrupt,
- unsigned int localAdapterNo,
- unsigned int *interruptNo,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_semaphoreId_t semId,
- sci_error_t *error);
-#endif /*WIN32*/
-
-/*********************************************************************************
- * *
- * S C I C R E A T E I N T E R R U P T *
- * *
- * Flags *
- * *
- * SCI_FLAG_USE_CALLBACK *
- * SCI_FLAG_FIXED_INTNO *
- * SCI_FLAG_SHARED_INT *
- * SCI_FLAG_COUNTING_INT: This flag will enable counting interrupts. This means *
- * that the number of trigged interrupts is equal to the *
- * number of received interrupts. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_INTNO_USED - This interrupt number is already used. *
- * *
- *********************************************************************************/
-#define SCICreateInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCICreateInterrupt)
-DLL void SCICreateInterrupt(sci_desc_t sd,
- sci_local_interrupt_t *interrupt,
- unsigned int localAdapterNo,
- unsigned int *interruptNo,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E M O V E I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- *********************************************************************************/
-#define SCIRemoveInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIRemoveInterrupt)
-DLL void SCIRemoveInterrupt(sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_TIMEOUT - The function timed out after specified timeout value. *
- * SCI_ERR_CANCELLED - The wait was interrupted by a call to *
- * SCIRemoveInterrupt. *
- * The handle is invalid when this error code is returned.*
- * *
- *********************************************************************************/
-#define SCIWaitForInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForInterrupt)
-DLL void SCIWaitForInterrupt(sci_local_interrupt_t interrupt,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * *
- * SCI_FLAG_COUNTING_INT: This flag will enable counting interrupts. This means *
- * that the number of trigged interrupts is equal to the *
- * number of received interrupts. *
- * if SCI_FLAG_COUNTING_INT is not used, the interface *
- * guarentees that there always will be an remote *
- * interrupt generated after the first and after the last*
- * trigger. If interupts is triggered faster than the *
- * remote interrupt handler can handle, interrupts may be*
- * lost. *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_NO_SUCH_INTNO - No such interrupt number. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIConnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectInterrupt)
-DLL void SCIConnectInterrupt(sci_desc_t sd,
- sci_remote_interrupt_t *interrupt,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- unsigned int interruptNo,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I D I S C O N N E C T I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisconnectInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisconnectInterrupt)
-DLL void SCIDisconnectInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I T R I G G E R I N T E R R U P T *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCITriggerInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCITriggerInterrupt)
-DLL void SCITriggerInterrupt(sci_remote_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R I N T E R R U P T F L A G *
- * *
- * *
- * This function register an "interrupt flag" that is identified as an unique *
- * location within a local segment. If successful, the resulting interrupt *
- * handle will have been associated with the specified local segment. *
- * *
- * It is up to the (remote) client(s) to set up an "interrupt mapping" for the *
- * corresponding segment offset using either the *
- * *
- * - SCI_FLAG_CONDITIONAL_INTERRUPT_MAP *
- * *
- * or the *
- * *
- * - SCI_FLAG_UNCONDITIONAL_DATA_INTERRUPT_MAP *
- * *
- * option to "SCIMapRemoteSegment()". - I.e. after having established a *
- * connection to the corresponding segment. A trigger operation can then *
- * be implemented using a store operation via the relevant "interrupt map". *
- * *
- * *
- * *
- * *
- * *
- * Flags: *
- * *
- * SCI_FLAG_CONDITIONAL_INTERRUPT - Triggering is to take place using *
- * "conditional interrupts". *
- * *
- * *
- * *
- * Specific error codes for this function: *
- * None. *
- * *
- *********************************************************************************/
-#define SCIRegisterInterruptFlag _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterInterruptFlag)
-DLL void SCIRegisterInterruptFlag(
- unsigned int localAdapterNo,
- sci_local_interrupt_t *interrupt,
- sci_local_segment_t segment,
- unsigned int offset,
- sci_cb_interrupt_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I E N A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * This function make sure that another HW interrupt will take place the next *
- * time the corresponding interrupt flag is triggered by a *
- * "conditional interrupt" operation. *
- * *
- * Default semantics: *
- * *
- * When successful, the client can rely on that the first subsequent trigger *
- * operation will cause a HW interrupt and subsequently cause the client *
- * handler function to be invoked. *
- * *
- * If an interrupt was triggered in parallell with the enable operation, then *
- * the operation will fail (SCI_ERR_COND_INT_RACE_PROBLEM), and the client can *
- * not rely on another trigger operation will lead to handler invocation. *
- * Hence, any state checking normally associated with handling the *
- * corresponding interrupt should take place before attempting to enable *
- * again. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_COND_INT_RACE_PROBLEM - The enable operation failed because an *
- * incomming trigger operation happened *
- * concurrently. *
- * *
- *********************************************************************************/
-#define SCIEnableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIEnableConditionalInterrupt)
-DLL void SCIEnableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I D I S A B L E C O N D I T I O N A L I N T E R R U P T *
- * *
- * *
- * Prevent subsequent "conditional interrupt"trigger operations for *
- * the specified interupt flag from causing HW interrupt and handler *
- * invocations. *
- * *
- * *
- * Default semantics: *
- * *
- * If successful, no subsequent HW interrupts will take place, but handler *
- * invocations that have already been scheduled may still take place. *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * *
- *********************************************************************************/
-#define SCIDisableConditionalInterrupt _SISCI_EXPANDE_FUNCTION_NAME(SCIDisableConditionalInterrupt)
-DLL void SCIDisableConditionalInterrupt(
- sci_local_interrupt_t interrupt,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I G E T C O N D I T I O N A L I N T E R R U P T C O U N T E R *
- * *
- * *
- * Returns a value that indicates the number of times this flag has *
- * been trigged since the last time it was enabled or disabled. *
- * Calling the SCIEnableConditionalInterrupt / SCIDisableConditionalInterrupt *
- * functions will reset the counter value. *
- * *
- * Default semantics: *
- * *
- * If successful, the current trig count is returned in the *
- * interruptTrigCounter parameter. *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OVERFLOW - The number of trig operations have exceeded the range *
- * that can be counted. *
- *********************************************************************************/
-#define SCIGetConditionalInterruptTrigCounter _SISCI_EXPANDE_FUNCTION_NAME(SCIGetConditionalInterruptTrigCounter)
-DLL void SCIGetConditionalInterruptTrigCounter(
- sci_local_interrupt_t interrupt,
- unsigned int *interruptTrigCounter,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlock _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlock)
-DLL void SCITransferBlock(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I T R A N S F E R B L O C K A S Y N C *
- * *
- * Flags *
- * *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_USE_CALLBACK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger than *
- * the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-#define SCITransferBlockAsync _SISCI_EXPANDE_FUNCTION_NAME(SCITransferBlockAsync)
-DLL void SCITransferBlockAsync(sci_map_t sourceMap,
- unsigned int sourceOffset,
- sci_map_t destinationMap,
- unsigned int destinationOffset,
- unsigned int size,
- sci_block_transfer_t *block,
- sci_cb_block_transfer_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I W A I T F O R B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * SCI_ERR_TIMEOUT - The function timed out after specified *
- * timeout value. *
- * *
- *********************************************************************************/
-#define SCIWaitForBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIWaitForBlockTransfer)
-DLL void SCIWaitForBlockTransfer(sci_block_transfer_t block,
- unsigned int timeout,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I A B O R T B L O C K T R A N S F E R *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_ILLEGAL_OPERATION - Illegal operation *
- * *
- *********************************************************************************/
-#define SCIAbortBlockTransfer _SISCI_EXPANDE_FUNCTION_NAME(SCIAbortBlockTransfer)
-DLL void SCIAbortBlockTransfer(sci_block_transfer_t block,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-#define SCIMemCpy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCpy)
-DLL void SCIMemCpy(sci_sequence_t sequence,
- void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I M E M C O P Y *
- * *
- * Flags: *
- * SCI_FLAG_BLOCK_READ *
- * SCI_FLAG_ERROR_CHECK *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_OUT_OF_RANGE - The sum of the size and offset is larger *
- * than the corresponding map size. *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_OFFSET_ALIGNMENT - Offset is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_TRANSFER_FAILED - The data transfer failed. *
- * *
- *********************************************************************************/
-
-
-#define SCIMemCopy _SISCI_EXPANDE_FUNCTION_NAME(SCIMemCopy)
-DLL void SCIMemCopy(void *memAddr,
- sci_map_t remoteMap,
- unsigned int remoteOffset,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*********************************************************************************
- * *
- * S C I R E G I S T E R S E G M E N T M E M O R Y *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required by *
- * the implementation. *
- * SCI_ERR_ILLEGAL_ADDRESS - Illegal address. *
- * SCI_ERR_OUT_OF_RANGE - Size is larger than the maximum size for the *
- * local segment. *
- * *
- *********************************************************************************/
-#define SCIRegisterSegmentMemory _SISCI_EXPANDE_FUNCTION_NAME(SCIRegisterSegmentMemory)
-DLL void SCIRegisterSegmentMemory(void *address,
- unsigned int size,
- sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-
-
-/*********************************************************************************
- * *
- * S C I C O N N E C T S C I S P A C E *
- * *
- * SISCI Priveleged function *
- * *
- * *
- * Flags *
- * None. *
- * *
- * *
- * Specific error codes for this function: *
- * *
- * SCI_ERR_SIZE_ALIGNMENT - Size is not correctly aligned as required *
- * by the implementation. *
- * SCI_ERR_CONNECTION_REFUSED - Connection attempt refused by remote node. *
- * *
- *********************************************************************************/
-#define SCIConnectSCISpace _SISCI_EXPANDE_FUNCTION_NAME(SCIConnectSCISpace)
-DLL void SCIConnectSCISpace(sci_desc_t sd,
- unsigned int localAdapterNo,
- sci_remote_segment_t *segment,
- sci_address_t address,
- unsigned int size,
- unsigned int flags,
- sci_error_t *error);
-
-
-
-/*
- * =====================================================================================
- *
- * S C I A T T A C H L O C A L S E G M E N T
- * Description:
- *
- * SCIAttachLocalSegment() permits an application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- *
- * SCI_FLAG_USE_CALLBACK - The callback function will be invoked for events
- * on this segment.
- *
- *
- * Specific error codes for this function:
- *
- * SCI_ERR_ACCESS - No such shared segment
- * SCI_ERR_NO_SUCH_SEGMENT - No such segment
- * Note: Current implenentation will return SCI_ERR_ACCESS for both cases. This will
- * change from next release. Application should handle both cases.
- *
- * =====================================================================================
- */
-#define SCIAttachLocalSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIAttachLocalSegment)
-
-DLL void
-SCIAttachLocalSegment(sci_desc_t sd,
- sci_local_segment_t *segment,
- unsigned int segmentId,
- unsigned int *size,
- sci_cb_local_segment_t callback,
- void *callbackArg,
- unsigned int flags,
- sci_error_t *error);
-/*
- * =====================================================================================
- *
- * S C I S H A R E S E G M E N T
- *
- * Description:
- *
- * SCIShareSegment() permits other application to "attach" to an already existing
- * local segment, implying that two or more application want
- * share the same local segment. The prerequest, is that the
- * application which originally created the segment ("owner") has
- * preformed a SCIShareSegment() in order to mark the segment
- * "shareable".
- *
- *
- * Flags:
- * none
- *
- * Specific error codes for this function:
- *
- *
- *
- * =====================================================================================
- */
-#define SCIShareSegment _SISCI_EXPANDE_FUNCTION_NAME(SCIShareSegment)
-
-DLL void
-SCIShareSegment(sci_local_segment_t segment,
- unsigned int flags,
- sci_error_t *error);
-
-
-/*********************************************************************************
- * *
- * S C I F L U S H *
- * *
- * This function will flush the CPU buffers and the PSB buffers. *
- * *
- * Flags *
- * SCI_FLAG_FLUSH_CPU_BUFFERS_ONLY : *
- * Only flush CPU buffers ( Write combining *
- * etc buffers). *
- * *
- *********************************************************************************/
-
-#define SCIFlush _SISCI_EXPANDE_FUNCTION_NAME(SCIFlush)
-DLL void SCIFlush(sci_sequence_t sequence,
- unsigned int flags);
-
-#if defined(CPLUSPLUS) || defined(__cplusplus)
-}
-#endif
-
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h b/ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h
deleted file mode 100644
index ce5bb2aec8e..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/sisci_demolib.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/* $Id: sisci_demolib.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_DEMOLIB_H
-#define _SISCI_DEMOLIB_H
-
-
-#if defined(_REENTRANT)
-
-#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_MT_ ## name
-
-#else
-
-#define _SISCI_DEMOLIB_EXPAND_NAME(name) _SISCI_DEMOLIB_ST_ ## name
-
-#endif
-
-/*********************************************************************************/
-/* Q U E R Y A D A P T E R */
-/* */
-/*********************************************************************************/
-
-#define QueryAdapter _SISCI_DEMOLIB_EXPAND_NAME(QueryAdapter)
-
-sci_error_t QueryAdapter(
- unsigned int subcommand,
- unsigned int localAdapterNo,
- unsigned int portNo,
- unsigned int *data);
-
-
-/*********************************************************************************/
-/* Q U E R Y S Y S T E M */
-/* */
-/*********************************************************************************/
-
-#define QuerySystem _SISCI_DEMOLIB_EXPAND_NAME(QuerySystem)
-
-sci_error_t QuerySystem(
- unsigned int subcommand,
- unsigned int *data);
-
-
-/*********************************************************************************/
-/* D E T E C T F I R S T A D A P T E R C A R D */
-/* */
-/*********************************************************************************/
-
-#define DetectFirstAdapterCard _SISCI_DEMOLIB_EXPAND_NAME(DetectFirstAdapterCard)
-
-sci_error_t DetectFirstAdapterCard(
- unsigned int *localAdapterNo,
- unsigned int *localNodeId);
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R T Y P E */
-/* */
-/*********************************************************************************/
-
-#define GetAdapterType _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterType)
-
-sci_error_t GetAdapterType(unsigned int localAdapterNo,
- unsigned int *adapterType);
-
-
-/*********************************************************************************/
-/* G E T L O C A L N O D E I D */
-/* */
-/*********************************************************************************/
-
-#define GetLocalNodeId _SISCI_DEMOLIB_EXPAND_NAME(GetLocalNodeId)
-
-sci_error_t GetLocalNodeId(
- unsigned int localAdapterNo,
- unsigned int *localNodeId);
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R S E R I A L N U M B E R */
-/* */
-/*********************************************************************************/
-
-#define GetAdapterSerialNumber _SISCI_DEMOLIB_EXPAND_NAME(GetAdapterSerialNumber)
-
-sci_error_t GetAdapterSerialNumber(
- unsigned int localAdapterNo,
- unsigned int *serialNo);
-
-
-
-/*********************************************************************************/
-/* G E T H O S T B R I D G E T Y P E */
-/* */
-/*********************************************************************************/
-
-#define GetHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(GetHostbridgeType)
-
-sci_error_t GetHostbridgeType(unsigned int *hostbridgeType);
-
-
-
-/*********************************************************************************/
-/* P R I N T H O S T B R I D G E T Y P E */
-/* */
-/*********************************************************************************/
-
-#define PrintHostbridgeType _SISCI_DEMOLIB_EXPAND_NAME(PrintHostbridgeType)
-
-void PrintHostbridgeType(unsigned int hostbridge);
-
-
-
-/*********************************************************************************/
-/* G E T A P I V E R S I O N S T R I N G */
-/* */
-/*********************************************************************************/
-
-#define GetAPIVersionString _SISCI_DEMOLIB_EXPAND_NAME(GetAPIVersionString)
-
-sci_error_t GetAPIVersionString(char str[], unsigned int strLength);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R I O B U S F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterIoBusFrequency(unsigned int localAdapterNo,
- unsigned int *ioBusFrequency);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R S C I L I N K F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterSciLinkFrequency(unsigned int localAdapterNo,
- unsigned int *sciLinkFrequency);
-
-
-
-/*********************************************************************************/
-/* G E T A D A P T E R B L I N K F R E Q U E N C Y */
-/* */
-/*********************************************************************************/
-
-sci_error_t GetAdapterBlinkFrequency(unsigned int localAdapterNo,
- unsigned int *bLinkFrequency);
-
-
-/*********************************************************************************/
-/* S E N D I N T E R R U P T */
-/* */
-/*********************************************************************************/
-
-#define SendInterrupt _SISCI_DEMOLIB_EXPAND_NAME(SendInterrupt)
-
-sci_error_t SendInterrupt(
- sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int localNodeId,
- unsigned int remoteNodeId,
- unsigned int interruptNo);
-
-
-/*********************************************************************************/
-/* R E C E I V E I N T E R R U P T */
-/* */
-/*********************************************************************************/
-
-#define ReceiveInterrupt _SISCI_DEMOLIB_EXPAND_NAME(ReceiveInterrupt)
-
-sci_error_t ReceiveInterrupt(
- sci_desc_t sd,
- unsigned int localAdapterNo,
- unsigned int localNodeId,
- unsigned int interruptNo);
-
-
-/*********************************************************************************/
-/* E N D I A N S W A P */
-/* */
-/*********************************************************************************/
-
-#define EndianSwap _SISCI_DEMOLIB_EXPAND_NAME(EndianSwap)
-
-unsigned int EndianSwap (unsigned int value);
-
-
-/*********************************************************************************/
-/* S L E E P M I L L I S E C O N D S */
-/* */
-/*********************************************************************************/
-
-#define SleepMilliseconds _SISCI_DEMOLIB_EXPAND_NAME(SleepMilliseconds)
-
-void SleepMilliseconds(int milliseconds);
-
-
-
-
-#endif
diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_error.h b/ndb/src/external/WIN32.x86/sci/include/sisci_error.h
deleted file mode 100644
index 56fa0d18b3a..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/sisci_error.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $Id: sisci_error.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_ERROR_H_
-#define _SISCI_ERROR_H_
-
-
-/* SCI Error return values always have 30 bit set */
-#define SCI_ERR_MASK 0x40000000
-#define SCI_ERR_REMOTE_MASK 0x01 /* Remote errors should have bit 0 set */
-
-#define SCI_ERR(u) ((unsigned32)(u)&0x7FFFFFFF )
-
-/* Error codes */
-typedef enum {
- SCI_ERR_OK = 0x000,
-
-
- SCI_ERR_BUSY = (0x900 | SCI_ERR_MASK),
- SCI_ERR_FLAG_NOT_IMPLEMENTED = (0x901 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_FLAG = (0x902 | SCI_ERR_MASK),
- SCI_ERR_NOSPC = (0x904 | SCI_ERR_MASK),
- SCI_ERR_API_NOSPC = (0x905 | SCI_ERR_MASK),
- SCI_ERR_HW_NOSPC = (0x906 | SCI_ERR_MASK),
- SCI_ERR_NOT_IMPLEMENTED = (0x907 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADAPTERNO = (0x908 | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_ADAPTERNO = (0x909 | SCI_ERR_MASK),
- SCI_ERR_TIMEOUT = (0x90A | SCI_ERR_MASK),
- SCI_ERR_OUT_OF_RANGE = (0x90B | SCI_ERR_MASK),
- SCI_ERR_NO_SUCH_SEGMENT = (0x90C | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_NODEID = (0x90D | SCI_ERR_MASK),
- SCI_ERR_CONNECTION_REFUSED = (0x90E | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_CONNECTED = (0x90F | SCI_ERR_MASK),
- SCI_ERR_SIZE_ALIGNMENT = (0x910 | SCI_ERR_MASK),
- SCI_ERR_OFFSET_ALIGNMENT = (0x911 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_PARAMETER = (0x912 | SCI_ERR_MASK),
- SCI_ERR_MAX_ENTRIES = (0x913 | SCI_ERR_MASK),
- SCI_ERR_SEGMENT_NOT_PREPARED = (0x914 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_ADDRESS = (0x915 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_OPERATION = (0x916 | SCI_ERR_MASK),
- SCI_ERR_ILLEGAL_QUERY = (0x917 | SCI_ERR_MASK),
- SCI_ERR_SEGMENTID_USED = (0x918 | SCI_ERR_MASK),
- SCI_ERR_SYSTEM = (0x919 | SCI_ERR_MASK),
- SCI_ERR_CANCELLED = (0x91A | SCI_ERR_MASK),
- SCI_ERR_NOT_CONNECTED = (0x91B | SCI_ERR_MASK),
- SCI_ERR_NOT_AVAILABLE = (0x91C | SCI_ERR_MASK),
- SCI_ERR_INCONSISTENT_VERSIONS = (0x91D | SCI_ERR_MASK),
- SCI_ERR_COND_INT_RACE_PROBLEM = (0x91E | SCI_ERR_MASK),
- SCI_ERR_OVERFLOW = (0x91F | SCI_ERR_MASK),
- SCI_ERR_NOT_INITIALIZED = (0x920 | SCI_ERR_MASK),
-
- SCI_ERR_ACCESS = (0x921 | SCI_ERR_MASK),
-
- SCI_ERR_NO_SUCH_NODEID = (0xA00 | SCI_ERR_MASK),
- SCI_ERR_NODE_NOT_RESPONDING = (0xA02 | SCI_ERR_MASK),
- SCI_ERR_NO_REMOTE_LINK_ACCESS = (0xA04 | SCI_ERR_MASK),
- SCI_ERR_NO_LINK_ACCESS = (0xA05 | SCI_ERR_MASK),
- SCI_ERR_TRANSFER_FAILED = (0xA06 | SCI_ERR_MASK),
-
- SCI_ERR_EWOULD_BLOCK = ( 0xB00 | SCI_ERR_MASK),
- SCI_ERR_SEMAPHORE_COUNT_EXCEEDED = ( 0xB01 | SCI_ERR_MASK),
- SCI_ERR_IRQL_ILLEGAL = ( 0xB02 | SCI_ERR_MASK)
-
-} sci_error_t;
-
-
-#endif /* _SCI_ERROR_H_ */
-
-
-
diff --git a/ndb/src/external/WIN32.x86/sci/include/sisci_types.h b/ndb/src/external/WIN32.x86/sci/include/sisci_types.h
deleted file mode 100644
index 03e7957c3f2..00000000000
--- a/ndb/src/external/WIN32.x86/sci/include/sisci_types.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $Id: sisci_types.h,v 1.1 2002/12/13 12:17:23 hin Exp $ */
-
-/*******************************************************************************
- * *
- * Copyright (C) 1993 - 2000 *
- * Dolphin Interconnect Solutions AS *
- * *
- * 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 _SISCI_TYPES_H
-#define _SISCI_TYPES_H
-
-#include "sisci_error.h"
-
-#ifndef IN
-#define IN
-#endif
-
-#ifndef OUT
-#define OUT
-#endif
-
-#ifndef IN_OUT
-#define IN_OUT
-#endif
-
-/* Opaque data types for descriptors/handles */
-typedef struct sci_desc *sci_desc_t;
-typedef struct sci_local_segment *sci_local_segment_t;
-typedef struct sci_remote_segment *sci_remote_segment_t;
-
-typedef struct sci_map *sci_map_t;
-typedef struct sci_sequence *sci_sequence_t;
-#ifndef KERNEL
-typedef struct sci_dma_queue *sci_dma_queue_t;
-#endif
-typedef struct sci_remote_interrupt *sci_remote_interrupt_t;
-typedef struct sci_local_interrupt *sci_local_interrupt_t;
-typedef struct sci_block_transfer *sci_block_transfer_t;
-
-/*
- * Constants defining reasons for segment callbacks:
- */
-
-typedef enum {
- SCI_CB_CONNECT = 1,
- SCI_CB_DISCONNECT,
- SCI_CB_NOT_OPERATIONAL,
- SCI_CB_OPERATIONAL,
- SCI_CB_LOST
-} sci_segment_cb_reason_t;
-
-#define MAX_CB_REASON SCI_CB_LOST
-
-/* dma_queue_states is identical to the dma_queue_state_t in genif.h, they must be consistent.*/
-typedef enum {
- SCI_DMAQUEUE_IDLE,
- SCI_DMAQUEUE_GATHER,
- SCI_DMAQUEUE_POSTED,
- SCI_DMAQUEUE_DONE,
- SCI_DMAQUEUE_ABORTED,
- SCI_DMAQUEUE_ERROR
-} sci_dma_queue_state_t;
-
-
-typedef enum {
- SCI_SEQ_OK,
- SCI_SEQ_RETRIABLE,
- SCI_SEQ_NOT_RETRIABLE,
- SCI_SEQ_PENDING
-} sci_sequence_status_t;
-
-
-typedef struct {
- unsigned short nodeId; /* SCI Address bit 63 - 48 */
- unsigned short offsHi; /* SCI Address bit 47 - 32 */
- unsigned int offsLo; /* SCI Address bit 31 - 0 */
-} sci_address_t;
-
-
-typedef unsigned int sci_ioaddr_t;
-
-typedef enum {
- SCI_CALLBACK_CANCEL = 1,
- SCI_CALLBACK_CONTINUE
-} sci_callback_action_t;
-
-#ifndef KERNEL
-typedef sci_callback_action_t (*sci_cb_local_segment_t)(void *arg,
- sci_local_segment_t segment,
- sci_segment_cb_reason_t reason,
- unsigned int nodeId,
- unsigned int localAdapterNo,
- sci_error_t error);
-
-typedef sci_callback_action_t (*sci_cb_remote_segment_t)(void *arg,
- sci_remote_segment_t segment,
- sci_segment_cb_reason_t reason,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_dma_t)(void IN *arg,
- sci_dma_queue_t queue,
- sci_error_t status);
-
-
-typedef int (*sci_cb_block_transfer_t)(void *arg,
- sci_block_transfer_t block,
- sci_error_t status);
-
-
-typedef sci_callback_action_t (*sci_cb_interrupt_t)(void *arg,
- sci_local_interrupt_t interrupt,
- sci_error_t status);
-
-#endif /* KERNEL */
-#endif
diff --git a/ndb/src/kernel/Makefile_old b/ndb/src/kernel/Makefile_old
deleted file mode 100644
index d1f1741aca4..00000000000
--- a/ndb/src/kernel/Makefile_old
+++ /dev/null
@@ -1,5 +0,0 @@
-include .defs.mk
-
-DIRS := error vm ndb-main blocks
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/ERROR_codes.txt b/ndb/src/kernel/blocks/ERROR_codes.txt
index 70f11c33cd7..5193d3eae9d 100644
--- a/ndb/src/kernel/blocks/ERROR_codes.txt
+++ b/ndb/src/kernel/blocks/ERROR_codes.txt
@@ -1,8 +1,8 @@
Next QMGR 1
Next NDBCNTR 1000
Next NDBFS 2000
-Next DBACC 3001
-Next DBTUP 4007
+Next DBACC 3002
+Next DBTUP 4013
Next DBLQH 5042
Next DBDICT 6006
Next DBDIH 7174
@@ -10,7 +10,7 @@ Next DBTC 8035
Next CMVMI 9000
Next BACKUP 10022
Next DBUTIL 11002
-Next DBTUX 12001
+Next DBTUX 12007
Next SUMA 13001
TESTING NODE FAILURE, ARBITRATION
@@ -393,6 +393,13 @@ Failed Create Table:
--------------------
7173: Create table failed due to not sufficient number of fragment or
replica records.
+3001: Fail create 1st fragment
+4007 12001: Fail create 1st fragment
+4008 12002: Fail create 2nd fragment
+4009 12003: Fail create 1st attribute in 1st fragment
+4010 12004: Fail create last attribute in 1st fragment
+4011 12005: Fail create 1st attribute in 2nd fragment
+4012 12006: Fail create last attribute in 2nd fragment
Drop Table/Index:
-----------------
diff --git a/ndb/src/kernel/blocks/Makefile_old b/ndb/src/kernel/blocks/Makefile_old
deleted file mode 100644
index ce554dfc3b8..00000000000
--- a/ndb/src/kernel/blocks/Makefile_old
+++ /dev/null
@@ -1,28 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# Name Makefile
-#
-#
-#
-# List subdirectories to be travered
-include .defs.mk
-
-DIRS := \
- cmvmi \
- dbacc \
- dbdict \
- dbdih \
- dblqh \
- dbtc \
- dbtup \
- ndbfs \
- ndbcntr \
- qmgr \
- trix \
- backup \
- dbutil \
- suma \
- grep \
- dbtux
-
-include ${NDB_TOP}/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/backup/Makefile.am b/ndb/src/kernel/blocks/backup/Makefile.am
index 85bf5b12415..e669febdc0d 100644
--- a/ndb/src/kernel/blocks/backup/Makefile.am
+++ b/ndb/src/kernel/blocks/backup/Makefile.am
@@ -1,6 +1,4 @@
-SUBDIRS = restore
-
noinst_LIBRARIES = libbackup.a
libbackup_a_SOURCES = Backup.cpp BackupInit.cpp
diff --git a/ndb/src/kernel/blocks/backup/Makefile_old b/ndb/src/kernel/blocks/backup/Makefile_old
deleted file mode 100644
index 989199cbe02..00000000000
--- a/ndb/src/kernel/blocks/backup/Makefile_old
+++ /dev/null
@@ -1,18 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-#ifneq ($(MYSQLCLUSTER_TOP),)
-DIRS := restore
-#endif
-
-ARCHIVE_TARGET := backup
-
-SOURCES = Backup.cpp BackupInit.cpp
-
-include $(NDB_TOP)/Epilogue.mk
-
-$(NDB_TOP)/bin/readBackupFile: read.o
- $(C++) -o $@ read.o \
- $(NDB_TOP)/lib/libportlib.a $(NDB_TOP)/lib/libgeneral.a
-
diff --git a/ndb/src/kernel/blocks/backup/restore/Makefile.am b/ndb/src/kernel/blocks/backup/restore/Makefile.am
deleted file mode 100644
index 16550f13546..00000000000
--- a/ndb/src/kernel/blocks/backup/restore/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-
-ndbtools_PROGRAMS = ndb_restore
-
-ndb_restore_SOURCES = main.cpp consumer.cpp consumer_restore.cpp consumer_printer.cpp Restore.cpp
-
-LDADD_LOC = \
- $(top_builddir)/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
-
-include $(top_srcdir)/ndb/config/common.mk.am
-
-INCLUDES += -I.. -I$(top_srcdir)/include -I$(top_srcdir)/ndb/include -I$(top_srcdir)/ndb/src/ndbapi -I$(top_srcdir)/ndb/include/ndbapi -I$(top_srcdir)/ndb/include/util -I$(top_srcdir)/ndb/include/portlib -I$(top_srcdir)/ndb/include/kernel
-
-ndb_restore_LDFLAGS = @ndb_bin_am_ldflags@
diff --git a/ndb/src/kernel/blocks/cmvmi/Makefile_old b/ndb/src/kernel/blocks/cmvmi/Makefile_old
deleted file mode 100644
index d75e5dbf08b..00000000000
--- a/ndb/src/kernel/blocks/cmvmi/Makefile_old
+++ /dev/null
@@ -1,9 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := cmvmi
-
-SOURCES = Cmvmi.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
index c275e5382f7..5c7cc597672 100644
--- a/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
+++ b/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
@@ -1062,7 +1062,21 @@ void Dbacc::execACCFRAGREQ(Signal* signal)
{
const AccFragReq * const req = (AccFragReq*)&signal->theData[0];
jamEntry();
+ if (ERROR_INSERTED(3001)) {
+ jam();
+ addFragRefuse(signal, 1);
+ CLEAR_ERROR_INSERT_VALUE;
+ return;
+ }
tabptr.i = req->tableId;
+#ifndef VM_TRACE
+ // config mismatch - do not crash if release compiled
+ if (tabptr.i >= ctablesize) {
+ jam();
+ addFragRefuse(signal, 800);
+ return;
+ }
+#endif
ptrCheckGuard(tabptr, ctablesize, tabrec);
ndbrequire((req->reqInfo & 0xF) == ZADDFRAG);
ndbrequire(!getrootfragmentrec(signal, rootfragrecptr, req->fragId));
diff --git a/ndb/src/kernel/blocks/dbacc/Makefile_old b/ndb/src/kernel/blocks/dbacc/Makefile_old
deleted file mode 100644
index 93a830cec95..00000000000
--- a/ndb/src/kernel/blocks/dbacc/Makefile_old
+++ /dev/null
@@ -1,11 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := dbacc
-
-SOURCES = \
- DbaccInit.cpp \
- DbaccMain.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
index 882557daae1..2b9072ab042 100644
--- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
+++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
@@ -239,7 +239,11 @@ Dbdict::packTableIntoPagesImpl(SimpleProperties::Writer & w,
w.add(DictTabInfo::TableName, tablePtr.p->tableName);
w.add(DictTabInfo::TableId, tablePtr.i);
+#ifdef HAVE_TABLE_REORG
w.add(DictTabInfo::SecondTableId, tablePtr.p->secondTable);
+#else
+ w.add(DictTabInfo::SecondTableId, (Uint32)0);
+#endif
w.add(DictTabInfo::TableVersion, tablePtr.p->tableVersion);
w.add(DictTabInfo::NoOfKeyAttr, tablePtr.p->noOfPrimkey);
w.add(DictTabInfo::NoOfAttributes, tablePtr.p->noOfAttributes);
@@ -1436,6 +1440,7 @@ Uint32 Dbdict::getFreeTableRecord(Uint32 primaryTableId)
jam();
return RNIL;
}//if
+#ifdef HAVE_TABLE_REORG
bool secondFound = false;
for (tablePtr.i = firstTablePtr.i + 1; tablePtr.i < tabSize ; tablePtr.i++) {
jam();
@@ -1455,6 +1460,7 @@ Uint32 Dbdict::getFreeTableRecord(Uint32 primaryTableId)
firstTablePtr.p->tabState = TableRecord::NOT_DEFINED;
return RNIL;
}//if
+#endif
return firstTablePtr.i;
}//Dbdict::getFreeTableRecord()
@@ -4623,7 +4629,7 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it,
jam();
tablePtr.p->tabState = TableRecord::DEFINING;
}//if
-
+#ifdef HAVE_TABLE_REORG
/* ---------------------------------------------------------------- */
// Get id of second table id and check that table doesn't already exist
// and set up links between first and second table.
@@ -4637,7 +4643,7 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it,
secondTablePtr.p->tabState = TableRecord::REORG_TABLE_PREPARED;
secondTablePtr.p->secondTable = tablePtr.i;
tablePtr.p->secondTable = secondTablePtr.i;
-
+#endif
/* ---------------------------------------------------------------- */
// Set table version
/* ---------------------------------------------------------------- */
@@ -5535,10 +5541,12 @@ void Dbdict::releaseTableObject(Uint32 tableId, bool removeFromHash)
nextAttrRecord = attrPtr.p->nextAttrInTable;
c_attributeRecordPool.release(attrPtr);
}//if
+#ifdef HAVE_TABLE_REORG
Uint32 secondTableId = tablePtr.p->secondTable;
initialiseTableRecord(tablePtr);
c_tableRecordPool.getPtr(tablePtr, secondTableId);
initialiseTableRecord(tablePtr);
+#endif
return;
}//releaseTableObject()
diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.hpp b/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
index 19c03a86e22..af80bcf5f94 100644
--- a/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
+++ b/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
@@ -151,10 +151,10 @@ public:
/* Temporary record used during add/drop table */
Uint32 myConnect;
-
+#ifdef HAVE_TABLE_REORG
/* Second table used by this table (for table reorg) */
Uint32 secondTable;
-
+#endif
/* Next record in Pool */
Uint32 nextPool;
diff --git a/ndb/src/kernel/blocks/dbdict/Makefile_old b/ndb/src/kernel/blocks/dbdict/Makefile_old
deleted file mode 100644
index 46d938114fb..00000000000
--- a/ndb/src/kernel/blocks/dbdict/Makefile_old
+++ /dev/null
@@ -1,12 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := dbdict
-
-SOURCES = \
- Dbdict.cpp
-
-DIRS := printSchemafile
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/dbdih/Makefile_old b/ndb/src/kernel/blocks/dbdih/Makefile_old
deleted file mode 100644
index 83c1b95b5c4..00000000000
--- a/ndb/src/kernel/blocks/dbdih/Makefile_old
+++ /dev/null
@@ -1,13 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := dbdih
-
-DIRS := printSysfile
-
-SOURCES = \
- DbdihInit.cpp \
- DbdihMain.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/dblqh/Dblqh.hpp b/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
index d6987f3e478..739c3c741fb 100644
--- a/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
+++ b/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
@@ -2474,7 +2474,7 @@ private:
void sendExecFragRefLab(Signal* signal);
void fragrefLab(Signal* signal, BlockReference retRef,
Uint32 retPtr, Uint32 errorCode);
- void accFragRefLab(Signal* signal);
+ void abortAddFragOps(Signal* signal);
void rwConcludedLab(Signal* signal);
void sendsttorryLab(Signal* signal);
void initialiseRecordsLab(Signal* signal, Uint32 data, Uint32, Uint32);
diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
index af1131e5e55..5622706a96c 100644
--- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
+++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
@@ -912,6 +912,10 @@ void Dblqh::execREAD_CONFIG_REQ(Signal* signal)
/* *********************************************************> */
/* LQHFRAGREQ: Create new fragments for a table. Sender DICT */
/* *********************************************************> */
+
+// this unbelievable mess could be replaced by one signal to LQH
+// and execute direct to local DICT to get everything at once
+
void Dblqh::execLQHFRAGREQ(Signal* signal)
{
jamEntry();
@@ -1049,6 +1053,11 @@ void Dblqh::execLQHFRAGREQ(Signal* signal)
addfragptr.p->lh3DistrBits = tlhstar;
addfragptr.p->tableType = tableType;
addfragptr.p->primaryTableId = primaryTableId;
+ //
+ addfragptr.p->tup1Connectptr = RNIL;
+ addfragptr.p->tup2Connectptr = RNIL;
+ addfragptr.p->tux1Connectptr = RNIL;
+ addfragptr.p->tux2Connectptr = RNIL;
if (DictTabInfo::isTable(tableType) ||
DictTabInfo::isHashIndex(tableType)) {
@@ -1329,15 +1338,21 @@ void Dblqh::execTUP_ADD_ATTCONF(Signal* signal)
{
jamEntry();
addfragptr.i = signal->theData[0];
+ // implies that operation was released on the other side
+ const bool lastAttr = signal->theData[1];
ptrCheckGuard(addfragptr, caddfragrecFileSize, addFragRecord);
switch (addfragptr.p->addfragStatus) {
case AddFragRecord::TUP_ATTR_WAIT1:
jam();
+ if (lastAttr)
+ addfragptr.p->tup1Connectptr = RNIL;
addfragptr.p->addfragStatus = AddFragRecord::TUP_ATTR_WAIT2;
sendAddAttrReq(signal);
break;
case AddFragRecord::TUP_ATTR_WAIT2:
jam();
+ if (lastAttr)
+ addfragptr.p->tup2Connectptr = RNIL;
if (DictTabInfo::isOrderedIndex(addfragptr.p->tableType)) {
addfragptr.p->addfragStatus = AddFragRecord::TUX_ATTR_WAIT1;
sendAddAttrReq(signal);
@@ -1347,11 +1362,15 @@ void Dblqh::execTUP_ADD_ATTCONF(Signal* signal)
break;
case AddFragRecord::TUX_ATTR_WAIT1:
jam();
+ if (lastAttr)
+ addfragptr.p->tux1Connectptr = RNIL;
addfragptr.p->addfragStatus = AddFragRecord::TUX_ATTR_WAIT2;
sendAddAttrReq(signal);
break;
case AddFragRecord::TUX_ATTR_WAIT2:
jam();
+ if (lastAttr)
+ addfragptr.p->tux2Connectptr = RNIL;
goto done_with_attr;
break;
done_with_attr:
@@ -1455,6 +1474,7 @@ Dblqh::sendAddAttrReq(Signal* signal)
jam();
TupAddAttrConf* tupconf = (TupAddAttrConf*)signal->getDataPtrSend();
tupconf->userPtr = addfragptr.i;
+ tupconf->lastAttr = false;
sendSignal(reference(), GSN_TUP_ADD_ATTCONF,
signal, TupAddAttrConf::SignalLength, JBB);
return;
@@ -1485,6 +1505,7 @@ Dblqh::sendAddAttrReq(Signal* signal)
jam();
TuxAddAttrConf* tuxconf = (TuxAddAttrConf*)signal->getDataPtrSend();
tuxconf->userPtr = addfragptr.i;
+ tuxconf->lastAttr = false;
sendSignal(reference(), GSN_TUX_ADD_ATTRCONF,
signal, TuxAddAttrConf::SignalLength, JBB);
return;
@@ -1549,6 +1570,40 @@ void Dblqh::fragrefLab(Signal* signal,
return;
}//Dblqh::fragrefLab()
+/*
+ * Abort on-going ops.
+ */
+void Dblqh::abortAddFragOps(Signal* signal)
+{
+ fragptr.i = addfragptr.p->fragmentPtr;
+ ptrCheckGuard(fragptr, cfragrecFileSize, fragrecord);
+ signal->theData[0] = (Uint32)-1;
+ if (addfragptr.p->tup1Connectptr != RNIL) {
+ jam();
+ signal->theData[1] = addfragptr.p->tup1Connectptr;
+ sendSignal(fragptr.p->tupBlockref, GSN_TUPFRAGREQ, signal, 2, JBB);
+ addfragptr.p->tup1Connectptr = RNIL;
+ }
+ if (addfragptr.p->tup2Connectptr != RNIL) {
+ jam();
+ signal->theData[1] = addfragptr.p->tup2Connectptr;
+ sendSignal(fragptr.p->tupBlockref, GSN_TUPFRAGREQ, signal, 2, JBB);
+ addfragptr.p->tup2Connectptr = RNIL;
+ }
+ if (addfragptr.p->tux1Connectptr != RNIL) {
+ jam();
+ signal->theData[1] = addfragptr.p->tux1Connectptr;
+ sendSignal(fragptr.p->tuxBlockref, GSN_TUXFRAGREQ, signal, 2, JBB);
+ addfragptr.p->tux1Connectptr = RNIL;
+ }
+ if (addfragptr.p->tux2Connectptr != RNIL) {
+ jam();
+ signal->theData[1] = addfragptr.p->tux2Connectptr;
+ sendSignal(fragptr.p->tuxBlockref, GSN_TUXFRAGREQ, signal, 2, JBB);
+ addfragptr.p->tux2Connectptr = RNIL;
+ }
+}
+
/* ************>> */
/* ACCFRAGREF > */
/* ************>> */
@@ -1582,6 +1637,27 @@ void Dblqh::execTUPFRAGREF(Signal* signal)
fragptr.i = addfragptr.p->fragmentPtr;
ptrCheckGuard(fragptr, cfragrecFileSize, fragrecord);
addfragptr.p->addfragErrorCode = terrorCode;
+
+ // no operation to release, just add some jams
+ switch (addfragptr.p->addfragStatus) {
+ case AddFragRecord::WAIT_TWO_TUP:
+ jam();
+ break;
+ case AddFragRecord::WAIT_ONE_TUP:
+ jam();
+ break;
+ case AddFragRecord::WAIT_TWO_TUX:
+ jam();
+ break;
+ case AddFragRecord::WAIT_ONE_TUX:
+ jam();
+ break;
+ default:
+ ndbrequire(false);
+ break;
+ }
+ abortAddFragOps(signal);
+
const Uint32 ref = addfragptr.p->dictBlockref;
const Uint32 senderData = addfragptr.p->dictConnectptr;
const Uint32 errorCode = addfragptr.p->addfragErrorCode;
@@ -1605,11 +1681,38 @@ void Dblqh::execTUXFRAGREF(Signal* signal)
void Dblqh::execTUP_ADD_ATTRREF(Signal* signal)
{
jamEntry();
-
addfragptr.i = signal->theData[0];
ptrCheckGuard(addfragptr, caddfragrecFileSize, addFragRecord);
terrorCode = signal->theData[1];
addfragptr.p->addfragErrorCode = terrorCode;
+
+ // operation was released on the other side
+ switch (addfragptr.p->addfragStatus) {
+ case AddFragRecord::TUP_ATTR_WAIT1:
+ jam();
+ ndbrequire(addfragptr.p->tup1Connectptr != RNIL);
+ addfragptr.p->tup1Connectptr = RNIL;
+ break;
+ case AddFragRecord::TUP_ATTR_WAIT2:
+ jam();
+ ndbrequire(addfragptr.p->tup2Connectptr != RNIL);
+ addfragptr.p->tup2Connectptr = RNIL;
+ break;
+ case AddFragRecord::TUX_ATTR_WAIT1:
+ jam();
+ ndbrequire(addfragptr.p->tux1Connectptr != RNIL);
+ addfragptr.p->tux1Connectptr = RNIL;
+ break;
+ case AddFragRecord::TUX_ATTR_WAIT2:
+ jam();
+ ndbrequire(addfragptr.p->tux2Connectptr != RNIL);
+ addfragptr.p->tux2Connectptr = RNIL;
+ break;
+ default:
+ ndbrequire(false);
+ break;
+ }
+ abortAddFragOps(signal);
const Uint32 Ref = addfragptr.p->dictBlockref;
const Uint32 senderData = addfragptr.p->dictConnectptr;
diff --git a/ndb/src/kernel/blocks/dblqh/Makefile_old b/ndb/src/kernel/blocks/dblqh/Makefile_old
deleted file mode 100644
index 520486d8058..00000000000
--- a/ndb/src/kernel/blocks/dblqh/Makefile_old
+++ /dev/null
@@ -1,12 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := dblqh
-DIRS := redoLogReader
-
-SOURCES = \
- DblqhInit.cpp \
- DblqhMain.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/dbtc/Makefile_old b/ndb/src/kernel/blocks/dbtc/Makefile_old
deleted file mode 100644
index ae876ab1f84..00000000000
--- a/ndb/src/kernel/blocks/dbtc/Makefile_old
+++ /dev/null
@@ -1,11 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := dbtc
-SOURCES = \
- DbtcInit.cpp \
- DbtcMain.cpp
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/src/kernel/blocks/dbtup/Dbtup.hpp b/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
index 55ad1d0910a..b48546576f9 100644
--- a/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
+++ b/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
@@ -504,6 +504,7 @@ struct Fragoperrec {
Uint32 noOfNewAttrCount;
Uint32 charsetIndex;
BlockReference lqhBlockrefFrag;
+ bool inUse;
};
typedef Ptr<Fragoperrec> FragoperrecPtr;
@@ -1936,6 +1937,7 @@ private:
void setUpKeyArray(Tablerec* const regTabPtr);
bool addfragtotab(Tablerec* const regTabPtr, Uint32 fragId, Uint32 fragIndex);
void deleteFragTab(Tablerec* const regTabPtr, Uint32 fragId);
+ void abortAddFragOp(Signal* signal);
void releaseTabDescr(Tablerec* const regTabPtr);
void getFragmentrec(FragrecordPtr& regFragPtr, Uint32 fragId, Tablerec* const regTabPtr);
diff --git a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
index efea312b865..405f790954e 100644
--- a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
+++ b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
@@ -39,11 +39,18 @@
/* ---------------------------------------------------------------- */
void Dbtup::execTUPFRAGREQ(Signal* signal)
{
+ ljamEntry();
+
+ if (signal->theData[0] == (Uint32)-1) {
+ ljam();
+ abortAddFragOp(signal);
+ return;
+ }
+
FragoperrecPtr fragOperPtr;
FragrecordPtr regFragPtr;
TablerecPtr regTabPtr;
- ljamEntry();
Uint32 userptr = signal->theData[0];
Uint32 userblockref = signal->theData[1];
Uint32 reqinfo = signal->theData[2];
@@ -62,6 +69,17 @@ void Dbtup::execTUPFRAGREQ(Signal* signal)
Uint32 noOfAttributeGroups = signal->theData[12];
Uint32 globalCheckpointIdIndicator = signal->theData[13];
+#ifndef VM_TRACE
+ // config mismatch - do not crash if release compiled
+ if (regTabPtr.i >= cnoOfTablerec) {
+ ljam();
+ signal->theData[0] = userptr;
+ signal->theData[1] = 800;
+ sendSignal(userblockref, GSN_TUPFRAGREF, signal, 2, JBB);
+ return;
+ }
+#endif
+
ptrCheckGuard(regTabPtr, cnoOfTablerec, tablerec);
if (cfirstfreeFragopr == RNIL) {
ljam();
@@ -132,6 +150,15 @@ void Dbtup::execTUPFRAGREQ(Signal* signal)
return;
}//if
+ if (ERROR_INSERTED(4007) && regTabPtr.p->fragid[0] == fragId ||
+ ERROR_INSERTED(4008) && regTabPtr.p->fragid[1] == fragId) {
+ ljam();
+ terrorCode = 1;
+ fragrefuse4Lab(signal, fragOperPtr, regFragPtr, regTabPtr.p, fragId);
+ CLEAR_ERROR_INSERT_VALUE;
+ return;
+ }
+
if (regTabPtr.p->tableStatus == NOT_DEFINED) {
ljam();
//-------------------------------------------------------------------------------------
@@ -243,6 +270,7 @@ void Dbtup::seizeFragoperrec(FragoperrecPtr& fragOperPtr)
ptrCheckGuard(fragOperPtr, cnoOfFragoprec, fragoperrec);
cfirstfreeFragopr = fragOperPtr.p->nextFragoprec;
fragOperPtr.p->nextFragoprec = RNIL;
+ fragOperPtr.p->inUse = true;
}//Dbtup::seizeFragoperrec()
/* **************************************************************** */
@@ -273,6 +301,7 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal)
ndbrequire(fragOperPtr.p->attributeCount > 0);
fragOperPtr.p->attributeCount--;
+ const bool lastAttr = (fragOperPtr.p->attributeCount == 0);
if ((regTabPtr.p->tableStatus == DEFINING) &&
(fragOperPtr.p->definingFragment)) {
@@ -346,20 +375,30 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal)
addattrrefuseLab(signal, regFragPtr, fragOperPtr, regTabPtr.p, fragId);
return;
}//if
- if ((fragOperPtr.p->attributeCount == 0) &&
- (fragOperPtr.p->freeNullBit != 0)) {
+ if (lastAttr && (fragOperPtr.p->freeNullBit != 0)) {
ljam();
terrorCode = ZINCONSISTENT_NULL_ATTRIBUTE_COUNT;
addattrrefuseLab(signal, regFragPtr, fragOperPtr, regTabPtr.p, fragId);
return;
}//if
}//if
+ if (ERROR_INSERTED(4009) && regTabPtr.p->fragid[0] == fragId && attrId == 0 ||
+ ERROR_INSERTED(4010) && regTabPtr.p->fragid[0] == fragId && lastAttr ||
+ ERROR_INSERTED(4011) && regTabPtr.p->fragid[1] == fragId && attrId == 0 ||
+ ERROR_INSERTED(4012) && regTabPtr.p->fragid[1] == fragId && lastAttr) {
+ ljam();
+ terrorCode = 1;
+ addattrrefuseLab(signal, regFragPtr, fragOperPtr, regTabPtr.p, fragId);
+ CLEAR_ERROR_INSERT_VALUE;
+ return;
+ }
/* **************************************************************** */
/* ************** TUP_ADD_ATTCONF ****************** */
/* **************************************************************** */
signal->theData[0] = fragOperPtr.p->lqhPtrFrag;
- sendSignal(fragOperPtr.p->lqhBlockrefFrag, GSN_TUP_ADD_ATTCONF, signal, 1, JBB);
- if (fragOperPtr.p->attributeCount > 0) {
+ signal->theData[1] = lastAttr;
+ sendSignal(fragOperPtr.p->lqhBlockrefFrag, GSN_TUP_ADD_ATTCONF, signal, 2, JBB);
+ if (! lastAttr) {
ljam();
return; /* EXIT AND WAIT FOR MORE */
}//if
@@ -491,11 +530,11 @@ void Dbtup::fragrefuseLab(Signal* signal, FragoperrecPtr fragOperPtr)
void Dbtup::releaseFragoperrec(FragoperrecPtr fragOperPtr)
{
+ fragOperPtr.p->inUse = false;
fragOperPtr.p->nextFragoprec = cfirstfreeFragopr;
cfirstfreeFragopr = fragOperPtr.i;
}//Dbtup::releaseFragoperrec()
-
void Dbtup::deleteFragTab(Tablerec* const regTabPtr, Uint32 fragId)
{
for (Uint32 i = 0; i < (2 * MAX_FRAG_PER_NODE); i++) {
@@ -510,6 +549,20 @@ void Dbtup::deleteFragTab(Tablerec* const regTabPtr, Uint32 fragId)
ndbrequire(false);
}//Dbtup::deleteFragTab()
+/*
+ * LQH aborts on-going create table operation. The table is later
+ * dropped by DICT.
+ */
+void Dbtup::abortAddFragOp(Signal* signal)
+{
+ FragoperrecPtr fragOperPtr;
+
+ fragOperPtr.i = signal->theData[1];
+ ptrCheckGuard(fragOperPtr, cnoOfFragoprec, fragoperrec);
+ ndbrequire(fragOperPtr.p->inUse);
+ releaseFragoperrec(fragOperPtr);
+}
+
void
Dbtup::execDROP_TAB_REQ(Signal* signal)
{
diff --git a/ndb/src/kernel/blocks/dbtup/Makefile_old b/ndb/src/kernel/blocks/dbtup/Makefile_old
deleted file mode 100644
index 87146f4b441..00000000000
--- a/ndb/src/kernel/blocks/dbtup/Makefile_old
+++ /dev/null
@@ -1,26 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := dbtup
-SOURCES = \
- DbtupExecQuery.cpp \
- DbtupBuffer.cpp \
- DbtupRoutines.cpp \
- DbtupCommit.cpp \
- DbtupFixAlloc.cpp \
- DbtupTrigger.cpp \
- DbtupAbort.cpp \
- DbtupLCP.cpp \
- DbtupUndoLog.cpp \
- DbtupPageMap.cpp \
- DbtupPagMan.cpp \
- DbtupStoredProcDef.cpp \
- DbtupMeta.cpp \
- DbtupTabDesMan.cpp \
- DbtupGen.cpp \
- DbtupSystemRestart.cpp \
- DbtupIndex.cpp \
- DbtupDebug.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
index 8896324f793..8f49b7fa6d6 100644
--- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
+++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
@@ -575,6 +575,7 @@ private:
void execDROP_TAB_REQ(Signal* signal);
bool allocDescEnt(IndexPtr indexPtr);
void freeDescEnt(IndexPtr indexPtr);
+ void abortAddFragOp(Signal* signal);
void dropIndex(Signal* signal, IndexPtr indexPtr, Uint32 senderRef, Uint32 senderData);
/*
@@ -684,6 +685,7 @@ private:
friend class NdbOut& operator<<(NdbOut&, const ScanOp&);
friend class NdbOut& operator<<(NdbOut&, const Index&);
friend class NdbOut& operator<<(NdbOut&, const Frag&);
+ friend class NdbOut& operator<<(NdbOut&, const FragOp&);
friend class NdbOut& operator<<(NdbOut&, const NodeHandle&);
FILE* debugFile;
NdbOut debugOut;
diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
index c5c22264460..1e1b0d1d5b6 100644
--- a/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
@@ -404,6 +404,19 @@ operator<<(NdbOut& out, const Dbtux::Frag& frag)
}
NdbOut&
+operator<<(NdbOut& out, const Dbtux::FragOp& fragOp)
+{
+ out << "[FragOp " << hex << &fragOp;
+ out << " [userPtr " << dec << fragOp.m_userPtr << "]";
+ out << " [indexId " << dec << fragOp.m_indexId << "]";
+ out << " [fragId " << dec << fragOp.m_fragId << "]";
+ out << " [fragNo " << dec << fragOp.m_fragNo << "]";
+ out << " numAttrsRecvd " << dec << fragOp.m_numAttrsRecvd << "]";
+ out << "]";
+ return out;
+}
+
+NdbOut&
operator<<(NdbOut& out, const Dbtux::NodeHandle& node)
{
const Dbtux::Frag& frag = node.m_frag;
diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
index ded02696a89..18aa914de05 100644
--- a/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
@@ -24,13 +24,8 @@ Dbtux::Dbtux(const Configuration& conf) :
#ifdef VM_TRACE
debugFile(0),
debugOut(*new NullOutputStream()),
- // until ndb_mgm supports dump
-#ifdef DBTUX_DEBUG_TREE
- debugFlags(DebugTree),
-#else
debugFlags(0),
#endif
-#endif
c_internalStartPhase(0),
c_typeOfStart(NodeState::ST_ILLEGAL_TYPE),
c_dataBuffer(0)
@@ -86,7 +81,7 @@ Dbtux::execCONTINUEB(Signal* signal)
jamEntry();
const Uint32* data = signal->getDataPtr();
switch (data[0]) {
- case TuxContinueB::DropIndex:
+ case TuxContinueB::DropIndex: // currently unused
{
IndexPtr indexPtr;
c_indexPool.getPtr(indexPtr, data[1]);
@@ -174,7 +169,7 @@ Dbtux::execREAD_CONFIG_REQ(Signal* signal)
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_ATTRIBUTE, &nAttribute));
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_SCAN_OP, &nScanOp));
- const Uint32 nDescPage = (nIndex + nAttribute + DescPageSize - 1) / DescPageSize;
+ const Uint32 nDescPage = (nIndex * DescHeadSize + nAttribute * DescAttrSize + DescPageSize - 1) / DescPageSize;
const Uint32 nScanBoundWords = nScanOp * ScanBoundSegmentSize * 4;
c_indexPool.setSize(nIndex);
diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp
index 1577c5045e0..b7526593a08 100644
--- a/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp
+++ b/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp
@@ -29,6 +29,11 @@ void
Dbtux::execTUXFRAGREQ(Signal* signal)
{
jamEntry();
+ if (signal->theData[0] == (Uint32)-1) {
+ jam();
+ abortAddFragOp(signal);
+ return;
+ }
const TuxFragReq reqCopy = *(const TuxFragReq*)signal->getDataPtr();
const TuxFragReq* const req = &reqCopy;
IndexPtr indexPtr;
@@ -61,6 +66,11 @@ Dbtux::execTUXFRAGREQ(Signal* signal)
fragOpPtr.p->m_fragId = req->fragId;
fragOpPtr.p->m_fragNo = indexPtr.p->m_numFrags;
fragOpPtr.p->m_numAttrsRecvd = 0;
+#ifdef VM_TRACE
+ if (debugFlags & DebugMeta) {
+ debugOut << "Seize frag op " << fragOpPtr.i << " " << *fragOpPtr.p << endl;
+ }
+#endif
// check if index has place for more fragments
ndbrequire(indexPtr.p->m_numFrags < MaxIndexFragments);
// seize new fragment record
@@ -129,6 +139,14 @@ Dbtux::execTUXFRAGREQ(Signal* signal)
debugOut << "Add frag " << fragPtr.i << " " << *fragPtr.p << endl;
}
#endif
+ // error inserts
+ if (ERROR_INSERTED(12001) && fragOpPtr.p->m_fragNo == 0 ||
+ ERROR_INSERTED(12002) && fragOpPtr.p->m_fragNo == 1) {
+ jam();
+ errorCode = (TuxFragRef::ErrorCode)1;
+ CLEAR_ERROR_INSERT_VALUE;
+ break;
+ }
// success
TuxFragConf* const conf = (TuxFragConf*)signal->getDataPtrSend();
conf->userPtr = req->userPtr;
@@ -145,10 +163,18 @@ Dbtux::execTUXFRAGREQ(Signal* signal)
ref->errorCode = errorCode;
sendSignal(req->userRef, GSN_TUXFRAGREF,
signal, TuxFragRef::SignalLength, JBB);
- if (fragOpPtr.i != RNIL)
+ if (fragOpPtr.i != RNIL) {
+#ifdef VM_TRACE
+ if (debugFlags & DebugMeta) {
+ debugOut << "Release on frag error frag op " << fragOpPtr.i << " " << *fragOpPtr.p << endl;
+ }
+#endif
c_fragOpPool.release(fragOpPtr);
- if (indexPtr.i != RNIL)
- dropIndex(signal, indexPtr, 0, 0);
+ }
+ if (indexPtr.i != RNIL) {
+ jam();
+ // let DICT drop the unfinished index
+ }
}
void
@@ -203,7 +229,16 @@ Dbtux::execTUX_ADD_ATTRREQ(Signal* signal)
}
}
#endif
- if (indexPtr.p->m_numAttrs == fragOpPtr.p->m_numAttrsRecvd) {
+ const bool lastAttr = (indexPtr.p->m_numAttrs == fragOpPtr.p->m_numAttrsRecvd);
+ if (ERROR_INSERTED(12003) && fragOpPtr.p->m_fragNo == 0 && attrId == 0 ||
+ ERROR_INSERTED(12004) && fragOpPtr.p->m_fragNo == 0 && lastAttr ||
+ ERROR_INSERTED(12005) && fragOpPtr.p->m_fragNo == 1 && attrId == 0 ||
+ ERROR_INSERTED(12006) && fragOpPtr.p->m_fragNo == 1 && lastAttr) {
+ errorCode = (TuxAddAttrRef::ErrorCode)1;
+ CLEAR_ERROR_INSERT_VALUE;
+ break;
+ }
+ if (lastAttr) {
jam();
// initialize tree header
TreeHead& tree = fragPtr.p->m_tree;
@@ -246,11 +281,17 @@ Dbtux::execTUX_ADD_ATTRREQ(Signal* signal)
}
#endif
// fragment is defined
+#ifdef VM_TRACE
+ if (debugFlags & DebugMeta) {
+ debugOut << "Release frag op " << fragOpPtr.i << " " << *fragOpPtr.p << endl;
+ }
+#endif
c_fragOpPool.release(fragOpPtr);
}
// success
TuxAddAttrConf* conf = (TuxAddAttrConf*)signal->getDataPtrSend();
conf->userPtr = fragOpPtr.p->m_userPtr;
+ conf->lastAttr = lastAttr;
sendSignal(fragOpPtr.p->m_userRef, GSN_TUX_ADD_ATTRCONF,
signal, TuxAddAttrConf::SignalLength, JBB);
return;
@@ -261,8 +302,32 @@ Dbtux::execTUX_ADD_ATTRREQ(Signal* signal)
ref->errorCode = errorCode;
sendSignal(fragOpPtr.p->m_userRef, GSN_TUX_ADD_ATTRREF,
signal, TuxAddAttrRef::SignalLength, JBB);
+#ifdef VM_TRACE
+ if (debugFlags & DebugMeta) {
+ debugOut << "Release on attr error frag op " << fragOpPtr.i << " " << *fragOpPtr.p << endl;
+ }
+#endif
c_fragOpPool.release(fragOpPtr);
- dropIndex(signal, indexPtr, 0, 0);
+ // let DICT drop the unfinished index
+}
+
+/*
+ * LQH aborts on-going create index operation.
+ */
+void
+Dbtux::abortAddFragOp(Signal* signal)
+{
+ FragOpPtr fragOpPtr;
+ IndexPtr indexPtr;
+ c_fragOpPool.getPtr(fragOpPtr, signal->theData[1]);
+ c_indexPool.getPtr(indexPtr, fragOpPtr.p->m_indexId);
+#ifdef VM_TRACE
+ if (debugFlags & DebugMeta) {
+ debugOut << "Release on abort frag op " << fragOpPtr.i << " " << *fragOpPtr.p << endl;
+ }
+#endif
+ c_fragOpPool.release(fragOpPtr);
+ // let DICT drop the unfinished index
}
/*
@@ -341,20 +406,13 @@ Dbtux::dropIndex(Signal* signal, IndexPtr indexPtr, Uint32 senderRef, Uint32 sen
{
jam();
indexPtr.p->m_state = Index::Dropping;
- // drop one fragment at a time
- if (indexPtr.p->m_numFrags > 0) {
+ // drop fragments
+ while (indexPtr.p->m_numFrags > 0) {
jam();
- unsigned i = --indexPtr.p->m_numFrags;
+ Uint32 i = --indexPtr.p->m_numFrags;
FragPtr fragPtr;
c_fragPool.getPtr(fragPtr, indexPtr.p->m_fragPtrI[i]);
c_fragPool.release(fragPtr);
- // the real time break is not used for anything currently
- signal->theData[0] = TuxContinueB::DropIndex;
- signal->theData[1] = indexPtr.i;
- signal->theData[2] = senderRef;
- signal->theData[3] = senderData;
- sendSignal(reference(), GSN_CONTINUEB, signal, 4, JBB);
- return;
}
// drop attributes
if (indexPtr.p->m_descPage != RNIL) {
diff --git a/ndb/src/kernel/blocks/dbtux/Makefile_old b/ndb/src/kernel/blocks/dbtux/Makefile_old
deleted file mode 100644
index 30927c31848..00000000000
--- a/ndb/src/kernel/blocks/dbtux/Makefile_old
+++ /dev/null
@@ -1,17 +0,0 @@
-include .defs.mk
-
-TYPE = kernel
-
-ARCHIVE_TARGET = dbtux
-
-SOURCES = \
- DbtuxGen.cpp \
- DbtuxMeta.cpp \
- DbtuxMaint.cpp \
- DbtuxNode.cpp \
- DbtuxTree.cpp \
- DbtuxScan.cpp \
- DbtuxCmp.cpp \
- DbtuxDebug.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/dbutil/Makefile_old b/ndb/src/kernel/blocks/dbutil/Makefile_old
deleted file mode 100644
index 54b7326e4e5..00000000000
--- a/ndb/src/kernel/blocks/dbutil/Makefile_old
+++ /dev/null
@@ -1,8 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := dbutil
-SOURCES = DbUtil.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/grep/Makefile_old b/ndb/src/kernel/blocks/grep/Makefile_old
deleted file mode 100644
index 5ad5a0bce3b..00000000000
--- a/ndb/src/kernel/blocks/grep/Makefile_old
+++ /dev/null
@@ -1,9 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := grep
-
-SOURCES = Grep.cpp GrepInit.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/ndbcntr/Makefile_old b/ndb/src/kernel/blocks/ndbcntr/Makefile_old
deleted file mode 100644
index 8e9c4f01027..00000000000
--- a/ndb/src/kernel/blocks/ndbcntr/Makefile_old
+++ /dev/null
@@ -1,12 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := ndbcntr
-
-SOURCES = \
- NdbcntrInit.cpp \
- NdbcntrSysTable.cpp \
- NdbcntrMain.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/ndbfs/Makefile_old b/ndb/src/kernel/blocks/ndbfs/Makefile_old
deleted file mode 100644
index 58e1458bf16..00000000000
--- a/ndb/src/kernel/blocks/ndbfs/Makefile_old
+++ /dev/null
@@ -1,14 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := ndbfs
-
-SOURCES = \
- AsyncFile.cpp \
- Ndbfs.cpp VoidFs.cpp \
- Filename.cpp \
- CircularIndex.cpp
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/src/kernel/blocks/qmgr/Makefile_old b/ndb/src/kernel/blocks/qmgr/Makefile_old
deleted file mode 100644
index cd15643ea60..00000000000
--- a/ndb/src/kernel/blocks/qmgr/Makefile_old
+++ /dev/null
@@ -1,11 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := qmgr
-
-SOURCES = \
- QmgrInit.cpp \
- QmgrMain.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
index 41deb3403c8..da8596076ec 100644
--- a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
+++ b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
@@ -1934,17 +1934,27 @@ void Qmgr::execAPI_REGREQ(Signal* signal)
switch(getNodeInfo(apiNodePtr.i).getType()){
case NodeInfo::API:
compatability_check = ndbCompatible_ndb_api(NDB_VERSION, version);
+ if (!compatability_check)
+ infoEvent("Connection attempt from api or mysqld id=%d with %s "
+ "incompatible with %s", apiNodePtr.i,
+ getVersionString(version,""), NDB_VERSION_STRING);
break;
case NodeInfo::MGM:
compatability_check = ndbCompatible_ndb_mgmt(NDB_VERSION, version);
+ if (!compatability_check)
+ infoEvent("Connection attempt from management server id=%d with %s "
+ "incompatible with %s", apiNodePtr.i,
+ getVersionString(version,""), NDB_VERSION_STRING);
break;
case NodeInfo::REP:
- compatability_check = ndbCompatible_ndb_api(NDB_VERSION, version);
- break;
+ // compatability_check = ndbCompatible_ndb_api(NDB_VERSION, version);
+ // break;
case NodeInfo::DB:
case NodeInfo::INVALID:
default:
sendApiRegRef(signal, ref, ApiRegRef::WrongType);
+ infoEvent("Invalid connection attempt with type %d",
+ getNodeInfo(apiNodePtr.i).getType());
return;
}
@@ -2937,6 +2947,12 @@ void Qmgr::sendPrepFailReq(Signal* signal, Uint16 aNode)
*/
/**
+ * Should < 1/2 nodes die unconditionally. Affects only >= 3-way
+ * replication.
+ */
+static const bool g_ndb_arbit_one_half_rule = false;
+
+/**
* Config signals are logically part of CM_INIT.
*/
void
@@ -3147,7 +3163,8 @@ Qmgr::handleArbitCheck(Signal* signal)
ndbrequire(cpresident == getOwnNodeId());
NodeBitmask ndbMask;
computeArbitNdbMask(ndbMask);
- if (2 * ndbMask.count() < cnoOfNodes) {
+ if (g_ndb_arbit_one_half_rule &&
+ 2 * ndbMask.count() < cnoOfNodes) {
jam();
arbitRec.code = ArbitCode::LoseNodes;
} else {
@@ -3171,6 +3188,11 @@ Qmgr::handleArbitCheck(Signal* signal)
case CheckNodeGroups::Partitioning:
jam();
arbitRec.code = ArbitCode::Partitioning;
+ if (g_ndb_arbit_one_half_rule &&
+ 2 * ndbMask.count() > cnoOfNodes) {
+ jam();
+ arbitRec.code = ArbitCode::WinNodes;
+ }
break;
default:
ndbrequire(false);
@@ -3180,8 +3202,12 @@ Qmgr::handleArbitCheck(Signal* signal)
switch (arbitRec.code) {
case ArbitCode::LoseNodes:
jam();
+ case ArbitCode::LoseGroups:
+ jam();
goto crashme;
- case ArbitCode::WinGroups:
+ case ArbitCode::WinNodes:
+ jam();
+ case ArbitCode::WinGroups:
jam();
if (arbitRec.state == ARBIT_RUN) {
jam();
@@ -3190,9 +3216,6 @@ Qmgr::handleArbitCheck(Signal* signal)
arbitRec.state = ARBIT_INIT;
arbitRec.newstate = true;
break;
- case ArbitCode::LoseGroups:
- jam();
- goto crashme;
case ArbitCode::Partitioning:
if (arbitRec.state == ARBIT_RUN) {
jam();
@@ -3752,8 +3775,7 @@ Qmgr::execARBIT_CHOOSEREF(Signal* signal)
}
/**
- * Handle CRASH state. We must crash immediately. But it
- * would be nice to wait until event reports have been sent.
+ * Handle CRASH state. We must crash immediately.
* XXX tell other nodes in our party to crash too.
*/
void
@@ -3763,12 +3785,11 @@ Qmgr::stateArbitCrash(Signal* signal)
if (arbitRec.newstate) {
jam();
CRASH_INSERTION((Uint32)910 + arbitRec.state);
-
arbitRec.setTimestamp();
arbitRec.code = 0;
arbitRec.newstate = false;
}
-#if 0
+#ifdef ndb_arbit_crash_wait_for_event_report_to_get_out
if (! (arbitRec.getTimediff() > getArbitTimeout()))
return;
#endif
diff --git a/ndb/src/kernel/blocks/suma/Makefile_old b/ndb/src/kernel/blocks/suma/Makefile_old
deleted file mode 100644
index 20014c94670..00000000000
--- a/ndb/src/kernel/blocks/suma/Makefile_old
+++ /dev/null
@@ -1,10 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := suma
-
-SOURCES = Suma.cpp SumaInit.cpp
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/src/kernel/blocks/trix/Makefile_old b/ndb/src/kernel/blocks/trix/Makefile_old
deleted file mode 100644
index 5ac0da11f33..00000000000
--- a/ndb/src/kernel/blocks/trix/Makefile_old
+++ /dev/null
@@ -1,8 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := trix
-SOURCES = Trix.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/error/Makefile_old b/ndb/src/kernel/error/Makefile_old
deleted file mode 100644
index 0fe81f083ce..00000000000
--- a/ndb/src/kernel/error/Makefile_old
+++ /dev/null
@@ -1,12 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := error
-
-SOURCES = \
- TimeModule.cpp \
- ErrorReporter.cpp \
- ErrorMessages.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp
index b3a436275f7..aac035fe1b7 100644
--- a/ndb/src/kernel/vm/Configuration.cpp
+++ b/ndb/src/kernel/vm/Configuration.cpp
@@ -590,6 +590,23 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
*/
ConfigValuesFactory cfg(ownConfig);
+ Uint32 noOfMetaTables= noOfTables + noOfOrderedIndexes +
+ noOfUniqueHashIndexes;
+ if (noOfMetaTables > MAX_TABLES)
+ noOfMetaTables= MAX_TABLES;
+
+ {
+ /**
+ * Dict Size Alt values
+ */
+ cfg.put(CFG_DICT_ATTRIBUTE,
+ noOfAttributes);
+
+ cfg.put(CFG_DICT_TABLE,
+ noOfMetaTables);
+ }
+
+
if (noOfLocalScanRecords == 0) {
noOfLocalScanRecords = (noOfDBNodes * noOfScanRecords) + 1;
}
@@ -599,7 +616,7 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
Uint32 noOfTCScanRecords = noOfScanRecords;
{
- Uint32 noOfAccTables= noOfTables + noOfUniqueHashIndexes;
+ Uint32 noOfAccTables= noOfMetaTables/*noOfTables+noOfUniqueHashIndexes*/;
/**
* Acc Size Alt values
*/
@@ -641,19 +658,6 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
cfg.put(CFG_ACC_SCAN, noOfLocalScanRecords);
}
- Uint32 noOfMetaTables= noOfTables + noOfOrderedIndexes +
- noOfUniqueHashIndexes;
- {
- /**
- * Dict Size Alt values
- */
- cfg.put(CFG_DICT_ATTRIBUTE,
- noOfAttributes);
-
- cfg.put(CFG_DICT_TABLE,
- noOfMetaTables);
- }
-
{
/**
* Dih Size Alt values
@@ -746,8 +750,8 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
noOfMetaTables);
cfg.put(CFG_TUP_TABLE_DESC,
- 4 * NO_OF_FRAG_PER_NODE * noOfAttributes* noOfReplicas +
- 12 * NO_OF_FRAG_PER_NODE * noOfMetaTables* noOfReplicas );
+ 2 * 6 * NO_OF_FRAG_PER_NODE * noOfAttributes * noOfReplicas +
+ 2 * 10 * NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfReplicas );
cfg.put(CFG_TUP_STORED_PROC,
noOfLocalScanRecords);
@@ -758,9 +762,9 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
* Tux Size Alt values
*/
cfg.put(CFG_TUX_INDEX,
- noOfOrderedIndexes);
+ noOfMetaTables /*noOfOrderedIndexes*/);
- cfg.put(CFG_TUX_FRAGMENT,
+ cfg.put(CFG_TUX_FRAGMENT,
2 * NO_OF_FRAG_PER_NODE * noOfOrderedIndexes * noOfReplicas);
cfg.put(CFG_TUX_ATTRIBUTE,
diff --git a/ndb/src/kernel/vm/Makefile_old b/ndb/src/kernel/vm/Makefile_old
deleted file mode 100644
index a162f3672ce..00000000000
--- a/ndb/src/kernel/vm/Makefile_old
+++ /dev/null
@@ -1,30 +0,0 @@
-include .defs.mk
-
-TYPE := kernel
-
-ARCHIVE_TARGET := kernel
-
-SOURCES = \
- SimulatedBlock.cpp \
- FastScheduler.cpp \
- TimeQueue.cpp \
- VMSignal.cpp \
- ThreadConfig.cpp \
- TransporterCallback.cpp \
- Emulator.cpp \
- Configuration.cpp \
- WatchDog.cpp \
- SimplePropertiesSection.cpp \
- SectionReader.cpp \
- MetaData.cpp \
- Mutex.cpp SafeCounter.cpp
-
-CFLAGS_Configuration.cpp := -I$(call fixpath,$(NDB_TOP)/src/mgmapi)
-
-DIRS := testCopy testDataBuffer testSimplePropertiesSection
-
-ifneq ($(USE_EDITLINE), N)
-DIRS += testLongSig
-endif
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/common/mgmcommon/LocalConfig.cpp b/ndb/src/mgmapi/LocalConfig.cpp
index 3cd4341c6b7..d0ff97cdedf 100644
--- a/ndb/src/common/mgmcommon/LocalConfig.cpp
+++ b/ndb/src/mgmapi/LocalConfig.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 "LocalConfig.hpp"
+#include <LocalConfig.hpp>
#include <NdbEnv.h>
#include <NdbConfig.h>
#include <NdbAutoPtr.hpp>
@@ -90,7 +90,7 @@ LocalConfig::init(const char *connectString,
//7. Check
{
char buf[256];
- BaseString::snprintf(buf, sizeof(buf), "host=localhost:%s", NDB_BASE_PORT);
+ BaseString::snprintf(buf, sizeof(buf), "host=localhost:%s", NDB_PORT);
if(readConnectString(buf, "default connect string"))
return true;
}
@@ -124,12 +124,12 @@ void LocalConfig::printUsage() const {
ndbout << "1. Put a Ndb.cfg file in the directory where you start"<<endl
<< " the node. "<< endl
<< " Ex: Ndb.cfg" << endl
- << " | host=localhost:"<<NDB_BASE_PORT<<endl;
+ << " | host=localhost:"<<NDB_PORT<<endl;
ndbout << "2. Use the environment variable NDB_CONNECTSTRING to "<<endl
<< " provide this information." <<endl
<< " Ex: " << endl
- << " >export NDB_CONNECTSTRING=\"host=localhost:"<<NDB_BASE_PORT<<"\""
+ << " >export NDB_CONNECTSTRING=\"host=localhost:"<<NDB_PORT<<"\""
<<endl<<endl;
}
@@ -164,17 +164,25 @@ LocalConfig::parseNodeId(const char * buf){
bool
LocalConfig::parseHostName(const char * buf){
char tempString[1024];
+ char tempString2[1024];
int port;
- for(int i = 0; hostNameTokens[i] != 0; i++) {
- if (sscanf(buf, hostNameTokens[i], tempString, &port) == 2) {
- MgmtSrvrId mgmtSrvrId;
- mgmtSrvrId.type = MgmId_TCP;
- mgmtSrvrId.name.assign(tempString);
- mgmtSrvrId.port = port;
- ids.push_back(mgmtSrvrId);
- return true;
+ do {
+ for(int i = 0; hostNameTokens[i] != 0; i++) {
+ if (sscanf(buf, hostNameTokens[i], tempString, &port) == 2) {
+ MgmtSrvrId mgmtSrvrId;
+ mgmtSrvrId.type = MgmId_TCP;
+ mgmtSrvrId.name.assign(tempString);
+ mgmtSrvrId.port = port;
+ ids.push_back(mgmtSrvrId);
+ return true;
+ }
}
- }
+ if (buf == tempString2)
+ break;
+ // try to add default port to see if it works
+ snprintf(tempString2, sizeof(tempString2),"%s:%s", buf, NDB_PORT);
+ buf= tempString2;
+ } while(1);
return false;
}
diff --git a/ndb/src/mgmapi/Makefile.am b/ndb/src/mgmapi/Makefile.am
index 0f0e1cea5d8..d64216b56c0 100644
--- a/ndb/src/mgmapi/Makefile.am
+++ b/ndb/src/mgmapi/Makefile.am
@@ -1,10 +1,11 @@
noinst_LTLIBRARIES = libmgmapi.la
-libmgmapi_la_SOURCES = mgmapi.cpp mgmapi_configuration.cpp
+libmgmapi_la_SOURCES = mgmapi.cpp mgmapi_configuration.cpp LocalConfig.cpp
-INCLUDES_LOC = -I$(top_srcdir)/ndb/include/mgmapi -I$(top_srcdir)/ndb/src/common/mgmcommon
-DEFS_LOC = -DNO_DEBUG_MESSAGES
+INCLUDES_LOC = -I$(top_srcdir)/ndb/include/mgmapi
+
+DEFS_LOC = -DNO_DEBUG_MESSAGES -DNDB_PORT="\"@ndb_port@\""
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_util.mk.am
diff --git a/ndb/src/mgmapi/Makefile_old b/ndb/src/mgmapi/Makefile_old
deleted file mode 100644
index fa734f998e6..00000000000
--- a/ndb/src/mgmapi/Makefile_old
+++ /dev/null
@@ -1,27 +0,0 @@
-include .defs.mk
-
-TYPE := util
-
-PIC_ARCHIVE := Y
-ARCHIVE_TARGET := mgmapi
-
-A_LIB := Y
-SO_LIB := Y
-PIC_LIB := Y
-
-#DIRS := test
-
-LIB_TARGET := MGM_API
-LIB_TARGET_ARCHIVES := $(ARCHIVE_TARGET) general portlib
-
-# Source files of non-templated classes (.C files)
-SOURCES = mgmapi.cpp mgmapi_configuration.cpp
-
-CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/mgmapi) \
- -I$(call fixpath,$(NDB_TOP)/src/common/mgmcommon)
-
-CCFLAGS += -DNO_DEBUG_MESSAGES
-
-# -I$(NDB_TOP)/src/common/mgmcommon
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index 4b62df968b3..51f2d7cee01 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -17,6 +17,7 @@
#include <ndb_global.h>
#include <my_sys.h>
+#include <LocalConfig.hpp>
#include <NdbAutoPtr.hpp>
#include <NdbTCP.h>
@@ -94,6 +95,8 @@ struct ndb_mgm_handle {
NDB_SOCKET_TYPE socket;
+ char cfg_ptr[sizeof(LocalConfig)];
+
#ifdef MGMAPI_LOG
FILE* logfile;
#endif
@@ -146,10 +149,12 @@ ndb_mgm_create_handle()
h->last_error = 0;
h->last_error_line = 0;
h->hostname = 0;
- h->socket = -1;
+ h->socket = NDB_INVALID_SOCKET;
h->read_timeout = 50000;
h->write_timeout = 100;
+ new (h->cfg_ptr) LocalConfig;
+
strncpy(h->last_error_desc, "No error", NDB_MGM_MAX_ERR_DESC_SIZE);
#ifdef MGMAPI_LOG
h->logfile = 0;
@@ -177,6 +182,7 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle)
(* handle)->logfile = 0;
}
#endif
+ ((LocalConfig*)((*handle)->cfg_ptr))->~LocalConfig();
my_free((char*)* handle,MYF(MY_ALLOW_ZERO_PTR));
* handle = 0;
}
@@ -220,42 +226,6 @@ ndb_mgm_get_latest_error_msg(const NdbMgmHandle h)
return "Error"; // Unknown Error message
}
-static
-int
-parse_connect_string(const char * connect_string,
- NdbMgmHandle handle)
-{
- if(connect_string == 0){
- SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, "");
- return -1;
- }
-
- char * line = my_strdup(connect_string,MYF(MY_WME));
- My_auto_ptr<char> ap1(line);
- if(line == 0){
- SET_ERROR(handle, NDB_MGM_OUT_OF_MEMORY, "");
- return -1;
- }
-
- char * tmp = strchr(line, ':');
- if(tmp == 0){
- SET_ERROR(handle, NDB_MGM_OUT_OF_MEMORY, "");
- return -1;
- }
- * tmp = 0; tmp++;
-
- int port = 0;
- if(sscanf(tmp, "%d", &port) != 1){
- SET_ERROR(handle, NDB_MGM_ILLEGAL_PORT_NUMBER, "");
- return -1;
- }
-
- my_free(handle->hostname,MYF(MY_ALLOW_ZERO_PTR));
- handle->hostname = my_strdup(line,MYF(MY_WME));
- handle->port = port;
- return 0;
-}
-
/*
* Call an operation, and return the reply
*/
@@ -348,11 +318,6 @@ ndb_mgm_connect(NdbMgmHandle handle, const char * mgmsrv)
{
SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_connect");
CHECK_HANDLE(handle, -1);
-
- if(parse_connect_string(mgmsrv, handle) != 0) {
- SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, "");
- return -1;
- }
#ifdef MGMAPI_LOG
/**
@@ -366,14 +331,37 @@ ndb_mgm_connect(NdbMgmHandle handle, const char * mgmsrv)
/**
* Do connect
*/
- SocketClient s(handle->hostname, handle->port);
- const NDB_SOCKET_TYPE sockfd = s.connect();
- if (sockfd < 0) {
+ LocalConfig *cfg= (LocalConfig*)(handle->cfg_ptr);
+ new (cfg) LocalConfig;
+ if (!cfg->init(mgmsrv, 0) ||
+ cfg->ids.size() == 0)
+ {
+ SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, "");
+ return -1;
+ }
+
+ NDB_SOCKET_TYPE sockfd= NDB_INVALID_SOCKET;
+ Uint32 i;
+ for (i = 0; i < cfg->ids.size(); i++)
+ {
+ if (cfg->ids[i].type != MgmId_TCP)
+ continue;
+ SocketClient s(cfg->ids[i].name.c_str(), cfg->ids[i].port);
+ sockfd = s.connect();
+ if (sockfd != NDB_INVALID_SOCKET)
+ break;
+ }
+ if (sockfd == NDB_INVALID_SOCKET)
+ {
setError(handle, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, __LINE__,
- "Unable to connect to %s", mgmsrv);
+ "Unable to connect using connectstring %s", mgmsrv);
return -1;
}
-
+
+ my_free(handle->hostname,MYF(MY_ALLOW_ZERO_PTR));
+ handle->hostname = my_strdup(cfg->ids[i].name.c_str(),MYF(MY_WME));
+ handle->port = cfg->ids[i].port;
+
handle->socket = sockfd;
handle->connected = 1;
@@ -392,7 +380,7 @@ ndb_mgm_disconnect(NdbMgmHandle handle)
CHECK_CONNECTED(handle, -1);
NDB_CLOSE_SOCKET(handle->socket);
- handle->socket = -1;
+ handle->socket = NDB_INVALID_SOCKET;
handle->connected = 0;
return 0;
@@ -1834,4 +1822,46 @@ ndb_mgm_set_string_parameter(NdbMgmHandle handle,
return res;
}
+extern "C"
+int
+ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **purged){
+ CHECK_HANDLE(handle, 0);
+ CHECK_CONNECTED(handle, 0);
+
+ Properties args;
+
+ const ParserRow<ParserDummy> reply[]= {
+ MGM_CMD("purge stale sessions reply", NULL, ""),
+ MGM_ARG("purged", String, Optional, ""),
+ MGM_ARG("result", String, Mandatory, "Error message"),
+ MGM_END()
+ };
+
+ const Properties *prop;
+ prop= ndb_mgm_call(handle, reply, "purge stale sessions", &args);
+
+ if(prop == NULL) {
+ SET_ERROR(handle, EIO, "Unable to purge stale sessions");
+ return -1;
+ }
+
+ int res= -1;
+ do {
+ const char * buf;
+ if(!prop->get("result", &buf) || strcmp(buf, "Ok") != 0){
+ ndbout_c("ERROR Message: %s\n", buf);
+ break;
+ }
+ if (purged) {
+ if (prop->get("purged", &buf))
+ *purged= strdup(buf);
+ else
+ *purged= 0;
+ }
+ res= 0;
+ } while(0);
+ delete prop;
+ return res;
+}
+
template class Vector<const ParserRow<ParserDummy>*>;
diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp
index e0935c2104e..bdeb885ed8b 100644
--- a/ndb/src/mgmclient/CommandInterpreter.cpp
+++ b/ndb/src/mgmclient/CommandInterpreter.cpp
@@ -17,7 +17,195 @@
#include <ndb_global.h>
#include <my_sys.h>
-#include "CommandInterpreter.hpp"
+//#define HAVE_GLOBAL_REPLICATION
+
+#include <Vector.hpp>
+#ifdef HAVE_GLOBAL_REPLICATION
+#include "../rep/repapi/repapi.h"
+#endif
+
+#include <mgmapi.h>
+
+class MgmtSrvr;
+
+/**
+ * @class CommandInterpreter
+ * @brief Reads command line in management client
+ *
+ * This class has one public method which reads a command line
+ * from a stream. It then interpret that commmand line and calls a suitable
+ * method in the MgmtSrvr class which executes the command.
+ *
+ * For command syntax, see the HELP command.
+ */
+class CommandInterpreter {
+public:
+ /**
+ * Constructor
+ * @param mgmtSrvr: Management server to use when executing commands
+ */
+ CommandInterpreter(const char *);
+ ~CommandInterpreter();
+
+ /**
+ * Reads one line from the stream, parse the line to find
+ * a command and then calls a suitable method which executes
+ * the command.
+ *
+ * @return true until quit/bye/exit has been typed
+ */
+ int execute(const char *_line, int _try_reconnect=-1);
+
+private:
+ void printError();
+
+ /**
+ * Analyse the command line, after the first token.
+ *
+ * @param processId: DB process id to send command to or -1 if
+ * command will be sent to all DB processes.
+ * @param allAfterFirstToken: What the client gave after the
+ * first token on the command line
+ */
+ void analyseAfterFirstToken(int processId, char* allAfterFirstTokenCstr);
+
+ /**
+ * Parse the block specification part of the LOG* commands,
+ * things after LOG*: [BLOCK = {ALL|<blockName>+}]
+ *
+ * @param allAfterLog: What the client gave after the second token
+ * (LOG*) on the command line
+ * @param blocks, OUT: ALL or name of all the blocks
+ * @return: true if correct syntax, otherwise false
+ */
+ bool parseBlockSpecification(const char* allAfterLog,
+ Vector<const char*>& blocks);
+
+ /**
+ * A bunch of execute functions: Executes one of the commands
+ *
+ * @param processId: DB process id to send command to
+ * @param parameters: What the client gave after the command name
+ * on the command line.
+ * For example if complete input from user is: "1 LOGLEVEL 22" then the
+ * parameters argument is the string with everything after LOGLEVEL, in
+ * this case "22". Each function is responsible to check the parameters
+ * argument.
+ */
+ void executeHelp(char* parameters);
+ void executeShow(char* parameters);
+ void executePurge(char* parameters);
+ void executeShutdown(char* parameters);
+ void executeRun(char* parameters);
+ void executeInfo(char* parameters);
+ void executeClusterLog(char* parameters);
+
+public:
+ void executeStop(int processId, const char* parameters, bool all);
+ void executeEnterSingleUser(char* parameters);
+ void executeExitSingleUser(char* parameters);
+ void executeStart(int processId, const char* parameters, bool all);
+ void executeRestart(int processId, const char* parameters, bool all);
+ void executeLogLevel(int processId, const char* parameters, bool all);
+ void executeError(int processId, const char* parameters, bool all);
+ void executeTrace(int processId, const char* parameters, bool all);
+ void executeLog(int processId, const char* parameters, bool all);
+ void executeLogIn(int processId, const char* parameters, bool all);
+ void executeLogOut(int processId, const char* parameters, bool all);
+ void executeLogOff(int processId, const char* parameters, bool all);
+ void executeTestOn(int processId, const char* parameters, bool all);
+ void executeTestOff(int processId, const char* parameters, bool all);
+ void executeSet(int processId, const char* parameters, bool all);
+ void executeGetStat(int processId, const char* parameters, bool all);
+ void executeStatus(int processId, const char* parameters, bool all);
+ void executeEventReporting(int processId, const char* parameters, bool all);
+ void executeDumpState(int processId, const char* parameters, bool all);
+ void executeStartBackup(char * parameters);
+ void executeAbortBackup(char * parameters);
+
+ void executeRep(char* parameters);
+
+ void executeCpc(char * parameters);
+
+public:
+ bool connect();
+ bool disconnect();
+
+ /**
+ * A execute function definition
+ */
+public:
+ typedef void (CommandInterpreter::* ExecuteFunction)(int processId,
+ const char * param,
+ bool all);
+
+ struct CommandFunctionPair {
+ const char * command;
+ ExecuteFunction executeFunction;
+ };
+private:
+ /**
+ *
+ */
+ void executeForAll(const char * cmd,
+ ExecuteFunction fun,
+ const char * param);
+
+ NdbMgmHandle m_mgmsrv;
+ bool connected;
+ const char *host;
+ int try_reconnect;
+#ifdef HAVE_GLOBAL_REPLICATION
+ NdbRepHandle m_repserver;
+ const char *rep_host;
+ bool rep_connected;
+#endif
+};
+
+
+/*
+ * Facade object for CommandInterpreter
+ */
+
+#include "ndb_mgmclient.hpp"
+#include "ndb_mgmclient.h"
+
+Ndb_mgmclient::Ndb_mgmclient(const char *host)
+{
+ m_cmd= new CommandInterpreter(host);
+}
+Ndb_mgmclient::~Ndb_mgmclient()
+{
+ delete m_cmd;
+}
+int Ndb_mgmclient::execute(const char *_line, int _try_reconnect)
+{
+ return m_cmd->execute(_line,_try_reconnect);
+}
+int
+Ndb_mgmclient::disconnect()
+{
+ return m_cmd->disconnect();
+}
+
+extern "C" {
+ Ndb_mgmclient_handle ndb_mgmclient_handle_create(const char *connect_string)
+ {
+ return (Ndb_mgmclient_handle) new Ndb_mgmclient(connect_string);
+ }
+ int ndb_mgmclient_execute(Ndb_mgmclient_handle h, int argc, char** argv)
+ {
+ return ((Ndb_mgmclient*)h)->execute(argc, argv, 1);
+ }
+ int ndb_mgmclient_handle_destroy(Ndb_mgmclient_handle h)
+ {
+ delete (Ndb_mgmclient*)h;
+ return 0;
+ }
+}
+/*
+ * The CommandInterpreter
+ */
#include <mgmapi.h>
#include <mgmapi_debug.h>
@@ -33,8 +221,22 @@
#endif // HAVE_GLOBAL_REPLICATION
#include "MgmtErrorReporter.hpp"
-#include "CpcClient.hpp"
+#include <Parser.hpp>
+#include <SocketServer.hpp>
+#include <util/InputStream.hpp>
+#include <util/OutputStream.hpp>
+int Ndb_mgmclient::execute(int argc, char** argv, int _try_reconnect)
+{
+ if (argc <= 0)
+ return 0;
+ BaseString _line(argv[0]);
+ for (int i= 1; i < argc; i++)
+ {
+ _line.appfmt(" %s", argv[i]);
+ }
+ return m_cmd->execute(_line.c_str(),_try_reconnect);
+}
/*****************************************************************************
* HELP
@@ -73,6 +275,7 @@ static const char* helpText =
#ifdef HAVE_GLOBAL_REPLICATION
"REP CONNECT <host:port> Connect to REP server on host:port\n"
#endif
+"PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt server\n"
"QUIT Quit management client\n"
;
@@ -181,8 +384,10 @@ CommandInterpreter::CommandInterpreter(const char *_host)
connected = false;
try_reconnect = 0;
-
- host = my_strdup(_host,MYF(MY_WME));
+ if (_host)
+ host= my_strdup(_host,MYF(MY_WME));
+ else
+ host= 0;
#ifdef HAVE_GLOBAL_REPLICATION
rep_host = NULL;
m_repserver = NULL;
@@ -197,11 +402,11 @@ CommandInterpreter::~CommandInterpreter()
{
connected = false;
ndb_mgm_destroy_handle(&m_mgmsrv);
- my_free((char *)host,MYF(0));
+ my_free((char *)host,MYF(MY_ALLOW_ZERO_PTR));
host = NULL;
}
-bool
+static bool
emptyString(const char* s)
{
if (s == NULL) {
@@ -264,18 +469,15 @@ CommandInterpreter::disconnect()
//*****************************************************************************
int
-CommandInterpreter::readAndExecute(int _try_reconnect)
+CommandInterpreter::execute(const char *_line, int _try_reconnect)
{
if (_try_reconnect >= 0)
try_reconnect=_try_reconnect;
-
- char* _line = readline_gets();
char * line;
if(_line == NULL) {
// ndbout << endl;
return false;
}
-
line = my_strdup(_line,MYF(MY_WME));
My_auto_ptr<char> ptr(line);
@@ -320,6 +522,10 @@ CommandInterpreter::readAndExecute(int _try_reconnect)
executeAbortBackup(allAfterFirstToken);
return true;
}
+ else if (strcmp(firstToken, "PURGE") == 0) {
+ executePurge(allAfterFirstToken);
+ return true;
+ }
#ifdef HAVE_GLOBAL_REPLICATION
else if(strcmp(firstToken, "REPLICATION") == 0 ||
strcmp(firstToken, "REP") == 0) {
@@ -349,10 +555,6 @@ CommandInterpreter::readAndExecute(int _try_reconnect)
strcmp(firstToken, "BYE") == 0) &&
allAfterFirstToken == NULL){
return false;
-#if 0
- } else if(strcmp(firstToken, "CPC") == 0) {
- executeCpc(allAfterFirstToken);
-#endif
} else {
/**
* First token should be a digit, node ID
@@ -766,6 +968,46 @@ print_nodes(ndb_mgm_cluster_state *state, ndb_mgm_configuration_iterator *it,
}
void
+CommandInterpreter::executePurge(char* parameters)
+{
+ int command_ok= 0;
+ do {
+ if (emptyString(parameters))
+ break;
+ char* firstToken = strtok(parameters, " ");
+ char* nextToken = strtok(NULL, " \0");
+ if (strcmp(firstToken,"STALE") == 0 &&
+ nextToken &&
+ strcmp(nextToken, "SESSIONS") == 0) {
+ command_ok= 1;
+ break;
+ }
+ } while(0);
+
+ if (!command_ok) {
+ ndbout_c("Unexpected command, expected: PURGE STALE SESSIONS");
+ return;
+ }
+
+ int i;
+ char *str;
+ connect();
+
+ if (ndb_mgm_purge_stale_sessions(m_mgmsrv, &str)) {
+ ndbout_c("Command failed");
+ return;
+ }
+ if (str) {
+ ndbout_c("Purged sessions with node id's: %s", str);
+ free(str);
+ }
+ else
+ {
+ ndbout_c("No sessions purged");
+ }
+}
+
+void
CommandInterpreter::executeShow(char* parameters)
{
int i;
@@ -1144,7 +1386,7 @@ void
CommandInterpreter::executeDumpState(int processId, const char* parameters,
bool all)
{
- if(parameters == 0 || strlen(parameters) == 0){
+ if(emptyString(parameters)){
ndbout << "Expected argument" << endl;
return;
}
@@ -1564,6 +1806,10 @@ CommandInterpreter::executeEventReporting(int processId,
const char* parameters,
bool all)
{
+ if (emptyString(parameters)) {
+ ndbout << "Expected argument" << endl;
+ return;
+ }
connect();
BaseString tmp(parameters);
@@ -1664,6 +1910,7 @@ void
CommandInterpreter::executeAbortBackup(char* parameters)
{
connect();
+
strtok(parameters, " ");
struct ndb_mgm_reply reply;
char* id = strtok(NULL, "\0");
@@ -1903,169 +2150,4 @@ CommandInterpreter::executeRep(char* parameters)
}
#endif // HAVE_GLOBAL_REPLICATION
-
-/*****************************************************************************
- * CPC
- *****************************************************************************/
-
-#if 0
-
-#if 0
-//#ifdef NDB_SOLARIS // XXX fix me
-static char* strsep(char** x, const char* y) { return 0; }
-#endif
-
-// Note this code has not been verified
-#if 0
-static char * my_strsep(char **stringp, const char *delim)
-{
- char *tmp= *stringp;
- if (tmp == 0)
- return 0;
- *stringp = strtok(tmp, delim);
- return tmp;
-}
-#endif
-
-void
-CommandInterpreter::executeCpc(char *parameters)
-{
- char *host_str = NULL, *port_str = NULL, *end;
- long port = 1234; /* XXX */
-
- while((host_str = my_strsep(&parameters, " \t:")) != NULL &&
- host_str[0] == '\0');
-
- if(parameters && parameters[0] != '\0') {
- while((port_str = my_strsep(&parameters, " \t:")) != NULL &&
- port_str[0] == '\0');
-
- errno = 0;
- port = strtol(port_str, &end, 0);
- if(end[0] != '\0')
- goto error;
- if((port == LONG_MAX || port == LONG_MIN) &&
- errno == ERANGE)
- goto error;
- }
-
- {
- SimpleCpcClient cpc(host_str, port);
- bool done = false;
-
- if(cpc.connect() < 0) {
- ndbout_c("Cannot connect to %s:%d.", cpc.getHost(), cpc.getPort());
- switch(errno) {
- case ENOENT:
- ndbout << ": " << "No such host" << endl;
- break;
- default:
- ndbout << ": " << strerror(errno) << endl;
- break;
- }
- return;
- }
-
- while(!done) {
- char *line = readline("CPC> ");
- if(line != NULL) {
- add_history(line);
-
- char *cmd = strtok(line, " ");
- char *arg = strtok(NULL, "");
-
- if(arg != NULL) {
- while(arg[0] == ' ')
- arg++;
- if(strlen(arg) == 0)
- arg = NULL;
- }
-
- if(cmd != NULL) {
- if(strcmp(cmd, "exit") == 0)
- done = true;
- else if(strcmp(cmd, "list") == 0)
- cpc.cmd_list(arg);
- else if(strcmp(cmd, "start") == 0)
- cpc.cmd_start(arg);
- else if(strcmp(cmd, "stop") == 0)
- cpc.cmd_stop(arg);
- else if(strcmp(cmd, "help") == 0)
- cpc.cmd_help(arg);
- }
- } else {
- done = true;
- ndbout << endl;
- }
- }
- }
- return;
-
- error:
- ndbout << "Error: expected a tcp port number, got '" << port_str << "'."
- << endl;
- return;
-}
-#endif
-
-#if 0
-static
-void
-CmdBackupCallback(const MgmtSrvr::BackupEvent & event){
- char str[255];
-
- ndbout << endl;
-
- bool ok = false;
- switch(event.Event){
- case MgmtSrvr::BackupEvent::BackupStarted:
- ok = true;
- BaseString::snprintf(str, sizeof(str),
- "Backup %d started", event.Started.BackupId);
- break;
- case MgmtSrvr::BackupEvent::BackupFailedToStart:
- ok = true;
- BaseString::snprintf(str, sizeof(str),
- "Backup failed to start (Error %d)",
- event.FailedToStart.ErrorCode);
- break;
- case MgmtSrvr::BackupEvent::BackupCompleted:
- ok = true;
- BaseString::snprintf(str, sizeof(str),
- "Backup %d completed",
- event.Completed.BackupId);
- ndbout << str << endl;
-
- BaseString::snprintf(str, sizeof(str),
- " StartGCP: %d StopGCP: %d",
- event.Completed.startGCP, event.Completed.stopGCP);
- ndbout << str << endl;
-
- BaseString::snprintf(str, sizeof(str),
- " #Records: %d #LogRecords: %d",
- event.Completed.NoOfRecords, event.Completed.NoOfLogRecords);
- ndbout << str << endl;
-
- BaseString::snprintf(str, sizeof(str),
- " Data: %d bytes Log: %d bytes",
- event.Completed.NoOfBytes, event.Completed.NoOfLogBytes);
- break;
- case MgmtSrvr::BackupEvent::BackupAborted:
- ok = true;
- BaseString::snprintf(str, sizeof(str),
- "Backup %d has been aborted reason %d",
- event.Aborted.BackupId,
- event.Aborted.Reason);
- break;
- }
- if(!ok){
- BaseString::snprintf(str, sizeof(str),
- "Unknown backup event: %d",
- event.Event);
-
- }
- ndbout << str << endl;
-}
-#endif
-
template class Vector<char const*>;
diff --git a/ndb/src/mgmclient/CommandInterpreter.hpp b/ndb/src/mgmclient/CommandInterpreter.hpp
deleted file mode 100644
index eecc48a739e..00000000000
--- a/ndb/src/mgmclient/CommandInterpreter.hpp
+++ /dev/null
@@ -1,197 +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 */
-
-#ifndef CommandInterpreter_H
-#define CommandInterpreter_H
-
-//#define HAVE_GLOBAL_REPLICATION
-//*****************************************************************************
-// Author: Peter Lind
-//*****************************************************************************
-
-#include <ndb_global.h>
-#include <Vector.hpp>
-#include <editline/editline.h>
-
-#ifdef HAVE_GLOBAL_REPLICATION
-#include "../rep/repapi/repapi.h"
-#endif
-
-#include <mgmapi.h>
-
-class MgmtSrvr;
-
-/**
- * @class CommandInterpreter
- * @brief Reads command line in management client
- *
- * This class has one public method which reads a command line
- * from a stream. It then interpret that commmand line and calls a suitable
- * method in the MgmtSrvr class which executes the command.
- *
- * For command syntax, see the HELP command.
- */
-class CommandInterpreter {
-public:
- /**
- * Constructor
- * @param mgmtSrvr: Management server to use when executing commands
- */
- CommandInterpreter(const char *);
- ~CommandInterpreter();
-
- /**
- * Reads one line from the stream, parse the line to find
- * a command and then calls a suitable method which executes
- * the command.
- *
- * @return true until quit/bye/exit has been typed
- */
- int readAndExecute(int _try_reconnect=-1);
-
-private:
- /**
- * Read a string, and return a pointer to it.
- *
- * @return NULL on EOF.
- */
- char *readline_gets ()
- {
- static char *line_read = (char *)NULL;
-
- /* If the buffer has already been allocated, return the memory
- to the free pool. */
- if (line_read)
- {
- free (line_read);
- line_read = (char *)NULL;
- }
-
- /* Get a line from the user. */
- line_read = readline ("NDB> ");
-
- /* If the line has any text in it, save it on the history. */
- if (line_read && *line_read)
- add_history (line_read);
-
- return (line_read);
- }
-
- void printError();
-
- /**
- * Analyse the command line, after the first token.
- *
- * @param processId: DB process id to send command to or -1 if
- * command will be sent to all DB processes.
- * @param allAfterFirstToken: What the client gave after the
- * first token on the command line
- */
- void analyseAfterFirstToken(int processId, char* allAfterFirstTokenCstr);
-
- /**
- * Parse the block specification part of the LOG* commands,
- * things after LOG*: [BLOCK = {ALL|<blockName>+}]
- *
- * @param allAfterLog: What the client gave after the second token
- * (LOG*) on the command line
- * @param blocks, OUT: ALL or name of all the blocks
- * @return: true if correct syntax, otherwise false
- */
- bool parseBlockSpecification(const char* allAfterLog,
- Vector<const char*>& blocks);
-
- /**
- * A bunch of execute functions: Executes one of the commands
- *
- * @param processId: DB process id to send command to
- * @param parameters: What the client gave after the command name
- * on the command line.
- * For example if complete input from user is: "1 LOGLEVEL 22" then the
- * parameters argument is the string with everything after LOGLEVEL, in
- * this case "22". Each function is responsible to check the parameters
- * argument.
- */
- void executeHelp(char* parameters);
- void executeShow(char* parameters);
- void executeShutdown(char* parameters);
- void executeRun(char* parameters);
- void executeInfo(char* parameters);
- void executeClusterLog(char* parameters);
-
-public:
- void executeStop(int processId, const char* parameters, bool all);
- void executeEnterSingleUser(char* parameters);
- void executeExitSingleUser(char* parameters);
- void executeStart(int processId, const char* parameters, bool all);
- void executeRestart(int processId, const char* parameters, bool all);
- void executeLogLevel(int processId, const char* parameters, bool all);
- void executeError(int processId, const char* parameters, bool all);
- void executeTrace(int processId, const char* parameters, bool all);
- void executeLog(int processId, const char* parameters, bool all);
- void executeLogIn(int processId, const char* parameters, bool all);
- void executeLogOut(int processId, const char* parameters, bool all);
- void executeLogOff(int processId, const char* parameters, bool all);
- void executeTestOn(int processId, const char* parameters, bool all);
- void executeTestOff(int processId, const char* parameters, bool all);
- void executeSet(int processId, const char* parameters, bool all);
- void executeGetStat(int processId, const char* parameters, bool all);
- void executeStatus(int processId, const char* parameters, bool all);
- void executeEventReporting(int processId, const char* parameters, bool all);
- void executeDumpState(int processId, const char* parameters, bool all);
- void executeStartBackup(char * parameters);
- void executeAbortBackup(char * parameters);
-
- void executeRep(char* parameters);
-
- void executeCpc(char * parameters);
-
-public:
- bool connect();
- bool disconnect();
-
- /**
- * A execute function definition
- */
-public:
- typedef void (CommandInterpreter::* ExecuteFunction)(int processId,
- const char * param,
- bool all);
-
- struct CommandFunctionPair {
- const char * command;
- ExecuteFunction executeFunction;
- };
-private:
- /**
- *
- */
- void executeForAll(const char * cmd,
- ExecuteFunction fun,
- const char * param);
-
- NdbMgmHandle m_mgmsrv;
- bool connected;
- const char *host;
- int try_reconnect;
-#ifdef HAVE_GLOBAL_REPLICATION
- NdbRepHandle m_repserver;
- const char *rep_host;
- bool rep_connected;
-#endif
-};
-
-#endif // CommandInterpreter_H
diff --git a/ndb/src/mgmclient/Makefile.am b/ndb/src/mgmclient/Makefile.am
index e271c7bed53..b8f9f82e501 100644
--- a/ndb/src/mgmclient/Makefile.am
+++ b/ndb/src/mgmclient/Makefile.am
@@ -1,18 +1,26 @@
+noinst_LTLIBRARIES = libndbmgmclient.la
ndbtools_PROGRAMS = ndb_mgm
-ndb_mgm_SOURCES = \
- main.cpp \
- CommandInterpreter.cpp \
- CpcClient.cpp
+libndbmgmclient_la_SOURCES = CommandInterpreter.cpp
+libndbmgmclient_la_LIBADD = ../mgmapi/libmgmapi.la \
+ ../common/logger/liblogger.la \
+ ../common/portlib/libportlib.la \
+ ../common/util/libgeneral.la \
+ ../common/portlib/libportlib.la
+
+
+ndb_mgm_SOURCES = main.cpp
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
-INCLUDES += -I$(top_srcdir)/ndb/include/mgmapi -I$(top_srcdir)/ndb/src/common/mgmcommon
+INCLUDES += -I$(top_srcdir)/ndb/include/mgmapi \
+ -I$(top_srcdir)/ndb/src/common/mgmcommon
-LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la \
- $(top_builddir)/ndb/src/common/editline/libeditline.a \
+LDADD_LOC = $(noinst_LTLIBRARIES) \
+ ../common/portlib/libportlib.la \
+ @readline_link@ \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
diff --git a/ndb/src/mgmclient/Makefile_old b/ndb/src/mgmclient/Makefile_old
deleted file mode 100644
index d1b2d60a52a..00000000000
--- a/ndb/src/mgmclient/Makefile_old
+++ /dev/null
@@ -1,25 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapi
-
-BIN_TARGET := mgmtclient
-BIN_TARGET_LIBS :=
-BIN_TARGET_ARCHIVES := trace logger mgmapi general mgmsrvcommon portlib repapi
-
-BIN_TARGET_ARCHIVES += editline
-
-DIRS = test_cpcd
-
-# Source files of non-templated classes (.cpp files)
-SOURCES = \
- main.cpp \
- CommandInterpreter.cpp \
- CpcClient.cpp
-
-CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/mgmapi) \
- -I$(call fixpath,$(NDB_TOP)/src/common/mgmcommon)
-
-include $(NDB_TOP)/Epilogue.mk
-
-_bins_mkconfig : $(NDB_TOP)/bin/$(BIN_TARGET)
-
diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp
index a37214d366b..401a9198f30 100644
--- a/ndb/src/mgmclient/main.cpp
+++ b/ndb/src/mgmclient/main.cpp
@@ -17,18 +17,29 @@
#include <ndb_global.h>
#include <ndb_opts.h>
+// copied from mysql.cc to get readline
+extern "C" {
+#if defined( __WIN__) || defined(OS2)
+#include <conio.h>
+#elif !defined(__NETWARE__)
+#include <readline/readline.h>
+extern "C" int add_history(const char *command); /* From readline directory */
+#define HAVE_READLINE
+#endif
+}
+
#include <NdbMain.h>
#include <NdbHost.h>
#include <mgmapi.h>
#include <ndb_version.h>
#include <LocalConfig.hpp>
-#include "CommandInterpreter.hpp"
+#include "ndb_mgmclient.hpp"
const char *progname = "ndb_mgm";
-static CommandInterpreter* com;
+static Ndb_mgmclient* com;
extern "C"
void
@@ -90,6 +101,39 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
return 0;
}
+static int
+read_and_execute(int _try_reconnect)
+{
+ static char *line_read = (char *)NULL;
+
+ /* If the buffer has already been allocated, return the memory
+ to the free pool. */
+ if (line_read)
+ {
+ free (line_read);
+ line_read = (char *)NULL;
+ }
+#ifdef HAVE_READLINE
+ /* Get a line from the user. */
+ line_read = readline ("ndb_mgm> ");
+ /* If the line has any text in it, save it on the history. */
+ if (line_read && *line_read)
+ add_history (line_read);
+#else
+ static char linebuffer[254];
+ fputs("ndb_mgm> ", stdout);
+ linebuffer[sizeof(linebuffer)-1]=0;
+ line_read = fgets(linebuffer, sizeof(linebuffer)-1, stdin);
+ if (line_read == linebuffer) {
+ char *q=linebuffer;
+ while (*q > 31) q++;
+ *q=0;
+ line_read= strdup(linebuffer);
+ }
+#endif
+ return com->execute(line_read,_try_reconnect);
+}
+
int main(int argc, char** argv){
NDB_INIT(argv[0]);
const char *_host = 0;
@@ -101,34 +145,22 @@ int main(int argc, char** argv){
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
- LocalConfig cfg;
-
- if(argc >= 1) {
- _host = argv[0];
- if(argc >= 2) {
- _port = atoi(argv[1]);
- }
- } else {
- if(cfg.init(opt_connect_str, 0) && cfg.ids.size() > 0 && cfg.ids[0].type == MgmId_TCP){
- _host = cfg.ids[0].name.c_str();
- _port = cfg.ids[0].port;
- } else {
- cfg.printError();
- cfg.printUsage();
- return 1;
- }
- }
-
char buf[MAXHOSTNAMELEN+10];
- BaseString::snprintf(buf, sizeof(buf), "%s:%d", _host, _port);
+ if(argc == 1) {
+ BaseString::snprintf(buf, sizeof(buf), "%s", argv[0]);
+ opt_connect_str= buf;
+ } else if (argc >= 2) {
+ BaseString::snprintf(buf, sizeof(buf), "%s:%s", argv[0], argv[1]);
+ opt_connect_str= buf;
+ }
ndbout << "-- NDB Cluster -- Management Client --" << endl;
- printf("Connecting to Management Server: %s\n", buf);
+ printf("Connecting to Management Server: %s\n", opt_connect_str ? opt_connect_str : "default");
signal(SIGPIPE, handler);
- com = new CommandInterpreter(buf);
- while(com->readAndExecute(_try_reconnect));
+ com = new Ndb_mgmclient(opt_connect_str);
+ while(read_and_execute(_try_reconnect));
delete com;
return 0;
diff --git a/ndb/src/common/editline/unix.h b/ndb/src/mgmclient/ndb_mgmclient.h
index 37f461b471d..b62a33999a3 100644
--- a/ndb/src/common/editline/unix.h
+++ b/ndb/src/mgmclient/ndb_mgmclient.h
@@ -14,12 +14,20 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/* $Revision: 1.3 $
-**
-** Editline system header file for Unix.
-*/
+#ifndef Ndb_mgmclient_h
+#define Ndb_mgmclient_h
-#define CRLF "\r\n"
+#ifdef __cplusplus
+extern "C" {
+#endif
-#include <ndb_global.h>
-#include <dirent.h>
+typedef void* Ndb_mgmclient_handle;
+Ndb_mgmclient_handle ndb_mgmclient_handle_create(const char *connect_string);
+int ndb_mgmclient_execute(Ndb_mgmclient_handle, int argc, char** argv);
+int ndb_mgmclient_handle_destroy(Ndb_mgmclient_handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* Ndb_mgmclient_h */
diff --git a/ndb/src/common/editline/editline_win32.c b/ndb/src/mgmclient/ndb_mgmclient.hpp
index 5083edb7fae..f6bcebc3896 100644
--- a/ndb/src/common/editline/editline_win32.c
+++ b/ndb/src/mgmclient/ndb_mgmclient.hpp
@@ -14,19 +14,20 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#ifndef Ndb_mgmclient_hpp
+#define Ndb_mgmclient_hpp
-#include <ndb_global.h>
-
-
-char* readline(const char* prompt)
+class CommandInterpreter;
+class Ndb_mgmclient
{
- char* szBuf;
- printf(prompt);
- szBuf = (char*)malloc(256);
- return gets(szBuf);
-}
-
-void add_history(char* pch)
-{
-}
-
+public:
+ Ndb_mgmclient(const char*);
+ ~Ndb_mgmclient();
+ int execute(const char *_line, int _try_reconnect=-1);
+ int execute(int argc, char** argv, int _try_reconnect=-1);
+ int disconnect();
+private:
+ CommandInterpreter *m_cmd;
+};
+
+#endif // Ndb_mgmclient_hpp
diff --git a/ndb/src/mgmsrv/CommandInterpreter.hpp b/ndb/src/mgmsrv/CommandInterpreter.hpp
index 3466ee76226..db23f76a5bd 100644
--- a/ndb/src/mgmsrv/CommandInterpreter.hpp
+++ b/ndb/src/mgmsrv/CommandInterpreter.hpp
@@ -23,7 +23,6 @@
#include <ndb_global.h>
#include <Vector.hpp>
-#include <editline/editline.h>
#include <BaseString.hpp>
class MgmtSrvr;
@@ -63,26 +62,27 @@ private:
*/
char *readline_gets ()
{
+ static char linebuffer[254];
static char *line_read = (char *)NULL;
- // Disable the default file-name completion action of TAB
- // rl_bind_key ('\t', rl_insert);
-
/* If the buffer has already been allocated, return the memory
to the free pool. */
if (line_read)
- {
- free (line_read);
- line_read = (char *)NULL;
- }
+ {
+ free (line_read);
+ line_read = (char *)NULL;
+ }
/* Get a line from the user. */
- line_read = readline ("NDB> ");
-
- /* If the line has any text in it, save it on the history. */
- if (line_read && *line_read)
- add_history (line_read);
-
+ fputs("ndb_mgmd> ", stdout);
+ linebuffer[sizeof(linebuffer)-1]=0;
+ line_read = fgets(linebuffer, sizeof(linebuffer)-1, stdin);
+ if (line_read == linebuffer) {
+ char *q=linebuffer;
+ while (*q > 31) q++;
+ *q=0;
+ line_read= strdup(linebuffer);
+ }
return (line_read);
}
diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp
index ad346b30ead..4af1556a0c0 100644
--- a/ndb/src/mgmsrv/ConfigInfo.cpp
+++ b/ndb/src/mgmsrv/ConfigInfo.cpp
@@ -1478,7 +1478,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::USED,
false,
ConfigInfo::INT,
- NDB_BASE_PORT,
+ NDB_PORT,
"0",
STR_VALUE(MAX_INT_RNIL) },
@@ -1490,7 +1490,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::USED,
false,
ConfigInfo::INT,
- "2199",
+ UNDEFINED,
"0",
STR_VALUE(MAX_INT_RNIL) },
@@ -3010,7 +3010,7 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
if(!(ctx.m_userDefaults &&
ctx.m_userDefaults->get("PortNumber", &base)) &&
!ctx.m_systemDefaults->get("PortNumber", &base)) {
- base= strtoll(NDB_BASE_PORT,0,0)+2;
+ base= strtoll(NDB_BASE_PORT,0,0);
// ctx.reportError("Cannot retrieve base port number");
// return false;
}
@@ -3442,7 +3442,7 @@ static bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>&sections,
#if 0
Properties * props= ctx.m_config;
Properties computers(true);
- Uint32 port_base = NDB_BASE_PORT+2;
+ Uint32 port_base = NDB_BASE_PORT;
Uint32 nNodes;
ctx.m_userProperties.get("NoOfNodes", &nNodes);
diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am
index 3b57b027827..ee5220ef9f8 100644
--- a/ndb/src/mgmsrv/Makefile.am
+++ b/ndb/src/mgmsrv/Makefile.am
@@ -24,7 +24,6 @@ INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \
-I$(top_srcdir)/ndb/src/common/mgmcommon
LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la \
- $(top_builddir)/ndb/src/common/editline/libeditline.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
@@ -34,6 +33,7 @@ DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DMYSQLCLUSTERDIR="\"$(MYSQLCLUSTERdir)\"" \
+ -DNDB_PORT="\"@ndb_port@\"" \
-DNDB_BASE_PORT="\"@ndb_port_base@\""
include $(top_srcdir)/ndb/config/common.mk.am
diff --git a/ndb/src/mgmsrv/Makefile_old b/ndb/src/mgmsrv/Makefile_old
deleted file mode 100644
index c99875ae8b6..00000000000
--- a/ndb/src/mgmsrv/Makefile_old
+++ /dev/null
@@ -1,41 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapi mgmapiclient
-
-BIN_TARGET := mgmtsrvr
-BIN_TARGET_LIBS :=
-BIN_TARGET_ARCHIVES := NDB_API mgmsrvcommon mgmapi general
-
-ifneq ($(USE_EDITLINE), N)
-BIN_TARGET_ARCHIVES += editline
-DIRS := mkconfig
-endif
-BIN_TARGET_ARCHIVES += general
-
-BIN_FLAGS += $(TERMCAP_LIB)
-
-# Source files of non-templated classes (.cpp files)
-SOURCES = \
- MgmtSrvr.cpp \
- MgmtSrvrGeneralSignalHandling.cpp \
- main.cpp \
- Services.cpp \
- convertStrToInt.cpp \
- NodeLogLevel.cpp \
- NodeLogLevelList.cpp \
- SignalQueue.cpp \
- MgmtSrvrConfig.cpp
-
-ifeq ($(findstring OSE, $(NDB_OS)),)
-SOURCES += CommandInterpreter.cpp
-endif
-
-CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/src/ndbapi) \
- -I$(call fixpath,$(NDB_TOP)/src/mgmapi) \
- -I$(call fixpath,$(NDB_TOP)/include/mgmapi) \
- -I$(call fixpath,$(NDB_TOP)/src/common/mgmcommon)
-
-include $(NDB_TOP)/Epilogue.mk
-
-_bins_mkconfig : $(NDB_TOP)/bin/$(BIN_TARGET)
-
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index 2e30d73290b..a49b29af275 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -400,11 +400,13 @@ MgmtSrvr::getPort() const {
/* Constructor */
MgmtSrvr::MgmtSrvr(NodeId nodeId,
+ SocketServer *socket_server,
const BaseString &configFilename,
LocalConfig &local_config,
Config * config):
_blockNumber(1), // Hard coded block number since it makes it easy to send
// signals to other management servers.
+ m_socket_server(socket_server),
_ownReference(0),
m_local_config(local_config),
theSignalIdleList(NULL),
@@ -2094,6 +2096,25 @@ MgmtSrvr::getNodeType(NodeId nodeId) const
return nodeTypes[nodeId];
}
+void
+MgmtSrvr::get_connected_nodes(NodeBitmask &connected_nodes) const
+{
+ if (theFacade && theFacade->theClusterMgr)
+ {
+ for(Uint32 i = 0; i < MAX_NODES; i++)
+ {
+ if (getNodeType(i) == NDB_MGM_NODE_TYPE_NDB)
+ {
+ const ClusterMgr::Node &node= theFacade->theClusterMgr->getNodeInfo(i);
+ if (node.connected)
+ {
+ connected_nodes.bitOR(node.m_state.m_connected_nodes);
+ }
+ }
+ }
+ }
+}
+
bool
MgmtSrvr::alloc_node_id(NodeId * nodeId,
enum ndb_mgm_node_type type,
@@ -2106,7 +2127,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
*nodeId, type, client_addr));
if (g_no_nodeid_checks) {
if (*nodeId == 0) {
- error_string.appfmt("no-nodeid-ckecks set in manegment server.\n"
+ error_string.appfmt("no-nodeid-checks set in management server.\n"
"node id must be set explicitly in connectstring");
DBUG_RETURN(false);
}
@@ -2115,16 +2136,11 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
Guard g(m_node_id_mutex);
int no_mgm= 0;
NodeBitmask connected_nodes(m_reserved_nodes);
- for(Uint32 i = 0; i < MAX_NODES; i++)
+ get_connected_nodes(connected_nodes);
{
- if (getNodeType(i) == NDB_MGM_NODE_TYPE_NDB &&
- theFacade && theFacade->theClusterMgr) {
- const ClusterMgr::Node &node= theFacade->theClusterMgr->getNodeInfo(i);
- if (node.connected) {
- connected_nodes.bitOR(node.m_state.m_connected_nodes);
- }
- } else if (getNodeType(i) == NDB_MGM_NODE_TYPE_MGM)
- no_mgm++;
+ for(Uint32 i = 0; i < MAX_NODES; i++)
+ if (getNodeType(i) == NDB_MGM_NODE_TYPE_MGM)
+ no_mgm++;
}
bool found_matching_id= false;
bool found_matching_type= false;
@@ -2227,6 +2243,10 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
m_connect_address[id_found].s_addr= 0;
}
m_reserved_nodes.set(id_found);
+ char tmp_str[128];
+ m_reserved_nodes.getText(tmp_str);
+ g_EventLogger.info("Mgmt server state: nodeid %d reserved for ip %s, m_reserved_nodes %s.",
+ id_found, get_connect_address(id_found), tmp_str);
DBUG_RETURN(true);
}
@@ -2283,6 +2303,36 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
error_string.appfmt("No node defined with id=%d in config file.",
*nodeId);
}
+
+ g_EventLogger.warning("Allocate nodeid (%d) failed. Connection from ip %s. "
+ "Returned error string \"%s\"",
+ *nodeId,
+ client_addr != 0 ? inet_ntoa(((struct sockaddr_in *)(client_addr))->sin_addr) : "<none>",
+ error_string.c_str());
+
+ NodeBitmask connected_nodes2;
+ get_connected_nodes(connected_nodes2);
+ {
+ BaseString tmp_connected, tmp_not_connected;
+ for(Uint32 i = 0; i < MAX_NODES; i++)
+ {
+ if (connected_nodes2.get(i))
+ {
+ if (!m_reserved_nodes.get(i))
+ tmp_connected.appfmt(" %d", i);
+ }
+ else if (m_reserved_nodes.get(i))
+ {
+ tmp_not_connected.appfmt(" %d", i);
+ }
+ }
+ if (tmp_connected.length() > 0)
+ g_EventLogger.info("Mgmt server state: node id's %s connected but not reserved",
+ tmp_connected.c_str());
+ if (tmp_not_connected.length() > 0)
+ g_EventLogger.info("Mgmt server state: node id's %s not connected but reserved",
+ tmp_not_connected.c_str());
+ }
DBUG_RETURN(false);
}
@@ -2531,10 +2581,15 @@ MgmtSrvr::Allocated_resources::~Allocated_resources()
{
Guard g(m_mgmsrv.m_node_id_mutex);
if (!m_reserved_nodes.isclear()) {
+ m_mgmsrv.m_reserved_nodes.bitANDC(m_reserved_nodes);
// node has been reserved, force update signal to ndb nodes
global_flag_send_heartbeat_now= 1;
+
+ char tmp_str[128];
+ m_mgmsrv.m_reserved_nodes.getText(tmp_str);
+ g_EventLogger.info("Mgmt server state: nodeid %d freed, m_reserved_nodes %s.",
+ get_nodeid(), tmp_str);
}
- m_mgmsrv.m_reserved_nodes.bitANDC(m_reserved_nodes);
}
void
@@ -2543,6 +2598,17 @@ MgmtSrvr::Allocated_resources::reserve_node(NodeId id)
m_reserved_nodes.set(id);
}
+NodeId
+MgmtSrvr::Allocated_resources::get_nodeid() const
+{
+ for(Uint32 i = 0; i < MAX_NODES; i++)
+ {
+ if (m_reserved_nodes.get(i))
+ return i;
+ }
+ return 0;
+}
+
int
MgmtSrvr::setDbParameter(int node, int param, const char * value,
BaseString& msg){
diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp
index c796e1e9219..b3257491123 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.hpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.hpp
@@ -96,7 +96,10 @@ public:
// methods to reserve/allocate resources which
// will be freed when running destructor
void reserve_node(NodeId id);
- bool is_reserved(NodeId nodeId) { return m_reserved_nodes.get(nodeId);}
+ bool is_reserved(NodeId nodeId) { return m_reserved_nodes.get(nodeId); }
+ bool is_reserved(NodeBitmask mask) { return !mask.bitAND(m_reserved_nodes).isclear(); }
+ bool isclear() { return m_reserved_nodes.isclear(); }
+ NodeId get_nodeid() const;
private:
MgmtSrvr &m_mgmsrv;
NodeBitmask m_reserved_nodes;
@@ -173,6 +176,7 @@ public:
/* Constructor */
MgmtSrvr(NodeId nodeId, /* Local nodeid */
+ SocketServer *socket_server,
const BaseString &config_filename, /* Where to save config */
LocalConfig &local_config, /* Ndb.cfg filename */
Config * config);
@@ -499,6 +503,9 @@ public:
int setDbParameter(int node, int parameter, const char * value, BaseString&);
const char *get_connect_address(Uint32 node_id) { return inet_ntoa(m_connect_address[node_id]); }
+ void get_connected_nodes(NodeBitmask &connected_nodes) const;
+ SocketServer *get_socket_server() { return m_socket_server; }
+
//**************************************************************************
private:
//**************************************************************************
@@ -525,6 +532,8 @@ private:
int _blockNumber;
NodeId _ownNodeId;
+ SocketServer *m_socket_server;
+
BlockReference _ownReference;
NdbMutex *m_configMutex;
const Config * _config;
diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp
index 2672d8c9d4b..0394c4e80bb 100644
--- a/ndb/src/mgmsrv/Services.cpp
+++ b/ndb/src/mgmsrv/Services.cpp
@@ -242,6 +242,8 @@ ParserRow<MgmApiSession> commands[] = {
MGM_ARG("node", Int, Optional, "Node"),
MGM_ARG("filter", String, Mandatory, "Event category"),
+ MGM_CMD("purge stale sessions", &MgmApiSession::purge_stale_sessions, ""),
+
MGM_END()
};
@@ -1412,6 +1414,46 @@ done:
m_output->println("");
}
+struct PurgeStruct
+{
+ NodeBitmask free_nodes;/* free nodes as reported
+ * by ndbd in apiRegReqConf
+ */
+ BaseString *str;
+};
+
+void
+MgmApiSession::stop_session_if_not_connected(SocketServer::Session *_s, void *data)
+{
+ MgmApiSession *s= (MgmApiSession *)_s;
+ struct PurgeStruct &ps= *(struct PurgeStruct *)data;
+ if (s->m_allocated_resources->is_reserved(ps.free_nodes))
+ {
+ ps.str->appfmt(" %d", s->m_allocated_resources->get_nodeid());
+ s->stopSession();
+ }
+}
+
+void
+MgmApiSession::purge_stale_sessions(Parser_t::Context &ctx,
+ const class Properties &args)
+{
+ struct PurgeStruct ps;
+ BaseString str;
+ ps.str = &str;
+
+ m_mgmsrv.get_connected_nodes(ps.free_nodes);
+ ps.free_nodes.bitXORC(NodeBitmask()); // invert connected_nodes to get free nodes
+
+ m_mgmsrv.get_socket_server()->foreachSession(stop_session_if_not_connected,&ps);
+
+ m_output->println("purge stale sessions reply");
+ if (str.length() > 0)
+ m_output->println("purged:%s",str.c_str());
+ m_output->println("result: Ok");
+ m_output->println("");
+}
+
template class MutexVector<int>;
template class Vector<ParserRow<MgmApiSession> const*>;
template class Vector<unsigned short>;
diff --git a/ndb/src/mgmsrv/Services.hpp b/ndb/src/mgmsrv/Services.hpp
index e47820826b6..bfc915f18f1 100644
--- a/ndb/src/mgmsrv/Services.hpp
+++ b/ndb/src/mgmsrv/Services.hpp
@@ -28,7 +28,9 @@
/** Undefine this to remove backwards compatibility for "GET CONFIG". */
#define MGM_GET_CONFIG_BACKWARDS_COMPAT
-class MgmApiSession : public SocketServer::Session {
+class MgmApiSession : public SocketServer::Session
+{
+ static void stop_session_if_not_connected(SocketServer::Session *_s, void *data);
private:
typedef Parser<MgmApiSession> Parser_t;
@@ -84,6 +86,8 @@ public:
void setParameter(Parser_t::Context &ctx, const class Properties &args);
void listen_event(Parser_t::Context &ctx, const class Properties &args);
+
+ void purge_stale_sessions(Parser_t::Context &ctx, const class Properties &args);
void repCommand(Parser_t::Context &ctx, const class Properties &args);
};
diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp
index 15767e4766d..76f0679b069 100644
--- a/ndb/src/mgmsrv/main.cpp
+++ b/ndb/src/mgmsrv/main.cpp
@@ -83,7 +83,6 @@ struct MgmGlobals {
int g_no_nodeid_checks= 0;
static MgmGlobals glob;
-
/******************************************************************************
* Function prototypes
******************************************************************************/
@@ -217,7 +216,7 @@ int main(int argc, char** argv)
* Read configuration files *
****************************/
LocalConfig local_config;
- if(!local_config.init(0,glob.local_config_filename)){
+ if(!local_config.init(opt_connect_str,glob.local_config_filename)){
local_config.printError();
goto error_end;
}
@@ -226,7 +225,7 @@ int main(int argc, char** argv)
if (!readGlobalConfig())
goto error_end;
- glob.mgmObject = new MgmtSrvr(glob.localNodeId,
+ glob.mgmObject = new MgmtSrvr(glob.localNodeId, glob.socketServer,
BaseString(glob.config_filename),
local_config,
glob.cluster_config);
diff --git a/ndb/src/ndbapi/Makefile_old b/ndb/src/ndbapi/Makefile_old
deleted file mode 100644
index 54de9ba96f4..00000000000
--- a/ndb/src/ndbapi/Makefile_old
+++ /dev/null
@@ -1,60 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapi
-
-PIC_ARCHIVE := Y
-NONPIC_ARCHIVE := Y
-ARCHIVE_TARGET := ndbapi
-
-A_LIB := Y
-SO_LIB := Y
-PIC_LIB := Y
-LIB_TARGET := NDB_API
-
-LIB_TARGET_ARCHIVES := $(ARCHIVE_TARGET) \
- transporter \
- general \
- signaldataprint \
- mgmapi mgmsrvcommon \
- portlib \
- logger \
- trace
-
-DIRS := signal-sender
-
-CFLAGS_TransporterFacade.cpp := -I$(call fixpath,$(NDB_TOP)/src/mgmapi)
-CFLAGS_ClusterMgr.cpp := -I$(call fixpath,$(NDB_TOP)/src/mgmapi)
-
-# Source files of non-templated classes (.cpp files)
-SOURCES = \
- TransporterFacade.cpp \
- ClusterMgr.cpp \
- Ndb.cpp \
- NdbPoolImpl.cpp NdbPool.cpp \
- Ndblist.cpp \
- Ndbif.cpp \
- Ndbinit.cpp \
- ndberror.c Ndberr.cpp NdbErrorOut.cpp \
- NdbConnection.cpp \
- NdbConnectionScan.cpp \
- NdbOperation.cpp \
- NdbOperationSearch.cpp \
- NdbOperationInt.cpp \
- NdbOperationDefine.cpp \
- NdbOperationExec.cpp \
- NdbResultSet.cpp \
- NdbScanOperation.cpp NdbScanFilter.cpp \
- NdbIndexOperation.cpp \
- NdbEventOperation.cpp \
- NdbEventOperationImpl.cpp \
- NdbApiSignal.cpp \
- NdbRecAttr.cpp \
- NdbUtil.cpp \
- NdbReceiver.cpp \
- NdbDictionary.cpp NdbDictionaryImpl.cpp DictCache.cpp
- NdbBlob.cpp
-
-include $(NDB_TOP)/Epilogue.mk
-
-###
-# Backward compatible
diff --git a/ndb/src/ndbapi/NdbConnection.cpp b/ndb/src/ndbapi/NdbConnection.cpp
index 4f6468eb4ae..719c5bef49e 100644
--- a/ndb/src/ndbapi/NdbConnection.cpp
+++ b/ndb/src/ndbapi/NdbConnection.cpp
@@ -55,6 +55,7 @@ NdbConnection::NdbConnection( Ndb* aNdb ) :
theFirstExecOpInList(NULL),
theLastExecOpInList(NULL),
theCompletedFirstOp(NULL),
+ theCompletedLastOp(NULL),
theNoOfOpSent(0),
theNoOfOpCompleted(0),
theNoOfOpFetched(0),
@@ -124,6 +125,7 @@ NdbConnection::init()
theLastExecOpInList = NULL;
theCompletedFirstOp = NULL;
+ theCompletedLastOp = NULL;
theGlobalCheckpointId = 0;
theCommitStatus = Started;
@@ -256,6 +258,8 @@ NdbConnection::handleExecuteCompletion()
if (tLastExecOp != NULL) {
tLastExecOp->next(theCompletedFirstOp);
theCompletedFirstOp = tFirstExecOp;
+ if (theCompletedLastOp == NULL)
+ theCompletedLastOp = tLastExecOp;
theFirstExecOpInList = NULL;
theLastExecOpInList = NULL;
}//if
@@ -292,6 +296,8 @@ NdbConnection::execute(ExecType aTypeOfExec,
ExecType tExecType;
NdbOperation* tPrepOp;
+ NdbOperation* tCompletedFirstOp = NULL;
+ NdbOperation* tCompletedLastOp = NULL;
int ret = 0;
do {
@@ -314,6 +320,7 @@ NdbConnection::execute(ExecType aTypeOfExec,
}
tPrepOp = tPrepOp->next();
}
+
// save rest of prepared ops if batch
NdbOperation* tRestOp= 0;
NdbOperation* tLastOp= 0;
@@ -323,6 +330,7 @@ NdbConnection::execute(ExecType aTypeOfExec,
tLastOp = theLastOpInList;
theLastOpInList = tPrepOp;
}
+
if (tExecType == Commit) {
NdbOperation* tOp = theCompletedFirstOp;
while (tOp != NULL) {
@@ -338,6 +346,19 @@ NdbConnection::execute(ExecType aTypeOfExec,
}
}
+ // completed ops are in unspecified order
+ if (theCompletedFirstOp != NULL) {
+ if (tCompletedFirstOp == NULL) {
+ tCompletedFirstOp = theCompletedFirstOp;
+ tCompletedLastOp = theCompletedLastOp;
+ } else {
+ tCompletedLastOp->next(theCompletedFirstOp);
+ tCompletedLastOp = theCompletedLastOp;
+ }
+ theCompletedFirstOp = NULL;
+ theCompletedLastOp = NULL;
+ }
+
if (executeNoBlobs(tExecType, abortOption, forceSend) == -1)
ret = -1;
#ifndef VM_TRACE
@@ -362,6 +383,7 @@ NdbConnection::execute(ExecType aTypeOfExec,
tOp = tOp->next();
}
}
+
// add saved prepared ops if batch
if (tPrepOp != NULL && tRestOp != NULL) {
if (theFirstOpInList == NULL)
@@ -373,6 +395,18 @@ NdbConnection::execute(ExecType aTypeOfExec,
assert(theFirstOpInList == NULL || tExecType == NoCommit);
} while (theFirstOpInList != NULL || tExecType != aTypeOfExec);
+ if (tCompletedFirstOp != NULL) {
+ tCompletedLastOp->next(theCompletedFirstOp);
+ theCompletedFirstOp = tCompletedFirstOp;
+ if (theCompletedLastOp == NULL)
+ theCompletedLastOp = tCompletedLastOp;
+ }
+#if ndb_api_count_completed_ops_after_blob_execute
+ { NdbOperation* tOp; unsigned n = 0;
+ for (tOp = theCompletedFirstOp; tOp != NULL; tOp = tOp->next()) n++;
+ ndbout << "completed ops: " << n << endl;
+ }
+#endif
DBUG_RETURN(ret);
}
@@ -894,6 +928,7 @@ NdbConnection::releaseOperations()
releaseOps(theFirstExecOpInList);
theCompletedFirstOp = NULL;
+ theCompletedLastOp = NULL;
theFirstOpInList = NULL;
theFirstExecOpInList = NULL;
theLastOpInList = NULL;
@@ -909,6 +944,7 @@ NdbConnection::releaseCompletedOperations()
{
releaseOps(theCompletedFirstOp);
theCompletedFirstOp = NULL;
+ theCompletedLastOp = NULL;
}//NdbConnection::releaseOperations()
/******************************************************************************
diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp
index c8414ec16a3..09d15c7f962 100644
--- a/ndb/src/ndbapi/NdbDictionary.cpp
+++ b/ndb/src/ndbapi/NdbDictionary.cpp
@@ -343,6 +343,18 @@ NdbDictionary::Table::getColumn(const int attrId) const {
return m_impl.getColumn(attrId);
}
+NdbDictionary::Column*
+NdbDictionary::Table::getColumn(const char * name)
+{
+ return m_impl.getColumn(name);
+}
+
+NdbDictionary::Column*
+NdbDictionary::Table::getColumn(const int attrId)
+{
+ return m_impl.getColumn(attrId);
+}
+
void
NdbDictionary::Table::setLogging(bool val){
m_impl.m_logging = val;
@@ -956,6 +968,10 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
out << " NOT NULL";
else
out << " NULL";
+
+ if (col.getDistributionKey())
+ out << " DISTRIBUTION KEY";
+
return out;
}
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 304d1b904d4..345f2caac89 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -1571,7 +1571,13 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
NdbApiSignal tSignal(m_reference);
tSignal.theReceiversBlockNumber = DBDICT;
- if (alter) {
+
+ LinearSectionPtr ptr[3];
+ ptr[0].p = (Uint32*)m_buffer.get_data();
+ ptr[0].sz = m_buffer.length() / 4;
+ int ret;
+ if (alter)
+ {
AlterTableReq * const req =
CAST_PTR(AlterTableReq, tSignal.getDataPtrSend());
@@ -1582,8 +1588,10 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
req->tableVersion = impl.m_version;;
tSignal.theVerId_signalNumber = GSN_ALTER_TABLE_REQ;
tSignal.theLength = AlterTableReq::SignalLength;
+ ret= alterTable(&tSignal, ptr);
}
- else {
+ else
+ {
CreateTableReq * const req =
CAST_PTR(CreateTableReq, tSignal.getDataPtrSend());
@@ -1591,25 +1599,21 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
req->senderData = 0;
tSignal.theVerId_signalNumber = GSN_CREATE_TABLE_REQ;
tSignal.theLength = CreateTableReq::SignalLength;
- }
-
- LinearSectionPtr ptr[3];
- ptr[0].p = (Uint32*)m_buffer.get_data();
- ptr[0].sz = m_buffer.length() / 4;
-
- int ret = (alter) ?
- alterTable(&tSignal, ptr)
- : createTable(&tSignal, ptr);
-
- if (!alter && haveAutoIncrement) {
- if (!ndb.setAutoIncrementValue(impl.m_externalName.c_str(),
- autoIncrementValue)) {
- if (ndb.theError.code == 0) {
- m_error.code = 4336;
- ndb.theError = m_error;
- } else
- m_error= ndb.theError;
- ret = -1; // errorcode set in initialize_autoincrement
+ ret= createTable(&tSignal, ptr);
+
+ if (ret)
+ return ret;
+
+ if (haveAutoIncrement) {
+ if (!ndb.setAutoIncrementValue(impl.m_externalName.c_str(),
+ autoIncrementValue)) {
+ if (ndb.theError.code == 0) {
+ m_error.code = 4336;
+ ndb.theError = m_error;
+ } else
+ m_error= ndb.theError;
+ ret = -1; // errorcode set in initialize_autoincrement
+ }
}
}
return ret;
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
index 12f0946ab67..62d2a951f28 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
@@ -637,11 +637,9 @@ NdbDictionaryImpl::get_local_table_info(const char * internalTableName,
return 0;
}
}
- if (do_add_blob_tables &&
- info->m_table_impl->m_noOfBlobs &&
- addBlobTables(*(info->m_table_impl))) {
- return 0;
- }
+ if (do_add_blob_tables && info->m_table_impl->m_noOfBlobs)
+ addBlobTables(*(info->m_table_impl));
+
return info; // autoincrement already initialized
}
diff --git a/ndb/src/ndbapi/NdbIndexOperation.cpp b/ndb/src/ndbapi/NdbIndexOperation.cpp
index 3f174a61b64..23af646c4c7 100644
--- a/ndb/src/ndbapi/NdbIndexOperation.cpp
+++ b/ndb/src/ndbapi/NdbIndexOperation.cpp
@@ -272,7 +272,7 @@ int NdbIndexOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
CHARSET_INFO* cs = tAttrInfo->m_cs;
if (cs != 0) {
// current limitation: strxfrm does not increase length
- assert(cs->strxfrm_multiply == 1);
+ assert(cs->strxfrm_multiply <= 1);
unsigned n =
(*cs->coll->strnxfrm)(cs,
(uchar*)xfrmData, sizeof(xfrmData),
diff --git a/ndb/src/ndbapi/NdbOperationExec.cpp b/ndb/src/ndbapi/NdbOperationExec.cpp
index 13664794dcd..cccc3b6409f 100644
--- a/ndb/src/ndbapi/NdbOperationExec.cpp
+++ b/ndb/src/ndbapi/NdbOperationExec.cpp
@@ -192,7 +192,7 @@ NdbOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransId)
OperationType tOperationType = theOperationType;
Uint32 tTupKeyLen = theTupKeyLen;
Uint8 abortOption =
- m_abortOption != (Int8)-1 ? m_abortOption : theNdbCon->m_abortOption;
+ m_abortOption != -1 ? m_abortOption : theNdbCon->m_abortOption;
tcKeyReq->setDirtyFlag(tReqInfo, tDirtyIndicator);
tcKeyReq->setOperationType(tReqInfo, tOperationType);
@@ -543,7 +543,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal)
}//if
AbortOption ao = (AbortOption)
- (m_abortOption != (Int8)-1 ? m_abortOption : theNdbCon->m_abortOption);
+ (m_abortOption != -1 ? m_abortOption : theNdbCon->m_abortOption);
theReceiver.m_received_result_length = ~0;
theStatus = Finished;
diff --git a/ndb/src/ndbapi/NdbOperationSearch.cpp b/ndb/src/ndbapi/NdbOperationSearch.cpp
index 69b4e803acd..28a70abcb9b 100644
--- a/ndb/src/ndbapi/NdbOperationSearch.cpp
+++ b/ndb/src/ndbapi/NdbOperationSearch.cpp
@@ -142,7 +142,7 @@ NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
CHARSET_INFO* cs = tAttrInfo->m_cs;
if (cs != 0) {
// current limitation: strxfrm does not increase length
- assert(cs->strxfrm_multiply == 1);
+ assert(cs->strxfrm_multiply <= 1);
unsigned n =
(*cs->coll->strnxfrm)(cs,
(uchar*)xfrmData, sizeof(xfrmData),
diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp
index 86bac7deb16..4b10ebb10cd 100644
--- a/ndb/src/ndbapi/NdbScanOperation.cpp
+++ b/ndb/src/ndbapi/NdbScanOperation.cpp
@@ -850,6 +850,14 @@ NdbScanOperation::doSendScan(int aProcessorId)
tSignal = tSignal->next();
}
theStatus = WaitResponse;
+
+ m_sent_receivers_count = theParallelism;
+ if(m_ordered)
+ {
+ m_current_api_receiver = theParallelism;
+ m_api_receivers_count = theParallelism;
+ }
+
return tSignalCount;
}//NdbOperation::doSendScan()
@@ -1083,7 +1091,7 @@ NdbIndexScanOperation::setBound(const NdbColumnImpl* tAttrInfo,
Uint32 xfrmData[2000];
if (cs != NULL && aValue != NULL) {
// current limitation: strxfrm does not increase length
- assert(cs->strxfrm_multiply == 1);
+ assert(cs->strxfrm_multiply <= 1);
unsigned n =
(*cs->coll->strnxfrm)(cs,
(uchar*)xfrmData, sizeof(xfrmData),
@@ -1507,13 +1515,8 @@ NdbScanOperation::reset_receivers(Uint32 parallell, Uint32 ordered){
m_api_receivers_count = 0;
m_current_api_receiver = 0;
- m_sent_receivers_count = parallell;
+ m_sent_receivers_count = 0;
m_conf_receivers_count = 0;
-
- if(ordered){
- m_current_api_receiver = parallell;
- m_api_receivers_count = parallell;
- }
}
int
diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c
index 17a80082023..e08b80f2433 100644
--- a/ndb/src/ndbapi/ndberror.c
+++ b/ndb/src/ndbapi/ndberror.c
@@ -53,6 +53,9 @@ typedef struct ErrorBundle {
#define NI ndberror_cl_function_not_implemented
#define UE ndberror_cl_unknown_error_code
+static const char REDO_BUFFER_MSG[]=
+"REDO log buffers overloaded, consult online manual (increase RedoBuffer, and|or decrease TimeBetweenLocalCheckpoints, and|or increase NoOfFragmentLogFiles)";
+
static const char* empty_string = "";
static
@@ -124,7 +127,8 @@ ErrorBundle ErrorCodes[] = {
{ 217, TR, "217" },
{ 218, TR, "218" },
{ 219, TR, "219" },
- { 233, TR, "Out of operation records in transaction coordinator" },
+ { 233, TR,
+ "Out of operation records in transaction coordinator (increase MaxNoOfConcurrentOperations)" },
{ 275, TR, "275" },
{ 279, TR, "Out of transaction markers in transaction coordinator" },
{ 414, TR, "414" },
@@ -136,9 +140,8 @@ ErrorBundle ErrorCodes[] = {
{ 805, TR, "Out of attrinfo records in tuple manager" },
{ 830, TR, "Out of add fragment operation records" },
{ 873, TR, "Out of attrinfo records for scan in tuple manager" },
- { 1217, TR, "1217" },
- { 1219, TR, "Out of operation records in local data manager" },
- { 1220, TR, "1220" },
+ { 1217, TR, "Out of operation records in local data manager (increase MaxNoOfLocalOperations)" },
+ { 1220, TR, REDO_BUFFER_MSG },
{ 1222, TR, "Out of transaction markers in LQH" },
{ 4021, TR, "Out of Send Buffer space in NDB API" },
{ 4022, TR, "Out of Send Buffer space in NDB API" },
@@ -149,9 +152,10 @@ ErrorBundle ErrorCodes[] = {
*/
{ 623, IS, "623" },
{ 624, IS, "624" },
- { 625, IS, "Out of memory in Ndb Kernel, index part" },
- { 826, IS, "Too many tables and attributes (increase MaxNoOfAttributes)" },
- { 827, IS, "Out of memory in Ndb Kernel, data part" },
+ { 625, IS, "Out of memory in Ndb Kernel, index part (increase IndexMemory)" },
+ { 800, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" },
+ { 826, IS, "Too many tables and attributes (increase MaxNoOfAttributes or MaxNoOfTables)" },
+ { 827, IS, "Out of memory in Ndb Kernel, data part (increase DataMemory)" },
{ 832, IS, "832" },
/**
@@ -163,15 +167,14 @@ ErrorBundle ErrorCodes[] = {
{ 297, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout, temporary!! */
{ 237, TO, "Transaction had timed out when trying to commit it" },
-
/**
* OverloadError
*/
- { 410, OL, "Out of log file space temporarily" },
- { 677, OL, "Index UNDO buffers overloaded" },
- { 891, OL, "Data UNDO buffers overloaded" },
- { 1221, OL, "REDO log buffers overloaded" },
- { 4006, OL, "Connect failure - out of connection objects" },
+ { 410, OL, REDO_BUFFER_MSG },
+ { 677, OL, "Index UNDO buffers overloaded (increase UndoIndexBuffer)" },
+ { 891, OL, "Data UNDO buffers overloaded (increase UndoDataBuffer)" },
+ { 1221, OL, REDO_BUFFER_MSG },
+ { 4006, OL, "Connect failure - out of connection objects (increase MaxNoOfConcurrentTransactions)" },
@@ -241,9 +244,9 @@ ErrorBundle ErrorCodes[] = {
{ 884, AE, "Stack overflow in interpreter" },
{ 885, AE, "Stack underflow in interpreter" },
{ 886, AE, "More than 65535 instructions executed in interpreter" },
- { 4256, AE, "Must call Ndb::init() before this function" },
+ { 4256, AE, "Must call Ndb::init() before this function" },
{ 880, AE, "Tried to read too much - too many getValue calls" },
- { 4257, AE, "Tried to read too much - too many getValue calls" },
+ { 4257, AE, "Tried to read too much - too many getValue calls" },
/**
* Scan application errors
@@ -288,7 +291,7 @@ ErrorBundle ErrorCodes[] = {
{ 283, SE, "Table is being dropped" },
{ 284, SE, "Table not defined in transaction coordinator" },
{ 285, SE, "Unknown table error in transaction coordinator" },
- { 881, SE, "Unable to create table, out of data pages" },
+ { 881, SE, "Unable to create table, out of data pages (increase DataMemory) " },
{ 1225, SE, "Table not defined in local query handler" },
{ 1226, SE, "Table is being dropped" },
{ 1228, SE, "Cannot use drop table for drop index" },
@@ -344,17 +347,11 @@ ErrorBundle ErrorCodes[] = {
{ 4327, AE, "Distribution Group with 1 byte attribute is not allowed" },
{ 4328, AE, "Disk memory attributes not yet supported" },
{ 4329, AE, "Variable stored attributes not yet supported" },
- { 4330, AE, "Table names limited to 127 bytes" },
- { 4331, AE, "Attribute names limited to 31 bytes" },
- { 4332, AE, "Maximum 2000 attributes in a table" },
- { 4333, AE, "Maximum 4092 bytes long keys allowed" },
- { 4334, AE, "Attribute properties length limited to 127 bytes" },
{ 4400, AE, "Status Error in NdbSchemaCon" },
{ 4401, AE, "Only one schema operation per schema transaction" },
{ 4402, AE, "No schema operation defined before calling execute" },
- { 4500, AE, "Cannot handle more than 2048 tables in NdbApi" },
{ 4501, AE, "Insert in hash table failed when getting table information from Ndb" },
{ 4502, AE, "GetValue not allowed in Update operation" },
{ 4503, AE, "GetValue not allowed in Insert operation" },
diff --git a/ndb/src/mgmclient/CpcClient.hpp b/ndb/test/include/CpcClient.hpp
index 1655bc57b56..1655bc57b56 100644
--- a/ndb/src/mgmclient/CpcClient.hpp
+++ b/ndb/test/include/CpcClient.hpp
diff --git a/ndb/test/include/NDBT_Test.hpp b/ndb/test/include/NDBT_Test.hpp
index b0b5fe15960..8b69faebde8 100644
--- a/ndb/test/include/NDBT_Test.hpp
+++ b/ndb/test/include/NDBT_Test.hpp
@@ -392,10 +392,10 @@ C##suitname():NDBT_TestSuite(#suitname){ \
// Add a number of equal steps to the testcase
#define STEPS(stepfunc, num) \
- for (int i = 0; i < num; i++){ \
+ { int i; for (i = 0; i < num; i++){ \
pts = new NDBT_ParallelStep(pt, #stepfunc, stepfunc); \
pt->addStep(pts);\
- }
+ } }
#define VERIFIER(stepfunc) \
ptv = new NDBT_Verifier(pt, #stepfunc, stepfunc); \
diff --git a/ndb/test/ndbapi/Makefile_old b/ndb/test/ndbapi/Makefile_old
deleted file mode 100644
index c3198096ec0..00000000000
--- a/ndb/test/ndbapi/Makefile_old
+++ /dev/null
@@ -1,49 +0,0 @@
-include .defs.mk
-
-
-ifeq ($(NDB_OS), OSE)
-DIRS = basic flexBench flexAsynch
-else
-DIRS = lmc-bench ronja
-BIN_DIRS = \
- flexAsynch \
- flexBench \
- flexHammer \
- flexTT \
- create_tab \
- create_all_tabs \
- drop_all_tabs \
- bulk_copy \
- restarter2 restarter \
- restarts testScan testNdbApi \
- testScanInterpreter testIndex \
- testInterpreter \
- testOIBasic \
- testBackup \
- testBasic \
- basicAsynch \
- testNodeRestart \
- testOperations testTransactions \
- testSystemRestart \
- testTimeout \
- testMgm \
- testRestartGci \
- testDataBuffers \
- testDict \
- acid \
- telco \
- indexTest \
- test_event \
- indexTest2 \
- testGrep \
- testBlobs
-
-ifeq ($(NDB_OS), SOLARIS)
-ifeq ($(NDB_COMPILER), FORTE6)
- DIRS += flexTimedAsynch
-endif
-endif
-endif
-
-include ${NDB_TOP}/Epilogue.mk
-
diff --git a/ndb/test/ndbapi/ScanFunctions.hpp b/ndb/test/ndbapi/ScanFunctions.hpp
index 2ff4b751c33..6964f8c73a8 100644
--- a/ndb/test/ndbapi/ScanFunctions.hpp
+++ b/ndb/test/ndbapi/ScanFunctions.hpp
@@ -286,36 +286,36 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){
attr = new Attrib;
attr->numAttribs = 0;
attriblist.push_back(attr);
-
- for(int i = 1; i < pTab->getNoOfColumns(); i++){
+ int i;
+ for(i = 1; i < pTab->getNoOfColumns(); i++){
attr = new Attrib;
attr->numAttribs = i;
for(int a = 0; a<i; a++)
attr->attribs[a] = a;
attriblist.push_back(attr);
}
- for(int i = pTab->getNoOfColumns()-1; i > 0; i--){
+ for(i = pTab->getNoOfColumns()-1; i > 0; i--){
attr = new Attrib;
attr->numAttribs = i;
for(int a = 0; a<i; a++)
attr->attribs[a] = a;
attriblist.push_back(attr);
}
- for(int i = pTab->getNoOfColumns(); i > 0; i--){
+ for(i = pTab->getNoOfColumns(); i > 0; i--){
attr = new Attrib;
attr->numAttribs = pTab->getNoOfColumns() - i;
for(int a = 0; a<pTab->getNoOfColumns() - i; a++)
attr->attribs[a] = pTab->getNoOfColumns()-a-1;
attriblist.push_back(attr);
}
- for(int i = 1; i < pTab->getNoOfColumns(); i++){
+ for(i = 1; i < pTab->getNoOfColumns(); i++){
attr = new Attrib;
attr->numAttribs = pTab->getNoOfColumns() - i;
for(int a = 0; a<pTab->getNoOfColumns() - i; a++)
attr->attribs[a] = pTab->getNoOfColumns()-a-1;
attriblist.push_back(attr);
}
- for(int i = 1; i < pTab->getNoOfColumns(); i++){
+ for(i = 1; i < pTab->getNoOfColumns(); i++){
attr = new Attrib;
attr->numAttribs = 2;
for(int a = 0; a<2; a++){
@@ -345,11 +345,11 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){
attriblist.push_back(attr);
#if 1
- for(size_t i = 0; i < attriblist.size(); i++){
+ for(size_t j = 0; j < attriblist.size(); j++){
- g_info << attriblist[i]->numAttribs << ": " ;
- for(int a = 0; a < attriblist[i]->numAttribs; a++)
- g_info << attriblist[i]->attribs[a] << ", ";
+ g_info << attriblist[j]->numAttribs << ": " ;
+ for(int a = 0; a < attriblist[j]->numAttribs; a++)
+ g_info << attriblist[j]->attribs[a] << ", ";
g_info << endl;
}
#endif
diff --git a/ndb/test/ndbapi/bank/Makefile_old b/ndb/test/ndbapi/bank/Makefile_old
deleted file mode 100644
index f710f9e6612..00000000000
--- a/ndb/test/ndbapi/bank/Makefile_old
+++ /dev/null
@@ -1,12 +0,0 @@
-include .defs.mk
-
-DIRS = src bankCreator \
- bankSumAccounts \
- bankTransactionMaker \
- bankValidateAllGLs \
- bankMakeGL \
- bankTimer \
- testBank
-
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/ndb/test/ndbapi/old_dirs/flexBench/Makefile_old b/ndb/test/ndbapi/old_dirs/flexBench/Makefile_old
deleted file mode 100644
index bfff5cd161a..00000000000
--- a/ndb/test/ndbapi/old_dirs/flexBench/Makefile_old
+++ /dev/null
@@ -1,11 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapitest
-
-BIN_TARGET := flexBench
-
-# Source files of non-templated classes (.C files)
-SOURCES = flexBench.cpp
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/test/ndbapi/testBlobs.cpp b/ndb/test/ndbapi/testBlobs.cpp
index efa0811aa39..4b532856709 100644
--- a/ndb/test/ndbapi/testBlobs.cpp
+++ b/ndb/test/ndbapi/testBlobs.cpp
@@ -22,6 +22,7 @@
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <NdbTest.hpp>
+#include <NdbTick.h>
struct Bcol {
bool m_nullable;
@@ -59,6 +60,9 @@ struct Opt {
bool m_oneblob;
Bcol m_blob1;
Bcol m_blob2;
+ // perf
+ const char* m_tnameperf;
+ unsigned m_rowsperf;
// bugs
int m_bug;
int (*m_bugtest)();
@@ -84,6 +88,9 @@ struct Opt {
m_oneblob(false),
m_blob1(false, 7, 1137, 10),
m_blob2(true, 99, 55, 1),
+ // perf
+ m_tnameperf("TBLOB2"),
+ m_rowsperf(10000),
// bugs
m_bug(0),
m_bugtest(0) {
@@ -107,6 +114,7 @@ printusage()
<< " -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
+ << " -rowsperf N rows for performace test [" << d.m_rowsperf << "]" << endl
<< " -seed N random seed 0=loop number [" << d.m_seed << "]" << endl
<< " -skip xxx skip given tests (see list) [no tests]" << endl
<< " -test xxx only given tests (see list) [all tests]" << endl
@@ -118,6 +126,7 @@ printusage()
<< " i hash index ops" << endl
<< " s table scans" << endl
<< " r ordered index scans" << endl
+ << " p performance test" << endl
<< "additional flags for test/skip" << endl
<< " u update existing blob value" << endl
<< " n normal insert and update" << endl
@@ -1381,6 +1390,292 @@ testmain()
return 0;
}
+// separate performance test
+
+struct Tmr { // stolen from testOIBasic
+ Tmr() {
+ clr();
+ }
+ void clr() {
+ m_on = m_ms = m_cnt = m_time[0] = m_text[0] = 0;
+ }
+ void on() {
+ assert(m_on == 0);
+ m_on = NdbTick_CurrentMillisecond();
+ }
+ void off(unsigned cnt = 0) {
+ NDB_TICKS off = NdbTick_CurrentMillisecond();
+ assert(m_on != 0 && off >= m_on);
+ m_ms += off - m_on;
+ m_cnt += cnt;
+ m_on = 0;
+ }
+ const char* time() {
+ if (m_cnt == 0)
+ sprintf(m_time, "%u ms", m_ms);
+ else
+ sprintf(m_time, "%u ms per %u ( %u ms per 1000 )", m_ms, m_cnt, (1000 * m_ms) / m_cnt);
+ return m_time;
+ }
+ const char* pct (const Tmr& t1) {
+ if (0 < t1.m_ms)
+ sprintf(m_text, "%u pct", (100 * m_ms) / t1.m_ms);
+ else
+ sprintf(m_text, "[cannot measure]");
+ return m_text;
+ }
+ const char* over(const Tmr& t1) {
+ if (0 < t1.m_ms) {
+ if (t1.m_ms <= m_ms)
+ sprintf(m_text, "%u pct", (100 * (m_ms - t1.m_ms)) / t1.m_ms);
+ else
+ sprintf(m_text, "-%u pct", (100 * (t1.m_ms - m_ms)) / t1.m_ms);
+ } else
+ sprintf(m_text, "[cannot measure]");
+ return m_text;
+ }
+ NDB_TICKS m_on;
+ unsigned m_ms;
+ unsigned m_cnt;
+ char m_time[100];
+ char m_text[100];
+};
+
+static int
+testperf()
+{
+ if (! testcase('p'))
+ return 0;
+ DBG("=== perf test ===");
+ g_ndb = new Ndb("TEST_DB");
+ CHK(g_ndb->init() == 0);
+ CHK(g_ndb->waitUntilReady() == 0);
+ g_dic = g_ndb->getDictionary();
+ NdbDictionary::Table tab(g_opt.m_tnameperf);
+ if (g_dic->getTable(tab.getName()) != 0)
+ CHK(g_dic->dropTable(tab) == 0);
+ // col A - pk
+ { NdbDictionary::Column col("A");
+ col.setType(NdbDictionary::Column::Unsigned);
+ col.setPrimaryKey(true);
+ tab.addColumn(col);
+ }
+ // col B - char 20
+ { NdbDictionary::Column col("B");
+ col.setType(NdbDictionary::Column::Char);
+ col.setLength(20);
+ col.setNullable(true);
+ tab.addColumn(col);
+ }
+ // col C - text
+ { NdbDictionary::Column col("C");
+ col.setType(NdbDictionary::Column::Text);
+ col.setInlineSize(20);
+ col.setPartSize(512);
+ col.setStripeSize(1);
+ col.setNullable(true);
+ tab.addColumn(col);
+ }
+ // create
+ CHK(g_dic->createTable(tab) == 0);
+ Uint32 cA = 0, cB = 1, cC = 2;
+ // timers
+ Tmr t1;
+ Tmr t2;
+ // insert char (one trans)
+ {
+ DBG("--- insert char ---");
+ t1.on();
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ for (Uint32 k = 0; k < g_opt.m_rowsperf; k++) {
+ CHK((g_opr = g_con->getNdbOperation(tab.getName())) != 0);
+ CHK(g_opr->insertTuple() == 0);
+ CHK(g_opr->equal(cA, (char*)&k) == 0);
+ CHK(g_opr->setValue(cB, "b") == 0);
+ CHK(g_con->execute(NoCommit) == 0);
+ }
+ t1.off(g_opt.m_rowsperf);
+ CHK(g_con->execute(Rollback) == 0);
+ DBG(t1.time());
+ g_opr = 0;
+ g_con = 0;
+ }
+ // insert text (one trans)
+ {
+ DBG("--- insert text ---");
+ t2.on();
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ for (Uint32 k = 0; k < g_opt.m_rowsperf; k++) {
+ CHK((g_opr = g_con->getNdbOperation(tab.getName())) != 0);
+ CHK(g_opr->insertTuple() == 0);
+ CHK(g_opr->equal(cA, (char*)&k) == 0);
+ CHK((g_bh1 = g_opr->getBlobHandle(cC)) != 0);
+ CHK((g_bh1->setValue("c", 1) == 0));
+ CHK(g_con->execute(NoCommit) == 0);
+ }
+ t2.off(g_opt.m_rowsperf);
+ CHK(g_con->execute(Rollback) == 0);
+ DBG(t2.time());
+ g_bh1 = 0;
+ g_opr = 0;
+ g_con = 0;
+ }
+ // insert overhead
+ DBG("insert overhead: " << t2.over(t1));
+ t1.clr();
+ t2.clr();
+ // insert
+ {
+ DBG("--- insert for read test ---");
+ unsigned n = 0;
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ for (Uint32 k = 0; k < g_opt.m_rowsperf; k++) {
+ CHK((g_opr = g_con->getNdbOperation(tab.getName())) != 0);
+ CHK(g_opr->insertTuple() == 0);
+ CHK(g_opr->equal(cA, (char*)&k) == 0);
+ CHK(g_opr->setValue(cB, "b") == 0);
+ CHK((g_bh1 = g_opr->getBlobHandle(cC)) != 0);
+ CHK((g_bh1->setValue("c", 1) == 0));
+ if (++n == g_opt.m_batch) {
+ CHK(g_con->execute(Commit) == 0);
+ g_ndb->closeTransaction(g_con);
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ n = 0;
+ }
+ }
+ if (n != 0) {
+ CHK(g_con->execute(Commit) == 0);
+ n = 0;
+ }
+ g_bh1 = 0;
+ g_opr = 0;
+ g_con = 0;
+ }
+ // pk read char (one trans)
+ {
+ DBG("--- pk read char ---");
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ Uint32 a;
+ char b[20];
+ t1.on();
+ for (Uint32 k = 0; k < g_opt.m_rowsperf; k++) {
+ CHK((g_opr = g_con->getNdbOperation(tab.getName())) != 0);
+ CHK(g_opr->readTuple() == 0);
+ CHK(g_opr->equal(cA, (char*)&k) == 0);
+ CHK(g_opr->getValue(cA, (char*)&a) != 0);
+ CHK(g_opr->getValue(cB, b) != 0);
+ a = (Uint32)-1;
+ b[0] = 0;
+ CHK(g_con->execute(NoCommit) == 0);
+ CHK(a == k && strcmp(b, "b") == 0);
+ }
+ CHK(g_con->execute(Commit) == 0);
+ t1.off(g_opt.m_rowsperf);
+ DBG(t1.time());
+ g_opr = 0;
+ g_con = 0;
+ }
+ // pk read text (one trans)
+ {
+ DBG("--- pk read text ---");
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ Uint32 a;
+ char c[20];
+ t2.on();
+ for (Uint32 k = 0; k < g_opt.m_rowsperf; k++) {
+ CHK((g_opr = g_con->getNdbOperation(tab.getName())) != 0);
+ CHK(g_opr->readTuple() == 0);
+ CHK(g_opr->equal(cA, (char*)&k) == 0);
+ CHK(g_opr->getValue(cA, (char*)&a) != 0);
+ CHK((g_bh1 = g_opr->getBlobHandle(cC)) != 0);
+ a = (Uint32)-1;
+ c[0] = 0;
+ CHK(g_con->execute(NoCommit) == 0);
+ Uint32 m = 20;
+ CHK(g_bh1->readData(c, m) == 0);
+ CHK(a == k && m == 1 && strcmp(c, "c") == 0);
+ }
+ CHK(g_con->execute(Commit) == 0);
+ t2.off(g_opt.m_rowsperf);
+ DBG(t2.time());
+ g_opr = 0;
+ g_con = 0;
+ }
+ // pk read overhead
+ DBG("pk read overhead: " << t2.over(t1));
+ t1.clr();
+ t2.clr();
+ // scan read char
+ {
+ DBG("--- scan read char ---");
+ NdbResultSet* rs;
+ Uint32 a;
+ char b[20];
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ CHK((g_ops = g_con->getNdbScanOperation(tab.getName())) != 0);
+ CHK((rs = g_ops->readTuples(NdbScanOperation::LM_Read)) != 0);
+ CHK(g_ops->getValue(cA, (char*)&a) != 0);
+ CHK(g_ops->getValue(cB, b) != 0);
+ CHK(g_con->execute(NoCommit) == 0);
+ unsigned n = 0;
+ t1.on();
+ while (1) {
+ a = (Uint32)-1;
+ b[0] = 0;
+ int ret;
+ CHK((ret = rs->nextResult(true)) == 0 || ret == 1);
+ if (ret == 1)
+ break;
+ CHK(a < g_opt.m_rowsperf && strcmp(b, "b") == 0);
+ n++;
+ }
+ CHK(n == g_opt.m_rowsperf);
+ t1.off(g_opt.m_rowsperf);
+ DBG(t1.time());
+ g_ops = 0;
+ g_con = 0;
+ }
+ // scan read text
+ {
+ DBG("--- read text ---");
+ NdbResultSet* rs;
+ Uint32 a;
+ char c[20];
+ CHK((g_con = g_ndb->startTransaction()) != 0);
+ CHK((g_ops = g_con->getNdbScanOperation(tab.getName())) != 0);
+ CHK((rs = g_ops->readTuples(NdbScanOperation::LM_Read)) != 0);
+ CHK(g_ops->getValue(cA, (char*)&a) != 0);
+ CHK((g_bh1 = g_ops->getBlobHandle(cC)) != 0);
+ CHK(g_con->execute(NoCommit) == 0);
+ unsigned n = 0;
+ t2.on();
+ while (1) {
+ a = (Uint32)-1;
+ c[0] = 0;
+ int ret;
+ CHK((ret = rs->nextResult(true)) == 0 || ret == 1);
+ if (ret == 1)
+ break;
+ Uint32 m = 20;
+ CHK(g_bh1->readData(c, m) == 0);
+ CHK(a < g_opt.m_rowsperf && m == 1 && strcmp(c, "c") == 0);
+ n++;
+ }
+ CHK(n == g_opt.m_rowsperf);
+ t2.off(g_opt.m_rowsperf);
+ DBG(t2.time());
+ g_bh1 = 0;
+ g_ops = 0;
+ g_con = 0;
+ }
+ // scan read overhead
+ DBG("scan read overhead: " << t2.over(t1));
+ t1.clr();
+ t2.clr();
+ delete g_ndb;
+ return 0;
+}
+
// bug tests
static int
@@ -1498,6 +1793,12 @@ NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
continue;
}
}
+ if (strcmp(arg, "-rowsperf") == 0) {
+ if (++argv, --argc > 0) {
+ g_opt.m_rowsperf = atoi(argv[0]);
+ continue;
+ }
+ }
if (strcmp(arg, "-seed") == 0) {
if (++argv, --argc > 0) {
g_opt.m_seed = atoi(argv[0]);
@@ -1558,7 +1859,7 @@ NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
strcat(b, "r");
g_opt.m_skip = strdup(b);
}
- if (testmain() == -1) {
+ if (testmain() == -1 || testperf() == -1) {
ndbout << "line " << __LINE__ << " FAIL loop=" << g_loop << endl;
return NDBT_ProgramExit(NDBT_FAILED);
}
diff --git a/ndb/test/ndbapi/testDataBuffers.cpp b/ndb/test/ndbapi/testDataBuffers.cpp
index 04602f51d5f..03d52252334 100644
--- a/ndb/test/ndbapi/testDataBuffers.cpp
+++ b/ndb/test/ndbapi/testDataBuffers.cpp
@@ -123,15 +123,15 @@ chkerror(char const* fmt, ...)
// alignment of addresses and data sizes
-static bool isAligned(unsigned x)
+static bool isAligned(UintPtr x)
{
return ((x & 3) == 0);
}
static bool isAligned(char* p)
{
- return isAligned(unsigned(p));
+ return isAligned(UintPtr(p));
}
-static unsigned toAligned(unsigned x)
+static unsigned toAligned(UintPtr x)
{
while (! isAligned(x))
x++;
@@ -223,10 +223,10 @@ testcase(int flag)
noRandom = ! (flag & 8);
ndbout << (noRandom ? "simple sizes" : "randomize sizes") << endl;
- int smax = 0, stot = 0;
+ int smax = 0, stot = 0, i;
if (xverbose)
ndbout << "- define table " << tab << endl;
- for (int i = 0; i < attrcnt; i++) {
+ for (i = 0; i < attrcnt; i++) {
col& c = ccol[i];
memset(&c, 0, sizeof(c));
sprintf(c.aAttrName, "C%d", i);
@@ -266,7 +266,7 @@ testcase(int flag)
return ndberror("getNdbSchemaOp");
if (top->createTable(tab) < 0)
return ndberror("createTable");
- for (int i = 0; i < attrcnt; i++) {
+ for (i = 0; i < attrcnt; i++) {
col& c = ccol[i];
if (top->createAttribute(
c.aAttrName,
@@ -299,7 +299,7 @@ testcase(int flag)
return ndberror("getNdbOperation key=%d", key);
if (op->deleteTuple() < 0)
return ndberror("deleteTuple key=%d", key);
- for (int i = 0; i < attrcnt; i++) {
+ for (i = 0; i < attrcnt; i++) {
col& c = ccol[i];
if (i == 0) {
if (op->equal(c.aAttrName, (char*)&key, sizeof(key)) < 0)
@@ -329,7 +329,7 @@ testcase(int flag)
return ndberror("getNdbOperation key=%d", key);
if (op->insertTuple() < 0)
return ndberror("insertTuple key=%d", key);
- for (int i = 0; i < attrcnt; i++) {
+ for (i = 0; i < attrcnt; i++) {
col& c = ccol[i];
if (i == 0) {
if (op->equal(c.aAttrName, (char*)&key, sizeof(key)) < 0)
@@ -362,7 +362,7 @@ testcase(int flag)
return ndberror("getNdbOperation key=%d", key);
if (op->readTuple() < 0)
return ndberror("readTuple key=%d", key);
- for (int i = 0; i < attrcnt; i++) {
+ for (i = 0; i < attrcnt; i++) {
col& c = ccol[i];
if (i == 0) {
if (op->equal(c.aAttrName, (char*)&key, sizeof(key)) < 0)
@@ -371,7 +371,7 @@ testcase(int flag)
if (xverbose) {
char tmp[20];
if (useBuf)
- sprintf(tmp, "0x%x", int(c.buf + off));
+ sprintf(tmp, "0x%p", c.buf + off);
else
strcpy(tmp, "ndbapi");
ndbout << "--- column " << i << " addr=" << tmp << endl;
@@ -388,23 +388,24 @@ testcase(int flag)
}
if (con->execute(Commit) != 0)
return ndberror("execute key=%d", key);
- for (int i = 0; i < attrcnt; i++) {
+ for (i = 0; i < attrcnt; i++) {
col& c = ccol[i];
if (i == 0) {
} else if (useBuf) {
- for (int j = 0; j < off; j++) {
+ int j;
+ for (j = 0; j < off; j++) {
if (c.buf[j] != 'B') {
return chkerror("mismatch before key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, 'B', c.buf[j]);
}
}
- for (int j = 0; j < c.aArraySize; j++) {
+ for (j = 0; j < c.aArraySize; j++) {
if (c.buf[j + off] != byteVal(key, i, j)) {
return chkerror("mismatch key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, byteVal(key, i, j), c.buf[j]);
}
}
- for (int j = c.aArraySize + off; j < c.bufsiz; j++) {
+ for (j = c.aArraySize + off; j < c.bufsiz; j++) {
if (c.buf[j] != 'B') {
return chkerror("mismatch after key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, 'B', c.buf[j]);
@@ -431,7 +432,8 @@ testcase(int flag)
if (xverbose)
ndbout << "- scan" << endl;
char found[MaxOper];
- for (int k = 0; k < opercnt; k++)
+ int k;
+ for (k = 0; k < opercnt; k++)
found[k] = 0;
for (key = 0; key < opercnt; key++) {
int off = makeOff(key);
@@ -459,7 +461,7 @@ testcase(int flag)
if (op->interpret_exit_ok() < 0)
return ndberror("interpret_exit_ok");
}
- for (int i = 0; i < attrcnt; i++) {
+ for (i = 0; i < attrcnt; i++) {
col& c = ccol[i];
if (i == 0) {
if (op->getValue(c.aAttrName, (char*)&newkey) < 0)
@@ -468,7 +470,7 @@ testcase(int flag)
if (xverbose) {
char tmp[20];
if (useBuf)
- sprintf(tmp, "0x%x", int(c.buf + off));
+ sprintf(tmp, "0x%p", c.buf + off);
else
strcpy(tmp, "ndbapi");
ndbout << "--- column " << i << " addr=" << tmp << endl;
@@ -489,22 +491,23 @@ testcase(int flag)
while ((ret = rs->nextResult()) == 0) {
if (key != newkey)
return ndberror("unexpected key=%d newkey=%d", key, newkey);
- for (int i = 1; i < attrcnt; i++) {
+ for (i = 1; i < attrcnt; i++) {
col& c = ccol[i];
if (useBuf) {
- for (int j = 0; j < off; j++) {
+ int j;
+ for (j = 0; j < off; j++) {
if (c.buf[j] != 'C') {
return chkerror("mismatch before key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, 'C', c.buf[j]);
}
}
- for (int j = 0; j < c.aArraySize; j++) {
+ for (j = 0; j < c.aArraySize; j++) {
if (c.buf[j + off] != byteVal(key, i, j)) {
return chkerror("mismatch key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, byteVal(key, i, j), c.buf[j]);
}
}
- for (int j = c.aArraySize + off; j < c.bufsiz; j++) {
+ for (j = c.aArraySize + off; j < c.bufsiz; j++) {
if (c.buf[j] != 'C') {
return chkerror("mismatch after key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, 'C', c.buf[j]);
@@ -533,7 +536,7 @@ testcase(int flag)
}
con = 0;
op = 0;
- for (int k = 0; k < opercnt; k++)
+ for (k = 0; k < opercnt; k++)
if (! found[k])
return ndberror("key %d not found", k);
ndbout << "scanned " << key << endl;
@@ -545,6 +548,7 @@ testcase(int flag)
NDB_COMMAND(testDataBuffers, "testDataBuffers", "testDataBuffers", "testDataBuffers", 65535)
{
+ int i;
ndb_init();
while (++argv, --argc > 0) {
char const* p = argv[0];
@@ -602,7 +606,7 @@ NDB_COMMAND(testDataBuffers, "testDataBuffers", "testDataBuffers", "testDataBuff
}
}
unsigned ok = true;
- for (int i = 1; 0 == loopcnt || i <= loopcnt; i++) {
+ for (i = 1; 0 == loopcnt || i <= loopcnt; i++) {
ndbout << "=== loop " << i << " ===" << endl;
for (int flag = 0; flag < (1<<testbits); flag++) {
if (testcase(flag) < 0) {
diff --git a/ndb/test/ndbapi/testDeadlock.cpp b/ndb/test/ndbapi/testDeadlock.cpp
index 66fa48173cc..eb985e815ac 100644
--- a/ndb/test/ndbapi/testDeadlock.cpp
+++ b/ndb/test/ndbapi/testDeadlock.cpp
@@ -459,7 +459,8 @@ wl1822_main(char scantx)
static const unsigned thrcount = 2;
// create threads for tx1 and tx2
Thr* thrlist[2];
- for (int n = 0; n < thrcount; n++) {
+ int n;
+ for (n = 0; n < thrcount; n++) {
Thr& thr = *(thrlist[n] = new Thr(1 + n));
CHK(thr.m_ret == 0);
}
@@ -472,7 +473,7 @@ wl1822_main(char scantx)
if (runstep != 0)
thr.start(runstep);
}
- for (int n = 0; n < thrcount; n++) {
+ for (n = 0; n < thrcount; n++) {
Thr& thr = *thrlist[n];
Runstep runstep = wl1822_step[i][n];
if (runstep != 0)
@@ -480,7 +481,7 @@ wl1822_main(char scantx)
}
}
// delete threads
- for (int n = 0; n < thrcount; n++) {
+ for (n = 0; n < thrcount; n++) {
Thr& thr = *thrlist[n];
thr.exit();
thr.join();
diff --git a/ndb/test/ndbapi/testDict.cpp b/ndb/test/ndbapi/testDict.cpp
index 89232de2535..0a43bb02fff 100644
--- a/ndb/test/ndbapi/testDict.cpp
+++ b/ndb/test/ndbapi/testDict.cpp
@@ -1431,11 +1431,12 @@ int
runTestDictionaryPerf(NDBT_Context* ctx, NDBT_Step* step){
Vector<char*> cols;
Vector<const NdbDictionary::Table*> tabs;
+ int i;
Ndb* pNdb = GETNDB(step);
const Uint32 count = NDBT_Tables::getNumTables();
- for (int i=0; i < count; i++){
+ for (i=0; i < count; i++){
const NdbDictionary::Table * tab = NDBT_Tables::getTable(i);
pNdb->getDictionary()->createTable(* tab);
@@ -1458,7 +1459,7 @@ runTestDictionaryPerf(NDBT_Context* ctx, NDBT_Step* step){
Uint32 size = cols.size() / 2;
char ** columns = &cols[0];
Uint64 start = NdbTick_CurrentMillisecond();
- for(int i = 0; i<times; i++){
+ for(i = 0; i<times; i++){
int j = 2 * (rand() % size);
const NdbDictionary::Table* tab = (const NdbDictionary::Table*)tcols[j];
const char * col = tcols[j+1];
@@ -1478,6 +1479,84 @@ runTestDictionaryPerf(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
+int runFailAddFragment(NDBT_Context* ctx, NDBT_Step* step){
+ static int acclst[] = { 3001 };
+ static int tuplst[] = { 4007, 4008, 4009, 4010, 4011, 4012 };
+ static int tuxlst[] = { 12001, 12002, 12003, 12004, 12005, 12006 };
+ static unsigned acccnt = sizeof(acclst)/sizeof(acclst[0]);
+ static unsigned tupcnt = sizeof(tuplst)/sizeof(tuplst[0]);
+ static unsigned tuxcnt = sizeof(tuxlst)/sizeof(tuxlst[0]);
+
+ NdbRestarter restarter;
+ int nodeId = restarter.getMasterNodeId();
+ Ndb* pNdb = GETNDB(step);
+ NdbDictionary::Dictionary* pDic = pNdb->getDictionary();
+ NdbDictionary::Table tab(*ctx->getTab());
+ tab.setFragmentType(NdbDictionary::Object::FragAllLarge);
+
+ // ordered index on first few columns
+ NdbDictionary::Index idx("X");
+ idx.setTable(tab.getName());
+ idx.setType(NdbDictionary::Index::OrderedIndex);
+ idx.setLogging(false);
+ for (int i_hate_broken_compilers = 0;
+ i_hate_broken_compilers < 3 &&
+ i_hate_broken_compilers < tab.getNoOfColumns();
+ i_hate_broken_compilers++) {
+ idx.addColumn(*tab.getColumn(i_hate_broken_compilers));
+ }
+
+ const int loops = ctx->getNumLoops();
+ int result = NDBT_OK;
+ (void)pDic->dropTable(tab.getName());
+
+ for (int l = 0; l < loops; l++) {
+ for (unsigned i0 = 0; i0 < acccnt; i0++) {
+ unsigned j = (l == 0 ? i0 : myRandom48(acccnt));
+ int errval = acclst[j];
+ g_info << "insert error node=" << nodeId << " value=" << errval << endl;
+ CHECK2(restarter.insertErrorInNode(nodeId, errval) == 0,
+ "failed to set error insert");
+ CHECK2(pDic->createTable(tab) != 0,
+ "failed to fail after error insert " << errval);
+ CHECK2(pDic->createTable(tab) == 0,
+ pDic->getNdbError());
+ CHECK2(pDic->dropTable(tab.getName()) == 0,
+ pDic->getNdbError());
+ }
+ for (unsigned i1 = 0; i1 < tupcnt; i1++) {
+ unsigned j = (l == 0 ? i1 : myRandom48(tupcnt));
+ int errval = tuplst[j];
+ g_info << "insert error node=" << nodeId << " value=" << errval << endl;
+ CHECK2(restarter.insertErrorInNode(nodeId, errval) == 0,
+ "failed to set error insert");
+ CHECK2(pDic->createTable(tab) != 0,
+ "failed to fail after error insert " << errval);
+ CHECK2(pDic->createTable(tab) == 0,
+ pDic->getNdbError());
+ CHECK2(pDic->dropTable(tab.getName()) == 0,
+ pDic->getNdbError());
+ }
+ for (unsigned i2 = 0; i2 < tuxcnt; i2++) {
+ unsigned j = (l == 0 ? i2 : myRandom48(tuxcnt));
+ int errval = tuxlst[j];
+ g_info << "insert error node=" << nodeId << " value=" << errval << endl;
+ CHECK2(restarter.insertErrorInNode(nodeId, errval) == 0,
+ "failed to set error insert");
+ CHECK2(pDic->createTable(tab) == 0,
+ pDic->getNdbError());
+ CHECK2(pDic->createIndex(idx) != 0,
+ "failed to fail after error insert " << errval);
+ CHECK2(pDic->createIndex(idx) == 0,
+ pDic->getNdbError());
+ CHECK2(pDic->dropTable(tab.getName()) == 0,
+ pDic->getNdbError());
+ }
+ }
+end:
+ return result;
+}
+
NDBT_TESTSUITE(testDict);
TESTCASE("CreateAndDrop",
"Try to create and drop the table loop number of times\n"){
@@ -1573,6 +1652,10 @@ TESTCASE("DictionaryPerf",
""){
INITIALIZER(runTestDictionaryPerf);
}
+TESTCASE("FailAddFragment",
+ "Fail add fragment or attribute in ACC or TUP or TUX\n"){
+ INITIALIZER(runFailAddFragment);
+}
NDBT_TESTSUITE_END(testDict);
int main(int argc, const char** argv){
@@ -1582,5 +1665,3 @@ int main(int argc, const char** argv){
myRandom48Init(NdbTick_CurrentMillisecond());
return testDict.execute(argc, argv);
}
-
-
diff --git a/ndb/test/ndbapi/testIndex.cpp b/ndb/test/ndbapi/testIndex.cpp
index ed9e114fd92..6623ad35a7f 100644
--- a/ndb/test/ndbapi/testIndex.cpp
+++ b/ndb/test/ndbapi/testIndex.cpp
@@ -58,7 +58,9 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){
// Build attrib definitions that describes which attributes to build index
// Try to build strange combinations, not just "all" or all PK's
- for(int i = 1; i <= pTab->getNoOfColumns(); i++){
+ int i;
+
+ for(i = 1; i <= pTab->getNoOfColumns(); i++){
attr = new Attrib;
attr->numAttribs = i;
for(int a = 0; a<i; a++)
@@ -66,7 +68,7 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){
attriblist.push_back(attr);
}
int b = 0;
- for(int i = pTab->getNoOfColumns()-1; i > 0; i--){
+ for(i = pTab->getNoOfColumns()-1; i > 0; i--){
attr = new Attrib;
attr->numAttribs = i;
b++;
@@ -74,21 +76,21 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){
attr->attribs[a] = a+b;
attriblist.push_back(attr);
}
- for(int i = pTab->getNoOfColumns(); i > 0; i--){
+ for(i = pTab->getNoOfColumns(); i > 0; i--){
attr = new Attrib;
attr->numAttribs = pTab->getNoOfColumns() - i;
for(int a = 0; a<pTab->getNoOfColumns() - i; a++)
attr->attribs[a] = pTab->getNoOfColumns()-a-1;
attriblist.push_back(attr);
}
- for(int i = 1; i < pTab->getNoOfColumns(); i++){
+ for(i = 1; i < pTab->getNoOfColumns(); i++){
attr = new Attrib;
attr->numAttribs = pTab->getNoOfColumns() - i;
for(int a = 0; a<pTab->getNoOfColumns() - i; a++)
attr->attribs[a] = pTab->getNoOfColumns()-a-1;
attriblist.push_back(attr);
}
- for(int i = 1; i < pTab->getNoOfColumns(); i++){
+ for(i = 1; i < pTab->getNoOfColumns(); i++){
attr = new Attrib;
attr->numAttribs = 2;
for(int a = 0; a<2; a++){
@@ -226,8 +228,8 @@ int runCreateIndexes(NDBT_Context* ctx, NDBT_Step* step){
while (l < loops && result == NDBT_OK){
-
- for (unsigned int i = 0; i < attrList.attriblist.size(); i++){
+ unsigned int i;
+ for (i = 0; i < attrList.attriblist.size(); i++){
// Try to create index
if (create_index(ctx, i, pTab, pNdb, attrList.attriblist[i], logged) == NDBT_FAILED)
@@ -235,7 +237,7 @@ int runCreateIndexes(NDBT_Context* ctx, NDBT_Step* step){
}
// Now drop all indexes that where created
- for (unsigned int i = 0; i < attrList.attriblist.size(); i++){
+ for (i = 0; i < attrList.attriblist.size(); i++){
// Try to drop index
if (drop_index(i, pNdb, pTab, attrList.attriblist[i]) != NDBT_OK)
@@ -1083,8 +1085,8 @@ runUniqueNullTransactions(NDBT_Context* ctx, NDBT_Step* step){
else
pIdx.setType(NdbDictionary::Index::UniqueHashIndex);
pIdx.setStoredIndex(logged);
-
- for (int c = 0; c< pTab->getNoOfColumns(); c++){
+ int c;
+ for (c = 0; c< pTab->getNoOfColumns(); c++){
const NdbDictionary::Column * col = pTab->getColumn(c);
if(col->getPrimaryKey()){
pIdx.addIndexColumn(col->getName());
@@ -1093,7 +1095,7 @@ runUniqueNullTransactions(NDBT_Context* ctx, NDBT_Step* step){
}
int colId = -1;
- for (int c = 0; c< pTab->getNoOfColumns(); c++){
+ for (c = 0; c< pTab->getNoOfColumns(); c++){
const NdbDictionary::Column * col = pTab->getColumn(c);
if(col->getNullable()){
pIdx.addIndexColumn(col->getName());
diff --git a/ndb/test/ndbapi/testLcp.cpp b/ndb/test/ndbapi/testLcp.cpp
index c92be091a97..d11692db761 100644
--- a/ndb/test/ndbapi/testLcp.cpp
+++ b/ndb/test/ndbapi/testLcp.cpp
@@ -85,7 +85,8 @@ main(int argc, char ** argv){
g_info << " where ZLCP_OP_WRITE_RT_BREAK is finished before SAVE_PAGES"
<< endl;
require(!pause_lcp());
- for(size_t j = 0; j<g_rows; j++){
+ size_t j;
+ for(j = 0; j<g_rows; j++){
require(!do_op(j));
}
require(!continue_lcp(5900));
@@ -98,7 +99,7 @@ main(int argc, char ** argv){
<< endl;
require(!load_table());
require(!pause_lcp());
- for(size_t j = 0; j<g_rows; j++){
+ for(j = 0; j<g_rows; j++){
require(!do_op(j));
}
require(!continue_lcp(5901));
@@ -109,7 +110,7 @@ main(int argc, char ** argv){
g_info << "Testing pre LCP operations, undo-ed at commit" << endl;
require(!load_table());
require(!pause_lcp());
- for(size_t j = 0; j<g_rows; j++){
+ for(j = 0; j<g_rows; j++){
require(!do_op(j));
}
require(!continue_lcp(5902));
diff --git a/ndb/test/ndbapi/testNdbApi.cpp b/ndb/test/ndbapi/testNdbApi.cpp
index 74cb1f8bcd0..a1ebac609b6 100644
--- a/ndb/test/ndbapi/testNdbApi.cpp
+++ b/ndb/test/ndbapi/testNdbApi.cpp
@@ -88,10 +88,10 @@ int runTestMaxNdb(NDBT_Context* ctx, NDBT_Step* step){
oldi = i;
- for(size_t i = 0; i < ndbVector.size(); i++){
- delete ndbVector[i];
- if(((i+1) % 250) == 0){
- ndbout << "Deleted " << (Uint64) i << " ndb objects " << endl;
+ for(size_t j = 0; j < ndbVector.size(); j++){
+ delete ndbVector[j];
+ if(((j+1) % 250) == 0){
+ ndbout << "Deleted " << (Uint64) j << " ndb objects " << endl;
}
}
ndbVector.clear();
@@ -178,8 +178,8 @@ int runTestMaxTransaction(NDBT_Context* ctx, NDBT_Step* step){
oldi = i;
- for(size_t i = 0; i < conVector.size(); i++){
- pNdb->closeTransaction(conVector[i]);
+ for(size_t j = 0; j < conVector.size(); j++){
+ pNdb->closeTransaction(conVector[j]);
}
conVector.clear();
l++;
@@ -537,8 +537,8 @@ int runTestDeleteNdb(NDBT_Context* ctx, NDBT_Step* step){
}
// Delete the ndb objects
- for(size_t i = 0; i < ndbVector.size(); i++)
- delete ndbVector[i];
+ for(size_t j = 0; j < ndbVector.size(); j++)
+ delete ndbVector[j];
ndbVector.clear();
l++;
}
diff --git a/ndb/test/ndbapi/testOIBasic.cpp b/ndb/test/ndbapi/testOIBasic.cpp
index 21862e02328..41f0686e63b 100644
--- a/ndb/test/ndbapi/testOIBasic.cpp
+++ b/ndb/test/ndbapi/testOIBasic.cpp
@@ -407,10 +407,11 @@ Col::verify(const void* addr) const
const unsigned char* p = (const unsigned char*)addr;
unsigned n = (p[0] << 8) | p[1];
assert(n <= m_length);
- for (unsigned i = 0; i < n; i++) {
+ unsigned i;
+ for (i = 0; i < n; i++) {
assert(p[2 + i] != 0);
}
- for (unsigned i = n; i < m_length; i++) {
+ for (i = n; i < m_length; i++) {
assert(p[2 + i] == 0);
}
}
@@ -3021,7 +3022,8 @@ runstep(Par par, const char* fname, TFunc func, unsigned mode)
{
LL2(fname);
const int threads = (mode & ST ? 1 : par.m_threads);
- for (int n = 0; n < threads; n++) {
+ int n;
+ for (n = 0; n < threads; n++) {
LL4("start " << n);
Thr& thr = *g_thrlist[n];
thr.m_par.m_tab = par.m_tab;
@@ -3033,7 +3035,7 @@ runstep(Par par, const char* fname, TFunc func, unsigned mode)
thr.start();
}
unsigned errs = 0;
- for (int n = threads - 1; n >= 0; n--) {
+ for (n = threads - 1; n >= 0; n--) {
LL4("stop " << n);
Thr& thr = *g_thrlist[n];
thr.stopped();
@@ -3301,10 +3303,11 @@ runtest(Par par)
CHK(con.connect() == 0);
par.m_con = &con;
g_thrlist = new Thr* [par.m_threads];
- for (unsigned n = 0; n < par.m_threads; n++) {
+ unsigned n;
+ for (n = 0; n < par.m_threads; n++) {
g_thrlist[n] = 0;
}
- for (unsigned n = 0; n < par.m_threads; n++) {
+ for (n = 0; n < par.m_threads; n++) {
g_thrlist[n] = new Thr(par, n);
Thr& thr = *g_thrlist[n];
assert(thr.m_thread != 0);
@@ -3330,11 +3333,11 @@ runtest(Par par)
}
}
}
- for (unsigned n = 0; n < par.m_threads; n++) {
+ for (n = 0; n < par.m_threads; n++) {
Thr& thr = *g_thrlist[n];
thr.exit();
}
- for (unsigned n = 0; n < par.m_threads; n++) {
+ for (n = 0; n < par.m_threads; n++) {
Thr& thr = *g_thrlist[n];
thr.join();
delete &thr;
diff --git a/ndb/test/ndbapi/testReadPerf.cpp b/ndb/test/ndbapi/testReadPerf.cpp
index 8d0d78cbe8c..380a809ad00 100644
--- a/ndb/test/ndbapi/testReadPerf.cpp
+++ b/ndb/test/ndbapi/testReadPerf.cpp
@@ -99,7 +99,8 @@ main(int argc, const char** argv){
{ "verbose", 'v', arg_flag, &verbose, "Print verbose status", "verbose" }
};
const int num_args = 1 + P_MAX;
- for(int i = 0; i<P_MAX; i++){
+ int i;
+ for(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;
@@ -127,7 +128,7 @@ main(int argc, const char** argv){
g_err << "Wait until ready failed" << endl;
goto error;
}
- for(int i = optind; i<argc; i++){
+ for(i = optind; i<argc; i++){
const char * T = argv[i];
g_info << "Testing " << T << endl;
BaseString::snprintf(g_table, sizeof(g_table), T);
diff --git a/ndb/test/ndbapi/testRestartGci.cpp b/ndb/test/ndbapi/testRestartGci.cpp
index e817245af55..4e541d1f38f 100644
--- a/ndb/test/ndbapi/testRestartGci.cpp
+++ b/ndb/test/ndbapi/testRestartGci.cpp
@@ -132,7 +132,8 @@ int runVerifyInserts(NDBT_Context* ctx, NDBT_Step* step){
// RULE1: The vector with saved records should have exactly as many
// records with lower or same gci as there are in DB
int recordsWithLowerOrSameGci = 0;
- for (unsigned i = 0; i < savedRecords.size(); i++){
+ unsigned i;
+ for (i = 0; i < savedRecords.size(); i++){
if (savedRecords[i].m_gci <= restartGCI)
recordsWithLowerOrSameGci++;
}
@@ -144,7 +145,7 @@ int runVerifyInserts(NDBT_Context* ctx, NDBT_Step* step){
// RULE2: The records found in db should have same or lower
// gci as in the vector
- for (unsigned i = 0; i < savedRecords.size(); i++){
+ for (i = 0; i < savedRecords.size(); i++){
CHECK(hugoOps.startTransaction(pNdb) == 0);
CHECK(hugoOps.pkReadRecord(pNdb, i) == 0);
if (hugoOps.execute_Commit(pNdb) != 0){
diff --git a/ndb/test/ndbapi/testScanPerf.cpp b/ndb/test/ndbapi/testScanPerf.cpp
index c1334125978..003fc67179f 100644
--- a/ndb/test/ndbapi/testScanPerf.cpp
+++ b/ndb/test/ndbapi/testScanPerf.cpp
@@ -80,7 +80,8 @@ main(int argc, const char** argv){
{ "verbose", 'v', arg_flag, &verbose, "Print verbose status", "verbose" }
};
const int num_args = 1 + P_MAX;
- for(int i = 0; i<P_MAX; i++){
+ int i;
+ for(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;
@@ -107,7 +108,7 @@ main(int argc, const char** argv){
g_err << "Wait until ready failed" << endl;
goto error;
}
- for(int i = optind; i<argc; i++){
+ for(i = optind; i<argc; i++){
const char * T = argv[i];
g_info << "Testing " << T << endl;
BaseString::snprintf(g_tablename, sizeof(g_tablename), T);
diff --git a/ndb/test/ndbapi/testSystemRestart.cpp b/ndb/test/ndbapi/testSystemRestart.cpp
index f8f2b84acc4..35016896495 100644
--- a/ndb/test/ndbapi/testSystemRestart.cpp
+++ b/ndb/test/ndbapi/testSystemRestart.cpp
@@ -452,7 +452,7 @@ int runSystemRestart3(NDBT_Context* ctx, NDBT_Step* step){
}
Vector<int> nodeIds;
- for(Uint32 i = 0; i<nodeCount; i++)
+ for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i));
Uint32 currentRestartNodeIndex = 0;
@@ -561,7 +561,7 @@ int runSystemRestart4(NDBT_Context* ctx, NDBT_Step* step){
}
Vector<int> nodeIds;
- for(Uint32 i = 0; i<nodeCount; i++)
+ for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i));
Uint32 currentRestartNodeIndex = 0;
@@ -691,7 +691,7 @@ int runSystemRestart5(NDBT_Context* ctx, NDBT_Step* step){
}
Vector<int> nodeIds;
- for(Uint32 i = 0; i<nodeCount; i++)
+ for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i));
Uint32 currentRestartNodeIndex = 0;
@@ -821,7 +821,7 @@ int runSystemRestart6(NDBT_Context* ctx, NDBT_Step* step){
}
Vector<int> nodeIds;
- for(Uint32 i = 0; i<nodeCount; i++)
+ for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i));
Uint32 currentRestartNodeIndex = 0;
@@ -877,7 +877,7 @@ int runSystemRestart7(NDBT_Context* ctx, NDBT_Step* step){
}
Vector<int> nodeIds;
- for(Uint32 i = 0; i<nodeCount; i++)
+ for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i));
int a_nodeIds[64];
@@ -952,7 +952,7 @@ int runSystemRestart8(NDBT_Context* ctx, NDBT_Step* step){
}
Vector<int> nodeIds;
- for(Uint32 i = 0; i<nodeCount; i++)
+ for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i));
int a_nodeIds[64];
diff --git a/ndb/test/odbc/tpcb/Makefile b/ndb/test/odbc/tpcb/Makefile
deleted file mode 100644
index 8ab429c8ea1..00000000000
--- a/ndb/test/odbc/tpcb/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-include .defs.mk
-
-TYPE = *
-
-BIN_TARGET = tpcb
-
-SOURCES = ttTime.c tpcb.cpp
-
-CCFLAGS_LOC += \
- -I$(NDB_TOP)/include \
- -I$(NDB_TOP)/include/ndbapi \
- -I$(NDB_TOP)/include/portlib \
- -I$(NDB_TOP)/include/util \
- -I$(NDB_TOP)/test/include \
- -I/usr/local/include
-
-CCFLAGS_WARNINGS += -Wno-unused -Wno-sign-compare -Wformat
-
-CCFLAGS_TOP += -DndbODBC
-
-BIN_TARGET_LIBS = NDB_API_pic NDB_ODBC_pic NDBT
-
-ifeq ($(NDB_OS),SOLARIS)
-BIN_TARGET_LIBS += dmallocthcxx
-CCFLAGS_TOP += -DDMALLOC
-endif
-
-include $(NDB_TOP)/Epilogue.mk
-
-$(BIN_DIR)$(BIN_TARGET): Makefile
diff --git a/ndb/test/odbc/tpcb/Makefile_mysql b/ndb/test/odbc/tpcb/Makefile_mysql
deleted file mode 100644
index 4e1b9a25fe2..00000000000
--- a/ndb/test/odbc/tpcb/Makefile_mysql
+++ /dev/null
@@ -1,33 +0,0 @@
-include $(NDB_TOP)/Defs.mk
-
-TYPE = odbcclient
-
-BIN_TARGET = tpcb
-
-SOURCES = ttTime.c tpcb.cpp
-
-CCFLAGS_LOC += -I/usr/local/include \
- -I$(NDB_TOP)/test/include \
- -I$(NDB_TOP)/include \
- -I$(NDB_TOP)/include/util \
- -I$(NDB_TOP)/src/client/odbc/common
-
-
-
-
-#CCFLAGS_WARNINGS += -Wno-unused
-
-LIBS_LOC += -L/usr/local/lib
-BIN_TARGET_LIBS_DIRS += /usr/local/lib
-BIN_TARGET_LIBS += odbc odbcinst
-
-#LIBS_SPEC += -pg
-# -lNDBT \
-# -lodbc \
-# -lodbcinst \
-# -lportlib
-
-
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/test/odbc/tpcb/Makefile_ndb b/ndb/test/odbc/tpcb/Makefile_ndb
deleted file mode 100644
index 85960413ef0..00000000000
--- a/ndb/test/odbc/tpcb/Makefile_ndb
+++ /dev/null
@@ -1,30 +0,0 @@
-include $(NDB_TOP)/Defs.mk
-
-TYPE = *
-
-BIN_TARGET = tpcb
-
-SOURCES = ttTime.c tpcb.cpp
-
-CCFLAGS_LOC += \
- -I$(NDB_TOP)/include \
- -I$(NDB_TOP)/include/ndbapi \
- -I$(NDB_TOP)/include/portlib \
- -I$(NDB_TOP)/include/util \
- -I$(NDB_TOP)/test/include \
- -I/usr/local/include
-
-CCFLAGS_WARNINGS += -Wno-unused -Wno-sign-compare -Wformat
-
-CCFLAGS_TOP += -DndbODBC
-
-BIN_TARGET_LIBS = NDB_API_pic NDB_ODBC_pic NDBT
-
-ifeq ($(NDB_OS),SOLARIS)
-BIN_TARGET_LIBS += dmallocthcxx
-CCFLAGS_TOP += -DDMALLOC
-endif
-
-include $(NDB_TOP)/Epilogue.mk
-
-$(BIN_DIR)$(BIN_TARGET): Makefile
diff --git a/ndb/test/odbc/tpcb/readme.txt b/ndb/test/odbc/tpcb/readme.txt
deleted file mode 100644
index 008cafb9d2f..00000000000
--- a/ndb/test/odbc/tpcb/readme.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-'tpcb' requires an .odbc.ini file in
-/etc/
-or in
-/home/user/
-
-The .odbc.ini file must contain a DSN entry called ndb:
-
-#--------- .odbc.ini example --------------------
-
-[ndb]
-Driver = /path_to_installation/lib/libNDB_ODBC.so
-
-#--------- End of example -----------------------
-
-
diff --git a/ndb/test/odbc/tpcb/timesten.h b/ndb/test/odbc/tpcb/timesten.h
deleted file mode 100644
index 45579f9d277..00000000000
--- a/ndb/test/odbc/tpcb/timesten.h
+++ /dev/null
@@ -1,188 +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 */
-
-/*
- * $Revision: 1.1 $
- * (c) Copyright 1997-2003, TimesTen, Inc.
- * All rights reserved.
- */
-
-#ifndef TIMESTEN_H_INCLUDED
-#define TIMESTEN_H_INCLUDED
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-#include <sql.h>
-#include <sqltypes.h>
-#include <sqlext.h>
-/*
- * TimesTen extension to application data types; only usable
- * when application directly linked to the TimesTen driver.
- */
-#define SQL_C_ADDR 100
-
-#ifndef SQL_C_SBIGINT
-#if (ODBCVER < 0x0300)
-#define SQL_C_SBIGINT (SQL_BIGINT+SQL_SIGNED_OFFSET)
-#define SQL_C_UBIGINT (SQL_BIGINT+SQL_UNSIGNED_OFFSET)
-#endif
-#endif
-
-#define SQL_C_BIGINT SQL_C_SBIGINT
-
-#if (ODBCVER < 0x0300)
-#ifdef _WIN32
-typedef __int64 SQLBIGINT;
-/* On Unix platforms SQLBIGINT is defined in odbcinclude directory*/
-#endif
-#endif
-
-#define BIGINT SQLBIGINT
-
-#ifdef _WIN32
-#define UBIGINT unsigned __int64
-#else
-#define UBIGINT unsigned long long
-#endif
-
-
-#define SQL_WCHAR (-8)
-#define SQL_WVARCHAR (-9)
-#define SQL_WLONGVARCHAR (-10)
-#define SQL_C_WCHAR SQL_WCHAR
-
-/* SQLGetInfo() InfoTypes */
-#define SQL_CONVERT_WCHAR 122
-#define SQL_CONVERT_WLONGVARCHAR 125
-#define SQL_CONVERT_WVARCHAR 126
-
-/* TimesTen specific SQLGetInfo types */
-#define TT_REPLICATION_INVALID (SQL_INFO_DRIVER_START + 2000)
-
-/* SQLGetInfo() return value bitmasks */
-#ifndef SQL_CVT_WCHAR
-/*
-** These definitions differ from Microsoft in that they are not
-** specified as long (e.g. 0x00200000L), hence they are protected
-** by the ifndef above.
-*/
-#define SQL_CVT_WCHAR 0x00200000
-#define SQL_CVT_WLONGVARCHAR 0x00400000
-#define SQL_CVT_WVARCHAR 0x00800000
-#endif
-
-/*
-** The Microsoft Driver Manager SQLBindParameter() will not pass SQL_WCHAR
-** through. Use this hack to get around it.
-*/
-#define SQL_WCHAR_DM_SQLBINDPARAMETER_BYPASS -888
-
-/* This is an extension to ODBC's isolation levels. It reflects an
- * earlier implementation of read-committed that released locks on
- * next fetch, rather than releasing locks before returning value to
- * application. */
-#define SQL_TXN_CURSOR_STABILITY 0x00001000
-#define SQL_TXN_NOBLOCK_DELETE 0x00002000
-
-/* TimesTen-specific connection option */
-#define TT_PREFETCH_CLOSE 10001
-#define TT_PREFETCH_CLOSE_OFF 0
-#define TT_PREFETCH_CLOSE_ON 1
-
-/* Adding a new sql connection option */
-#define TT_PREFETCH_COUNT 10003
-#define TT_PREFETCH_COUNT_MAX 128
-
-/*
- * Platform specific data types for integers that scale
- * with pointer size
- */
-
-#ifdef _IA64_
-typedef signed __int64 tt_ptrint;
-typedef unsigned __int64 tt_uptrint;
-#else
-#ifdef _WIN32
-typedef signed long tt_ptrint;
-typedef unsigned long tt_uptrint;
-#else
-typedef signed long tt_ptrint;
-typedef unsigned long tt_uptrint;
-#endif
-#endif
-
-#ifdef _WIN32
-typedef signed __int64 tt_int8;
-typedef unsigned __int64 tt_uint8;
-#else
-typedef signed long long tt_int8;
-typedef unsigned long long tt_uint8;
-#endif
-
-/* printf formats for pointer-sized integers */
-#ifdef _IA64_ /* 64-bit NT */
-#define PTRINT_FMT "I64d"
-#define UPTRINT_FMT "I64u"
-#define xPTRINT_FMT "I64x"
-#define XPTRINT_FMT "I64X"
-#else
-#ifdef _WIN32 /* 32-bit NT */
-#define PTRINT_FMT "ld"
-#define UPTRINT_FMT "lu"
-#define xPTRINT_FMT "lx"
-#define XPTRINT_FMT "lX"
-#else /* 32 and 64-bit UNIX */
-#define PTRINT_FMT "ld"
-#define UPTRINT_FMT "lu"
-#define xPTRINT_FMT "lx"
-#define XPTRINT_FMT "lX"
-#endif
-#endif
-
-/* printf formats for 8-byte integers */
-#ifndef INT8_FMT_DEFINED
-#ifdef _WIN32 /* 32 and 64-bit NT */
-#define INT8_FMT "I64d"
-#define UINT8_FMT "I64u"
-#define xINT8_FMT "I64x"
-#define XINT8_FMT "I64X"
-#else /* 32 and 64-bit UNIX */
-#define INT8_FMT "lld"
-#define UINT8_FMT "llu"
-#define xINT8_FMT "llx"
-#define XINT8_FMT "llX"
-#endif
-#define INT8_FMT_DEFINED 1
-#endif
-
-/* The following types are defined in the newer odbc include files
- from Microsoft
-*/
-#if defined (_WIN32) && !defined (_IA64_)
-#ifndef SQLROWSETSIZE
-#define SQLROWSETSIZE SQLUINTEGER
-#define SQLLEN SQLINTEGER
-#define SQLROWOFFSET SQLINTEGER
-#define SQLROWCOUNT SQLUINTEGER
-#define SQLULEN SQLUINTEGER
-#define SQLSETPOSIROW SQLUSMALLINT
-#endif
-#endif
-
-
-#endif
diff --git a/ndb/test/odbc/tpcb/tpcb.cpp b/ndb/test/odbc/tpcb/tpcb.cpp
deleted file mode 100644
index 60d746e7844..00000000000
--- a/ndb/test/odbc/tpcb/tpcb.cpp
+++ /dev/null
@@ -1,1415 +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 */
-
-static const volatile char cvsid[] = "$Id: tpcb.cpp,v 1.4 2003/09/26 09:04:34 johan Exp $";
-/*
- * $Revision: 1.4 $
- * (c) Copyright 1996-2003, TimesTen, Inc.
- * All rights reserved.
- */
-
-/* This source is best displayed with a tabstop of 4 */
-
-#define NDB
-
-//#define MYSQL
-
-#ifdef WIN32
-#include <windows.h>
-#include "ttRand.h"
-#else
-#if !defined NDB && !defined MYSQL
-#include <sqlunix.h>
-#endif
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef SB_P_OS_CHORUS
-#include "ttRand.h"
-#endif
-#endif
-
-#include <math.h>
-#include <time.h>
-#include <sql.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#if !defined NDB && !defined MYSQL
-#include "ttTime.h"
-#include "utils.h"
-#include "tt_version.h"
-#include "timesten.h"
-#endif
-
-#if defined NDB || defined MYSQL
-#include <NdbOut.hpp>
-#include <string.h>
-
-#include <sqlext.h>
-#include <sql.h>
-extern "C" {
-#include "ttTime.h"
-#include "timesten.h"
- void ttGetWallClockTime(ttWallClockTime* timeP);
- void ttCalcElapsedWallClockTime(ttWallClockTime* beforeP,
- ttWallClockTime* afterP,
- double* nmillisecondsP);
- void ttGetThreadTimes(ttThreadTimes * endRes);
- void ttCalcElapsedThreadTimes(ttThreadTimes* startRes,
- ttThreadTimes * endRes,
- double * kernel,
- double * user);
-}
-
-#define app_exit exit
-#define status_msg0 ndbout_c
-#define status_msg1 ndbout_c
-#define status_msg2 ndbout_c
-#define err_msg0 ndbout_c
-#define err_msg1 ndbout_c
-#define err_msg3 ndbout_c
-#define out_msg0 ndbout_c
-#define out_msg1 ndbout_c
-#define out_msg3 ndbout_c
-#define CONN_STR_LEN 255
-#define DBMS_TIMESTEN 1
-#define DBMS_MSSQL 2
-#define DBMS_UNKNOWN 3
-#define ABORT_DISCONNECT_EXIT 1
-#define NO_EXIT 0
-#define ERROR_EXIT 1
-#define DISCONNECT_EXIT 2
-#endif
-
-#define VERBOSE_NOMSGS 0
-/* this value is used for results (and err msgs) only */
-#define VERBOSE_RESULTS 1
-/* this value is the default for the cmdline demo */
-#define VERBOSE_DFLT 2
-#define VERBOSE_ALL 3
-
-#ifdef MYSQL
-#define DSNNAME "DSN=myodbc3"
-#elif defined NDB
-#define DSNNAME "DSN=ndb"
-#else
-#define DSNNAME "DSN="
-#endif
-
-/* number of branches, tellers, and accounts */
-
-#define NumBranches 1
-#define TellersPerBranch 10
-#define AccountsPerBranch 10000
-
-/* number of transactions to execute */
-
-#define NumXacts 25000
-
-/* starting seed value for the random number generator */
-
-#define SeedVal 84773
-
-/* for MS SQL, the drop, create and use database statements */
-
-#define DatabaseDropStmt "drop database tpcbDB;"
-#ifdef MYSQL
-#define DatabaseCreateStmt "create database tpcbDB;"
-#else
-#define DatabaseCreateStmt "create database tpcbDB ON DEFAULT = %d;"
-#endif
-#define DatabaseUseStmt "use tpcbDB;"
-
-/*
- * Specifications of table columns.
- * Fillers of 80, 80, 84, and 24 bytes, respectively, are used
- * to ensure that rows are the width required by the benchmark.
- *
- * Note: The TimesTen and MS SQL CREATE TABLE statements for the
- * accounts, tellers and branches tables are different.
- *
- */
-
-#define TuplesPerPage 256
-
-
-#ifdef MYSQL
-
-#define AccountCrTblStmt "create table accounts \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float not null, \
-filler char(80));"
-
-#define TellerCrTblStmt "create table tellers \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float not null, \
-filler char(80));"
-
-#define BranchCrTblStmt "create table branches \
-(number integer not null primary key, \
-balance float not null, \
-filler char(84));"
-
-#endif
-
-
-#ifdef NDB
-#define AccountCrTblStmt "create table accounts \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float not null, \
-filler char(80)) nologging"
-
-#define TellerCrTblStmt "create table tellers \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float not null, \
-filler char(80)) nologging"
-
-#define BranchCrTblStmt "create table branches \
-(number integer not null primary key, \
-balance float not null, \
-filler char(84)) nologging"
-#endif
-
-#ifdef NDB
-
-#define HistoryCrTblStmt "create table History \
-(tellernum integer not null, \
-branchnum integer not null, \
-accountnum integer not null, \
-delta float not null, \
-createtime integer not null, \
-filler char(24), \
-primary key (tellernum, branchnum, accountnum, delta, createtime)) nologging"
-
-#else
-
-#ifdef MYSQL
-
-#define HistoryCrTblStmt "create table History \
-(tellernum integer not null, \
-branchnum integer not null, \
-accountnum integer not null, \
-delta float(53) not null, \
-createtime integer not null, \
-filler char(24))"
-#endif
-
-#define HistoryCrTblStmt "create table History \
-(tellernum integer not null, \
-branchnum integer not null, \
-accountnum integer not null, \
-delta float(53) not null, \
-createtime integer not null, \
-filler char(24));"
-#endif
-
-#define TTAccountCrTblStmt "create table accounts \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float(53) not null, \
-filler char(80)) unique hash on (number) pages = %" PTRINT_FMT ";"
-
-#define TTTellerCrTblStmt "create table tellers \
-(number integer not null primary key, \
-branchnum integer not null, \
-balance float(53) not null, \
-filler char(80)) unique hash on (number) pages = %" PTRINT_FMT ";"
-
-#define TTBranchCrTblStmt "create table branches \
-(number integer not null primary key, \
-balance float(53) not null, \
-filler char(84)) unique hash on (number) pages = %" PTRINT_FMT ";"
-
-
-/* Insertion statements used to populate the tables */
-
-#define NumInsStmts 3
-char* insStmt[NumInsStmts] = {
- "insert into branches values (?, 0.0, NULL)",
- "insert into tellers values (?, ?, 0.0, NULL)",
- "insert into accounts values (?, ?, 0.0, NULL)"
-};
-
-/* Transaction statements used to update the tables */
-
-#define NumXactStmts 5
-
-#ifdef NDB
-char* tpcbXactStmt[NumXactStmts] = {
- "update accounts \
-set balance = balance + ? \
-where number = ?",
-
- "select balance \
-from accounts \
-where number = ?",
-
- "update tellers \
-set balance = balance + ? \
-where number = ?",
-
- "update branches \
-set balance = balance + ? \
-where number = ?",
-
- "insert into History(tellernum, branchnum, \
-accountnum, delta, createtime, filler) \
-values (?, ?, ?, ?, ?, NULL)"
-};
-
-#else
-char* tpcbXactStmt[NumXactStmts] = {
- "update accounts \
-set balance = balance + ? \
-where number = ?;",
-
- "select balance \
-from accounts \
-where number = ?;",
-
- "update tellers \
-set balance = balance + ? \
-where number = ?;",
-
- "update branches \
-set balance = balance + ? \
-where number = ?;",
-
- "insert into History \
-values (?, ?, ?, ?, ?, NULL);"
-};
-
-
-#endif
-
-/* Global parameters and flags (typically set by parse_args()) */
-
-int tabFlag = 0; /* Default is NOT tab output mode */
-char szConnStrIn[CONN_STR_LEN]; /* ODBC Connection String */
-int printXactTimes = 0; /* Transaction statistics
- * gathering flag */
-char statFile[FILENAME_MAX]; /* Transaction statistics filename */
-int scaleFactor = 2; /* Default TPS scale factor */
-int numBranchTups; /* Number of branches */
-int numTellerTups; /* Number of tellers */
-int numAccountTups; /* Number of accounts */
-int numNonLocalAccountTups; /* Number of local accounts */
-int numXacts = NumXacts; /* Default number of transactions */
-int verbose = VERBOSE_DFLT; /* Verbose level */
-FILE *statusfp; /* File for status messages */
-
-
-
-int DBMSType; /* DBMS type (DBMS_TIMESTEN, DBMS_MSSQL...) */
-
-
-SQLHENV henv; /* Environment handle */
-
-
-
-
-
-
-
-void handle_errors( SQLHDBC hdbc, SQLHSTMT hstmt, int errcode, int action, char * msg,
- char * file, int line) {
-
- if (errcode == SQL_SUCCESS)
- return;
-
- if(errcode == SQL_ERROR) {
- int ret;
- long diagCount=0;
- short length=0;
- SQLCHAR state[10] = "";
- SQLCHAR message[200] = "";
- long native = 0;
- if(hstmt != 0) {
- ret = SQLGetDiagField(SQL_HANDLE_STMT, hstmt, 0, SQL_DIAG_NUMBER, &diagCount, SQL_IS_INTEGER, 0);
-
- for(long i = 0; i < diagCount; i++) {
- ret = SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, i, (SQLCHAR*)state, &native, (SQLCHAR*)message, 200, &length);
- ndbout_c("GetDiagRec: Message : %s ", message);
- }
- }
- }
-
- if(errcode != SQL_SUCCESS) {
- ndbout_c("Message: %s", msg);
- switch(errcode) {
- case SQL_SUCCESS_WITH_INFO:
- ndbout_c("SQL_SUCCESS_WITH_INFO");
- break;
- case SQL_STILL_EXECUTING:
- ndbout_c("SQL_STILL_EXECUTING");
- break;
- case SQL_ERROR:
- ndbout_c("SQL_ERROR");
- break;
- case SQL_INVALID_HANDLE:
- ndbout_c("SQL_INVALID_HANDLE");
- break;
- default:
- ndbout_c("Some other error");
- }
- exit(1);
- }
-
-
-}
-
-
-
-
-
-/*********************************************************************
- * FUNCTION: usage
- *
- * DESCRIPTION: This function prints a usage message describing
- * the command line options of the program.
- *
- * PARAMETERS: char* prog full program path name
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-static void usage(char *prog)
-{
- char *progname;
-
- /* Get the name of the program (sans path). */
-
-#ifdef WIN32
- progname = strrchr(prog, '\\');
-#else
- progname = strrchr(prog, '/');
-#endif
- if (progname == 0)
- progname = prog;
- else
- ++progname;
-
- /* Print the usage message */
-
- fprintf(stderr,
- "Usage:\t%s [-h] [-help] [-V] [-connStr <string>] [-v <level>]\n"
- "\t\t[-xact <xacts>] [-scale <scale>] [-tabs] [-s <statfile>]\n\n"
- " -h Prints this message and exits.\n"
- " -help Same as -h.\n"
- " -V Prints version number and exits.\n"
- " -connStr <string> Specifies an ODBC connection string to replace the\n"
- " default DSN for the program. The default is\n"
- " \"DSN=TpcbData<version>;OverWrite=1\".\n"
- " -v <level> Verbose level\n"
- " 0 = errors only\n"
- " 1 = results only\n"
- " 2 = results and some status messages (default)\n"
- " 3 = all messages\n"
- " -xact <xacts> Specifies the number of transactions to be run\n"
- " The default is 25000 transactions.\n"
- " -scale <scale> Specifies a scale factor which determines the\n"
- " number of branches (scale), tellers (scale x 10),\n"
- " accounts (scale x 10000) and non-local accounts\n"
- " ((scale-1) x 10000. The default scale factor is 2.\n"
- " -tabs Specifies that the output be a tab-separated\n"
- " format suitable for import into a spreadsheet.\n"
- " Results only go to stdout; status and other\n"
- " messages go to stderr.\n"
- " -s <statfile> Prints individual transaction times to <statfile>.\n",
- progname);
-}
-
-/*********************************************************************
- *
- * FUNCTION: parse_args
- *
- * DESCRIPTION: This function parses the command line arguments
- * passed to main(), setting the appropriate global
- * variables and issuing a usage message for
- * invalid arguments.
- *
- * PARAMETERS: int argc # of arguments from main()
- * char *argv[] arguments from main()
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-parse_args(int argc, char *argv[])
-{
- int i = 1;
-
- *szConnStrIn = 0;
-
- while (i < argc) {
-
- if ( !strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") ) {
- usage(argv[0]);
- app_exit(0);
- }
- /*
- if (!strcmp(argv[i], "-V")) {
- printf("%s\n", TTVERSION_STRING);
- app_exit(0);
- }
- */
- if (strcmp(argv[i], "-s") == 0) {
- if (argc < i+2 ) {
- usage(argv[0]);
- app_exit(1);
- }
- if (sscanf(argv[i+1], "%s", statFile) == 0) {
- usage(argv[0]);
- app_exit(1);
- }
- printXactTimes = 1;
- i += 2;
- }
- else if (!strcmp(argv[i], "-connStr")) {
- if (argc < i+2 ) {
- usage(argv[0]);
- app_exit(1);
- }
- strcpy(szConnStrIn, argv[i+1]);
- i += 2;
- continue;
- }
- else if (strcmp("-v", argv[i]) == 0) {
- if (argc < i+2 ) {
- usage(argv[0]);
- app_exit(1);
- }
- if (sscanf(argv[i+1], "%d", &verbose) == -1 ||
- verbose < 0 || verbose > 3) {
- fprintf(stderr, "-v flag requires an integer parameter (0-3)\n");
- usage(argv[0]);
- app_exit(1);
- }
- i += 2;
- }
- else if (strcmp("-xact",argv[i]) == 0) {
- if (argc < i+2 ) {
- usage(argv[0]);
- app_exit(1);
- }
-
- if (sscanf(argv[i+1], "%" PTRINT_FMT, &numXacts) == -1 || numXacts < 0) {
- fprintf(stderr, "-xact flag requires a non-negative integer argument\n");
- usage(argv[0]);
- app_exit(1);
- }
-
- i += 2;
- }
- else if (strcmp("-scale",argv[i]) == 0) {
- if (argc < i+2 ) {
- usage(argv[0]);
- app_exit(1);
- }
- if (sscanf(argv[i+1], "%d", &scaleFactor) == -1 || scaleFactor < 1) {
- fprintf(stderr, "-scale flag requires an integer argument >= 1\n");
- usage(argv[0]);
- app_exit(1);
- }
- /* Calculate tuple sizes */
- numBranchTups = NumBranches * scaleFactor;
- numTellerTups = TellersPerBranch * scaleFactor;
- numAccountTups = AccountsPerBranch * scaleFactor;
- numNonLocalAccountTups = AccountsPerBranch * (scaleFactor-1);
- i += 2;
- }
- else if (strcmp("-tabs",argv[i]) == 0) {
- tabFlag = 1;
- statusfp = stderr;
- i += 1;
- }
- else {
- usage(argv[0]);
- app_exit(1);
- }
- }
-}
-
-/*********************************************************************
- *
- * FUNCTION: doImmed
- *
- * DESCRIPTION: This function executes and frees the specified
- * statement. It is used as a direct means to
- * create the tables used by this benchmark,
- *
- * PARAMETERS: SQLHDBC hdbc SQL Connection handle
- * SQLHSTMT hs SQL Statement handle
- * char* cmd SQL Statement text
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-doImmed(SQLHDBC hdbc, SQLHSTMT hs, char* cmd)
-{
- SQLRETURN rc;
-
- /* Execute the command */
-
- rc = SQLExecDirect(hs, (SQLCHAR *) cmd, SQL_NTS);
- handle_errors(hdbc, hs, rc, ABORT_DISCONNECT_EXIT,
- "Error executing statement", __FILE__, __LINE__);
-
- /* Close associated cursor and drop pending results */
-
- rc = SQLFreeStmt(hs, SQL_CLOSE);
- handle_errors(hdbc, hs, rc, ABORT_DISCONNECT_EXIT,
- "closing statement handle",
- __FILE__, __LINE__);
-
-}
-
-
-/*********************************************************************
- *
- * FUNCTION: main
- *
- * DESCRIPTION: This is the main function of the tpcb benchmark.
- * It connects to an ODBC data source, creates and
- * populates tables, updates the tables in a user-
- * specified number of transactions and reports on
- * on the transaction times.
- *
- * PARAMETERS: int argc # of command line arguments
- * char *argv[] command line arguments
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-int
-main(int argc, char *argv[])
-{
-
- /* variables used for setting up the tables */
-
- char cmdStr[1024];
- char errstr[4096];
-
- /* variables used during transactions */
-
- int accountNum;
- int tellerNum;
- int branchNum;
- int timeStamp;
- double delta;
- unsigned int lrand;
- unsigned short *srands, localLimit;
- int lp64;
-
- /* variables used for timing and statistics */
-
- int warmup;
- double kernel, user, real;
- ttThreadTimes startRes, endRes;
- ttWallClockTime startT, endT;
- ttWallClockTime** rtStart;
- ttWallClockTime** rtEnd;
- double** resTime;
- double maxTime, totTime;
- int i;
- int j;
- int numLocalXacts=0, numRemoteXacts=0;
-
- /* variables for ODBC */
-
- SQLHDBC hdbc;
- SQLHSTMT hstmt;
- SQLHSTMT txstmt[NumXactStmts];
- SQLRETURN rc;
- char DBMSName[32];
- char DBMSVersion[32];
- int databaseSize;
-
- int fThreadTime = 1;
-
-#ifdef WIN32
- OSVERSIONINFO sysInfo;
-
- sysInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx (&sysInfo);
-
- /* GetThreadTimes is not supported on 95/98. Hence,
- we do not support Resource/User/System times */
- if (sysInfo.dwPlatformId != VER_PLATFORM_WIN32_NT)
- fThreadTime = 0;
-#endif
-#if defined(TTCLIENTSERVER) && defined(__hpux) && !defined(__LP64__)
- /* HP requires this for C main programs that call aC++ shared libs */
- _main();
-#endif /* hpux32 */
-
- /* Set up default signal handlers */
-
-#ifndef NDB
- /* StopRequestClear();
- if (HandleSignals() != 0) {
- err_msg0("Unable to set signal handlers\n");
- return 1;
- }
- */
-#endif
- /* set IO mode for demo */
- /* set_io_mode(); */
-
- /* initialize the file for status messages */
- statusfp = stdout;
-
- /* set variable for 8-byte longs */
- lp64 = (sizeof(lrand) == 8);
-
- /* set the default tuple sizes */
-
- numBranchTups = NumBranches * scaleFactor;
- numTellerTups = TellersPerBranch * scaleFactor;
- numAccountTups = AccountsPerBranch * scaleFactor;
- numNonLocalAccountTups = AccountsPerBranch * (scaleFactor-1);
-
- /* parse the command arguments */
- parse_args(argc, argv);
-
- /* allocate the transaction-based variables */
-
- rtStart = (ttWallClockTime**) malloc(numXacts * sizeof(ttWallClockTime*));
- if (!rtStart) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- for (i = 0; i < numXacts; i++) {
- rtStart[i] = (ttWallClockTime*) malloc(sizeof(ttWallClockTime));
- if (!rtStart[i]) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- }
-
- rtEnd = (ttWallClockTime**) malloc(numXacts * sizeof(ttWallClockTime*));
- if (!rtEnd) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- for (i = 0; i < numXacts; i++) {
- rtEnd[i] = (ttWallClockTime*) malloc(sizeof(ttWallClockTime));
- if (!rtEnd[i]) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- }
-
- resTime = (double**) malloc(numXacts * sizeof(double*));
- if (!resTime) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- for (i = 0; i < numXacts; i++) {
- resTime[i] = (double*) malloc(sizeof(double));
- if (!resTime[i]) {
- err_msg0("Cannot allocate the transaction timing structures");
- app_exit(1);
- }
- }
-
- /* ODBC initialization */
-
- rc = SQLAllocEnv(&henv);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- /* error occurred -- don't bother calling handle_errors, since handle
- * is not valid so SQLError won't work */
- err_msg3("ERROR in %s, line %d: %s\n",
- __FILE__, __LINE__, "allocating an environment handle");
- app_exit(1);
- }
- SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, SQL_IS_INTEGER);
-
- /* call this in case of warning */
- handle_errors(NULL, NULL, rc, NO_EXIT,
- "allocating execution environment",
- __FILE__, __LINE__);
-
- rc = SQLAllocConnect(henv, &hdbc);
- handle_errors(NULL, NULL, rc, ERROR_EXIT,
- "allocating connection handle",
- __FILE__, __LINE__);
-
- /* Connect to data store */
-
- status_msg0("Connecting to the data source...\n");
-
- /* Set up the connection options if not specified on the command line
- * (default to TimesTen settings).
- */
-
- if ( !*szConnStrIn ) {
- /* Running the benchmark with a scale factor creates (scale) branches,
- * (scale x 10) tellers, (scale x 10000) accounts and ((scale-1) x 10000)
- * non-local accounts. The size of the table rows are branches (141)
- * tellers (141) and accounts (141). Therefore the data size requirements
- * of this benchmark is:
- * size ~= 141 * ((scale * 20011) - 10000) (bytes)
- *
- * Multiply data size by 20% to account for additional DB overhead (e.g.
- * indexes), and round up the nearest 10Mb for safety.
- */
-
- int est_size = (int) (3.6 * scaleFactor + 10.0);
- est_size = est_size - (est_size % 10);
-
- sprintf(szConnStrIn,"OverWrite=1;PermSize=%d;%s",
- est_size, DSNNAME);
- status_msg0("Connecting to the data source... %s \n", szConnStrIn);
- }
-
- rc = SQLDriverConnect(hdbc, NULL, (SQLCHAR *) szConnStrIn, SQL_NTS,
- NULL, 0, NULL,
- SQL_DRIVER_NOPROMPT);
-
- status_msg0("Connected to the data source...\n");
- sprintf(errstr, "connecting to driver (connect string %s)\n",
- szConnStrIn);
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- errstr, __FILE__, __LINE__);
-
- /* Turn auto-commit off */
-
- rc = SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
- handle_errors(hdbc, NULL, rc, DISCONNECT_EXIT,
- "switching off the AUTO_COMMIT option",
- __FILE__, __LINE__);
-
- /* Allocate a statement handle */
-
- rc = SQLAllocStmt(hdbc, &hstmt);
- handle_errors(hdbc, NULL, rc, DISCONNECT_EXIT,
- "allocating a statement handle",
- __FILE__, __LINE__);
-
- /* (Implicit) Transaction begin */
-
- /* Determine the DBMS Type*/
-
- DBMSName[0] = '\0';
- rc = SQLGetInfo(hdbc, SQL_DBMS_NAME, (PTR) &DBMSName,
- sizeof(DBMSName), NULL);
- rc = SQLGetInfo(hdbc, SQL_DRIVER_VER, (PTR) &DBMSVersion,
- sizeof(DBMSVersion), NULL);
-
- if (strcmp(DBMSName, "TimesTen") == 0)
- DBMSType = DBMS_TIMESTEN;
- else if (strcmp(DBMSName, "Microsoft SQL Server") == 0)
- DBMSType = DBMS_MSSQL;
- else DBMSType = DBMS_UNKNOWN;
-
- /* if not TimesTen: delete (if it exists), create & use the new database */
-
- if (DBMSType != DBMS_TIMESTEN) {
- status_msg0("Deleting the database...\n");
- rc = SQLExecDirect(hstmt, (SQLCHAR *) DatabaseDropStmt, SQL_NTS);
-
- /* estimate database size, size = data space + log space
- * data space = (#tuples)/(tuples per page) * 2K bytes/page
- * tuples per page = useable page size / row size (no index) = 2016/(96+2)
- * log space = #transactions * average log size for the program transaction mix
- * database size is in MB
- */
-
- databaseSize = (int) ceil((((numBranchTups + numTellerTups + numAccountTups)/
- (2016/98)) * 2048 + (numXacts * 600)) / 1000000.0);
-
- status_msg1("Creating the database (%dMB)...\n", databaseSize);
-#ifndef NDB
- sprintf(cmdStr, DatabaseCreateStmt, databaseSize);
- doImmed(hdbc, hstmt, cmdStr);
- strcpy(cmdStr, DatabaseUseStmt);
- doImmed(hdbc, hstmt, cmdStr);
-#endif
- }
-
- status_msg2("Connected to '%s' version '%s'...\n", DBMSName, DBMSVersion);
-
- /* create branches table */
- status_msg0("Creating tasddbles...\n");
-#ifndef NDB
- if (DBMSType == DBMS_TIMESTEN)
- sprintf(cmdStr, TTBranchCrTblStmt, numBranchTups/TuplesPerPage + 1);
- else
-#endif
- sprintf(cmdStr, BranchCrTblStmt);
- doImmed(hdbc, hstmt, cmdStr);
-
- /* create tellers table */
-#ifndef NDB
- if (DBMSType == DBMS_TIMESTEN)
- sprintf(cmdStr, TTTellerCrTblStmt, numTellerTups/TuplesPerPage + 1);
-
- else
-#endif
- sprintf(cmdStr, TellerCrTblStmt);
- doImmed(hdbc, hstmt, cmdStr);
-
- /* create accounts table */
-#ifndef NDB
- if (DBMSType == DBMS_TIMESTEN)
- sprintf(cmdStr, TTAccountCrTblStmt, numAccountTups/TuplesPerPage + 1);
- else
-#endif
- sprintf(cmdStr, AccountCrTblStmt);
- doImmed(hdbc, hstmt, cmdStr);
-
- /* create History table */
-
- doImmed(hdbc, hstmt, HistoryCrTblStmt);
-
- /* lock the database during population */
-#ifndef NDB
- if ( DBMSType == DBMS_TIMESTEN ) {
- rc = SQLExecDirect(hstmt, (SQLCHAR *)"call ttlocklevel('DS')", SQL_NTS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "specifying dbs lock usage",
- __FILE__, __LINE__);
- /* make sure dbs lock take effect in next transaction */
- rc = SQLTransact(henv,hdbc,SQL_COMMIT);
- if ( rc != SQL_SUCCESS) {
- handle_errors(hdbc, SQL_NULL_HSTMT, rc, ERROR_EXIT,
- "committing transaction",
- __FILE__, __LINE__);
- }
- }
-#endif
- /* populate branches table */
-
-
- rc = SQLPrepare(hstmt, (SQLCHAR *) insStmt[0], SQL_NTS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "preparing statement",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 10, 0, &branchNum, sizeof branchNum, NULL);
-
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
-
- status_msg1("Populating branches table (%" PTRINT_FMT " rows)...\n",
- numBranchTups);
-
-
- for (i=0; i<numBranchTups; i++) {
- branchNum = i;
- rc = SQLExecute(hstmt);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "Error executing statement",
- __FILE__, __LINE__);
- }
-
- /* Reset all bind-parameters for the statement handle. */
- rc = SQLFreeStmt(hstmt, SQL_RESET_PARAMS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "resetting parms on statement handle",
- __FILE__, __LINE__);
-
- /* populate tellers table */
-
- status_msg1("Populating tellers table (%" PTRINT_FMT " rows)...\n",
- numTellerTups);
-
-
- rc = SQLPrepare(hstmt, (SQLCHAR *) insStmt[1], SQL_NTS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "preparing statement",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER,
- 10, 0, &tellerNum, sizeof tellerNum, NULL);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER,
- 10, 0, &branchNum, sizeof branchNum, NULL);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- for (i=0; i<numTellerTups; i++) {
- tellerNum = i;
- branchNum = i/TellersPerBranch;
- rc = SQLExecute(hstmt);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "Error executing statement",
- __FILE__, __LINE__);
- }
-
- /* Reset all bind-parameters for the statement handle. */
-
- rc = SQLFreeStmt(hstmt, SQL_RESET_PARAMS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "resetting parms on statement handle",
- __FILE__, __LINE__);
-
- /* populate accounts table */
-
- status_msg1("Populating accounts table (%" PTRINT_FMT " rows)...\n",
- numAccountTups);
-
- rc = SQLPrepare(hstmt, (SQLCHAR *) insStmt[2], SQL_NTS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "preparing statement",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER,
- 10, 0, &accountNum, sizeof accountNum, NULL);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER,
- 10, 0, &branchNum, sizeof branchNum, NULL);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- for (i=0; i<numAccountTups; i++) {
- accountNum = i;
- branchNum = i/AccountsPerBranch;
- rc = SQLExecute(hstmt);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "Error executing statement",
- __FILE__, __LINE__);
- }
- status_msg0("Commit...\n");
- rc = SQLTransact(henv, hdbc, SQL_COMMIT);
- status_msg0("Commit done...\n");
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- "committing transaction",
- __FILE__, __LINE__);
-
- /* compile SQL statements of transaction */
-
- status_msg0("Compiling statements of transaction...\n");
- for (i=0; i<NumXactStmts; i++) {
-#ifndef NDB
- rc = SQLAllocStmt(hdbc, &txstmt[i]);
- handle_errors(hdbc, NULL, rc, ABORT_DISCONNECT_EXIT,
- "allocating a statement handle",
- __FILE__, __LINE__);
-#else
- rc = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &txstmt[i]);
- handle_errors(hdbc, NULL, rc, ABORT_DISCONNECT_EXIT,
- "allocating a statement handle",
- __FILE__, __LINE__);
-
-#endif
-
- rc = SQLPrepare(txstmt[i], (SQLCHAR *) tpcbXactStmt[i], SQL_NTS);
- handle_errors(hdbc, txstmt[i], rc, ABORT_DISCONNECT_EXIT,
- "preparing statement",
- __FILE__, __LINE__);
- }
-
- /* unuse dbs lock */
-#ifndef NDB
- if ( DBMSType == DBMS_TIMESTEN ) {
- rc = SQLExecDirect(hstmt, (SQLCHAR *)"call ttlocklevel('Row')", SQL_NTS);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "specifying row lock usage",
- __FILE__, __LINE__);
- }
-#endif
-
- /* commit transaction */
-
- rc = SQLTransact(henv, hdbc, SQL_COMMIT);
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- "committing transaction",
- __FILE__, __LINE__);
-
-
- /* Initialize random seed and timers */
-
- srand48(SeedVal);
- localLimit = (unsigned short)((1<<16) * 0.85);
-
- /* Initialize parameter lists for each of the transactions */
-
- rc = SQLBindParameter(txstmt[0], 1, SQL_PARAM_INPUT, SQL_C_DOUBLE,
- SQL_DOUBLE, 15, 0, &delta, sizeof delta, NULL);
- handle_errors(hdbc, txstmt[0], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[0], 2, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &accountNum, sizeof accountNum,
- NULL);
- handle_errors(hdbc, txstmt[0], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[1], 1, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &accountNum, sizeof accountNum,
- NULL);
- handle_errors(hdbc, txstmt[1], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[2], 1, SQL_PARAM_INPUT, SQL_C_DOUBLE,
- SQL_DOUBLE, 15, 0, &delta, sizeof delta, NULL);
- handle_errors(hdbc, txstmt[2], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[2], 2, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &tellerNum, sizeof tellerNum,
- NULL);
- handle_errors(hdbc, txstmt[2], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[3], 1, SQL_PARAM_INPUT, SQL_C_DOUBLE,
- SQL_DOUBLE, 15, 0, &delta, sizeof delta, NULL);
- handle_errors(hdbc, txstmt[3], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[3], 2, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &branchNum, sizeof branchNum,
- NULL);
- handle_errors(hdbc, txstmt[3], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[4], 1, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &tellerNum, sizeof tellerNum,
- NULL);
- handle_errors(hdbc, txstmt[4], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[4], 2, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &branchNum, sizeof branchNum,
- NULL);
- handle_errors(hdbc, txstmt[4], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[4], 3, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &accountNum, sizeof accountNum,
- NULL);
- handle_errors(hdbc, txstmt[4], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[4], 4, SQL_PARAM_INPUT, SQL_C_DOUBLE,
- SQL_DOUBLE, 15, 0, &delta, sizeof delta, NULL);
- handle_errors(hdbc, txstmt[4], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- rc = SQLBindParameter(txstmt[4], 5, SQL_PARAM_INPUT, SQL_C_SLONG,
- SQL_INTEGER, 10, 0, &timeStamp, sizeof timeStamp,
- NULL);
- handle_errors(hdbc, txstmt[4], rc, ABORT_DISCONNECT_EXIT,
- "binding parameter",
- __FILE__, __LINE__);
-
- /* Execute transaction loop.
- * Do it twice, once briefly as a warm-up. */
-
-
-
- for (warmup = 1; warmup >= 0; warmup--) {
-
- int max_i = (warmup ? numXacts/10 : numXacts);
-
- /* Execute tpcb transaction max_i times.*/
-
- if (warmup) {
- status_msg1("\nWarming up with %d tpcb transactions...\n", max_i);
- }
- else {
- status_msg1("Executing and timing %d tpcb transactions...\n", max_i);
- }
-
- ttGetWallClockTime(&startT);
- ttGetThreadTimes(&startRes);
-
- for (i = 0; i < max_i; i++) {
-
- lrand = lrand48();
- srands = (unsigned short *)(&lrand);
- if (lp64) srands += 2; /* skip high half -- all zero */
-
- /* randomly choose a teller */
-
- tellerNum = srands[0] % numTellerTups;
-
- /* compute branch */
-
- branchNum = (tellerNum / TellersPerBranch);
-
- /* randomly choose an account */
-
- if (srands[1] < localLimit || numBranchTups == 1) {
-
- /* choose account local to selected branch */
-
- accountNum = branchNum * AccountsPerBranch +
- (lrand48() % AccountsPerBranch);
-
- ++numLocalXacts;
-
- }
- else {
- /* choose account not local to selected branch */
-
- /* first select account in range [0,numNonLocalAccountTups) */
-
- accountNum = lrand48() % numNonLocalAccountTups;
-
- /* if branch number of selected account is at least as big
- * as local branch number, then increment account number
- * by AccountsPerBranch to skip over local accounts
- */
-
- if ((accountNum/AccountsPerBranch) >= branchNum)
- accountNum += AccountsPerBranch;
-
- ++numRemoteXacts;
- }
-
- /* select delta amount, -999,999 to +999,999 */
-
- delta = ((lrand48() % 1999999) - 999999);
-
-
- /* begin timing the "residence time" */
-
- ttGetWallClockTime(rtStart[i]);
-
- for ( j = 0; j < NumXactStmts - 2; j++) {
- rc = SQLExecute(txstmt[j]);
- handle_errors(hdbc, txstmt[j], rc, ABORT_DISCONNECT_EXIT,
- "Error executing statement1",
- __FILE__, __LINE__);
-
- /* Close the handle after the SELECT statement
- * (txstmt[1]) for non TimesTen DBMS' */
-
- if ((DBMSType != DBMS_TIMESTEN) && (j == 1)) {
- SQLFreeStmt(txstmt[1], SQL_CLOSE);
- }
-
-
- }
-
- /* note that time must be taken within the */
- timeStamp = time(NULL);
-
- rc = SQLExecute(txstmt[NumXactStmts - 1]);
- handle_errors(hdbc, txstmt[NumXactStmts - 1], rc,
- ABORT_DISCONNECT_EXIT, "Error executing statement2",
- __FILE__, __LINE__);
-
- rc = SQLTransact(henv, hdbc, SQL_COMMIT);
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- "Error committing transaction",
- __FILE__, __LINE__);
-
- ttGetWallClockTime(rtEnd[i]);
-
- } /* end fortransaction loop */
-
-
-
-
- ttGetThreadTimes(&endRes);
- ttGetWallClockTime(&endT);
- ttCalcElapsedThreadTimes(&startRes, &endRes, &kernel, &user);
- ttCalcElapsedWallClockTime(&startT, &endT, &real);
-
- if (warmup) {
- if (!tabFlag) {
- if (verbose) {
- if (fThreadTime) {
- out_msg0(" time user system\n");
-
- out_msg3("Warmup time (sec): %12.3f %12.3f %12.3f\n\n",
- real/1000.0, user, kernel);
- } else {
- out_msg1("Warmup time (sec): %12.3f\n\n", real/1000.0);
- }
- }
- } else {
- if (verbose) {
- if (fThreadTime) {
- out_msg0("\ttime\tuser\tsystem\n");
-
- out_msg3("Warmup time (sec):\t%12.3f\t%12.3f\t%12.3f\n",
- real/1000.0, user, kernel);
- } else {
- out_msg1("Warmup time (sec):\t%12.3f\n", real/1000.0);
- }
- }
- }
- }
- }
-
- status_msg0("\nExecution completed...\n");
-
- /* Compute and report timing statistics */
-
- maxTime = 0.0;
- totTime = 0.0;
-
- for (i = 0; i < numXacts; i++) {
- ttCalcElapsedWallClockTime(rtStart[i], rtEnd[i], resTime[i]);
- totTime += *(resTime[i]);
-
- if (*(resTime[i]) > maxTime) maxTime = *(resTime[i]);
- }
-
- if (!tabFlag) {
- if (verbose) {
- if (fThreadTime) {
- out_msg0(" time user system\n");
- out_msg3("Total time (sec): %12.3f %12.3f %12.3f\n",
- real/1000.0, user, kernel);
- } else {
- out_msg1("Total time (sec): %12.3f\n", real/1000.0);
- }
- }
-
- if (verbose)
- out_msg1("\nAverage transaction time (msec):%12.3f\n",
- totTime/numXacts);
- if (verbose)
- out_msg1("Maximum transaction time (msec):%12.3f\n", maxTime);
- if (verbose)
- out_msg1("\nLocal transactions: %7" PTRINT_FMT "\n", numLocalXacts);
- if (verbose)
- out_msg1("Remote transactions: %7" PTRINT_FMT "\n", numRemoteXacts);
-
- } else {
- if (verbose) {
- if (fThreadTime) {
- out_msg0("\ttime\tuser\tsystem\n");
- out_msg3("Total time (sec):\t%12.3f\t%12.3f\t%12.3f\n",
- real/1000.0, user, kernel);
- } else {
- out_msg1("Total time (sec):\t%12.3f\n", real/1000.0);
- }
- }
-
- if (verbose)
- out_msg1("\nAverage transaction time (msec):\t%12.3f\n",
- totTime/numXacts);
- if (verbose)
- out_msg1("Maximum transaction time (msec):\t%12.3f\n", maxTime);
- if (verbose)
- out_msg1("Local transactions:\t%7" PTRINT_FMT "\n", numLocalXacts);
-
- if (verbose)
- out_msg1("Remote transactions:\t%7" PTRINT_FMT "\n", numRemoteXacts);
-
-
-
- }
-
- /* If the statfile option is selected, print each transaction's time */
-
- if (printXactTimes) {
- FILE * fp;
- if ( (fp = fopen (statFile, "w")) == NULL ) {
- err_msg1("Unable to open stat file %s for writing\n\n", statFile);
- } else {
- for (int i = 0; i < numXacts; i++)
- fprintf(fp,"%6d: %12.3f\n", i, *(resTime[i]));
- fclose(fp);
- }
- }
-
- /* Disconnect and return */
-
- rc = SQLFreeStmt(hstmt, SQL_DROP);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "dropping the statement handle",
- __FILE__, __LINE__);
-
- for (int i=0; i<NumXactStmts; i++) {
- rc = SQLFreeStmt(txstmt[i], SQL_DROP);
- handle_errors(hdbc, hstmt, rc, ABORT_DISCONNECT_EXIT,
- "dropping the statement handle",
- __FILE__, __LINE__);
- }
-
- if (verbose >= VERBOSE_DFLT)
- status_msg0("Disconnecting from the data source...\n");
-
- rc = SQLDisconnect(hdbc);
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- "disconnecting",
- __FILE__, __LINE__);
-
- rc = SQLFreeConnect(hdbc);
- handle_errors(hdbc, NULL, rc, ERROR_EXIT,
- "freeing connection handle",
- __FILE__, __LINE__);
-
- rc = SQLFreeEnv(henv);
- handle_errors(NULL, NULL, rc, ERROR_EXIT,
- "freeing environment handle",
- __FILE__, __LINE__);
-
- app_exit(0);
- return 0;
-}
-
-
-
-
-
-/* Emacs variable settings */
-/* Local Variables: */
-/* tab-width:8 */
-/* indent-tabs-mode:nil */
-/* c-basic-offset:2 */
-/* End: */
-
-
-
diff --git a/ndb/test/odbc/tpcb/ttTime.c b/ndb/test/odbc/tpcb/ttTime.c
deleted file mode 100644
index 8f10b0c6b91..00000000000
--- a/ndb/test/odbc/tpcb/ttTime.c
+++ /dev/null
@@ -1,366 +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 */
-
-static const volatile char cvsid[] = "$Id: ttTime.c,v 1.1 2003/09/23 12:43:46 johan Exp $";
-/*
- * $Revision: 1.1 $
- * (c) Copyright 1996-2003, TimesTen, Inc.
- * All rights reserved.
- *
- */
-
-
-/* Contains functions for performing elapsed-time calculations
- in a portable manner */
-
-#include "ttTime.h"
-
-#ifdef WIN32
-
-#include <stdio.h>
-#include <mapiutil.h>
-
-/*------------*/
-/* NT VERSION */
-/*------------*/
-
-/*********************************************************************
- *
- * FUNCTION: ttGetThreadTimes
- *
- * DESCRIPTION: This function sets the supplied parameter's
- * user and kernel time for the current thread.
- *
- * PARAMETERS: ttThreadTimes* timesP thread time structure
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttGetThreadTimes(ttThreadTimes* timesP)
-{
- BOOL rc;
- HANDLE curThread;
- FILETIME creationTime;
- FILETIME exitTime;
- FILETIME kTime;
- FILETIME uTime;
-
- memset (&kTime, 0, sizeof (FILETIME));
- memset (&uTime, 0, sizeof (FILETIME));
-
- curThread = GetCurrentThread();
- rc = GetThreadTimes(curThread,
- &creationTime,
- &exitTime,
- &kTime,
- &uTime);
-
- timesP->kernelTime = kTime;
- timesP->userTime = uTime;
-
-}
-
-/*********************************************************************
- *
- * FUNCTION: ttCalcElapsedThreadTimes
- *
- * DESCRIPTION: This function calculates the user and kernel
- * time deltas.
- *
- * PARAMETERS: ttThreadTimes* beforeP beginning timestamp (IN)
- * ttThreadTimes* afterP ending timestamp (IN)
- * double* kernelDeltaP kernel time delta (OUT)
- * double* userDeltaP user time delta (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttCalcElapsedThreadTimes(ttThreadTimes* beforeP,
- ttThreadTimes* afterP,
- double* kernelDeltaP,
- double* userDeltaP)
-{
- static const double secPerHi = (double) 4.294967296; /* 2**32 * 10**-9 */
- FILETIME *before, *after;
-
- before = &beforeP->kernelTime;
- after = &afterP->kernelTime;
- *kernelDeltaP = (double) ((after->dwHighDateTime - before->dwHighDateTime) * secPerHi
- + (after->dwLowDateTime - before->dwLowDateTime) * 100e-9);
- before = &beforeP->userTime;
- after = &afterP->userTime;
- *userDeltaP = (double) ((after->dwHighDateTime - before->dwHighDateTime) * secPerHi
- + (after->dwLowDateTime - before->dwLowDateTime) * 100e-9);
-}
-
-/*********************************************************************
- *
- * FUNCTION: ttGetWallClockTime
- *
- * DESCRIPTION: This function gets the current wall-clock time.
- *
- * PARAMETERS: ttWallClockTime* timeP tms time structure (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttGetWallClockTime(ttWallClockTime* timeP)
-{
- LARGE_INTEGER frequency;
- if ( QueryPerformanceFrequency(&frequency) ) {
- QueryPerformanceCounter(&(timeP->time64));
- }
- else {
- _ftime(&(timeP->notSoLargeTime));
- }
-}
-
-/*********************************************************************
- *
- * FUNCTION: ttCalcElapsedWallClockTime
- *
- * DESCRIPTION: This function calculates the elapsed wall-clock
- * time in msec.
- *
- * PARAMETERS: ttWallClockTime* beforeP starting timestamp
- * ttWallClockTime* afterP ending timestamp
- * double* nmillisecondsP elapsed time (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttCalcElapsedWallClockTime(ttWallClockTime* beforeP,
- ttWallClockTime* afterP,
- double* nmillisecondsP)
-{
- LARGE_INTEGER frequency;
-
- if ( QueryPerformanceFrequency(&frequency) ) {
- *nmillisecondsP = 1000 * ((double) (afterP->time64.QuadPart
- - beforeP->time64.QuadPart))
- / frequency.QuadPart;
-
- }
- else {
- double start;
- double end;
-
- start = (double) beforeP->notSoLargeTime.time * 1000. +
- (double) beforeP->notSoLargeTime.millitm;
- end = (double) afterP->notSoLargeTime.time * 1000. +
- (double) afterP->notSoLargeTime.millitm;
-
- *nmillisecondsP = (double) (end - start);
- }
-}
-
-#elif defined (RTSYS_VXWORKS)
-
-/*-----------------*/
-/* VxWorks VERSION */
-/*-----------------*/
-
-/*
- * The TimeBase registers have a period of 60ns, i.e.
- * 0.00000006 or (6e-8) seconds.
- */
-#define TIMER_MSEC_PER_CYC (6e-5)
-
-void
-ttGetWallClockTime(ttWallClockTime* timeP)
-{
- vxTimeBaseGet(&timeP->sep.upper32, &timeP->sep.lower32);
-}
-
-
-void
-ttCalcElapsedWallClockTime(ttWallClockTime* beforeP,
- ttWallClockTime* afterP,
- double* nmillisecondsP)
-{
- *nmillisecondsP = (double)(afterP->val - beforeP->val) * TIMER_MSEC_PER_CYC;
-}
-
-
-#else
-
-/*--------------*/
-/* UNIX VERSION */
-/*--------------*/
-
-#include <unistd.h>
-
-/*********************************************************************
- *
- * FUNCTION: ttGetThreadTimes
- *
- * DESCRIPTION: This function sets the supplied parameter's
- * tms structure.
- *
- * PARAMETERS: ttThreadTimes* timesP tms time structure
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-#ifdef SB_P_OS_CHORUS
-void ttGetThreadTimes(ttThreadTimes* timesP)
-{
- KnCap actorCap;
-
- if (acap (agetId(), &actorCap) == -1) {
- timesP->ins.tmSec = 0;
- timesP->ins.tmNSec = 0;
- timesP->ext.tmSec = 0;
- timesP->ext.tmNSec = 0;
- }
- else {
- (void) threadTimes (&actorCap, K_ALLACTORTHREADS,
- &timesP->ins, &timesP->ext);
- }
-}
-#else
-void ttGetThreadTimes(ttThreadTimes* timesP)
-{
- (void) times(timesP);
-}
-#endif
-
-/*********************************************************************
- *
- * FUNCTION: ttCalcElapsedThreadTimes
- *
- * DESCRIPTION: This function calculates the user and kernel
- * time deltas.
- *
- * PARAMETERS: ttThreadTimes* beforeP beginning timestamp (IN)
- * ttThreadTimes* afterP ending timestamp (IN)
- * double* kernelDeltaP kernel time delta (OUT)
- * double* userDeltaP user time delta (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-#ifdef SB_P_OS_CHORUS
-void
-ttCalcElapsedThreadTimes(ttThreadTimes* beforeP,
- ttThreadTimes* afterP,
- double* kernelDeltaP,
- double* userDeltaP)
-{
- double kernelBefore;
- double kernelAfter;
- double userBefore;
- double userAfter;
-
- kernelBefore = (beforeP->ext.tmSec) + (beforeP->ext.tmNSec / 1e9);
- kernelAfter = (afterP->ext.tmSec) + (afterP->ext.tmNSec / 1e9);
- *kernelDeltaP = kernelAfter - kernelBefore;
-
- userBefore = (beforeP->ins.tmSec) + (beforeP->ins.tmNSec / 1e9);
- userAfter = (afterP->ins.tmSec) + (afterP->ins.tmNSec / 1e9);
- *userDeltaP = userAfter - userBefore;
-
-}
-#else
-void
-ttCalcElapsedThreadTimes(ttThreadTimes* beforeP,
- ttThreadTimes* afterP,
- double* kernelDeltaP,
- double* userDeltaP)
-{
- double ticks = (double)sysconf(_SC_CLK_TCK);
-
- *kernelDeltaP = (afterP->tms_stime - beforeP->tms_stime) / ticks;
- *userDeltaP = (afterP->tms_utime - beforeP->tms_utime) / ticks;
-}
-#endif
-
-/*********************************************************************
- *
- * FUNCTION: ttGetWallClockTime
- *
- * DESCRIPTION: This function gets the current wall-clock time.
- *
- * PARAMETERS: ttWallClockTime* timeP tms time structure (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttGetWallClockTime(ttWallClockTime* timeP)
-{
- gettimeofday(timeP, NULL);
-}
-
-/*********************************************************************
- *
- * FUNCTION: ttCalcElapsedWallClockTime
- *
- * DESCRIPTION: This function calculates the elapsed wall-clock
- * time is msec.
- *
- * PARAMETERS: ttWallClockTime* beforeP starting timestamp
- * ttWallClockTime* afterP ending timestamp
- * double* nmillisecondsP elapsed time (OUT)
- *
- * RETURNS: void
- *
- * NOTES: NONE
- *
- *********************************************************************/
-
-void
-ttCalcElapsedWallClockTime(ttWallClockTime* beforeP,
- ttWallClockTime* afterP,
- double* nmillisP)
-{
- *nmillisP = (afterP->tv_sec - beforeP->tv_sec)*1000.0 +
- (afterP->tv_usec - beforeP->tv_usec)/1000.0;
-}
-
-#endif
-
-/* Emacs variable settings */
-/* Local Variables: */
-/* tab-width:8 */
-/* indent-tabs-mode:nil */
-/* c-basic-offset:2 */
-/* End: */
diff --git a/ndb/test/odbc/tpcb/ttTime.h b/ndb/test/odbc/tpcb/ttTime.h
deleted file mode 100644
index f78b71667fe..00000000000
--- a/ndb/test/odbc/tpcb/ttTime.h
+++ /dev/null
@@ -1,125 +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 */
-
-/*
- * $Revision: 1.1 $
- * (c) Copyright 1996-2003, TimesTen, Inc.
- * All rights reserved.
- *
- */
-
-#ifndef __TT_TIME
-#define __TT_TIME
-
-
-#ifdef WIN32
-
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/timeb.h>
-
-typedef struct {
- FILETIME kernelTime;
- FILETIME userTime;
-} ttThreadTimes;
-
-
-typedef union {
- LARGE_INTEGER time64;
- struct _timeb notSoLargeTime;
-} ttWallClockTime;
-
-#elif defined(RTSYS_VXWORKS)
-
-#define srand48(x) sb_srand48((x))
-#define drand48() sb_drand48()
-
-#ifdef SB_P_OS_VXPPC
-/* For little-endian switch the lower, upper fields */
-typedef union {
- struct {
- unsigned int upper32;
- unsigned int lower32;
- } sep;
- long long val;
-} ttWallClockTime;
-
-/*
- * This is a VxWorks private function to read the PPC's 64 bit Time Base
- * Register. This is the assembler dump of this function.
- 001126e4 7cad42e6 mftb r5, TBU
- 001126e8 7ccc42e6 mftb r6, TBL
- 001126ec 7ced42e6 mftb r7, TBU
- 001126f0 7c053800 cmp crf0, 0, r5, r7
- 001126f4 4082fff0 bc 0x4, 0x2, vxTimeBaseGet
- 001126f8 90a30000 stw r5, 0x0(r3)
- 001126fc 90c40000 stw r6, 0x0(r4)
- 00112700 4e800020 blr
- * This is a fine grained timer with a period of 60ns.
- */
-void vxTimeBaseGet(unsigned int* pUpper32, unsigned int* pLower32);
-#endif /* SB_P_OS_VXPPC */
-
-#elif defined(SB_P_OS_CHORUS)
-#include <sys/types.h>
-#include <sys/times.h>
-#include <sys/time.h>
-
-#include <vtimer/chVtimer.h>
-
-struct chrTimes {
- KnTimeVal ins;
- KnTimeVal ext;
-};
-typedef struct chrTimes ttThreadTimes;
-
-typedef struct timeval ttWallClockTime;
-
-#else
-/* UNIX version */
-
-#include <sys/times.h>
-#include <sys/time.h>
-
-typedef struct tms ttThreadTimes;
-
-typedef struct timeval ttWallClockTime;
-
-#endif /* NT, VxWorks, Chorus, Unix */
-
-
-#ifndef RTSYS_VXWORKS
-void ttGetThreadTimes(ttThreadTimes* timesP);
-void ttCalcElapsedThreadTimes(ttThreadTimes* beforeP, ttThreadTimes* afterP,
- double* kernelDeltaP, double* userDeltaP);
-#endif /* ! VXWORKS */
-void ttGetWallClockTime(ttWallClockTime* timeP);
-void ttCalcElapsedWallClockTime(ttWallClockTime* beforeP,
- ttWallClockTime* afterP,
- double* nmillisecondsP);
-
-
-
-
-
-#endif /* __TT_TIME */
-
-/* Emacs variable settings */
-/* Local Variables: */
-/* tab-width:8 */
-/* indent-tabs-mode:nil */
-/* c-basic-offset:2 */
-/* End: */
diff --git a/ndb/test/run-test/Makefile.am b/ndb/test/run-test/Makefile.am
index 1eac96e7ac7..c890536dcc6 100644
--- a/ndb/test/run-test/Makefile.am
+++ b/ndb/test/run-test/Makefile.am
@@ -11,9 +11,8 @@ test_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
atrt_SOURCES = main.cpp
-INCLUDES_LOC = -I$(top_srcdir)/ndb/test/include -I$(top_srcdir)/ndb/src/mgmclient
-LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CpcClient.o \
- $(top_builddir)/ndb/test/src/libNDBT.a \
+INCLUDES_LOC = -I$(top_srcdir)/ndb/test/include
+LDADD_LOC = $(top_builddir)/ndb/test/src/libNDBT.a \
$(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
diff --git a/ndb/test/run-test/Makefile_old b/ndb/test/run-test/Makefile_old
deleted file mode 100644
index 6b4689b2dbb..00000000000
--- a/ndb/test/run-test/Makefile_old
+++ /dev/null
@@ -1,22 +0,0 @@
-include .defs.mk
-
-TYPE := util
-
-BIN_TARGET := atrt
-BIN_TARGET_LIBS := mgmapi
-
-SOURCES = main.cpp
-SCRIPTS = atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
- atrt-clear-result.sh make-config.sh
-
-OBJECTS_LOC = $(call fixpath,$(NDB_TOP)/src/mgmclient/CpcClient.o)
-
-CFLAGS_main.cpp := -I$(call fixpath,$(NDB_TOP)/src/mgmclient)
-CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/mgmapi)
-
-include $(NDB_TOP)/Epilogue.mk
-
-_bins::
- -rm -f $(SCRIPTS:%=$(NDB_TOP)/bin/%)
- cp $(SCRIPTS) $(NDB_TOP)/bin
-
diff --git a/ndb/src/mgmclient/CpcClient.cpp b/ndb/test/src/CpcClient.cpp
index d407ba65312..d407ba65312 100644
--- a/ndb/src/mgmclient/CpcClient.cpp
+++ b/ndb/test/src/CpcClient.cpp
diff --git a/ndb/test/src/Makefile.am b/ndb/test/src/Makefile.am
index a8f34a0ea22..56f3d6a1ec6 100644
--- a/ndb/test/src/Makefile.am
+++ b/ndb/test/src/Makefile.am
@@ -9,7 +9,8 @@ libNDBT_a_SOURCES = \
HugoAsynchTransactions.cpp UtilTransactions.cpp \
NdbRestarter.cpp NdbRestarts.cpp NDBT_Output.cpp \
NdbBackup.cpp NdbConfig.cpp NdbGrep.cpp NDBT_Table.cpp \
- NdbSchemaCon.cpp NdbSchemaOp.cpp getarg.c
+ NdbSchemaCon.cpp NdbSchemaOp.cpp getarg.c \
+ CpcClient.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
diff --git a/ndb/test/src/Makefile_old b/ndb/test/src/Makefile_old
deleted file mode 100644
index 2738ce1aba2..00000000000
--- a/ndb/test/src/Makefile_old
+++ /dev/null
@@ -1,33 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapitest
-
-ARCHIVE_TARGET := NDBT
-
-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
-
-SOURCES.c =
-
-CFLAGS_NdbRestarter.cpp := -I$(call fixpath,$(NDB_TOP)/src/common/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/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/tools/Makefile.am b/ndb/test/tools/Makefile.am
index 8d94c21b721..3255267b636 100644
--- a/ndb/test/tools/Makefile.am
+++ b/ndb/test/tools/Makefile.am
@@ -20,12 +20,10 @@ 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
+ndb_cpcc_LDADD = $(LDADD)
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/ndb/test/tools/Makefile_old b/ndb/test/tools/Makefile_old
deleted file mode 100644
index b8e90ae207f..00000000000
--- a/ndb/test/tools/Makefile_old
+++ /dev/null
@@ -1,9 +0,0 @@
-include .defs.mk
-
-DIRS := hugoCalculator hugoFill hugoLoad hugoLockRecords \
- hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate \
- hugoScanRead hugoScanUpdate restart waiter
-
-include $(NDB_TOP)/Epilogue.mk
-
-_bins_ndbapi : _libs_src
diff --git a/ndb/test/tools/old_dirs/waiter/Makefile_old b/ndb/test/tools/old_dirs/waiter/Makefile_old
deleted file mode 100644
index da2c9daff00..00000000000
--- a/ndb/test/tools/old_dirs/waiter/Makefile_old
+++ /dev/null
@@ -1,11 +0,0 @@
-include .defs.mk
-
-TYPE := ndbapitest
-
-BIN_TARGET := waiter
-
-# Source files of non-templated classes (.C files)
-SOURCES = waiter.cpp
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/tools/Makefile.am b/ndb/tools/Makefile.am
index 64625f69ea2..7a61a9b1be5 100644
--- a/ndb/tools/Makefile.am
+++ b/ndb/tools/Makefile.am
@@ -1,5 +1,6 @@
ndbtools_PROGRAMS = \
+ ndb_test_platform \
ndb_waiter \
ndb_drop_table \
ndb_delete_all \
@@ -7,22 +8,34 @@ ndbtools_PROGRAMS = \
ndb_drop_index \
ndb_show_tables \
ndb_select_all \
- ndb_select_count
+ ndb_select_count \
+ ndb_restore
-tools_common_sources = ../test/src/NDBT_ReturnCodes.cpp ../test/src/NDBT_Table.cpp ../test/src/NDBT_Output.cpp
+tools_common_sources = ../test/src/NDBT_ReturnCodes.cpp \
+ ../test/src/NDBT_Table.cpp \
+ ../test/src/NDBT_Output.cpp
+ndb_test_platform_SOURCES = ndb_test_platform.cpp
ndb_waiter_SOURCES = waiter.cpp $(tools_common_sources)
ndb_delete_all_SOURCES = delete_all.cpp $(tools_common_sources)
ndb_desc_SOURCES = desc.cpp $(tools_common_sources)
ndb_drop_index_SOURCES = drop_index.cpp $(tools_common_sources)
ndb_drop_table_SOURCES = drop_tab.cpp $(tools_common_sources)
ndb_show_tables_SOURCES = listTables.cpp $(tools_common_sources)
-ndb_select_all_SOURCES = select_all.cpp ../test/src/NDBT_ResultRow.cpp $(tools_common_sources)
+ndb_select_all_SOURCES = select_all.cpp \
+ ../test/src/NDBT_ResultRow.cpp \
+ $(tools_common_sources)
ndb_select_count_SOURCES = select_count.cpp $(tools_common_sources)
+ndb_restore_SOURCES = restore/restore_main.cpp \
+ restore/consumer.cpp \
+ restore/consumer_restore.cpp \
+ restore/consumer_printer.cpp \
+ restore/Restore.cpp
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapitools.mk.am
+ndb_test_platform_LDFLAGS = @ndb_bin_am_ldflags@
ndb_waiter_LDFLAGS = @ndb_bin_am_ldflags@
ndb_drop_table_LDFLAGS = @ndb_bin_am_ldflags@
ndb_delete_all_LDFLAGS = @ndb_bin_am_ldflags@
@@ -31,6 +44,7 @@ ndb_drop_index_LDFLAGS = @ndb_bin_am_ldflags@
ndb_show_tables_LDFLAGS = @ndb_bin_am_ldflags@
ndb_select_all_LDFLAGS = @ndb_bin_am_ldflags@
ndb_select_count_LDFLAGS = @ndb_bin_am_ldflags@
+ndb_restore_LDFLAGS = @ndb_bin_am_ldflags@
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/ndb/tools/Makefile_old b/ndb/tools/Makefile_old
deleted file mode 100644
index b9dc6883e18..00000000000
--- a/ndb/tools/Makefile_old
+++ /dev/null
@@ -1,12 +0,0 @@
-include .defs.mk
-
-BIN_DIRS = select_all select_count desc list_tables \
- drop_tab delete_all copy_tab \
- create_index drop_index verify_index cpcc
-
-ifneq ($(NDB_ODBC),N)
-BIN_DIRS += ndbsql
-endif
-
-include $(NDB_TOP)/Epilogue.mk
-
diff --git a/ndb/tools/ndb_test_platform.cpp b/ndb/tools/ndb_test_platform.cpp
new file mode 100644
index 00000000000..72dd146dacd
--- /dev/null
+++ b/ndb/tools/ndb_test_platform.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 <my_sys.h>
+#include <BaseString.hpp>
+
+/*
+ * Test BaseString::snprintf
+ */
+
+static
+int test_snprintf(const char * fmt, int buf_sz, int result)
+{
+ int ret;
+ char buf[100];
+ ret = BaseString::snprintf(buf, buf_sz, fmt);
+
+ if(ret < 0)
+ {
+ printf("BaseString::snprint returns %d with size=%d and strlen(fmt)=%d\n",
+ ret, buf_sz, strlen(fmt));
+ return -1;
+ }
+
+ if(ret+1 == buf_sz)
+ {
+ printf("BaseString::snprint truncates returns %d with size=%d and strlen(fmt)=%d\n",
+ ret, buf_sz, strlen(fmt));
+ return -1;
+ }
+
+ if(ret != result)
+ {
+ printf("BaseString::snprint returns incorrect value: returned=%d != expected=%d\n",
+ ret, result);
+ return -1;
+ }
+
+ for(ret = 0; ret+1 < buf_sz && ret < result; ret++)
+ {
+ if(buf[ret] != fmt[ret])
+ {
+ printf("BaseString::snprint Incorrect value in output buffer: "
+ "size=%d returned=expected=%d at pos=%d result=%d != expected=%d\n",
+ buf_sz, result, ret, buf[ret], fmt[ret]);
+ return -1;
+ }
+ }
+ return 0;
+}
+
+int
+main(void)
+{
+ /*
+ * Test BaseString::snprintf
+ */
+
+ if(test_snprintf("test", 1, 4))
+ return -1;
+
+ if(test_snprintf("test", 0, 4))
+ return -1;
+
+ if(test_snprintf("test", 100, 4))
+ return -1;
+
+ /*
+ * Test UintPtr
+ */
+
+ if (sizeof(UintPtr) != sizeof(Uint32*))
+ {
+ printf("sizeof(UintPtr)=%d != sizeof(Uint32*)=%d\n",
+ sizeof(UintPtr), sizeof(Uint32*));
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.cpp b/ndb/tools/restore/Restore.cpp
index fb3bde6bdef..6e2fcaed3af 100644
--- a/ndb/src/kernel/blocks/backup/restore/Restore.cpp
+++ b/ndb/tools/restore/Restore.cpp
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "Restore.hpp"
-#include "BackupFormat.hpp"
#include <NdbTCP.h>
#include <OutputStream.hpp>
#include <Bitmask.hpp>
@@ -25,9 +24,6 @@
#include <SimpleProperties.hpp>
#include <signaldata/DictTabInfo.hpp>
-// from src/ndbapi
-#include <NdbDictionaryImpl.hpp>
-
Uint16 Twiddle16(Uint16 in); // Byte shift 16-bit data
Uint32 Twiddle32(Uint32 in); // Byte shift 32-bit data
Uint64 Twiddle64(Uint64 in); // Byte shift 64-bit data
diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.hpp b/ndb/tools/restore/Restore.hpp
index 0ec1ab852e9..82fcdcdb183 100644
--- a/ndb/src/kernel/blocks/backup/restore/Restore.hpp
+++ b/ndb/tools/restore/Restore.hpp
@@ -19,7 +19,8 @@
#include <ndb_global.h>
#include <NdbOut.hpp>
-#include <BackupFormat.hpp>
+#include "../src/kernel/blocks/backup/BackupFormat.hpp"
+#include "../src/ndbapi/NdbDictionaryImpl.hpp"
#include <NdbApi.hpp>
#include <ndb_version.h>
diff --git a/ndb/src/kernel/blocks/backup/restore/consumer.cpp b/ndb/tools/restore/consumer.cpp
index e94c31b2666..e94c31b2666 100644
--- a/ndb/src/kernel/blocks/backup/restore/consumer.cpp
+++ b/ndb/tools/restore/consumer.cpp
diff --git a/ndb/src/kernel/blocks/backup/restore/consumer.hpp b/ndb/tools/restore/consumer.hpp
index 692c814159f..692c814159f 100644
--- a/ndb/src/kernel/blocks/backup/restore/consumer.hpp
+++ b/ndb/tools/restore/consumer.hpp
diff --git a/ndb/src/kernel/blocks/backup/restore/consumer_printer.cpp b/ndb/tools/restore/consumer_printer.cpp
index 0aa5b521d29..0aa5b521d29 100644
--- a/ndb/src/kernel/blocks/backup/restore/consumer_printer.cpp
+++ b/ndb/tools/restore/consumer_printer.cpp
diff --git a/ndb/src/kernel/blocks/backup/restore/consumer_printer.hpp b/ndb/tools/restore/consumer_printer.hpp
index 7cbc924e364..7cbc924e364 100644
--- a/ndb/src/kernel/blocks/backup/restore/consumer_printer.hpp
+++ b/ndb/tools/restore/consumer_printer.hpp
diff --git a/ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp b/ndb/tools/restore/consumer_restore.cpp
index a35d9d22c65..e2c55e5a0b1 100644
--- a/ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp
+++ b/ndb/tools/restore/consumer_restore.cpp
@@ -16,7 +16,6 @@
#include "consumer_restore.hpp"
#include <NdbSleep.h>
-#include <NdbDictionaryImpl.hpp>
extern FilteredNdbOut err;
extern FilteredNdbOut info;
diff --git a/ndb/src/kernel/blocks/backup/restore/consumer_restore.hpp b/ndb/tools/restore/consumer_restore.hpp
index 59e2734ea1f..59e2734ea1f 100644
--- a/ndb/src/kernel/blocks/backup/restore/consumer_restore.hpp
+++ b/ndb/tools/restore/consumer_restore.hpp
diff --git a/ndb/src/kernel/blocks/backup/restore/consumer_restorem.cpp b/ndb/tools/restore/consumer_restorem.cpp
index 6a9ec07148a..6a9ec07148a 100644
--- a/ndb/src/kernel/blocks/backup/restore/consumer_restorem.cpp
+++ b/ndb/tools/restore/consumer_restorem.cpp
diff --git a/ndb/src/kernel/blocks/backup/restore/main.cpp b/ndb/tools/restore/restore_main.cpp
index 482212911cb..c43791c6723 100644
--- a/ndb/src/kernel/blocks/backup/restore/main.cpp
+++ b/ndb/tools/restore/restore_main.cpp
@@ -74,7 +74,7 @@ static struct my_option my_long_options[] =
"No of parallel transactions during restore of data."
"(parallelism can be 1 to 1024)",
(gptr*) &ga_nParallelism, (gptr*) &ga_nParallelism, 0,
- GET_INT, REQUIRED_ARG, 128, 0, 0, 0, 0, 0 },
+ GET_INT, REQUIRED_ARG, 128, 1, 1024, 0, 1, 0 },
{ "print", 256, "Print data and log to stdout",
(gptr*) &_print, (gptr*) &_print, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
@@ -120,6 +120,20 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'V':
print_version();
exit(0);
+ case 'n':
+ if (ga_nodeId == 0)
+ {
+ printf("Error in --nodeid,-n setting, see --help\n");
+ exit(1);
+ }
+ break;
+ case 'b':
+ if (ga_backupId == 0)
+ {
+ printf("Error in --backupid,-b setting, see --help\n");
+ exit(1);
+ }
+ break;
case '?':
usage();
exit(0);
@@ -131,11 +145,8 @@ readArguments(int *pargc, char*** pargv)
{
const char *load_default_groups[]= { "ndb_tools","ndb_restore",0 };
load_defaults("my",load_default_groups,pargc,pargv);
- if (handle_options(pargc, pargv, my_long_options, get_one_option) ||
- ga_nodeId == 0 ||
- ga_backupId == 0 ||
- ga_nParallelism < 1 ||
- ga_nParallelism >1024) {
+ if (handle_options(pargc, pargv, my_long_options, get_one_option))
+ {
exit(1);
}
@@ -343,7 +354,8 @@ main(int argc, char** argv)
if (res < 0)
{
- err << "Restore: An error occured while restoring data. Exiting... res=" << res << endl;
+ err << "Restore: An error occured while restoring data. Exiting... "
+ << "res=" << res << endl;
return -1;
}
@@ -369,7 +381,8 @@ main(int argc, char** argv)
}
if (res < 0)
{
- err << "Restore: An restoring the data log. Exiting... res=" << res << endl;
+ err << "Restore: An restoring the data log. Exiting... res="
+ << res << endl;
return -1;
}
logIter.validateFooter(); //not implemented
diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp
index c9e76bb8ed3..e24164ea807 100644
--- a/ndb/tools/waiter.cpp
+++ b/ndb/tools/waiter.cpp
@@ -23,12 +23,13 @@
#include <NdbOut.hpp>
#include <NdbSleep.h>
#include <kernel/ndb_limits.h>
-#include "../include/mgmcommon/LocalConfig.hpp"
+#include <LocalConfig.hpp>
#include <NDBT.hpp>
int
-waitClusterStatus(const char* _addr, ndb_mgm_node_status _status, unsigned int _timeout);
+waitClusterStatus(const char* _addr, ndb_mgm_node_status _status,
+ unsigned int _timeout);
static const char* opt_connect_str= 0;
static int _no_contact = 0;
@@ -86,7 +87,7 @@ int main(int argc, char** argv){
if (_hostName == NULL){
LocalConfig lcfg;
- if(!lcfg.init())
+ if(!lcfg.init(opt_connect_str, 0))
{
lcfg.printError();
lcfg.printUsage();
diff --git a/scripts/fill_help_tables.sh b/scripts/fill_help_tables.sh
index cb5437f7178..78dfe7b6088 100644
--- a/scripts/fill_help_tables.sh
+++ b/scripts/fill_help_tables.sh
@@ -197,6 +197,10 @@ sub prepare_name
$a =~ s/(\@node(.*?)\n)/ /g;
$a =~ s/(\@tab)/\t/g;
$a =~ s/\@item/ /g;
+ $a =~ s/\@minus\{\}/-/g;
+ $a =~ s/\@dots\{\}/.../g;
+ $a =~ s/\@var\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@command\{((.|\n)+?)\}/$1/go;
$a =~ s/\@code\{((.|\n)+?)\}/$1/go;
$a =~ s/\@strong\{(.+?)\}/$1/go;
$a =~ s/\@samp\{(.+?)\}/$1/go;
@@ -244,6 +248,10 @@ sub prepare_description
$a =~ s/(\@item)/ /g;
$a =~ s/(\@tindex\s(.*?)\n)//g;
$a =~ s/(\@c\s(.*?)\n)//g;
+ $a =~ s/\@minus\{\}/-/g;
+ $a =~ s/\@dots\{\}/.../g;
+ $a =~ s/\@var\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@command\{((.|\n)+?)\}/$1/go;
$a =~ s/\@code\{((.|\n)+?)\}/$1/go;
$a =~ s/\@strong\{(.+?)\}/$1/go;
$a =~ s/\@samp\{(.+?)\}/$1/go;
@@ -273,6 +281,8 @@ sub prepare_example
$a =~ s/(^\@c for_help_topic(.*?)\n)//g;
+ $a =~ s/\@var\{((.|\n)+?)\}/$1/go;
+ $a =~ s/\@dots\{\}/.../g;
$a =~ s/\\/\\\\/g;
$a =~ s/(\@{)/{/g;
$a =~ s/(\@})/}/g;
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index b9e7ce21f79..da7e06f6c05 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -315,7 +315,7 @@ do
break
fi
- if test @IS_LINUX@ -a $KILL_MYSQLD -eq 1
+ if @IS_LINUX@ && test $KILL_MYSQLD -eq 1
then
# Test if one process was hanging.
# This is only a fix for Linux (running as base 3 mysqld processes)
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 6c020466e1e..29935696b7d 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -343,7 +343,8 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
(l_time->month || l_time->day))
l_time->year+= (l_time->year < YY_PART_YEAR ? 2000 : 1900);
- if (number_of_fields < 3 || l_time->month > 12 ||
+ if (number_of_fields < 3 ||
+ l_time->year > 9999 || l_time->month > 12 ||
l_time->day > 31 || l_time->hour > 23 ||
l_time->minute > 59 || l_time->second > 59 ||
(!(flags & TIME_FUZZY_DATE) && (l_time->month == 0 || l_time->day == 0)))
@@ -664,6 +665,10 @@ my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap)
I couldn't come up with a better way to get a repeatable result :(
We can't use mktime() as it's buggy on many platforms and not thread safe.
+
+ Note: this code assumes that our time_t estimation is not too far away
+ from real value (we assume that localtime_r(tmp) will return something
+ within 24 hrs from t) which is probably true for all current time zones.
*/
tmp=(time_t) (((calc_daynr((uint) t->year,(uint) t->month,(uint) t->day) -
(long) days_at_timestart)*86400L + (long) t->hour*3600L +
@@ -676,7 +681,8 @@ my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap)
for (loop=0;
loop < 2 &&
(t->hour != (uint) l_time->tm_hour ||
- t->minute != (uint) l_time->tm_min);
+ t->minute != (uint) l_time->tm_min ||
+ t->second != (uint) l_time->tm_sec);
loop++)
{ /* One check should be enough ? */
/* Get difference in days */
@@ -686,15 +692,22 @@ my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap)
else if (days > 1)
days= -1;
diff=(3600L*(long) (days*24+((int) t->hour - (int) l_time->tm_hour)) +
- (long) (60*((int) t->minute - (int) l_time->tm_min)));
+ (long) (60*((int) t->minute - (int) l_time->tm_min)) +
+ (long) ((int) t->second - (int) l_time->tm_sec));
current_timezone+= diff+3600; /* Compensate for -3600 above */
tmp+= (time_t) diff;
localtime_r(&tmp,&tm_tmp);
l_time=&tm_tmp;
}
/*
- Fix that if we are in the not existing daylight saving time hour
- we move the start of the next real hour
+ Fix that if we are in the non existing daylight saving time hour
+ we move the start of the next real hour.
+
+ This code doesn't handle such exotical thing as time-gaps whose length
+ is more than one hour or non-integer (latter can theoretically happen
+ if one of seconds will be removed due leap correction, or because of
+ general time correction like it happened for Africa/Monrovia time zone
+ in year 1972).
*/
if (loop == 2 && t->hour != (uint) l_time->tm_hour)
{
@@ -704,7 +717,8 @@ my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap)
else if (days > 1)
days= -1;
diff=(3600L*(long) (days*24+((int) t->hour - (int) l_time->tm_hour))+
- (long) (60*((int) t->minute - (int) l_time->tm_min)));
+ (long) (60*((int) t->minute - (int) l_time->tm_min)) +
+ (long) ((int) t->second - (int) l_time->tm_sec));
if (diff == 3600)
tmp+=3600 - t->minute*60 - t->second; /* Move to next hour */
else if (diff == -3600)
@@ -720,10 +734,10 @@ my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap)
/* Set MYSQL_TIME structure to 0000-00-00 00:00:00.000000 */
-void set_zero_time(MYSQL_TIME *tm)
+void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type)
{
bzero((void*) tm, sizeof(*tm));
- tm->time_type= MYSQL_TIMESTAMP_NONE;
+ tm->time_type= time_type;
}
diff --git a/sql/field.cc b/sql/field.cc
index 24bd0c48c92..72c27b6adf9 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4086,6 +4086,10 @@ int Field_datetime::store(longlong nr)
void Field_datetime::store_time(TIME *ltime,timestamp_type type)
{
longlong tmp;
+ /*
+ We don't perform range checking here since values stored in TIME
+ structure always fit into DATETIME range.
+ */
if (type == MYSQL_TIMESTAMP_DATE || type == MYSQL_TIMESTAMP_DATETIME)
tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*LL(1000000)+
(ltime->hour*10000L+ltime->minute*100+ltime->second));
@@ -4390,6 +4394,8 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)),
int Field_string::cmp(const char *a_ptr, const char *b_ptr)
{
+ uint a_len, b_len;
+
if (field_charset->strxfrm_multiply > 1)
{
/*
@@ -4401,10 +4407,19 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
(const uchar*) b_ptr,
field_length);
}
- return my_strnncoll(field_charset,(const uchar*) a_ptr, field_length,
- (const uchar*) b_ptr, field_length);
+ if (field_charset->mbmaxlen != 1)
+ {
+ uint char_len= field_length/field_charset->mbmaxlen;
+ a_len= my_charpos(field_charset, a_ptr, a_ptr + field_length, char_len);
+ b_len= my_charpos(field_charset, b_ptr, b_ptr + field_length, char_len);
+ }
+ else
+ a_len= b_len= field_length;
+ return my_strnncoll(field_charset,(const uchar*) a_ptr, a_len,
+ (const uchar*) b_ptr, b_len);
}
+
void Field_string::sort_string(char *to,uint length)
{
uint tmp=my_strnxfrm(field_charset,
@@ -5930,8 +5945,15 @@ Field *make_field(char *ptr, uint32 field_length,
if (f_is_alpha(pack_flag))
{
if (!f_is_packed(pack_flag))
- return new Field_string(ptr,field_length,null_pos,null_bit,
- unireg_check, field_name, table, field_charset);
+ {
+ if (field_type == FIELD_TYPE_STRING ||
+ field_type == FIELD_TYPE_DECIMAL || // 3.23 or 4.0 string
+ field_type == FIELD_TYPE_VAR_STRING)
+ return new Field_string(ptr,field_length,null_pos,null_bit,
+ unireg_check, field_name, table,
+ field_charset);
+ return 0; // Error
+ }
uint pack_length=calc_pack_length((enum_field_types)
f_packtype(pack_flag),
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 890687fc925..61a5a28f47b 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -473,7 +473,7 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
{
if (to->flags & BLOB_FLAG)
{
- if (!(from->flags & BLOB_FLAG))
+ if (!(from->flags & BLOB_FLAG) || from->charset() != to->charset())
return do_conv_blob;
if (from_length != to_length ||
to->table->db_low_byte_first != from->table->db_low_byte_first)
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 09b3e340d1f..2c7cce4bcd0 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -234,13 +234,13 @@ int berkeley_show_logs(Protocol *protocol)
{
char **all_logs, **free_logs, **a, **f;
int error=1;
- MEM_ROOT show_logs_root;
- MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
+ MEM_ROOT **root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC);
+ MEM_ROOT show_logs_root, *old_mem_root= *root_ptr;
DBUG_ENTER("berkeley_show_logs");
init_sql_alloc(&show_logs_root, BDB_LOG_ALLOC_BLOCK_SIZE,
BDB_LOG_ALLOC_BLOCK_SIZE);
- my_pthread_setspecific_ptr(THR_MALLOC,&show_logs_root);
+ *root_ptr= &show_logs_root;
if ((error= db_env->log_archive(db_env, &all_logs,
DB_ARCH_ABS | DB_ARCH_LOG)) ||
@@ -277,15 +277,17 @@ int berkeley_show_logs(Protocol *protocol)
}
err:
free_root(&show_logs_root,MYF(0));
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ *root_ptr= old_mem_root;
DBUG_RETURN(error);
}
+
static void berkeley_print_error(const char *db_errpfx, char *buffer)
{
sql_print_error("%s: %s",db_errpfx,buffer); /* purecov: tested */
}
+
static void berkeley_noticecall(DB_ENV *db_env, db_notices notice)
{
switch (notice)
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index 19b15c6fbcc..dbcf7bc9197 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -30,6 +30,18 @@
const char **ha_heap::bas_ext() const
{ static const char *ext[1]= { NullS }; return ext; }
+/*
+ Hash index statistics is updated (copied from HP_KEYDEF::hash_buckets to
+ rec_per_key) after 1/HEAP_STATS_UPDATE_THRESHOLD fraction of table records
+ have been inserted/updated/deleted. delete_all_rows() and table flush cause
+ immediate update.
+
+ NOTE
+ hash index statistics must be updated when number of table records changes
+ from 0 to non-zero value and vice versa. Otherwise records_in_range may
+ erroneously return 0 and 'range' may miss records.
+*/
+#define HEAP_STATS_UPDATE_THRESHOLD 10
int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
@@ -48,6 +60,8 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
/* Initialize variables for the opened table */
set_keys_for_scanning();
+ if (table->tmp_table == NO_TMP_TABLE)
+ update_key_stats();
}
return (file ? 0 : 1);
}
@@ -84,28 +98,58 @@ void ha_heap::set_keys_for_scanning(void)
}
}
+void ha_heap::update_key_stats()
+{
+ for (uint i= 0; i < table->keys; i++)
+ {
+ KEY *key=table->key_info+i;
+ if (key->algorithm != HA_KEY_ALG_BTREE)
+ {
+ ha_rows hash_buckets= file->s->keydef[i].hash_buckets;
+ key->rec_per_key[key->key_parts-1]=
+ hash_buckets ? file->s->records/hash_buckets : 0;
+ }
+ }
+ records_changed= 0;
+}
+
int ha_heap::write_row(byte * buf)
{
+ int res;
statistic_increment(ha_write_count,&LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
if (table->next_number_field && buf == table->record[0])
update_auto_increment();
- return heap_write(file,buf);
+ res= heap_write(file,buf);
+ if (!res && table->tmp_table == NO_TMP_TABLE &&
+ ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records)
+ update_key_stats();
+ return res;
}
int ha_heap::update_row(const byte * old_data, byte * new_data)
{
+ int res;
statistic_increment(ha_update_count,&LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
- return heap_update(file,old_data,new_data);
+ res= heap_update(file,old_data,new_data);
+ if (!res && table->tmp_table == NO_TMP_TABLE &&
+ ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records)
+ update_key_stats();
+ return res;
}
int ha_heap::delete_row(const byte * buf)
{
+ int res;
statistic_increment(ha_delete_count,&LOCK_status);
- return heap_delete(file,buf);
+ res= heap_delete(file,buf);
+ if (!res && table->tmp_table == NO_TMP_TABLE &&
+ ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records)
+ update_key_stats();
+ return res;
}
int ha_heap::index_read(byte * buf, const byte * key, uint key_len,
@@ -227,6 +271,8 @@ int ha_heap::extra(enum ha_extra_function operation)
int ha_heap::delete_all_rows()
{
heap_clear(file);
+ if (table->tmp_table == NO_TMP_TABLE)
+ update_key_stats();
return 0;
}
@@ -384,7 +430,8 @@ ha_rows ha_heap::records_in_range(uint inx, key_range *min_key,
min_key->flag != HA_READ_KEY_EXACT ||
max_key->flag != HA_READ_AFTER_KEY)
return HA_POS_ERROR; // Can only use exact keys
- return 10; // Good guess
+ else
+ return key->rec_per_key[key->key_parts-1];
}
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index 9ca6b9b76b6..f36e9f31c55 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -27,9 +27,10 @@ class ha_heap: public handler
{
HP_INFO *file;
key_map btree_keys;
-
- public:
- ha_heap(TABLE *table): handler(table), file(0) {}
+ /* number of records changed since last statistics update */
+ uint records_changed;
+public:
+ ha_heap(TABLE *table): handler(table), file(0), records_changed(0) {}
~ha_heap() {}
const char *table_type() const { return "HEAP"; }
const char *index_type(uint inx)
@@ -91,5 +92,6 @@ class ha_heap: public handler
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type);
-
+private:
+ void update_key_stats();
};
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 0bcb7062437..07d8da63733 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -1505,17 +1505,14 @@ innobase_close_connection(
*****************************************************************************/
/********************************************************************
-This function is not relevant since we store the tables and indexes
-into our own tablespace, not as files, whose extension this function would
-give. */
+Gives the file extension of an InnoDB single-table tablespace. */
const char**
ha_innobase::bas_ext() const
/*========================*/
- /* out: file extension strings, currently not
- used */
+ /* out: file extension string */
{
- static const char* ext[] = {".InnoDB", NullS};
+ static const char* ext[] = {".ibd", NullS};
return(ext);
}
@@ -2314,6 +2311,34 @@ ha_innobase::write_row(
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
+ if (user_thd->lex->sql_command == SQLCOM_ALTER_TABLE
+ && num_write_row >= 10000) {
+ /* ALTER TABLE is COMMITted at every 10000 copied rows.
+ The IX table lock for the original table has to be re-issued.
+ As this method will be called on a temporary table where the
+ contents of the original table is being copied to, it is
+ a bit tricky to determine the source table. The cursor
+ position in the source table need not be adjusted after the
+ intermediate COMMIT, since writes by other transactions are
+ being blocked by a MySQL table lock TL_WRITE_ALLOW_READ. */
+ ut_a(prebuilt->trx->mysql_n_tables_locked == 2);
+ ut_a(UT_LIST_GET_LEN(prebuilt->trx->trx_locks) >= 2);
+ dict_table_t* table = lock_get_ix_table(
+ UT_LIST_GET_FIRST(prebuilt->trx->trx_locks));
+ num_write_row = 0;
+ /* Commit the transaction. This will release the table
+ locks, so they have to be acquired again. */
+ innobase_commit(user_thd, prebuilt->trx);
+ /* Note that this transaction is still active. */
+ user_thd->transaction.all.innodb_active_trans = 1;
+ /* Re-acquire the IX table lock on the source table. */
+ row_lock_table_for_mysql(prebuilt, table);
+ /* We will need an IX lock on the destination table. */
+ prebuilt->sql_stat_start = TRUE;
+ }
+
+ num_write_row++;
+
if (last_query_id != user_thd->query_id) {
prebuilt->sql_stat_start = TRUE;
last_query_id = user_thd->query_id;
@@ -2362,8 +2387,9 @@ ha_innobase::write_row(
same SQL statement! */
if (auto_inc == 0 && user_thd->next_insert_id != 0) {
- auto_inc = user_thd->next_insert_id;
- auto_inc_counter_for_this_stat = auto_inc;
+
+ auto_inc_counter_for_this_stat
+ = user_thd->next_insert_id;
}
if (auto_inc == 0 && auto_inc_counter_for_this_stat) {
@@ -2371,14 +2397,14 @@ ha_innobase::write_row(
this SQL statement with SET INSERT_ID. We must
assign sequential values from the counter. */
- auto_inc_counter_for_this_stat++;
- incremented_auto_inc_for_stat = TRUE;
-
auto_inc = auto_inc_counter_for_this_stat;
/* We give MySQL a new value to place in the
auto-inc column */
user_thd->next_insert_id = auto_inc;
+
+ auto_inc_counter_for_this_stat++;
+ incremented_auto_inc_for_stat = TRUE;
}
if (auto_inc != 0) {
@@ -4986,7 +5012,7 @@ ha_innobase::external_lock(
if (thd->in_lock_tables &&
thd->variables.innodb_table_locks) {
ulint error;
- error = row_lock_table_for_mysql(prebuilt);
+ error = row_lock_table_for_mysql(prebuilt, 0);
if (error != DB_SUCCESS) {
error = convert_error_code_to_mysql(
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index c10beacac1b..e76a966c6b9 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -64,6 +64,7 @@ class ha_innobase: public handler
uint last_match_mode;/* match mode of the latest search:
ROW_SEL_EXACT, ROW_SEL_EXACT_PREFIX,
or undefined */
+ uint num_write_row; /* number of write_row() calls */
longlong auto_inc_counter_for_this_stat;
ulong max_supported_row_length(const byte *buf);
@@ -85,7 +86,8 @@ class ha_innobase: public handler
HA_PRIMARY_KEY_IN_READ_INDEX |
HA_TABLE_SCAN_ON_INDEX),
last_dup_key((uint) -1),
- start_of_scan(0)
+ start_of_scan(0),
+ num_write_row(0)
{
}
~ha_innobase() {}
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 4f0bd1f99ec..77cc7ce5bc4 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -39,9 +39,6 @@ static const int parallelism= 240;
// createable against NDB from this handler
static const int max_transactions= 256;
-// Default value for prefetch of autoincrement values
-static const ha_rows autoincrement_prefetch= 32;
-
// connectstring to cluster if given by mysqld
const char *ndbcluster_connectstring= 0;
@@ -103,51 +100,52 @@ struct err_code_mapping
{
int ndb_err;
int my_err;
+ int show_warning;
};
static const err_code_mapping err_map[]=
{
- { 626, HA_ERR_KEY_NOT_FOUND },
- { 630, HA_ERR_FOUND_DUPP_KEY },
- { 893, HA_ERR_FOUND_DUPP_UNIQUE },
- { 721, HA_ERR_TABLE_EXIST },
- { 4244, HA_ERR_TABLE_EXIST },
-
- { 709, HA_ERR_NO_SUCH_TABLE },
- { 284, HA_ERR_NO_SUCH_TABLE },
-
- { 266, HA_ERR_LOCK_WAIT_TIMEOUT },
- { 274, HA_ERR_LOCK_WAIT_TIMEOUT },
- { 296, HA_ERR_LOCK_WAIT_TIMEOUT },
- { 297, HA_ERR_LOCK_WAIT_TIMEOUT },
- { 237, HA_ERR_LOCK_WAIT_TIMEOUT },
-
- { 623, HA_ERR_RECORD_FILE_FULL },
- { 624, HA_ERR_RECORD_FILE_FULL },
- { 625, HA_ERR_RECORD_FILE_FULL },
- { 826, HA_ERR_RECORD_FILE_FULL },
- { 827, HA_ERR_RECORD_FILE_FULL },
- { 832, HA_ERR_RECORD_FILE_FULL },
-
- { 0, 1 },
-
- { -1, -1 }
+ { 626, HA_ERR_KEY_NOT_FOUND, 0 },
+ { 630, HA_ERR_FOUND_DUPP_KEY, 0 },
+ { 893, HA_ERR_FOUND_DUPP_KEY, 0 },
+ { 721, HA_ERR_TABLE_EXIST, 1 },
+ { 4244, HA_ERR_TABLE_EXIST, 1 },
+
+ { 709, HA_ERR_NO_SUCH_TABLE, 1 },
+ { 284, HA_ERR_NO_SUCH_TABLE, 1 },
+
+ { 266, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
+ { 274, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
+ { 296, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
+ { 297, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
+ { 237, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
+
+ { 623, HA_ERR_RECORD_FILE_FULL, 1 },
+ { 624, HA_ERR_RECORD_FILE_FULL, 1 },
+ { 625, HA_ERR_RECORD_FILE_FULL, 1 },
+ { 826, HA_ERR_RECORD_FILE_FULL, 1 },
+ { 827, HA_ERR_RECORD_FILE_FULL, 1 },
+ { 832, HA_ERR_RECORD_FILE_FULL, 1 },
+
+ { 0, 1, 0 },
+
+ { -1, -1, 1 }
};
static int ndb_to_mysql_error(const NdbError *err)
{
uint i;
- for (i=0 ; err_map[i].ndb_err != err->code ; i++)
+ for (i=0; err_map[i].ndb_err != err->code && err_map[i].my_err != -1; i++);
+ if (err_map[i].show_warning)
{
- if (err_map[i].my_err == -1){
- // Push the NDB error message as warning
- push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
- ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
- err->code, err->message, "NDB");
- return err->code;
- }
+ // Push the NDB error message as warning
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
+ err->code, err->message, "NDB");
}
+ if (err_map[i].my_err == -1)
+ return err->code;
return err_map[i].my_err;
}
@@ -161,7 +159,7 @@ int execute_no_commit(ha_ndbcluster *h, NdbConnection *trans)
if (m_batch_execute)
return 0;
#endif
- return trans->execute(NoCommit,AbortOnError,1);
+ return trans->execute(NoCommit,AbortOnError,h->m_force_send);
}
inline
@@ -172,7 +170,18 @@ int execute_commit(ha_ndbcluster *h, NdbConnection *trans)
if (m_batch_execute)
return 0;
#endif
- return trans->execute(Commit,AbortOnError,1);
+ return trans->execute(Commit,AbortOnError,h->m_force_send);
+}
+
+inline
+int execute_commit(THD *thd, NdbConnection *trans)
+{
+ int m_batch_execute= 0;
+#ifdef NOT_USED
+ if (m_batch_execute)
+ return 0;
+#endif
+ return trans->execute(Commit,AbortOnError,thd->variables.ndb_force_send);
}
inline
@@ -183,7 +192,7 @@ int execute_no_commit_ie(ha_ndbcluster *h, NdbConnection *trans)
if (m_batch_execute)
return 0;
#endif
- return trans->execute(NoCommit,IgnoreError,1);
+ return trans->execute(NoCommit,IgnoreError,h->m_force_send);
}
/*
@@ -226,6 +235,8 @@ void ha_ndbcluster::set_rec_per_key()
void ha_ndbcluster::records_update()
{
+ if (m_ha_not_exact_count)
+ return;
DBUG_ENTER("ha_ndbcluster::records_update");
struct Ndb_table_local_info *info= (struct Ndb_table_local_info *)m_table_info;
DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
@@ -249,6 +260,8 @@ void ha_ndbcluster::records_update()
void ha_ndbcluster::no_uncommitted_rows_execute_failure()
{
+ if (m_ha_not_exact_count)
+ return;
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_execute_failure");
THD *thd= current_thd;
((Thd_ndb*)(thd->transaction.thd_ndb))->error= 1;
@@ -257,6 +270,8 @@ void ha_ndbcluster::no_uncommitted_rows_execute_failure()
void ha_ndbcluster::no_uncommitted_rows_init(THD *thd)
{
+ if (m_ha_not_exact_count)
+ return;
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_init");
struct Ndb_table_local_info *info= (struct Ndb_table_local_info *)m_table_info;
Thd_ndb *thd_ndb= (Thd_ndb *)thd->transaction.thd_ndb;
@@ -274,6 +289,8 @@ void ha_ndbcluster::no_uncommitted_rows_init(THD *thd)
void ha_ndbcluster::no_uncommitted_rows_update(int c)
{
+ if (m_ha_not_exact_count)
+ return;
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_update");
struct Ndb_table_local_info *info=
(struct Ndb_table_local_info *)m_table_info;
@@ -286,6 +303,8 @@ void ha_ndbcluster::no_uncommitted_rows_update(int c)
void ha_ndbcluster::no_uncommitted_rows_reset(THD *thd)
{
+ if (m_ha_not_exact_count)
+ return;
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_reset");
((Thd_ndb*)(thd->transaction.thd_ndb))->count++;
((Thd_ndb*)(thd->transaction.thd_ndb))->error= 0;
@@ -324,7 +343,7 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans)
DBUG_PRINT("info", ("transformed ndbcluster error %d to mysql error %d",
err.code, res));
if (res == HA_ERR_FOUND_DUPP_KEY)
- dupkey= table->primary_key;
+ m_dupkey= table->primary_key;
DBUG_RETURN(res);
}
@@ -551,7 +570,7 @@ int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob)
blob_size+= 8 - blob_size % 8;
if (loop == 1)
{
- char *buf= blobs_buffer + offset;
+ char *buf= m_blobs_buffer + offset;
uint32 len= 0xffffffff; // Max uint32
DBUG_PRINT("value", ("read blob ptr=%x len=%u",
(uint)buf, (uint)blob_len));
@@ -563,15 +582,15 @@ int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob)
offset+= blob_size;
}
}
- if (loop == 0 && offset > blobs_buffer_size)
+ if (loop == 0 && offset > m_blobs_buffer_size)
{
- my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
- blobs_buffer_size= 0;
+ my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ m_blobs_buffer_size= 0;
DBUG_PRINT("value", ("allocate blobs buffer size %u", offset));
- blobs_buffer= my_malloc(offset, MYF(MY_WME));
- if (blobs_buffer == NULL)
+ m_blobs_buffer= my_malloc(offset, MYF(MY_WME));
+ if (m_blobs_buffer == NULL)
DBUG_RETURN(-1);
- blobs_buffer_size= offset;
+ m_blobs_buffer_size= offset;
}
}
DBUG_RETURN(0);
@@ -777,7 +796,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
error= create_unique_index(unique_index_name, key_info);
break;
case UNIQUE_INDEX:
- error= create_unique_index(unique_index_name, key_info);
+ if (!(error= check_index_fields_not_null(i)))
+ error= create_unique_index(unique_index_name, key_info);
break;
case ORDERED_INDEX:
error= create_ordered_index(index_name, key_info);
@@ -829,6 +849,26 @@ NDB_INDEX_TYPE ha_ndbcluster::get_index_type_from_table(uint inx) const
ORDERED_INDEX);
}
+int ha_ndbcluster::check_index_fields_not_null(uint inx)
+{
+ KEY* key_info= table->key_info + inx;
+ KEY_PART_INFO* key_part= key_info->key_part;
+ KEY_PART_INFO* end= key_part+key_info->key_parts;
+ DBUG_ENTER("check_index_fields_not_null");
+
+ for (; key_part != end; key_part++)
+ {
+ Field* field= key_part->field;
+ if (field->maybe_null())
+ {
+ my_printf_error(ER_NULL_COLUMN_IN_INDEX,ER(ER_NULL_COLUMN_IN_INDEX),
+ MYF(0),field->field_name);
+ DBUG_RETURN(ER_NULL_COLUMN_IN_INDEX);
+ }
+ }
+
+ DBUG_RETURN(0);
+}
void ha_ndbcluster::release_metadata()
{
@@ -854,7 +894,7 @@ int ha_ndbcluster::get_ndb_lock_type(enum thr_lock_type type)
{
if (type >= TL_WRITE_ALLOW_WRITE)
return NdbOperation::LM_Exclusive;
- else if (uses_blob_value(retrieve_all_fields))
+ else if (uses_blob_value(m_retrieve_all_fields))
return NdbOperation::LM_Read;
else
return NdbOperation::LM_CommittedRead;
@@ -1018,7 +1058,8 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf)
{
Field *field= table->field[i];
if ((thd->query_id == field->query_id) ||
- retrieve_all_fields)
+ m_retrieve_all_fields ||
+ (field->flags & PRI_KEY_FLAG) && m_retrieve_primary_key)
{
if (get_ndb_value(op, field, i, buf))
ERR_RETURN(trans->getNdbError());
@@ -1055,7 +1096,7 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
THD *thd= current_thd;
DBUG_ENTER("complemented_pk_read");
- if (retrieve_all_fields)
+ if (m_retrieve_all_fields)
// We have allready retrieved all fields, nothing to complement
DBUG_RETURN(0);
@@ -1093,6 +1134,34 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data)
DBUG_RETURN(0);
}
+/*
+ Peek to check if a particular row already exists
+*/
+
+int ha_ndbcluster::peek_row()
+{
+ NdbConnection *trans= m_active_trans;
+ NdbOperation *op;
+ THD *thd= current_thd;
+ DBUG_ENTER("peek_row");
+
+ NdbOperation::LockMode lm=
+ (NdbOperation::LockMode)get_ndb_lock_type(m_lock.type);
+ if (!(op= trans->getNdbOperation((const NDBTAB *) m_table)) ||
+ op->readTuple(lm) != 0)
+ ERR_RETURN(trans->getNdbError());
+
+ int res;
+ if ((res= set_primary_key(op)))
+ ERR_RETURN(trans->getNdbError());
+
+ if (execute_no_commit_ie(this,trans) != 0)
+ {
+ table->status= STATUS_NOT_FOUND;
+ DBUG_RETURN(ndb_err(trans));
+ }
+ DBUG_RETURN(0);
+}
/*
Read one record from NDB using unique secondary index
@@ -1138,7 +1207,7 @@ int ha_ndbcluster::unique_index_read(const byte *key,
{
Field *field= table->field[i];
if ((thd->query_id == field->query_id) ||
- (field->flags & PRI_KEY_FLAG))
+ (field->flags & PRI_KEY_FLAG)) // && m_retrieve_primary_key ??
{
if (get_ndb_value(op, field, i, buf))
ERR_RETURN(op->getNdbError());
@@ -1192,12 +1261,12 @@ inline int ha_ndbcluster::next_result(byte *buf)
/*
We can only handle one tuple with blobs at a time.
*/
- if (ops_pending && blobs_pending)
+ if (m_ops_pending && m_blobs_pending)
{
if (execute_no_commit(this,trans) != 0)
DBUG_RETURN(ndb_err(trans));
- ops_pending= 0;
- blobs_pending= FALSE;
+ m_ops_pending= 0;
+ m_blobs_pending= FALSE;
}
check= cursor->nextResult(contact_ndb);
if (check == 0)
@@ -1219,10 +1288,11 @@ inline int ha_ndbcluster::next_result(byte *buf)
all pending update or delete operations should
be sent to NDB
*/
- DBUG_PRINT("info", ("ops_pending: %d", ops_pending));
- if (ops_pending)
+ DBUG_PRINT("info", ("ops_pending: %d", m_ops_pending));
+ if (m_ops_pending)
{
- if (current_thd->transaction.on)
+ // if (current_thd->transaction.on)
+ if (m_transaction_on)
{
if (execute_no_commit(this,trans) != 0)
DBUG_RETURN(ndb_err(trans));
@@ -1234,7 +1304,7 @@ inline int ha_ndbcluster::next_result(byte *buf)
int res= trans->restart();
DBUG_ASSERT(res == 0);
}
- ops_pending= 0;
+ m_ops_pending= 0;
}
contact_ndb= (check == 2);
@@ -1290,7 +1360,6 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
Field *field= key_part->field;
uint part_len= key_part->length;
uint part_store_len= key_part->store_length;
- bool part_nullable= (bool) key_part->null_bit;
// Info about each key part
struct part_st {
bool part_last;
@@ -1312,9 +1381,9 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
p.part_last= (tot_len + part_store_len >= key_tot_len[j]);
p.key= keys[j];
p.part_ptr= &p.key->key[tot_len];
- p.part_null= (field->maybe_null() && *p.part_ptr);
+ p.part_null= key_part->null_bit && *p.part_ptr;
p.bound_ptr= (const char *)
- p.part_null ? 0 : part_nullable ? p.part_ptr + 1 : p.part_ptr;
+ p.part_null ? 0 : key_part->null_bit ? p.part_ptr + 1 : p.part_ptr;
if (j == 0)
{
@@ -1423,7 +1492,7 @@ int ha_ndbcluster::define_read_attrs(byte* buf, NdbOperation* op)
Field *field= table->field[i];
if ((thd->query_id == field->query_id) ||
(field->flags & PRI_KEY_FLAG) ||
- retrieve_all_fields)
+ m_retrieve_all_fields)
{
if (get_ndb_value(op, field, i, buf))
ERR_RETURN(op->getNdbError());
@@ -1567,7 +1636,7 @@ int ha_ndbcluster::filtered_scan(const byte *key, uint key_len,
Field* field= key_part->field;
uint ndb_fieldnr= key_part->fieldnr-1;
DBUG_PRINT("key_part", ("fieldnr: %d", ndb_fieldnr));
- // const NDBCOL *col= tab->getColumn(ndb_fieldnr);
+ //const NDBCOL *col= ((const NDBTAB *) m_table)->getColumn(ndb_fieldnr);
uint32 field_len= field->pack_length();
DBUG_DUMP("key", (char*)key, field_len);
@@ -1636,9 +1705,17 @@ int ha_ndbcluster::write_row(byte *record)
int res;
DBUG_ENTER("write_row");
- if(m_ignore_dup_key_not_supported)
+ if(m_ignore_dup_key && table->primary_key != MAX_KEY)
{
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+ int peek_res= peek_row();
+
+ if (!peek_res)
+ {
+ m_dupkey= table->primary_key;
+ DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY);
+ }
+ if (peek_res != HA_ERR_KEY_NOT_FOUND)
+ DBUG_RETURN(peek_res);
}
statistic_increment(ha_write_count,&LOCK_status);
@@ -1666,9 +1743,9 @@ int ha_ndbcluster::write_row(byte *record)
if (has_auto_increment)
{
- skip_auto_increment= FALSE;
+ m_skip_auto_increment= FALSE;
update_auto_increment();
- skip_auto_increment= !auto_increment_column_changed;
+ m_skip_auto_increment= !auto_increment_column_changed;
}
if ((res= set_primary_key(op)))
@@ -1683,7 +1760,7 @@ int ha_ndbcluster::write_row(byte *record)
if (!(field->flags & PRI_KEY_FLAG) &&
set_ndb_value(op, field, i, &set_blob_value))
{
- skip_auto_increment= TRUE;
+ m_skip_auto_increment= TRUE;
ERR_RETURN(op->getNdbError());
}
}
@@ -1695,25 +1772,26 @@ int ha_ndbcluster::write_row(byte *record)
to NoCommit the transaction between each row.
Find out how this is detected!
*/
- rows_inserted++;
+ m_rows_inserted++;
no_uncommitted_rows_update(1);
- bulk_insert_not_flushed= TRUE;
- if ((rows_to_insert == 1) ||
- ((rows_inserted % bulk_insert_rows) == 0) ||
+ m_bulk_insert_not_flushed= TRUE;
+ if ((m_rows_to_insert == 1) ||
+ ((m_rows_inserted % m_bulk_insert_rows) == 0) ||
set_blob_value)
{
THD *thd= current_thd;
// Send rows to NDB
DBUG_PRINT("info", ("Sending inserts to NDB, "\
"rows_inserted:%d, bulk_insert_rows: %d",
- (int)rows_inserted, (int)bulk_insert_rows));
+ (int)m_rows_inserted, (int)m_bulk_insert_rows));
- bulk_insert_not_flushed= FALSE;
- if (thd->transaction.on)
+ m_bulk_insert_not_flushed= FALSE;
+ // if (thd->transaction.on)
+ if (m_transaction_on)
{
if (execute_no_commit(this,trans) != 0)
{
- skip_auto_increment= TRUE;
+ m_skip_auto_increment= TRUE;
no_uncommitted_rows_execute_failure();
DBUG_RETURN(ndb_err(trans));
}
@@ -1722,7 +1800,7 @@ int ha_ndbcluster::write_row(byte *record)
{
if (execute_commit(this,trans) != 0)
{
- skip_auto_increment= TRUE;
+ m_skip_auto_increment= TRUE;
no_uncommitted_rows_execute_failure();
DBUG_RETURN(ndb_err(trans));
}
@@ -1730,7 +1808,7 @@ int ha_ndbcluster::write_row(byte *record)
DBUG_ASSERT(res == 0);
}
}
- if ((has_auto_increment) && (skip_auto_increment))
+ if ((has_auto_increment) && (m_skip_auto_increment))
{
Uint64 next_val= (Uint64) table->next_number_field->val_int() + 1;
DBUG_PRINT("info",
@@ -1740,7 +1818,7 @@ int ha_ndbcluster::write_row(byte *record)
DBUG_PRINT("info",
("Setting next auto increment value to %u", next_val));
}
- skip_auto_increment= TRUE;
+ m_skip_auto_increment= TRUE;
DBUG_RETURN(0);
}
@@ -1820,7 +1898,9 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
}
// Delete old row
DBUG_PRINT("info", ("insert succeded"));
+ m_primary_key_update= TRUE;
delete_res= delete_row(old_data);
+ m_primary_key_update= FALSE;
if (delete_res)
{
DBUG_PRINT("info", ("delete failed"));
@@ -1843,9 +1923,9 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
DBUG_PRINT("info", ("Calling updateTuple on cursor"));
if (!(op= cursor->updateTuple()))
ERR_RETURN(trans->getNdbError());
- ops_pending++;
+ m_ops_pending++;
if (uses_blob_value(FALSE))
- blobs_pending= TRUE;
+ m_blobs_pending= TRUE;
}
else
{
@@ -1880,7 +1960,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
for (i= 0; i < table->fields; i++)
{
Field *field= table->field[i];
- if ((thd->query_id == field->query_id) &&
+ if (((thd->query_id == field->query_id) || m_retrieve_all_fields) &&
(!(field->flags & PRI_KEY_FLAG)) &&
set_ndb_value(op, field, i))
ERR_RETURN(op->getNdbError());
@@ -1921,7 +2001,7 @@ int ha_ndbcluster::delete_row(const byte *record)
DBUG_PRINT("info", ("Calling deleteTuple on cursor"));
if (cursor->deleteTuple() != 0)
ERR_RETURN(trans->getNdbError());
- ops_pending++;
+ m_ops_pending++;
no_uncommitted_rows_update(-1);
@@ -1951,8 +2031,10 @@ int ha_ndbcluster::delete_row(const byte *record)
else
{
int res;
- if ((res= set_primary_key(op)))
- return res;
+ if ((res= (m_primary_key_update ?
+ set_primary_key_from_old_data(op, record)
+ : set_primary_key(op))))
+ return res;
}
}
@@ -2146,17 +2228,15 @@ void ha_ndbcluster::print_results()
break;
}
case NdbDictionary::Column::Char:{
- char buf[field->pack_length()+1];
- char *value= (char *) field->ptr;
- snprintf(buf, field->pack_length(), "%s", value);
- fprintf(DBUG_FILE, "Char\t'%s'", buf);
+ const char *value= (char *) field->ptr;
+ fprintf(DBUG_FILE, "Char\t'%.*s'", field->pack_length(), value);
break;
}
case NdbDictionary::Column::Varchar:
case NdbDictionary::Column::Binary:
case NdbDictionary::Column::Varbinary: {
- char *value= (char *) field->ptr;
- fprintf(DBUG_FILE, "'%s'", value);
+ const char *value= (char *) field->ptr;
+ fprintf(DBUG_FILE, "Var\t'%.*s'", field->pack_length(), value);
break;
}
case NdbDictionary::Column::Datetime: {
@@ -2315,7 +2395,7 @@ int ha_ndbcluster::index_last(byte *buf)
DBUG_RETURN(0);
}
}
- DBUG_RETURN(1);
+ DBUG_RETURN(res);
}
@@ -2411,18 +2491,18 @@ int ha_ndbcluster::close_scan()
DBUG_RETURN(1);
- if (ops_pending)
+ if (m_ops_pending)
{
/*
Take over any pending transactions to the
deleteing/updating transaction before closing the scan
*/
- DBUG_PRINT("info", ("ops_pending: %d", ops_pending));
+ DBUG_PRINT("info", ("ops_pending: %d", m_ops_pending));
if (execute_no_commit(this,trans) != 0) {
no_uncommitted_rows_execute_failure();
DBUG_RETURN(ndb_err(trans));
}
- ops_pending= 0;
+ m_ops_pending= 0;
}
cursor->close();
@@ -2537,14 +2617,17 @@ void ha_ndbcluster::info(uint flag)
DBUG_PRINT("info", ("HA_STATUS_VARIABLE"));
if (m_table_info)
{
- records_update();
+ if (m_ha_not_exact_count)
+ records= 100;
+ else
+ records_update();
}
else
{
- Uint64 rows;
- if(ndb_get_table_statistics(m_ndb, m_tabname, &rows, 0) == 0){
- records= rows;
- }
+ Uint64 rows= 100;
+ if (current_thd->variables.ndb_use_exact_count)
+ ndb_get_table_statistics(m_ndb, m_tabname, &rows, 0);
+ records= rows;
}
}
if (flag & HA_STATUS_CONST)
@@ -2555,7 +2638,7 @@ void ha_ndbcluster::info(uint flag)
if (flag & HA_STATUS_ERRKEY)
{
DBUG_PRINT("info", ("HA_STATUS_ERRKEY"));
- errkey= dupkey;
+ errkey= m_dupkey;
}
if (flag & HA_STATUS_AUTO)
DBUG_PRINT("info", ("HA_STATUS_AUTO"));
@@ -2650,21 +2733,21 @@ int ha_ndbcluster::extra(enum ha_extra_function operation)
m_use_write= TRUE;
} else
{
- if (table->keys)
- m_ignore_dup_key_not_supported= TRUE;
+ DBUG_PRINT("info", ("Ignoring duplicate key"));
+ m_ignore_dup_key= TRUE;
}
break;
case HA_EXTRA_NO_IGNORE_DUP_KEY:
DBUG_PRINT("info", ("HA_EXTRA_NO_IGNORE_DUP_KEY"));
DBUG_PRINT("info", ("Turning OFF use of write instead of insert"));
m_use_write= FALSE;
- m_ignore_dup_key_not_supported= FALSE;
+ m_ignore_dup_key= FALSE;
break;
case HA_EXTRA_RETRIEVE_ALL_COLS: /* Retrieve all columns, not just those
where field->query_id is the same as
the current query id */
DBUG_PRINT("info", ("HA_EXTRA_RETRIEVE_ALL_COLS"));
- retrieve_all_fields= TRUE;
+ m_retrieve_all_fields= TRUE;
break;
case HA_EXTRA_PREPARE_FOR_DELETE:
DBUG_PRINT("info", ("HA_EXTRA_PREPARE_FOR_DELETE"));
@@ -2677,6 +2760,7 @@ int ha_ndbcluster::extra(enum ha_extra_function operation)
break;
case HA_EXTRA_RETRIEVE_PRIMARY_KEY:
DBUG_PRINT("info", ("HA_EXTRA_RETRIEVE_PRIMARY_KEY"));
+ m_retrieve_primary_key= TRUE;
break;
case HA_EXTRA_CHANGE_KEY_TO_UNIQUE:
DBUG_PRINT("info", ("HA_EXTRA_CHANGE_KEY_TO_UNIQUE"));
@@ -2708,8 +2792,8 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
DBUG_ENTER("start_bulk_insert");
DBUG_PRINT("enter", ("rows: %d", (int)rows));
- rows_inserted= 0;
- rows_to_insert= rows;
+ m_rows_inserted= 0;
+ m_rows_to_insert= rows;
/*
Calculate how many rows that should be inserted
@@ -2723,7 +2807,7 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
batch= bytesperbatch/bytes;
batch= batch == 0 ? 1 : batch;
DBUG_PRINT("info", ("batch: %d, bytes: %d", batch, bytes));
- bulk_insert_rows= batch;
+ m_bulk_insert_rows= batch;
DBUG_VOID_RETURN;
}
@@ -2737,22 +2821,22 @@ int ha_ndbcluster::end_bulk_insert()
DBUG_ENTER("end_bulk_insert");
// Check if last inserts need to be flushed
- if (bulk_insert_not_flushed)
+ if (m_bulk_insert_not_flushed)
{
NdbConnection *trans= m_active_trans;
// Send rows to NDB
DBUG_PRINT("info", ("Sending inserts to NDB, "\
"rows_inserted:%d, bulk_insert_rows: %d",
- rows_inserted, bulk_insert_rows));
- bulk_insert_not_flushed= FALSE;
+ m_rows_inserted, m_bulk_insert_rows));
+ m_bulk_insert_not_flushed= FALSE;
if (execute_no_commit(this,trans) != 0) {
no_uncommitted_rows_execute_failure();
my_errno= error= ndb_err(trans);
}
}
- rows_inserted= 0;
- rows_to_insert= 1;
+ m_rows_inserted= 0;
+ m_rows_to_insert= 1;
DBUG_RETURN(error);
}
@@ -2774,7 +2858,7 @@ int ha_ndbcluster::reset()
const char **ha_ndbcluster::bas_ext() const
-{ static const char *ext[]= { ".ndb", NullS }; return ext; }
+{ static const char *ext[]= { ha_ndb_ext, NullS }; return ext; }
/*
@@ -2933,13 +3017,23 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
pointer to point to the NDB transaction.
*/
+ // store thread specific data first to set the right context
+ m_force_send= thd->variables.ndb_force_send;
+ m_ha_not_exact_count= !thd->variables.ndb_use_exact_count;
+ m_autoincrement_prefetch= thd->variables.ndb_autoincrement_prefetch_sz;
+ if (!thd->transaction.on)
+ m_transaction_on= FALSE;
+ else
+ m_transaction_on= thd->variables.ndb_use_transactions;
+
m_active_trans= thd->transaction.all.ndb_tid ?
(NdbConnection*)thd->transaction.all.ndb_tid:
(NdbConnection*)thd->transaction.stmt.ndb_tid;
DBUG_ASSERT(m_active_trans);
// Start of transaction
- retrieve_all_fields= FALSE;
- ops_pending= 0;
+ m_retrieve_all_fields= FALSE;
+ m_retrieve_primary_key= FALSE;
+ m_ops_pending= 0;
{
NDBDICT *dict= m_ndb->getDictionary();
const NDBTAB *tab;
@@ -2987,13 +3081,13 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
DBUG_PRINT("warning", ("m_active_cursor != NULL"));
m_active_cursor= NULL;
- if (blobs_pending)
+ if (m_blobs_pending)
DBUG_PRINT("warning", ("blobs_pending != 0"));
- blobs_pending= 0;
+ m_blobs_pending= 0;
- if (ops_pending)
+ if (m_ops_pending)
DBUG_PRINT("warning", ("ops_pending != 0L"));
- ops_pending= 0;
+ m_ops_pending= 0;
}
DBUG_RETURN(error);
}
@@ -3030,8 +3124,9 @@ int ha_ndbcluster::start_stmt(THD *thd)
m_active_trans= trans;
// Start of statement
- retrieve_all_fields= FALSE;
- ops_pending= 0;
+ m_retrieve_all_fields= FALSE;
+ m_retrieve_primary_key= FALSE;
+ m_ops_pending= 0;
DBUG_RETURN(error);
}
@@ -3053,7 +3148,7 @@ int ndbcluster_commit(THD *thd, void *ndb_transaction)
"stmt" : "all"));
DBUG_ASSERT(ndb && trans);
- if (execute_commit(0,trans) != 0)
+ if (execute_commit(thd,trans) != 0)
{
const NdbError err= trans->getNdbError();
const NdbOperation *error_op= trans->getNdbErrorOperation();
@@ -3308,7 +3403,7 @@ int ha_ndbcluster::create(const char *name,
{
NDBTAB tab;
NDBCOL col;
- uint pack_length, length, i;
+ uint pack_length, length, i, pk_length= 0;
const void *data, *pack_data;
const char **key_names= form->keynames.type_names;
char name2[FN_HEADLEN];
@@ -3355,6 +3450,8 @@ int ha_ndbcluster::create(const char *name,
if ((my_errno= create_ndb_column(col, field, info)))
DBUG_RETURN(my_errno);
tab.addColumn(col);
+ if(col.getPrimaryKey())
+ pk_length += (field->pack_length() + 3) / 4;
}
// No primary key, create shadow key as 64 bit, auto increment
@@ -3368,6 +3465,39 @@ int ha_ndbcluster::create(const char *name,
col.setPrimaryKey(TRUE);
col.setAutoIncrement(TRUE);
tab.addColumn(col);
+ pk_length += 2;
+ }
+
+ // Make sure that blob tables don't have to big part size
+ for (i= 0; i < form->fields; i++)
+ {
+ /**
+ * The extra +7 concists
+ * 2 - words from pk in blob table
+ * 5 - from extra words added by tup/dict??
+ */
+ switch (form->field[i]->real_type()) {
+ case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ {
+ NdbDictionary::Column * col = tab.getColumn(i);
+ int size = pk_length + (col->getPartSize()+3)/4 + 7;
+ if(size > NDB_MAX_TUPLE_SIZE_IN_WORDS &&
+ (pk_length+7) < NDB_MAX_TUPLE_SIZE_IN_WORDS)
+ {
+ size = NDB_MAX_TUPLE_SIZE_IN_WORDS - pk_length - 7;
+ col->setPartSize(4*size);
+ }
+ /**
+ * If size > NDB_MAX and pk_length+7 >= NDB_MAX
+ * then the table can't be created anyway, so skip
+ * changing part size, and have error later
+ */
+ }
+ default:
+ break;
+ }
}
if ((my_errno= check_ndb_connection()))
@@ -3572,13 +3702,13 @@ longlong ha_ndbcluster::get_auto_increment()
DBUG_ENTER("get_auto_increment");
DBUG_PRINT("enter", ("m_tabname: %s", m_tabname));
int cache_size=
- (rows_to_insert - rows_inserted < autoincrement_prefetch) ?
- rows_to_insert - rows_inserted
- : (rows_to_insert > autoincrement_prefetch) ?
- rows_to_insert
- : autoincrement_prefetch;
+ (m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ?
+ m_rows_to_insert - m_rows_inserted
+ : (m_rows_to_insert > m_autoincrement_prefetch) ?
+ m_rows_to_insert
+ : m_autoincrement_prefetch;
Uint64 auto_value=
- (skip_auto_increment) ?
+ (m_skip_auto_increment) ?
m_ndb->readAutoIncrementValue((const NDBTAB *) m_table)
: m_ndb->getAutoIncrementValue((const NDBTAB *) m_table, cache_size);
DBUG_RETURN((longlong)auto_value);
@@ -3602,18 +3732,24 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
HA_NO_PREFIX_CHAR_KEYS),
m_share(0),
m_use_write(FALSE),
- m_ignore_dup_key_not_supported(FALSE),
- retrieve_all_fields(FALSE),
- rows_to_insert(1),
- rows_inserted(0),
- bulk_insert_rows(1024),
- bulk_insert_not_flushed(FALSE),
- ops_pending(0),
- skip_auto_increment(TRUE),
- blobs_pending(0),
- blobs_buffer(0),
- blobs_buffer_size(0),
- dupkey((uint) -1)
+ m_ignore_dup_key(FALSE),
+ m_primary_key_update(FALSE),
+ m_retrieve_all_fields(FALSE),
+ m_retrieve_primary_key(FALSE),
+ m_rows_to_insert(1),
+ m_rows_inserted(0),
+ m_bulk_insert_rows(1024),
+ m_bulk_insert_not_flushed(FALSE),
+ m_ops_pending(0),
+ m_skip_auto_increment(TRUE),
+ m_blobs_pending(0),
+ m_blobs_buffer(0),
+ m_blobs_buffer_size(0),
+ m_dupkey((uint) -1),
+ m_ha_not_exact_count(FALSE),
+ m_force_send(TRUE),
+ m_autoincrement_prefetch(32),
+ m_transaction_on(TRUE)
{
int i;
@@ -3647,8 +3783,8 @@ ha_ndbcluster::~ha_ndbcluster()
if (m_share)
free_share(m_share);
release_metadata();
- my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
- blobs_buffer= 0;
+ my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ m_blobs_buffer= 0;
// Check for open cursor/transaction
if (m_active_cursor) {
@@ -4263,6 +4399,62 @@ ha_ndbcluster::records_in_range(uint inx, key_range *min_key,
DBUG_RETURN(10); /* Good guess when you don't know anything */
}
+ulong ha_ndbcluster::table_flags(void) const
+{
+ if (m_ha_not_exact_count)
+ return m_table_flags | HA_NOT_EXACT_COUNT;
+ else
+ return m_table_flags;
+}
+const char * ha_ndbcluster::table_type() const
+{
+ return("ndbcluster");
+}
+uint ha_ndbcluster::max_supported_record_length() const
+{
+ return NDB_MAX_TUPLE_SIZE;
+}
+uint ha_ndbcluster::max_supported_keys() const
+{
+ return MAX_KEY;
+}
+uint ha_ndbcluster::max_supported_key_parts() const
+{
+ return NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY;
+}
+uint ha_ndbcluster::max_supported_key_length() const
+{
+ return NDB_MAX_KEY_SIZE;
+}
+bool ha_ndbcluster::low_byte_first() const
+{
+#ifdef WORDS_BIGENDIAN
+ return FALSE;
+#else
+ return TRUE;
+#endif
+}
+bool ha_ndbcluster::has_transactions()
+{
+ return TRUE;
+}
+const char* ha_ndbcluster::index_type(uint key_number)
+{
+ switch (get_index_type(key_number)) {
+ case ORDERED_INDEX:
+ case UNIQUE_ORDERED_INDEX:
+ case PRIMARY_KEY_ORDERED_INDEX:
+ return "BTREE";
+ case UNIQUE_INDEX:
+ case PRIMARY_KEY_INDEX:
+ default:
+ return "HASH";
+ }
+}
+uint8 ha_ndbcluster::table_cache_type()
+{
+ return HA_CACHE_TBL_NOCACHE;
+}
/*
Handling the shared NDB_SHARE structure that is needed to
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index b33a0657d4f..1b49aca81e6 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -118,15 +118,14 @@ class ha_ndbcluster: public handler
int reset();
int external_lock(THD *thd, int lock_type);
int start_stmt(THD *thd);
- const char * table_type() const { return("ndbcluster");}
+ const char * table_type() const;
const char ** bas_ext() const;
- ulong table_flags(void) const { return m_table_flags; }
+ ulong table_flags(void) const;
ulong index_flags(uint idx, uint part, bool all_parts) const;
- uint max_supported_record_length() const { return NDB_MAX_TUPLE_SIZE; };
- uint max_supported_keys() const { return MAX_KEY; }
- uint max_supported_key_parts() const
- { return NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY; };
- uint max_supported_key_length() const { return NDB_MAX_KEY_SIZE;};
+ uint max_supported_record_length() const;
+ uint max_supported_keys() const;
+ uint max_supported_key_parts() const;
+ uint max_supported_key_length() const;
int rename_table(const char *from, const char *to);
int delete_table(const char *name);
@@ -135,28 +134,9 @@ class ha_ndbcluster: public handler
THR_LOCK_DATA **to,
enum thr_lock_type lock_type);
- bool low_byte_first() const
- {
-#ifdef WORDS_BIGENDIAN
- return FALSE;
-#else
- return TRUE;
-#endif
- }
- bool has_transactions() { return TRUE; }
-
- const char* index_type(uint key_number) {
- switch (get_index_type(key_number)) {
- case ORDERED_INDEX:
- case UNIQUE_ORDERED_INDEX:
- case PRIMARY_KEY_ORDERED_INDEX:
- return "BTREE";
- case UNIQUE_INDEX:
- case PRIMARY_KEY_INDEX:
- default:
- return "HASH";
- }
- }
+ bool low_byte_first() const;
+ bool has_transactions();
+ const char* index_type(uint key_number);
double scan_time();
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
@@ -165,7 +145,7 @@ class ha_ndbcluster: public handler
static Thd_ndb* seize_thd_ndb();
static void release_thd_ndb(Thd_ndb* thd_ndb);
- uint8 table_cache_type() { return HA_CACHE_TBL_NOCACHE; }
+ uint8 table_cache_type();
private:
int alter_table_name(const char *from, const char *to);
@@ -180,9 +160,11 @@ class ha_ndbcluster: public handler
void release_metadata();
NDB_INDEX_TYPE get_index_type(uint idx_no) const;
NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const;
-
+ int check_index_fields_not_null(uint index_no);
+
int pk_read(const byte *key, uint key_len, byte *buf);
int complemented_pk_read(const byte *old_data, byte *new_data);
+ int peek_row();
int unique_index_read(const byte *key, uint key_len,
byte *buf);
int ordered_index_scan(const key_range *start_key,
@@ -242,19 +224,25 @@ class ha_ndbcluster: public handler
typedef union { NdbRecAttr *rec; NdbBlob *blob; void *ptr; } NdbValue;
NdbValue m_value[NDB_MAX_ATTRIBUTES_IN_TABLE];
bool m_use_write;
- bool m_ignore_dup_key_not_supported;
- bool retrieve_all_fields;
- ha_rows rows_to_insert;
- ha_rows rows_inserted;
- ha_rows bulk_insert_rows;
- bool bulk_insert_not_flushed;
- ha_rows ops_pending;
- bool skip_auto_increment;
- bool blobs_pending;
+ bool m_ignore_dup_key;
+ bool m_primary_key_update;
+ bool m_retrieve_all_fields;
+ bool m_retrieve_primary_key;
+ ha_rows m_rows_to_insert;
+ ha_rows m_rows_inserted;
+ ha_rows m_bulk_insert_rows;
+ bool m_bulk_insert_not_flushed;
+ ha_rows m_ops_pending;
+ bool m_skip_auto_increment;
+ bool m_blobs_pending;
// memory for blobs in one tuple
- char *blobs_buffer;
- uint32 blobs_buffer_size;
- uint dupkey;
+ char *m_blobs_buffer;
+ uint32 m_blobs_buffer_size;
+ uint m_dupkey;
+ bool m_ha_not_exact_count;
+ bool m_force_send;
+ ha_rows m_autoincrement_prefetch;
+ bool m_transaction_on;
void set_rec_per_key();
void records_update();
@@ -264,6 +252,8 @@ class ha_ndbcluster: public handler
void no_uncommitted_rows_reset(THD *);
friend int execute_no_commit(ha_ndbcluster*, NdbConnection*);
+ friend int execute_commit(ha_ndbcluster*, NdbConnection*);
+ friend int execute_no_commit_ie(ha_ndbcluster*, NdbConnection*);
};
bool ndbcluster_init(void);
diff --git a/sql/handler.cc b/sql/handler.cc
index f7a1a6ef0bf..7ddd7b80a34 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -109,6 +109,9 @@ const char *tx_isolation_names[] =
TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"",
tx_isolation_names, NULL};
+static TYPELIB known_extensions= {0,"known_exts", NULL, NULL};
+uint known_extensions_id= 0;
+
enum db_type ha_resolve_by_name(const char *name, uint namelen)
{
THD *thd=current_thd;
@@ -581,6 +584,12 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
if (opt_using_transactions)
{
bool operation_done=0;
+ /*
+ As rollback can be 30 times slower than insert in InnoDB, and user may
+ not know there's rollback (if it's because of a dupl row), better warn.
+ */
+ const char *save_proc_info= thd->proc_info;
+ thd->proc_info= "Rolling back";
#ifdef HAVE_NDBCLUSTER_DB
if (trans->ndb_tid)
{
@@ -652,6 +661,7 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
thd->variables.tx_isolation=thd->session_tx_isolation;
if (operation_done)
statistic_increment(ha_rollback_count,&LOCK_status);
+ thd->proc_info= save_proc_info;
}
#endif /* USING_TRANSACTIONS */
DBUG_RETURN(error);
@@ -764,6 +774,25 @@ int ha_savepoint(THD *thd, char *savepoint_name)
DBUG_RETURN(error);
}
+
+int ha_start_consistent_snapshot(THD *thd)
+{
+#ifdef HAVE_INNOBASE_DB
+ if ((have_innodb == SHOW_OPTION_YES) &&
+ !innobase_start_trx_and_assign_read_view(thd))
+ return 0;
+#endif
+ /*
+ Same idea as when one wants to CREATE TABLE in one engine which does not
+ exist:
+ */
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
+ "This MySQL server does not support any "
+ "consistent-read capable storage engine");
+ return 0;
+}
+
+
bool ha_flush_logs()
{
bool result=0;
@@ -924,8 +953,10 @@ int handler::read_first_row(byte * buf, uint primary_key)
/*
If there is very few deleted rows in the table, find the first row by
scanning the table.
+ TODO remove the test for HA_READ_ORDER
*/
- if (deleted < 10 || primary_key >= MAX_KEY)
+ if (deleted < 10 || primary_key >= MAX_KEY ||
+ !(index_flags(primary_key, 0, 0) & HA_READ_ORDER))
{
(void) ha_rnd_init(1);
while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ;
@@ -1633,3 +1664,64 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key,
return error;
}
+
+/*
+ Returns a list of all known extensions.
+
+ SYNOPSIS
+ ha_known_exts()
+
+ NOTES
+ No mutexes, worst case race is a minor surplus memory allocation
+ We have to recreate the extension map if mysqld is restarted (for example
+ within libmysqld)
+
+ RETURN VALUE
+ pointer pointer to TYPELIB structure
+*/
+
+TYPELIB *ha_known_exts(void)
+{
+ if (!known_extensions.type_names || mysys_usage_id != known_extensions_id)
+ {
+ show_table_type_st *types;
+ List<char> found_exts;
+ List_iterator_fast<char> it(found_exts);
+ const char **ext, *old_ext;
+
+ known_extensions_id= mysys_usage_id;
+ found_exts.push_back((char*) ".db");
+ for (types= sys_table_types; types->type; types++)
+ {
+ if (*types->value == SHOW_OPTION_YES)
+ {
+ handler *file= get_new_handler(0,(enum db_type) types->db_type);
+ for (ext= file->bas_ext(); *ext; ext++)
+ {
+ while ((old_ext= it++))
+ {
+ if (!strcmp(old_ext, *ext))
+ break;
+ }
+ if (!old_ext)
+ found_exts.push_back((char *) *ext);
+
+ it.rewind();
+ }
+ delete file;
+ }
+ }
+ ext= (const char **) my_once_alloc(sizeof(char *)*
+ (found_exts.elements+1),
+ MYF(MY_WME | MY_FAE));
+
+ DBUG_ASSERT(ext);
+ known_extensions.count= found_exts.elements;
+ known_extensions.type_names= ext;
+
+ while ((old_ext= it++))
+ *ext++= old_ext;
+ *ext= 0;
+ }
+ return &known_extensions;
+}
diff --git a/sql/handler.h b/sql/handler.h
index a7ce4e708fd..252861e5c37 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -138,6 +138,8 @@
#define HA_CACHE_TBL_ASKTRANSACT 2
#define HA_CACHE_TBL_TRANSACT 4
+/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
+#define MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1
enum db_type
{
@@ -567,5 +569,5 @@ int ha_discover(THD* thd, const char* dbname, const char* name,
int ha_find_files(THD *thd,const char *db,const char *path,
const char *wild, bool dir,List<char>* files);
int ha_table_exists(THD* thd, const char* db, const char* name);
-
-
+TYPELIB *ha_known_exts(void);
+int ha_start_consistent_snapshot(THD *thd);
diff --git a/sql/item.cc b/sql/item.cc
index 7dc7e9e542c..31c35e87cd4 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -376,13 +376,13 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
}
else if ((flags & MY_COLL_ALLOW_COERCIBLE_CONV) &&
derivation < dt.derivation &&
- dt.derivation == DERIVATION_COERCIBLE)
+ dt.derivation >= DERIVATION_COERCIBLE)
{
// Do nothing;
}
else if ((flags & MY_COLL_ALLOW_COERCIBLE_CONV) &&
dt.derivation < derivation &&
- derivation == DERIVATION_COERCIBLE)
+ derivation >= DERIVATION_COERCIBLE)
{
set(dt);
strong= nagg;
@@ -837,6 +837,21 @@ void Item_param::set_double(double d)
}
+/*
+ Set parameter value from TIME value.
+
+ SYNOPSIS
+ set_time()
+ tm - datetime value to set (time_type is ignored)
+ type - type of datetime value
+ max_length_arg - max length of datetime value as string
+
+ NOTE
+ If we value to be stored is not normalized, zero value will be stored
+ instead and proper warning will be produced. This function relies on
+ the fact that even wrong value sent over binary protocol fits into
+ MAX_DATE_STRING_REP_LENGTH buffer.
+*/
void Item_param::set_time(TIME *tm, timestamp_type type, uint32 max_length_arg)
{
DBUG_ENTER("Item_param::set_time");
@@ -844,6 +859,17 @@ void Item_param::set_time(TIME *tm, timestamp_type type, uint32 max_length_arg)
value.time= *tm;
value.time.time_type= type;
+ if (value.time.year > 9999 || value.time.month > 12 ||
+ value.time.day > 31 ||
+ type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23 ||
+ value.time.minute > 59 || value.time.second > 59)
+ {
+ char buff[MAX_DATE_STRING_REP_LENGTH];
+ uint length= my_TIME_to_str(&value.time, buff);
+ make_truncated_value_warning(current_thd, buff, length, type);
+ set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR);
+ }
+
state= TIME_VALUE;
maybe_null= 0;
max_length= max_length_arg;
@@ -1218,6 +1244,10 @@ bool Item_param::convert_str_value(THD *thd)
value.cs_info.character_set_client,
value.cs_info.final_character_set_of_str_value);
}
+ else
+ str_value.set_charset(value.cs_info.final_character_set_of_str_value);
+ /* Here str_value is guaranteed to be in final_character_set_of_str_value */
+
max_length= str_value.length();
decimals= 0;
/*
diff --git a/sql/item.h b/sql/item.h
index fea3aa010a8..ccb0fda1c49 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -31,6 +31,7 @@ void item_init(void); /* Init item functions */
enum Derivation
{
+ DERIVATION_IGNORABLE= 4,
DERIVATION_COERCIBLE= 3,
DERIVATION_IMPLICIT= 2,
DERIVATION_NONE= 1,
@@ -98,6 +99,7 @@ public:
{
switch(derivation)
{
+ case DERIVATION_IGNORABLE: return "IGNORABLE";
case DERIVATION_COERCIBLE: return "COERCIBLE";
case DERIVATION_IMPLICIT: return "IMPLICIT";
case DERIVATION_EXPLICIT: return "EXPLICIT";
@@ -264,6 +266,14 @@ public:
virtual bool get_time(TIME *ltime);
virtual bool get_date_result(TIME *ltime,uint fuzzydate)
{ return get_date(ltime,fuzzydate); }
+ /*
+ This function is used only in Item_func_isnull/Item_func_isnotnull
+ (implementations of IS NULL/IS NOT NULL clauses). Item_func_is{not}null
+ calls this method instead of one of val/result*() methods, which
+ normally will set null_value. This allows to determine nullness of
+ a complex expression without fully evaluating it.
+ Any new item which can be NULL must implement this call.
+ */
virtual bool is_null() { return 0; }
/*
it is "top level" item of WHERE clause and we do not need correct NULL
@@ -440,6 +450,7 @@ public:
max_length= 0;
name= name_par ? name_par : (char*) "NULL";
fixed= 1;
+ collation.set(&my_charset_bin, DERIVATION_IGNORABLE);
}
enum Type type() const { return NULL_ITEM; }
bool eq(const Item *item, bool binary_cmp) const;
@@ -570,6 +581,8 @@ public:
void print(String *str) { str->append('?'); }
/* parameter never equal to other parameter of other item */
bool eq(const Item *item, bool binary_cmp) const { return 0; }
+ bool is_null()
+ { DBUG_ASSERT(state != NO_VALUE); return state == NULL_VALUE; }
};
class Item_int :public Item_num
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 701894cacb5..4970517de87 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1744,12 +1744,13 @@ void Item_func_in::fix_length_and_dec()
Conversion is possible:
All IN arguments are constants.
*/
- Item_arena *arena= thd->current_arena, backup;
- if (arena->is_stmt_prepare())
- thd->set_n_backup_item_arena(arena, &backup);
+ Item_arena *arena, backup;
+ arena= thd->change_arena_if_needed(&backup);
+
for (arg= args+1, arg_end= args+arg_count; arg < arg_end; arg++)
{
- if (!my_charset_same(cmp_collation.collation,
+ if (!arg[0]->null_value &&
+ !my_charset_same(cmp_collation.collation,
arg[0]->collation.collation))
{
Item_string *conv;
@@ -1763,7 +1764,7 @@ void Item_func_in::fix_length_and_dec()
arg[0]= conv;
}
}
- if (arena->is_stmt_prepare())
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
}
}
@@ -2363,11 +2364,12 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
return 0;
}
int error;
- if ((error=regcomp(&preg,res->c_ptr(),
- (cmp_collation.collation->state & MY_CS_BINSORT) ?
- REG_EXTENDED | REG_NOSUB :
- REG_EXTENDED | REG_NOSUB | REG_ICASE,
- cmp_collation.collation)))
+ if ((error= regcomp(&preg,res->c_ptr(),
+ ((cmp_collation.collation->state & MY_CS_BINSORT) ||
+ (cmp_collation.collation->state & MY_CS_CSSORT)) ?
+ REG_EXTENDED | REG_NOSUB :
+ REG_EXTENDED | REG_NOSUB | REG_ICASE,
+ cmp_collation.collation)))
{
(void) regerror(error,&preg,buff,sizeof(buff));
my_printf_error(ER_REGEXP_ERROR,ER(ER_REGEXP_ERROR),MYF(0),buff);
@@ -2415,10 +2417,11 @@ longlong Item_func_regex::val_int()
regex_compiled=0;
}
if (regcomp(&preg,res2->c_ptr(),
- (cmp_collation.collation->state & MY_CS_BINSORT) ?
- REG_EXTENDED | REG_NOSUB :
- REG_EXTENDED | REG_NOSUB | REG_ICASE,
- cmp_collation.collation))
+ ((cmp_collation.collation->state & MY_CS_BINSORT) ||
+ (cmp_collation.collation->state & MY_CS_CSSORT)) ?
+ REG_EXTENDED | REG_NOSUB :
+ REG_EXTENDED | REG_NOSUB | REG_ICASE,
+ cmp_collation.collation))
{
null_value=1;
return 0;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 09d7e50eaa3..3fb5bcd01c6 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -160,14 +160,13 @@ bool Item_func::agg_arg_charsets(DTCollation &coll,
}
THD *thd= current_thd;
- Item_arena *arena= thd->current_arena, backup;
+ Item_arena *arena, backup;
bool res= FALSE;
/*
In case we're in statement prepare, create conversion item
in its memory: it will be reused on each execute.
*/
- if (arena->is_stmt_prepare())
- thd->set_n_backup_item_arena(arena, &backup);
+ arena= thd->change_arena_if_needed(&backup);
for (arg= args, last= args + nargs; arg < last; arg++)
{
@@ -193,7 +192,7 @@ bool Item_func::agg_arg_charsets(DTCollation &coll,
conv->fix_fields(thd, 0, &conv);
*arg= conv;
}
- if (arena->is_stmt_prepare())
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
return res;
}
@@ -265,7 +264,7 @@ Item_func::Item_func(THD *thd, Item_func *item)
Sets as a side effect the following class variables:
maybe_null Set if any argument may return NULL
with_sum_func Set if any of the arguments contains a sum function
- used_table_cache Set to union of the arguments used table
+ used_tables_cache Set to union of the tables used by arguments
str_value.charset If this is a string function, set this to the
character set for the first argument.
@@ -351,6 +350,7 @@ void Item_func::split_sum_func(THD *thd, Item **ref_pointer_array,
{
uint el= fields.elements;
Item *new_item= new Item_ref(ref_pointer_array + el, 0, item->name);
+ new_item->collation.set(item->collation);
fields.push_front(item);
ref_pointer_array[el]= item;
thd->change_item_tree(arg, new_item);
@@ -2340,6 +2340,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
entry->value=0;
entry->length=0;
entry->update_query_id=0;
+ entry->collation.set(NULL, DERIVATION_NONE);
/*
If we are here, we were called from a SET or a query which sets a
variable. Imagine it is this:
@@ -2381,7 +2382,24 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
is different from query_id).
*/
entry->update_query_id= thd->query_id;
- entry->collation.set(args[0]->collation);
+ /*
+ As it is wrong and confusing to associate any
+ character set with NULL, @a should be latin2
+ after this query sequence:
+
+ SET @a=_latin2'string';
+ SET @a=NULL;
+
+ I.e. the second query should not change the charset
+ to the current default value, but should keep the
+ original value assigned during the first query.
+ In order to do it, we don't copy charset
+ from the argument if the argument is NULL
+ and the variable has previously been initialized.
+ */
+ if (!entry->collation.collation || !args[0]->null_value)
+ entry->collation.set(args[0]->collation);
+ collation.set(entry->collation);
cached_result_type= args[0]->result_type();
return 0;
}
@@ -2409,7 +2427,6 @@ bool Item_func_set_user_var::update_hash(void *ptr, uint length,
my_free(entry->value,MYF(0));
entry->value=0;
entry->length=0;
- entry->collation.set(cs, dv);
}
else
{
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 81fff899ec7..5a23eec5a1b 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2562,9 +2562,12 @@ String* Item_func_inet_ntoa::val_str(String* str)
This function is very useful when you want to generate SQL statements
- RETURN VALUES
+ NOTE
+ QUOTE(NULL) returns the string 'NULL' (4 letters, without quotes).
+
+ RETURN VALUES
str Quoted string
- NULL Argument to QUOTE() was NULL or out of memory.
+ NULL Out of memory.
*/
#define get_esc_bit(mask, num) (1 & (*((mask) + ((num) >> 3))) >> ((num) & 7))
@@ -2589,7 +2592,12 @@ String *Item_func_quote::val_str(String *str)
String *arg= args[0]->val_str(str);
uint arg_length, new_length;
if (!arg) // Null argument
- goto null;
+ {
+ str->copy("NULL", 4, collation.collation); // Return the string 'NULL'
+ null_value= 0;
+ return str;
+ }
+
arg_length= arg->length();
new_length= arg_length+2; /* for beginning and ending ' signs */
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 401d4dee20f..62cd016b0df 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -190,15 +190,16 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
bool Item_subselect::exec()
{
int res;
- MEM_ROOT *old_root= my_pthread_getspecific_ptr(MEM_ROOT*, THR_MALLOC);
- if (&thd->mem_root != old_root)
- {
- my_pthread_setspecific_ptr(THR_MALLOC, &thd->mem_root);
- res= engine->exec();
- my_pthread_setspecific_ptr(THR_MALLOC, old_root);
- }
- else
- res= engine->exec();
+ MEM_ROOT *old_root= thd->mem_root;
+
+ /*
+ As this is execution, all objects should be allocated through the main
+ mem root
+ */
+ thd->mem_root= &thd->main_mem_root;
+ res= engine->exec();
+ thd->mem_root= old_root;
+
if (engine_changed)
{
engine_changed= 0;
@@ -312,7 +313,6 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
/* Juggle with current arena only if we're in prepared statement prepare */
Item_arena *arena= join->thd->current_arena;
- Item_arena backup;
if (!select_lex->master_unit()->first_select()->next_select() &&
!select_lex->table_list.elements &&
@@ -655,11 +655,9 @@ Item_in_subselect::single_value_transformer(JOIN *join,
}
SELECT_LEX *select_lex= join->select_lex;
- Item_arena *arena= join->thd->current_arena, backup;
-
+ Item_arena *arena, backup;
+ arena= thd->change_arena_if_needed(&backup);
thd->where= "scalar IN/ALL/ANY subquery";
- if (arena->is_stmt_prepare())
- thd->set_n_backup_item_arena(arena, &backup);
/*
Check that the right part of the subselect contains no more than one
@@ -892,7 +890,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_SELECT_REDUCED, warn_buff);
}
- if (arena->is_stmt_prepare())
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
DBUG_RETURN(RES_REDUCE);
}
@@ -900,13 +898,13 @@ Item_in_subselect::single_value_transformer(JOIN *join,
}
ok:
- if (arena->is_stmt_prepare())
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
thd->where= save_where;
DBUG_RETURN(RES_OK);
err:
- if (arena->is_stmt_prepare())
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
DBUG_RETURN(RES_ERROR);
}
@@ -922,14 +920,12 @@ Item_in_subselect::row_value_transformer(JOIN *join)
{
DBUG_RETURN(RES_OK);
}
- Item_arena *arena= join->thd->current_arena, backup;
+ Item_arena *arena, backup;
Item *item= 0;
+ SELECT_LEX *select_lex= join->select_lex;
thd->where= "row IN/ALL/ANY subquery";
- if (arena->is_stmt_prepare())
- thd->set_n_backup_item_arena(arena, &backup);
-
- SELECT_LEX *select_lex= join->select_lex;
+ arena= thd->change_arena_if_needed(&backup);
if (select_lex->item_list.elements != left_expr->cols())
{
@@ -1006,13 +1002,13 @@ Item_in_subselect::row_value_transformer(JOIN *join)
if (join->conds->fix_fields(thd, join->tables_list, 0))
goto err;
}
- if (arena->is_stmt_prepare())
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
thd->where= save_where;
DBUG_RETURN(RES_OK);
err:
- if (arena->is_stmt_prepare())
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
DBUG_RETURN(RES_ERROR);
}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index e6c96dd6a9a..c43a7d87f8f 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -218,16 +218,13 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
hybrid_type= item->result_type();
if (hybrid_type == INT_RESULT)
{
- cmp_charset= &my_charset_bin;
max_length=20;
}
else if (hybrid_type == REAL_RESULT)
{
- cmp_charset= &my_charset_bin;
max_length=float_length(decimals);
}else
{
- cmp_charset= item->collation.collation;
max_length=item->max_length;
}
decimals=item->decimals;
@@ -254,7 +251,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
Item *Item_sum_sum::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_sum(thd, this);
+ return new (thd->mem_root) Item_sum_sum(thd, this);
}
@@ -282,7 +279,7 @@ double Item_sum_sum::val()
Item *Item_sum_count::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_count(thd, this);
+ return new (thd->mem_root) Item_sum_count(thd, this);
}
@@ -327,7 +324,7 @@ void Item_sum_count::cleanup()
Item *Item_sum_avg::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_avg(thd, this);
+ return new (thd->mem_root) Item_sum_avg(thd, this);
}
@@ -374,7 +371,7 @@ double Item_sum_std::val()
Item *Item_sum_std::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_std(thd, this);
+ return new (thd->mem_root) Item_sum_std(thd, this);
}
@@ -384,7 +381,7 @@ Item *Item_sum_std::copy_or_same(THD* thd)
Item *Item_sum_variance::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_variance(thd, this);
+ return new (thd->mem_root) Item_sum_variance(thd, this);
}
@@ -546,7 +543,7 @@ void Item_sum_hybrid::cleanup()
Item *Item_sum_min::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_min(thd, this);
+ return new (thd->mem_root) Item_sum_min(thd, this);
}
@@ -557,7 +554,7 @@ bool Item_sum_min::add()
{
String *result=args[0]->val_str(&tmp_value);
if (!args[0]->null_value &&
- (null_value || sortcmp(&value,result,cmp_charset) > 0))
+ (null_value || sortcmp(&value,result,collation.collation) > 0))
{
value.copy(*result);
null_value=0;
@@ -599,7 +596,7 @@ bool Item_sum_min::add()
Item *Item_sum_max::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_max(thd, this);
+ return new (thd->mem_root) Item_sum_max(thd, this);
}
@@ -610,7 +607,7 @@ bool Item_sum_max::add()
{
String *result=args[0]->val_str(&tmp_value);
if (!args[0]->null_value &&
- (null_value || sortcmp(&value,result,cmp_charset) < 0))
+ (null_value || sortcmp(&value,result,collation.collation) < 0))
{
value.copy(*result);
null_value=0;
@@ -666,7 +663,7 @@ void Item_sum_bit::clear()
Item *Item_sum_or::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_or(thd, this);
+ return new (thd->mem_root) Item_sum_or(thd, this);
}
@@ -680,7 +677,7 @@ bool Item_sum_or::add()
Item *Item_sum_xor::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_xor(thd, this);
+ return new (thd->mem_root) Item_sum_xor(thd, this);
}
@@ -694,7 +691,7 @@ bool Item_sum_xor::add()
Item *Item_sum_and::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_and(thd, this);
+ return new (thd->mem_root) Item_sum_and(thd, this);
}
@@ -921,7 +918,7 @@ Item_sum_hybrid::min_max_update_str_field()
result_field->val_str(&tmp_value);
if (result_field->is_null() ||
- (cmp_sign * sortcmp(res_str,&tmp_value,cmp_charset)) < 0)
+ (cmp_sign * sortcmp(res_str,&tmp_value,collation.collation)) < 0)
result_field->store(res_str->ptr(),res_str->length(),res_str->charset());
result_field->set_notnull();
}
@@ -1337,7 +1334,7 @@ int Item_sum_count_distinct::tree_to_myisam()
Item *Item_sum_count_distinct::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_count_distinct(thd, this);
+ return new (thd->mem_root) Item_sum_count_distinct(thd, this);
}
@@ -1438,7 +1435,7 @@ bool Item_udf_sum::add()
Item *Item_sum_udf_float::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_udf_float(thd, this);
+ return new (thd->mem_root) Item_sum_udf_float(thd, this);
}
double Item_sum_udf_float::val()
@@ -1463,7 +1460,7 @@ String *Item_sum_udf_float::val_str(String *str)
Item *Item_sum_udf_int::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_udf_int(thd, this);
+ return new (thd->mem_root) Item_sum_udf_int(thd, this);
}
@@ -1501,7 +1498,7 @@ void Item_sum_udf_str::fix_length_and_dec()
Item *Item_sum_udf_str::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_sum_udf_str(thd, this);
+ return new (thd->mem_root) Item_sum_udf_str(thd, this);
}
@@ -1815,7 +1812,7 @@ Item_func_group_concat::~Item_func_group_concat()
Item *Item_func_group_concat::copy_or_same(THD* thd)
{
- return new (&thd->mem_root) Item_func_group_concat(thd, this);
+ return new (thd->mem_root) Item_func_group_concat(thd, this);
}
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 5aa0d37190b..f9c48304795 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -402,20 +402,19 @@ class Item_sum_hybrid :public Item_sum
enum_field_types hybrid_field_type;
int cmp_sign;
table_map used_table_cache;
- CHARSET_INFO *cmp_charset;
public:
Item_sum_hybrid(Item *item_par,int sign)
:Item_sum(item_par), sum(0.0), sum_int(0),
hybrid_type(INT_RESULT), hybrid_field_type(FIELD_TYPE_LONGLONG),
- cmp_sign(sign), used_table_cache(~(table_map) 0),
- cmp_charset(&my_charset_bin)
- {}
+ cmp_sign(sign), used_table_cache(~(table_map) 0)
+ { collation.set(&my_charset_bin); }
Item_sum_hybrid(THD *thd, Item_sum_hybrid *item):
Item_sum(thd, item), value(item->value),
sum(item->sum), sum_int(item->sum_int), hybrid_type(item->hybrid_type),
hybrid_field_type(item->hybrid_field_type),cmp_sign(item->cmp_sign),
- used_table_cache(item->used_table_cache), cmp_charset(item->cmp_charset) {}
+ used_table_cache(item->used_table_cache)
+ { collation.set(item->collation); }
bool fix_fields(THD *, TABLE_LIST *, Item **);
table_map used_tables() const { return used_table_cache; }
bool const_item() const { return !used_table_cache; }
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index f621953a5bc..354c8b5c50c 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -161,23 +161,24 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
{
int weekday= 0, yearday= 0, daypart= 0;
int week_number= -1;
- CHARSET_INFO *cs= &my_charset_bin;
int error= 0;
+ int strict_week_number_year= -1;
+ int frac_part;
bool usa_time= 0;
bool sunday_first_n_first_week_non_iso;
bool strict_week_number;
- int strict_week_number_year= -1;
bool strict_week_number_year_type;
- int frac_part;
const char *val_begin= val;
const char *val_end= val + length;
const char *ptr= format->format.str;
const char *end= ptr + format->format.length;
+ CHARSET_INFO *cs= &my_charset_bin;
DBUG_ENTER("extract_date_time");
- LINT_INIT(sunday_first_n_first_week_non_iso);
LINT_INIT(strict_week_number);
- LINT_INIT(strict_week_number_year_type);
+ /* Remove valgrind varnings when using gcc 3.3 and -O1 */
+ PURIFY_OR_LINT_INIT(strict_week_number_year_type);
+ PURIFY_OR_LINT_INIT(sunday_first_n_first_week_non_iso);
if (!sub_pattern_end)
bzero((char*) l_time, sizeof(*l_time));
@@ -1600,50 +1601,46 @@ void Item_func_from_unixtime::fix_length_and_dec()
String *Item_func_from_unixtime::val_str(String *str)
{
TIME time_tmp;
- my_time_t tmp;
-
+
DBUG_ASSERT(fixed == 1);
- tmp= (time_t) args[0]->val_int();
- if ((null_value=args[0]->null_value))
- goto null_date;
-
- thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, tmp);
-
+
+ if (get_date(&time_tmp, 0))
+ return 0;
+
if (str->alloc(20*MY_CHARSET_BIN_MB_MAXLEN))
- goto null_date;
+ {
+ null_value= 1;
+ return 0;
+ }
+
make_datetime((DATE_TIME_FORMAT *) 0, &time_tmp, str);
return str;
-
-null_date:
- null_value=1;
- return 0;
}
longlong Item_func_from_unixtime::val_int()
{
TIME time_tmp;
- my_time_t tmp;
-
+
DBUG_ASSERT(fixed == 1);
- tmp= (time_t) (ulong) args[0]->val_int();
- if ((null_value=args[0]->null_value))
+ if (get_date(&time_tmp, 0))
return 0;
-
- current_thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, tmp);
-
+
return (longlong) TIME_to_ulonglong_datetime(&time_tmp);
}
bool Item_func_from_unixtime::get_date(TIME *ltime,
uint fuzzy_date __attribute__((unused)))
{
- my_time_t tmp=(my_time_t) args[0]->val_int();
- if ((null_value=args[0]->null_value))
+ longlong tmp= args[0]->val_int();
+
+ if ((null_value= (args[0]->null_value ||
+ tmp < TIMESTAMP_MIN_VALUE ||
+ tmp > TIMESTAMP_MAX_VALUE)))
return 1;
-
- current_thd->variables.time_zone->gmt_sec_to_TIME(ltime, tmp);
+
+ thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)tmp);
return 0;
}
diff --git a/sql/lex.h b/sql/lex.h
index c64a7069c32..325d052de90 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -114,6 +114,7 @@ static SYMBOL symbols[] = {
{ "COMMITTED", SYM(COMMITTED_SYM)},
{ "COMPRESSED", SYM(COMPRESSED_SYM)},
{ "CONCURRENT", SYM(CONCURRENT)},
+ { "CONSISTENT", SYM(CONSISTENT_SYM)},
{ "CONSTRAINT", SYM(CONSTRAINT)},
{ "CONVERT", SYM(CONVERT_SYM)},
{ "CREATE", SYM(CREATE)},
@@ -382,6 +383,7 @@ static SYMBOL symbols[] = {
{ "SIGNED", SYM(SIGNED_SYM)},
{ "SIMPLE", SYM(SIMPLE_SYM)},
{ "SLAVE", SYM(SLAVE)},
+ { "SNAPSHOT", SYM(SNAPSHOT_SYM)},
{ "SMALLINT", SYM(SMALLINT)},
{ "SOME", SYM(ANY_SYM)},
{ "SONAME", SYM(UDF_SONAME_SYM)},
diff --git a/sql/log.cc b/sql/log.cc
index ef57a57d3b4..460910fcee8 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1450,7 +1450,8 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
if (flush_io_cache(file) || sync_binlog(file))
goto err;
- if (opt_using_transactions && !my_b_tell(&thd->transaction.trans_log))
+ if (opt_using_transactions &&
+ !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
{
/*
LOAD DATA INFILE in AUTOCOMMIT=1 mode writes to the binlog
@@ -1598,6 +1599,14 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
{
Query_log_event qinfo(thd, "BEGIN", 5, TRUE);
/*
+ Imagine this is rollback due to net timeout, after all statements of
+ the transaction succeeded. Then we want a zero-error code in BEGIN.
+ In other words, if there was a really serious error code it's already
+ in the statement's events.
+ This is safer than thd->clear_error() against kills at shutdown.
+ */
+ qinfo.error_code= 0;
+ /*
Now this Query_log_event has artificial log_pos 0. It must be adjusted
to reflect the real position in the log. Not doing it would confuse the
slave: it would prevent this one from knowing where he is in the
@@ -1630,6 +1639,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
commit_or_rollback ? "COMMIT" : "ROLLBACK",
commit_or_rollback ? 6 : 8,
TRUE);
+ qinfo.error_code= 0;
qinfo.set_log_pos(this);
if (qinfo.write(&log_file) || flush_io_cache(&log_file) ||
sync_binlog(&log_file))
@@ -1703,6 +1713,8 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
time_t current_time;
if (!is_open())
return 0;
+ DBUG_ENTER("MYSQL_LOG::write");
+
VOID(pthread_mutex_lock(&LOCK_log));
if (is_open())
{ // Safety agains reopen
@@ -1712,7 +1724,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
if (!(thd->options & OPTION_UPDATE_LOG))
{
VOID(pthread_mutex_unlock(&LOCK_log));
- return 0;
+ DBUG_RETURN(0);
}
if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT) || query_start_arg)
{
@@ -1812,7 +1824,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
}
}
VOID(pthread_mutex_unlock(&LOCK_log));
- return error;
+ DBUG_RETURN(error);
}
@@ -1832,16 +1844,19 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
THD::enter_cond() (see NOTES in sql_class.h).
*/
-void MYSQL_LOG:: wait_for_update(THD* thd, bool master_or_slave)
+void MYSQL_LOG::wait_for_update(THD* thd, bool master_or_slave)
{
- const char* old_msg = thd->enter_cond(&update_cond, &LOCK_log,
- master_or_slave ?
- "Has read all relay log; waiting for \
-the slave I/O thread to update it" :
- "Has sent all binlog to slave; \
-waiting for binlog to be updated");
+ const char *old_msg;
+ DBUG_ENTER("wait_for_update");
+ old_msg= thd->enter_cond(&update_cond, &LOCK_log,
+ master_or_slave ?
+ "Has read all relay log; waiting for the slave I/O "
+ "thread to update it" :
+ "Has sent all binlog to slave; waiting for binlog "
+ "to be updated");
pthread_cond_wait(&update_cond, &LOCK_log);
thd->exit_cond(old_msg);
+ DBUG_VOID_RETURN;
}
@@ -2198,6 +2213,15 @@ void MYSQL_LOG::report_pos_in_innodb()
DBUG_VOID_RETURN;
}
+
+void MYSQL_LOG::signal_update()
+{
+ DBUG_ENTER("MYSQL_LOG::signal_update");
+ pthread_cond_broadcast(&update_cond);
+ DBUG_VOID_RETURN;
+}
+
+
#ifdef __NT__
void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
uint length, int buffLen)
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 326f2fc5c59..2fdc89504d7 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -977,7 +977,8 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
int Query_log_event::exec_event(struct st_relay_log_info* rli)
{
int expected_error,actual_error= 0;
- thd->db= (char*) rewrite_db(db); // thd->db_length is set later if needed
+ thd->db_length= db_len;
+ thd->db= (char*) rewrite_db(db, &thd->db_length);
/*
InnoDB internally stores the master log position it has processed so far;
@@ -995,11 +996,6 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
thd->set_time((time_t)when);
- /*
- We cannot use db_len from event to fill thd->db_length, because
- rewrite_db() may have changed db.
- */
- thd->db_length= thd->db ? strlen(thd->db) : 0;
thd->query_length= q_len;
thd->query = (char*)query;
VOID(pthread_mutex_lock(&LOCK_thread_count));
@@ -1057,7 +1053,7 @@ Default database: '%s'. Query: '%s'",
expected_error,
actual_error ? thd->net.last_error: "no error",
actual_error,
- print_slave_db_safe(db), query);
+ print_slave_db_safe(thd->db), query);
thd->query_error= 1;
}
/*
@@ -1078,7 +1074,7 @@ Default database: '%s'. Query: '%s'",
"Error '%s' on query. Default database: '%s'. Query: '%s'",
(actual_error ? thd->net.last_error :
"unexpected success or fatal error"),
- print_slave_db_safe(db), query);
+ print_slave_db_safe(thd->db), query);
thd->query_error= 1;
}
} /* End of if (db_ok(... */
@@ -1090,7 +1086,7 @@ end:
thd->query_length= thd->db_length =0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
close_thread_tables(thd);
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
/*
If there was an error we stop. Otherwise we increment positions. Note that
we will not increment group* positions if we are just after a SET
@@ -1659,16 +1655,22 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db,
/*
Load_log_event::set_fields()
+
+ Note that this function can not use the member variable
+ for the database, since LOAD DATA INFILE on the slave
+ can be for a different database than the current one.
+ This is the reason for the affected_db argument to this method.
*/
#ifndef MYSQL_CLIENT
-void Load_log_event::set_fields(List<Item> &field_list)
+void Load_log_event::set_fields(const char* affected_db,
+ List<Item> &field_list)
{
uint i;
const char* field = fields;
for (i= 0; i < num_fields; i++)
{
- field_list.push_back(new Item_field(db, table_name, field));
+ field_list.push_back(new Item_field(affected_db, table_name, field));
field+= field_lens[i] + 1;
}
}
@@ -1706,7 +1708,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
bool use_rli_only_for_errors)
{
char *load_data_query= 0;
- thd->db= (char*) rewrite_db(db); // thd->db_length is set later if needed
+ thd->db_length= db_len;
+ thd->db= (char*) rewrite_db(db, &thd->db_length);
DBUG_ASSERT(thd->query == 0);
thd->query_length= 0; // Should not be needed
thd->query_error= 0;
@@ -1741,7 +1744,6 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
thd->set_time((time_t)when);
- thd->db_length= thd->db ? strlen(thd->db) : 0;
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id = query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
@@ -1824,7 +1826,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
ex.skip_lines = skip_lines;
List<Item> field_list;
- set_fields(field_list);
+ set_fields(thd->db,field_list);
thd->variables.pseudo_thread_id= thread_id;
if (net)
{
@@ -1841,13 +1843,13 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
if (thd->cuted_fields)
{
/* log_pos is the position of the LOAD event in the master log */
- sql_print_error("\
-Slave: load data infile on table '%s' at log position %s in log \
-'%s' produced %ld warning(s). Default database: '%s'",
- (char*) table_name,
- llstr(log_pos,llbuff), RPL_LOG_NAME,
- (ulong) thd->cuted_fields,
- print_slave_db_safe(db));
+ sql_print_warning("Slave: load data infile on table '%s' at "
+ "log position %s in log '%s' produced %ld "
+ "warning(s). Default database: '%s'",
+ (char*) table_name,
+ llstr(log_pos,llbuff), RPL_LOG_NAME,
+ (ulong) thd->cuted_fields,
+ print_slave_db_safe(thd->db));
}
if (net)
net->pkt_nr= thd->net.pkt_nr;
@@ -1865,6 +1867,7 @@ Slave: load data infile on table '%s' at log position %s in log \
}
thd->net.vio = 0;
+ char *save_db= thd->db;
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->db= 0;
thd->query= 0;
@@ -1887,17 +1890,17 @@ Slave: load data infile on table '%s' at log position %s in log \
}
slave_print_error(rli,sql_errno,"\
Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
- err, (char*)table_name, print_slave_db_safe(db));
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ err, (char*)table_name, print_slave_db_safe(save_db));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
return 1;
}
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
if (thd->is_fatal_error)
{
slave_print_error(rli,ER_UNKNOWN_ERROR, "\
Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'",
- (char*)table_name, print_slave_db_safe(db));
+ (char*)table_name, print_slave_db_safe(save_db));
return 1;
}
@@ -2505,7 +2508,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli)
*/
e.fix_fields(thd, 0, 0);
e.update_hash(val, val_len, type, charset, DERIVATION_NONE);
- free_root(&thd->mem_root,0);
+ free_root(thd->mem_root,0);
rli->inc_event_relay_log_pos(get_event_len());
return 0;
@@ -2839,7 +2842,7 @@ void Create_file_log_event::print(FILE* file, bool short_form,
if (enable_local)
{
- Load_log_event::print(file, 1, last_db, !check_fname_outside_temp_buf());
+ Load_log_event::print(file, short_form, last_db, !check_fname_outside_temp_buf());
/*
That one is for "file_id: etc" below: in mysqlbinlog we want the #, in
SHOW BINLOG EVENTS we don't.
diff --git a/sql/log_event.h b/sql/log_event.h
index 8070c334d8b..1606659e21e 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -587,7 +587,7 @@ public:
const char* table_name_arg,
List<Item>& fields_arg, enum enum_duplicates handle_dup,
bool using_trans);
- void set_fields(List<Item> &fields_arg);
+ void set_fields(const char* db, List<Item> &fields_arg);
const char* get_db() { return db; }
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 770b7057661..3f55a88b262 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -910,7 +910,7 @@ extern char *default_tz_name;
extern MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
extern FILE *bootstrap_file;
-extern pthread_key(MEM_ROOT*,THR_MALLOC);
+extern pthread_key(MEM_ROOT**,THR_MALLOC);
extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
LOCK_thread_count,LOCK_mapped_file,LOCK_user_locks, LOCK_status,
LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator,
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index ea4d52359f1..43407b345fa 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -374,7 +374,7 @@ SHOW_COMP_OPTION have_crypt, have_compress;
/* Thread specific variables */
-pthread_key(MEM_ROOT*,THR_MALLOC);
+pthread_key(MEM_ROOT**,THR_MALLOC);
pthread_key(THD*, THR_THD);
pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count,
LOCK_mapped_file, LOCK_status,
@@ -541,7 +541,7 @@ static void close_connections(void)
struct timespec abstime;
int error;
LINT_INIT(error);
- DBUG_PRINT("info",("Waiting for select_thread"));
+ DBUG_PRINT("info",("Waiting for select thread"));
#ifndef DONT_USE_THR_ALARM
if (pthread_kill(select_thread,THR_CLIENT_ALARM))
@@ -2315,8 +2315,6 @@ bool init_global_datetime_format(timestamp_type format_type,
static int init_common_variables(const char *conf_file_name, int argc,
char **argv, const char **groups)
{
- my_umask=0660; // Default umask for new files
- my_umask_dir=0700; // Default umask for new directories
umask(((~my_umask) & 0666));
tzset(); // Set tzname
@@ -3964,7 +3962,10 @@ enum options_mysqld
OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB,
OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG,
- OPT_INNODB, OPT_ISAM, OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_SKIP_SAFEMALLOC,
+ OPT_INNODB, OPT_ISAM,
+ OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_NDB_USE_EXACT_COUNT,
+ OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
+ OPT_SKIP_SAFEMALLOC,
OPT_TEMP_POOL, OPT_TX_ISOLATION,
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
@@ -4257,7 +4258,7 @@ Disable with --skip-innodb (will save memory).",
"Percentage of dirty pages allowed in bufferpool.", (gptr*) &srv_max_buf_pool_modified_pct,
(gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0},
{"innodb_max_purge_lag", OPT_INNODB_MAX_PURGE_LAG,
- "",
+ "Desired maximum length of the purge queue (0 = no limit)",
(gptr*) &srv_max_purge_lag,
(gptr*) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L,
0, 1L, 0},
@@ -4266,7 +4267,7 @@ Disable with --skip-innodb (will save memory).",
(gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file,
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_table_locks", OPT_INNODB_TABLE_LOCKS,
- "If Innodb should enforce LOCK TABLE",
+ "Enable InnoDB locking in LOCK TABLES",
(gptr*) &global_system_variables.innodb_table_locks,
(gptr*) &global_system_variables.innodb_table_locks,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
@@ -4403,9 +4404,26 @@ Disable with --skip-ndbcluster (will save memory).",
(gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 1, 0, 0,
0, 0, 0},
#ifdef HAVE_NDBCLUSTER_DB
- {"ndb-connectstring", OPT_NDB_CONNECTSTRING, "Connect string for ndbcluster.",
- (gptr*) &ndbcluster_connectstring, (gptr*) &ndbcluster_connectstring, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"ndb-connectstring", OPT_NDB_CONNECTSTRING,
+ "Connect string for ndbcluster.",
+ (gptr*) &ndbcluster_connectstring, (gptr*) &ndbcluster_connectstring,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"ndb_autoincrement_prefetch_sz", OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
+ "Specify number of autoincrement values that are prefetched",
+ (gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz,
+ (gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz,
+ 0, GET_INT, REQUIRED_ARG, 32, 1, 256, 0, 0, 0},
+ {"ndb_force_send", OPT_NDB_FORCE_SEND,
+ "Force send of buffers to ndb immediately without waiting for other threads",
+ (gptr*) &global_system_variables.ndb_force_send,
+ (gptr*) &global_system_variables.ndb_force_send,
+ 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
+ {"ndb_use_exact_count", OPT_NDB_USE_EXACT_COUNT,
+ "Use exact records count during query planning and for "
+ "fast select count(*)",
+ (gptr*) &global_system_variables.ndb_use_exact_count,
+ (gptr*) &global_system_variables.ndb_use_exact_count,
+ 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
#endif
{"new", 'n', "Use very new possible 'unsafe' functions.",
(gptr*) &global_system_variables.new_mode,
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index c9528af7d98..d25901e56b1 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -400,7 +400,7 @@ QUICK_SELECT::QUICK_SELECT(THD *thd, TABLE *table, uint key_nr, bool no_alloc)
{
// Allocates everything through the internal memroot
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0);
- my_pthread_setspecific_ptr(THR_MALLOC,&alloc);
+ thd->mem_root= &alloc;
}
else
bzero((char*) &alloc,sizeof(alloc));
@@ -668,8 +668,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
DBUG_RETURN(0); // Can't use range
}
key_parts= param.key_parts;
- old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
- my_pthread_setspecific_ptr(THR_MALLOC,&alloc);
+ old_root= thd->mem_root;
+ thd->mem_root= &alloc;
key_info= head->key_info;
for (idx=0 ; idx < head->keys ; idx++, key_info++)
@@ -769,7 +769,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
}
}
free_root(&alloc,MYF(0)); // Return memory & allocator
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ thd->mem_root= old_root;
thd->no_errors=0;
}
DBUG_EXECUTE("info",print_quick(quick,&needed_reg););
@@ -2563,7 +2563,8 @@ static bool null_part_in_key(KEY_PART *key_part, const char *key, uint length)
QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref)
{
- MEM_ROOT *old_root= my_pthread_getspecific_ptr(MEM_ROOT*, THR_MALLOC);
+ MEM_ROOT *old_root= thd->mem_root;
+ /* The following call may change thd->mem_root */
QUICK_SELECT *quick= new QUICK_SELECT(thd, table, ref->key);
KEY *key_info = &table->key_info[ref->key];
KEY_PART *key_part;
@@ -2624,11 +2625,11 @@ QUICK_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, TABLE_REF *ref)
}
ok:
- my_pthread_setspecific_ptr(THR_MALLOC, old_root);
+ thd->mem_root= old_root;
return quick;
err:
- my_pthread_setspecific_ptr(THR_MALLOC, old_root);
+ thd->mem_root= old_root;
delete quick;
return 0;
}
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 83fceca80ef..720e82f414e 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -92,7 +92,7 @@ static int init_failsafe_rpl_thread(THD* thd)
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
#endif
- thd->mem_root.free=thd->mem_root.used=0;
+ thd->mem_root->free= thd->mem_root->used= 0;
if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options|= OPTION_BIG_SELECTS;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 905bffac29a..2031ac15412 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -359,6 +359,23 @@ sys_var_thd_bool sys_innodb_table_locks("innodb_table_locks",
sys_var_long_ptr sys_innodb_autoextend_increment("innodb_autoextend_increment",
&srv_auto_extend_increment);
#endif
+#ifdef HAVE_NDBCLUSTER_DB
+// ndb thread specific variable settings
+sys_var_thd_ulong
+sys_ndb_autoincrement_prefetch_sz("ndb_autoincrement_prefetch_sz",
+ &SV::ndb_autoincrement_prefetch_sz);
+sys_var_thd_bool
+sys_ndb_force_send("ndb_force_send",
+ &SV::ndb_force_send);
+sys_var_thd_bool
+sys_ndb_use_exact_count("ndb_use_exact_count",
+ &SV::ndb_use_exact_count);
+sys_var_thd_bool
+sys_ndb_use_transactions("ndb_use_transactions",
+ &SV::ndb_use_transactions);
+// ndb server global variable settings
+// none
+#endif
/* Time/date/datetime formats */
@@ -612,7 +629,13 @@ sys_var *sys_variables[]=
&sys_innodb_table_locks,
&sys_innodb_max_purge_lag,
&sys_innodb_autoextend_increment,
-#endif
+#endif
+#ifdef HAVE_NDBCLUSTER_DB
+ &sys_ndb_autoincrement_prefetch_sz,
+ &sys_ndb_force_send,
+ &sys_ndb_use_exact_count,
+ &sys_ndb_use_transactions,
+#endif
&sys_unique_checks,
&sys_warning_count
};
@@ -773,6 +796,13 @@ struct show_var_st init_vars[]= {
#ifdef __NT__
{"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL},
#endif
+#ifdef HAVE_NDBCLUSTER_DB
+ {sys_ndb_autoincrement_prefetch_sz.name,
+ (char*) &sys_ndb_autoincrement_prefetch_sz, SHOW_SYS},
+ {sys_ndb_force_send.name, (char*) &sys_ndb_force_send, SHOW_SYS},
+ {sys_ndb_use_exact_count.name,(char*) &sys_ndb_use_exact_count, SHOW_SYS},
+ {sys_ndb_use_transactions.name,(char*) &sys_ndb_use_transactions, SHOW_SYS},
+#endif
{sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS},
{sys_net_read_timeout.name, (char*) &sys_net_read_timeout, SHOW_SYS},
{sys_net_retry_count.name, (char*) &sys_net_retry_count, SHOW_SYS},
@@ -1165,7 +1195,7 @@ static void fix_max_connections(THD *thd, enum_var_type type)
static void fix_thd_mem_root(THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
- reset_root_defaults(&thd->mem_root,
+ reset_root_defaults(thd->mem_root,
thd->variables.query_alloc_block_size,
thd->variables.query_prealloc_size);
}
@@ -2703,13 +2733,18 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list)
while ((var=it++))
{
if ((error=var->check(thd)))
- DBUG_RETURN(error);
+ goto err;
}
- if (thd->net.report_error)
- DBUG_RETURN(1);
- it.rewind();
- while ((var=it++))
- error|= var->update(thd); // Returns 0, -1 or 1
+ if (!thd->net.report_error)
+ {
+ it.rewind();
+ while ((var= it++))
+ error|= var->update(thd); // Returns 0, -1 or 1
+ }
+ else
+ error= 1;
+err:
+ free_underlaid_joins(thd, &thd->lex->select_lex);
DBUG_RETURN(error);
}
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 355e784b156..bb2bd29171a 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -209,7 +209,7 @@ character-set=latin1
"Erreur d'écriture réseau reçue du maître",
"Impossible de trouver un index FULLTEXT correspondant à cette liste de colonnes",
"Impossible d'exécuter la commande car vous avez des tables verrouillées ou une transaction active",
-"Variable système '%-.64' inconnue",
+"Variable système '%-.64s' inconnue",
"La table '%-.64s' est marquée 'crashed' et devrait être réparée",
"La table '%-.64s' est marquée 'crashed' et le dernier 'repair' a échoué",
"Attention: certaines tables ne supportant pas les transactions ont été changées et elles ne pourront pas être restituées",
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index 06f31a79a73..87168431595 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -168,7 +168,7 @@ character-set=greek
"You have an error in your SQL syntax",
"Delayed insert thread couldn't get requested lock for table %-.64s",
"Too many delayed threads in use",
-"Aborted connection %ld to db: '%-.64s' user: '%-32s' (%-.64s)",
+"Aborted connection %ld to db: '%-.64s' user: '%-.32s' (%-.64s)",
"Got a packet bigger than 'max_allowed_packet' bytes",
"Got a read error from the connection pipe",
"Got an error from fcntl()",
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index c79c346008e..65d80918072 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -211,7 +211,7 @@ character-set=latin1
"Erro de rede gravando no 'master'",
"Não pode encontrar um índice para o texto todo que combine com a lista de colunas",
"Não pode executar o comando dado porque você tem tabelas ativas travadas ou uma transação ativa",
-"Variável de sistema '%-.64' desconhecida",
+"Variável de sistema '%-.64s' desconhecida",
"Tabela '%-.64s' está marcada como danificada e deve ser reparada",
"Tabela '%-.64s' está marcada como danificada e a última reparação (automática?) falhou",
"Aviso: Algumas tabelas não-transacionais alteradas não puderam ser reconstituídas (rolled back)",
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 7cb0427dc3f..01c22f00119 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -173,7 +173,7 @@ character-set=latin2
"Aveti o eroare in sintaxa RSQL",
"Thread-ul pentru inserarea aminata nu a putut obtine lacatul (lock) pentru tabela %-.64s",
"Prea multe threaduri aminate care sint in uz",
-"Conectie terminata %ld la baza de date: '%-.64s' utilizator: '%-32s' (%-.64s)",
+"Conectie terminata %ld la baza de date: '%-.64s' utilizator: '%-.32s' (%-.64s)",
"Un packet mai mare decit 'max_allowed_packet' a fost primit",
"Eroare la citire din cauza lui 'connection pipe'",
"Eroare obtinuta de la fcntl()",
diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt
index 45b56c8269c..06270f621e4 100644
--- a/sql/share/serbian/errmsg.txt
+++ b/sql/share/serbian/errmsg.txt
@@ -202,7 +202,7 @@ character-set=cp1250
"Greška u slanju mrežnih paketa na glavni server u klasteru",
"Ne mogu da pronaðem 'FULLTEXT' indeks koli odgovara listi kolona",
"Ne mogu da izvršim datu komandu zbog toga što su tabele zakljuèane ili je transakcija u toku",
-"Nepoznata sistemska promenljiva '%-.64'",
+"Nepoznata sistemska promenljiva '%-.64s'",
"Tabela '%-.64s' je markirana kao ošteæena i trebala bi biti popravljena",
"Tabela '%-.64s' je markirana kao ošteæena, a zadnja (automatska?) popravka je bila neuspela",
"Upozorenje: Neke izmenjene tabele ne podržavaju komandu 'ROLLBACK'",
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index bd2439c44a6..c5b4fd34eca 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -238,9 +238,9 @@ character-set=latin1
"No puede adicionar clave extranjera constraint",
"No puede adicionar una línea hijo: falla de clave extranjera constraint",
"No puede deletar una línea padre: falla de clave extranjera constraint",
-"Error de coneccion a master: %-128s",
-"Error executando el query en master: %-128%",
-"Error de %s: %-128%",
+"Error de coneccion a master: %-.128s",
+"Error executando el query en master: %-.128s",
+"Error de %s: %-.128s",
"Equivocado uso de %s y %s",
"El comando SELECT usado tiene diferente número de columnas",
"No puedo ejecutar el query porque usted tiene conflicto de traba de lectura",
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index da75e4fcede..4dc42389d89 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -101,7 +101,7 @@ character-set=latin1
"Tabellen '%-.64s' har inget index som motsvarar det angivna i CREATE INDEX. Skapa om tabellen",
"Fältseparatorerna är vad som förväntades. Kontrollera mot manualen",
"Man kan inte använda fast radlängd med blobs. Använd 'fields terminated by'",
-"Textfilen '%' måste finnas i databasbiblioteket eller vara läsbar för alla",
+"Textfilen '%.64s' måste finnas i databasbiblioteket eller vara läsbar för alla",
"Filen '%-.64s' existerar redan",
"Rader: %ld Bortagna: %ld Dubletter: %ld Varningar: %ld",
"Rader: %ld Dubletter: %ld",
@@ -200,7 +200,7 @@ character-set=latin1
"Fick fel %d vid ROLLBACK",
"Fick fel %d vid FLUSH_LOGS",
"Fick fel %d vid CHECKPOINT",
-"Avbröt länken för tråd %ld till db '%-.64s', användare '%-.32s', host '%-.64s' (%.-64s)",
+"Avbröt länken för tråd %ld till db '%-.64s', användare '%-.32s', host '%-.64s' (%-.64s)",
"Tabellhanteraren klarar inte en binär kopiering av tabellen",
"Binärloggen stängdes medan FLUSH MASTER utfördes",
"Failed rebuilding the index of dumped table '%-.64s'",
diff --git a/sql/slave.cc b/sql/slave.cc
index 4ef8715f1e6..6bc977e8d41 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1032,7 +1032,7 @@ bool net_request_file(NET* net, const char* fname)
}
-const char *rewrite_db(const char* db)
+const char *rewrite_db(const char* db, uint32 *new_len)
{
if (replicate_rewrite_db.is_empty() || !db)
return db;
@@ -1042,7 +1042,10 @@ const char *rewrite_db(const char* db)
while ((tmp=it++))
{
if (!strcmp(tmp->key, db))
+ {
+ *new_len= (uint32)strlen(tmp->val);
return tmp->val;
+ }
}
return db;
}
@@ -1056,7 +1059,7 @@ const char *rewrite_db(const char* db)
const char *print_slave_db_safe(const char* db)
{
- return (db ? rewrite_db(db) : "");
+ return (db ? db : "");
}
/*
@@ -2632,7 +2635,7 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi,
DBUG_ENTER("request_dump");
// TODO if big log files: Change next to int8store()
- int4store(buf, (longlong) mi->master_log_pos);
+ int4store(buf, (ulong) mi->master_log_pos);
int2store(buf + 4, binlog_flags);
int4store(buf + 6, server_id);
len = (uint) strlen(logname);
diff --git a/sql/slave.h b/sql/slave.h
index 20167094453..c6cb81699a2 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -510,8 +510,8 @@ int add_table_rule(HASH* h, const char* table_spec);
int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec);
void init_table_rule_hash(HASH* h, bool* h_inited);
void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited);
-const char *rewrite_db(const char* db);
-const char *print_slave_db_safe(const char* db);
+const char *rewrite_db(const char* db, uint32 *new_db_len);
+const char *print_slave_db_safe(const char *db);
int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code);
void skip_load_data_infile(NET* net);
void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...);
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index ff2dfedc30b..d6f52fed1d2 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -970,6 +970,7 @@ ulong acl_get(const char *host, const char *ip,
db_access=0; host_access= ~0;
char key[ACL_KEY_LENGTH],*tmp_db,*end;
acl_entry *entry;
+ DBUG_ENTER("acl_get");
VOID(pthread_mutex_lock(&acl_cache->lock));
end=strmov((tmp_db=strmov(strmov(key, ip ? ip : "")+1,user)+1),db);
@@ -983,7 +984,8 @@ ulong acl_get(const char *host, const char *ip,
{
db_access=entry->access;
VOID(pthread_mutex_unlock(&acl_cache->lock));
- return db_access;
+ DBUG_PRINT("exit", ("access: 0x%lx", db_access));
+ DBUG_RETURN(db_access);
}
/*
@@ -1035,7 +1037,8 @@ exit:
acl_cache->add(entry);
}
VOID(pthread_mutex_unlock(&acl_cache->lock));
- return (db_access & host_access);
+ DBUG_PRINT("exit", ("access: 0x%lx", db_access & host_access));
+ DBUG_RETURN(db_access & host_access);
}
/*
@@ -1381,8 +1384,10 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
table->field[0]->store(host,(uint) strlen(host), &my_charset_latin1);
table->field[1]->store(user,(uint) strlen(user), &my_charset_latin1);
+ table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
if (table->file->index_read_idx(table->record[0],0,
- (byte*) table->field[0]->ptr,0,
+ (byte*) table->field[0]->ptr,
+ table->key_info[0].key_length,
HA_READ_KEY_EXACT))
{
my_error(ER_PASSWORD_NO_MATCH,MYF(0)); /* purecov: deadcode */
@@ -1460,9 +1465,11 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1);
table->field[1]->store(combo.user.str,combo.user.length, &my_charset_latin1);
+ table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
if (table->file->index_read_idx(table->record[0], 0,
- (byte*) table->field[0]->ptr,0,
- HA_READ_KEY_EXACT))
+ (byte*) table->field[0]->ptr,
+ table->key_info[0].key_length,
+ HA_READ_KEY_EXACT))
{
if (!create_user)
{
@@ -1565,6 +1572,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
We should NEVER delete from the user table, as a uses can still
use mysqld even if he doesn't have any privileges in the user table!
*/
+ table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
if (cmp_record(table,record[1]) &&
(error=table->file->update_row(table->record[1],table->record[0])))
{ // This should never happen
@@ -1642,8 +1650,11 @@ static int replace_db_table(TABLE *table, const char *db,
table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1);
table->field[1]->store(db,(uint) strlen(db), &my_charset_latin1);
table->field[2]->store(combo.user.str,combo.user.length, &my_charset_latin1);
- if (table->file->index_read_idx(table->record[0],0,(byte*) table->field[0]->ptr,0,
- HA_READ_KEY_EXACT))
+ table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
+ if (table->file->index_read_idx(table->record[0],0,
+ (byte*) table->field[0]->ptr,
+ table->key_info[0].key_length,
+ HA_READ_KEY_EXACT))
{
if (what == 'N')
{ // no row, no revoke
@@ -1676,6 +1687,7 @@ static int replace_db_table(TABLE *table, const char *db,
/* update old existing row */
if (rights)
{
+ table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
if ((error=table->file->update_row(table->record[1],table->record[0])))
goto table_error; /* purecov: deadcode */
}
@@ -1685,7 +1697,7 @@ static int replace_db_table(TABLE *table, const char *db,
goto table_error; /* purecov: deadcode */
}
}
- else if ((error=table->file->write_row(table->record[0])))
+ else if (rights && (error=table->file->write_row(table->record[0])))
{
if (error && error != HA_ERR_FOUND_DUPP_KEY) /* purecov: inspected */
goto table_error; /* purecov: deadcode */
@@ -1695,6 +1707,7 @@ static int replace_db_table(TABLE *table, const char *db,
if (old_row_exists)
acl_update_db(combo.user.str,combo.host.str,db,rights);
else
+ if (rights)
acl_insert_db(combo.user.str,combo.host.str,db,rights);
DBUG_RETURN(0);
@@ -1949,8 +1962,10 @@ static int replace_column_table(GRANT_TABLE *g_t,
table->field[4]->store(xx->column.ptr(),xx->column.length(),
&my_charset_latin1);
+ table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
if (table->file->index_read(table->record[0],(byte*) table->field[0]->ptr,
- 0, HA_READ_KEY_EXACT))
+ table->key_info[0].key_length,
+ HA_READ_KEY_EXACT))
{
if (revoke_grant)
{
@@ -2018,8 +2033,10 @@ static int replace_column_table(GRANT_TABLE *g_t,
if (revoke_grant)
{
+ table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
if (table->file->index_read(table->record[0], (byte*) table->field[0]->ptr,
- key_length, HA_READ_KEY_EXACT))
+ table->key_info[0].key_length,
+ HA_READ_KEY_EXACT))
goto end;
/* Scan through all rows with the same host,db,user and table */
@@ -2108,9 +2125,10 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
table->field[2]->store(combo.user.str,combo.user.length, &my_charset_latin1);
table->field[3]->store(table_name,(uint) strlen(table_name), &my_charset_latin1);
store_record(table,record[1]); // store at pos 1
-
+ table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
if (table->file->index_read_idx(table->record[0],0,
- (byte*) table->field[0]->ptr,0,
+ (byte*) table->field[0]->ptr,
+ table->key_info[0].key_length,
HA_READ_KEY_EXACT))
{
/*
@@ -2309,8 +2327,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
create_new_users= test_if_create_new_users(thd);
int result=0;
rw_wrlock(&LOCK_grant);
- MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
- my_pthread_setspecific_ptr(THR_MALLOC,&memex);
+ MEM_ROOT *old_root= thd->mem_root;
+ thd->mem_root= &memex;
while ((Str = str_list++))
{
@@ -2415,7 +2433,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
}
}
grant_option=TRUE;
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ thd->mem_root= old_root;
rw_unlock(&LOCK_grant);
if (!result)
send_ok(thd);
@@ -2549,6 +2567,7 @@ my_bool grant_init(THD *org_thd)
THD *thd;
TABLE_LIST tables[2];
MYSQL_LOCK *lock;
+ MEM_ROOT *memex_ptr;
my_bool return_val= 1;
TABLE *t_table, *c_table;
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
@@ -2596,7 +2615,8 @@ my_bool grant_init(THD *org_thd)
grant_option= TRUE;
/* Will be restored by org_thd->store_globals() */
- my_pthread_setspecific_ptr(THR_MALLOC,&memex);
+ memex_ptr= &memex;
+ my_pthread_setspecific_ptr(THR_MALLOC, &memex_ptr);
do
{
GRANT_TABLE *mem_check;
@@ -3565,9 +3585,12 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
tables[0].table->field[1]->store(user_name->user.str,(uint)
user_name->user.length,
system_charset_info);
+ tables[0].table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
if (!tables[0].table->file->index_read_idx(tables[0].table->record[0],0,
(byte*) tables[0].table->
- field[0]->ptr,0,
+ field[0]->ptr,
+ tables[0].table->
+ key_info[0].key_length,
HA_READ_KEY_EXACT))
{
int error;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 839b92e7e7f..a5db02478ac 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -499,7 +499,7 @@ void close_temporary_tables(THD *thd)
*/
query_buf_size+= table->key_length+1;
- if ((query = alloc_root(&thd->mem_root, query_buf_size)))
+ if ((query = alloc_root(thd->mem_root, query_buf_size)))
// Better add "if exists", in case a RESET MASTER has been done
end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ");
@@ -2311,18 +2311,16 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
if (!wild_num)
DBUG_RETURN(0);
- Item_arena *arena= thd->current_arena, backup;
-
+ reg2 Item *item;
+ List_iterator<Item> it(fields);
+ Item_arena *arena, backup;
/*
If we are in preparing prepared statement phase then we have change
temporary mem_root to statement mem root to save changes of SELECT list
*/
- if ((is_stmt_prepare= arena->is_stmt_prepare()))
- thd->set_n_backup_item_arena(arena, &backup);
+ arena= thd->change_arena_if_needed(&backup);
- reg2 Item *item;
- List_iterator<Item> it(fields);
- while ( wild_num && (item= it++))
+ while (wild_num && (item= it++))
{
if (item->type() == Item::FIELD_ITEM &&
((Item_field*) item)->field_name &&
@@ -2344,7 +2342,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
else if (insert_fields(thd,tables,((Item_field*) item)->db_name,
((Item_field*) item)->table_name, &it))
{
- if (is_stmt_prepare)
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
DBUG_RETURN(-1);
}
@@ -2360,7 +2358,7 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
wild_num--;
}
}
- if (is_stmt_prepare)
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
DBUG_RETURN(0);
}
@@ -2589,11 +2587,10 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
{
table_map not_null_tables= 0;
- Item_arena *arena= thd->current_arena, backup;
- bool is_stmt_prepare= arena->is_stmt_prepare();
+ Item_arena *arena= 0, backup;
DBUG_ENTER("setup_conds");
+
thd->set_query_id=1;
-
thd->lex->current_select->cond_count= 0;
if (*conds)
{
@@ -2628,12 +2625,14 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
!(specialflag & SPECIAL_NO_NEW_FUNC)))
{
table->outer_join= 0;
- if (is_stmt_prepare)
- thd->set_n_backup_item_arena(arena, &backup);
+ arena= thd->change_arena_if_needed(&backup);
*conds= and_conds(*conds, table->on_expr);
table->on_expr=0;
- if (is_stmt_prepare)
+ if (arena)
+ {
thd->restore_backup_item_arena(arena, &backup);
+ arena= 0; // Safety if goto err
+ }
if ((*conds) && !(*conds)->fixed &&
(*conds)->fix_fields(thd, tables, conds))
DBUG_RETURN(1);
@@ -2641,8 +2640,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
}
if (table->natural_join)
{
- if (is_stmt_prepare)
- thd->set_n_backup_item_arena(arena, &backup);
+ arena= thd->change_arena_if_needed(&backup);
/* Make a join of all fields with have the same name */
TABLE *t1= table->table;
TABLE *t2= table->natural_join->table;
@@ -2683,7 +2681,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
{
*conds= and_conds(*conds, cond_and);
// fix_fields() should be made with temporary memory pool
- if (is_stmt_prepare)
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
if (*conds && !(*conds)->fixed)
{
@@ -2695,7 +2693,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
{
table->on_expr= and_conds(table->on_expr, cond_and);
// fix_fields() should be made with temporary memory pool
- if (is_stmt_prepare)
+ if (arena)
thd->restore_backup_item_arena(arena, &backup);
if (table->on_expr && !table->on_expr->fixed)
{
@@ -2704,12 +2702,15 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
}
}
}
- else if (is_stmt_prepare)
+ else if (arena)
+ {
thd->restore_backup_item_arena(arena, &backup);
+ arena= 0; // Safety if goto err
+ }
}
}
- if (is_stmt_prepare)
+ if (thd->current_arena->is_stmt_prepare())
{
/*
We are in prepared statement preparation code => we should store
@@ -2722,8 +2723,8 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
DBUG_RETURN(test(thd->net.report_error));
err:
- if (is_stmt_prepare)
- thd->restore_backup_item_arena(arena, &backup);
+ if (arena)
+ thd->restore_backup_item_arena(arena, &backup);
DBUG_RETURN(1);
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 7ad20967de0..bab81d785c3 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -280,6 +280,9 @@ void THD::init(void)
variables.date_format);
variables.datetime_format= date_time_format_copy((THD*) 0,
variables.datetime_format);
+#ifdef HAVE_NDBCLUSTER_DB
+ variables.ndb_use_transactions= 1;
+#endif
pthread_mutex_unlock(&LOCK_global_system_variables);
server_status= SERVER_STATUS_AUTOCOMMIT;
options= thd_startup_options;
@@ -305,7 +308,7 @@ void THD::init_for_queries()
{
ha_enable_transaction(this,TRUE);
- reset_root_defaults(&mem_root, variables.query_alloc_block_size,
+ reset_root_defaults(mem_root, variables.query_alloc_block_size,
variables.query_prealloc_size);
reset_root_defaults(&transaction.mem_root,
variables.trans_alloc_block_size,
@@ -411,7 +414,7 @@ THD::~THD()
dbug_sentry = THD_SENTRY_GONE;
#endif
/* Reset stmt_backup.mem_root to not double-free memory from thd.mem_root */
- clear_alloc_root(&stmt_backup.mem_root);
+ clear_alloc_root(&stmt_backup.main_mem_root);
DBUG_VOID_RETURN;
}
@@ -1394,10 +1397,10 @@ void select_dumpvar::cleanup()
for memory root initialization.
*/
Item_arena::Item_arena(THD* thd)
- :free_list(0),
- state(INITIALIZED)
+ :free_list(0), mem_root(&main_mem_root),
+ state(INITIALIZED)
{
- init_sql_alloc(&mem_root,
+ init_sql_alloc(&main_mem_root,
thd->variables.query_alloc_block_size,
thd->variables.query_prealloc_size);
}
@@ -1420,11 +1423,11 @@ Item_arena::Item_arena(THD* thd)
statements.
*/
Item_arena::Item_arena(bool init_mem_root)
- :free_list(0),
+ :free_list(0), mem_root(&main_mem_root),
state(CONVENTIONAL_EXECUTION)
{
if (init_mem_root)
- init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
+ init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
}
@@ -1518,13 +1521,16 @@ void THD::end_statement()
void Item_arena::set_n_backup_item_arena(Item_arena *set, Item_arena *backup)
{
+ DBUG_ENTER("Item_arena::set_n_backup_item_arena");
backup->set_item_arena(this);
set_item_arena(set);
+ DBUG_VOID_RETURN;
}
void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup)
{
+ DBUG_ENTER("Item_arena::restore_backup_item_arena");
set->set_item_arena(this);
set_item_arena(backup);
#ifdef NOT_NEEDED_NOW
@@ -1537,18 +1543,19 @@ void Item_arena::restore_backup_item_arena(Item_arena *set, Item_arena *backup)
*/
clear_alloc_root(&backup->mem_root);
#endif
+ DBUG_VOID_RETURN;
}
void Item_arena::set_item_arena(Item_arena *set)
{
- mem_root= set->mem_root;
+ mem_root= set->mem_root;
free_list= set->free_list;
state= set->state;
}
Statement::~Statement()
{
- free_root(&mem_root, MYF(0));
+ free_root(&main_mem_root, MYF(0));
}
C_MODE_START
diff --git a/sql/sql_class.h b/sql/sql_class.h
index e73b35966a9..d0d9afc7746 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -131,7 +131,7 @@ public:
DBUG_VOID_RETURN;
}
void set_max_size(ulong max_size_arg);
- void signal_update() { pthread_cond_broadcast(&update_cond);}
+ void signal_update();
void wait_for_update(THD* thd, bool master_or_slave);
void set_need_start_event() { need_start_event = 1; }
void init(enum_log_type log_type_arg,
@@ -399,6 +399,12 @@ struct system_variables
#ifdef HAVE_INNOBASE_DB
my_bool innodb_table_locks;
#endif /* HAVE_INNOBASE_DB */
+#ifdef HAVE_NDBCLUSTER_DB
+ ulong ndb_autoincrement_prefetch_sz;
+ my_bool ndb_force_send;
+ my_bool ndb_use_exact_count;
+ my_bool ndb_use_transactions;
+#endif /* HAVE_NDBCLUSTER_DB */
my_bool old_passwords;
/* Only charset part of these variables is sensible */
@@ -429,7 +435,8 @@ public:
itself to the list on creation (see Item::Item() for details))
*/
Item *free_list;
- MEM_ROOT mem_root;
+ MEM_ROOT main_mem_root;
+ MEM_ROOT *mem_root; // Pointer to current memroot
enum enum_state
{
INITIALIZED= 0, PREPARED= 1, EXECUTED= 3, CONVENTIONAL_EXECUTION= 2,
@@ -468,24 +475,24 @@ public:
{ return state == PREPARED || state == EXECUTED; }
inline bool is_conventional_execution() const
{ return state == CONVENTIONAL_EXECUTION; }
- inline gptr alloc(unsigned int size) { return alloc_root(&mem_root,size); }
+ inline gptr alloc(unsigned int size) { return alloc_root(mem_root,size); }
inline gptr calloc(unsigned int size)
{
gptr ptr;
- if ((ptr=alloc_root(&mem_root,size)))
+ if ((ptr=alloc_root(mem_root,size)))
bzero((char*) ptr,size);
return ptr;
}
inline char *strdup(const char *str)
- { return strdup_root(&mem_root,str); }
+ { return strdup_root(mem_root,str); }
inline char *strmake(const char *str, uint size)
- { return strmake_root(&mem_root,str,size); }
+ { return strmake_root(mem_root,str,size); }
inline char *memdup(const char *str, uint size)
- { return memdup_root(&mem_root,str,size); }
+ { return memdup_root(mem_root,str,size); }
inline char *memdup_w_gap(const char *str, uint size, uint gap)
{
gptr ptr;
- if ((ptr=alloc_root(&mem_root,size+gap)))
+ if ((ptr=alloc_root(mem_root,size+gap)))
memcpy(ptr,str,size);
return ptr;
}
@@ -1052,11 +1059,26 @@ public:
inline CHARSET_INFO *charset() { return variables.character_set_client; }
void update_charset();
+ inline Item_arena *change_arena_if_needed(Item_arena *backup)
+ {
+ /*
+ use new arena if we are in a prepared statements and we have not
+ already changed to use this arena.
+ */
+ if (current_arena->is_stmt_prepare() &&
+ mem_root != &current_arena->main_mem_root)
+ {
+ set_n_backup_item_arena(current_arena, backup);
+ return current_arena;
+ }
+ return 0;
+ }
+
void change_item_tree(Item **place, Item *new_value)
{
/* TODO: check for OOM condition here */
if (!current_arena->is_conventional_execution())
- nocheck_register_item_tree_change(place, *place, &mem_root);
+ nocheck_register_item_tree_change(place, *place, mem_root);
*place= new_value;
}
void nocheck_register_item_tree_change(Item **place, Item *old_value,
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index eb851e79d2e..350a7432990 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -30,11 +30,6 @@ const char *del_exts[]= {".frm", ".BAK", ".TMD",".opt", NullS};
static TYPELIB deletable_extentions=
{array_elements(del_exts)-1,"del_exts", del_exts, NULL};
-const char *known_exts[]=
-{".ISM",".ISD",".ISM",".MRG",".MYI",".MYD",".db", ".ibd", NullS};
-static TYPELIB known_extentions=
-{array_elements(known_exts)-1,"known_exts", known_exts, NULL};
-
static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
const char *db, const char *path,
uint level);
@@ -725,7 +720,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
if ((mysql_rm_known_files(thd, new_dirp, NullS, newpath,1)) < 0)
goto err;
if (!(copy_of_path= thd->memdup(newpath, length+1)) ||
- !(dir= new (&thd->mem_root) String(copy_of_path, length,
+ !(dir= new (thd->mem_root) String(copy_of_path, length,
&my_charset_bin)) ||
raid_dirs.push_back(dir))
goto err;
@@ -737,7 +732,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
extension= fn_ext(file->name);
if (find_type(extension, &deletable_extentions,1+2) <= 0)
{
- if (find_type(extension, &known_extentions,1+2) <= 0)
+ if (find_type(extension, ha_known_exts(),1+2) <= 0)
found_other_files++;
continue;
}
diff --git a/sql/sql_do.cc b/sql/sql_do.cc
index 25a8359f3d2..0d4529fb29e 100644
--- a/sql/sql_do.cc
+++ b/sql/sql_do.cc
@@ -29,6 +29,7 @@ int mysql_do(THD *thd, List<Item> &values)
DBUG_RETURN(-1);
while ((value = li++))
value->val_int();
+ free_underlaid_joins(thd, &thd->lex->select_lex);
thd->clear_error(); // DO always is OK
send_ok(thd);
DBUG_RETURN(0);
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 87644300535..eab5ec890df 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -113,12 +113,12 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
The following code is here to change the allocation to not
use the thd->mem_root, which is freed after each query
*/
- MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
- my_pthread_setspecific_ptr(THR_MALLOC, &thd->warn_root);
+ MEM_ROOT *old_root= thd->mem_root;
+ thd->mem_root= &thd->warn_root;
err= new MYSQL_ERROR(thd, code, level, msg);
if (err)
thd->warn_list.push_back(err);
- my_pthread_setspecific_ptr(THR_MALLOC, old_root);
+ thd->mem_root= old_root;
}
thd->warn_count[(uint) level]++;
thd->total_warn_count++;
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index ffaaafc26e6..04ecbbd43b9 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -127,7 +127,7 @@ void memorize_variant_topic(THD *thd, TABLE *topics, int count,
String *name, String *description, String *example)
{
DBUG_ENTER("memorize_variant_topic");
- MEM_ROOT *mem_root= &thd->mem_root;
+ MEM_ROOT *mem_root= thd->mem_root;
if (count==0)
{
get_field(mem_root,find_fields[help_topic_name].field, name);
@@ -138,7 +138,7 @@ void memorize_variant_topic(THD *thd, TABLE *topics, int count,
{
if (count == 1)
names->push_back(name);
- String *new_name= new (&thd->mem_root) String;
+ String *new_name= new (thd->mem_root) String;
get_field(mem_root,find_fields[help_topic_name].field,new_name);
names->push_back(new_name);
}
@@ -351,8 +351,8 @@ int search_categories(THD *thd, TABLE *categories,
{
if (select && !select->cond->val_int())
continue;
- String *lname= new (&thd->mem_root) String;
- get_field(&thd->mem_root,pfname,lname);
+ String *lname= new (thd->mem_root) String;
+ get_field(thd->mem_root,pfname,lname);
if (++count == 1 && res_id)
*res_id= (int16) pcat_id->val_int();
names->push_back(lname);
@@ -385,8 +385,8 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname,
{
if (!select->cond->val_int())
continue;
- String *name= new (&thd->mem_root) String();
- get_field(&thd->mem_root,pfname,name);
+ String *name= new (thd->mem_root) String();
+ get_field(thd->mem_root,pfname,name);
res->push_back(name);
}
end_read_record(&read_record_info);
@@ -638,7 +638,7 @@ int mysqld_help(THD *thd, const char *mask)
String name, description, example;
int res, count_topics, count_categories, error;
uint mlen= strlen(mask);
- MEM_ROOT *mem_root= &thd->mem_root;
+ MEM_ROOT *mem_root= thd->mem_root;
if (open_and_lock_tables(thd, tables))
{
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 648549ca3ac..d590d3b5093 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -202,7 +202,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
{
/* it should be allocated before Item::fix_fields() */
table->insert_values=
- (byte *)alloc_root(&thd->mem_root, table->rec_buff_length);
+ (byte *)alloc_root(thd->mem_root, table->rec_buff_length);
if (!table->insert_values)
goto abort;
}
@@ -453,8 +453,8 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
setup_tables(insert_table_list) ||
setup_fields(thd, 0, insert_table_list, *values, 0, 0, 0) ||
(duplic == DUP_UPDATE &&
- (setup_fields(thd, 0, insert_table_list, update_fields, 0, 0, 0) ||
- setup_fields(thd, 0, insert_table_list, update_values, 0, 0, 0))))
+ (setup_fields(thd, 0, insert_table_list, update_fields, 1, 0, 0) ||
+ setup_fields(thd, 0, insert_table_list, update_values, 1, 0, 0))))
DBUG_RETURN(-1);
if (find_real_table_in_list(table_list->next,
table_list->db, table_list->real_name))
@@ -462,6 +462,9 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
DBUG_RETURN(-1);
}
+ if (duplic == DUP_UPDATE || duplic == DUP_REPLACE)
+ table->file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY);
+
DBUG_RETURN(0);
}
@@ -924,7 +927,7 @@ TABLE *delayed_insert::get_local_table(THD* client_thd)
found_next_number_field=table->found_next_number_field;
for (org_field=table->field ; *org_field ; org_field++,field++)
{
- if (!(*field= (*org_field)->new_field(&client_thd->mem_root,copy)))
+ if (!(*field= (*org_field)->new_field(client_thd->mem_root,copy)))
return 0;
(*field)->orig_table= copy; // Remove connection
(*field)->move_field(adjust_ptrs); // Point at copy->record[0]
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 268198f74a2..90c020b3e93 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -613,7 +613,7 @@ typedef struct st_lex
uint uint_geom_type;
uint grant, grant_tot_col, which_columns;
uint fk_delete_opt, fk_update_opt, fk_match_option;
- uint slave_thd_opt;
+ uint slave_thd_opt, start_transaction_opt;
uint8 describe;
bool drop_if_exists, drop_temporary, local_file, one_shot_set;
bool in_comment, ignore_space, verbose, no_write_to_binlog;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index f5b9bc0638f..e066e447345 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1026,7 +1026,7 @@ pthread_handler_decl(handle_one_connection,arg)
}
if (thd->user_connect)
decrease_user_connections(thd->user_connect);
- free_root(&thd->mem_root,MYF(0));
+ free_root(thd->mem_root,MYF(0));
if (net->error && net->vio != 0 && net->report_error)
{
if (!thd->killed && thd->variables.log_warnings > 1)
@@ -1106,7 +1106,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
if (buff[length-1]!='\n' && !feof(file))
{
send_error(thd,ER_NET_PACKET_TOO_LARGE, NullS);
- thd->is_fatal_error= 1;
+ thd->fatal_error();
break;
}
while (length && (my_isspace(thd->charset(), buff[length-1]) ||
@@ -1121,14 +1121,14 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
{
thd->net.error = 0;
close_thread_tables(thd); // Free tables
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
break;
}
mysql_parse(thd,thd->query,length);
close_thread_tables(thd); // Free tables
if (thd->is_fatal_error)
break;
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
}
@@ -1610,15 +1610,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#ifndef EMBEDDED_LIBRARY
case COM_BINLOG_DUMP:
{
+ ulong pos;
+ ushort flags;
+ uint32 slave_server_id;
+
statistic_increment(com_other,&LOCK_status);
thd->slow_command = TRUE;
if (check_global_access(thd, REPL_SLAVE_ACL))
break;
- mysql_log.write(thd,command, 0);
- ulong pos;
- ushort flags;
- uint32 slave_server_id;
/* TODO: The following has to be changed to an 8 byte integer */
pos = uint4korr(packet);
flags = uint2korr(packet + 4);
@@ -1626,6 +1626,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if ((slave_server_id= uint4korr(packet+6))) // mysqlbinlog.server_id==0
kill_zombie_dump_threads(slave_server_id);
thd->server_id = slave_server_id;
+
+ mysql_log.write(thd, command, "Log: '%s' Pos: %ld", packet+10,
+ (long) pos);
mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags);
unregister_slave(thd,1,1);
// fake COM_QUIT -- if we get here, the thread needs to terminate
@@ -1681,7 +1684,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#endif
close_connection(thd, 0, 1);
close_thread_tables(thd); // Free before kill
- free_root(&thd->mem_root,MYF(0));
+ free_root(thd->mem_root,MYF(0));
free_root(&thd->transaction.mem_root,MYF(0));
kill_mysql();
error=TRUE;
@@ -1808,7 +1811,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thread_running--;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
- free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
+ free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
DBUG_RETURN(error);
}
@@ -2062,7 +2065,7 @@ mysql_execute_command(THD *thd)
query_len= need_conversion? (pstr->length() * to_cs->mbmaxlen) :
pstr->length();
- if (!(query_str= alloc_root(&thd->mem_root, query_len+1)))
+ if (!(query_str= alloc_root(thd->mem_root, query_len+1)))
{
res= -1;
break; // EOM (error should be reported by allocator)
@@ -3076,6 +3079,12 @@ purposes internal to the MySQL server", MYF(0));
}
case SQLCOM_UNLOCK_TABLES:
+ /*
+ It is critical for mysqldump --single-transaction --master-data that
+ UNLOCK TABLES does not implicitely commit a connection which has only
+ done FLUSH TABLES WITH READ LOCK + BEGIN. If this assumption becomes
+ false, mysqldump will not work.
+ */
unlock_locked_tables(thd);
if (thd->options & OPTION_TABLE_LOCK)
{
@@ -3462,7 +3471,9 @@ purposes internal to the MySQL server", MYF(0));
thd->options= ((thd->options & (ulong) ~(OPTION_STATUS_NO_TRANS_UPDATE)) |
OPTION_BEGIN);
thd->server_status|= SERVER_STATUS_IN_TRANS;
- send_ok(thd);
+ if (!(lex->start_transaction_opt & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT) ||
+ !(res= ha_start_consistent_snapshot(thd)))
+ send_ok(thd);
}
break;
case SQLCOM_COMMIT:
@@ -3937,8 +3948,8 @@ mysql_init_select(LEX *lex)
bool
mysql_new_select(LEX *lex, bool move_down)
{
- SELECT_LEX *select_lex = new(&lex->thd->mem_root) SELECT_LEX();
- if (!select_lex)
+ SELECT_LEX *select_lex;
+ if (!(select_lex= new(lex->thd->mem_root) SELECT_LEX()))
return 1;
select_lex->select_number= ++lex->thd->select_number;
select_lex->init_query();
@@ -3946,9 +3957,10 @@ mysql_new_select(LEX *lex, bool move_down)
if (move_down)
{
/* first select_lex of subselect or derived table */
- SELECT_LEX_UNIT *unit= new(&lex->thd->mem_root) SELECT_LEX_UNIT();
- if (!unit)
+ SELECT_LEX_UNIT *unit;
+ if (!(unit= new(lex->thd->mem_root) SELECT_LEX_UNIT()))
return 1;
+
unit->init_query();
unit->init_select();
unit->thd= lex->thd;
@@ -3970,7 +3982,8 @@ mysql_new_select(LEX *lex, bool move_down)
as far as we included SELECT_LEX for UNION unit should have
fake SELECT_LEX for UNION processing
*/
- fake= unit->fake_select_lex= new(&lex->thd->mem_root) SELECT_LEX();
+ if (!(fake= unit->fake_select_lex= new(lex->thd->mem_root) SELECT_LEX()))
+ return 1;
fake->include_standalone(unit,
(SELECT_LEX_NODE**)&unit->fake_select_lex);
fake->select_number= INT_MAX;
@@ -4110,7 +4123,7 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
- SET uses tot_length.
*/
void calculate_interval_lengths(THD *thd, TYPELIB *interval,
- uint *max_length, uint *tot_length)
+ uint32 *max_length, uint32 *tot_length)
{
const char **pos;
uint *len;
@@ -4122,7 +4135,7 @@ void calculate_interval_lengths(THD *thd, TYPELIB *interval,
*len= (uint) strip_sp((char*) *pos);
uint length= cs->cset->numchars(cs, *pos, *pos + *len);
*tot_length+= length;
- set_if_bigger(*max_length, length);
+ set_if_bigger(*max_length, (uint32)length);
}
}
@@ -4441,7 +4454,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
if (new_field->pack_length > 4)
new_field->pack_length=8;
new_field->interval=interval;
- uint dummy_max_length;
+ uint32 dummy_max_length;
calculate_interval_lengths(thd, interval,
&dummy_max_length, &new_field->length);
new_field->length+= (interval->count - 1);
@@ -4471,7 +4484,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
new_field->interval=interval;
new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe
- uint dummy_tot_length;
+ uint32 dummy_tot_length;
calculate_interval_lengths(thd, interval,
&new_field->length, &dummy_tot_length);
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 4ae69e40342..a790e6fe9d8 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -349,12 +349,6 @@ static void set_param_time(Item_param *param, uchar **pos, ulong len)
tm.neg= (bool) to[0];
day= (uint) sint4korr(to+1);
- /*
- Note, that though ranges of hour, minute and second are not checked
- here we rely on them being < 256: otherwise
- we'll get buffer overflow in make_{date,time} functions,
- which are called when time value is converted to string.
- */
tm.hour= (uint) to[5] + day * 24;
tm.minute= (uint) to[6];
tm.second= (uint) to[7];
@@ -369,7 +363,7 @@ static void set_param_time(Item_param *param, uchar **pos, ulong len)
tm.day= tm.year= tm.month= 0;
}
else
- set_zero_time(&tm);
+ set_zero_time(&tm, MYSQL_TIMESTAMP_TIME);
param->set_time(&tm, MYSQL_TIMESTAMP_TIME,
MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
*pos+= length;
@@ -388,11 +382,6 @@ static void set_param_datetime(Item_param *param, uchar **pos, ulong len)
tm.year= (uint) sint2korr(to);
tm.month= (uint) to[2];
tm.day= (uint) to[3];
- /*
- Note, that though ranges of hour, minute and second are not checked
- here we rely on them being < 256: otherwise
- we'll get buffer overflow in make_{date,time} functions.
- */
if (length > 4)
{
tm.hour= (uint) to[4];
@@ -405,7 +394,7 @@ static void set_param_datetime(Item_param *param, uchar **pos, ulong len)
tm.second_part= (length > 7) ? (ulong) sint4korr(to+7) : 0;
}
else
- set_zero_time(&tm);
+ set_zero_time(&tm, MYSQL_TIMESTAMP_DATETIME);
param->set_time(&tm, MYSQL_TIMESTAMP_DATETIME,
MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
*pos+= length;
@@ -419,11 +408,7 @@ static void set_param_date(Item_param *param, uchar **pos, ulong len)
if (length >= 4)
{
uchar *to= *pos;
- /*
- Note, that though ranges of hour, minute and second are not checked
- here we rely on them being < 256: otherwise
- we'll get buffer overflow in make_{date,time} functions.
- */
+
tm.year= (uint) sint2korr(to);
tm.month= (uint) to[2];
tm.day= (uint) to[3];
@@ -433,7 +418,7 @@ static void set_param_date(Item_param *param, uchar **pos, ulong len)
tm.neg= 0;
}
else
- set_zero_time(&tm);
+ set_zero_time(&tm, MYSQL_TIMESTAMP_DATE);
param->set_time(&tm, MYSQL_TIMESTAMP_DATE,
MAX_DATE_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
*pos+= length;
@@ -1065,7 +1050,7 @@ static int mysql_test_select(Prepared_statement *stmt,
DBUG_RETURN(1);
#endif
- if (!lex->result && !(lex->result= new (&stmt->mem_root) select_send))
+ if (!lex->result && !(lex->result= new (stmt->mem_root) select_send))
{
send_error(thd);
goto err;
@@ -1503,7 +1488,7 @@ static bool init_param_array(Prepared_statement *stmt)
List_iterator<Item_param> param_iterator(lex->param_list);
/* Use thd->mem_root as it points at statement mem_root */
stmt->param_array= (Item_param **)
- alloc_root(&stmt->thd->mem_root,
+ alloc_root(stmt->thd->mem_root,
sizeof(Item_param*) * stmt->param_count);
if (!stmt->param_array)
{
@@ -1569,7 +1554,7 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
if (name)
{
stmt->name.length= name->length;
- if (!(stmt->name.str= memdup_root(&stmt->mem_root, (char*)name->str,
+ if (!(stmt->name.str= memdup_root(stmt->mem_root, (char*)name->str,
name->length)))
{
delete stmt;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index df74a946b5c..40dae434c5e 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2154,7 +2154,7 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, COND *cond,
bool is_const=1;
for (uint i=0; i<num_values; i++)
- is_const&= (*value)->const_item();
+ is_const&= value[i]->const_item();
if (is_const)
stat[0].const_keys.merge(possible_keys);
/*
@@ -3507,8 +3507,17 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
/* Join with outer join condition */
COND *orig_cond=sel->cond;
sel->cond= and_conds(sel->cond, tab->on_expr);
+
+ /*
+ We can't call sel->cond->fix_fields,
+ as it will break tab->on_expr if it's AND condition
+ (fix_fields currently removes extra AND/OR levels).
+ Yet attributes of the just built condition are not needed.
+ Thus we call sel->cond->quick_fix_field for safety.
+ */
if (sel->cond && !sel->cond->fixed)
- sel->cond->fix_fields(join->thd, 0, &sel->cond);
+ sel->cond->quick_fix_field();
+
if (sel->test_quick_select(join->thd, tab->keys,
used_tables & ~ current_map,
(join->select_options &
@@ -4603,7 +4612,7 @@ static Field* create_tmp_field_from_field(THD *thd, Field* org_field,
org_field->field_name, table,
org_field->charset());
else
- new_field= org_field->new_field(&thd->mem_root, table);
+ new_field= org_field->new_field(thd->mem_root, table);
if (new_field)
{
if (modify_item)
@@ -5206,7 +5215,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
if (!using_unique_constraint)
{
group->buff=(char*) group_buff;
- if (!(group->field=field->new_field(&thd->mem_root,table)))
+ if (!(group->field=field->new_field(thd->mem_root,table)))
goto err; /* purecov: inspected */
if (maybe_null)
{
@@ -8499,7 +8508,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
saved value
*/
Field *field= item->field;
- item->result_field=field->new_field(&thd->mem_root,field->table);
+ item->result_field=field->new_field(thd->mem_root,field->table);
char *tmp=(char*) sql_alloc(field->pack_length()+1);
if (!tmp)
goto err;
@@ -8942,7 +8951,7 @@ bool JOIN::rollup_init()
return 1;
rollup.ref_pointer_arrays= (Item***) (rollup.fields + send_group_parts);
ref_array= (Item**) (rollup.ref_pointer_arrays+send_group_parts);
- rollup.item_null= new (&thd->mem_root) Item_null();
+ rollup.item_null= new (thd->mem_root) Item_null();
/*
Prepare space for field list for the different levels
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 34eaa7e272d..bbd169d1850 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -354,7 +354,7 @@ class store_key :public Sql_alloc
field_arg->table, field_arg->charset());
else
{
- to_field=field_arg->new_field(&thd->mem_root,field_arg->table);
+ to_field=field_arg->new_field(thd->mem_root,field_arg->table);
if (to_field)
to_field->move_field(ptr, (uchar*) null, 1);
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index c69235a5647..eedd9388877 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -835,7 +835,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
#endif
}
- List_iterator<key_part_spec> cols(key->columns);
+ List_iterator<key_part_spec> cols(key->columns), cols2(key->columns);
CHARSET_INFO *ft_key_charset=0; // for FULLTEXT
for (uint column_nr=0 ; (column=cols++) ; column_nr++)
{
@@ -853,6 +853,19 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
column->field_name);
DBUG_RETURN(-1);
}
+ for (uint dup_nr= 0; dup_nr < column_nr; dup_nr++)
+ {
+ key_part_spec *dup_column= cols2++;
+ if (!my_strcasecmp(system_charset_info,
+ column->field_name, dup_column->field_name))
+ {
+ my_printf_error(ER_DUP_FIELDNAME,
+ ER(ER_DUP_FIELDNAME),MYF(0),
+ column->field_name);
+ DBUG_RETURN(-1);
+ }
+ }
+ cols2.rewind();
/* for fulltext keys keyseg length is 1 for blobs (it's ignored in
ft code anyway, and 0 (set to column width later) for char's.
it has to be correct col width for char's, as char data are not
@@ -1418,7 +1431,6 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
}
table->file->extra(HA_EXTRA_WRITE_CACHE);
DBUG_RETURN(table);
- /* Note that leaving the function resets binlogging properties */
}
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 0be554f58a2..e0e8f8d42c5 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -313,24 +313,24 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
We're in statement prepare or in execution
of a conventional statement.
*/
- Item_arena backup;
- if (arena->is_stmt_prepare())
- thd->set_n_backup_item_arena(arena, &backup);
+ Item_arena *tmp_arena,backup;
+ tmp_arena= thd->change_arena_if_needed(&backup);
+
Field **field;
for (field= table->field; *field; field++)
{
Item_field *item= new Item_field(*field);
if (!item || item_list.push_back(item))
{
- if (arena->is_stmt_prepare())
- thd->restore_backup_item_arena(arena, &backup);
+ if (tmp_arena)
+ thd->restore_backup_item_arena(tmp_arena, &backup);
DBUG_RETURN(-1);
}
}
+ if (tmp_arena)
+ thd->restore_backup_item_arena(tmp_arena, &backup);
if (arena->is_stmt_prepare())
{
- thd->restore_backup_item_arena(arena, &backup);
-
/* prepare fake select to initialize it correctly */
ulong options_tmp= init_prepare_fake_select_lex(thd);
if (!(fake_select_lex->join= new JOIN(thd, item_list, thd->options,
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 4538cb6e6ac..8cbfaf3f99b 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -131,6 +131,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token CLIENT_SYM
%token COMMENT_SYM
%token COMMIT_SYM
+%token CONSISTENT_SYM
%token COUNT_SYM
%token CREATE
%token CROSS
@@ -165,6 +166,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token SELECT_SYM
%token SHOW
%token SLAVE
+%token SNAPSHOT_SYM
%token SQL_THREAD
%token START_SYM
%token STD_SYM
@@ -618,6 +620,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
table_option opt_if_not_exists opt_no_write_to_binlog opt_var_type
opt_var_ident_type delete_option opt_temporary all_or_any opt_distinct
opt_ignore_leaves fulltext_options spatial_type union_option
+ start_transaction_opts
%type <ulong_num>
ULONG_NUM raid_types merge_insert_types
@@ -1399,6 +1402,9 @@ type:
| BINARY '(' NUM ')' { Lex->length=$3.str;
Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_STRING; }
+ | BINARY { Lex->length= (char*) "1";
+ Lex->charset=&my_charset_bin;
+ $$=FIELD_TYPE_STRING; }
| varchar '(' NUM ')' opt_binary { Lex->length=$3.str;
$$=FIELD_TYPE_VAR_STRING; }
| nvarchar '(' NUM ')' { Lex->length=$3.str;
@@ -2095,10 +2101,21 @@ slave:
start:
- START_SYM TRANSACTION_SYM { Lex->sql_command = SQLCOM_BEGIN;}
- {}
+ START_SYM TRANSACTION_SYM start_transaction_opts
+ {
+ Lex->sql_command = SQLCOM_BEGIN;
+ Lex->start_transaction_opt= $3;
+ }
;
+start_transaction_opts:
+ /*empty*/ { $$ = 0; }
+ | WITH CONSISTENT_SYM SNAPSHOT_SYM
+ {
+ $$= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT;
+ }
+ ;
+
slave_thread_opts:
{ Lex->slave_thd_opt= 0; }
slave_thread_opt_list
@@ -3297,7 +3314,7 @@ opt_distinct:
|DISTINCT { $$ = 1; };
opt_gconcat_separator:
- /* empty */ { $$ = new (&YYTHD->mem_root) String(",",1,default_charset_info); }
+ /* empty */ { $$ = new (YYTHD->mem_root) String(",",1,default_charset_info); }
|SEPARATOR_SYM text_string { $$ = $2; };
@@ -3551,15 +3568,15 @@ key_list_or_empty:
key_usage_list2:
key_usage_list2 ',' ident
{ Select->
- interval_list.push_back(new (&YYTHD->mem_root) String((const char*) $3.str, $3.length,
+ interval_list.push_back(new (YYTHD->mem_root) String((const char*) $3.str, $3.length,
system_charset_info)); }
| ident
{ Select->
- interval_list.push_back(new (&YYTHD->mem_root) String((const char*) $1.str, $1.length,
+ interval_list.push_back(new (YYTHD->mem_root) String((const char*) $1.str, $1.length,
system_charset_info)); }
| PRIMARY_SYM
{ Select->
- interval_list.push_back(new (&YYTHD->mem_root) String("PRIMARY", 7,
+ interval_list.push_back(new (YYTHD->mem_root) String("PRIMARY", 7,
system_charset_info)); };
using_list:
@@ -3915,11 +3932,12 @@ do: DO_SYM
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_DO;
- if (!(lex->insert_list = new List_item))
- YYABORT;
+ mysql_init_select(lex);
+ }
+ expr_list
+ {
+ Lex->insert_list= $3;
}
- values
- {}
;
/*
@@ -4507,7 +4525,7 @@ opt_db:
wild:
/* empty */
| LIKE TEXT_STRING_sys
- { Lex->wild= new (&YYTHD->mem_root) String($2.str, $2.length,
+ { Lex->wild= new (YYTHD->mem_root) String($2.str, $2.length,
system_charset_info); };
opt_full:
@@ -4561,7 +4579,7 @@ opt_describe_column:
/* empty */ {}
| text_string { Lex->wild= $1; }
| ident
- { Lex->wild= new (&YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); };
+ { Lex->wild= new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); };
/* flush things */
@@ -4802,7 +4820,7 @@ text_literal:
text_string:
TEXT_STRING_literal
- { $$= new (&YYTHD->mem_root) String($1.str,$1.length,YYTHD->variables.collation_connection); }
+ { $$= new (YYTHD->mem_root) String($1.str,$1.length,YYTHD->variables.collation_connection); }
| HEX_NUM
{
Item *tmp = new Item_varbinary($1.str,$1.length);
@@ -5122,6 +5140,7 @@ keyword:
| COMMIT_SYM {}
| COMPRESSED_SYM {}
| CONCURRENT {}
+ | CONSISTENT_SYM {}
| CUBE_SYM {}
| DATA_SYM {}
| DATETIME {}
@@ -5262,6 +5281,7 @@ keyword:
| SHARE_SYM {}
| SHUTDOWN {}
| SLAVE {}
+ | SNAPSHOT_SYM {}
| SOUNDS_SYM {}
| SQL_CACHE_SYM {}
| SQL_BUFFER_RESULT {}
@@ -5612,7 +5632,7 @@ revoke_command:
grant_privileges ON opt_table FROM user_list
{}
|
- ALL PRIVILEGES ',' GRANT OPTION FROM user_list
+ ALL opt_privileges ',' GRANT OPTION FROM user_list
{
Lex->sql_command = SQLCOM_REVOKE_ALL;
}
@@ -5638,10 +5658,14 @@ grant:
grant_privileges:
grant_privilege_list {}
- | ALL PRIVILEGES { Lex->grant = GLOBAL_ACLS;}
- | ALL { Lex->grant = GLOBAL_ACLS;}
+ | ALL opt_privileges { Lex->grant = GLOBAL_ACLS;}
;
+opt_privileges:
+ /* empty */
+ | PRIVILEGES
+ ;
+
grant_privilege_list:
grant_privilege
| grant_privilege_list ',' grant_privilege;
@@ -5821,7 +5845,7 @@ column_list:
column_list_id:
ident
{
- String *new_str = new (&YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info);
+ String *new_str = new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info);
List_iterator <LEX_COLUMN> iter(Lex->columns);
class LEX_COLUMN *point;
LEX *lex=Lex;
@@ -5888,7 +5912,7 @@ grant_option:
;
begin:
- BEGIN_SYM { Lex->sql_command = SQLCOM_BEGIN;} opt_work {}
+ BEGIN_SYM { Lex->sql_command = SQLCOM_BEGIN; Lex->start_transaction_opt= 0;} opt_work {}
;
opt_work:
diff --git a/sql/structs.h b/sql/structs.h
index c30d85f59cb..846b3400fab 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -89,7 +89,12 @@ typedef struct st_key {
enum ha_key_alg algorithm;
KEY_PART_INFO *key_part;
char *name; /* Name of key */
- ulong *rec_per_key; /* Key part distribution */
+ /*
+ Array of AVG(#records with the same field value) for 1st ... Nth key part.
+ 0 means 'not known'.
+ For temporary heap tables this member is NULL.
+ */
+ ulong *rec_per_key;
union {
int bdb_return_if_eq;
} handler;
diff --git a/sql/table.cc b/sql/table.cc
index 3ae3d668407..20ac714020d 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -81,6 +81,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
uchar *null_pos;
uint null_bit, new_frm_ver, field_pack_length;
SQL_CRYPT *crypted=0;
+ MEM_ROOT **root_ptr, *old_root;
DBUG_ENTER("openfrm");
DBUG_PRINT("enter",("name: '%s' form: %lx",name,outparam));
@@ -91,8 +92,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
error=1;
init_sql_alloc(&outparam->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
- MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
- my_pthread_setspecific_ptr(THR_MALLOC,&outparam->mem_root);
+ root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC);
+ old_root= *root_ptr;
+ *root_ptr= &outparam->mem_root;
outparam->real_name=strdup_root(&outparam->mem_root,
name+dirname_length(name));
@@ -251,9 +253,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
#ifdef HAVE_CRYPTED_FRM
else if (*(head+26) == 2)
{
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ *root_ptr= old_root
crypted=get_crypt_for_frm();
- my_pthread_setspecific_ptr(THR_MALLOC,&outparam->mem_root);
+ *root_ptr= &outparam->mem_root;
outparam->crypted=1;
}
#endif
@@ -736,7 +738,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
}
outparam->db_low_byte_first=outparam->file->low_byte_first();
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ *root_ptr= old_root;
opened_tables++;
#ifndef DBUG_OFF
if (use_hash)
@@ -751,7 +753,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
err_end: /* Here when no file */
delete crypted;
- my_pthread_setspecific_ptr(THR_MALLOC,old_root);
+ *root_ptr= old_root;
frm_error(error,outparam,name,ME_ERROR+ME_WAITTANG);
delete outparam->file;
outparam->file=0; // For easyer errorchecking
diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc
index 0df60858bcb..3a9ca397bba 100644
--- a/sql/thr_malloc.cc
+++ b/sql/thr_malloc.cc
@@ -38,7 +38,7 @@ void init_sql_alloc(MEM_ROOT *mem_root, uint block_size, uint pre_alloc)
gptr sql_alloc(uint Size)
{
- MEM_ROOT *root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
+ MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC);
char *ptr= (char*) alloc_root(root,Size);
return ptr;
}
diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c
index 6f9e9f74d35..2177a18504e 100644
--- a/strings/ctype-czech.c
+++ b/strings/ctype-czech.c
@@ -589,12 +589,12 @@ static MY_COLLATION_HANDLER my_collation_latin2_czech_ci_handler =
CHARSET_INFO my_charset_latin2_czech_ci =
{
- 2,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */
- "latin2", /* cs name */
- "latin2_czech_cs", /* name */
- "", /* comment */
- NULL, /* tailoring */
+ 2,0,0, /* number */
+ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */
+ "latin2", /* cs name */
+ "latin2_czech_cs", /* name */
+ "", /* comment */
+ NULL, /* tailoring */
ctype_czech,
to_lower_czech,
to_upper_czech,
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 7d81766c4cb..3cdf7f460cd 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -443,6 +443,37 @@ static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
}
}
+
+/*
+ Write max key: create a buffer with multibyte
+ representation of the max_sort_char character,
+ and copy it into max_str in a loop.
+*/
+static void pad_max_char(CHARSET_INFO *cs, char *str, char *end)
+{
+ char buf[10];
+ char buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf,
+ (uchar*) buf + sizeof(buf));
+ DBUG_ASSERT(buflen > 0);
+ do
+ {
+ if ((str + buflen) < end)
+ {
+ /* Enough space for the characer */
+ memcpy(str, buf, buflen);
+ str+= buflen;
+ }
+ else
+ {
+ /*
+ There is no space for whole multibyte
+ character, then add trailing spaces.
+ */
+ *str++= ' ';
+ }
+ } while (str < end);
+}
+
/*
** Calculate min_str and max_str that ranges a LIKE string.
** Arguments:
@@ -467,10 +498,15 @@ my_bool my_like_range_mb(CHARSET_INFO *cs,
char *min_str,char *max_str,
uint *min_length,uint *max_length)
{
- const char *end=ptr+ptr_length;
- char *min_org=min_str;
- char *min_end=min_str+res_length;
- char *max_end=max_str+res_length;
+ const char *end;
+ char *min_org= min_str;
+ char *min_end= min_str + res_length;
+ char *max_end= max_str + res_length;
+ uint charlen= my_charpos(cs, ptr, ptr+ptr_length, res_length/cs->mbmaxlen);
+
+ if (charlen < ptr_length)
+ ptr_length= charlen;
+ end= ptr + ptr_length;
for (; ptr != end && min_str != min_end ; ptr++)
{
@@ -482,16 +518,14 @@ my_bool my_like_range_mb(CHARSET_INFO *cs,
}
if (*ptr == w_one || *ptr == w_many) /* '_' and '%' in SQL */
{
- char buf[10];
- uint buflen;
- uint charlen= my_charpos(cs, min_org, min_str, res_length/cs->mbmaxlen);
+ charlen= my_charpos(cs, min_org, min_str, res_length/cs->mbmaxlen);
if (charlen < (uint) (min_str - min_org))
min_str= min_org + charlen;
/* Write min key */
*min_length= (uint) (min_str - min_org);
- *max_length=res_length;
+ *max_length= res_length;
do
{
*min_str++= (char) cs->min_sort_char;
@@ -502,27 +536,7 @@ my_bool my_like_range_mb(CHARSET_INFO *cs,
representation of the max_sort_char character,
and copy it into max_str in a loop.
*/
- buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf,
- (uchar*) buf + sizeof(buf));
- DBUG_ASSERT(buflen > 0);
- do
- {
- if ((max_str + buflen) <= max_end)
- {
- /* Enough space for max characer */
- memcpy(max_str, buf, buflen);
- max_str+= buflen;
- }
- else
- {
- /*
- There is no space for whole multibyte
- character, then add trailing spaces.
- */
-
- *max_str++= ' ';
- }
- } while (max_str != max_end);
+ pad_max_char(cs, max_str, max_end);
return 0;
}
*min_str++= *max_str++ = *ptr;
@@ -530,7 +544,8 @@ my_bool my_like_range_mb(CHARSET_INFO *cs,
*min_length= *max_length = (uint) (min_str - min_org);
while (min_str != min_end)
- *min_str++ = *max_str++ = ' '; /* Because if key compression */
+ *min_str++= ' '; /* Because if key compression */
+ pad_max_char(cs, max_str, max_end);
return 0;
}
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index a2ba4783591..5d37aa965d9 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -541,7 +541,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
tc1= buf;
if ((len1 + len2 +2) > (int) sizeof(buf))
- tc1= (uchar*) malloc(len1+len2);
+ tc1= (uchar*) malloc(len1+len2+2);
tc2= tc1 + len1+1;
memcpy((char*) tc1, (char*) s1, len1);
tc1[len1]= 0; /* if length(s1)> len1, need to put 'end of string' */
@@ -562,17 +562,13 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
const uchar *b0, uint b_length)
{
uchar buf[80] ;
- uchar *end, *a, *b;
+ uchar *end, *a, *b, *alloced= NULL;
uint length;
int res= 0;
- int alloced= 0;
a= buf;
if ((a_length + b_length +2) > (int) sizeof(buf))
- {
- a= (uchar*) malloc(a_length+b_length);
- alloced= 1;
- }
+ alloced= a= (uchar*) malloc(a_length+b_length+2);
b= a + a_length+1;
memcpy((char*) a, (char*) a0, a_length);
@@ -618,7 +614,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
ret:
if (alloced)
- free(a);
+ free(alloced);
return res;
}
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index 91af7af0c54..8df5b3277c1 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -8567,7 +8567,7 @@ CHARSET_INFO my_charset_utf8_icelandic_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8594,7 +8594,7 @@ CHARSET_INFO my_charset_utf8_latvian_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8621,7 +8621,7 @@ CHARSET_INFO my_charset_utf8_romanian_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8648,7 +8648,7 @@ CHARSET_INFO my_charset_utf8_slovenian_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8675,7 +8675,7 @@ CHARSET_INFO my_charset_utf8_polish_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8702,7 +8702,7 @@ CHARSET_INFO my_charset_utf8_estonian_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8729,7 +8729,7 @@ CHARSET_INFO my_charset_utf8_spanish_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8756,7 +8756,7 @@ CHARSET_INFO my_charset_utf8_swedish_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8783,7 +8783,7 @@ CHARSET_INFO my_charset_utf8_turkish_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8810,7 +8810,7 @@ CHARSET_INFO my_charset_utf8_czech_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8838,7 +8838,7 @@ CHARSET_INFO my_charset_utf8_danish_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8865,7 +8865,7 @@ CHARSET_INFO my_charset_utf8_lithuanian_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8892,7 +8892,7 @@ CHARSET_INFO my_charset_utf8_slovak_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8919,7 +8919,7 @@ CHARSET_INFO my_charset_utf8_spanish2_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8946,7 +8946,7 @@ CHARSET_INFO my_charset_utf8_roman_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
@@ -8973,7 +8973,7 @@ CHARSET_INFO my_charset_utf8_persian_uca_ci=
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
- 2, /* mbmaxlen */
+ 3, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index b4dbda3e8ed..4ada3d47bf5 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -624,12 +624,12 @@ static MY_COLLATION_HANDLER my_collation_czech_ci_handler =
CHARSET_INFO my_charset_cp1250_czech_ci =
{
- 34,0,0, /* number */
- MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */
- "cp1250", /* cs name */
- "cp1250_czech_cs", /* name */
- "", /* comment */
- NULL, /* tailoring */
+ 34,0,0, /* number */
+ MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */
+ "cp1250", /* cs name */
+ "cp1250_czech_cs", /* name */
+ "", /* comment */
+ NULL, /* tailoring */
ctype_win1250ch,
to_lower_win1250ch,
to_upper_win1250ch,
diff --git a/strings/uca-dump.c b/strings/uca-dump.c
index 6836c321526..db5cb7e999a 100644
--- a/strings/uca-dump.c
+++ b/strings/uca-dump.c
@@ -23,13 +23,14 @@ struct uca_item_st
#define MY_UCA_PSHIFT 8
#endif
+static char *pname[]= {"", "2", "3"};
+
int main(int ac, char **av)
{
char str[256];
char *weights[64];
struct uca_item_st uca[64*1024];
- size_t code, page, w;
- int pagemaxlen[MY_UCA_NPAGES];
+ size_t code, w;
int pageloaded[MY_UCA_NPAGES];
bzero(uca, sizeof(uca));
@@ -155,14 +156,20 @@ int main(int ac, char **av)
printf("#define MY_UCA_CMASK %d\n",MY_UCA_CMASK);
printf("#define MY_UCA_PSHIFT %d\n",MY_UCA_PSHIFT);
- for (w=0; w<1; w++)
+ for (w=0; w<3; w++)
{
+ size_t page;
+ int pagemaxlen[MY_UCA_NPAGES];
+
for (page=0; page < MY_UCA_NPAGES; page++)
{
size_t offs;
size_t maxnum= 0;
size_t nchars= 0;
size_t mchars;
+ size_t ndefs= 0;
+
+ pagemaxlen[page]= 0;
/*
Skip this page if no weights were loaded
@@ -183,15 +190,36 @@ int main(int ac, char **av)
code= page*MY_UCA_NCHARS+offs;
/* Calculate only non-zero weights */
- num=0;
- for (i=0; i < uca[code].num; i++)
+ for (num=0, i=0; i < uca[code].num; i++)
if (uca[code].weight[w][i])
num++;
maxnum= maxnum < num ? num : maxnum;
+
+ /* Check if default weight */
+ if (w == 1 && num == 1)
+ {
+ /* 0020 0000 ... */
+ if (uca[code].weight[w][0] == 0x0020)
+ ndefs++;
+ }
+ else if (w == 2 && num == 1)
+ {
+ /* 0002 0000 ... */
+ if (uca[code].weight[w][0] == 0x0002)
+ ndefs++;
+ }
}
maxnum++;
+ /*
+ If the page have only default weights
+ then no needs to dump it, skip.
+ */
+ if (ndefs == MY_UCA_NCHARS)
+ {
+ continue;
+ }
switch (maxnum)
{
case 0: mchars= 8; break;
@@ -210,8 +238,8 @@ int main(int ac, char **av)
*/
- printf("uint16 page%03Xdata[]= { /* %04X (%d weights per char) */\n",
- page, page*MY_UCA_NCHARS, maxnum);
+ printf("uint16 page%03Xdata%s[]= { /* %04X (%d weights per char) */\n",
+ page, pname[w], page*MY_UCA_NCHARS, maxnum);
for (offs=0; offs < MY_UCA_NCHARS; offs++)
{
@@ -234,7 +262,17 @@ int main(int ac, char **av)
for (i=0; i < maxnum; i++)
{
- printf("0x%04X",(int)weight[i]);
+ /*
+ Invert weights for secondary level to
+ sort upper case letters before their
+ lower case counter part.
+ */
+ int tmp= weight[i];
+ if (w == 2 && tmp)
+ tmp= (int)(0x100 - weight[i]);
+
+
+ printf("0x%04X", tmp);
if ((offs+1 != MY_UCA_NCHARS) || (i+1!=maxnum))
printf(",");
nchars++;
@@ -251,25 +289,28 @@ int main(int ac, char **av)
}
printf("};\n\n");
}
- }
- printf("uchar ucal[%d]={\n",MY_UCA_NPAGES);
- for (page=0; page < MY_UCA_NPAGES; page++)
- {
- printf("%d%s%s",pagemaxlen[page],page<MY_UCA_NPAGES-1?",":"",(page+1) % 16 ? "":"\n");
- }
- printf("};\n");
-
-
- printf("uint16 *ucaw[%d]={\n",MY_UCA_NPAGES);
- for (page=0; page < MY_UCA_NPAGES; page++)
- {
- if (!pageloaded[page])
- printf("NULL %s%s",page<MY_UCA_NPAGES-1?",":"", (page+1) % 4 ? "":"\n");
- else
- printf("page%03Xdata%s%s",page,page<MY_UCA_NPAGES-1?",":"", (page+1) % 4 ? "":"\n");
+ printf("uchar uca_length%s[%d]={\n", pname[w], MY_UCA_NPAGES);
+ for (page=0; page < MY_UCA_NPAGES; page++)
+ {
+ printf("%d%s%s",pagemaxlen[page],page<MY_UCA_NPAGES-1?",":"",(page+1) % 16 ? "":"\n");
+ }
+ printf("};\n");
+
+
+ printf("uint16 *uca_weight%s[%d]={\n", pname[w], MY_UCA_NPAGES);
+ for (page=0; page < MY_UCA_NPAGES; page++)
+ {
+ const char *comma= page < MY_UCA_NPAGES-1 ? "," : "";
+ const char *nline= (page+1) % 4 ? "" : "\n";
+ if (!pagemaxlen[page])
+ printf("NULL %s%s", comma , nline);
+ else
+ printf("page%03Xdata%s%s%s", page, pname[w], comma, nline);
+ }
+ printf("};\n");
}
- printf("};\n");
+
printf("int main(void){ return 0;};\n");
return 0;
diff --git a/tests/client_test.c b/tests/client_test.c
index 227f7e29ef2..35990a521a4 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -27,7 +27,7 @@
#include <my_getopt.h>
#include <m_string.h>
-#define VER "2.0"
+#define VER "2.1"
#define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
/* set default options */
@@ -52,6 +52,12 @@ static double total_time;
const char *default_dbug_option= "d:t:o,/tmp/client_test.trace";
+struct my_tests_st
+{
+ const char *name;
+ void (*function)();
+};
+
#define myheader(str) \
if (opt_silent < 2) \
{ \
@@ -97,11 +103,12 @@ void die(const char *file, int line, const char *expr)
#define myerror(msg) print_error(msg)
#define mysterror(stmt, msg) print_st_error(stmt, msg)
-#define myquery(r) \
+#define myquery(RES) \
{ \
-if (r) \
- myerror(NULL); \
- DIE_UNLESS(r == 0); \
+ int r= (RES); \
+ if (r) \
+ myerror(NULL); \
+ DIE_UNLESS(r == 0); \
}
#define myquery_r(r) \
@@ -214,6 +221,7 @@ static void client_connect()
if (!(mysql= mysql_init(NULL)))
{
+ opt_silent= 0;
myerror("mysql_init() failed");
exit(1);
}
@@ -222,6 +230,7 @@ static void client_connect()
opt_password, opt_db ? opt_db:"test", opt_port,
opt_unix_socket, 0)))
{
+ opt_silent= 0;
myerror("connection failed");
mysql_close(mysql);
fprintf(stdout, "\n Check the connection options using --help or -?\n");
@@ -282,38 +291,40 @@ static void client_query()
myheader("client_query");
- rc= mysql_query(mysql, "DROP TABLE IF EXISTS myclient_test");
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
myquery(rc);
- rc= mysql_query(mysql, "CREATE TABLE myclient_test("
+ rc= mysql_query(mysql, "CREATE TABLE t1("
"id int primary key auto_increment, "
"name varchar(20))");
myquery(rc);
- rc= mysql_query(mysql, "CREATE TABLE myclient_test(id int, name varchar(20))");
+ rc= mysql_query(mysql, "CREATE TABLE t1(id int, name varchar(20))");
myquery_r(rc);
- rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('mysql')");
+ rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('mysql')");
myquery(rc);
- rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('monty')");
+ rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('monty')");
myquery(rc);
- rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('venu')");
+ rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('venu')");
myquery(rc);
- rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('deleted')");
+ rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('deleted')");
myquery(rc);
- rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('deleted')");
+ rc= mysql_query(mysql, "INSERT INTO t1(name) VALUES('deleted')");
myquery(rc);
- rc= mysql_query(mysql, "UPDATE myclient_test SET name= 'updated' "
+ rc= mysql_query(mysql, "UPDATE t1 SET name= 'updated' "
"WHERE name= 'deleted'");
myquery(rc);
- rc= mysql_query(mysql, "UPDATE myclient_test SET id= 3 WHERE name= 'updated'");
+ rc= mysql_query(mysql, "UPDATE t1 SET id= 3 WHERE name= 'updated'");
myquery_r(rc);
+
+ myquery(mysql_query(mysql, "drop table t1"));
}
@@ -624,12 +635,15 @@ static void verify_prepare_field(MYSQL_RES *result,
unsigned long length, const char *def)
{
MYSQL_FIELD *field;
+ CHARSET_INFO *cs;
if (!(field= mysql_fetch_field_direct(result, no)))
{
fprintf(stdout, "\n *** ERROR: FAILED TO GET THE RESULT ***");
exit(1);
}
+ cs= get_charset(field->charsetnr, 0);
+ DIE_UNLESS(cs);
if (!opt_silent)
{
fprintf(stdout, "\n field[%d]:", no);
@@ -643,7 +657,7 @@ static void verify_prepare_field(MYSQL_RES *result,
field->org_table, org_table);
fprintf(stdout, "\n database :`%s`\t(expected: `%s`)", field->db, db);
fprintf(stdout, "\n length :`%ld`\t(expected: `%ld`)",
- field->length, length);
+ field->length, length * cs->mbmaxlen);
fprintf(stdout, "\n maxlength:`%ld`", field->max_length);
fprintf(stdout, "\n charsetnr:`%d`", field->charsetnr);
fprintf(stdout, "\n default :`%s`\t(expected: `%s`)",
@@ -652,11 +666,24 @@ static void verify_prepare_field(MYSQL_RES *result,
}
DIE_UNLESS(strcmp(field->name, name) == 0);
DIE_UNLESS(strcmp(field->org_name, org_name) == 0);
- DIE_UNLESS(field->type == type);
+ /*
+ XXX: silent column specification change works based on number of
+ bytes a column occupies. So CHAR -> VARCHAR upgrade is possible even
+ for CHAR(2) column if its character set is multibyte.
+ VARCHAR -> CHAR downgrade won't work for VARCHAR(3) as one would
+ expect.
+ */
+ if (cs->mbmaxlen == 1)
+ DIE_UNLESS(field->type == type);
DIE_UNLESS(strcmp(field->table, table) == 0);
DIE_UNLESS(strcmp(field->org_table, org_table) == 0);
DIE_UNLESS(strcmp(field->db, db) == 0);
- DIE_UNLESS(field->length == length);
+ /*
+ Character set should be taken into account for multibyte encodings, such
+ as utf8. Field length is calculated as number of characters * maximum
+ number of bytes a character can occupy.
+ */
+ DIE_UNLESS(field->length == length * cs->mbmaxlen);
if (def)
DIE_UNLESS(strcmp(field->def, def) == 0);
}
@@ -743,7 +770,7 @@ static void client_store_result()
myheader("client_store_result");
- rc= mysql_query(mysql, "SELECT * FROM myclient_test");
+ rc= mysql_query(mysql, "SELECT * FROM t1");
myquery(rc);
/* get the result */
@@ -763,7 +790,7 @@ static void client_use_result()
int rc;
myheader("client_use_result");
- rc= mysql_query(mysql, "SELECT * FROM myclient_test");
+ rc= mysql_query(mysql, "SELECT * FROM t1");
myquery(rc);
/* get the result */
@@ -7537,17 +7564,17 @@ static void test_fetch_seek()
char c2[11], c3[20];
myheader("test_fetch_seek");
+ rc= mysql_query(mysql, "drop table if exists t1");
- rc= mysql_query(mysql, "drop table if exists test_seek");
myquery(rc);
- rc= mysql_query(mysql, "create table test_seek(c1 int primary key auto_increment, c2 char(10), c3 timestamp(14))");
+ rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10), c3 timestamp(14))");
myquery(rc);
- rc= mysql_query(mysql, "insert into test_seek(c2) values('venu'), ('mysql'), ('open'), ('source')");
+ rc= mysql_query(mysql, "insert into t1(c2) values('venu'), ('mysql'), ('open'), ('source')");
myquery(rc);
- stmt= mysql_simple_prepare(mysql, "select * from test_seek");
+ stmt= mysql_simple_prepare(mysql, "select * from t1");
check_stmt(stmt);
bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -7620,6 +7647,7 @@ static void test_fetch_seek()
DIE_UNLESS(rc == MYSQL_NO_DATA);
mysql_stmt_close(stmt);
+ myquery(mysql_query(mysql, "drop table t1"));
}
@@ -7637,16 +7665,16 @@ static void test_fetch_offset()
myheader("test_fetch_offset");
- rc= mysql_query(mysql, "drop table if exists test_column");
+ rc= mysql_query(mysql, "drop table if exists t1");
myquery(rc);
- rc= mysql_query(mysql, "create table test_column(a char(10))");
+ rc= mysql_query(mysql, "create table t1(a char(10))");
myquery(rc);
- rc= mysql_query(mysql, "insert into test_column values('abcdefghij'), (null)");
+ rc= mysql_query(mysql, "insert into t1 values('abcdefghij'), (null)");
myquery(rc);
- stmt= mysql_simple_prepare(mysql, "select * from test_column");
+ stmt= mysql_simple_prepare(mysql, "select * from t1");
check_stmt(stmt);
bind[0].buffer_type= MYSQL_TYPE_STRING;
@@ -7706,6 +7734,8 @@ static void test_fetch_offset()
check_execute_r(stmt, rc);
mysql_stmt_close(stmt);
+
+ myquery(mysql_query(mysql, "drop table t1"));
}
@@ -7721,16 +7751,16 @@ static void test_fetch_column()
myheader("test_fetch_column");
- rc= mysql_query(mysql, "drop table if exists test_column");
+ rc= mysql_query(mysql, "drop table if exists t1");
myquery(rc);
- rc= mysql_query(mysql, "create table test_column(c1 int primary key auto_increment, c2 char(10))");
+ rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10))");
myquery(rc);
- rc= mysql_query(mysql, "insert into test_column(c2) values('venu'), ('mysql')");
+ rc= mysql_query(mysql, "insert into t1(c2) values('venu'), ('mysql')");
myquery(rc);
- stmt= mysql_simple_prepare(mysql, "select * from test_column order by c2 desc");
+ stmt= mysql_simple_prepare(mysql, "select * from t1 order by c2 desc");
check_stmt(stmt);
bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -7841,6 +7871,7 @@ static void test_fetch_column()
check_execute_r(stmt, rc);
mysql_stmt_close(stmt);
+ myquery(mysql_query(mysql, "drop table t1"));
}
@@ -7852,27 +7883,28 @@ static void test_list_fields()
int rc;
myheader("test_list_fields");
- rc= mysql_query(mysql, "drop table if exists test_list_fields");
+ rc= mysql_query(mysql, "drop table if exists t1");
myquery(rc);
- rc= mysql_query(mysql, "create table test_list_fields(c1 int primary key auto_increment, c2 char(10) default 'mysql')");
+ rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10) default 'mysql')");
myquery(rc);
- result= mysql_list_fields(mysql, "test_list_fields", NULL);
+ result= mysql_list_fields(mysql, "t1", NULL);
mytest(result);
rc= my_process_result_set(result);
DIE_UNLESS(rc == 0);
verify_prepare_field(result, 0, "c1", "c1", MYSQL_TYPE_LONG,
- "test_list_fields", "test_list_fields",
+ "t1", "t1",
current_db, 11, "0");
verify_prepare_field(result, 1, "c2", "c2", MYSQL_TYPE_STRING,
- "test_list_fields", "test_list_fields",
+ "t1", "t1",
current_db, 10, "mysql");
mysql_free_result(result);
+ myquery(mysql_query(mysql, "drop table t1"));
}
@@ -11082,6 +11114,7 @@ static void test_bug6096()
free(bind[i].buffer);
mysql_stmt_close(stmt);
mysql_free_result(query_result);
+ mysql_free_result(stmt_metadata);
stmt_text= "drop table t1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
@@ -11089,6 +11122,273 @@ static void test_bug6096()
/*
+ Test of basic checks that are performed in server for components
+ of MYSQL_TIME parameters.
+*/
+
+static void test_datetime_ranges()
+{
+ const char *stmt_text;
+ int rc, i;
+ MYSQL_STMT *stmt;
+ MYSQL_BIND bind[6];
+ MYSQL_TIME tm[6];
+
+ myheader("test_datetime_ranges");
+
+ stmt_text= "drop table if exists t1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+
+ stmt_text= "create table t1 (year datetime, month datetime, day datetime, "
+ "hour datetime, min datetime, sec datetime)";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+
+ stmt= mysql_simple_prepare(mysql,
+ "INSERT INTO t1 VALUES (?, ?, ?, ?, ?, ?)");
+ check_stmt(stmt);
+ verify_param_count(stmt, 6);
+
+ bzero(bind, sizeof(bind));
+ for (i= 0; i < 6; i++)
+ {
+ bind[i].buffer_type= MYSQL_TYPE_DATETIME;
+ bind[i].buffer= &tm[i];
+ }
+ rc= mysql_stmt_bind_param(stmt, bind);
+ check_execute(stmt, rc);
+
+ tm[0].year= 2004; tm[0].month= 11; tm[0].day= 10;
+ tm[0].hour= 12; tm[0].minute= 30; tm[0].second= 30;
+ tm[0].second_part= 0; tm[0].neg= 0;
+
+ tm[5]= tm[4]= tm[3]= tm[2]= tm[1]= tm[0];
+ tm[0].year= 10000; tm[1].month= 13; tm[2].day= 32;
+ tm[3].hour= 24; tm[4].minute= 60; tm[5].second= 60;
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ DIE_UNLESS(mysql_warning_count(mysql) != 6);
+
+ verify_col_data("t1", "year", "0000-00-00 00:00:00");
+ verify_col_data("t1", "month", "0000-00-00 00:00:00");
+ verify_col_data("t1", "day", "0000-00-00 00:00:00");
+ verify_col_data("t1", "hour", "0000-00-00 00:00:00");
+ verify_col_data("t1", "min", "0000-00-00 00:00:00");
+ verify_col_data("t1", "sec", "0000-00-00 00:00:00");
+
+ mysql_stmt_close(stmt);
+
+ stmt_text= "delete from t1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+
+ stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 (year, month, day) "
+ "VALUES (?, ?, ?)");
+ check_stmt(stmt);
+ verify_param_count(stmt, 3);
+
+ /*
+ We reuse contents of bind and tm arrays left from previous part of test.
+ */
+ for (i= 0; i < 3; i++)
+ bind[i].buffer_type= MYSQL_TYPE_DATE;
+
+ rc= mysql_stmt_bind_param(stmt, bind);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ DIE_UNLESS(mysql_warning_count(mysql) != 3);
+
+ verify_col_data("t1", "year", "0000-00-00 00:00:00");
+ verify_col_data("t1", "month", "0000-00-00 00:00:00");
+ verify_col_data("t1", "day", "0000-00-00 00:00:00");
+
+ mysql_stmt_close(stmt);
+
+ stmt_text= "drop table t1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+
+ stmt_text= "create table t1 (day_ovfl time, day time, hour time, min time, sec time)";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+
+ stmt= mysql_simple_prepare(mysql,
+ "INSERT INTO t1 VALUES (?, ?, ?, ?, ?)");
+ check_stmt(stmt);
+ verify_param_count(stmt, 5);
+
+ /*
+ Again we reuse what we can from previous part of test.
+ */
+ for (i= 0; i < 5; i++)
+ bind[i].buffer_type= MYSQL_TYPE_TIME;
+
+ rc= mysql_stmt_bind_param(stmt, bind);
+ check_execute(stmt, rc);
+
+ tm[0].year= 0; tm[0].month= 0; tm[0].day= 10;
+ tm[0].hour= 12; tm[0].minute= 30; tm[0].second= 30;
+ tm[0].second_part= 0; tm[0].neg= 0;
+
+ tm[4]= tm[3]= tm[2]= tm[1]= tm[0];
+ tm[0].day= 35; tm[1].day= 34; tm[2].hour= 30; tm[3].minute= 60; tm[4].second= 60;
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ DIE_UNLESS(mysql_warning_count(mysql) != 2);
+
+ verify_col_data("t1", "day_ovfl", "838:59:59");
+ verify_col_data("t1", "day", "828:30:30");
+ verify_col_data("t1", "hour", "270:30:30");
+ verify_col_data("t1", "min", "00:00:00");
+ verify_col_data("t1", "sec", "00:00:00");
+
+ mysql_stmt_close(stmt);
+
+ stmt_text= "drop table t1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+}
+
+
+static void test_bug4172()
+{
+ MYSQL_STMT *stmt;
+ MYSQL_BIND bind[3];
+ const char *stmt_text;
+ MYSQL_RES *res;
+ MYSQL_ROW row;
+ int rc;
+ char f[100], d[100], e[100];
+ long f_len, d_len, e_len;
+
+ myheader("test_bug4172");
+
+ mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ mysql_query(mysql, "CREATE TABLE t1 (f float, d double, e decimal(10,4))");
+ mysql_query(mysql, "INSERT INTO t1 VALUES (12345.1234, 123456.123456, "
+ "123456.1234)");
+
+ stmt= mysql_stmt_init(mysql);
+ stmt_text= "SELECT f, d, e FROM t1";
+
+ rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ check_execute(stmt, rc);
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ bzero(bind, sizeof(bind));
+ bind[0].buffer_type= MYSQL_TYPE_STRING;
+ bind[0].buffer= f;
+ bind[0].buffer_length= sizeof(f);
+ bind[0].length= &f_len;
+ bind[1].buffer_type= MYSQL_TYPE_STRING;
+ bind[1].buffer= d;
+ bind[1].buffer_length= sizeof(d);
+ bind[1].length= &d_len;
+ bind[2].buffer_type= MYSQL_TYPE_STRING;
+ bind[2].buffer= e;
+ bind[2].buffer_length= sizeof(e);
+ bind[2].length= &e_len;
+
+ mysql_stmt_bind_result(stmt, bind);
+
+ mysql_stmt_store_result(stmt);
+ rc= mysql_stmt_fetch(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+ res= mysql_store_result(mysql);
+ row= mysql_fetch_row(res);
+
+ if (!opt_silent)
+ {
+ printf("Binary protocol: float=%s, double=%s, decimal(10,4)=%s\n",
+ f, d, e);
+ printf("Text protocol: float=%s, double=%s, decimal(10,4)=%s\n",
+ row[0], row[1], row[2]);
+ }
+ DIE_UNLESS(!strcmp(f, row[0]) && !strcmp(d, row[1]) && !strcmp(e, row[2]));
+
+ mysql_free_result(res);
+ mysql_stmt_close(stmt);
+}
+
+
+static void test_conversion()
+{
+ MYSQL_STMT *stmt;
+ const char *stmt_text;
+ int rc;
+ MYSQL_BIND bind[1];
+ char buff[4];
+ ulong length;
+
+ myheader("test_conversion");
+
+ stmt_text= "DROP TABLE IF EXISTS t1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+ stmt_text= "CREATE TABLE t1 (a TEXT) DEFAULT CHARSET latin1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+ stmt_text= "SET character_set_connection=utf8, character_set_client=utf8, "
+ " character_set_results=latin1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+
+ stmt= mysql_stmt_init(mysql);
+
+ stmt_text= "INSERT INTO t1 (a) VALUES (?)";
+ rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ check_execute(stmt, rc);
+
+ bzero(bind, sizeof(bind));
+ bind[0].buffer= buff;
+ bind[0].length= &length;
+ bind[0].buffer_type= MYSQL_TYPE_STRING;
+
+ mysql_stmt_bind_param(stmt, bind);
+
+ buff[0]= 0xC3;
+ buff[1]= 0xA0;
+ length= 2;
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ stmt_text= "SELECT a FROM t1";
+ rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ check_execute(stmt, rc);
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ bind[0].buffer_length= sizeof(buff);
+ mysql_stmt_bind_result(stmt, bind);
+
+ rc= mysql_stmt_fetch(stmt);
+ DIE_UNLESS(rc == 0);
+ DIE_UNLESS(length == 1);
+ DIE_UNLESS((uchar) buff[0] == 0xE0);
+ rc= mysql_stmt_fetch(stmt);
+ DIE_UNLESS(rc == MYSQL_NO_DATA);
+
+ mysql_stmt_close(stmt);
+ stmt_text= "DROP TABLE t1";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+ stmt_text= "SET NAMES DEFAULT";
+ rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ myquery(rc);
+}
+
+
+/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -11097,31 +11397,35 @@ static char **defaults_argv;
static struct my_option client_test_long_options[] =
{
- {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
- 0, 0, 0, 0, 0},
+ {"count", 't', "Number of times test to be executed", (char **) &opt_count,
+ (char **) &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use", (char **) &opt_db, (char **) &opt_db,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"host", 'h', "Connect to host", (char **) &opt_host, (char **) &opt_host, 0, GET_STR_ALLOC,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
+ 0, 0, 0, 0, 0},
+ {"host", 'h', "Connect to host", (char **) &opt_host, (char **) &opt_host,
+ 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-#ifndef DONT_ALLOW_USER_CHANGE
- {"user", 'u', "User for login if not current user", (char **) &opt_user,
- (char **) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"port", 'P', "Port number to use for connection", (char **) &opt_port,
(char **) &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"show-tests", 'T', "Show all tests' names", 0, 0, 0, GET_NO_ARG, NO_ARG,
+ 0, 0, 0, 0, 0, 0},
{"silent", 's', "Be more silent", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0,
0},
- {"socket", 'S', "Socket file to use for connection", (char **) &opt_unix_socket,
- (char **) &opt_unix_socket, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"testcase", 'c', "May disable some code when runs as mysql-test-run testcase.",
+ {"socket", 'S', "Socket file to use for connection",
+ (char **) &opt_unix_socket, (char **) &opt_unix_socket, 0, GET_STR,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"testcase", 'c',
+ "May disable some code when runs as mysql-test-run testcase.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"count", 't', "Number of times test to be executed", (char **) &opt_count,
- (char **) &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
+#ifndef DONT_ALLOW_USER_CHANGE
+ {"user", 'u', "User for login if not current user", (char **) &opt_user,
+ (char **) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#endif
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -11137,13 +11441,161 @@ static void usage(void)
Copyright (C) 2002-2004 MySQL AB\n\
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
and you are welcome to modify and redistribute it under the GPL license\n");
- printf("Usage: %s [OPTIONS]\n", my_progname);
+ printf("Usage: %s [OPTIONS] [TESTNAME1 TESTNAME2...]\n", my_progname);
my_print_help(client_test_long_options);
print_defaults("my", client_test_load_default_groups);
my_print_variables(client_test_long_options);
}
+static struct my_tests_st my_tests[]= {
+ { "client_query", client_query },
+#if NOT_YET_WORKING
+ { "test_drop_temp", test_drop_temp },
+#endif
+ { "test_fetch_seek", test_fetch_seek },
+ { "test_fetch_nobuffs", test_fetch_nobuffs },
+ { "test_open_direct", test_open_direct },
+ { "test_fetch_null", test_fetch_null },
+ { "test_ps_null_param", test_ps_null_param },
+ { "test_fetch_date", test_fetch_date },
+ { "test_fetch_str", test_fetch_str },
+ { "test_fetch_long", test_fetch_long },
+ { "test_fetch_short", test_fetch_short },
+ { "test_fetch_tiny", test_fetch_tiny },
+ { "test_fetch_bigint", test_fetch_bigint },
+ { "test_fetch_float", test_fetch_float },
+ { "test_fetch_double", test_fetch_double },
+ { "test_bind_result_ext", test_bind_result_ext },
+ { "test_bind_result_ext1", test_bind_result_ext1 },
+ { "test_select_direct", test_select_direct },
+ { "test_select_prepare", test_select_prepare },
+ { "test_select", test_select },
+ { "test_select_version", test_select_version },
+ { "test_ps_conj_select", test_ps_conj_select },
+ { "test_select_show_table", test_select_show_table },
+ { "test_func_fields", test_func_fields },
+ { "test_long_data", test_long_data },
+ { "test_insert", test_insert },
+ { "test_set_variable", test_set_variable },
+ { "test_select_show", test_select_show },
+ { "test_prepare_noparam", test_prepare_noparam },
+ { "test_bind_result", test_bind_result },
+ { "test_prepare_simple", test_prepare_simple },
+ { "test_prepare", test_prepare },
+ { "test_null", test_null },
+ { "test_debug_example", test_debug_example },
+ { "test_update", test_update },
+ { "test_simple_update", test_simple_update },
+ { "test_simple_delete", test_simple_delete },
+ { "test_double_compare", test_double_compare },
+ { "client_store_result", client_store_result },
+ { "client_use_result", client_use_result },
+ { "test_tran_bdb", test_tran_bdb },
+ { "test_tran_innodb", test_tran_innodb },
+ { "test_prepare_ext", test_prepare_ext },
+ { "test_prepare_syntax", test_prepare_syntax },
+ { "test_field_names", test_field_names },
+ { "test_field_flags", test_field_flags },
+ { "test_long_data_str", test_long_data_str },
+ { "test_long_data_str1", test_long_data_str1 },
+ { "test_long_data_bin", test_long_data_bin },
+ { "test_warnings", test_warnings },
+ { "test_errors", test_errors },
+ { "test_prepare_resultset", test_prepare_resultset },
+ { "test_stmt_close", test_stmt_close },
+ { "test_prepare_field_result", test_prepare_field_result },
+ { "test_multi_stmt", test_multi_stmt },
+ { "test_multi_statements", test_multi_statements },
+ { "test_prepare_multi_statements", test_prepare_multi_statements },
+ { "test_store_result", test_store_result },
+ { "test_store_result1", test_store_result1 },
+ { "test_store_result2", test_store_result2 },
+ { "test_subselect", test_subselect },
+ { "test_date", test_date },
+ { "test_date_date", test_date_date },
+ { "test_date_time", test_date_time },
+ { "test_date_ts", test_date_ts },
+ { "test_date_dt", test_date_dt },
+ { "test_prepare_alter", test_prepare_alter },
+ { "test_manual_sample", test_manual_sample },
+ { "test_pure_coverage", test_pure_coverage },
+ { "test_buffers", test_buffers },
+ { "test_ushort_bug", test_ushort_bug },
+ { "test_sshort_bug", test_sshort_bug },
+ { "test_stiny_bug", test_stiny_bug },
+ { "test_field_misc", test_field_misc },
+ { "test_set_option", test_set_option },
+#ifndef EMBEDDED_LIBRARY
+ { "test_prepare_grant", test_prepare_grant },
+#endif
+ { "test_frm_bug", test_frm_bug },
+ { "test_explain_bug", test_explain_bug },
+ { "test_decimal_bug", test_decimal_bug },
+ { "test_nstmts", test_nstmts },
+ { "test_logs;", test_logs },
+ { "test_cuted_rows", test_cuted_rows },
+ { "test_fetch_offset", test_fetch_offset },
+ { "test_fetch_column", test_fetch_column },
+ { "test_mem_overun", test_mem_overun },
+ { "test_list_fields", test_list_fields },
+ { "test_free_result", test_free_result },
+ { "test_free_store_result", test_free_store_result },
+ { "test_sqlmode", test_sqlmode },
+ { "test_ts", test_ts },
+ { "test_bug1115", test_bug1115 },
+ { "test_bug1180", test_bug1180 },
+ { "test_bug1500", test_bug1500 },
+ { "test_bug1644", test_bug1644 },
+ { "test_bug1946", test_bug1946 },
+ { "test_bug2248", test_bug2248 },
+ { "test_parse_error_and_bad_length", test_parse_error_and_bad_length },
+ { "test_bug2247", test_bug2247 },
+ { "test_subqueries", test_subqueries },
+ { "test_bad_union", test_bad_union },
+ { "test_distinct", test_distinct },
+ { "test_subqueries_ref", test_subqueries_ref },
+ { "test_union", test_union },
+ { "test_bug3117", test_bug3117 },
+ { "test_join", test_join },
+ { "test_selecttmp", test_selecttmp },
+ { "test_create_drop", test_create_drop },
+ { "test_rename", test_rename },
+ { "test_do_set", test_do_set },
+ { "test_multi", test_multi },
+ { "test_insert_select", test_insert_select },
+ { "test_bind_nagative", test_bind_nagative },
+ { "test_derived", test_derived },
+ { "test_xjoin", test_xjoin },
+ { "test_bug3035", test_bug3035 },
+ { "test_union2", test_union2 },
+ { "test_bug1664", test_bug1664 },
+ { "test_union_param", test_union_param },
+ { "test_order_param", test_order_param },
+ { "test_ps_i18n", test_ps_i18n },
+ { "test_bug3796", test_bug3796 },
+ { "test_bug4026", test_bug4026 },
+ { "test_bug4079", test_bug4079 },
+ { "test_bug4236", test_bug4236 },
+ { "test_bug4030", test_bug4030 },
+ { "test_bug5126", test_bug5126 },
+ { "test_bug4231", test_bug4231 },
+ { "test_bug5399", test_bug5399 },
+ { "test_bug5194", test_bug5194 },
+ { "test_bug5315", test_bug5315 },
+ { "test_bug6049", test_bug6049 },
+ { "test_bug6058", test_bug6058 },
+ { "test_bug6059", test_bug6059 },
+ { "test_bug6046", test_bug6046 },
+ { "test_bug6081", test_bug6081 },
+ { "test_bug6096", test_bug6096 },
+ { "test_datetime_ranges", test_datetime_ranges },
+ { "test_bug4172", test_bug4172 },
+ { "test_conversion", test_conversion },
+ { 0, 0 }
+};
+
+
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
@@ -11174,6 +11626,16 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
else
opt_silent++;
break;
+ case 'T':
+ {
+ struct my_tests_st *fptr;
+
+ printf("All possible test names:\n\n");
+ for (fptr= my_tests; fptr->name; fptr++)
+ printf("%s\n", fptr->name);
+ exit(0);
+ break;
+ }
case '?':
case 'I': /* Info */
usage();
@@ -11183,11 +11645,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
return 0;
}
-static void get_options(int argc, char **argv)
+static void get_options(int *argc, char ***argv)
{
int ho_error;
- if ((ho_error= handle_options(&argc, &argv, client_test_long_options,
+ if ((ho_error= handle_options(argc, argv, client_test_long_options,
get_one_option)))
exit(ho_error);
@@ -11220,14 +11682,17 @@ static void print_test_output()
main routine
***************************************************************************/
+
int main(int argc, char **argv)
{
+ struct my_tests_st *fptr;
+
DEBUGGER_OFF;
MY_INIT(argv[0]);
-
+
load_defaults("my", client_test_load_default_groups, &argc, &argv);
defaults_argv= argv;
- get_options(argc, argv);
+ get_options(&argc, &argv);
client_connect(); /* connect to server */
@@ -11236,174 +11701,37 @@ int main(int argc, char **argv)
{
/* Start of tests */
test_count= 1;
-
start_time= time((time_t *)0);
- client_query(); /* simple client query test */
-#if NOT_YET_WORKING
- /* Used for internal new development debugging */
- test_drop_temp(); /* Test DROP TEMPORARY TABLE Access checks */
-#endif
- test_fetch_seek(); /* Test stmt seek() functions */
- test_fetch_nobuffs(); /* to fecth without prior bound buffers */
- test_open_direct(); /* direct execution in the middle of open stmts */
- test_fetch_null(); /* to fetch null data */
- test_ps_null_param(); /* Fetch value of null parameter */
- test_fetch_date(); /* to fetch date, time and timestamp */
- test_fetch_str(); /* to fetch string to all types */
- test_fetch_long(); /* to fetch long to all types */
- test_fetch_short(); /* to fetch short to all types */
- test_fetch_tiny(); /* to fetch tiny to all types */
- test_fetch_bigint(); /* to fetch bigint to all types */
- test_fetch_float(); /* to fetch float to all types */
- test_fetch_double(); /* to fetch double to all types */
- test_bind_result_ext(); /* result bind test - extension */
- test_bind_result_ext1(); /* result bind test - extension */
- test_select_direct(); /* direct select - protocol_simple debug */
- test_select_prepare(); /* prepare select - protocol_prep debug */
- test_select(); /* simple select test */
- test_select_version(); /* select with variables */
- test_ps_conj_select(); /* prepare select with "where a=? or b=?" */
- test_select_show_table();/* simple show prepare */
-#if NOT_USED
- /*
- Enable this tests from 4.1.1 when mysql_param_result() is
- supported
- */
- test_select_meta(); /* select param meta information */
- test_update_meta(); /* update param meta information */
- test_insert_meta(); /* insert param meta information */
-#endif
- test_func_fields(); /* test for new 4.1 MYSQL_FIELD members */
- test_long_data(); /* test for sending text data in chunks */
- test_insert(); /* simple insert test - prepare */
- test_set_variable(); /* prepare with set variables */
- test_select_show(); /* prepare - show test */
- test_prepare_noparam(); /* prepare without parameters */
- test_bind_result(); /* result bind test */
- test_prepare_simple(); /* simple prepare */
- test_prepare(); /* prepare test */
- test_null(); /* test null data handling */
- test_debug_example(); /* some debugging case */
- test_update(); /* prepare-update test */
- test_simple_update(); /* simple prepare with update */
- test_simple_delete(); /* prepare with delete */
- test_double_compare(); /* float comparision */
- client_store_result(); /* usage of mysql_store_result() */
- client_use_result(); /* usage of mysql_use_result() */
- test_tran_bdb(); /* transaction test on BDB table type */
- test_tran_innodb(); /* transaction test on InnoDB table type */
- test_prepare_ext(); /* test prepare with all types
- conversion -- TODO */
- test_prepare_syntax(); /* syntax check for prepares */
- test_field_names(); /* test for field names */
- test_field_flags(); /* test to help .NET provider team */
- test_long_data_str(); /* long data handling */
- test_long_data_str1(); /* yet another long data handling */
- test_long_data_bin(); /* long binary insertion */
- test_warnings(); /* show warnings test */
- test_errors(); /* show errors test */
- test_prepare_resultset();/* prepare meta info test */
- test_stmt_close(); /* mysql_stmt_close() test -- hangs */
- test_prepare_field_result(); /* prepare meta info */
- test_multi_stmt(); /* multi stmt test */
- test_multi_statements();/* test multi statement execution */
- test_prepare_multi_statements(); /* check that multi statements are
- disabled in PS */
- test_store_result(); /* test the store_result */
- test_store_result1(); /* test store result without buffers */
- test_store_result2(); /* test store result for misc case */
- test_subselect(); /* test subselect prepare -TODO*/
- test_date(); /* test the MYSQL_TIME conversion */
- test_date_date(); /* test conversion from DATE to all */
- test_date_time(); /* test conversion from TIME to all */
- test_date_ts() ; /* test conversion from TIMESTAMP to all */
- test_date_dt() ; /* test conversion from DATETIME to all */
- test_prepare_alter(); /* change table schema in middle of prepare */
- test_manual_sample(); /* sample in the manual */
- test_pure_coverage(); /* keep pure coverage happy */
- test_buffers(); /* misc buffer handling */
- test_ushort_bug(); /* test a simple conv bug from php */
- test_sshort_bug(); /* test a simple conv bug from php */
- test_stiny_bug(); /* test a simple conv bug from php */
- test_field_misc(); /* check the field info for misc case, bug: #74 */
- test_set_option(); /* test the SET OPTION feature, bug #85 */
- /*TODO HF: here should be NO_EMBEDDED_ACCESS_CHECKS*/
-#ifndef EMBEDDED_LIBRARY
- test_prepare_grant(); /* Test the GRANT command, bug #89 */
-#endif
- test_frm_bug(); /* test the crash when .frm is invalid, bug #93 */
- test_explain_bug(); /* test for the EXPLAIN, bug #115 */
- test_decimal_bug(); /* test for the decimal bug */
- test_nstmts(); /* test n statements */
- test_logs(); ; /* Test logs */
- test_cuted_rows(); /* Test for WARNINGS from cuted rows */
- test_fetch_offset(); /* Test mysql_stmt_fetch_column with offset */
- test_fetch_column(); /* Test mysql_stmt_fetch_column */
- test_mem_overun(); /* test DBD ovverun bug */
- test_list_fields(); /* test COM_LIST_FIELDS for DEFAULT */
- test_free_result(); /* test mysql_stmt_free_result() */
- test_free_store_result(); /* test to make sure stmt results are cleared
- during stmt_free_result() */
- test_sqlmode(); /* test for SQL_MODE */
- test_ts(); /* test for timestamp BR#819 */
- test_bug1115(); /* BUG#1115 */
- test_bug1180(); /* BUG#1180 */
- test_bug1500(); /* BUG#1500 */
- test_bug1644(); /* BUG#1644 */
- test_bug1946(); /* test that placeholders are allowed only in
- prepared queries */
- test_bug2248(); /* BUG#2248 */
- test_parse_error_and_bad_length(); /* test if bad length param in
- mysql_stmt_prepare() triggers error */
- test_bug2247(); /* test that mysql_stmt_affected_rows() returns
- number of rows affected by last prepared
- statement execution */
- test_subqueries(); /* repeatable subqueries */
- test_bad_union(); /* correct setup of UNION */
- test_distinct(); /* distinct aggregate functions */
- test_subqueries_ref(); /* outer reference in subqueries converted
- Item_field -> Item_ref */
- test_union(); /* test union with prepared statements */
- test_bug3117(); /* BUG#3117: LAST_INSERT_ID() */
- test_join(); /* different kinds of join, BUG#2794 */
- test_selecttmp(); /* temporary table used in select execution */
- test_create_drop(); /* some table manipulation BUG#2811 */
- test_rename(); /* rename test */
- test_do_set(); /* DO & SET commands test BUG#3393 */
- test_multi(); /* test of multi delete & update */
- test_insert_select(); /* test INSERT ... SELECT */
- test_bind_nagative(); /* bind negative to unsigned BUG#3223 */
- test_derived(); /* derived table with parameter BUG#3020 */
- test_xjoin(); /* complex join test */
- test_bug3035(); /* inserts of INT32_MAX/UINT32_MAX */
- test_union2(); /* repeatable execution of union (Bug #3577) */
- test_bug1664(); /* test for bugs in mysql_stmt_send_long_data()
- call (Bug #1664) */
- test_union_param();
- test_order_param(); /* ORDER BY with parameters in select list
- (Bug #3686 */
- test_ps_i18n(); /* test for i18n support in binary protocol */
- test_bug3796(); /* test for select concat(?, <string>) */
- test_bug4026(); /* test microseconds precision of time types */
- test_bug4079(); /* erroneous subquery in prepared statement */
- test_bug4236(); /* init -> execute */
- test_bug4030(); /* test conversion string -> time types in
- libmysql */
- test_bug5126(); /* support for mediumint type in libmysql */
- test_bug4231(); /* proper handling of all-zero times and
- dates in the server */
- test_bug5399(); /* check that statement id uniquely identifies
- statement */
- test_bug5194(); /* bulk inserts in prepared mode */
- test_bug5315(); /* check that mysql_change_user closes all
- prepared statements */
- test_bug6049(); /* check support for negative TIME values */
- test_bug6058(); /* check support for 0000-00-00 dates */
- test_bug6059(); /* correct metadata for SELECT ... INTO OUTFILE */
- test_bug6046(); /* NATURAL JOIN transformation works in PS */
- test_bug6081(); /* test of mysql_create_db()/mysql_rm_db() */
- test_bug6096(); /* max_length for numeric columns */
+ if (!argc)
+ {
+ for (fptr= my_tests; fptr->name; fptr++)
+ (*fptr->function)();
+ }
+ else
+ {
+ for ( ; *argv ; argv++)
+ {
+ for (fptr= my_tests; fptr->name; fptr++)
+ {
+ if (!strcmp(fptr->name, *argv))
+ {
+ (*fptr->function)();
+ break;
+ }
+ }
+ if (!fptr->name)
+ {
+ fprintf(stderr, "\n\nGiven test not found: '%s'\n", *argv);
+ fprintf(stderr, "See legal test names with %s -T\n\nAborting!\n",
+ my_progname);
+ client_disconnect();
+ free_defaults(defaults_argv);
+ exit(1);
+ }
+ }
+ }
+
/*
XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST
DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH.