diff options
author | unknown <brian@zim.(none)> | 2005-04-26 18:19:54 -0700 |
---|---|---|
committer | unknown <brian@zim.(none)> | 2005-04-26 18:19:54 -0700 |
commit | b7e422be1b7a8ca3f4e761e67db5e8febc701dfd (patch) | |
tree | df9016f3d70b4657f89dcddca2ec4e188fc7fbdf /ndb/src/ndbapi | |
parent | c0333ecee42a4de499b3377cfa21d7b5af1ddd2b (diff) | |
download | mariadb-git-b7e422be1b7a8ca3f4e761e67db5e8febc701dfd.tar.gz |
Changes to create storage directory for storage engines.
storage/heap/.cvsignore:
mvdir
storage/heap/ChangeLog:
mvdir
storage/heap/Makefile.am:
mvdir
storage/heap/_check.c:
mvdir
storage/heap/_rectest.c:
mvdir
storage/heap/heapdef.h:
mvdir
storage/heap/hp_block.c:
mvdir
storage/heap/hp_clear.c:
mvdir
storage/heap/hp_close.c:
mvdir
storage/heap/hp_create.c:
mvdir
storage/heap/hp_delete.c:
mvdir
storage/heap/hp_extra.c:
mvdir
storage/heap/hp_hash.c:
mvdir
storage/heap/hp_info.c:
mvdir
storage/heap/hp_open.c:
mvdir
storage/heap/hp_panic.c:
mvdir
storage/heap/hp_rename.c:
mvdir
storage/heap/hp_rfirst.c:
mvdir
storage/heap/hp_rkey.c:
mvdir
storage/heap/hp_rlast.c:
mvdir
storage/heap/hp_rnext.c:
mvdir
storage/heap/hp_rprev.c:
mvdir
storage/heap/hp_rrnd.c:
mvdir
storage/heap/hp_rsame.c:
mvdir
storage/heap/hp_scan.c:
mvdir
storage/heap/hp_static.c:
mvdir
storage/heap/hp_test1.c:
mvdir
storage/heap/hp_test2.c:
mvdir
storage/heap/hp_update.c:
mvdir
storage/heap/hp_write.c:
mvdir
storage/heap/make-ccc:
mvdir
storage/myisam/.cvsignore:
mvdir
storage/myisam/ChangeLog:
mvdir
storage/myisam/Makefile.am:
mvdir
storage/myisam/NEWS:
mvdir
storage/myisam/TODO:
mvdir
storage/myisam/ft_boolean_search.c:
mvdir
storage/myisam/ft_eval.c:
mvdir
storage/myisam/ft_eval.h:
mvdir
storage/myisam/ft_nlq_search.c:
mvdir
storage/myisam/ft_parser.c:
mvdir
storage/myisam/ft_static.c:
mvdir
storage/myisam/ft_stem.c:
mvdir
storage/myisam/ft_stopwords.c:
mvdir
storage/myisam/ft_test1.c:
mvdir
storage/myisam/ft_test1.h:
mvdir
storage/myisam/ft_update.c:
mvdir
storage/myisam/ftdefs.h:
mvdir
storage/myisam/fulltext.h:
mvdir
storage/myisam/make-ccc:
mvdir
storage/myisam/mi_cache.c:
mvdir
storage/myisam/mi_changed.c:
mvdir
storage/myisam/mi_check.c:
mvdir
storage/myisam/mi_checksum.c:
mvdir
storage/myisam/mi_close.c:
mvdir
storage/myisam/mi_create.c:
mvdir
storage/myisam/mi_dbug.c:
mvdir
storage/myisam/mi_delete.c:
mvdir
storage/myisam/mi_delete_all.c:
mvdir
storage/myisam/mi_delete_table.c:
mvdir
storage/myisam/mi_dynrec.c:
mvdir
storage/myisam/mi_extra.c:
mvdir
storage/myisam/mi_info.c:
mvdir
storage/myisam/mi_key.c:
mvdir
storage/myisam/mi_keycache.c:
mvdir
storage/myisam/mi_locking.c:
mvdir
storage/myisam/mi_log.c:
mvdir
storage/myisam/mi_open.c:
mvdir
storage/myisam/mi_packrec.c:
mvdir
storage/myisam/mi_page.c:
mvdir
storage/myisam/mi_panic.c:
mvdir
storage/myisam/mi_preload.c:
mvdir
storage/myisam/mi_range.c:
mvdir
storage/myisam/mi_rename.c:
mvdir
storage/myisam/mi_rfirst.c:
mvdir
storage/myisam/mi_rkey.c:
mvdir
storage/myisam/mi_rlast.c:
mvdir
storage/myisam/mi_rnext.c:
mvdir
storage/myisam/mi_rnext_same.c:
mvdir
storage/myisam/mi_rprev.c:
mvdir
storage/myisam/mi_rrnd.c:
mvdir
storage/myisam/mi_rsame.c:
mvdir
storage/myisam/ftbench/Ecompare.pl:
mvdir
storage/myisam/ftbench/Ecreate.pl:
mvdir
storage/myisam/ftbench/Ereport.pl:
mvdir
storage/myisam/ftbench/README:
mvdir
storage/myisam/ftbench/ft-test-run.sh:
mvdir
storage/myisam/mi_rsamepos.c:
mvdir
storage/myisam/mi_scan.c:
mvdir
storage/myisam/mi_search.c:
mvdir
storage/myisam/mi_static.c:
mvdir
storage/myisam/mi_statrec.c:
mvdir
storage/myisam/mi_test1.c:
mvdir
storage/myisam/mi_test2.c:
mvdir
storage/myisam/mi_test3.c:
mvdir
storage/myisam/mi_test_all.res:
mvdir
storage/myisam/mi_test_all.sh:
mvdir
storage/myisam/mi_unique.c:
mvdir
storage/myisam/mi_update.c:
mvdir
storage/myisam/mi_write.c:
mvdir
storage/myisam/myisam_ftdump.c:
mvdir
storage/myisam/myisamchk.c:
mvdir
storage/myisam/myisamdef.h:
mvdir
storage/myisam/myisamlog.c:
mvdir
storage/myisam/myisampack.c:
mvdir
storage/myisam/rt_index.c:
mvdir
storage/myisam/rt_index.h:
mvdir
storage/myisam/rt_key.c:
mvdir
storage/myisam/rt_key.h:
mvdir
storage/myisam/rt_mbr.c:
mvdir
storage/myisam/rt_mbr.h:
mvdir
storage/myisam/rt_split.c:
mvdir
storage/myisam/rt_test.c:
mvdir
storage/myisam/sort.c:
mvdir
storage/myisam/sp_defs.h:
mvdir
storage/myisam/sp_key.c:
mvdir
storage/myisam/sp_test.c:
mvdir
storage/myisam/test_pack:
mvdir
storage/myisammrg/.cvsignore:
mvdir
storage/myisammrg/Makefile.am:
mvdir
storage/myisammrg/make-ccc:
mvdir
storage/myisammrg/myrg_close.c:
mvdir
storage/myisammrg/myrg_create.c:
mvdir
storage/myisammrg/myrg_def.h:
mvdir
storage/myisammrg/myrg_delete.c:
mvdir
storage/myisammrg/myrg_extra.c:
mvdir
storage/myisammrg/myrg_info.c:
mvdir
storage/myisammrg/myrg_locking.c:
mvdir
storage/myisammrg/myrg_open.c:
mvdir
storage/myisammrg/myrg_panic.c:
mvdir
storage/myisammrg/myrg_queue.c:
mvdir
storage/myisammrg/myrg_range.c:
mvdir
storage/myisammrg/myrg_rfirst.c:
mvdir
storage/myisammrg/myrg_rkey.c:
mvdir
storage/myisammrg/myrg_rlast.c:
mvdir
storage/myisammrg/myrg_rnext.c:
mvdir
storage/myisammrg/myrg_rnext_same.c:
mvdir
storage/myisammrg/myrg_rprev.c:
mvdir
storage/myisammrg/myrg_rrnd.c:
mvdir
storage/myisammrg/myrg_rsame.c:
mvdir
storage/myisammrg/myrg_static.c:
mvdir
storage/myisammrg/myrg_update.c:
mvdir
storage/myisammrg/myrg_write.c:
mvdir
storage/innobase/Makefile.am:
mvdir
storage/innobase/btr/Makefile.am:
mvdir
storage/innobase/btr/btr0btr.c:
mvdir
storage/innobase/btr/btr0cur.c:
mvdir
storage/innobase/btr/btr0pcur.c:
mvdir
storage/innobase/btr/btr0sea.c:
mvdir
storage/innobase/btr/makefilewin:
mvdir
storage/innobase/buf/Makefile.am:
mvdir
storage/innobase/buf/buf0buf.c:
mvdir
storage/innobase/buf/buf0flu.c:
mvdir
storage/innobase/buf/buf0lru.c:
mvdir
storage/innobase/buf/buf0rea.c:
mvdir
storage/innobase/buf/makefilewin:
mvdir
storage/innobase/configure.in:
mvdir
storage/innobase/data/Makefile.am:
mvdir
storage/innobase/data/data0data.c:
mvdir
storage/innobase/data/data0type.c:
mvdir
storage/innobase/data/makefilewin:
mvdir
storage/innobase/db/db0err.h:
mvdir
storage/innobase/dict/Makefile.am:
mvdir
storage/innobase/dict/dict0boot.c:
mvdir
storage/innobase/dict/dict0crea.c:
mvdir
storage/innobase/dict/dict0dict.c:
mvdir
storage/innobase/dict/dict0load.c:
mvdir
storage/innobase/makefilewin:
mvdir
storage/innobase/my_cnf:
mvdir
storage/innobase/dict/dict0mem.c:
mvdir
storage/innobase/dict/makefilewin:
mvdir
storage/innobase/dyn/Makefile.am:
mvdir
storage/innobase/dyn/dyn0dyn.c:
mvdir
storage/innobase/dyn/makefilewin:
mvdir
storage/innobase/eval/Makefile.am:
mvdir
storage/innobase/eval/eval0eval.c:
mvdir
storage/innobase/eval/eval0proc.c:
mvdir
storage/innobase/eval/makefilewin:
mvdir
storage/innobase/fil/Makefile.am:
mvdir
storage/innobase/fil/fil0fil.c:
mvdir
storage/innobase/fil/makefilewin:
mvdir
storage/innobase/fsp/Makefile.am:
mvdir
storage/innobase/fsp/fsp0fsp.c:
mvdir
storage/innobase/fsp/makefilewin:
mvdir
storage/innobase/fut/Makefile.am:
mvdir
storage/innobase/fut/fut0fut.c:
mvdir
storage/innobase/fut/fut0lst.c:
mvdir
storage/innobase/fut/makefilewin:
mvdir
storage/innobase/ha/Makefile.am:
mvdir
storage/innobase/ha/ha0ha.c:
mvdir
storage/innobase/ha/hash0hash.c:
mvdir
storage/innobase/ha/makefilewin:
mvdir
storage/innobase/ibuf/Makefile.am:
mvdir
storage/innobase/ibuf/ibuf0ibuf.c:
mvdir
storage/innobase/ibuf/makefilewin:
mvdir
storage/innobase/include/Makefile.am:
mvdir
storage/innobase/include/Makefile.i:
mvdir
storage/innobase/include/btr0btr.h:
mvdir
storage/innobase/include/btr0btr.ic:
mvdir
storage/innobase/include/btr0cur.h:
mvdir
storage/innobase/include/btr0cur.ic:
mvdir
storage/innobase/include/btr0pcur.h:
mvdir
storage/innobase/include/btr0pcur.ic:
mvdir
storage/innobase/include/btr0sea.h:
mvdir
storage/innobase/include/btr0sea.ic:
mvdir
storage/innobase/include/btr0types.h:
mvdir
storage/innobase/include/buf0buf.h:
mvdir
storage/innobase/include/buf0buf.ic:
mvdir
storage/innobase/include/buf0flu.h:
mvdir
storage/innobase/include/buf0flu.ic:
mvdir
storage/innobase/include/buf0lru.h:
mvdir
storage/innobase/include/buf0lru.ic:
mvdir
storage/innobase/include/buf0rea.h:
mvdir
storage/innobase/include/buf0types.h:
mvdir
storage/innobase/include/data0data.h:
mvdir
storage/innobase/include/data0data.ic:
mvdir
storage/innobase/include/data0type.h:
mvdir
storage/innobase/include/data0type.ic:
mvdir
storage/innobase/include/data0types.h:
mvdir
storage/innobase/include/db0err.h:
mvdir
storage/innobase/include/dict0boot.h:
mvdir
storage/innobase/include/dict0boot.ic:
mvdir
storage/innobase/include/dict0crea.h:
mvdir
storage/innobase/include/dict0crea.ic:
mvdir
storage/innobase/include/dict0dict.h:
mvdir
storage/innobase/include/dict0dict.ic:
mvdir
storage/innobase/include/dict0load.h:
mvdir
storage/innobase/include/dict0load.ic:
mvdir
storage/innobase/include/dict0mem.h:
mvdir
storage/innobase/include/dict0mem.ic:
mvdir
storage/innobase/include/dict0types.h:
mvdir
storage/innobase/include/dyn0dyn.h:
mvdir
storage/innobase/include/dyn0dyn.ic:
mvdir
storage/innobase/include/eval0eval.h:
mvdir
storage/innobase/include/eval0eval.ic:
mvdir
storage/innobase/include/eval0proc.h:
mvdir
storage/innobase/include/eval0proc.ic:
mvdir
storage/innobase/include/fil0fil.h:
mvdir
storage/innobase/include/fsp0fsp.h:
mvdir
storage/innobase/include/fsp0fsp.ic:
mvdir
storage/innobase/include/fut0fut.h:
mvdir
storage/innobase/include/fut0fut.ic:
mvdir
storage/innobase/include/fut0lst.h:
mvdir
storage/innobase/include/fut0lst.ic:
mvdir
storage/innobase/include/ha0ha.h:
mvdir
storage/innobase/include/ha0ha.ic:
mvdir
storage/innobase/include/hash0hash.h:
mvdir
storage/innobase/include/hash0hash.ic:
mvdir
storage/innobase/include/ibuf0ibuf.h:
mvdir
storage/innobase/include/ibuf0ibuf.ic:
mvdir
storage/innobase/include/ibuf0types.h:
mvdir
storage/innobase/include/lock0lock.h:
mvdir
storage/innobase/include/lock0lock.ic:
mvdir
storage/innobase/include/lock0types.h:
mvdir
storage/innobase/include/log0log.h:
mvdir
storage/innobase/include/log0log.ic:
mvdir
storage/innobase/include/log0recv.h:
mvdir
storage/innobase/include/log0recv.ic:
mvdir
storage/innobase/include/mach0data.h:
mvdir
storage/innobase/include/mach0data.ic:
mvdir
storage/innobase/include/makefilewin.i:
mvdir
storage/innobase/include/mem0dbg.h:
mvdir
storage/innobase/include/mem0dbg.ic:
mvdir
storage/innobase/include/mem0mem.h:
mvdir
storage/innobase/include/mem0mem.ic:
mvdir
storage/innobase/include/mem0pool.h:
mvdir
storage/innobase/include/mem0pool.ic:
mvdir
storage/innobase/include/mtr0log.h:
mvdir
storage/innobase/include/mtr0log.ic:
mvdir
storage/innobase/include/mtr0mtr.h:
mvdir
storage/innobase/include/mtr0mtr.ic:
mvdir
storage/innobase/include/mtr0types.h:
mvdir
storage/innobase/include/os0file.h:
mvdir
storage/innobase/include/os0proc.h:
mvdir
storage/innobase/include/os0proc.ic:
mvdir
storage/innobase/include/os0sync.h:
mvdir
storage/innobase/include/os0sync.ic:
mvdir
storage/innobase/include/os0thread.h:
mvdir
storage/innobase/include/os0thread.ic:
mvdir
storage/innobase/include/page0cur.h:
mvdir
storage/innobase/include/page0cur.ic:
mvdir
storage/innobase/include/page0page.h:
mvdir
storage/innobase/include/page0page.ic:
mvdir
storage/innobase/include/page0types.h:
mvdir
storage/innobase/include/pars0grm.h:
mvdir
storage/innobase/include/pars0opt.h:
mvdir
storage/innobase/include/pars0opt.ic:
mvdir
storage/innobase/include/pars0pars.h:
mvdir
storage/innobase/include/pars0pars.ic:
mvdir
storage/innobase/include/pars0sym.h:
mvdir
storage/innobase/include/pars0sym.ic:
mvdir
storage/innobase/include/pars0types.h:
mvdir
storage/innobase/include/que0que.h:
mvdir
storage/innobase/include/que0que.ic:
mvdir
storage/innobase/include/que0types.h:
mvdir
storage/innobase/include/read0read.h:
mvdir
storage/innobase/include/read0read.ic:
mvdir
storage/innobase/include/read0types.h:
mvdir
storage/innobase/include/rem0cmp.h:
mvdir
storage/innobase/include/rem0cmp.ic:
mvdir
storage/innobase/include/rem0rec.h:
mvdir
storage/innobase/include/rem0rec.ic:
mvdir
storage/innobase/include/rem0types.h:
mvdir
storage/innobase/include/row0ins.h:
mvdir
storage/innobase/include/row0ins.ic:
mvdir
storage/innobase/include/row0mysql.h:
mvdir
storage/innobase/include/row0mysql.ic:
mvdir
storage/innobase/include/row0purge.h:
mvdir
storage/innobase/include/row0purge.ic:
mvdir
storage/innobase/include/row0row.h:
mvdir
storage/innobase/include/row0row.ic:
mvdir
storage/innobase/include/row0sel.h:
mvdir
storage/innobase/include/row0sel.ic:
mvdir
storage/innobase/include/row0types.h:
mvdir
storage/innobase/include/row0uins.h:
mvdir
storage/innobase/include/row0uins.ic:
mvdir
storage/innobase/include/row0umod.h:
mvdir
storage/innobase/include/row0umod.ic:
mvdir
storage/innobase/include/row0undo.h:
mvdir
storage/innobase/include/row0undo.ic:
mvdir
storage/innobase/include/row0upd.h:
mvdir
storage/innobase/include/row0upd.ic:
mvdir
storage/innobase/include/row0vers.h:
mvdir
storage/innobase/include/row0vers.ic:
mvdir
storage/innobase/include/srv0que.h:
mvdir
storage/innobase/include/srv0srv.h:
mvdir
storage/innobase/include/srv0srv.ic:
mvdir
storage/innobase/include/srv0start.h:
mvdir
storage/innobase/include/sync0arr.h:
mvdir
storage/innobase/include/sync0arr.ic:
mvdir
storage/innobase/include/sync0rw.h:
mvdir
storage/innobase/include/sync0rw.ic:
mvdir
storage/innobase/include/sync0sync.h:
mvdir
storage/innobase/include/sync0sync.ic:
mvdir
storage/innobase/include/sync0types.h:
mvdir
storage/innobase/include/thr0loc.h:
mvdir
storage/innobase/include/thr0loc.ic:
mvdir
storage/innobase/include/trx0purge.h:
mvdir
storage/innobase/include/trx0purge.ic:
mvdir
storage/innobase/include/trx0rec.h:
mvdir
storage/innobase/include/trx0rec.ic:
mvdir
storage/innobase/include/trx0roll.h:
mvdir
storage/innobase/include/trx0roll.ic:
mvdir
storage/innobase/include/trx0rseg.h:
mvdir
storage/innobase/include/trx0rseg.ic:
mvdir
storage/innobase/include/trx0sys.h:
mvdir
storage/innobase/include/trx0sys.ic:
mvdir
storage/innobase/include/trx0trx.h:
mvdir
storage/innobase/include/trx0trx.ic:
mvdir
storage/innobase/include/trx0types.h:
mvdir
storage/innobase/include/trx0undo.h:
mvdir
storage/innobase/include/trx0undo.ic:
mvdir
storage/innobase/include/trx0xa.h:
mvdir
storage/innobase/include/univ.i:
mvdir
storage/innobase/include/usr0sess.h:
mvdir
storage/innobase/include/usr0sess.ic:
mvdir
storage/innobase/include/usr0types.h:
mvdir
storage/innobase/include/ut0byte.h:
mvdir
storage/innobase/include/ut0byte.ic:
mvdir
storage/innobase/include/ut0dbg.h:
mvdir
storage/innobase/include/ut0lst.h:
mvdir
storage/innobase/include/ut0mem.h:
mvdir
storage/innobase/include/ut0mem.ic:
mvdir
storage/innobase/include/ut0rnd.h:
mvdir
storage/innobase/include/ut0rnd.ic:
mvdir
storage/innobase/include/ut0sort.h:
mvdir
storage/innobase/include/ut0ut.h:
mvdir
storage/innobase/include/ut0ut.ic:
mvdir
storage/innobase/lock/Makefile.am:
mvdir
storage/innobase/lock/lock0lock.c:
mvdir
storage/innobase/lock/makefilewin:
mvdir
storage/innobase/log/Makefile.am:
mvdir
storage/innobase/log/log0log.c:
mvdir
storage/innobase/log/log0recv.c:
mvdir
storage/innobase/log/makefilewin:
mvdir
storage/innobase/mach/Makefile.am:
mvdir
storage/innobase/mach/mach0data.c:
mvdir
storage/innobase/mach/makefilewin:
mvdir
storage/innobase/mem/Makefile.am:
mvdir
storage/innobase/mem/makefilewin:
mvdir
storage/innobase/mem/mem0dbg.c:
mvdir
storage/innobase/mem/mem0mem.c:
mvdir
storage/innobase/mem/mem0pool.c:
mvdir
storage/innobase/mtr/Makefile.am:
mvdir
storage/innobase/mtr/makefilewin:
mvdir
storage/innobase/mtr/mtr0log.c:
mvdir
storage/innobase/mtr/mtr0mtr.c:
mvdir
storage/innobase/os/Makefile.am:
mvdir
storage/innobase/os/makefilewin:
mvdir
storage/innobase/os/os0file.c:
mvdir
storage/innobase/os/os0proc.c:
mvdir
storage/innobase/os/os0sync.c:
mvdir
storage/innobase/os/os0thread.c:
mvdir
storage/innobase/page/Makefile.am:
mvdir
storage/innobase/page/makefilewin:
mvdir
storage/innobase/page/page0cur.c:
mvdir
storage/innobase/page/page0page.c:
mvdir
storage/innobase/pars/Makefile.am:
mvdir
storage/innobase/pars/lexyy.c:
mvdir
storage/innobase/pars/makefilewin:
mvdir
storage/innobase/pars/pars0grm.c:
mvdir
storage/innobase/pars/pars0grm.h:
mvdir
storage/innobase/pars/pars0grm.y:
mvdir
storage/innobase/pars/pars0lex.l:
mvdir
storage/innobase/pars/pars0opt.c:
mvdir
storage/innobase/pars/pars0pars.c:
mvdir
storage/innobase/pars/pars0sym.c:
mvdir
storage/innobase/que/Makefile.am:
mvdir
storage/innobase/que/makefilewin:
mvdir
storage/innobase/que/que0que.c:
mvdir
storage/innobase/read/Makefile.am:
mvdir
storage/innobase/read/makefilewin:
mvdir
storage/innobase/read/read0read.c:
mvdir
storage/innobase/rem/Makefile.am:
mvdir
storage/innobase/rem/makefilewin:
mvdir
storage/innobase/rem/rem0cmp.c:
mvdir
storage/innobase/rem/rem0rec.c:
mvdir
storage/innobase/row/Makefile.am:
mvdir
storage/innobase/row/makefilewin:
mvdir
storage/innobase/row/row0ins.c:
mvdir
storage/innobase/row/row0mysql.c:
mvdir
storage/innobase/row/row0purge.c:
mvdir
storage/innobase/row/row0row.c:
mvdir
storage/innobase/row/row0sel.c:
mvdir
storage/innobase/row/row0uins.c:
mvdir
storage/innobase/row/row0umod.c:
mvdir
storage/innobase/row/row0undo.c:
mvdir
storage/innobase/row/row0upd.c:
mvdir
storage/innobase/row/row0vers.c:
mvdir
storage/innobase/srv/Makefile.am:
mvdir
storage/innobase/srv/makefilewin:
mvdir
storage/innobase/srv/srv0que.c:
mvdir
storage/innobase/srv/srv0srv.c:
mvdir
storage/innobase/srv/srv0start.c:
mvdir
storage/innobase/sync/Makefile.am:
mvdir
storage/innobase/sync/makefilewin:
mvdir
storage/innobase/sync/sync0arr.c:
mvdir
storage/innobase/sync/sync0rw.c:
mvdir
storage/innobase/sync/sync0sync.c:
mvdir
storage/innobase/thr/Makefile.am:
mvdir
storage/innobase/thr/makefilewin:
mvdir
storage/innobase/thr/thr0loc.c:
mvdir
storage/innobase/trx/Makefile.am:
mvdir
storage/innobase/trx/makefilewin:
mvdir
storage/innobase/trx/trx0purge.c:
mvdir
storage/innobase/trx/trx0rec.c:
mvdir
storage/innobase/trx/trx0roll.c:
mvdir
storage/innobase/trx/trx0rseg.c:
mvdir
storage/innobase/trx/trx0sys.c:
mvdir
storage/innobase/trx/trx0trx.c:
mvdir
storage/innobase/trx/trx0undo.c:
mvdir
storage/innobase/usr/Makefile.am:
mvdir
storage/innobase/usr/makefilewin:
mvdir
storage/innobase/usr/usr0sess.c:
mvdir
storage/innobase/ut/Makefile.am:
mvdir
storage/innobase/ut/makefilewin:
mvdir
storage/innobase/ut/ut0byte.c:
mvdir
storage/innobase/ut/ut0dbg.c:
mvdir
storage/innobase/ut/ut0mem.c:
mvdir
storage/innobase/ut/ut0rnd.c:
mvdir
storage/innobase/ut/ut0ut.c:
mvdir
storage/ndb/Makefile.am:
mvdir
storage/ndb/bin/.empty:
mvdir
storage/ndb/bin/check-regression.sh:
mvdir
storage/ndb/bin/makeTestPrograms_html.sh:
mvdir
storage/ndb/config/common.mk.am:
mvdir
storage/ndb/config/make-win-dsw.sh:
mvdir
storage/ndb/config/type_kernel.mk.am:
mvdir
storage/ndb/config/type_mgmapiclient.mk.am:
mvdir
storage/ndb/config/type_ndbapi.mk.am:
mvdir
storage/ndb/config/type_ndbapiclient.mk.am:
mvdir
storage/ndb/config/type_ndbapitest.mk.am:
mvdir
storage/ndb/config/type_ndbapitools.mk.am:
mvdir
storage/ndb/config/type_util.mk.am:
mvdir
storage/ndb/config/win-includes:
mvdir
storage/ndb/config/win-lib.am:
mvdir
storage/ndb/config/win-libraries:
mvdir
storage/ndb/config/win-name:
mvdir
storage/ndb/config/win-prg.am:
mvdir
storage/ndb/config/win-sources:
mvdir
storage/ndb/demos/1-node/1-api-3/Ndb.cfg:
mvdir
storage/ndb/demos/1-node/1-db-2/Ndb.cfg:
mvdir
storage/ndb/demos/1-node/1-mgm-1/Ndb.cfg:
mvdir
storage/ndb/demos/1-node/1-mgm-1/template_config.ini:
mvdir
storage/ndb/demos/2-node/2-api-4/Ndb.cfg:
mvdir
storage/ndb/demos/2-node/2-api-5/Ndb.cfg:
mvdir
storage/ndb/demos/2-node/2-api-6/Ndb.cfg:
mvdir
storage/ndb/demos/2-node/2-api-7/Ndb.cfg:
mvdir
storage/ndb/demos/2-node/2-db-2/Ndb.cfg:
mvdir
storage/ndb/demos/2-node/2-db-3/Ndb.cfg:
mvdir
storage/ndb/demos/2-node/2-mgm-1/Ndb.cfg:
mvdir
storage/ndb/demos/2-node/2-mgm-1/template_config.ini:
mvdir
storage/ndb/demos/config-templates/config_template-1-REP.ini:
mvdir
storage/ndb/demos/config-templates/config_template-4.ini:
mvdir
storage/ndb/demos/config-templates/config_template-install.ini:
mvdir
storage/ndb/demos/run_demo1-PS-SS_common.sh:
mvdir
storage/ndb/demos/run_demo1-PS.sh:
mvdir
storage/ndb/demos/run_demo1-SS.sh:
mvdir
storage/ndb/demos/run_demo1.sh:
mvdir
storage/ndb/demos/run_demo2.sh:
mvdir
storage/ndb/docs/Makefile.am:
mvdir
storage/ndb/docs/README:
mvdir
storage/ndb/docs/doxygen/Doxyfile.mgmapi:
mvdir
storage/ndb/docs/doxygen/Doxyfile.ndbapi:
mvdir
storage/ndb/docs/doxygen/Doxyfile.ndb:
mvdir
storage/ndb/docs/doxygen/Doxyfile.odbc:
mvdir
storage/ndb/docs/doxygen/Doxyfile.test:
mvdir
storage/ndb/docs/doxygen/header.mgmapi.tex:
mvdir
storage/ndb/docs/doxygen/header.ndbapi.tex:
mvdir
storage/ndb/docs/doxygen/postdoxy.pl:
mvdir
storage/ndb/docs/doxygen/predoxy.pl:
mvdir
storage/ndb/docs/wl2077.txt:
mvdir
storage/ndb/home/bin/Linuxmkisofs:
mvdir
storage/ndb/home/bin/Solarismkisofs:
mvdir
storage/ndb/home/bin/cvs2cl.pl:
mvdir
storage/ndb/home/bin/fix-cvs-root:
mvdir
storage/ndb/home/bin/import-from-bk.sh:
mvdir
storage/ndb/home/bin/ndb_deploy:
mvdir
storage/ndb/home/bin/ndbdoxy.pl:
mvdir
storage/ndb/home/bin/ngcalc:
mvdir
storage/ndb/home/bin/parseConfigFile.awk:
mvdir
storage/ndb/home/bin/setup-test.sh:
mvdir
storage/ndb/home/bin/signallog2html.lib/signallog2list.awk:
mvdir
storage/ndb/home/bin/signallog2html.lib/uniq_blocks.awk:
mvdir
storage/ndb/home/bin/signallog2html.sh:
mvdir
storage/ndb/home/bin/stripcr:
mvdir
storage/ndb/home/lib/funcs.sh:
mvdir
storage/ndb/include/Makefile.am:
mvdir
storage/ndb/include/debugger/DebuggerNames.hpp:
mvdir
storage/ndb/include/debugger/EventLogger.hpp:
mvdir
storage/ndb/include/debugger/GrepError.hpp:
mvdir
storage/ndb/include/debugger/SignalLoggerManager.hpp:
mvdir
storage/ndb/include/editline/editline.h:
mvdir
storage/ndb/include/kernel/AttributeDescriptor.hpp:
mvdir
storage/ndb/include/kernel/AttributeHeader.hpp:
mvdir
storage/ndb/include/kernel/AttributeList.hpp:
mvdir
storage/ndb/include/kernel/BlockNumbers.h:
mvdir
storage/ndb/include/kernel/GlobalSignalNumbers.h:
mvdir
storage/ndb/include/kernel/GrepEvent.hpp:
mvdir
storage/ndb/include/kernel/Interpreter.hpp:
mvdir
storage/ndb/include/kernel/LogLevel.hpp:
mvdir
storage/ndb/include/kernel/NodeBitmask.hpp:
mvdir
storage/ndb/include/kernel/NodeInfo.hpp:
mvdir
storage/ndb/include/kernel/NodeState.hpp:
mvdir
storage/ndb/include/kernel/RefConvert.hpp:
mvdir
storage/ndb/include/kernel/kernel_config_parameters.h:
mvdir
storage/ndb/include/kernel/kernel_types.h:
mvdir
storage/ndb/include/kernel/ndb_limits.h:
mvdir
storage/ndb/include/kernel/signaldata/AbortAll.hpp:
mvdir
storage/ndb/include/kernel/signaldata/AccFrag.hpp:
mvdir
storage/ndb/include/kernel/signaldata/AccLock.hpp:
mvdir
storage/ndb/include/kernel/signaldata/AccScan.hpp:
mvdir
storage/ndb/include/kernel/signaldata/AccSizeAltReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/AlterIndx.hpp:
mvdir
storage/ndb/include/kernel/signaldata/AlterTab.hpp:
mvdir
storage/ndb/include/kernel/signaldata/AlterTable.hpp:
mvdir
storage/ndb/include/kernel/signaldata/AlterTrig.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ApiRegSignalData.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ApiVersion.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ArbitSignalData.hpp:
mvdir
storage/ndb/include/kernel/signaldata/AttrInfo.hpp:
mvdir
storage/ndb/include/kernel/trigger_definitions.h:
mvdir
storage/ndb/include/ndb_constants.h:
mvdir
storage/ndb/include/ndb_global.h.in:
mvdir
storage/ndb/include/ndb_init.h:
mvdir
storage/ndb/include/ndb_net.h:
mvdir
storage/ndb/include/ndb_types.h.in:
mvdir
storage/ndb/include/ndb_version.h.in:
mvdir
storage/ndb/include/kernel/signaldata/BackupContinueB.hpp:
mvdir
storage/ndb/include/kernel/signaldata/BackupImpl.hpp:
mvdir
storage/ndb/include/kernel/signaldata/BackupSignalData.hpp:
mvdir
storage/ndb/include/kernel/signaldata/BlockCommitOrd.hpp:
mvdir
storage/ndb/include/kernel/signaldata/BuildIndx.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CheckNodeGroups.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CloseComReqConf.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CmInit.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CmRegSignalData.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CmvmiCfgConf.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CntrMasterConf.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CntrMasterReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CntrStart.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ConfigParamId.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ContinueFragmented.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CopyActive.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CopyFrag.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CopyGCIReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CreateEvnt.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CreateFrag.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CreateFragmentation.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CreateIndx.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CreateTab.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CreateTable.hpp:
mvdir
storage/ndb/include/kernel/signaldata/CreateTrig.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DiAddTab.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DiGetNodes.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DictSchemaInfo.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DictSizeAltReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DictStart.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DihAddFrag.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DihContinueB.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DihSizeAltReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DihStartTab.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DihSwitchReplica.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DisconnectRep.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DropIndx.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DropTab.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DropTabFile.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DropTable.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DropTrig.hpp:
mvdir
storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp:
mvdir
storage/ndb/include/kernel/signaldata/EmptyLcp.hpp:
mvdir
storage/ndb/include/kernel/signaldata/EndTo.hpp:
mvdir
storage/ndb/include/kernel/signaldata/EventReport.hpp:
mvdir
storage/ndb/include/kernel/signaldata/EventSubscribeReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ExecFragReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/FailRep.hpp:
mvdir
storage/ndb/include/kernel/signaldata/FireTrigOrd.hpp:
mvdir
storage/ndb/include/kernel/signaldata/FsAppendReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/FsCloseReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/FsConf.hpp:
mvdir
storage/ndb/include/kernel/signaldata/FsOpenReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/FsReadWriteReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/FsRef.hpp:
mvdir
storage/ndb/include/kernel/signaldata/FsRemoveReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/GCPSave.hpp:
mvdir
storage/ndb/include/kernel/signaldata/GetTabInfo.hpp:
mvdir
storage/ndb/include/kernel/signaldata/GetTableId.hpp:
mvdir
storage/ndb/include/kernel/signaldata/GrepImpl.hpp:
mvdir
storage/ndb/include/kernel/signaldata/HotSpareRep.hpp:
mvdir
storage/ndb/include/kernel/signaldata/IndxAttrInfo.hpp:
mvdir
storage/ndb/include/kernel/signaldata/IndxKeyInfo.hpp:
mvdir
storage/ndb/include/kernel/signaldata/InvalidateNodeLCPConf.hpp:
mvdir
storage/ndb/include/kernel/signaldata/InvalidateNodeLCPReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/KeyInfo.hpp:
mvdir
storage/ndb/include/kernel/signaldata/LCP.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ListTables.hpp:
mvdir
storage/ndb/include/kernel/signaldata/LqhFrag.hpp:
mvdir
storage/ndb/include/kernel/signaldata/LqhKey.hpp:
mvdir
storage/ndb/include/kernel/signaldata/LqhSizeAltReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/LqhTransConf.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ManagementServer.hpp:
mvdir
storage/ndb/include/kernel/signaldata/MasterGCP.hpp:
mvdir
storage/ndb/include/kernel/signaldata/MasterLCP.hpp:
mvdir
storage/ndb/include/kernel/signaldata/NFCompleteRep.hpp:
mvdir
storage/ndb/include/kernel/signaldata/NdbSttor.hpp:
mvdir
storage/ndb/include/kernel/signaldata/NdbfsContinueB.hpp:
mvdir
storage/ndb/include/kernel/signaldata/NextScan.hpp:
mvdir
storage/ndb/include/kernel/signaldata/NodeFailRep.hpp:
mvdir
storage/ndb/include/kernel/signaldata/NodeStateSignalData.hpp:
mvdir
storage/ndb/include/kernel/signaldata/PackedSignal.hpp:
mvdir
storage/ndb/include/kernel/signaldata/PrepDropTab.hpp:
mvdir
storage/ndb/include/kernel/signaldata/PrepFailReqRef.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ReadConfig.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ReadNodesConf.hpp:
mvdir
storage/ndb/include/kernel/signaldata/RelTabMem.hpp:
mvdir
storage/ndb/include/kernel/signaldata/RepImpl.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ResumeReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ScanFrag.hpp:
mvdir
storage/ndb/include/kernel/signaldata/ScanTab.hpp:
mvdir
storage/ndb/include/kernel/signaldata/SetLogLevelOrd.hpp:
mvdir
storage/ndb/include/kernel/signaldata/SetVarReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/SignalData.hpp:
mvdir
storage/ndb/include/kernel/signaldata/SignalDataPrint.hpp:
mvdir
storage/ndb/include/kernel/signaldata/SignalDroppedRep.hpp:
mvdir
storage/ndb/include/kernel/signaldata/SrFragidConf.hpp:
mvdir
storage/ndb/include/kernel/signaldata/StartFragReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/StartInfo.hpp:
mvdir
storage/ndb/include/kernel/signaldata/StartMe.hpp:
mvdir
storage/ndb/include/kernel/signaldata/StartOrd.hpp:
mvdir
storage/ndb/include/kernel/signaldata/StartPerm.hpp:
mvdir
storage/ndb/include/kernel/signaldata/StartRec.hpp:
mvdir
storage/ndb/include/kernel/signaldata/StartTo.hpp:
mvdir
storage/ndb/include/kernel/signaldata/StopMe.hpp:
mvdir
storage/ndb/include/kernel/signaldata/StopPerm.hpp:
mvdir
storage/ndb/include/kernel/signaldata/StopReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/SumaImpl.hpp:
mvdir
storage/ndb/include/kernel/signaldata/SystemError.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TamperOrd.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TcCommit.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TcContinueB.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TcHbRep.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TcIndx.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TcKeyConf.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TcKeyFailConf.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TcKeyRef.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TcKeyReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TcRollbackRep.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TcSizeAltReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TestOrd.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TransIdAI.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TrigAttrInfo.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TupCommit.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TupFrag.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TupKey.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TupSizeAltReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TuxBound.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TuxContinueB.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TuxMaint.hpp:
mvdir
storage/ndb/include/kernel/signaldata/TuxSizeAltReq.hpp:
mvdir
storage/ndb/include/kernel/signaldata/UpdateTo.hpp:
mvdir
storage/ndb/include/kernel/signaldata/UpgradeStartup.hpp:
mvdir
storage/ndb/include/kernel/signaldata/UtilDelete.hpp:
mvdir
storage/ndb/include/kernel/signaldata/UtilExecute.hpp:
mvdir
storage/ndb/include/kernel/signaldata/UtilLock.hpp:
mvdir
storage/ndb/include/kernel/signaldata/UtilPrepare.hpp:
mvdir
storage/ndb/include/kernel/signaldata/UtilRelease.hpp:
mvdir
storage/ndb/include/kernel/signaldata/UtilSequence.hpp:
mvdir
storage/ndb/include/kernel/signaldata/WaitGCP.hpp:
mvdir
storage/ndb/include/logger/ConsoleLogHandler.hpp:
mvdir
storage/ndb/include/logger/FileLogHandler.hpp:
mvdir
storage/ndb/include/logger/LogHandler.hpp:
mvdir
storage/ndb/include/logger/Logger.hpp:
mvdir
storage/ndb/include/logger/SysLogHandler.hpp:
mvdir
storage/ndb/include/mgmapi/mgmapi.h:
mvdir
storage/ndb/include/mgmapi/mgmapi_config_parameters.h:
mvdir
storage/ndb/include/mgmapi/mgmapi_config_parameters_debug.h:
mvdir
storage/ndb/include/mgmapi/mgmapi_debug.h:
mvdir
storage/ndb/include/mgmapi/ndb_logevent.h:
mvdir
storage/ndb/include/mgmcommon/ConfigRetriever.hpp:
mvdir
storage/ndb/include/mgmcommon/IPCConfig.hpp:
mvdir
storage/ndb/include/mgmcommon/MgmtErrorReporter.hpp:
mvdir
storage/ndb/include/ndbapi/Ndb.hpp:
mvdir
storage/ndb/include/ndbapi/NdbApi.hpp:
mvdir
storage/ndb/include/ndbapi/NdbBlob.hpp:
mvdir
storage/ndb/include/ndbapi/NdbDictionary.hpp:
mvdir
storage/ndb/include/ndbapi/NdbError.hpp:
mvdir
storage/ndb/include/ndbapi/NdbEventOperation.hpp:
mvdir
storage/ndb/include/ndbapi/NdbIndexOperation.hpp:
mvdir
storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp:
mvdir
storage/ndb/include/ndbapi/NdbOperation.hpp:
mvdir
storage/ndb/include/ndbapi/NdbPool.hpp:
mvdir
storage/ndb/include/ndbapi/NdbRecAttr.hpp:
mvdir
storage/ndb/include/ndbapi/NdbReceiver.hpp:
mvdir
storage/ndb/include/ndbapi/NdbScanFilter.hpp:
mvdir
storage/ndb/include/ndbapi/NdbScanOperation.hpp:
mvdir
storage/ndb/include/ndbapi/NdbTransaction.hpp:
mvdir
storage/ndb/include/ndbapi/ndb_cluster_connection.hpp:
mvdir
storage/ndb/include/ndbapi/ndb_opt_defaults.h:
mvdir
storage/ndb/include/ndbapi/ndbapi_limits.h:
mvdir
storage/ndb/include/ndbapi/ndberror.h:
mvdir
storage/ndb/include/newtonapi/dba.h:
mvdir
storage/ndb/include/newtonapi/defs/pcn_types.h:
mvdir
storage/ndb/include/portlib/NdbCondition.h:
mvdir
storage/ndb/include/portlib/NdbConfig.h:
mvdir
storage/ndb/include/portlib/NdbDaemon.h:
mvdir
storage/ndb/include/portlib/NdbEnv.h:
mvdir
storage/ndb/include/portlib/NdbHost.h:
mvdir
storage/ndb/include/portlib/NdbMain.h:
mvdir
storage/ndb/include/portlib/NdbMem.h:
mvdir
storage/ndb/include/portlib/NdbMutex.h:
mvdir
storage/ndb/include/portlib/NdbSleep.h:
mvdir
storage/ndb/include/portlib/NdbTCP.h:
mvdir
storage/ndb/include/portlib/NdbThread.h:
mvdir
storage/ndb/include/portlib/NdbTick.h:
mvdir
storage/ndb/include/portlib/PortDefs.h:
mvdir
storage/ndb/include/portlib/prefetch.h:
mvdir
storage/ndb/include/transporter/TransporterCallback.hpp:
mvdir
storage/ndb/include/transporter/TransporterDefinitions.hpp:
mvdir
storage/ndb/include/transporter/TransporterRegistry.hpp:
mvdir
storage/ndb/include/util/Base64.hpp:
mvdir
storage/ndb/include/util/BaseString.hpp:
mvdir
storage/ndb/include/util/Bitmask.hpp:
mvdir
storage/ndb/include/util/ConfigValues.hpp:
mvdir
storage/ndb/include/util/File.hpp:
mvdir
storage/ndb/include/util/InputStream.hpp:
mvdir
storage/ndb/include/util/NdbAutoPtr.hpp:
mvdir
storage/ndb/include/util/NdbOut.hpp:
mvdir
storage/ndb/include/util/NdbSqlUtil.hpp:
mvdir
storage/ndb/include/util/OutputStream.hpp:
mvdir
storage/ndb/include/util/Parser.hpp:
mvdir
storage/ndb/include/util/Properties.hpp:
mvdir
storage/ndb/include/util/SimpleProperties.hpp:
mvdir
storage/ndb/include/util/SocketAuthenticator.hpp:
mvdir
storage/ndb/include/util/SocketClient.hpp:
mvdir
storage/ndb/include/util/SocketServer.hpp:
mvdir
storage/ndb/include/util/UtilBuffer.hpp:
mvdir
storage/ndb/include/util/Vector.hpp:
mvdir
storage/ndb/include/util/basestring_vsnprintf.h:
mvdir
storage/ndb/include/util/md5_hash.hpp:
mvdir
storage/ndb/include/util/ndb_opts.h:
mvdir
storage/ndb/include/util/random.h:
mvdir
storage/ndb/include/util/socket_io.h:
mvdir
storage/ndb/include/util/uucode.h:
mvdir
storage/ndb/include/util/version.h:
mvdir
storage/ndb/lib/.empty:
mvdir
storage/ndb/ndbapi-examples/Makefile:
mvdir
storage/ndb/ndbapi-examples/mgmapi_logevent_example/Makefile:
mvdir
storage/ndb/ndbapi-examples/mgmapi_logevent_example/mgmapi_logevent.cpp:
mvdir
storage/ndb/ndbapi-examples/ndbapi_async_example/Makefile:
mvdir
storage/ndb/ndbapi-examples/ndbapi_async_example/ndbapi_async.cpp:
mvdir
storage/ndb/ndbapi-examples/ndbapi_async_example/readme.txt:
mvdir
storage/ndb/ndbapi-examples/ndbapi_async_example1/Makefile:
mvdir
storage/ndb/ndbapi-examples/ndbapi_async_example1/ndbapi_async1.cpp:
mvdir
storage/ndb/ndbapi-examples/ndbapi_event_example/Makefile:
mvdir
storage/ndb/ndbapi-examples/ndbapi_event_example/ndbapi_event.cpp:
mvdir
storage/ndb/ndbapi-examples/ndbapi_retries_example/Makefile:
mvdir
storage/ndb/ndbapi-examples/ndbapi_retries_example/ndbapi_retries.cpp:
mvdir
storage/ndb/ndbapi-examples/ndbapi_scan_example/Makefile:
mvdir
storage/ndb/ndbapi-examples/ndbapi_scan_example/ndbapi_scan.cpp:
mvdir
storage/ndb/ndbapi-examples/ndbapi_scan_example/readme.txt:
mvdir
storage/ndb/ndbapi-examples/ndbapi_simple_example/Makefile:
mvdir
storage/ndb/ndbapi-examples/ndbapi_simple_example/ndbapi_simple.cpp:
mvdir
storage/ndb/ndbapi-examples/ndbapi_simple_index_example/Makefile:
mvdir
storage/ndb/ndbapi-examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp:
mvdir
storage/ndb/src/Makefile.am:
mvdir
storage/ndb/src/common/Makefile.am:
mvdir
storage/ndb/src/common/debugger/BlockNames.cpp:
mvdir
storage/ndb/src/common/debugger/DebuggerNames.cpp:
mvdir
storage/ndb/src/common/debugger/EventLogger.cpp:
mvdir
storage/ndb/src/common/debugger/GrepError.cpp:
mvdir
storage/ndb/src/common/debugger/Makefile.am:
mvdir
storage/ndb/src/common/debugger/SignalLoggerManager.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/AccLock.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/AlterIndx.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/AlterTab.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/AlterTable.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/AlterTrig.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/BackupImpl.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/BackupSignalData.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/CntrStart.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/ContinueB.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/CopyGCI.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/CreateEvnt.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/CreateIndx.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/CreateTrig.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/DihContinueB.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/DihSwitchReplicaReq.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/DisconnectRep.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/DropIndx.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/DropTab.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/DropTrig.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/FailRep.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/FireTrigOrd.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/FsAppendReq.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/FsCloseReq.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/FsConf.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/FsOpenReq.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/FsRef.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/GCPSave.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/IndxAttrInfo.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/IndxKeyInfo.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/LCP.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/LqhFrag.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/LqhKey.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/LqhTrans.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/Makefile.am:
mvdir
storage/ndb/src/common/debugger/signaldata/MasterLCP.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/NFCompleteRep.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/NdbSttor.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/NdbfsContinueB.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/PackedSignal.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/PrepDropTab.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/ReadNodesConf.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/ScanFrag.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/ScanTab.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/SignalDroppedRep.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/SignalNames.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/StartRec.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/SumaImpl.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/SystemError.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/TcIndx.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/TcKeyConf.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/TcKeyRef.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/TcKeyReq.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/TcRollbackRep.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/TrigAttrInfo.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/TupCommit.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/TupKey.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/TuxMaint.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/UtilDelete.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/UtilExecute.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/UtilLock.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/UtilPrepare.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/UtilSequence.cpp:
mvdir
storage/ndb/src/common/debugger/signaldata/print.awk:
mvdir
storage/ndb/src/common/logger/ConsoleLogHandler.cpp:
mvdir
storage/ndb/src/common/logger/FileLogHandler.cpp:
mvdir
storage/ndb/src/common/logger/LogHandler.cpp:
mvdir
storage/ndb/src/common/logger/LogHandlerList.cpp:
mvdir
storage/ndb/src/common/logger/LogHandlerList.hpp:
mvdir
storage/ndb/src/common/logger/Logger.cpp:
mvdir
storage/ndb/src/common/logger/Makefile.am:
mvdir
storage/ndb/src/common/logger/SysLogHandler.cpp:
mvdir
storage/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp:
mvdir
storage/ndb/src/common/logger/listtest/LogHandlerListUnitTest.hpp:
mvdir
storage/ndb/src/common/logger/listtest/Makefile:
mvdir
storage/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp:
mvdir
storage/ndb/src/common/logger/loggertest/LoggerUnitTest.hpp:
mvdir
storage/ndb/src/common/logger/loggertest/Makefile:
mvdir
storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp:
mvdir
storage/ndb/src/common/mgmcommon/IPCConfig.cpp:
mvdir
storage/ndb/src/common/mgmcommon/Makefile.am:
mvdir
storage/ndb/src/common/mgmcommon/printConfig/Makefile:
mvdir
storage/ndb/src/common/mgmcommon/printConfig/printConfig.cpp:
mvdir
storage/ndb/src/common/portlib/Makefile.am:
mvdir
storage/ndb/src/common/portlib/NdbCondition.c:
mvdir
storage/ndb/src/common/portlib/NdbConfig.c:
mvdir
storage/ndb/src/common/portlib/NdbDaemon.c:
mvdir
storage/ndb/src/common/portlib/NdbEnv.c:
mvdir
storage/ndb/src/common/portlib/NdbHost.c:
mvdir
storage/ndb/src/common/portlib/NdbMem.c:
mvdir
storage/ndb/src/common/portlib/NdbMutex.c:
mvdir
storage/ndb/src/common/portlib/NdbPortLibTest.cpp:
mvdir
storage/ndb/src/common/portlib/NdbSleep.c:
mvdir
storage/ndb/src/common/portlib/NdbTCP.cpp:
mvdir
storage/ndb/src/common/portlib/NdbThread.c:
mvdir
storage/ndb/src/common/portlib/NdbTick.c:
mvdir
storage/ndb/src/common/portlib/gcc.cpp:
mvdir
storage/ndb/src/common/portlib/memtest.c:
mvdir
storage/ndb/src/common/portlib/mmslist.cpp:
mvdir
storage/ndb/src/common/portlib/mmstest.cpp:
mvdir
storage/ndb/src/common/portlib/munmaptest.cpp:
mvdir
storage/ndb/src/common/portlib/old_dirs/memtest/Makefile:
mvdir
storage/ndb/src/common/portlib/old_dirs/memtest/munmaptest/Makefile:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/Makefile:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbCondition.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbConditionOSE.h:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbEnv.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbHost.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbMem.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbMem_SoftOse.cpp:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbMutex.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbOut.cpp:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbSleep.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbTCP.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbThread.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/ose/NdbTick.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/test/Makefile:
mvdir
storage/ndb/src/common/portlib/old_dirs/win32/Makefile:
mvdir
storage/ndb/src/common/portlib/old_dirs/win32/NdbCondition.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/win32/NdbDaemon.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/win32/NdbEnv.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/win32/NdbHost.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/win32/NdbMem.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/win32/NdbMutex.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/win32/NdbSleep.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/win32/NdbTCP.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/win32/NdbThread.c:
mvdir
storage/ndb/src/common/portlib/old_dirs/win32/NdbTick.c:
mvdir
storage/ndb/src/common/portlib/win32/NdbCondition.c:
mvdir
storage/ndb/src/common/portlib/win32/NdbDaemon.c:
mvdir
storage/ndb/src/common/portlib/win32/NdbEnv.c:
mvdir
storage/ndb/src/common/portlib/win32/NdbHost.c:
mvdir
storage/ndb/src/common/portlib/win32/NdbMem.c:
mvdir
storage/ndb/src/common/portlib/win32/NdbMutex.c:
mvdir
storage/ndb/src/common/portlib/win32/NdbSleep.c:
mvdir
storage/ndb/src/common/portlib/win32/NdbTCP.c:
mvdir
storage/ndb/src/common/portlib/win32/NdbThread.c:
mvdir
storage/ndb/src/common/portlib/win32/NdbTick.c:
mvdir
storage/ndb/src/common/transporter/Makefile.am:
mvdir
storage/ndb/src/common/transporter/OSE_Receiver.cpp:
mvdir
storage/ndb/src/common/transporter/OSE_Receiver.hpp:
mvdir
storage/ndb/src/common/transporter/OSE_Signals.hpp:
mvdir
storage/ndb/src/common/transporter/OSE_Transporter.cpp:
mvdir
storage/ndb/src/common/transporter/OSE_Transporter.hpp:
mvdir
storage/ndb/src/common/transporter/Packer.cpp:
mvdir
storage/ndb/src/common/transporter/Packer.hpp:
mvdir
storage/ndb/src/common/transporter/SCI_Transporter.cpp:
mvdir
storage/ndb/src/common/transporter/SCI_Transporter.hpp:
mvdir
storage/ndb/src/common/transporter/SHM_Buffer.hpp:
mvdir
storage/ndb/src/common/transporter/SHM_Transporter.cpp:
mvdir
storage/ndb/src/common/transporter/SHM_Transporter.hpp:
mvdir
storage/ndb/src/common/transporter/SHM_Transporter.unix.cpp:
mvdir
storage/ndb/src/common/transporter/SHM_Transporter.win32.cpp:
mvdir
storage/ndb/src/common/transporter/SendBuffer.cpp:
mvdir
storage/ndb/src/common/transporter/SendBuffer.hpp:
mvdir
storage/ndb/src/common/transporter/TCP_Transporter.cpp:
mvdir
storage/ndb/src/common/transporter/TCP_Transporter.hpp:
mvdir
storage/ndb/src/common/transporter/Transporter.cpp:
mvdir
storage/ndb/src/common/transporter/Transporter.hpp:
mvdir
storage/ndb/src/common/transporter/TransporterInternalDefinitions.hpp:
mvdir
storage/ndb/src/common/transporter/TransporterRegistry.cpp:
mvdir
storage/ndb/src/common/transporter/basictest/Makefile:
mvdir
storage/ndb/src/common/transporter/basictest/basicTransporterTest.cpp:
mvdir
storage/ndb/src/common/transporter/buddy.cpp:
mvdir
storage/ndb/src/common/transporter/buddy.hpp:
mvdir
storage/ndb/src/common/transporter/failoverSCI/Makefile:
mvdir
storage/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp:
mvdir
storage/ndb/src/common/transporter/perftest/Makefile:
mvdir
storage/ndb/src/common/transporter/perftest/perfTransporterTest.cpp:
mvdir
storage/ndb/src/common/transporter/priotest/Makefile:
mvdir
storage/ndb/src/common/transporter/priotest/prioOSE/Makefile:
mvdir
storage/ndb/src/common/transporter/priotest/prioSCI/Makefile:
mvdir
storage/ndb/src/common/transporter/priotest/prioSCI/prioSCI.cpp:
mvdir
storage/ndb/src/common/transporter/priotest/prioSHM/Makefile:
mvdir
storage/ndb/src/common/transporter/priotest/prioSHM/prioSHM.cpp:
mvdir
storage/ndb/src/common/transporter/priotest/prioTCP/Makefile:
mvdir
storage/ndb/src/common/transporter/priotest/prioTCP/prioTCP.cpp:
mvdir
storage/ndb/src/common/transporter/priotest/prioTransporterTest.cpp:
mvdir
storage/ndb/src/common/transporter/priotest/prioTransporterTest.hpp:
mvdir
storage/ndb/src/common/util/Base64.cpp:
mvdir
storage/ndb/src/common/util/BaseString.cpp:
mvdir
storage/ndb/src/common/util/Bitmask.cpp:
mvdir
storage/ndb/src/common/util/ConfigValues.cpp:
mvdir
storage/ndb/src/common/util/File.cpp:
mvdir
storage/ndb/src/common/util/InputStream.cpp:
mvdir
storage/ndb/src/common/util/Makefile.am:
mvdir
storage/ndb/src/common/util/NdbErrHnd.cpp:
mvdir
storage/ndb/src/common/util/NdbOut.cpp:
mvdir
storage/ndb/src/common/util/NdbSqlUtil.cpp:
mvdir
storage/ndb/src/common/util/OutputStream.cpp:
mvdir
storage/ndb/src/common/util/Parser.cpp:
mvdir
storage/ndb/src/common/util/Properties.cpp:
mvdir
storage/ndb/src/common/util/SimpleProperties.cpp:
mvdir
storage/ndb/src/common/util/SocketAuthenticator.cpp:
mvdir
storage/ndb/src/common/util/SocketClient.cpp:
mvdir
storage/ndb/src/common/util/SocketServer.cpp:
mvdir
storage/ndb/src/common/util/basestring_vsnprintf.c:
mvdir
storage/ndb/src/common/util/filetest/FileUnitTest.cpp:
mvdir
storage/ndb/src/common/util/filetest/FileUnitTest.hpp:
mvdir
storage/ndb/src/common/util/filetest/Makefile:
mvdir
storage/ndb/src/common/util/getarg.cat3:
mvdir
storage/ndb/src/common/util/md5_hash.cpp:
mvdir
storage/ndb/src/common/util/ndb_init.c:
mvdir
storage/ndb/src/common/util/new.cpp:
mvdir
storage/ndb/src/common/util/random.c:
mvdir
storage/ndb/src/common/util/socket_io.cpp:
mvdir
storage/ndb/src/common/util/strdup.c:
mvdir
storage/ndb/src/common/util/testConfigValues/Makefile:
mvdir
storage/ndb/src/common/util/testConfigValues/testConfigValues.cpp:
mvdir
storage/ndb/src/common/util/uucode.c:
mvdir
storage/ndb/src/common/util/version.c:
mvdir
storage/ndb/src/common/util/testProperties/Makefile:
mvdir
storage/ndb/src/common/util/testProperties/testProperties.cpp:
mvdir
storage/ndb/src/common/util/testSimpleProperties/Makefile:
mvdir
storage/ndb/src/common/util/testSimpleProperties/sp_test.cpp:
mvdir
storage/ndb/src/cw/Makefile.am:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.cpp:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.dsp:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.dsw:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.h:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.rc:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.sln:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.suo:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.vcproj:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/Closed.ICO:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/NdbControls.cpp:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/Open.ICO:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/StdAfx.cpp:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/StdAfx.h:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/TreeView.cpp:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/TreeView.h:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/bmp00001.bmp:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/resource.h:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/small.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/C++/toolbar.bmp:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/App.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/CPC_Form.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/Computer.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/ComputerAddDialog.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/ComputerRemoveDialog.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/DATABASE.ICO:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/Database.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.csproj.user:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.csproj:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.ncb:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.sln:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/PanelWizard.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/Process.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/ProcessDefineDialog.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/fileaccess/FileMgmt.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/simpleparser/SimpleCPCParser.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/socketcomm/SocketComm.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/socketcomm/myTcpClient.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/startDatabaseDlg.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/csharp/telnetclient/telnetClient.cs:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Computer.cls:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Database.cls:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 110.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 231.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 237.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 241.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 242.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 270.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 271.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 273.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 31.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 337.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 338.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Icon 339.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/MSSCCPRJ.SCC:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Module1.bas:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbp:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/NdbCPC.vbw:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/Process.cls:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/closed folder.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/computer.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmAbout.frm:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmLogin.frm:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmMain.frm:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frm:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmNewComputer.frx:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase.frx:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase1.frm:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.frm:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase2.log:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmNewDatabase3.frm:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmOptions.frm:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/frmSplash.frx:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/networking.ico:
mvdir
storage/ndb/src/cw/cpcc-win32/vb6/open folder.ico:
mvdir
storage/ndb/src/cw/cpcd/APIService.cpp:
mvdir
storage/ndb/src/cw/cpcd/APIService.hpp:
mvdir
storage/ndb/src/cw/cpcd/CPCD.cpp:
mvdir
storage/ndb/src/cw/cpcd/CPCD.hpp:
mvdir
storage/ndb/src/cw/cpcd/Makefile.am:
mvdir
storage/ndb/src/cw/cpcd/Monitor.cpp:
mvdir
storage/ndb/src/cw/cpcd/Process.cpp:
mvdir
storage/ndb/src/cw/cpcd/common.cpp:
mvdir
storage/ndb/src/cw/cpcd/common.hpp:
mvdir
storage/ndb/src/cw/cpcd/main.cpp:
mvdir
storage/ndb/src/cw/test/socketclient/Makefile:
mvdir
storage/ndb/src/cw/test/socketclient/socketClientTest.cpp:
mvdir
storage/ndb/src/cw/util/ClientInterface.cpp:
mvdir
storage/ndb/src/cw/util/ClientInterface.hpp:
mvdir
storage/ndb/src/cw/util/Makefile:
mvdir
storage/ndb/src/cw/util/SocketRegistry.cpp:
mvdir
storage/ndb/src/cw/util/SocketRegistry.hpp:
mvdir
storage/ndb/src/cw/util/SocketService.cpp:
mvdir
storage/ndb/src/cw/util/SocketService.hpp:
mvdir
storage/ndb/src/external/WIN32.x86/sci/lib/SISCI_LIBRARY_WIN32.TXT:
mvdir
storage/ndb/src/external/WIN32.x86/sci/lib/scilib.lib:
mvdir
storage/ndb/src/external/WIN32.x86/sci/lib/scilib_md.lib:
mvdir
storage/ndb/src/external/WIN32.x86/sci/lib/scilib_mt.lib:
mvdir
storage/ndb/src/external/WIN32.x86/sci/lib/sisci_api.lib:
mvdir
storage/ndb/src/external/WIN32.x86/sci/lib/sisci_api_md.lib:
mvdir
storage/ndb/src/external/WIN32.x86/sci/lib/sisci_api_mt.lib:
mvdir
storage/ndb/src/kernel/Makefile.am:
mvdir
storage/ndb/src/kernel/SimBlockList.cpp:
mvdir
storage/ndb/src/kernel/blocks/ERROR_codes.txt:
mvdir
storage/ndb/src/kernel/blocks/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/NodeRestart.new.txt:
mvdir
storage/ndb/src/kernel/blocks/NodeRestart.txt:
mvdir
storage/ndb/src/kernel/blocks/Start.txt:
mvdir
storage/ndb/src/kernel/blocks/SystemRestart.new.txt:
mvdir
storage/ndb/src/kernel/blocks/SystemRestart.txt:
mvdir
storage/ndb/src/kernel/blocks/backup/Backup.cpp:
mvdir
storage/ndb/src/kernel/blocks/backup/Backup.hpp:
mvdir
storage/ndb/src/kernel/blocks/backup/Backup.txt:
mvdir
storage/ndb/src/kernel/blocks/backup/BackupFormat.hpp:
mvdir
storage/ndb/src/kernel/blocks/backup/BackupInit.cpp:
mvdir
storage/ndb/src/kernel/blocks/backup/FsBuffer.hpp:
mvdir
storage/ndb/src/kernel/blocks/backup/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/backup/read.cpp:
mvdir
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp:
mvdir
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.hpp:
mvdir
storage/ndb/src/kernel/blocks/cmvmi/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp:
mvdir
storage/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbacc/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/mutexes.hpp:
mvdir
storage/ndb/src/kernel/blocks/new-block.tar.gz:
mvdir
storage/ndb/src/kernel/main.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbdict/CreateIndex.txt:
mvdir
storage/ndb/src/kernel/blocks/dbdict/CreateTable.new.txt:
mvdir
storage/ndb/src/kernel/blocks/dbdict/CreateTable.txt:
mvdir
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
mvdir
storage/ndb/src/kernel/blocks/dbdict/Dbdict.txt:
mvdir
storage/ndb/src/kernel/blocks/dbdict/DropTable.txt:
mvdir
storage/ndb/src/kernel/blocks/dbdict/Event.txt:
mvdir
storage/ndb/src/kernel/blocks/dbdict/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/dbdict/Master_AddTable.sfl:
mvdir
storage/ndb/src/kernel/blocks/dbdict/SchemaFile.hpp:
mvdir
storage/ndb/src/kernel/blocks/dbdict/Slave_AddTable.sfl:
mvdir
storage/ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp:
mvdir
storage/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbdih/LCP.txt:
mvdir
storage/ndb/src/kernel/blocks/dbdih/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/dbdih/Sysfile.hpp:
mvdir
storage/ndb/src/kernel/blocks/dbdih/printSysfile/Makefile:
mvdir
storage/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp:
mvdir
storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp:
mvdir
storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp:
mvdir
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
mvdir
storage/ndb/src/kernel/blocks/dblqh/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/dblqh/redoLogReader/Makefile:
mvdir
storage/ndb/src/kernel/blocks/dblqh/redoLogReader/records.cpp:
mvdir
storage/ndb/src/kernel/blocks/dblqh/redoLogReader/records.hpp:
mvdir
storage/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp:
mvdir
storage/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtc/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/dbtup/AttributeOffset.hpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupBuffer.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupFixAlloc.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupStoredProcDef.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtup/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/dbtup/Notes.txt:
mvdir
storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp:
mvdir
storage/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbtux/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/dbtux/Times.txt:
mvdir
storage/ndb/src/kernel/blocks/dbtux/tuxstatus.html:
mvdir
storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp:
mvdir
storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp:
mvdir
storage/ndb/src/kernel/blocks/dbutil/DbUtil.txt:
mvdir
storage/ndb/src/kernel/blocks/dbutil/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/grep/Grep.cpp:
mvdir
storage/ndb/src/kernel/blocks/grep/Grep.hpp:
mvdir
storage/ndb/src/kernel/blocks/grep/GrepInit.cpp:
mvdir
storage/ndb/src/kernel/blocks/grep/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/grep/systab_test/Makefile:
mvdir
storage/ndb/src/kernel/blocks/grep/systab_test/grep_systab_test.cpp:
mvdir
storage/ndb/src/kernel/blocks/ndbcntr/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp:
mvdir
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp:
mvdir
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp:
mvdir
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrSysTable.cpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/CircularIndex.cpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/CircularIndex.hpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/Filename.hpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/MemoryChannel.cpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/Makefile:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/MemoryChannelTest/Makefile:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/MemoryChannelTest/MemoryChannelTest.cpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/OpenFiles.hpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/Pool.hpp:
mvdir
storage/ndb/src/kernel/blocks/ndbfs/VoidFs.cpp:
mvdir
storage/ndb/src/kernel/blocks/qmgr/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp:
mvdir
storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp:
mvdir
storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp:
mvdir
storage/ndb/src/kernel/blocks/qmgr/timer.hpp:
mvdir
storage/ndb/src/kernel/blocks/suma/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/suma/Suma.cpp:
mvdir
storage/ndb/src/kernel/blocks/suma/Suma.hpp:
mvdir
storage/ndb/src/kernel/blocks/suma/Suma.txt:
mvdir
storage/ndb/src/kernel/blocks/suma/SumaInit.cpp:
mvdir
storage/ndb/src/kernel/blocks/trix/Makefile.am:
mvdir
storage/ndb/src/kernel/blocks/trix/Trix.cpp:
mvdir
storage/ndb/src/kernel/blocks/trix/Trix.hpp:
mvdir
storage/ndb/src/kernel/error/Error.hpp:
mvdir
storage/ndb/src/kernel/error/ErrorHandlingMacros.hpp:
mvdir
storage/ndb/src/kernel/error/ErrorMessages.cpp:
mvdir
storage/ndb/src/kernel/error/ErrorMessages.hpp:
mvdir
storage/ndb/src/kernel/error/ErrorReporter.cpp:
mvdir
storage/ndb/src/kernel/error/ErrorReporter.hpp:
mvdir
storage/ndb/src/kernel/error/Makefile.am:
mvdir
storage/ndb/src/kernel/error/TimeModule.cpp:
mvdir
storage/ndb/src/kernel/error/TimeModule.hpp:
mvdir
storage/ndb/src/kernel/vm/Array.hpp:
mvdir
storage/ndb/src/kernel/vm/ArrayFifoList.hpp:
mvdir
storage/ndb/src/kernel/vm/ArrayList.hpp:
mvdir
storage/ndb/src/kernel/vm/ArrayPool.hpp:
mvdir
storage/ndb/src/kernel/vm/CArray.hpp:
mvdir
storage/ndb/src/kernel/vm/Callback.hpp:
mvdir
storage/ndb/src/kernel/vm/ClusterConfiguration.cpp:
mvdir
storage/ndb/src/kernel/vm/ClusterConfiguration.hpp:
mvdir
storage/ndb/src/kernel/vm/Configuration.cpp:
mvdir
storage/ndb/src/kernel/vm/Configuration.hpp:
mvdir
storage/ndb/src/kernel/vm/DLFifoList.hpp:
mvdir
storage/ndb/src/kernel/vm/DLHashTable.hpp:
mvdir
storage/ndb/src/kernel/vm/DLHashTable2.hpp:
mvdir
storage/ndb/src/kernel/vm/DLList.hpp:
mvdir
storage/ndb/src/kernel/vm/DataBuffer.hpp:
mvdir
storage/ndb/src/kernel/vm/Emulator.cpp:
mvdir
storage/ndb/src/kernel/vm/Emulator.hpp:
mvdir
storage/ndb/src/kernel/vm/FastScheduler.cpp:
mvdir
storage/ndb/src/kernel/vm/FastScheduler.hpp:
mvdir
storage/ndb/src/kernel/vm/GlobalData.hpp:
mvdir
storage/ndb/src/kernel/vm/KeyTable.hpp:
mvdir
storage/ndb/src/kernel/vm/KeyTable2.hpp:
mvdir
storage/ndb/src/kernel/vm/LongSignal.hpp:
mvdir
storage/ndb/src/kernel/vm/Makefile.am:
mvdir
storage/ndb/src/kernel/vm/MetaData.cpp:
mvdir
storage/ndb/src/kernel/vm/MetaData.hpp:
mvdir
storage/ndb/src/kernel/vm/Mutex.cpp:
mvdir
storage/ndb/src/kernel/vm/Mutex.hpp:
mvdir
storage/ndb/src/kernel/vm/Prio.hpp:
mvdir
storage/ndb/src/kernel/vm/RequestTracker.hpp:
mvdir
storage/ndb/src/kernel/vm/SLList.hpp:
mvdir
storage/ndb/src/kernel/vm/SafeCounter.cpp:
mvdir
storage/ndb/src/kernel/vm/SafeCounter.hpp:
mvdir
storage/ndb/src/kernel/vm/SectionReader.cpp:
mvdir
storage/ndb/src/kernel/vm/SectionReader.hpp:
mvdir
storage/ndb/src/kernel/vm/SignalCounter.hpp:
mvdir
storage/ndb/src/kernel/vm/SimBlockList.hpp:
mvdir
storage/ndb/src/kernel/vm/SimplePropertiesSection.cpp:
mvdir
storage/ndb/src/kernel/vm/SimulatedBlock.cpp:
mvdir
storage/ndb/src/kernel/vm/SimulatedBlock.hpp:
mvdir
storage/ndb/src/kernel/vm/ThreadConfig.cpp:
mvdir
storage/ndb/src/kernel/vm/ThreadConfig.hpp:
mvdir
storage/ndb/src/kernel/vm/TimeQueue.cpp:
mvdir
storage/ndb/src/kernel/vm/TimeQueue.hpp:
mvdir
storage/ndb/src/kernel/vm/TransporterCallback.cpp:
mvdir
storage/ndb/src/kernel/vm/VMSignal.cpp:
mvdir
storage/ndb/src/kernel/vm/VMSignal.hpp:
mvdir
storage/ndb/src/kernel/vm/WaitQueue.hpp:
mvdir
storage/ndb/src/kernel/vm/WatchDog.cpp:
mvdir
storage/ndb/src/kernel/vm/WatchDog.hpp:
mvdir
storage/ndb/src/kernel/vm/al_test/Makefile:
mvdir
storage/ndb/src/kernel/vm/al_test/arrayListTest.cpp:
mvdir
storage/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp:
mvdir
storage/ndb/src/kernel/vm/al_test/main.cpp:
mvdir
storage/ndb/src/kernel/vm/pc.hpp:
mvdir
storage/ndb/src/kernel/vm/testCopy/Makefile:
mvdir
storage/ndb/src/kernel/vm/testCopy/rr.cpp:
mvdir
storage/ndb/src/kernel/vm/testCopy/testCopy.cpp:
mvdir
storage/ndb/src/kernel/vm/testDataBuffer/Makefile:
mvdir
storage/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp:
mvdir
storage/ndb/src/kernel/vm/testLongSig/Makefile:
mvdir
storage/ndb/src/kernel/vm/testLongSig/testLongSig.cpp:
mvdir
storage/ndb/src/kernel/vm/testSimplePropertiesSection/Makefile:
mvdir
storage/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp:
mvdir
storage/ndb/src/mgmapi/LocalConfig.cpp:
mvdir
storage/ndb/src/mgmapi/LocalConfig.hpp:
mvdir
storage/ndb/src/mgmapi/Makefile.am:
mvdir
storage/ndb/src/mgmapi/mgmapi.cpp:
mvdir
storage/ndb/src/mgmapi/mgmapi_configuration.cpp:
mvdir
storage/ndb/src/mgmapi/mgmapi_configuration.hpp:
mvdir
storage/ndb/src/mgmapi/mgmapi_internal.h:
mvdir
storage/ndb/src/mgmapi/ndb_logevent.cpp:
mvdir
storage/ndb/src/mgmapi/ndb_logevent.hpp:
mvdir
storage/ndb/src/mgmapi/test/Makefile:
mvdir
storage/ndb/src/mgmapi/test/keso.c:
mvdir
storage/ndb/src/mgmapi/test/mgmSrvApi.cpp:
mvdir
storage/ndb/src/mgmclient/CommandInterpreter.cpp:
mvdir
storage/ndb/src/mgmclient/Makefile.am:
mvdir
storage/ndb/src/mgmclient/main.cpp:
mvdir
storage/ndb/src/mgmclient/ndb_mgmclient.hpp:
mvdir
storage/ndb/src/mgmclient/ndb_mgmclient.h:
mvdir
storage/ndb/src/mgmclient/test_cpcd/Makefile:
mvdir
storage/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp:
mvdir
storage/ndb/src/mgmsrv/Config.cpp:
mvdir
storage/ndb/src/mgmsrv/Config.hpp:
mvdir
storage/ndb/src/mgmsrv/ConfigInfo.cpp:
mvdir
storage/ndb/src/mgmsrv/ConfigInfo.hpp:
mvdir
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
mvdir
storage/ndb/src/mgmsrv/InitConfigFileParser.hpp:
mvdir
storage/ndb/src/mgmsrv/Makefile.am:
mvdir
storage/ndb/src/mgmsrv/MgmtSrvr.cpp:
mvdir
storage/ndb/src/mgmsrv/MgmtSrvr.hpp:
mvdir
storage/ndb/src/mgmsrv/MgmtSrvrConfig.cpp:
mvdir
storage/ndb/src/mgmsrv/MgmtSrvrGeneralSignalHandling.cpp:
mvdir
storage/ndb/src/mgmsrv/Services.cpp:
mvdir
storage/ndb/src/mgmsrv/Services.hpp:
mvdir
storage/ndb/src/mgmsrv/SignalQueue.cpp:
mvdir
storage/ndb/src/mgmsrv/SignalQueue.hpp:
mvdir
storage/ndb/src/mgmsrv/convertStrToInt.cpp:
mvdir
storage/ndb/src/mgmsrv/convertStrToInt.hpp:
mvdir
storage/ndb/src/mgmsrv/main.cpp:
mvdir
storage/ndb/src/mgmsrv/mkconfig/Makefile:
mvdir
storage/ndb/src/mgmsrv/mkconfig/mkconfig.cpp:
mvdir
storage/ndb/src/ndbapi/API.hpp:
mvdir
storage/ndb/src/ndbapi/ClusterMgr.cpp:
mvdir
storage/ndb/src/ndbapi/ClusterMgr.hpp:
mvdir
storage/ndb/src/ndbapi/DictCache.cpp:
mvdir
storage/ndb/src/ndbapi/DictCache.hpp:
mvdir
storage/ndb/src/ndbapi/Makefile.am:
mvdir
storage/ndb/src/ndbapi/Ndb.cpp:
mvdir
storage/ndb/src/ndbapi/NdbApiSignal.cpp:
mvdir
storage/ndb/src/ndbapi/NdbApiSignal.hpp:
mvdir
storage/ndb/src/ndbapi/NdbBlob.cpp:
mvdir
storage/ndb/src/ndbapi/NdbBlobImpl.hpp:
mvdir
storage/ndb/src/ndbapi/NdbDictionary.cpp:
mvdir
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
mvdir
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp:
mvdir
storage/ndb/src/ndbapi/NdbErrorOut.cpp:
mvdir
storage/ndb/src/ndbapi/NdbEventOperation.cpp:
mvdir
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
mvdir
storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp:
mvdir
storage/ndb/src/ndbapi/NdbImpl.hpp:
mvdir
storage/ndb/src/ndbapi/NdbIndexOperation.cpp:
mvdir
storage/ndb/src/ndbapi/NdbLinHash.hpp:
mvdir
storage/ndb/src/ndbapi/NdbOperation.cpp:
mvdir
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
mvdir
storage/ndb/src/ndbapi/NdbOperationExec.cpp:
mvdir
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
mvdir
storage/ndb/src/ndbapi/NdbOperationScan.cpp:
mvdir
storage/ndb/src/ndbapi/NdbOperationSearch.cpp:
mvdir
storage/ndb/src/ndbapi/NdbPool.cpp:
mvdir
storage/ndb/src/ndbapi/NdbPoolImpl.cpp:
mvdir
storage/ndb/src/ndbapi/NdbPoolImpl.hpp:
mvdir
storage/ndb/src/ndbapi/NdbRecAttr.cpp:
mvdir
storage/ndb/src/ndbapi/NdbReceiver.cpp:
mvdir
storage/ndb/src/ndbapi/NdbScanFilter.cpp:
mvdir
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
mvdir
storage/ndb/src/ndbapi/NdbTransaction.cpp:
mvdir
storage/ndb/src/ndbapi/NdbTransactionScan.cpp:
mvdir
storage/ndb/src/ndbapi/NdbUtil.cpp:
mvdir
storage/ndb/src/ndbapi/NdbUtil.hpp:
mvdir
storage/ndb/src/ndbapi/NdbWaiter.hpp:
mvdir
storage/ndb/src/ndbapi/Ndberr.cpp:
mvdir
storage/ndb/src/ndbapi/Ndbif.cpp:
mvdir
storage/ndb/src/ndbapi/Ndbinit.cpp:
mvdir
storage/ndb/src/ndbapi/Ndblist.cpp:
mvdir
storage/ndb/src/ndbapi/ObjectMap.hpp:
mvdir
storage/ndb/src/ndbapi/ScanOperation.txt:
mvdir
storage/ndb/src/ndbapi/TransporterFacade.cpp:
mvdir
storage/ndb/src/ndbapi/TransporterFacade.hpp:
mvdir
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp:
mvdir
storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp:
mvdir
storage/ndb/src/ndbapi/ndberror.c:
mvdir
storage/ndb/src/ndbapi/signal-sender/Makefile:
mvdir
storage/ndb/src/ndbapi/signal-sender/SignalSender.cpp:
mvdir
storage/ndb/src/ndbapi/signal-sender/SignalSender.hpp:
mvdir
storage/ndb/src/old_files/client/Makefile:
mvdir
storage/ndb/src/old_files/client/odbc/Extra.mk:
mvdir
storage/ndb/src/old_files/client/odbc/Makefile:
mvdir
storage/ndb/src/old_files/client/odbc/NdbOdbc.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/NdbOdbc.def:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/CodeGen.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/CodeGen.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_base.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_base.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_column.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_column.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_comp_op.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_comp_op.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_create_index.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_create_index.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_create_row.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_create_row.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_create_table.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_create_table.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_data_type.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_data_type.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_ddl.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_ddl.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_delete.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_delete.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_delete_index.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_delete_index.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_dml.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_dml.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_dml_column.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_dml_column.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_dml_row.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_dml_row.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_drop_index.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_drop_index.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_drop_table.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_drop_table.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_column.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_column.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_const.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_const.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_func.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_func.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_op.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_op.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_param.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_param.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_row.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_expr_row.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_idx_column.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_idx_column.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_insert.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_insert.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_pred.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_pred.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_pred_op.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_pred_op.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_count.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_count.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_filter.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_filter.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_group.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_group.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_index.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_index.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_join.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_join.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_project.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_project.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_range.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_range.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_scan.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_scan.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_sort.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_sort.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_sys.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_query_sys.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_root.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_root.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_select.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_select.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_set_row.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_set_row.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_stmt.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_stmt.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_table.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_table.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_table_list.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_table_list.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_update.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_update.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_update_index.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_update_index.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_update_scan.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Code_update_scan.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/Makefile:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/SimpleGram.ypp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/SimpleParser.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/SimpleParser.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/codegen/SimpleScan.lpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/AttrArea.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/AttrArea.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/CodeTree.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/CodeTree.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/ConnArea.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/ConnArea.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/Ctx.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/Ctx.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/DataField.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/DataField.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/DataRow.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/DataRow.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/DataType.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/DataType.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/DescArea.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/DescArea.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/DiagArea.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/DiagArea.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/Makefile:
mvdir
storage/ndb/src/old_files/client/odbc/common/OdbcData.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/OdbcData.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/ResultArea.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/ResultArea.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/Sqlstate.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/Sqlstate.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/StmtArea.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/StmtArea.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/StmtInfo.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/StmtInfo.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/common.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/common/common.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictCatalog.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictCatalog.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictColumn.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictColumn.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictIndex.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictIndex.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictSchema.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictSchema.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictSys.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictSys.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictTable.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/DictTable.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/dictionary/Makefile:
mvdir
storage/ndb/src/old_files/client/odbc/docs/class.fig:
mvdir
storage/ndb/src/old_files/client/odbc/docs/descfield.pl:
mvdir
storage/ndb/src/old_files/client/odbc/docs/diag.txt:
mvdir
storage/ndb/src/old_files/client/odbc/docs/getinfo.pl:
mvdir
storage/ndb/src/old_files/client/odbc/docs/gettypeinfo.pl:
mvdir
storage/ndb/src/old_files/client/odbc/docs/handleattr.pl:
mvdir
storage/ndb/src/old_files/client/odbc/docs/main.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/docs/ndbodbc.html:
mvdir
storage/ndb/src/old_files/client/odbc/docs/select.fig:
mvdir
storage/ndb/src/old_files/client/odbc/docs/systables.pl:
mvdir
storage/ndb/src/old_files/client/odbc/docs/type.txt:
mvdir
storage/ndb/src/old_files/client/odbc/driver/Func.data:
mvdir
storage/ndb/src/old_files/client/odbc/driver/Func.pl:
mvdir
storage/ndb/src/old_files/client/odbc/driver/Makefile:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLAllocConnect.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLAllocEnv.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLAllocHandle.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLAllocHandleStd.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLAllocStmt.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLBindCol.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLBindParam.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLBindParameter.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLBrowseConnect.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLBulkOperations.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLCancel.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLCloseCursor.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLColAttribute.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLColAttributes.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLColumnPrivileges.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLColumns.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLConnect.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLCopyDesc.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLDataSources.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLDescribeCol.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLDescribeParam.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLDisconnect.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLDriverConnect.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLDrivers.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLEndTran.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLError.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLExecDirect.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLExecute.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLExtendedFetch.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLFetch.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLFetchScroll.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLForeignKeys.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLFreeConnect.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLFreeEnv.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLFreeHandle.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLFreeStmt.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetConnectAttr.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetConnectOption.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetCursorName.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetData.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetDescField.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetDescRec.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetDiagField.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetDiagRec.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetEnvAttr.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetFunctions.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetInfo.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetStmtAttr.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetStmtOption.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLGetTypeInfo.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLMoreResults.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLNativeSql.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLNumParams.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLNumResultCols.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLParamData.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLParamOptions.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLPrepare.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLPrimaryKeys.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLProcedureColumns.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLProcedures.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLPutData.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLRowCount.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSetConnectAttr.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSetConnectOption.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSetCursorName.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSetDescField.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSetDescRec.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSetEnvAttr.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSetParam.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSetPos.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSetScrollOptions.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSetStmtAttr.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSetStmtOption.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLSpecialColumns.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLStatistics.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLTablePrivileges.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLTables.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/SQLTransact.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/driver.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/driver/driver.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_comp_op.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_create_index.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_create_table.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_delete_index.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_delete_lookup.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_delete_scan.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_drop_index.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_drop_table.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_expr_conv.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_expr_func.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_expr_op.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_insert.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_pred_op.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_query_index.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_query_lookup.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_query_range.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_query_scan.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_query_sys.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_update_index.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_update_lookup.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Exec_update_scan.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Executor.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Executor.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/executor/Makefile:
mvdir
storage/ndb/src/old_files/client/odbc/handles/AttrDbc.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/AttrEnv.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/AttrRoot.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/AttrStmt.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/DescSpec.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/FuncTab.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleBase.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleBase.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleDbc.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleDbc.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleDesc.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleDesc.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleEnv.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleEnv.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleRoot.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleRoot.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleStmt.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/HandleStmt.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/InfoTab.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/Makefile:
mvdir
storage/ndb/src/old_files/client/odbc/handles/PoolNdb.cpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/PoolNdb.hpp:
mvdir
storage/ndb/src/old_files/client/odbc/handles/handles.hpp:
mvdir
storage/ndb/src/old_files/ndbbaseclient/Makefile:
mvdir
storage/ndb/src/old_files/ndbbaseclient/ndbbaseclient_dummy.cpp:
mvdir
storage/ndb/src/old_files/ndbclient/Makefile:
mvdir
storage/ndb/src/old_files/ndbclient/ndbclient_dummy.cpp:
mvdir
storage/ndb/src/old_files/newtonapi/Makefile:
mvdir
storage/ndb/src/old_files/newtonapi/dba_binding.cpp:
mvdir
storage/ndb/src/old_files/newtonapi/dba_bulkread.cpp:
mvdir
storage/ndb/src/old_files/newtonapi/dba_config.cpp:
mvdir
storage/ndb/src/old_files/newtonapi/dba_dac.cpp:
mvdir
storage/ndb/src/old_files/newtonapi/dba_error.cpp:
mvdir
storage/ndb/src/old_files/newtonapi/dba_init.cpp:
mvdir
storage/ndb/src/old_files/newtonapi/dba_internal.hpp:
mvdir
storage/ndb/src/old_files/newtonapi/dba_process.cpp:
mvdir
storage/ndb/src/old_files/newtonapi/dba_process.hpp:
mvdir
storage/ndb/src/old_files/newtonapi/dba_schema.cpp:
mvdir
storage/ndb/src/old_files/rep/ExtSender.cpp:
mvdir
storage/ndb/src/old_files/rep/ExtSender.hpp:
mvdir
storage/ndb/src/old_files/rep/Makefile:
mvdir
storage/ndb/src/old_files/rep/NodeConnectInfo.hpp:
mvdir
storage/ndb/src/old_files/rep/README:
mvdir
storage/ndb/src/old_files/rep/RepApiInterpreter.cpp:
mvdir
storage/ndb/src/old_files/rep/RepApiInterpreter.hpp:
mvdir
storage/ndb/src/old_files/rep/RepApiService.cpp:
mvdir
storage/ndb/src/old_files/rep/RepApiService.hpp:
mvdir
storage/ndb/src/old_files/rep/RepCommandInterpreter.cpp:
mvdir
storage/ndb/src/old_files/rep/RepCommandInterpreter.hpp:
mvdir
storage/ndb/src/old_files/rep/RepComponents.cpp:
mvdir
storage/ndb/src/old_files/rep/RepComponents.hpp:
mvdir
storage/ndb/src/old_files/rep/RepMain.cpp:
mvdir
storage/ndb/src/old_files/rep/Requestor.cpp:
mvdir
storage/ndb/src/old_files/rep/Requestor.hpp:
mvdir
storage/ndb/src/old_files/rep/RequestorSubscriptions.cpp:
mvdir
storage/ndb/src/old_files/rep/SignalQueue.cpp:
mvdir
storage/ndb/src/old_files/rep/SignalQueue.hpp:
mvdir
storage/ndb/src/old_files/rep/TODO:
mvdir
storage/ndb/src/old_files/rep/adapters/AppNDB.cpp:
mvdir
storage/ndb/src/old_files/rep/adapters/AppNDB.hpp:
mvdir
storage/ndb/src/old_files/rep/adapters/ExtAPI.cpp:
mvdir
storage/ndb/src/old_files/rep/adapters/ExtAPI.hpp:
mvdir
storage/ndb/src/old_files/rep/adapters/ExtNDB.cpp:
mvdir
storage/ndb/src/old_files/rep/adapters/ExtNDB.hpp:
mvdir
storage/ndb/src/old_files/rep/adapters/Makefile:
mvdir
storage/ndb/src/old_files/rep/adapters/TableInfoPs.hpp:
mvdir
storage/ndb/src/old_files/rep/dbug_hack.cpp:
mvdir
storage/ndb/src/old_files/rep/rep_version.hpp:
mvdir
storage/ndb/src/old_files/rep/repapi/Makefile:
mvdir
storage/ndb/src/old_files/rep/repapi/repapi.cpp:
mvdir
storage/ndb/src/old_files/rep/repapi/repapi.h:
mvdir
storage/ndb/src/old_files/rep/state/Channel.cpp:
mvdir
storage/ndb/src/old_files/rep/state/Channel.hpp:
mvdir
storage/ndb/src/old_files/rep/state/Interval.cpp:
mvdir
storage/ndb/src/old_files/rep/state/Interval.hpp:
mvdir
storage/ndb/src/old_files/rep/state/Makefile:
mvdir
storage/ndb/src/old_files/rep/state/RepState.cpp:
mvdir
storage/ndb/src/old_files/rep/state/RepState.hpp:
mvdir
storage/ndb/src/old_files/rep/state/RepStateEvent.cpp:
mvdir
storage/ndb/src/old_files/rep/state/RepStateRequests.cpp:
mvdir
storage/ndb/src/old_files/rep/state/testInterval/Makefile:
mvdir
storage/ndb/src/old_files/rep/state/testInterval/testInterval.cpp:
mvdir
storage/ndb/src/old_files/rep/state/testRepState/Makefile:
mvdir
storage/ndb/src/old_files/rep/state/testRepState/testRequestor.cpp:
mvdir
storage/ndb/src/old_files/rep/state/testRepState/testRequestor.hpp:
mvdir
storage/ndb/src/old_files/rep/storage/GCIBuffer.cpp:
mvdir
storage/ndb/src/old_files/rep/storage/GCIBuffer.hpp:
mvdir
storage/ndb/src/old_files/rep/storage/GCIContainer.cpp:
mvdir
storage/ndb/src/old_files/rep/storage/GCIContainer.hpp:
mvdir
storage/ndb/src/old_files/rep/storage/GCIContainerPS.cpp:
mvdir
storage/ndb/src/old_files/rep/storage/GCIContainerPS.hpp:
mvdir
storage/ndb/src/old_files/rep/storage/GCIPage.cpp:
mvdir
storage/ndb/src/old_files/rep/storage/GCIPage.hpp:
mvdir
storage/ndb/src/old_files/rep/storage/LogRecord.hpp:
mvdir
storage/ndb/src/old_files/rep/storage/Makefile:
mvdir
storage/ndb/src/old_files/rep/storage/NodeConnectInfo.hpp:
mvdir
storage/ndb/src/old_files/rep/storage/NodeGroup.cpp:
mvdir
storage/ndb/src/old_files/rep/storage/NodeGroup.hpp:
mvdir
storage/ndb/src/old_files/rep/storage/NodeGroupInfo.cpp:
mvdir
storage/ndb/src/old_files/rep/storage/NodeGroupInfo.hpp:
mvdir
storage/ndb/src/old_files/rep/transfer/Makefile:
mvdir
storage/ndb/src/old_files/rep/transfer/TransPS.cpp:
mvdir
storage/ndb/src/old_files/rep/transfer/TransPS.hpp:
mvdir
storage/ndb/src/old_files/rep/transfer/TransSS.cpp:
mvdir
storage/ndb/src/old_files/rep/transfer/TransSS.hpp:
mvdir
storage/ndb/src/old_files/rep/transfer/TransSSSubscriptions.cpp:
mvdir
storage/ndb/test/Makefile.am:
mvdir
storage/ndb/test/include/CpcClient.hpp:
mvdir
storage/ndb/test/include/HugoAsynchTransactions.hpp:
mvdir
storage/ndb/test/include/HugoCalculator.hpp:
mvdir
storage/ndb/test/include/HugoOperations.hpp:
mvdir
storage/ndb/test/include/HugoTransactions.hpp:
mvdir
storage/ndb/test/include/NDBT.hpp:
mvdir
storage/ndb/test/include/NDBT_DataSet.hpp:
mvdir
storage/ndb/test/include/NDBT_DataSetTransaction.hpp:
mvdir
storage/ndb/test/include/NDBT_Error.hpp:
mvdir
storage/ndb/test/include/NDBT_Output.hpp:
mvdir
storage/ndb/test/include/NDBT_ResultRow.hpp:
mvdir
storage/ndb/test/include/NDBT_ReturnCodes.h:
mvdir
storage/ndb/test/include/NDBT_Stats.hpp:
mvdir
storage/ndb/test/include/NDBT_Table.hpp:
mvdir
storage/ndb/test/include/NDBT_Tables.hpp:
mvdir
storage/ndb/test/include/NDBT_Test.hpp:
mvdir
storage/ndb/test/include/NdbBackup.hpp:
mvdir
storage/ndb/test/include/NdbConfig.hpp:
mvdir
storage/ndb/test/include/NdbGrep.hpp:
mvdir
storage/ndb/test/include/NdbRestarter.hpp:
mvdir
storage/ndb/test/include/NdbRestarts.hpp:
mvdir
storage/ndb/test/include/NdbSchemaCon.hpp:
mvdir
storage/ndb/test/include/NdbSchemaOp.hpp:
mvdir
storage/ndb/test/include/NdbTest.hpp:
mvdir
storage/ndb/test/include/NdbTimer.hpp:
mvdir
storage/ndb/test/include/TestNdbEventOperation.hpp:
mvdir
storage/ndb/test/include/UtilTransactions.hpp:
mvdir
storage/ndb/test/include/getarg.h:
mvdir
storage/ndb/test/ndbapi/InsertRecs.cpp:
mvdir
storage/ndb/test/ndbapi/Makefile.am:
mvdir
storage/ndb/test/ndbapi/ScanFilter.hpp:
mvdir
storage/ndb/test/ndbapi/ScanFunctions.hpp:
mvdir
storage/ndb/test/ndbapi/ScanInterpretTest.hpp:
mvdir
storage/ndb/test/ndbapi/TraceNdbApi.cpp:
mvdir
storage/ndb/test/ndbapi/VerifyNdbApi.cpp:
mvdir
storage/ndb/test/ndbapi/acid.cpp:
mvdir
storage/ndb/test/ndbapi/acid2.cpp:
mvdir
storage/ndb/test/ndbapi/adoInsertRecs.cpp:
mvdir
storage/ndb/test/ndbapi/asyncGenerator.cpp:
mvdir
storage/ndb/test/ndbapi/benchronja.cpp:
mvdir
storage/ndb/test/ndbapi/bulk_copy.cpp:
mvdir
storage/ndb/test/ndbapi/cdrserver.cpp:
mvdir
storage/ndb/test/ndbapi/celloDb.cpp:
mvdir
storage/ndb/test/ndbapi/create_all_tabs.cpp:
mvdir
storage/ndb/test/ndbapi/create_tab.cpp:
mvdir
storage/ndb/test/ndbapi/drop_all_tabs.cpp:
mvdir
storage/ndb/test/ndbapi/flexAsynch.cpp:
mvdir
storage/ndb/test/ndbapi/flexBench.cpp:
mvdir
storage/ndb/test/ndbapi/flexHammer.cpp:
mvdir
storage/ndb/test/ndbapi/flexScan.cpp:
mvdir
storage/ndb/test/ndbapi/flexTT.cpp:
mvdir
storage/ndb/test/ndbapi/flexTimedAsynch.cpp:
mvdir
storage/ndb/test/ndbapi/flex_bench_mysql.cpp:
mvdir
storage/ndb/test/ndbapi/index.cpp:
mvdir
storage/ndb/test/ndbapi/index2.cpp:
mvdir
storage/ndb/test/ndbapi/initronja.cpp:
mvdir
storage/ndb/test/ndbapi/interpreterInTup.cpp:
mvdir
storage/ndb/test/ndbapi/mainAsyncGenerator.cpp:
mvdir
storage/ndb/test/ndbapi/msa.cpp:
mvdir
storage/ndb/test/ndbapi/ndb_async1.cpp:
mvdir
storage/ndb/test/ndbapi/ndb_async2.cpp:
mvdir
storage/ndb/test/ndbapi/ndb_user_populate.cpp:
mvdir
storage/ndb/test/ndbapi/ndb_user_transaction.cpp:
mvdir
storage/ndb/test/ndbapi/ndb_user_transaction2.cpp:
mvdir
storage/ndb/test/ndbapi/ndb_user_transaction3.cpp:
mvdir
storage/ndb/test/ndbapi/ndb_user_transaction4.cpp:
mvdir
storage/ndb/test/ndbapi/ndb_user_transaction5.cpp:
mvdir
storage/ndb/test/ndbapi/ndb_user_transaction6.cpp:
mvdir
storage/ndb/test/ndbapi/restarter.cpp:
mvdir
storage/ndb/test/ndbapi/restarter2.cpp:
mvdir
storage/ndb/test/ndbapi/restarts.cpp:
mvdir
storage/ndb/test/ndbapi/size.cpp:
mvdir
storage/ndb/test/ndbapi/slow_select.cpp:
mvdir
storage/ndb/test/ndbapi/testBackup.cpp:
mvdir
storage/ndb/test/ndbapi/testBasic.cpp:
mvdir
storage/ndb/test/ndbapi/testBasicAsynch.cpp:
mvdir
storage/ndb/test/ndbapi/testBitfield.cpp:
mvdir
storage/ndb/test/ndbapi/testBlobs.cpp:
mvdir
storage/ndb/test/ndbapi/testDataBuffers.cpp:
mvdir
storage/ndb/test/ndbapi/testDeadlock.cpp:
mvdir
storage/ndb/test/ndbapi/testDict.cpp:
mvdir
storage/ndb/test/ndbapi/testGrep.cpp:
mvdir
storage/ndb/test/ndbapi/testGrepVerify.cpp:
mvdir
storage/ndb/test/ndbapi/testIndex.cpp:
mvdir
storage/ndb/test/ndbapi/testInterpreter.cpp:
mvdir
storage/ndb/test/ndbapi/testLcp.cpp:
mvdir
storage/ndb/test/ndbapi/testMgm.cpp:
mvdir
storage/ndb/test/ndbapi/testNdbApi.cpp:
mvdir
storage/ndb/test/ndbapi/testNodeRestart.cpp:
mvdir
storage/ndb/test/ndbapi/testOIBasic.cpp:
mvdir
storage/ndb/test/ndbapi/testOperations.cpp:
mvdir
storage/ndb/test/ndbapi/testOrderedIndex.cpp:
mvdir
storage/ndb/test/ndbapi/testPartitioning.cpp:
mvdir
storage/ndb/test/ndbapi/testReadPerf.cpp:
mvdir
storage/ndb/test/ndbapi/testRestartGci.cpp:
mvdir
storage/ndb/test/ndbapi/bank/Bank.cpp:
mvdir
storage/ndb/test/ndbapi/bank/Bank.hpp:
mvdir
storage/ndb/test/ndbapi/bank/BankLoad.cpp:
mvdir
storage/ndb/test/ndbapi/bank/Makefile.am:
mvdir
storage/ndb/test/ndbapi/bank/bankCreator.cpp:
mvdir
storage/ndb/test/ndbapi/bank/bankMakeGL.cpp:
mvdir
storage/ndb/test/ndbapi/bank/bankSumAccounts.cpp:
mvdir
storage/ndb/test/ndbapi/bank/bankTimer.cpp:
mvdir
storage/ndb/test/ndbapi/bank/bankTransactionMaker.cpp:
mvdir
storage/ndb/test/ndbapi/bank/bankValidateAllGLs.cpp:
mvdir
storage/ndb/test/ndbapi/bank/testBank.cpp:
mvdir
storage/ndb/test/ndbapi/bench/asyncGenerator.cpp:
mvdir
storage/ndb/test/ndbapi/bench/dbGenerator.h:
mvdir
storage/ndb/test/ndbapi/bench/dbPopulate.cpp:
mvdir
storage/ndb/test/ndbapi/bench/dbPopulate.h:
mvdir
storage/ndb/test/ndbapi/bench/macros.h:
mvdir
storage/ndb/test/ndbapi/bench/mainAsyncGenerator.cpp:
mvdir
storage/ndb/test/ndbapi/bench/mainPopulate.cpp:
mvdir
storage/ndb/test/ndbapi/bench/ndb_async1.cpp:
mvdir
storage/ndb/test/ndbapi/bench/ndb_async2.cpp:
mvdir
storage/ndb/test/ndbapi/bench/ndb_error.hpp:
mvdir
storage/ndb/test/ndbapi/bench/ndb_schema.hpp:
mvdir
storage/ndb/test/ndbapi/bench/ndb_user_transaction.cpp:
mvdir
storage/ndb/test/ndbapi/bench/ndb_user_transaction2.cpp:
mvdir
storage/ndb/test/ndbapi/bench/ndb_user_transaction3.cpp:
mvdir
storage/ndb/test/ndbapi/bench/ndb_user_transaction4.cpp:
mvdir
storage/ndb/test/ndbapi/bench/ndb_user_transaction5.cpp:
mvdir
storage/ndb/test/ndbapi/testScan.cpp:
mvdir
storage/ndb/test/ndbapi/testScanInterpreter.cpp:
mvdir
storage/ndb/test/ndbapi/testScanPerf.cpp:
mvdir
storage/ndb/test/ndbapi/testSystemRestart.cpp:
mvdir
storage/ndb/test/ndbapi/testTimeout.cpp:
mvdir
storage/ndb/test/ndbapi/testTransactions.cpp:
mvdir
storage/ndb/test/ndbapi/test_event.cpp:
mvdir
storage/ndb/test/ndbapi/test_event_multi_table.cpp:
mvdir
storage/ndb/test/ndbapi/userInterface.cpp:
mvdir
storage/ndb/test/ndbapi/bench/ndb_user_transaction6.cpp:
mvdir
storage/ndb/test/ndbapi/bench/testData.h:
mvdir
storage/ndb/test/ndbapi/bench/testDefinitions.h:
mvdir
storage/ndb/test/ndbapi/bench/userInterface.cpp:
mvdir
storage/ndb/test/ndbapi/bench/userInterface.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/acid/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/acid2/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp:
mvdir
storage/ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp:
mvdir
storage/ndb/test/ndbapi/old_dirs/basicAsynch/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/bulk_copy/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/create_all_tabs/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/create_tab/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/drop_all_tabs/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/flexAsynch/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/flexBench/Makefile.am:
mvdir
storage/ndb/test/ndbapi/old_dirs/flexBench/ndbplot.pl:
mvdir
storage/ndb/test/ndbapi/old_dirs/flexHammer/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/flexHammer/README:
mvdir
storage/ndb/test/ndbapi/old_dirs/flexScan/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/flexScan/README:
mvdir
storage/ndb/test/ndbapi/old_dirs/flexTT/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/flexTimedAsynch/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/flex_bench_mysql/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/indexTest/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/indexTest2/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/interpreterInTup/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/generator/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/bin/.empty:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/lib/.empty:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l-p10.sh:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-l.sh:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench-p10.sh:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/script/async-lmc-bench.sh:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/README:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.linux:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/makevars.sparc:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/mainPopulate.c:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/localDbPrepare.c:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c:
mvdir
storage/ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c:
mvdir
storage/ndb/test/ndbapi/old_dirs/restarter/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/restarter2/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/restarts/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/ronja/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/ronja/benchronja/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/ronja/initronja/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/telco/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/telco/readme:
mvdir
storage/ndb/test/ndbapi/old_dirs/testBackup/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testBasic/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testBlobs/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testDataBuffers/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testDict/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testGrep/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testGrep/verify/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testIndex/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testInterpreter/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testMgm/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testNdbApi/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testNodeRestart/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testOIBasic/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testOIBasic/times.txt:
mvdir
storage/ndb/test/ndbapi/old_dirs/testOperations/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testOrderedIndex/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testRestartGci/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testScan/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testScanInterpreter/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testSystemRestart/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testTimeout/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/testTransactions/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/test_event/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/vw_test/Makefile:
mvdir
storage/ndb/test/ndbapi/old_dirs/vw_test/bcd.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/vw_test/script/client_start:
mvdir
storage/ndb/test/ndbapi/old_dirs/vw_test/utv.h:
mvdir
storage/ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h:
mvdir
storage/ndb/test/ndbnet/test.run:
mvdir
storage/ndb/test/ndbnet/testError.run:
mvdir
storage/ndb/test/ndbnet/testMNF.run:
mvdir
storage/ndb/test/ndbnet/testNR.run:
mvdir
storage/ndb/test/ndbnet/testNR1.run:
mvdir
storage/ndb/test/ndbnet/testNR4.run:
mvdir
storage/ndb/test/ndbnet/testSRhang.run:
mvdir
storage/ndb/test/ndbnet/testTR295.run:
mvdir
storage/ndb/test/newtonapi/basic_test/Makefile:
mvdir
storage/ndb/test/newtonapi/basic_test/basic/Makefile:
mvdir
storage/ndb/test/newtonapi/basic_test/basic/basic.cpp:
mvdir
storage/ndb/test/newtonapi/basic_test/bulk_read/Makefile:
mvdir
storage/ndb/test/newtonapi/basic_test/bulk_read/br_test.cpp:
mvdir
storage/ndb/test/newtonapi/basic_test/common.cpp:
mvdir
storage/ndb/test/newtonapi/basic_test/common.hpp:
mvdir
storage/ndb/test/newtonapi/basic_test/ptr_binding/Makefile:
mvdir
storage/ndb/test/newtonapi/basic_test/ptr_binding/ptr_binding_test.cpp:
mvdir
storage/ndb/test/newtonapi/basic_test/too_basic.cpp:
mvdir
storage/ndb/test/newtonapi/perf_test/Makefile:
mvdir
storage/ndb/test/newtonapi/perf_test/perf.cpp:
mvdir
storage/ndb/test/odbc/SQL99_test/Makefile:
mvdir
storage/ndb/test/odbc/SQL99_test/SQL99_test.cpp:
mvdir
storage/ndb/test/odbc/SQL99_test/SQL99_test.h:
mvdir
storage/ndb/test/odbc/client/Makefile:
mvdir
storage/ndb/test/odbc/client/NDBT_ALLOCHANDLE.cpp:
mvdir
storage/ndb/test/odbc/client/NDBT_ALLOCHANDLE_HDBC.cpp:
mvdir
storage/ndb/test/odbc/client/NDBT_SQLConnect.cpp:
mvdir
storage/ndb/test/odbc/client/NDBT_SQLPrepare.cpp:
mvdir
storage/ndb/test/odbc/client/SQLAllocEnvTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLAllocHandleTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLAllocHandleTest_bf.cpp:
mvdir
storage/ndb/test/odbc/client/SQLBindColTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLBindParameterTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLCancelTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLCloseCursorTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLColAttributeTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLColAttributeTest1.cpp:
mvdir
storage/ndb/test/odbc/client/SQLColAttributeTest2.cpp:
mvdir
storage/ndb/test/odbc/client/SQLColAttributeTest3.cpp:
mvdir
storage/ndb/test/odbc/client/SQLConnectTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLCopyDescTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLDescribeColTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLDisconnectTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLDriverConnectTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLEndTranTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLErrorTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLExecDirectTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLExecuteTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLFetchScrollTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLFetchTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLFreeHandleTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLFreeStmtTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetConnectAttrTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetCursorNameTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetDataTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetDescFieldTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetDescRecTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetDiagFieldTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetDiagRecSimpleTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetDiagRecTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetEnvAttrTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetFunctionsTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetInfoTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetStmtAttrTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLGetTypeInfoTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLMoreResultsTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLNumResultColsTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLParamDataTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLPrepareTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLPutDataTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLRowCountTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLSetConnectAttrTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLSetCursorNameTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLSetDescFieldTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLSetDescRecTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLSetEnvAttrTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLSetStmtAttrTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLTablesTest.cpp:
mvdir
storage/ndb/test/odbc/client/SQLTransactTest.cpp:
mvdir
storage/ndb/test/odbc/client/common.hpp:
mvdir
storage/ndb/test/odbc/client/main.cpp:
mvdir
storage/ndb/test/odbc/dm-iodbc/Makefile:
mvdir
storage/ndb/test/odbc/dm-unixodbc/Makefile:
mvdir
storage/ndb/test/odbc/driver/Makefile:
mvdir
storage/ndb/test/odbc/driver/testOdbcDriver.cpp:
mvdir
storage/ndb/test/odbc/test_compiler/Makefile:
mvdir
storage/ndb/test/odbc/test_compiler/test_compiler.cpp:
mvdir
storage/ndb/test/run-test/16node-tests.txt:
mvdir
storage/ndb/test/run-test/Makefile.am:
mvdir
storage/ndb/test/run-test/README.ATRT:
mvdir
storage/ndb/test/run-test/README:
mvdir
storage/ndb/test/run-test/atrt-analyze-result.sh:
mvdir
storage/ndb/test/run-test/atrt-clear-result.sh:
mvdir
storage/ndb/test/run-test/atrt-example.tgz:
mvdir
storage/ndb/test/run-test/atrt-gather-result.sh:
mvdir
storage/ndb/test/run-test/atrt-mysql-test-run:
mvdir
storage/ndb/test/run-test/atrt-setup.sh:
mvdir
storage/ndb/test/run-test/atrt-testBackup:
mvdir
storage/ndb/test/run-test/basic.txt:
mvdir
storage/ndb/test/run-test/daily-basic-tests.txt:
mvdir
storage/ndb/test/run-test/daily-devel-tests.txt:
mvdir
storage/ndb/test/run-test/example.conf:
mvdir
storage/ndb/test/run-test/main.cpp:
mvdir
storage/ndb/test/run-test/make-config.sh:
mvdir
storage/ndb/test/run-test/make-html-reports.sh:
mvdir
storage/ndb/test/run-test/make-index.sh:
mvdir
storage/ndb/test/run-test/ndb-autotest.sh:
mvdir
storage/ndb/test/run-test/run-test.hpp:
mvdir
storage/ndb/test/src/CpcClient.cpp:
mvdir
storage/ndb/test/src/HugoAsynchTransactions.cpp:
mvdir
storage/ndb/test/src/HugoCalculator.cpp:
mvdir
storage/ndb/test/src/HugoOperations.cpp:
mvdir
storage/ndb/test/src/HugoTransactions.cpp:
mvdir
storage/ndb/test/src/Makefile.am:
mvdir
storage/ndb/test/src/NDBT_Error.cpp:
mvdir
storage/ndb/test/src/NDBT_Output.cpp:
mvdir
storage/ndb/test/src/NDBT_ResultRow.cpp:
mvdir
storage/ndb/test/src/NDBT_ReturnCodes.cpp:
mvdir
storage/ndb/test/src/NDBT_Table.cpp:
mvdir
storage/ndb/test/src/NDBT_Tables.cpp:
mvdir
storage/ndb/test/src/NDBT_Test.cpp:
mvdir
storage/ndb/test/src/NdbBackup.cpp:
mvdir
storage/ndb/test/src/NdbConfig.cpp:
mvdir
storage/ndb/test/src/NdbGrep.cpp:
mvdir
storage/ndb/test/src/NdbRestarter.cpp:
mvdir
storage/ndb/test/src/NdbRestarts.cpp:
mvdir
storage/ndb/test/src/NdbSchemaCon.cpp:
mvdir
storage/ndb/test/src/NdbSchemaOp.cpp:
mvdir
storage/ndb/test/src/UtilTransactions.cpp:
mvdir
storage/ndb/test/src/getarg.c:
mvdir
storage/ndb/test/tools/Makefile.am:
mvdir
storage/ndb/test/tools/copy_tab.cpp:
mvdir
storage/ndb/test/tools/cpcc.cpp:
mvdir
storage/ndb/test/tools/create_index.cpp:
mvdir
storage/ndb/test/tools/hugoCalculator.cpp:
mvdir
storage/ndb/test/tools/hugoFill.cpp:
mvdir
storage/ndb/test/tools/hugoLoad.cpp:
mvdir
storage/ndb/test/tools/hugoLockRecords.cpp:
mvdir
storage/ndb/test/tools/hugoPkDelete.cpp:
mvdir
storage/ndb/test/tools/hugoPkRead.cpp:
mvdir
storage/ndb/test/tools/hugoPkReadRecord.cpp:
mvdir
storage/ndb/test/tools/hugoPkUpdate.cpp:
mvdir
storage/ndb/test/tools/hugoScanRead.cpp:
mvdir
storage/ndb/test/tools/hugoScanUpdate.cpp:
mvdir
storage/ndb/test/tools/old_dirs/hugoCalculator/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/hugoFill/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/hugoLoad/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/hugoLockRecords/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/hugoPkDelete/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/hugoPkRead/Makefile:
mvdir
storage/ndb/test/tools/restart.cpp:
mvdir
storage/ndb/test/tools/transproxy.cpp:
mvdir
storage/ndb/test/tools/verify_index.cpp:
mvdir
storage/ndb/test/tools/old_dirs/hugoPkReadRecord/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/hugoPkUpdate/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/hugoScanRead/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/hugoScanUpdate/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/restart/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/transproxy/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/verify_index/Makefile:
mvdir
storage/ndb/test/tools/old_dirs/waiter/waiter.cpp:
mvdir
storage/ndb/tools/Makefile.am:
mvdir
storage/ndb/tools/clean-links.sh:
mvdir
storage/ndb/tools/delete_all.cpp:
mvdir
storage/ndb/tools/desc.cpp:
mvdir
storage/ndb/tools/drop_index.cpp:
mvdir
storage/ndb/tools/drop_tab.cpp:
mvdir
storage/ndb/tools/listTables.cpp:
mvdir
storage/ndb/tools/make-errors.pl:
mvdir
storage/ndb/tools/make-links.sh:
mvdir
storage/ndb/tools/ndb_test_platform.cpp:
mvdir
storage/ndb/tools/ndbsql.cpp:
mvdir
storage/ndb/tools/old_dirs/copy_tab/Makefile:
mvdir
storage/ndb/tools/old_dirs/cpcc/Makefile:
mvdir
storage/ndb/tools/old_dirs/create_index/Makefile:
mvdir
storage/ndb/tools/old_dirs/delete_all/Makefile:
mvdir
storage/ndb/tools/old_dirs/desc/Makefile:
mvdir
storage/ndb/tools/old_dirs/drop_index/Makefile:
mvdir
storage/ndb/tools/old_dirs/drop_tab/Makefile:
mvdir
storage/ndb/tools/old_dirs/list_tables/Makefile:
mvdir
storage/ndb/tools/old_dirs/ndbnet/Makefile.PL:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/ndbnet.pl:
mvdir
storage/ndb/tools/old_dirs/ndbnet/ndbnetd.pl:
mvdir
storage/ndb/tools/old_dirs/ndbnet/ndbrun:
mvdir
storage/ndb/tools/rgrep:
mvdir
storage/ndb/tools/select_all.cpp:
mvdir
storage/ndb/tools/select_count.cpp:
mvdir
storage/ndb/tools/waiter.cpp:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Base.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Client.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Command.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Config.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Database.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Env.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Node.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeApi.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeDb.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/NodeMgmt.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/Server.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/ServerINET.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Net/ServerUNIX.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Base.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Database.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Env.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Run/Node.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Base.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Dir.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Event.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/File.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/IO.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Lock.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Log.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/Socket.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/SocketINET.pm:
mvdir
storage/ndb/tools/old_dirs/ndbnet/lib/NDB/Util/SocketUNIX.pm:
mvdir
storage/ndb/tools/old_dirs/ndbsql/Makefile:
mvdir
storage/ndb/tools/old_dirs/select_all/Makefile:
mvdir
storage/ndb/tools/old_dirs/select_count/Makefile:
mvdir
storage/ndb/tools/old_dirs/src/counterviewer/CounterViewer.java:
mvdir
storage/ndb/tools/restore/Restore.cpp:
mvdir
storage/ndb/tools/restore/Restore.hpp:
mvdir
storage/ndb/tools/restore/consumer.cpp:
mvdir
storage/ndb/tools/restore/consumer.hpp:
mvdir
storage/ndb/tools/restore/consumer_printer.cpp:
mvdir
storage/ndb/tools/restore/consumer_printer.hpp:
mvdir
storage/ndb/tools/restore/consumer_restore.cpp:
mvdir
storage/ndb/tools/restore/consumer_restore.hpp:
mvdir
storage/ndb/tools/restore/consumer_restorem.cpp:
mvdir
storage/ndb/tools/restore/restore_main.cpp:
mvdir
storage/bdb/LICENSE:
mvdir
storage/bdb/Makefile.in:
mvdir
storage/bdb/btree/bt_compare.c:
mvdir
storage/bdb/btree/bt_conv.c:
mvdir
storage/bdb/btree/bt_curadj.c:
mvdir
storage/bdb/btree/bt_cursor.c:
mvdir
storage/bdb/btree/bt_delete.c:
mvdir
storage/bdb/btree/bt_method.c:
mvdir
storage/bdb/btree/bt_open.c:
mvdir
storage/bdb/btree/bt_put.c:
mvdir
storage/bdb/btree/bt_rec.c:
mvdir
storage/bdb/btree/bt_reclaim.c:
mvdir
storage/bdb/btree/bt_recno.c:
mvdir
storage/bdb/btree/bt_rsearch.c:
mvdir
storage/bdb/btree/bt_search.c:
mvdir
storage/bdb/btree/bt_split.c:
mvdir
storage/bdb/btree/bt_stat.c:
mvdir
storage/bdb/btree/bt_upgrade.c:
mvdir
storage/bdb/btree/bt_verify.c:
mvdir
storage/bdb/btree/btree.src:
mvdir
storage/bdb/build_unix/.IGNORE_ME:
mvdir
storage/bdb/build_vxworks/BerkeleyDB.wsp:
mvdir
storage/bdb/build_vxworks/dbdemo/README:
mvdir
storage/bdb/build_win32/Berkeley_DB.dsw:
mvdir
storage/bdb/build_win32/app_dsp.src:
mvdir
storage/bdb/build_win32/build_all.dsp:
mvdir
storage/bdb/build_win32/db_java_xa.dsp:
mvdir
storage/bdb/build_win32/db_java_xaj.mak:
mvdir
storage/bdb/build_win32/db_lib.dsp:
mvdir
storage/bdb/build_win32/db_test.src:
mvdir
storage/bdb/build_win32/dbkill.cpp:
mvdir
storage/bdb/build_win32/dllmain.c:
mvdir
storage/bdb/build_win32/dynamic_dsp.src:
mvdir
storage/bdb/build_win32/java_dsp.src:
mvdir
storage/bdb/build_win32/libdb_tcl.def:
mvdir
storage/bdb/build_win32/libdbrc.src:
mvdir
storage/bdb/build_win32/srcfile_dsp.src:
mvdir
storage/bdb/build_win32/static_dsp.src:
mvdir
storage/bdb/build_win32/tcl_dsp.src:
mvdir
storage/bdb/clib/getcwd.c:
mvdir
storage/bdb/clib/getopt.c:
mvdir
storage/bdb/clib/memcmp.c:
mvdir
storage/bdb/clib/memmove.c:
mvdir
storage/bdb/clib/raise.c:
mvdir
storage/bdb/clib/snprintf.c:
mvdir
storage/bdb/clib/strcasecmp.c:
mvdir
storage/bdb/clib/strdup.c:
mvdir
storage/bdb/clib/strerror.c:
mvdir
storage/bdb/clib/vsnprintf.c:
mvdir
storage/bdb/common/db_byteorder.c:
mvdir
storage/bdb/common/db_err.c:
mvdir
storage/bdb/common/db_getlong.c:
mvdir
storage/bdb/common/db_idspace.c:
mvdir
storage/bdb/common/db_log2.c:
mvdir
storage/bdb/common/util_arg.c:
mvdir
storage/bdb/common/util_cache.c:
mvdir
storage/bdb/common/util_log.c:
mvdir
storage/bdb/common/util_sig.c:
mvdir
storage/bdb/cxx/cxx_db.cpp:
mvdir
storage/bdb/cxx/cxx_dbc.cpp:
mvdir
storage/bdb/cxx/cxx_dbt.cpp:
mvdir
storage/bdb/cxx/cxx_env.cpp:
mvdir
storage/bdb/cxx/cxx_except.cpp:
mvdir
storage/bdb/cxx/cxx_lock.cpp:
mvdir
storage/bdb/cxx/cxx_logc.cpp:
mvdir
storage/bdb/cxx/cxx_mpool.cpp:
mvdir
storage/bdb/cxx/cxx_txn.cpp:
mvdir
storage/bdb/db/crdel.src:
mvdir
storage/bdb/db/crdel_rec.c:
mvdir
storage/bdb/db/db.c:
mvdir
storage/bdb/db/db.src:
mvdir
storage/bdb/db/db_am.c:
mvdir
storage/bdb/db/db_cam.c:
mvdir
storage/bdb/db/db_conv.c:
mvdir
storage/bdb/db/db_dispatch.c:
mvdir
storage/bdb/db/db_dup.c:
mvdir
storage/bdb/db/db_iface.c:
mvdir
storage/bdb/db/db_join.c:
mvdir
storage/bdb/db/db_meta.c:
mvdir
storage/bdb/db/db_method.c:
mvdir
storage/bdb/db/db_open.c:
mvdir
storage/bdb/db/db_overflow.c:
mvdir
storage/bdb/db/db_pr.c:
mvdir
storage/bdb/db/db_rec.c:
mvdir
storage/bdb/db/db_reclaim.c:
mvdir
storage/bdb/db/db_remove.c:
mvdir
storage/bdb/db/db_rename.c:
mvdir
storage/bdb/db/db_ret.c:
mvdir
storage/bdb/db/db_truncate.c:
mvdir
storage/bdb/db/db_upg.c:
mvdir
storage/bdb/db/db_upg_opd.c:
mvdir
storage/bdb/db/db_vrfy.c:
mvdir
storage/bdb/db/db_vrfyutil.c:
mvdir
storage/bdb/db185/db185.c:
mvdir
storage/bdb/db185/db185_int.in:
mvdir
storage/bdb/db_archive/db_archive.c:
mvdir
storage/bdb/db_checkpoint/db_checkpoint.c:
mvdir
storage/bdb/db_deadlock/db_deadlock.c:
mvdir
storage/bdb/db_dump/db_dump.c:
mvdir
storage/bdb/db_dump185/db_dump185.c:
mvdir
storage/bdb/db_load/db_load.c:
mvdir
storage/bdb/db_printlog/README:
mvdir
storage/bdb/db_printlog/commit.awk:
mvdir
storage/bdb/db_printlog/count.awk:
mvdir
storage/bdb/db_printlog/db_printlog.c:
mvdir
storage/bdb/db_printlog/dbname.awk:
mvdir
storage/bdb/db_printlog/fileid.awk:
mvdir
storage/bdb/db_printlog/logstat.awk:
mvdir
storage/bdb/db_printlog/pgno.awk:
mvdir
storage/bdb/db_printlog/range.awk:
mvdir
storage/bdb/db_printlog/rectype.awk:
mvdir
storage/bdb/db_printlog/status.awk:
mvdir
storage/bdb/db_printlog/txn.awk:
mvdir
storage/bdb/db_recover/db_recover.c:
mvdir
storage/bdb/db_stat/db_stat.c:
mvdir
storage/bdb/db_upgrade/db_upgrade.c:
mvdir
storage/bdb/db_verify/db_verify.c:
mvdir
storage/bdb/dbinc/btree.h:
mvdir
storage/bdb/dbinc/crypto.h:
mvdir
storage/bdb/dbinc/cxx_common.h:
mvdir
storage/bdb/dbinc/cxx_except.h:
mvdir
storage/bdb/dbinc/cxx_int.h:
mvdir
storage/bdb/dbinc/db.in:
mvdir
storage/bdb/dbinc/db_185.in:
mvdir
storage/bdb/dbinc/db_am.h:
mvdir
storage/bdb/dbinc/db_cxx.in:
mvdir
storage/bdb/dbinc/db_dispatch.h:
mvdir
storage/bdb/dbinc/db_int.in:
mvdir
storage/bdb/dbinc/db_join.h:
mvdir
storage/bdb/dbinc/db_page.h:
mvdir
storage/bdb/dbinc/db_server_int.h:
mvdir
storage/bdb/dbinc/db_shash.h:
mvdir
storage/bdb/dbinc/db_swap.h:
mvdir
storage/bdb/dbinc/db_upgrade.h:
mvdir
storage/bdb/dbinc/db_verify.h:
mvdir
storage/bdb/dbinc/debug.h:
mvdir
storage/bdb/dbinc/fop.h:
mvdir
storage/bdb/dbinc/globals.h:
mvdir
storage/bdb/dbinc/hash.h:
mvdir
storage/bdb/dbinc/hmac.h:
mvdir
storage/bdb/dbinc/lock.h:
mvdir
storage/bdb/dbinc/log.h:
mvdir
storage/bdb/dbinc/mp.h:
mvdir
storage/bdb/dbinc/mutex.h:
mvdir
storage/bdb/dbinc/os.h:
mvdir
storage/bdb/dbinc/qam.h:
mvdir
storage/bdb/dbinc/queue.h:
mvdir
storage/bdb/dbinc/region.h:
mvdir
storage/bdb/dbinc/rep.h:
mvdir
storage/bdb/dbinc/shqueue.h:
mvdir
storage/bdb/dbinc/tcl_db.h:
mvdir
storage/bdb/dbinc/txn.h:
mvdir
storage/bdb/dbinc/xa.h:
mvdir
storage/bdb/dbm/dbm.c:
mvdir
storage/bdb/dbreg/dbreg.c:
mvdir
storage/bdb/dbreg/dbreg.src:
mvdir
storage/bdb/dbreg/dbreg_rec.c:
mvdir
storage/bdb/dbreg/dbreg_util.c:
mvdir
storage/bdb/dist/Makefile.in:
mvdir
storage/bdb/dist/RELEASE:
mvdir
storage/bdb/dist/buildrel:
mvdir
storage/bdb/dist/config.guess:
mvdir
storage/bdb/dist/config.sub:
mvdir
storage/bdb/dist/configure.ac:
mvdir
storage/bdb/dist/db.ecd.in:
mvdir
storage/bdb/dist/db.spec.in:
mvdir
storage/bdb/dist/gen_inc.awk:
mvdir
storage/bdb/dist/gen_rec.awk:
mvdir
storage/bdb/dist/gen_rpc.awk:
mvdir
storage/bdb/dist/install-sh:
mvdir
storage/bdb/dist/ltmain.sh:
mvdir
storage/bdb/dist/pubdef.in:
mvdir
storage/bdb/dist/s_all:
mvdir
storage/bdb/dist/s_config:
mvdir
storage/bdb/dist/aclocal/config.ac:
mvdir
storage/bdb/dist/aclocal/cxx.ac:
mvdir
storage/bdb/dist/aclocal/gcc.ac:
mvdir
storage/bdb/dist/aclocal/libtool.ac:
mvdir
storage/bdb/dist/s_crypto:
mvdir
storage/bdb/dist/s_dir:
mvdir
storage/bdb/dist/s_include:
mvdir
storage/bdb/dist/s_javah:
mvdir
storage/bdb/dist/s_java:
mvdir
storage/bdb/dist/s_perm:
mvdir
storage/bdb/dist/s_readme:
mvdir
storage/bdb/dist/s_recover:
mvdir
storage/bdb/dist/s_rpc:
mvdir
storage/bdb/dist/s_symlink:
mvdir
storage/bdb/dist/s_tags:
mvdir
storage/bdb/dist/s_test:
mvdir
storage/bdb/dist/s_vxworks:
mvdir
storage/bdb/dist/s_win32_dsp:
mvdir
storage/bdb/dist/s_win32:
mvdir
storage/bdb/dist/srcfiles.in:
mvdir
storage/bdb/dist/vx_buildcd:
mvdir
storage/bdb/dist/vx_config.in:
mvdir
storage/bdb/dist/win_config.in:
mvdir
storage/bdb/dist/win_exports.in:
mvdir
storage/bdb/dist/aclocal/mutex.ac:
mvdir
storage/bdb/dist/aclocal/options.ac:
mvdir
storage/bdb/dist/aclocal/programs.ac:
mvdir
storage/bdb/dist/aclocal/sosuffix.ac:
mvdir
storage/bdb/dist/aclocal/tcl.ac:
mvdir
storage/bdb/dist/aclocal/types.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_check_class.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_check_classpath.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_check_junit.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_check_rqrd_class.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_java_options.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_jni_include_dirs.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_prog_jar.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_prog_java.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_prog_java_works.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_prog_javac.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_prog_javac_works.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_prog_javadoc.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_prog_javah.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_try_compile_java.ac:
mvdir
storage/bdb/dist/aclocal_java/ac_try_run_javac.ac:
mvdir
storage/bdb/dist/template/rec_ctemp:
mvdir
storage/bdb/dist/vx_2.0/BerkeleyDB.wpj:
mvdir
storage/bdb/dist/vx_2.0/wpj.in:
mvdir
storage/bdb/dist/vx_3.1/Makefile.custom:
mvdir
storage/bdb/dist/vx_3.1/cdf.1:
mvdir
storage/bdb/dist/vx_3.1/cdf.2:
mvdir
storage/bdb/dist/vx_3.1/cdf.3:
mvdir
storage/bdb/dist/vx_3.1/component.cdf:
mvdir
storage/bdb/dist/vx_3.1/component.wpj:
mvdir
storage/bdb/dist/vx_3.1/wpj.1:
mvdir
storage/bdb/dist/vx_3.1/wpj.2:
mvdir
storage/bdb/dist/vx_3.1/wpj.3:
mvdir
storage/bdb/dist/vx_3.1/wpj.4:
mvdir
storage/bdb/dist/vx_3.1/wpj.5:
mvdir
storage/bdb/dist/vx_setup/CONFIG.in:
mvdir
storage/bdb/dist/vx_setup/LICENSE.TXT:
mvdir
storage/bdb/dist/vx_setup/MESSAGES.TCL:
mvdir
storage/bdb/dist/vx_setup/README.in:
mvdir
storage/bdb/dist/vx_setup/SETUP.BMP:
mvdir
storage/bdb/dist/vx_setup/vx_allfile.in:
mvdir
storage/bdb/dist/vx_setup/vx_demofile.in:
mvdir
storage/bdb/dist/vx_setup/vx_setup.in:
mvdir
storage/bdb/env/db_salloc.c:
mvdir
storage/bdb/env/db_shash.c:
mvdir
storage/bdb/env/env_file.c:
mvdir
storage/bdb/env/env_method.c.b:
mvdir
storage/bdb/env/env_method.c:
mvdir
storage/bdb/env/env_open.c:
mvdir
storage/bdb/env/env_recover.c:
mvdir
storage/bdb/env/env_region.c:
mvdir
storage/bdb/fileops/fileops.src:
mvdir
storage/bdb/fileops/fop_basic.c:
mvdir
storage/bdb/fileops/fop_rec.c:
mvdir
storage/bdb/fileops/fop_util.c:
mvdir
storage/bdb/hash/hash.c:
mvdir
storage/bdb/hash/hash.src:
mvdir
storage/bdb/hash/hash_conv.c:
mvdir
storage/bdb/hash/hash_dup.c:
mvdir
storage/bdb/hash/hash_func.c:
mvdir
storage/bdb/hash/hash_meta.c:
mvdir
storage/bdb/hash/hash_method.c:
mvdir
storage/bdb/hash/hash_open.c:
mvdir
storage/bdb/hash/hash_page.c:
mvdir
storage/bdb/hash/hash_rec.c:
mvdir
storage/bdb/hash/hash_reclaim.c:
mvdir
storage/bdb/hash/hash_stat.c:
mvdir
storage/bdb/hash/hash_upgrade.c:
mvdir
storage/bdb/hash/hash_verify.c:
mvdir
storage/bdb/hmac/hmac.c:
mvdir
storage/bdb/hmac/sha1.c:
mvdir
storage/bdb/hsearch/hsearch.c:
mvdir
storage/bdb/libdb_java/checkapi.prl:
mvdir
storage/bdb/libdb_java/com_sleepycat_db_Db.h:
mvdir
storage/bdb/libdb_java/com_sleepycat_db_DbEnv.h:
mvdir
storage/bdb/libdb_java/com_sleepycat_db_DbLock.h:
mvdir
storage/bdb/libdb_java/com_sleepycat_db_DbLogc.h:
mvdir
storage/bdb/libdb_java/com_sleepycat_db_DbLsn.h:
mvdir
storage/bdb/libdb_java/com_sleepycat_db_DbTxn.h:
mvdir
storage/bdb/libdb_java/com_sleepycat_db_DbUtil.h:
mvdir
storage/bdb/libdb_java/com_sleepycat_db_Dbc.h:
mvdir
storage/bdb/libdb_java/com_sleepycat_db_Dbt.h:
mvdir
storage/bdb/libdb_java/com_sleepycat_db_xa_DbXAResource.h:
mvdir
storage/bdb/libdb_java/java_Db.c:
mvdir
storage/bdb/libdb_java/java_DbEnv.c:
mvdir
storage/bdb/libdb_java/java_DbLock.c:
mvdir
storage/bdb/libdb_java/java_DbLogc.c:
mvdir
storage/bdb/libdb_java/java_DbLsn.c:
mvdir
storage/bdb/libdb_java/java_DbTxn.c:
mvdir
storage/bdb/libdb_java/java_DbUtil.c:
mvdir
storage/bdb/libdb_java/java_DbXAResource.c:
mvdir
storage/bdb/libdb_java/java_Dbc.c:
mvdir
storage/bdb/libdb_java/java_Dbt.c:
mvdir
storage/bdb/libdb_java/java_info.c:
mvdir
storage/bdb/libdb_java/java_info.h:
mvdir
storage/bdb/libdb_java/java_locked.c:
mvdir
storage/bdb/libdb_java/java_locked.h:
mvdir
storage/bdb/libdb_java/java_util.c:
mvdir
storage/bdb/libdb_java/java_util.h:
mvdir
storage/bdb/lock/Design:
mvdir
storage/bdb/lock/lock.c:
mvdir
storage/bdb/lock/lock_deadlock.c:
mvdir
storage/bdb/lock/lock_method.c:
mvdir
storage/bdb/lock/lock_region.c:
mvdir
storage/bdb/lock/lock_stat.c:
mvdir
storage/bdb/lock/lock_util.c:
mvdir
storage/bdb/log/log.c:
mvdir
storage/bdb/log/log_archive.c:
mvdir
storage/bdb/log/log_compare.c:
mvdir
storage/bdb/log/log_get.c:
mvdir
storage/bdb/log/log_method.c:
mvdir
storage/bdb/log/log_put.c:
mvdir
storage/bdb/mp/mp_alloc.c:
mvdir
storage/bdb/mp/mp_bh.c:
mvdir
storage/bdb/mp/mp_fget.c:
mvdir
storage/bdb/mp/mp_fopen.c:
mvdir
storage/bdb/mp/mp_fput.c:
mvdir
storage/bdb/mp/mp_fset.c:
mvdir
storage/bdb/mp/mp_method.c:
mvdir
storage/bdb/mp/mp_region.c:
mvdir
storage/bdb/mp/mp_register.c:
mvdir
storage/bdb/mp/mp_stat.c:
mvdir
storage/bdb/mp/mp_sync.c:
mvdir
storage/bdb/mp/mp_trickle.c:
mvdir
storage/bdb/mutex/README:
mvdir
storage/bdb/mutex/mut_fcntl.c:
mvdir
storage/bdb/mutex/mut_pthread.c:
mvdir
storage/bdb/mutex/mut_tas.c:
mvdir
storage/bdb/mutex/mut_win32.c:
mvdir
storage/bdb/mutex/mutex.c:
mvdir
storage/bdb/mutex/tm.c:
mvdir
storage/bdb/mutex/uts4_cc.s:
mvdir
storage/bdb/os/os_abs.c:
mvdir
storage/bdb/os/os_alloc.c:
mvdir
storage/bdb/os/os_clock.c:
mvdir
storage/bdb/os/os_config.c:
mvdir
storage/bdb/os/os_dir.c:
mvdir
storage/bdb/os/os_errno.c:
mvdir
storage/bdb/os/os_fid.c:
mvdir
storage/bdb/os/os_fsync.c:
mvdir
storage/bdb/os/os_handle.c:
mvdir
storage/bdb/os/os_id.c:
mvdir
storage/bdb/os/os_map.c:
mvdir
storage/bdb/os/os_method.c:
mvdir
storage/bdb/os/os_oflags.c:
mvdir
storage/bdb/os/os_open.c:
mvdir
storage/bdb/os/os_region.c:
mvdir
storage/bdb/os/os_rename.c:
mvdir
storage/bdb/os/os_root.c:
mvdir
storage/bdb/os/os_rpath.c:
mvdir
storage/bdb/os/os_rw.c:
mvdir
storage/bdb/os/os_seek.c:
mvdir
storage/bdb/os/os_sleep.c:
mvdir
storage/bdb/os/os_spin.c:
mvdir
storage/bdb/os/os_stat.c:
mvdir
storage/bdb/os/os_tmpdir.c:
mvdir
storage/bdb/os/os_unlink.c:
mvdir
storage/bdb/os_vxworks/os_vx_abs.c:
mvdir
storage/bdb/os_vxworks/os_vx_config.c:
mvdir
storage/bdb/os_vxworks/os_vx_map.c:
mvdir
storage/bdb/os_win32/os_abs.c:
mvdir
storage/bdb/os_win32/os_clock.c:
mvdir
storage/bdb/os_win32/os_config.c:
mvdir
storage/bdb/os_win32/os_dir.c:
mvdir
storage/bdb/os_win32/os_errno.c:
mvdir
storage/bdb/os_win32/os_fid.c:
mvdir
storage/bdb/os_win32/os_fsync.c:
mvdir
storage/bdb/os_win32/os_handle.c:
mvdir
storage/bdb/os_win32/os_map.c:
mvdir
storage/bdb/os_win32/os_open.c:
mvdir
storage/bdb/os_win32/os_rename.c:
mvdir
storage/bdb/os_win32/os_rw.c:
mvdir
storage/bdb/os_win32/os_seek.c:
mvdir
storage/bdb/os_win32/os_sleep.c:
mvdir
storage/bdb/os_win32/os_spin.c:
mvdir
storage/bdb/os_win32/os_stat.c:
mvdir
storage/bdb/os_win32/os_type.c:
mvdir
storage/bdb/perl/BerkeleyDB/BerkeleyDB.pm:
mvdir
storage/bdb/perl/BerkeleyDB/BerkeleyDB.pod.P:
mvdir
storage/bdb/perl/BerkeleyDB/BerkeleyDB.pod:
mvdir
storage/bdb/perl/BerkeleyDB/BerkeleyDB.xs:
mvdir
storage/bdb/perl/BerkeleyDB/Changes:
mvdir
storage/bdb/perl/BerkeleyDB/MANIFEST:
mvdir
storage/bdb/perl/BerkeleyDB/Makefile.PL:
mvdir
storage/bdb/perl/BerkeleyDB/README:
mvdir
storage/bdb/perl/BerkeleyDB/Todo:
mvdir
storage/bdb/perl/BerkeleyDB/config.in:
mvdir
storage/bdb/perl/BerkeleyDB/constants.h:
mvdir
storage/bdb/perl/BerkeleyDB/constants.xs:
mvdir
storage/bdb/perl/BerkeleyDB/dbinfo:
mvdir
storage/bdb/perl/BerkeleyDB/mkconsts:
mvdir
storage/bdb/perl/BerkeleyDB/mkpod:
mvdir
storage/bdb/perl/BerkeleyDB/BerkeleyDB/Btree.pm:
mvdir
storage/bdb/perl/BerkeleyDB/BerkeleyDB/Hash.pm:
mvdir
storage/bdb/perl/BerkeleyDB/hints/dec_osf.pl:
mvdir
storage/bdb/perl/BerkeleyDB/hints/irix_6_5.pl:
mvdir
storage/bdb/perl/BerkeleyDB/hints/solaris.pl:
mvdir
storage/bdb/perl/BerkeleyDB/patches/5.004_01:
mvdir
storage/bdb/perl/BerkeleyDB/patches/5.004_02:
mvdir
storage/bdb/perl/BerkeleyDB/patches/5.004_03:
mvdir
storage/bdb/perl/BerkeleyDB/patches/5.004_04:
mvdir
storage/bdb/perl/BerkeleyDB/patches/5.004_05:
mvdir
storage/bdb/perl/BerkeleyDB/patches/5.004:
mvdir
storage/bdb/perl/BerkeleyDB/patches/5.005_01:
mvdir
storage/bdb/perl/BerkeleyDB/patches/5.005_02:
mvdir
storage/bdb/perl/BerkeleyDB/patches/5.005_03:
mvdir
storage/bdb/perl/BerkeleyDB/patches/5.005:
mvdir
storage/bdb/perl/BerkeleyDB/patches/5.6.0:
mvdir
storage/bdb/perl/BerkeleyDB/ppport.h:
mvdir
storage/bdb/perl/BerkeleyDB/scan:
mvdir
storage/bdb/perl/BerkeleyDB/t/btree.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/destroy.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/env.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/examples.t.T:
mvdir
storage/bdb/perl/BerkeleyDB/t/examples.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/examples3.t.T:
mvdir
storage/bdb/perl/BerkeleyDB/t/examples3.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/filter.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/hash.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/join.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/mldbm.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/queue.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/recno.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/strict.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/subdb.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/txn.t:
mvdir
storage/bdb/perl/BerkeleyDB/typemap:
mvdir
storage/bdb/perl/BerkeleyDB/t/unknown.t:
mvdir
storage/bdb/perl/BerkeleyDB/t/util.pm:
mvdir
storage/bdb/perl/DB_File/Changes:
mvdir
storage/bdb/perl/DB_File/DB_File.pm:
mvdir
storage/bdb/perl/DB_File/DB_File.xs:
mvdir
storage/bdb/perl/DB_File/DB_File_BS:
mvdir
storage/bdb/perl/DB_File/MANIFEST:
mvdir
storage/bdb/perl/DB_File/Makefile.PL:
mvdir
storage/bdb/perl/DB_File/README:
mvdir
storage/bdb/perl/DB_File/config.in:
mvdir
storage/bdb/perl/DB_File/dbinfo:
mvdir
storage/bdb/perl/DB_File/fallback.h:
mvdir
storage/bdb/perl/DB_File/fallback.xs:
mvdir
storage/bdb/perl/DB_File/hints/dynixptx.pl:
mvdir
storage/bdb/perl/DB_File/hints/sco.pl:
mvdir
storage/bdb/perl/DB_File/patches/5.004_01:
mvdir
storage/bdb/perl/DB_File/patches/5.004_02:
mvdir
storage/bdb/perl/DB_File/patches/5.004_03:
mvdir
storage/bdb/perl/DB_File/patches/5.004_04:
mvdir
storage/bdb/perl/DB_File/patches/5.004_05:
mvdir
storage/bdb/perl/DB_File/patches/5.004:
mvdir
storage/bdb/perl/DB_File/patches/5.005_01:
mvdir
storage/bdb/perl/DB_File/patches/5.005_02:
mvdir
storage/bdb/perl/DB_File/patches/5.005_03:
mvdir
storage/bdb/perl/DB_File/patches/5.005:
mvdir
storage/bdb/perl/DB_File/patches/5.6.0:
mvdir
storage/bdb/perl/DB_File/ppport.h:
mvdir
storage/bdb/perl/DB_File/t/db-btree.t:
mvdir
storage/bdb/perl/DB_File/t/db-hash.t:
mvdir
storage/bdb/perl/DB_File/t/db-recno.t:
mvdir
storage/bdb/perl/DB_File/typemap:
mvdir
storage/bdb/perl/DB_File/version.c:
mvdir
storage/bdb/qam/qam.c:
mvdir
storage/bdb/qam/qam.src:
mvdir
storage/bdb/qam/qam_conv.c:
mvdir
storage/bdb/qam/qam_files.c:
mvdir
storage/bdb/qam/qam_method.c:
mvdir
storage/bdb/qam/qam_open.c:
mvdir
storage/bdb/qam/qam_rec.c:
mvdir
storage/bdb/qam/qam_stat.c:
mvdir
storage/bdb/qam/qam_upgrade.c:
mvdir
storage/bdb/qam/qam_verify.c:
mvdir
storage/bdb/rep/rep_method.c:
mvdir
storage/bdb/rep/rep_record.c:
mvdir
storage/bdb/rep/rep_region.c:
mvdir
storage/bdb/rep/rep_util.c:
mvdir
storage/bdb/rpc_client/client.c:
mvdir
storage/bdb/rpc_client/gen_client_ret.c:
mvdir
storage/bdb/rpc_server/c/db_server_proc.c.in:
mvdir
storage/bdb/rpc_server/c/db_server_util.c:
mvdir
storage/bdb/rpc_server/clsrv.html:
mvdir
storage/bdb/rpc_server/cxx/db_server_cxxproc.cpp:
mvdir
storage/bdb/rpc_server/cxx/db_server_cxxutil.cpp:
mvdir
storage/bdb/rpc_server/java/DbDispatcher.java:
mvdir
storage/bdb/rpc_server/java/DbServer.java:
mvdir
storage/bdb/rpc_server/java/FreeList.java:
mvdir
storage/bdb/rpc_server/java/LocalIterator.java:
mvdir
storage/bdb/rpc_server/java/README:
mvdir
storage/bdb/rpc_server/java/RpcDb.java:
mvdir
storage/bdb/rpc_server/java/RpcDbEnv.java:
mvdir
storage/bdb/rpc_server/java/RpcDbTxn.java:
mvdir
storage/bdb/rpc_server/java/RpcDbc.java:
mvdir
storage/bdb/rpc_server/java/Timer.java:
mvdir
storage/bdb/rpc_server/java/jrpcgen.jar:
mvdir
storage/bdb/rpc_server/java/oncrpc.jar:
mvdir
storage/bdb/rpc_server/rpc.src:
mvdir
storage/bdb/rpc_server/java/gen/DbServerStub.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_associate_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_associate_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_bt_maxkey_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_bt_maxkey_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_bt_minkey_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_bt_minkey_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_close_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_close_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_create_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_create_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_cursor_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_cursor_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_del_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_del_reply.java:
mvdir
storage/bdb/rpc_server/java/s_jrpcgen:
mvdir
storage/bdb/rpc_server/java/gen/__db_encrypt_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_encrypt_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_extentsize_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_extentsize_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_flags_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_flags_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_get_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_get_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_h_ffactor_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_h_ffactor_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_h_nelem_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_h_nelem_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_join_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_join_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_key_range_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_key_range_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_lorder_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_lorder_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_open_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_open_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_pagesize_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_pagesize_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_pget_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_pget_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_put_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_put_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_re_delim_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_re_delim_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_re_len_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_re_len_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_re_pad_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_re_pad_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_remove_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_remove_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_rename_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_rename_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_stat_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_stat_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_sync_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_sync_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_truncate_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__db_truncate_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_close_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_close_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_count_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_count_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_del_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_del_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_dup_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_dup_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_get_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_get_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_pget_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_pget_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_put_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__dbc_put_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_cachesize_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_cachesize_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_close_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_close_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_create_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_create_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_dbremove_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_dbremove_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_dbrename_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_dbrename_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_encrypt_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_encrypt_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_flags_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_flags_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_open_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_open_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_remove_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__env_remove_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_abort_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_abort_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_begin_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_begin_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_commit_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_commit_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_discard_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_discard_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_prepare_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_prepare_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_recover_msg.java:
mvdir
storage/bdb/rpc_server/java/gen/__txn_recover_reply.java:
mvdir
storage/bdb/rpc_server/java/gen/db_server.java:
mvdir
storage/bdb/tcl/tcl_compat.c:
mvdir
storage/bdb/tcl/tcl_db.c:
mvdir
storage/bdb/tcl/tcl_db_pkg.c:
mvdir
storage/bdb/tcl/docs/db.html:
mvdir
storage/bdb/tcl/docs/env.html:
mvdir
storage/bdb/tcl/docs/historic.html:
mvdir
storage/bdb/tcl/docs/index.html:
mvdir
storage/bdb/tcl/docs/library.html:
mvdir
storage/bdb/tcl/docs/lock.html:
mvdir
storage/bdb/tcl/docs/log.html:
mvdir
storage/bdb/tcl/docs/mpool.html:
mvdir
storage/bdb/tcl/docs/rep.html:
mvdir
storage/bdb/tcl/docs/test.html:
mvdir
storage/bdb/tcl/docs/txn.html:
mvdir
storage/bdb/tcl/tcl_dbcursor.c:
mvdir
storage/bdb/tcl/tcl_env.c:
mvdir
storage/bdb/tcl/tcl_internal.c:
mvdir
storage/bdb/tcl/tcl_lock.c:
mvdir
storage/bdb/tcl/tcl_log.c:
mvdir
storage/bdb/tcl/tcl_mp.c:
mvdir
storage/bdb/tcl/tcl_rep.c:
mvdir
storage/bdb/tcl/tcl_txn.c:
mvdir
storage/bdb/tcl/tcl_util.c:
mvdir
storage/bdb/test/archive.tcl:
mvdir
storage/bdb/test/bigfile001.tcl:
mvdir
storage/bdb/test/bigfile002.tcl:
mvdir
storage/bdb/test/byteorder.tcl:
mvdir
storage/bdb/test/conscript.tcl:
mvdir
storage/bdb/test/dbm.tcl:
mvdir
storage/bdb/test/dbscript.tcl:
mvdir
storage/bdb/test/ddoyscript.tcl:
mvdir
storage/bdb/test/ddscript.tcl:
mvdir
storage/bdb/test/dead001.tcl:
mvdir
storage/bdb/test/dead002.tcl:
mvdir
storage/bdb/test/dead003.tcl:
mvdir
storage/bdb/test/dead004.tcl:
mvdir
storage/bdb/test/dead005.tcl:
mvdir
storage/bdb/test/dead006.tcl:
mvdir
storage/bdb/test/dead007.tcl:
mvdir
storage/bdb/test/env001.tcl:
mvdir
storage/bdb/test/env002.tcl:
mvdir
storage/bdb/test/env003.tcl:
mvdir
storage/bdb/test/env004.tcl:
mvdir
storage/bdb/test/env005.tcl:
mvdir
storage/bdb/test/env006.tcl:
mvdir
storage/bdb/test/env007.tcl:
mvdir
storage/bdb/test/env008.tcl:
mvdir
storage/bdb/test/env009.tcl:
mvdir
storage/bdb/test/env010.tcl:
mvdir
storage/bdb/test/env011.tcl:
mvdir
storage/bdb/test/hsearch.tcl:
mvdir
storage/bdb/test/join.tcl:
mvdir
storage/bdb/test/lock001.tcl:
mvdir
storage/bdb/test/lock002.tcl:
mvdir
storage/bdb/test/lock003.tcl:
mvdir
storage/bdb/test/lock004.tcl:
mvdir
storage/bdb/test/lock005.tcl:
mvdir
storage/bdb/test/lockscript.tcl:
mvdir
storage/bdb/test/log001.tcl:
mvdir
storage/bdb/test/log002.tcl:
mvdir
storage/bdb/test/log003.tcl:
mvdir
storage/bdb/test/log004.tcl:
mvdir
storage/bdb/test/log005.tcl:
mvdir
storage/bdb/test/logtrack.tcl:
mvdir
storage/bdb/test/mdbscript.tcl:
mvdir
storage/bdb/test/memp001.tcl:
mvdir
storage/bdb/test/memp002.tcl:
mvdir
storage/bdb/test/memp003.tcl:
mvdir
storage/bdb/test/mpoolscript.tcl:
mvdir
storage/bdb/test/mutex001.tcl:
mvdir
storage/bdb/test/mutex002.tcl:
mvdir
storage/bdb/test/mutex003.tcl:
mvdir
storage/bdb/test/mutexscript.tcl:
mvdir
storage/bdb/test/ndbm.tcl:
mvdir
storage/bdb/test/parallel.tcl:
mvdir
storage/bdb/test/recd001.tcl:
mvdir
storage/bdb/test/recd002.tcl:
mvdir
storage/bdb/test/recd003.tcl:
mvdir
storage/bdb/test/recd004.tcl:
mvdir
storage/bdb/test/recd005.tcl:
mvdir
storage/bdb/test/recd006.tcl:
mvdir
storage/bdb/test/recd007.tcl:
mvdir
storage/bdb/test/recd008.tcl:
mvdir
storage/bdb/test/recd009.tcl:
mvdir
storage/bdb/test/recd010.tcl:
mvdir
storage/bdb/test/recd011.tcl:
mvdir
storage/bdb/test/recd012.tcl:
mvdir
storage/bdb/test/recd013.tcl:
mvdir
storage/bdb/test/recd014.tcl:
mvdir
storage/bdb/test/recd015.tcl:
mvdir
storage/bdb/test/recd016.tcl:
mvdir
storage/bdb/test/recd017.tcl:
mvdir
storage/bdb/test/recd018.tcl:
mvdir
storage/bdb/test/recd019.tcl:
mvdir
storage/bdb/test/recd020.tcl:
mvdir
storage/bdb/test/recd15scr.tcl:
mvdir
storage/bdb/test/recdscript.tcl:
mvdir
storage/bdb/test/rep001.tcl:
mvdir
storage/bdb/test/rep002.tcl:
mvdir
storage/bdb/test/rep003.tcl:
mvdir
storage/bdb/test/rep004.tcl:
mvdir
storage/bdb/test/rep005.tcl:
mvdir
storage/bdb/test/reputils.tcl:
mvdir
storage/bdb/test/rpc001.tcl:
mvdir
storage/bdb/test/rpc002.tcl:
mvdir
storage/bdb/test/rpc003.tcl:
mvdir
storage/bdb/test/rpc004.tcl:
mvdir
storage/bdb/test/rpc005.tcl:
mvdir
storage/bdb/test/rsrc001.tcl:
mvdir
storage/bdb/test/rsrc002.tcl:
mvdir
storage/bdb/test/rsrc003.tcl:
mvdir
storage/bdb/test/rsrc004.tcl:
mvdir
storage/bdb/test/sdb001.tcl:
mvdir
storage/bdb/test/sdb002.tcl:
mvdir
storage/bdb/test/sdb003.tcl:
mvdir
storage/bdb/test/sdb004.tcl:
mvdir
storage/bdb/test/sdb005.tcl:
mvdir
storage/bdb/test/sdb006.tcl:
mvdir
storage/bdb/test/sdb007.tcl:
mvdir
storage/bdb/test/sdb008.tcl:
mvdir
storage/bdb/test/sdb009.tcl:
mvdir
storage/bdb/test/sdb010.tcl:
mvdir
storage/bdb/test/sdb011.tcl:
mvdir
storage/bdb/test/sdb012.tcl:
mvdir
storage/bdb/test/sdbscript.tcl:
mvdir
storage/bdb/test/sdbtest001.tcl:
mvdir
storage/bdb/test/sdbtest002.tcl:
mvdir
storage/bdb/test/sdbutils.tcl:
mvdir
storage/bdb/test/sec001.tcl:
mvdir
storage/bdb/test/sec002.tcl:
mvdir
storage/bdb/test/shelltest.tcl:
mvdir
storage/bdb/test/si001.tcl:
mvdir
storage/bdb/test/si002.tcl:
mvdir
storage/bdb/test/si003.tcl:
mvdir
storage/bdb/test/si004.tcl:
mvdir
storage/bdb/test/si005.tcl:
mvdir
storage/bdb/test/si006.tcl:
mvdir
storage/bdb/test/sindex.tcl:
mvdir
storage/bdb/test/sysscript.tcl:
mvdir
storage/bdb/test/test.tcl:
mvdir
storage/bdb/test/test001.tcl:
mvdir
storage/bdb/test/test002.tcl:
mvdir
storage/bdb/test/test003.tcl:
mvdir
storage/bdb/test/test004.tcl:
mvdir
storage/bdb/test/test005.tcl:
mvdir
storage/bdb/test/test006.tcl:
mvdir
storage/bdb/test/test007.tcl:
mvdir
storage/bdb/test/test008.tcl:
mvdir
storage/bdb/test/test009.tcl:
mvdir
storage/bdb/test/test010.tcl:
mvdir
storage/bdb/test/test011.tcl:
mvdir
storage/bdb/test/test012.tcl:
mvdir
storage/bdb/test/test013.tcl:
mvdir
storage/bdb/test/test014.tcl:
mvdir
storage/bdb/test/test015.tcl:
mvdir
storage/bdb/test/test016.tcl:
mvdir
storage/bdb/test/test017.tcl:
mvdir
storage/bdb/test/test018.tcl:
mvdir
storage/bdb/test/test019.tcl:
mvdir
storage/bdb/test/test020.tcl:
mvdir
storage/bdb/test/test021.tcl:
mvdir
storage/bdb/test/test022.tcl:
mvdir
storage/bdb/test/test023.tcl:
mvdir
storage/bdb/test/test024.tcl:
mvdir
storage/bdb/test/test025.tcl:
mvdir
storage/bdb/test/test026.tcl:
mvdir
storage/bdb/test/test027.tcl:
mvdir
storage/bdb/test/test028.tcl:
mvdir
storage/bdb/test/test029.tcl:
mvdir
storage/bdb/test/test030.tcl:
mvdir
storage/bdb/test/test031.tcl:
mvdir
storage/bdb/test/test032.tcl:
mvdir
storage/bdb/test/test033.tcl:
mvdir
storage/bdb/test/test034.tcl:
mvdir
storage/bdb/test/test035.tcl:
mvdir
storage/bdb/test/test036.tcl:
mvdir
storage/bdb/test/test037.tcl:
mvdir
storage/bdb/test/test038.tcl:
mvdir
storage/bdb/test/test039.tcl:
mvdir
storage/bdb/test/test040.tcl:
mvdir
storage/bdb/test/test041.tcl:
mvdir
storage/bdb/test/test042.tcl:
mvdir
storage/bdb/test/test043.tcl:
mvdir
storage/bdb/test/test044.tcl:
mvdir
storage/bdb/test/test045.tcl:
mvdir
storage/bdb/test/test046.tcl:
mvdir
storage/bdb/test/test047.tcl:
mvdir
storage/bdb/test/test048.tcl:
mvdir
storage/bdb/test/test049.tcl:
mvdir
storage/bdb/test/test050.tcl:
mvdir
storage/bdb/test/test051.tcl:
mvdir
storage/bdb/test/test052.tcl:
mvdir
storage/bdb/test/test053.tcl:
mvdir
storage/bdb/test/test054.tcl:
mvdir
storage/bdb/test/test055.tcl:
mvdir
storage/bdb/test/test056.tcl:
mvdir
storage/bdb/test/test057.tcl:
mvdir
storage/bdb/test/test058.tcl:
mvdir
storage/bdb/test/test059.tcl:
mvdir
storage/bdb/test/test060.tcl:
mvdir
storage/bdb/test/test061.tcl:
mvdir
storage/bdb/test/test062.tcl:
mvdir
storage/bdb/test/test063.tcl:
mvdir
storage/bdb/test/test064.tcl:
mvdir
storage/bdb/test/test065.tcl:
mvdir
storage/bdb/test/test066.tcl:
mvdir
storage/bdb/test/test067.tcl:
mvdir
storage/bdb/test/test068.tcl:
mvdir
storage/bdb/test/test069.tcl:
mvdir
storage/bdb/test/test070.tcl:
mvdir
storage/bdb/test/test071.tcl:
mvdir
storage/bdb/test/test072.tcl:
mvdir
storage/bdb/test/test073.tcl:
mvdir
storage/bdb/test/test074.tcl:
mvdir
storage/bdb/test/test075.tcl:
mvdir
storage/bdb/test/test076.tcl:
mvdir
storage/bdb/test/test077.tcl:
mvdir
storage/bdb/test/test078.tcl:
mvdir
storage/bdb/test/test079.tcl:
mvdir
storage/bdb/test/test080.tcl:
mvdir
storage/bdb/test/test081.tcl:
mvdir
storage/bdb/test/test082.tcl:
mvdir
storage/bdb/test/test083.tcl:
mvdir
storage/bdb/test/test084.tcl:
mvdir
storage/bdb/test/test085.tcl:
mvdir
storage/bdb/test/test086.tcl:
mvdir
storage/bdb/test/test087.tcl:
mvdir
storage/bdb/test/test088.tcl:
mvdir
storage/bdb/test/test089.tcl:
mvdir
storage/bdb/test/test090.tcl:
mvdir
storage/bdb/test/test091.tcl:
mvdir
storage/bdb/test/test092.tcl:
mvdir
storage/bdb/test/test093.tcl:
mvdir
storage/bdb/test/test094.tcl:
mvdir
storage/bdb/test/test095.tcl:
mvdir
storage/bdb/test/test096.tcl:
mvdir
storage/bdb/test/test097.tcl:
mvdir
storage/bdb/test/test098.tcl:
mvdir
storage/bdb/test/test099.tcl:
mvdir
storage/bdb/test/test100.tcl:
mvdir
storage/bdb/test/test101.tcl:
mvdir
storage/bdb/test/testparams.tcl:
mvdir
storage/bdb/test/testutils.tcl:
mvdir
storage/bdb/test/txn001.tcl:
mvdir
storage/bdb/test/txn002.tcl:
mvdir
storage/bdb/test/txn003.tcl:
mvdir
storage/bdb/test/txn004.tcl:
mvdir
storage/bdb/test/txn005.tcl:
mvdir
storage/bdb/test/txn006.tcl:
mvdir
storage/bdb/test/txn007.tcl:
mvdir
storage/bdb/test/txn008.tcl:
mvdir
storage/bdb/test/txn009.tcl:
mvdir
storage/bdb/test/txnscript.tcl:
mvdir
storage/bdb/test/update.tcl:
mvdir
storage/bdb/test/scr001/chk.code:
mvdir
storage/bdb/test/scr002/chk.def:
mvdir
storage/bdb/test/scr003/chk.define:
mvdir
storage/bdb/test/scr004/chk.javafiles:
mvdir
storage/bdb/test/scr005/chk.nl:
mvdir
storage/bdb/test/scr006/chk.offt:
mvdir
storage/bdb/test/scr007/chk.proto:
mvdir
storage/bdb/test/scr008/chk.pubdef:
mvdir
storage/bdb/test/scr009/chk.srcfiles:
mvdir
storage/bdb/test/scr010/chk.str:
mvdir
storage/bdb/test/scr010/spell.ok:
mvdir
storage/bdb/test/scr011/chk.tags:
mvdir
storage/bdb/test/scr012/chk.vx_code:
mvdir
storage/bdb/test/scr013/chk.stats:
mvdir
storage/bdb/test/scr014/chk.err:
mvdir
storage/bdb/test/scr015/README:
mvdir
storage/bdb/test/scr015/TestConstruct01.cpp:
mvdir
storage/bdb/test/scr015/TestConstruct01.testerr:
mvdir
storage/bdb/test/scr015/TestConstruct01.testout:
mvdir
storage/bdb/test/scr015/TestExceptInclude.cpp:
mvdir
storage/bdb/test/scr015/TestGetSetMethods.cpp:
mvdir
storage/bdb/test/scr015/TestKeyRange.cpp:
mvdir
storage/bdb/test/scr015/TestKeyRange.testin:
mvdir
storage/bdb/test/scr015/TestKeyRange.testout:
mvdir
storage/bdb/test/upgrade.tcl:
mvdir
storage/bdb/test/wordlist:
mvdir
storage/bdb/test/wrap.tcl:
mvdir
storage/bdb/test/scr015/TestLogc.cpp:
mvdir
storage/bdb/test/scr015/TestLogc.testout:
mvdir
storage/bdb/test/scr015/TestSimpleAccess.cpp:
mvdir
storage/bdb/test/scr015/TestSimpleAccess.testout:
mvdir
storage/bdb/test/scr015/TestTruncate.cpp:
mvdir
storage/bdb/test/scr015/TestTruncate.testout:
mvdir
storage/bdb/test/scr015/chk.cxxtests:
mvdir
storage/bdb/test/scr015/ignore:
mvdir
storage/bdb/test/scr015/testall:
mvdir
storage/bdb/test/scr015/testone:
mvdir
storage/bdb/test/scr016/CallbackTest.java:
mvdir
storage/bdb/test/scr016/CallbackTest.testout:
mvdir
storage/bdb/test/scr016/README:
mvdir
storage/bdb/test/scr016/TestAppendRecno.java:
mvdir
storage/bdb/test/scr016/TestAppendRecno.testout:
mvdir
storage/bdb/test/scr016/TestAssociate.java:
mvdir
storage/bdb/test/scr016/TestAssociate.testout:
mvdir
storage/bdb/test/scr016/TestClosedDb.java:
mvdir
storage/bdb/test/scr016/TestClosedDb.testout:
mvdir
storage/bdb/test/scr016/TestConstruct01.java:
mvdir
storage/bdb/test/scr016/TestConstruct01.testerr:
mvdir
storage/bdb/test/scr016/TestConstruct01.testout:
mvdir
storage/bdb/test/scr016/TestConstruct02.java:
mvdir
storage/bdb/test/scr016/TestConstruct02.testout:
mvdir
storage/bdb/test/scr016/TestDbtFlags.java:
mvdir
storage/bdb/test/scr016/TestDbtFlags.testerr:
mvdir
storage/bdb/test/scr016/TestDbtFlags.testout:
mvdir
storage/bdb/test/scr016/TestGetSetMethods.java:
mvdir
storage/bdb/test/scr016/TestKeyRange.java:
mvdir
storage/bdb/test/scr016/TestKeyRange.testout:
mvdir
storage/bdb/test/scr016/TestLockVec.java:
mvdir
storage/bdb/test/scr016/TestLockVec.testout:
mvdir
storage/bdb/test/scr016/TestLogc.java:
mvdir
storage/bdb/test/scr016/TestLogc.testout:
mvdir
storage/bdb/test/scr016/TestOpenEmpty.java:
mvdir
storage/bdb/test/scr016/TestOpenEmpty.testerr:
mvdir
storage/bdb/test/scr016/TestReplication.java:
mvdir
storage/bdb/test/scr016/TestRpcServer.java:
mvdir
storage/bdb/test/scr016/TestSameDbt.java:
mvdir
storage/bdb/test/scr016/TestSameDbt.testout:
mvdir
storage/bdb/test/scr016/TestSimpleAccess.java:
mvdir
storage/bdb/test/scr016/TestSimpleAccess.testout:
mvdir
storage/bdb/test/scr016/TestStat.java:
mvdir
storage/bdb/test/scr016/TestStat.testout:
mvdir
storage/bdb/test/scr016/TestTruncate.java:
mvdir
storage/bdb/test/scr016/TestTruncate.testout:
mvdir
storage/bdb/test/scr016/TestUtil.java:
mvdir
storage/bdb/test/scr016/TestXAServlet.java:
mvdir
storage/bdb/test/scr016/chk.javatests:
mvdir
storage/bdb/test/scr016/ignore:
mvdir
storage/bdb/test/scr016/testall:
mvdir
storage/bdb/test/scr016/testone:
mvdir
storage/bdb/test/scr017/O.BH:
mvdir
storage/bdb/test/scr017/O.R:
mvdir
storage/bdb/test/scr017/chk.db185:
mvdir
storage/bdb/test/scr017/t.c:
mvdir
storage/bdb/test/scr018/chk.comma:
mvdir
storage/bdb/test/scr018/t.c:
mvdir
storage/bdb/test/scr019/chk.include:
mvdir
storage/bdb/test/scr020/chk.inc:
mvdir
storage/bdb/test/scr021/chk.flags:
mvdir
storage/bdb/test/scr022/chk.rr:
mvdir
storage/bdb/txn/txn.c:
mvdir
storage/bdb/txn/txn.src:
mvdir
storage/bdb/txn/txn_method.c:
mvdir
storage/bdb/txn/txn_rec.c:
mvdir
storage/bdb/txn/txn_recover.c:
mvdir
storage/bdb/txn/txn_region.c:
mvdir
storage/bdb/txn/txn_stat.c:
mvdir
storage/bdb/txn/txn_util.c:
mvdir
storage/bdb/xa/xa.c:
mvdir
storage/bdb/xa/xa_db.c:
mvdir
storage/bdb/xa/xa_map.c:
mvdir
Diffstat (limited to 'ndb/src/ndbapi')
53 files changed, 0 insertions, 28138 deletions
diff --git a/ndb/src/ndbapi/API.hpp b/ndb/src/ndbapi/API.hpp deleted file mode 100644 index 05e2d863cb6..00000000000 --- a/ndb/src/ndbapi/API.hpp +++ /dev/null @@ -1,26 +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 API_H -#define API_H - -#include <BlockNumbers.h> -#include <GlobalSignalNumbers.h> -#include <RefConvert.hpp> -#include "NdbImpl.hpp" -#include "NdbDictionaryImpl.hpp" - -#endif diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp deleted file mode 100644 index 71938e27037..00000000000 --- a/ndb/src/ndbapi/ClusterMgr.cpp +++ /dev/null @@ -1,820 +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 */ - -#include <ndb_global.h> -#include <my_pthread.h> -#include <ndb_limits.h> -#include <ndb_version.h> - -#include "TransporterFacade.hpp" -#include "ClusterMgr.hpp" -#include <IPCConfig.hpp> -#include "NdbApiSignal.hpp" -#include "API.hpp" -#include <NdbSleep.h> -#include <NdbOut.hpp> -#include <NdbTick.h> - - -#include <signaldata/NodeFailRep.hpp> -#include <signaldata/NFCompleteRep.hpp> -#include <signaldata/ApiRegSignalData.hpp> - -#include <mgmapi.h> -#include <mgmapi_configuration.hpp> -#include <mgmapi_config_parameters.h> - -int global_flag_send_heartbeat_now= 0; - -// Just a C wrapper for threadMain -extern "C" -void* -runClusterMgr_C(void * me) -{ - ((ClusterMgr*) me)->threadMain(); - /** - * Sleep to allow another thread that is not exiting to take control - * of signals allocated by this thread - * - * see Ndb::~Ndb() in Ndbinit.cpp - */ -#ifdef NDB_OSE - NdbSleep_MilliSleep(50); -#endif - return NULL; -} - -extern "C" { - void ndbSetOwnVersion(); -} -ClusterMgr::ClusterMgr(TransporterFacade & _facade): - theStop(0), - theFacade(_facade) -{ - ndbSetOwnVersion(); - clusterMgrThreadMutex = NdbMutex_Create(); - noOfConnectedNodes= 0; - theClusterMgrThread= 0; -} - -ClusterMgr::~ClusterMgr(){ - doStop(); - NdbMutex_Destroy(clusterMgrThreadMutex); -} - -void -ClusterMgr::init(ndb_mgm_configuration_iterator & iter){ - for(iter.first(); iter.valid(); iter.next()){ - Uint32 tmp = 0; - if(iter.get(CFG_NODE_ID, &tmp)) - continue; - - theNodes[tmp].defined = true; -#if 0 - ndbout << "--------------------------------------" << endl; - ndbout << "--------------------------------------" << endl; - ndbout_c("ClusterMgr: Node %d defined as %s", tmp, config.getNodeType(tmp)); -#endif - - unsigned type; - if(iter.get(CFG_TYPE_OF_SECTION, &type)) - continue; - - switch(type){ - case NODE_TYPE_DB: - theNodes[tmp].m_info.m_type = NodeInfo::DB; - break; - case NODE_TYPE_API: - theNodes[tmp].m_info.m_type = NodeInfo::API; - break; - case NODE_TYPE_MGM: - theNodes[tmp].m_info.m_type = NodeInfo::MGM; - break; - case NODE_TYPE_REP: - theNodes[tmp].m_info.m_type = NodeInfo::REP; - break; - case NODE_TYPE_EXT_REP: - theNodes[tmp].m_info.m_type = NodeInfo::REP; - { - Uint32 hbFreq = 10000; - //ndb_mgm_get_int_parameter(iter, CFG_, &hbFreq); - theNodes[tmp].hbFrequency = hbFreq; - assert(100 <= hbFreq && hbFreq < 60 * 60 * 1000); - } - break; - default: - type = type; -#if 0 - ndbout_c("ClusterMgr: Unknown node type: %d", type); -#endif - } - } -} - -void -ClusterMgr::startThread() { - NdbMutex_Lock(clusterMgrThreadMutex); - - theStop = 0; - - theClusterMgrThread = NdbThread_Create(runClusterMgr_C, - (void**)this, - 32768, - "ndb_clustermgr", - NDB_THREAD_PRIO_LOW); - NdbMutex_Unlock(clusterMgrThreadMutex); -} - -void -ClusterMgr::doStop( ){ - DBUG_ENTER("ClusterMgr::doStop"); - NdbMutex_Lock(clusterMgrThreadMutex); - if(theStop){ - NdbMutex_Unlock(clusterMgrThreadMutex); - DBUG_VOID_RETURN; - } - void *status; - theStop = 1; - if (theClusterMgrThread) { - NdbThread_WaitFor(theClusterMgrThread, &status); - NdbThread_Destroy(&theClusterMgrThread); - theClusterMgrThread= 0; - } - NdbMutex_Unlock(clusterMgrThreadMutex); - DBUG_VOID_RETURN; -} - -void -ClusterMgr::threadMain( ){ - NdbApiSignal signal(numberToRef(API_CLUSTERMGR, theFacade.ownId())); - - signal.theVerId_signalNumber = GSN_API_REGREQ; - signal.theReceiversBlockNumber = QMGR; - signal.theTrace = 0; - signal.theLength = ApiRegReq::SignalLength; - - ApiRegReq * req = CAST_PTR(ApiRegReq, signal.getDataPtrSend()); - req->ref = numberToRef(API_CLUSTERMGR, theFacade.ownId()); - req->version = NDB_VERSION; - - - Uint32 timeSlept = 100; - Uint64 now = NdbTick_CurrentMillisecond(); - - while(!theStop){ - /** - * Start of Secure area for use of Transporter - */ - int send_heartbeat_now= global_flag_send_heartbeat_now; - global_flag_send_heartbeat_now= 0; - - theFacade.lock_mutex(); - for (int i = 1; i < MAX_NODES; i++){ - /** - * Send register request (heartbeat) to all available nodes - * at specified timing intervals - */ - const NodeId nodeId = i; - Node & theNode = theNodes[nodeId]; - - if (!theNode.defined) - continue; - - if (theNode.connected == false){ - theFacade.doConnect(nodeId); - continue; - } - - if (!theNode.compatible){ - continue; - } - - theNode.hbCounter += timeSlept; - if (theNode.hbCounter >= theNode.hbFrequency || - send_heartbeat_now) { - /** - * It is now time to send a new Heartbeat - */ - if (theNode.hbCounter >= theNode.hbFrequency) { - theNode.hbSent++; - theNode.hbCounter = 0; - } - - /** - * If the node is of type REP, - * then the receiver of the signal should be API_CLUSTERMGR - */ - if (theNode.m_info.m_type == NodeInfo::REP) { - signal.theReceiversBlockNumber = API_CLUSTERMGR; - } -#if 0 - ndbout_c("ClusterMgr: Sending API_REGREQ to node %d", (int)nodeId); -#endif - theFacade.sendSignalUnCond(&signal, nodeId); - }//if - - if (theNode.hbSent == 4 && theNode.hbFrequency > 0){ - reportNodeFailed(i); - }//if - } - - /** - * End of secure area. Let other threads in - */ - theFacade.unlock_mutex(); - - // Sleep for 100 ms between each Registration Heartbeat - Uint64 before = now; - NdbSleep_MilliSleep(100); - now = NdbTick_CurrentMillisecond(); - timeSlept = (now - before); - } -} - -#if 0 -void -ClusterMgr::showState(NodeId nodeId){ - ndbout << "-- ClusterMgr - NodeId = " << nodeId << endl; - ndbout << "theNodeList = " << theNodeList[nodeId] << endl; - ndbout << "theNodeState = " << theNodeState[nodeId] << endl; - ndbout << "theNodeCount = " << theNodeCount[nodeId] << endl; - ndbout << "theNodeStopDelay = " << theNodeStopDelay[nodeId] << endl; - ndbout << "theNodeSendDelay = " << theNodeSendDelay[nodeId] << endl; -} -#endif - -ClusterMgr::Node::Node() - : m_state(NodeState::SL_NOTHING) { - compatible = nfCompleteRep = true; - connected = defined = m_alive = false; - m_state.m_connected_nodes.clear(); -} - -/****************************************************************************** - * API_REGREQ and friends - ******************************************************************************/ - -void -ClusterMgr::execAPI_REGREQ(const Uint32 * theData){ - const ApiRegReq * const apiRegReq = (ApiRegReq *)&theData[0]; - const NodeId nodeId = refToNode(apiRegReq->ref); - -#if 0 - ndbout_c("ClusterMgr: Recd API_REGREQ from node %d", nodeId); -#endif - - assert(nodeId > 0 && nodeId < MAX_NODES); - - Node & node = theNodes[nodeId]; - assert(node.defined == true); - assert(node.connected == true); - - if(node.m_info.m_version != apiRegReq->version){ - node.m_info.m_version = apiRegReq->version; - - if (getMajor(node.m_info.m_version) < getMajor(NDB_VERSION) || - getMinor(node.m_info.m_version) < getMinor(NDB_VERSION)) { - node.compatible = false; - } else { - node.compatible = true; - } - } - - NdbApiSignal signal(numberToRef(API_CLUSTERMGR, theFacade.ownId())); - signal.theVerId_signalNumber = GSN_API_REGCONF; - signal.theReceiversBlockNumber = API_CLUSTERMGR; - signal.theTrace = 0; - signal.theLength = ApiRegConf::SignalLength; - - ApiRegConf * const conf = CAST_PTR(ApiRegConf, signal.getDataPtrSend()); - conf->qmgrRef = numberToRef(API_CLUSTERMGR, theFacade.ownId()); - conf->version = NDB_VERSION; - conf->apiHeartbeatFrequency = node.hbFrequency; - theFacade.sendSignalUnCond(&signal, nodeId); -} - -int global_mgmt_server_check = 0; // set to one in mgmtsrvr main; - -void -ClusterMgr::execAPI_REGCONF(const Uint32 * theData){ - const ApiRegConf * const apiRegConf = (ApiRegConf *)&theData[0]; - const NodeId nodeId = refToNode(apiRegConf->qmgrRef); - -#if 0 - ndbout_c("ClusterMgr: Recd API_REGCONF from node %d", nodeId); -#endif - - assert(nodeId > 0 && nodeId < MAX_NODES); - - Node & node = theNodes[nodeId]; - assert(node.defined == true); - assert(node.connected == true); - - if(node.m_info.m_version != apiRegConf->version){ - node.m_info.m_version = apiRegConf->version; - if (global_mgmt_server_check == 1) - node.compatible = ndbCompatible_mgmt_ndb(NDB_VERSION, - node.m_info.m_version); - else - node.compatible = ndbCompatible_api_ndb(NDB_VERSION, - node.m_info.m_version); - } - - node.m_state = apiRegConf->nodeState; - if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED || - node.m_state.startLevel == NodeState::SL_SINGLEUSER)){ - node.m_alive = true; - } else { - node.m_alive = false; - }//if - node.hbSent = 0; - node.hbCounter = 0; - if (node.m_info.m_type != NodeInfo::REP) { - node.hbFrequency = (apiRegConf->apiHeartbeatFrequency * 10) - 50; - } -} - -void -ClusterMgr::execAPI_REGREF(const Uint32 * theData){ - - ApiRegRef * ref = (ApiRegRef*)theData; - - const NodeId nodeId = refToNode(ref->ref); - - assert(nodeId > 0 && nodeId < MAX_NODES); - - Node & node = theNodes[nodeId]; - assert(node.connected == true); - assert(node.defined == true); - - node.compatible = false; - node.m_alive = false; - node.m_state = NodeState::SL_NOTHING; - node.m_info.m_version = ref->version; - - switch(ref->errorCode){ - case ApiRegRef::WrongType: - ndbout_c("Node %d reports that this node should be a NDB node", nodeId); - abort(); - case ApiRegRef::UnsupportedVersion: - default: - break; - } -} - -void -ClusterMgr::execNODE_FAILREP(const Uint32 * theData){ - NodeFailRep * const nodeFail = (NodeFailRep *)&theData[0]; - for(int i = 1; i<MAX_NODES; i++){ - if(NodeBitmask::get(nodeFail->theNodes, i)){ - reportNodeFailed(i); - } - } -} - -void -ClusterMgr::execNF_COMPLETEREP(const Uint32 * theData){ - NFCompleteRep * const nfComp = (NFCompleteRep *)theData; - - const NodeId nodeId = nfComp->failedNodeId; - assert(nodeId > 0 && nodeId < MAX_NODES); - - theFacade.ReportNodeFailureComplete(nodeId); - theNodes[nodeId].nfCompleteRep = true; -} - -void -ClusterMgr::reportConnected(NodeId nodeId){ - /** - * Ensure that we are sending heartbeat every 100 ms - * until we have got the first reply from NDB providing - * us with the real time-out period to use. - */ - assert(nodeId > 0 && nodeId < MAX_NODES); - - noOfConnectedNodes++; - - Node & theNode = theNodes[nodeId]; - theNode.connected = true; - theNode.hbSent = 0; - theNode.hbCounter = 0; - - /** - * make sure the node itself is marked connected even - * if first API_REGCONF has not arrived - */ - theNode.m_state.m_connected_nodes.set(nodeId); - - if (theNode.m_info.m_type != NodeInfo::REP) { - theNode.hbFrequency = 0; - } - theNode.m_info.m_version = 0; - theNode.compatible = true; - theNode.nfCompleteRep = true; - - theFacade.ReportNodeAlive(nodeId); -} - -void -ClusterMgr::reportDisconnected(NodeId nodeId){ - assert(nodeId > 0 && nodeId < MAX_NODES); - assert(noOfConnectedNodes > 0); - - noOfConnectedNodes--; - theNodes[nodeId].connected = false; - - theNodes[nodeId].m_state.m_connected_nodes.clear(); - - reportNodeFailed(nodeId); -} - -void -ClusterMgr::reportNodeFailed(NodeId nodeId){ - - Node & theNode = theNodes[nodeId]; - - theNode.m_alive = false; - theNode.m_info.m_connectCount ++; - - if(theNode.connected) - { - theFacade.doDisconnect(nodeId); - } - const bool report = (theNode.m_state.startLevel != NodeState::SL_NOTHING); - theNode.m_state.startLevel = NodeState::SL_NOTHING; - - if(report) - { - theFacade.ReportNodeDead(nodeId); - } - - theNode.nfCompleteRep = false; - - if(noOfConnectedNodes == 0){ - NFCompleteRep rep; - for(Uint32 i = 1; i<MAX_NODES; i++){ - if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){ - rep.failedNodeId = i; - execNF_COMPLETEREP((Uint32*)&rep); - } - } - } -} - -/****************************************************************************** - * Arbitrator - ******************************************************************************/ -ArbitMgr::ArbitMgr(TransporterFacade & _fac) - : theFacade(_fac) -{ - theThreadMutex = NdbMutex_Create(); - theInputCond = NdbCondition_Create(); - theInputMutex = NdbMutex_Create(); - - theRank = 0; - theDelay = 0; - theThread = 0; - - theInputTimeout = 0; - theInputFull = false; - memset(&theInputFull, 0, sizeof(theInputFull)); - theState = StateInit; - - memset(&theStartReq, 0, sizeof(theStartReq)); - memset(&theChooseReq1, 0, sizeof(theChooseReq1)); - memset(&theChooseReq2, 0, sizeof(theChooseReq2)); - memset(&theStopOrd, 0, sizeof(theStopOrd)); -} - -ArbitMgr::~ArbitMgr() -{ - NdbMutex_Destroy(theThreadMutex); - NdbCondition_Destroy(theInputCond); - NdbMutex_Destroy(theInputMutex); -} - -// Start arbitrator thread. This is kernel request. -// First stop any previous thread since it is a left-over -// which was never used and which now has wrong ticket. -void -ArbitMgr::doStart(const Uint32* theData) -{ - ArbitSignal aSignal; - NdbMutex_Lock(theThreadMutex); - if (theThread != NULL) { - aSignal.init(GSN_ARBIT_STOPORD, NULL); - aSignal.data.code = StopRestart; - sendSignalToThread(aSignal); - void* value; - NdbThread_WaitFor(theThread, &value); - theThread = NULL; - theState = StateInit; - theInputFull = false; - } - aSignal.init(GSN_ARBIT_STARTREQ, theData); - sendSignalToThread(aSignal); - theThread = NdbThread_Create( - runArbitMgr_C, (void**)this, 32768, "ndb_arbitmgr", - NDB_THREAD_PRIO_HIGH); - NdbMutex_Unlock(theThreadMutex); -} - -// The "choose me" signal from a candidate. -void -ArbitMgr::doChoose(const Uint32* theData) -{ - ArbitSignal aSignal; - aSignal.init(GSN_ARBIT_CHOOSEREQ, theData); - sendSignalToThread(aSignal); -} - -// Stop arbitrator thread via stop signal from the kernel -// or when exiting API program. -void -ArbitMgr::doStop(const Uint32* theData) -{ - DBUG_ENTER("ArbitMgr::doStop"); - ArbitSignal aSignal; - NdbMutex_Lock(theThreadMutex); - if (theThread != NULL) { - aSignal.init(GSN_ARBIT_STOPORD, theData); - if (theData == 0) { - aSignal.data.code = StopExit; - } else { - aSignal.data.code = StopRequest; - } - sendSignalToThread(aSignal); - void* value; - NdbThread_WaitFor(theThread, &value); - theThread = NULL; - theState = StateInit; - } - NdbMutex_Unlock(theThreadMutex); - DBUG_VOID_RETURN; -} - -// private methods - -extern "C" -void* -runArbitMgr_C(void* me) -{ - ((ArbitMgr*) me)->threadMain(); - return NULL; -} - -void -ArbitMgr::sendSignalToThread(ArbitSignal& aSignal) -{ -#ifdef DEBUG_ARBIT - char buf[17] = ""; - ndbout << "arbit recv: "; - ndbout << " gsn=" << aSignal.gsn; - ndbout << " send=" << aSignal.data.sender; - ndbout << " code=" << aSignal.data.code; - ndbout << " node=" << aSignal.data.node; - ndbout << " ticket=" << aSignal.data.ticket.getText(buf, sizeof(buf)); - ndbout << " mask=" << aSignal.data.mask.getText(buf, sizeof(buf)); - ndbout << endl; -#endif - aSignal.setTimestamp(); // signal arrival time - NdbMutex_Lock(theInputMutex); - while (theInputFull) { - NdbCondition_WaitTimeout(theInputCond, theInputMutex, 1000); - } - theInputBuffer = aSignal; - theInputFull = true; - NdbCondition_Signal(theInputCond); - NdbMutex_Unlock(theInputMutex); -} - -void -ArbitMgr::threadMain() -{ - ArbitSignal aSignal; - aSignal = theInputBuffer; - threadStart(aSignal); - bool stop = false; - while (! stop) { - NdbMutex_Lock(theInputMutex); - while (! theInputFull) { - NdbCondition_WaitTimeout(theInputCond, theInputMutex, theInputTimeout); - threadTimeout(); - } - aSignal = theInputBuffer; - theInputFull = false; - NdbCondition_Signal(theInputCond); - NdbMutex_Unlock(theInputMutex); - switch (aSignal.gsn) { - case GSN_ARBIT_CHOOSEREQ: - threadChoose(aSignal); - break; - case GSN_ARBIT_STOPORD: - stop = true; - break; - } - } - threadStop(aSignal); -} - -// handle events in the thread - -void -ArbitMgr::threadStart(ArbitSignal& aSignal) -{ - theStartReq = aSignal; - sendStartConf(theStartReq, ArbitCode::ApiStart); - theState = StateStarted; - theInputTimeout = 1000; -} - -void -ArbitMgr::threadChoose(ArbitSignal& aSignal) -{ - switch (theState) { - case StateStarted: // first REQ - if (! theStartReq.data.match(aSignal.data)) { - sendChooseRef(aSignal, ArbitCode::ErrTicket); - break; - } - theChooseReq1 = aSignal; - if (theDelay == 0) { - sendChooseConf(aSignal, ArbitCode::WinChoose); - theState = StateFinished; - theInputTimeout = 1000; - break; - } - theState = StateChoose1; - theInputTimeout = 1; - return; - case StateChoose1: // second REQ within Delay - if (! theStartReq.data.match(aSignal.data)) { - sendChooseRef(aSignal, ArbitCode::ErrTicket); - break; - } - theChooseReq2 = aSignal; - theState = StateChoose2; - theInputTimeout = 1; - return; - case StateChoose2: // too many REQs - refuse all - if (! theStartReq.data.match(aSignal.data)) { - sendChooseRef(aSignal, ArbitCode::ErrTicket); - break; - } - sendChooseRef(theChooseReq1, ArbitCode::ErrToomany); - sendChooseRef(theChooseReq2, ArbitCode::ErrToomany); - sendChooseRef(aSignal, ArbitCode::ErrToomany); - theState = StateFinished; - theInputTimeout = 1000; - return; - default: - sendChooseRef(aSignal, ArbitCode::ErrState); - break; - } -} - -void -ArbitMgr::threadTimeout() -{ - switch (theState) { - case StateStarted: - break; - case StateChoose1: - if (theChooseReq1.getTimediff() < theDelay) - break; - sendChooseConf(theChooseReq1, ArbitCode::WinChoose); - theState = StateFinished; - theInputTimeout = 1000; - break; - case StateChoose2: - sendChooseConf(theChooseReq1, ArbitCode::WinChoose); - sendChooseConf(theChooseReq2, ArbitCode::LoseChoose); - theState = StateFinished; - theInputTimeout = 1000; - break; - default: - break; - } -} - -void -ArbitMgr::threadStop(ArbitSignal& aSignal) -{ - switch (aSignal.data.code) { - case StopExit: - switch (theState) { - case StateStarted: - sendStopRep(theStartReq, 0); - break; - case StateChoose1: // just in time - sendChooseConf(theChooseReq1, ArbitCode::WinChoose); - break; - case StateChoose2: - sendChooseConf(theChooseReq1, ArbitCode::WinChoose); - sendChooseConf(theChooseReq2, ArbitCode::LoseChoose); - break; - case StateInit: - case StateFinished: - //?? - break; - } - break; - case StopRequest: - break; - case StopRestart: - break; - } -} - -// output routines - -void -ArbitMgr::sendStartConf(ArbitSignal& aSignal, Uint32 code) -{ - ArbitSignal copySignal = aSignal; - copySignal.gsn = GSN_ARBIT_STARTCONF; - copySignal.data.code = code; - sendSignalToQmgr(copySignal); -} - -void -ArbitMgr::sendChooseConf(ArbitSignal& aSignal, Uint32 code) -{ - ArbitSignal copySignal = aSignal; - copySignal.gsn = GSN_ARBIT_CHOOSECONF; - copySignal.data.code = code; - sendSignalToQmgr(copySignal); -} - -void -ArbitMgr::sendChooseRef(ArbitSignal& aSignal, Uint32 code) -{ - ArbitSignal copySignal = aSignal; - copySignal.gsn = GSN_ARBIT_CHOOSEREF; - copySignal.data.code = code; - sendSignalToQmgr(copySignal); -} - -void -ArbitMgr::sendStopRep(ArbitSignal& aSignal, Uint32 code) -{ - ArbitSignal copySignal = aSignal; - copySignal.gsn = GSN_ARBIT_STOPREP; - copySignal.data.code = code; - sendSignalToQmgr(copySignal); -} - -/** - * Send signal to QMGR. The input includes signal number and - * signal data. The signal data is normally a copy of a received - * signal so it contains expected arbitrator node id and ticket. - * The sender in signal data is the QMGR node id. - */ -void -ArbitMgr::sendSignalToQmgr(ArbitSignal& aSignal) -{ - NdbApiSignal signal(numberToRef(API_CLUSTERMGR, theFacade.ownId())); - - signal.theVerId_signalNumber = aSignal.gsn; - signal.theReceiversBlockNumber = QMGR; - signal.theTrace = 0; - signal.theLength = ArbitSignalData::SignalLength; - - ArbitSignalData* sd = CAST_PTR(ArbitSignalData, signal.getDataPtrSend()); - - sd->sender = numberToRef(API_CLUSTERMGR, theFacade.ownId()); - sd->code = aSignal.data.code; - sd->node = aSignal.data.node; - sd->ticket = aSignal.data.ticket; - sd->mask = aSignal.data.mask; - -#ifdef DEBUG_ARBIT - char buf[17] = ""; - ndbout << "arbit send: "; - ndbout << " gsn=" << aSignal.gsn; - ndbout << " recv=" << aSignal.data.sender; - ndbout << " code=" << aSignal.data.code; - ndbout << " node=" << aSignal.data.node; - ndbout << " ticket=" << aSignal.data.ticket.getText(buf, sizeof(buf)); - ndbout << " mask=" << aSignal.data.mask.getText(buf, sizeof(buf)); - ndbout << endl; -#endif - - theFacade.lock_mutex(); - theFacade.sendSignalUnCond(&signal, aSignal.data.sender); - theFacade.unlock_mutex(); -} - diff --git a/ndb/src/ndbapi/ClusterMgr.hpp b/ndb/src/ndbapi/ClusterMgr.hpp deleted file mode 100644 index cc3cf66c8aa..00000000000 --- a/ndb/src/ndbapi/ClusterMgr.hpp +++ /dev/null @@ -1,215 +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 ClusterMgr_H -#define ClusterMgr_H - -#include "API.hpp" -#include <ndb_limits.h> -#include <NdbThread.h> -#include <NdbMutex.h> -#include <NdbCondition.h> -#include <signaldata/ArbitSignalData.hpp> -#include <signaldata/NodeStateSignalData.hpp> -#include <NodeInfo.hpp> -#include <NodeState.hpp> - -extern "C" void* runClusterMgr_C(void * me); - - -/** - * @class ClusterMgr - */ -class ClusterMgr { - friend void* runClusterMgr_C(void * me); - friend void execute(void *, struct SignalHeader * const, - Uint8, Uint32 * const, LinearSectionPtr ptr[3]); -public: - ClusterMgr(class TransporterFacade &); - ~ClusterMgr(); - void init(struct ndb_mgm_configuration_iterator & config); - - void reportConnected(NodeId nodeId); - void reportDisconnected(NodeId nodeId); - - bool checkUpgradeCompatability(Uint32 nodeVersion); - - void doStop(); - void startThread(); - -private: - void threadMain(); - - int theStop; - class TransporterFacade & theFacade; - -public: - struct Node { - Node(); - bool defined; - bool connected; // Transporter connected - bool compatible; // Version is compatible - bool nfCompleteRep; // NF Complete Rep has arrived - bool m_alive; // Node is alive - - NodeInfo m_info; - NodeState m_state; - - /** - * Heartbeat stuff - */ - Uint32 hbFrequency; // Heartbeat frequence - Uint32 hbCounter; // # milliseconds passed since last hb sent - Uint32 hbSent; // # heartbeats sent (without answer) - }; - - const Node & getNodeInfo(NodeId) const; - Uint32 getNoOfConnectedNodes() const; - -private: - Uint32 noOfConnectedNodes; - Node theNodes[MAX_NODES]; - NdbThread* theClusterMgrThread; - - /** - * Used for controlling start/stop of the thread - */ - NdbMutex* clusterMgrThreadMutex; - - void showState(NodeId nodeId); - void reportNodeFailed(NodeId nodeId); - - /** - * Signals received - */ - void execAPI_REGREQ (const Uint32 * theData); - void execAPI_REGCONF (const Uint32 * theData); - void execAPI_REGREF (const Uint32 * theData); - void execNODE_FAILREP (const Uint32 * theData); - void execNF_COMPLETEREP(const Uint32 * theData); -}; - -inline -const ClusterMgr::Node & -ClusterMgr::getNodeInfo(NodeId nodeId) const { - return theNodes[nodeId]; -} - -inline -Uint32 -ClusterMgr::getNoOfConnectedNodes() const { - return noOfConnectedNodes; -} - -/*****************************************************************************/ - -/** - * @class ArbitMgr - * Arbitration manager. Runs in separate thread. - * Started only by a request from the kernel. - */ - -extern "C" void* runArbitMgr_C(void* me); - -class ArbitMgr -{ -public: - ArbitMgr(class TransporterFacade &); - ~ArbitMgr(); - - inline void setRank(unsigned n) { theRank = n; } - inline void setDelay(unsigned n) { theDelay = n; } - - void doStart(const Uint32* theData); - void doChoose(const Uint32* theData); - void doStop(const Uint32* theData); - - friend void* runArbitMgr_C(void* me); - -private: - class TransporterFacade & theFacade; - unsigned theRank; - unsigned theDelay; - - void threadMain(); - NdbThread* theThread; - NdbMutex* theThreadMutex; // not really needed - - struct ArbitSignal { - GlobalSignalNumber gsn; - ArbitSignalData data; - NDB_TICKS timestamp; - - inline void init(GlobalSignalNumber aGsn, const Uint32* aData) { - gsn = aGsn; - if (aData != NULL) - memcpy(&data, aData, sizeof(data)); - else - memset(&data, 0, sizeof(data)); - } - - inline void setTimestamp() { - timestamp = NdbTick_CurrentMillisecond(); - } - - inline NDB_TICKS getTimediff() { - NDB_TICKS now = NdbTick_CurrentMillisecond(); - return now < timestamp ? 0 : now - timestamp; - } - }; - - NdbMutex* theInputMutex; - NdbCondition* theInputCond; - int theInputTimeout; - bool theInputFull; // the predicate - ArbitSignal theInputBuffer; // shared buffer - - void sendSignalToThread(ArbitSignal& aSignal); - - enum State { // thread states - StateInit, - StateStarted, // thread started - StateChoose1, // received one valid REQ - StateChoose2, // received two valid REQs - StateFinished // finished one way or other - }; - State theState; - - enum Stop { // stop code in ArbitSignal.data.code - StopExit = 1, // at API exit - StopRequest = 2, // request from kernel - StopRestart = 3 // stop before restart - }; - - void threadStart(ArbitSignal& aSignal); // handle thread events - void threadChoose(ArbitSignal& aSignal); - void threadTimeout(); - void threadStop(ArbitSignal& aSignal); - - ArbitSignal theStartReq; - ArbitSignal theChooseReq1; - ArbitSignal theChooseReq2; - ArbitSignal theStopOrd; - - void sendStartConf(ArbitSignal& aSignal, Uint32); - void sendChooseRef(ArbitSignal& aSignal, Uint32); - void sendChooseConf(ArbitSignal& aSignal, Uint32); - void sendStopRep(ArbitSignal& aSignal, Uint32); - - void sendSignalToQmgr(ArbitSignal& aSignal); -}; - -#endif diff --git a/ndb/src/ndbapi/DictCache.cpp b/ndb/src/ndbapi/DictCache.cpp deleted file mode 100644 index da9d5b70d47..00000000000 --- a/ndb/src/ndbapi/DictCache.cpp +++ /dev/null @@ -1,277 +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 */ - -#include <ndb_global.h> -#include "DictCache.hpp" -#include "NdbDictionaryImpl.hpp" -#include <NdbTick.h> -#include <NdbCondition.h> -#include <NdbSleep.h> - -Ndb_local_table_info * -Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz) -{ - Uint32 tot_size= sizeof(NdbTableImpl *) + ((sz+7) & ~7); // round to Uint64 - void *data= malloc(tot_size); - if (data == 0) - return 0; - memset(data, 0, tot_size); - new (data) Ndb_local_table_info(table_impl); - return (Ndb_local_table_info *) data; -} - -void Ndb_local_table_info::destroy(Ndb_local_table_info *info) -{ - free((void *)info); -} - -Ndb_local_table_info::Ndb_local_table_info(NdbTableImpl *table_impl) -{ - m_table_impl= table_impl; -} - -Ndb_local_table_info::~Ndb_local_table_info() -{ -} - -LocalDictCache::LocalDictCache(){ - m_tableHash.createHashTable(); -} - -LocalDictCache::~LocalDictCache(){ - m_tableHash.releaseHashTable(); -} - -Ndb_local_table_info * -LocalDictCache::get(const char * name){ - const Uint32 len = strlen(name); - return m_tableHash.getData(name, len); -} - -void -LocalDictCache::put(const char * name, Ndb_local_table_info * tab_info){ - const Uint32 id = tab_info->m_table_impl->m_tableId; - - m_tableHash.insertKey(name, strlen(name), id, tab_info); -} - -void -LocalDictCache::drop(const char * name){ - Ndb_local_table_info *info= m_tableHash.deleteKey(name, strlen(name)); - DBUG_ASSERT(info != 0); - Ndb_local_table_info::destroy(info); -} - -/***************************************************************** - * Global cache - */ -GlobalDictCache::GlobalDictCache(){ - m_tableHash.createHashTable(); - m_waitForTableCondition = NdbCondition_Create(); -} - -GlobalDictCache::~GlobalDictCache(){ - NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0); - while(curr != 0){ - Vector<TableVersion> * vers = curr->theData; - const unsigned sz = vers->size(); - for(unsigned i = 0; i<sz ; i++){ - if((* vers)[i].m_impl != 0) - delete (* vers)[i].m_impl; - } - delete curr->theData; - curr = m_tableHash.getNext(curr); - } - - m_tableHash.releaseHashTable(); - NdbCondition_Destroy(m_waitForTableCondition); -} - -#include <NdbOut.hpp> - -NdbTableImpl * -GlobalDictCache::get(const char * name) -{ - const Uint32 len = strlen(name); - Vector<TableVersion> * versions = 0; - versions = m_tableHash.getData(name, len); - if(versions == 0){ - versions = new Vector<TableVersion>(2); - m_tableHash.insertKey(name, len, 0, versions); - } - - int waitTime = 100; - - bool retreive = false; - while(versions->size() > 0 && !retreive){ - TableVersion * ver = & versions->back(); - switch(ver->m_status){ - case OK: - ver->m_refCount++; - return ver->m_impl; - case DROPPED: - retreive = true; // Break loop - break; - case RETREIVING: - NdbCondition_WaitTimeout(m_waitForTableCondition, m_mutex, waitTime); - continue; - } - } - - /** - * Create new... - */ - TableVersion tmp; - tmp.m_version = 0; - tmp.m_impl = 0; - tmp.m_status = RETREIVING; - tmp.m_refCount = 1; // The one retreiving it - versions->push_back(tmp); - return 0; -} - -NdbTableImpl * -GlobalDictCache::put(const char * name, NdbTableImpl * tab) -{ - const Uint32 len = strlen(name); - Vector<TableVersion> * vers = m_tableHash.getData(name, len); - if(vers == 0){ - // Should always tried to retreive it first - // and then there should be a record - abort(); - } - - const Uint32 sz = vers->size(); - if(sz == 0){ - // Should always tried to retreive it first - // and then there should be a record - abort(); - } - - TableVersion & ver = vers->back(); - if(ver.m_status != RETREIVING || - ver.m_impl != 0 || - ver.m_version != 0 || - ver.m_refCount == 0){ - abort(); - } - - if(tab == 0){ - // No table found in db - vers->erase(sz - 1); - } else { - ver.m_impl = tab; - ver.m_version = tab->m_version; - ver.m_status = OK; - } - - NdbCondition_Broadcast(m_waitForTableCondition); - return tab; -} - -void -GlobalDictCache::drop(NdbTableImpl * tab) -{ - unsigned i; - const Uint32 len = strlen(tab->m_internalName.c_str()); - Vector<TableVersion> * vers = - m_tableHash.getData(tab->m_internalName.c_str(), len); - if(vers == 0){ - // Should always tried to retreive it first - // and then there should be a record - abort(); - } - - const Uint32 sz = vers->size(); - if(sz == 0){ - // Should always tried to retreive it first - // and then there should be a record - abort(); - } - - for(i = 0; i < sz; i++){ - TableVersion & ver = (* vers)[i]; - if(ver.m_impl == tab){ - if(ver.m_refCount == 0 || ver.m_status == RETREIVING || - ver.m_version != tab->m_version){ - ndbout_c("Dropping with refCount=%d status=%d impl=%p", - ver.m_refCount, ver.m_status, ver.m_impl); - break; - } - - ver.m_refCount--; - ver.m_status = DROPPED; - if(ver.m_refCount == 0){ - delete ver.m_impl; - vers->erase(i); - } - return; - } - } - - for(i = 0; i<sz; i++){ - TableVersion & ver = (* vers)[i]; - ndbout_c("%d: version: %d refCount: %d status: %d impl: %p", - i, ver.m_version, ver.m_refCount, ver.m_status, ver.m_impl); - } - - abort(); -} - -void -GlobalDictCache::release(NdbTableImpl * tab){ - unsigned i; - const Uint32 len = strlen(tab->m_internalName.c_str()); - Vector<TableVersion> * vers = - m_tableHash.getData(tab->m_internalName.c_str(), len); - if(vers == 0){ - // Should always tried to retreive it first - // and then there should be a record - abort(); - } - - const Uint32 sz = vers->size(); - if(sz == 0){ - // Should always tried to retreive it first - // and then there should be a record - abort(); - } - - for(i = 0; i < sz; i++){ - TableVersion & ver = (* vers)[i]; - if(ver.m_impl == tab){ - if(ver.m_refCount == 0 || ver.m_status == RETREIVING || - ver.m_version != tab->m_version){ - ndbout_c("Releasing with refCount=%d status=%d impl=%p", - ver.m_refCount, ver.m_status, ver.m_impl); - break; - } - - ver.m_refCount--; - return; - } - } - - for(i = 0; i<sz; i++){ - TableVersion & ver = (* vers)[i]; - ndbout_c("%d: version: %d refCount: %d status: %d impl: %p", - i, ver.m_version, ver.m_refCount, ver.m_status, ver.m_impl); - } - - abort(); -} - -template class Vector<GlobalDictCache::TableVersion>; diff --git a/ndb/src/ndbapi/DictCache.hpp b/ndb/src/ndbapi/DictCache.hpp deleted file mode 100644 index 58c08a93e61..00000000000 --- a/ndb/src/ndbapi/DictCache.hpp +++ /dev/null @@ -1,92 +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 DictCache_H -#define DictCache_H - -#include <ndb_types.h> -#include <kernel_types.h> -#include <NdbError.hpp> -#include <BaseString.hpp> -#include <Vector.hpp> -#include <UtilBuffer.hpp> -#include <NdbDictionary.hpp> -#include <Ndb.hpp> -#include <NdbCondition.h> -#include "NdbLinHash.hpp" - -class Ndb_local_table_info { -public: - static Ndb_local_table_info *create(NdbTableImpl *table_impl, Uint32 sz=0); - static void destroy(Ndb_local_table_info *); - NdbTableImpl *m_table_impl; - Uint64 m_local_data[1]; -private: - Ndb_local_table_info(NdbTableImpl *table_impl); - ~Ndb_local_table_info(); -}; - -/** - * A non thread safe dict cache - */ -class LocalDictCache { -public: - LocalDictCache(); - ~LocalDictCache(); - - Ndb_local_table_info * get(const char * name); - - void put(const char * name, Ndb_local_table_info *); - void drop(const char * name); - - NdbLinHash<Ndb_local_table_info> m_tableHash; // On name -}; - -/** - * A thread safe dict cache - */ -class GlobalDictCache : public NdbLockable { -public: - GlobalDictCache(); - ~GlobalDictCache(); - - NdbTableImpl * get(const char * name); - - NdbTableImpl* put(const char * name, NdbTableImpl *); - void drop(NdbTableImpl *); - void release(NdbTableImpl *); -public: - enum Status { - OK = 0, - DROPPED = 1, - RETREIVING = 2 - }; - -private: - struct TableVersion { - Uint32 m_version; - Uint32 m_refCount; - NdbTableImpl * m_impl; - Status m_status; - }; - - NdbLinHash<Vector<TableVersion> > m_tableHash; - NdbCondition * m_waitForTableCondition; -}; - -#endif - - diff --git a/ndb/src/ndbapi/Makefile.am b/ndb/src/ndbapi/Makefile.am deleted file mode 100644 index b734e058b87..00000000000 --- a/ndb/src/ndbapi/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -#SUBDIRS = signal-sender - -noinst_LTLIBRARIES = libndbapi.la - -libndbapi_la_SOURCES = \ - TransporterFacade.cpp \ - ClusterMgr.cpp \ - Ndb.cpp \ - NdbPoolImpl.cpp \ - NdbPool.cpp \ - Ndblist.cpp \ - Ndbif.cpp \ - Ndbinit.cpp \ - Ndberr.cpp \ - ndberror.c \ - NdbErrorOut.cpp \ - NdbTransaction.cpp \ - NdbTransactionScan.cpp \ - NdbOperation.cpp \ - NdbOperationSearch.cpp \ - NdbOperationScan.cpp \ - NdbOperationInt.cpp \ - NdbOperationDefine.cpp \ - NdbOperationExec.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 \ - ndb_cluster_connection.cpp \ - NdbBlob.cpp - -INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi - -# Ndbapi cannot handle -O3 -NDB_CXXFLAGS_RELEASE_LOC = -O2 - -include $(top_srcdir)/ndb/config/common.mk.am -include $(top_srcdir)/ndb/config/type_ndbapi.mk.am - -# Don't update the files from bitkeeper -%::SCCS/s.% - -windoze-dsp: libndbapi.dsp - -libndbapi.dsp: Makefile \ - $(top_srcdir)/ndb/config/win-lib.am \ - $(top_srcdir)/ndb/config/win-name \ - $(top_srcdir)/ndb/config/win-includes \ - $(top_srcdir)/ndb/config/win-sources \ - $(top_srcdir)/ndb/config/win-libraries - cat $(top_srcdir)/ndb/config/win-lib.am > $@ - @$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES) - @$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES) - @$(top_srcdir)/ndb/config/win-sources $@ $(libndbapi_la_SOURCES) - @$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD) diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp deleted file mode 100644 index b047ae1bd1a..00000000000 --- a/ndb/src/ndbapi/Ndb.cpp +++ /dev/null @@ -1,1317 +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 */ - - - - -/***************************************************************************** -Name: Ndb.cpp -******************************************************************************/ - -#include <ndb_global.h> - - -#include "NdbApiSignal.hpp" -#include "NdbImpl.hpp" -#include <NdbOperation.hpp> -#include <NdbTransaction.hpp> -#include <NdbEventOperation.hpp> -#include <NdbRecAttr.hpp> -#include <md5_hash.hpp> -#include <NdbSleep.h> -#include <NdbOut.hpp> -#include <ndb_limits.h> -#include "API.hpp" -#include <NdbEnv.h> -#include <BaseString.hpp> - -/**************************************************************************** -void connect(); - -Connect to any node which has no connection at the moment. -****************************************************************************/ -NdbTransaction* Ndb::doConnect(Uint32 tConNode) -{ - Uint32 tNode; - Uint32 tAnyAlive = 0; - int TretCode= 0; - - DBUG_ENTER("Ndb::doConnect"); - - if (tConNode != 0) { - TretCode = NDB_connect(tConNode); - if ((TretCode == 1) || (TretCode == 2)) { -//**************************************************************************** -// We have connections now to the desired node. Return -//**************************************************************************** - DBUG_RETURN(getConnectedNdbTransaction(tConNode)); - } else if (TretCode != 0) { - tAnyAlive = 1; - }//if - }//if -//**************************************************************************** -// We will connect to any node. Make sure that we have connections to all -// nodes. -//**************************************************************************** - if (theImpl->m_optimized_node_selection) - { - Ndb_cluster_connection_node_iter &node_iter= - theImpl->m_node_iter; - theImpl->m_ndb_cluster_connection.init_get_next_node(node_iter); - while ((tNode= theImpl->m_ndb_cluster_connection.get_next_node(node_iter))) - { - TretCode= NDB_connect(tNode); - if ((TretCode == 1) || - (TretCode == 2)) - { -//**************************************************************************** -// We have connections now to the desired node. Return -//**************************************************************************** - DBUG_RETURN(getConnectedNdbTransaction(tNode)); - } else if (TretCode != 0) { - tAnyAlive= 1; - }//if - DBUG_PRINT("info",("tried node %d, TretCode %d, error code %d, %s", - tNode, TretCode, getNdbError().code, - getNdbError().message)); - } - } - else // just do a regular round robin - { - Uint32 tNoOfDbNodes= theImpl->theNoOfDBnodes; - Uint32 &theCurrentConnectIndex= theImpl->theCurrentConnectIndex; - UintR Tcount = 0; - do { - theCurrentConnectIndex++; - if (theCurrentConnectIndex >= tNoOfDbNodes) - theCurrentConnectIndex = 0; - - Tcount++; - tNode= theImpl->theDBnodes[theCurrentConnectIndex]; - TretCode= NDB_connect(tNode); - if ((TretCode == 1) || - (TretCode == 2)) - { -//**************************************************************************** -// We have connections now to the desired node. Return -//**************************************************************************** - DBUG_RETURN(getConnectedNdbTransaction(tNode)); - } else if (TretCode != 0) { - tAnyAlive= 1; - }//if - DBUG_PRINT("info",("tried node %d TretCode %d", tNode, TretCode)); - } while (Tcount < tNoOfDbNodes); - } -//**************************************************************************** -// We were unable to find a free connection. If no node alive we will report -// error code for cluster failure otherwise connection failure. -//**************************************************************************** - if (tAnyAlive == 1) { -#ifdef VM_TRACE - ndbout << "TretCode = " << TretCode << endl; -#endif - theError.code = 4006; - } else { - theError.code = 4009; - }//if - DBUG_RETURN(NULL); -} - -int -Ndb::NDB_connect(Uint32 tNode) -{ -//**************************************************************************** -// We will perform seize of a transaction record in DBTC in the specified node. -//*************************************************************************** - - int tReturnCode; - TransporterFacade *tp = TransporterFacade::instance(); - - DBUG_ENTER("Ndb::NDB_connect"); - - bool nodeAvail = tp->get_node_alive(tNode); - if(nodeAvail == false){ - DBUG_RETURN(0); - } - - NdbTransaction * tConArray = theConnectionArray[tNode]; - if (tConArray != NULL) { - DBUG_RETURN(2); - } - - NdbTransaction * tNdbCon = getNdbCon(); // Get free connection object. - if (tNdbCon == NULL) { - DBUG_RETURN(4); - }//if - NdbApiSignal* tSignal = getSignal(); // Get signal object - if (tSignal == NULL) { - releaseNdbCon(tNdbCon); - DBUG_RETURN(4); - }//if - if (tSignal->setSignal(GSN_TCSEIZEREQ) == -1) { - releaseNdbCon(tNdbCon); - releaseSignal(tSignal); - DBUG_RETURN(4); - }//if - tSignal->setData(tNdbCon->ptr2int(), 1); -//************************************************ -// Set connection pointer as NdbTransaction object -//************************************************ - tSignal->setData(theMyRef, 2); // Set my block reference - tNdbCon->Status(NdbTransaction::Connecting); // Set status to connecting - Uint32 nodeSequence; - { // send and receive signal - Guard guard(tp->theMutexPtr); - nodeSequence = tp->getNodeSequence(tNode); - bool node_is_alive = tp->get_node_alive(tNode); - if (node_is_alive) { - tReturnCode = tp->sendSignal(tSignal, tNode); - releaseSignal(tSignal); - if (tReturnCode != -1) { - theImpl->theWaiter.m_node = tNode; - theImpl->theWaiter.m_state = WAIT_TC_SEIZE; - tReturnCode = receiveResponse(); - }//if - } else { - releaseSignal(tSignal); - tReturnCode = -1; - }//if - } - if ((tReturnCode == 0) && (tNdbCon->Status() == NdbTransaction::Connected)) { - //************************************************ - // Send and receive was successful - //************************************************ - NdbTransaction* tPrevFirst = theConnectionArray[tNode]; - tNdbCon->setConnectedNodeId(tNode, nodeSequence); - - tNdbCon->setMyBlockReference(theMyRef); - theConnectionArray[tNode] = tNdbCon; - tNdbCon->theNext = tPrevFirst; - DBUG_RETURN(1); - } else { - releaseNdbCon(tNdbCon); -//**************************************************************************** -// Unsuccessful connect is indicated by 3. -//**************************************************************************** - DBUG_PRINT("info", - ("unsuccessful connect tReturnCode %d, tNdbCon->Status() %d", - tReturnCode, tNdbCon->Status())); - DBUG_RETURN(3); - }//if -}//Ndb::NDB_connect() - -NdbTransaction * -Ndb::getConnectedNdbTransaction(Uint32 nodeId){ - NdbTransaction* next = theConnectionArray[nodeId]; - theConnectionArray[nodeId] = next->theNext; - next->theNext = NULL; - - return next; -}//Ndb::getConnectedNdbTransaction() - -/***************************************************************************** -disconnect(); - -Remark: Disconnect all connections to the database. -*****************************************************************************/ -void -Ndb::doDisconnect() -{ - DBUG_ENTER("Ndb::doDisconnect"); - NdbTransaction* tNdbCon; - CHECK_STATUS_MACRO_VOID; - - Uint32 tNoOfDbNodes = theImpl->theNoOfDBnodes; - Uint8 *theDBnodes= theImpl->theDBnodes; - DBUG_PRINT("info", ("theNoOfDBnodes=%d", tNoOfDbNodes)); - UintR i; - for (i = 0; i < tNoOfDbNodes; i++) { - Uint32 tNode = theDBnodes[i]; - tNdbCon = theConnectionArray[tNode]; - while (tNdbCon != NULL) { - NdbTransaction* tmpNdbCon = tNdbCon; - tNdbCon = tNdbCon->theNext; - releaseConnectToNdb(tmpNdbCon); - }//while - }//for - tNdbCon = theTransactionList; - while (tNdbCon != NULL) { - NdbTransaction* tmpNdbCon = tNdbCon; - tNdbCon = tNdbCon->theNext; - releaseConnectToNdb(tmpNdbCon); - }//while - DBUG_VOID_RETURN; -}//Ndb::disconnect() - -/***************************************************************************** -int waitUntilReady(int timeout); - -Return Value: Returns 0 if the Ndb is ready within timeout seconds. - Returns -1 otherwise. -Remark: Waits until a node has status != 0 -*****************************************************************************/ -int -Ndb::waitUntilReady(int timeout) -{ - DBUG_ENTER("Ndb::waitUntilReady"); - int secondsCounter = 0; - int milliCounter = 0; - int noChecksSinceFirstAliveFound = 0; - int id; - - if (theInitState != Initialised) { - // Ndb::init is not called - theError.code = 4256; - DBUG_RETURN(-1); - } - - while (theNode == 0) { - if (secondsCounter >= timeout) - { - theError.code = 4269; - DBUG_RETURN(-1); - } - NdbSleep_MilliSleep(100); - milliCounter += 100; - if (milliCounter >= 1000) { - secondsCounter++; - milliCounter = 0; - }//if - } - - if (theImpl->m_ndb_cluster_connection.wait_until_ready - (timeout-secondsCounter,30) < 0) - { - theError.code = 4009; - DBUG_RETURN(-1); - } - - DBUG_RETURN(0); -} - -/***************************************************************************** -NdbTransaction* startTransaction(); - -Return Value: Returns a pointer to a connection object. - Return NULL otherwise. -Remark: Start transaction. Synchronous. -*****************************************************************************/ -NdbTransaction* -Ndb::startTransaction(const NdbDictionary::Table *table, - const char * keyData, Uint32 keyLen) -{ - DBUG_ENTER("Ndb::startTransaction"); - - if (theInitState == Initialised) { - theError.code = 0; - checkFailedNode(); - /** - * If the user supplied key data - * We will make a qualified quess to which node is the primary for the - * the fragment and contact that node - */ - Uint32 nodeId; - NdbTableImpl* impl; - if(table != 0 && keyData != 0 && (impl= &NdbTableImpl::getImpl(*table))) - { - Uint32 hashValue; - { - Uint32 buf[4]; - if((UintPtr(keyData) & 7) == 0 && (keyLen & 3) == 0) - { - md5_hash(buf, (const Uint64*)keyData, keyLen >> 2); - } - else - { - Uint64 tmp[1000]; - tmp[keyLen/8] = 0; - memcpy(tmp, keyData, keyLen); - md5_hash(buf, tmp, (keyLen+3) >> 2); - } - hashValue= buf[1]; - } - const Uint16 *nodes; - Uint32 cnt= impl->get_nodes(hashValue, &nodes); - if(cnt) - nodeId= nodes[0]; - else - nodeId= 0; - } else { - nodeId = 0; - }//if - - { - NdbTransaction *trans= startTransactionLocal(0, nodeId); - DBUG_PRINT("exit",("start trans: 0x%x transid: 0x%llx", - trans, trans ? trans->getTransactionId() : 0)); - DBUG_RETURN(trans); - } - } else { - DBUG_RETURN(NULL); - }//if -}//Ndb::startTransaction() - -/***************************************************************************** -NdbTransaction* hupp(NdbTransaction* pBuddyTrans); - -Return Value: Returns a pointer to a connection object. - Connected to the same node as pBuddyTrans - and also using the same transction id -Remark: Start transaction. Synchronous. -*****************************************************************************/ -NdbTransaction* -Ndb::hupp(NdbTransaction* pBuddyTrans) -{ - DBUG_ENTER("Ndb::hupp"); - - DBUG_PRINT("enter", ("trans: 0x%x",pBuddyTrans)); - - Uint32 aPriority = 0; - if (pBuddyTrans == NULL){ - DBUG_RETURN(startTransaction()); - } - - if (theInitState == Initialised) { - theError.code = 0; - checkFailedNode(); - - Uint32 nodeId = pBuddyTrans->getConnectedNodeId(); - NdbTransaction* pCon = startTransactionLocal(aPriority, nodeId); - if(pCon == NULL) - DBUG_RETURN(NULL); - - if (pCon->getConnectedNodeId() != nodeId){ - // We could not get a connection to the desired node - // release the connection and return NULL - closeTransaction(pCon); - theError.code = 4006; - DBUG_RETURN(NULL); - } - pCon->setTransactionId(pBuddyTrans->getTransactionId()); - pCon->setBuddyConPtr((Uint32)pBuddyTrans->getTC_ConnectPtr()); - DBUG_PRINT("exit", ("hupp trans: 0x%x transid: 0x%llx", - pCon, pCon ? pCon->getTransactionId() : 0)); - DBUG_RETURN(pCon); - } else { - DBUG_RETURN(NULL); - }//if -}//Ndb::hupp() - -NdbTransaction* -Ndb::startTransactionLocal(Uint32 aPriority, Uint32 nodeId) -{ -#ifdef VM_TRACE - char buf[255]; - const char* val = NdbEnv_GetEnv("NDB_TRANSACTION_NODE_ID", buf, 255); - if(val != 0){ - nodeId = atoi(val); - } -#endif - - DBUG_ENTER("Ndb::startTransactionLocal"); - DBUG_PRINT("enter", ("nodeid: %d", nodeId)); - - NdbTransaction* tConnection; - Uint64 tFirstTransId = theFirstTransId; - tConnection = doConnect(nodeId); - if (tConnection == NULL) { - DBUG_RETURN(NULL); - }//if - NdbTransaction* tConNext = theTransactionList; - tConnection->init(); - theTransactionList = tConnection; // into a transaction list. - tConnection->next(tConNext); // Add the active connection object - tConnection->setTransactionId(tFirstTransId); - tConnection->thePriority = aPriority; - if ((tFirstTransId & 0xFFFFFFFF) == 0xFFFFFFFF) { - //--------------------------------------------------- -// Transaction id rolling round. We will start from -// consecutive identity 0 again. -//--------------------------------------------------- - theFirstTransId = ((tFirstTransId >> 32) << 32); - } else { - theFirstTransId = tFirstTransId + 1; - }//if -#ifdef VM_TRACE - if (tConnection->theListState != NdbTransaction::NotInList) { - printState("startTransactionLocal %x", tConnection); - abort(); - } -#endif - DBUG_RETURN(tConnection); -}//Ndb::startTransactionLocal() - -/***************************************************************************** -void closeTransaction(NdbTransaction* aConnection); - -Parameters: aConnection: the connection used in the transaction. -Remark: Close transaction by releasing the connection and all operations. -*****************************************************************************/ -void -Ndb::closeTransaction(NdbTransaction* aConnection) -{ - DBUG_ENTER("Ndb::closeTransaction"); - NdbTransaction* tCon; - NdbTransaction* tPreviousCon; - - if (aConnection == NULL) { -//----------------------------------------------------- -// closeTransaction called on NULL pointer, destructive -// application behaviour. -//----------------------------------------------------- -#ifdef VM_TRACE - printf("NULL into closeTransaction\n"); -#endif - DBUG_VOID_RETURN; - }//if - CHECK_STATUS_MACRO_VOID; - - tCon = theTransactionList; - - DBUG_PRINT("info",("close trans: 0x%x transid: 0x%llx", - aConnection, aConnection->getTransactionId())); - DBUG_PRINT("info",("magic number: 0x%x TCConPtr: 0x%x theMyRef: 0x%x 0x%x", - aConnection->theMagicNumber, aConnection->theTCConPtr, - aConnection->theMyRef, getReference())); - - if (aConnection == tCon) { // Remove the active connection object - theTransactionList = tCon->next(); // from the transaction list. - } else { - while (aConnection != tCon) { - if (tCon == NULL) { -//----------------------------------------------------- -// closeTransaction called on non-existing transaction -//----------------------------------------------------- - - if(aConnection->theError.code == 4008){ - /** - * When a SCAN timed-out, returning the NdbTransaction leads - * to reuse. And TC crashes when the API tries to reuse it to - * something else... - */ -#ifdef VM_TRACE - printf("Scan timeout:ed NdbTransaction-> " - "not returning it-> memory leak\n"); -#endif - DBUG_VOID_RETURN; - } - -#ifdef VM_TRACE - printf("Non-existing transaction into closeTransaction\n"); - abort(); -#endif - DBUG_VOID_RETURN; - }//if - tPreviousCon = tCon; - tCon = tCon->next(); - }//while - tPreviousCon->next(tCon->next()); - }//if - - aConnection->release(); - - if(aConnection->theError.code == 4008){ - /** - * Something timed-out, returning the NdbTransaction leads - * to reuse. And TC crashes when the API tries to reuse it to - * something else... - */ -#ifdef VM_TRACE - printf("Con timeout:ed NdbTransaction-> not returning it-> memory leak\n"); -#endif - DBUG_VOID_RETURN; - } - - if (aConnection->theReleaseOnClose == false) { - /** - * Put it back in idle list for that node - */ - Uint32 nodeId = aConnection->getConnectedNodeId(); - aConnection->theNext = theConnectionArray[nodeId]; - theConnectionArray[nodeId] = aConnection; - DBUG_VOID_RETURN; - } else { - aConnection->theReleaseOnClose = false; - releaseNdbCon(aConnection); - }//if - DBUG_VOID_RETURN; -}//Ndb::closeTransaction() - -/***************************************************************************** -int* NdbTamper(int aAction, int aNode); - -Parameters: aAction Specifies what action to be taken - 1: Lock global checkpointing Can only be sent to master DIH, Parameter aNode ignored. - 2: UnLock global checkpointing Can only be sent to master DIH, Parameter aNode ignored. - 3: Crash node - - aNode Specifies which node the action will be taken - -1: Master DIH - 0-16: Nodnumber - -Return Value: -1 Error . - -Remark: Sends a signal to DIH. -*****************************************************************************/ -int -Ndb::NdbTamper(TamperType aAction, int aNode) -{ - NdbTransaction* tNdbConn; - NdbApiSignal tSignal(theMyRef); - int tNode; - int tAction; - int ret_code; - -#ifdef CUSTOMER_RELEASE - return -1; -#else - CHECK_STATUS_MACRO; - checkFailedNode(); - - theRestartGCI = 0; - switch (aAction) { -// Translate enum to integer. This is done because the SCI layer -// expects integers. - case LockGlbChp: - tAction = 1; - break; - case UnlockGlbChp: - tAction = 2; - break; - case CrashNode: - tAction = 3; - break; - case ReadRestartGCI: - tAction = 4; - break; - default: - theError.code = 4102; - return -1; - } - - tNdbConn = getNdbCon(); // Get free connection object - if (tNdbConn == NULL) { - theError.code = 4000; - return -1; - } - tSignal.setSignal(GSN_DIHNDBTAMPER); - tSignal.setData (tAction, 1); - tSignal.setData(tNdbConn->ptr2int(),2); - tSignal.setData(theMyRef,3); // Set return block reference - tNdbConn->Status(NdbTransaction::Connecting); // Set status to connecting - TransporterFacade *tp = TransporterFacade::instance(); - if (tAction == 3) { - tp->lock_mutex(); - tp->sendSignal(&tSignal, aNode); - tp->unlock_mutex(); - releaseNdbCon(tNdbConn); - } else if ( (tAction == 2) || (tAction == 1) ) { - tp->lock_mutex(); - tNode = tp->get_an_alive_node(); - if (tNode == 0) { - theError.code = 4002; - releaseNdbCon(tNdbConn); - return -1; - }//if - ret_code = tp->sendSignal(&tSignal,aNode); - tp->unlock_mutex(); - releaseNdbCon(tNdbConn); - return ret_code; - } else { - do { - tp->lock_mutex(); - // Start protected area - tNode = tp->get_an_alive_node(); - tp->unlock_mutex(); - // End protected area - if (tNode == 0) { - theError.code = 4009; - releaseNdbCon(tNdbConn); - return -1; - }//if - ret_code = sendRecSignal(tNode, WAIT_NDB_TAMPER, &tSignal, 0); - if (ret_code == 0) { - if (tNdbConn->Status() != NdbTransaction::Connected) { - theRestartGCI = 0; - }//if - releaseNdbCon(tNdbConn); - return theRestartGCI; - } else if ((ret_code == -5) || (ret_code == -2)) { - TRACE_DEBUG("Continue DIHNDBTAMPER when node failed/stopping"); - } else { - return -1; - }//if - } while (1); - } - return 0; -#endif -} -#if 0 -/**************************************************************************** -NdbSchemaCon* startSchemaTransaction(); - -Return Value: Returns a pointer to a schema connection object. - Return NULL otherwise. -Remark: Start schema transaction. Synchronous. -****************************************************************************/ -NdbSchemaCon* -Ndb::startSchemaTransaction() -{ - NdbSchemaCon* tSchemaCon; - if (theSchemaConToNdbList != NULL) { - theError.code = 4321; - return NULL; - }//if - tSchemaCon = new NdbSchemaCon(this); - if (tSchemaCon == NULL) { - theError.code = 4000; - return NULL; - }//if - theSchemaConToNdbList = tSchemaCon; - return tSchemaCon; -} -/***************************************************************************** -void closeSchemaTransaction(NdbSchemaCon* aSchemaCon); - -Parameters: aSchemaCon: the schemacon used in the transaction. -Remark: Close transaction by releasing the schemacon and all schemaop. -*****************************************************************************/ -void -Ndb::closeSchemaTransaction(NdbSchemaCon* aSchemaCon) -{ - if (theSchemaConToNdbList != aSchemaCon) { - abort(); - return; - }//if - aSchemaCon->release(); - delete aSchemaCon; - theSchemaConToNdbList = NULL; - return; -}//Ndb::closeSchemaTransaction() -#endif - -/***************************************************************************** -void RestartGCI(int aRestartGCI); - -Remark: Set theRestartGCI on the NDB object -*****************************************************************************/ -void -Ndb::RestartGCI(int aRestartGCI) -{ - theRestartGCI = aRestartGCI; -} - -/**************************************************************************** -int getBlockNumber(void); - -Remark: -****************************************************************************/ -int -Ndb::getBlockNumber() -{ - return theNdbBlockNumber; -} - -NdbDictionary::Dictionary * -Ndb::getDictionary() const { - return theDictionary; -} - -/**************************************************************************** -int getNodeId(); - -Remark: -****************************************************************************/ -int -Ndb::getNodeId() -{ - return theNode; -} - -/**************************************************************************** -Uint64 getTupleIdFromNdb( Uint32 aTableId, Uint32 cacheSize ); - -Parameters: aTableId : The TableId. - cacheSize: Prefetch this many values -Remark: Returns a new TupleId to the application. - The TupleId comes from SYSTAB_0 where SYSKEY_0 = TableId. - It is initialized to (TableId << 48) + 1 in NdbcntrMain.cpp. -****************************************************************************/ -#define DEBUG_TRACE(msg) \ -// ndbout << __FILE__ << " line: " << __LINE__ << " msg: " << msg << endl - -Uint64 -Ndb::getAutoIncrementValue(const char* aTableName, Uint32 cacheSize) -{ - DEBUG_TRACE("getAutoIncrementValue"); - const char * internalTableName = internalizeTableName(aTableName); - Ndb_local_table_info *info= - theDictionary->get_local_table_info(internalTableName, false); - if (info == 0) - return ~0; - const NdbTableImpl *table= info->m_table_impl; - Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize); - return tupleId; -} - -Uint64 -Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable, Uint32 cacheSize) -{ - DEBUG_TRACE("getAutoIncrementValue"); - if (aTable == 0) - return ~0; - const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable); - Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize); - return tupleId; -} - -Uint64 -Ndb::getTupleIdFromNdb(const char* aTableName, Uint32 cacheSize) -{ - const NdbTableImpl* table = theDictionary->getTable(aTableName); - if (table == 0) - return ~0; - return getTupleIdFromNdb(table->m_tableId, cacheSize); -} - -Uint64 -Ndb::getTupleIdFromNdb(Uint32 aTableId, Uint32 cacheSize) -{ - if ( theFirstTupleId[aTableId] != theLastTupleId[aTableId] ) - { - theFirstTupleId[aTableId]++; - return theFirstTupleId[aTableId]; - } - else // theFirstTupleId == theLastTupleId - { - return opTupleIdOnNdb(aTableId, cacheSize, 0); - } -} - -Uint64 -Ndb::readAutoIncrementValue(const char* aTableName) -{ - DEBUG_TRACE("readtAutoIncrementValue"); - const NdbTableImpl* table = theDictionary->getTable(aTableName); - if (table == 0) { - theError= theDictionary->getNdbError(); - return ~0; - } - Uint64 tupleId = readTupleIdFromNdb(table->m_tableId); - return tupleId; -} - -Uint64 -Ndb::readAutoIncrementValue(const NdbDictionary::Table * aTable) -{ - DEBUG_TRACE("readtAutoIncrementValue"); - if (aTable == 0) - return ~0; - const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable); - Uint64 tupleId = readTupleIdFromNdb(table->m_tableId); - return tupleId; -} - -Uint64 -Ndb::readTupleIdFromNdb(Uint32 aTableId) -{ - if ( theFirstTupleId[aTableId] == theLastTupleId[aTableId] ) - // Cache is empty, check next in database - return opTupleIdOnNdb(aTableId, 0, 3); - - return theFirstTupleId[aTableId] + 1; -} - -bool -Ndb::setAutoIncrementValue(const char* aTableName, Uint64 val, bool increase) -{ - DEBUG_TRACE("setAutoIncrementValue " << val); - const char * internalTableName= internalizeTableName(aTableName); - Ndb_local_table_info *info= - theDictionary->get_local_table_info(internalTableName, false); - if (info == 0) { - theError= theDictionary->getNdbError(); - return false; - } - const NdbTableImpl* table= info->m_table_impl; - return setTupleIdInNdb(table->m_tableId, val, increase); -} - -bool -Ndb::setAutoIncrementValue(const NdbDictionary::Table * aTable, Uint64 val, bool increase) -{ - DEBUG_TRACE("setAutoIncrementValue " << val); - if (aTable == 0) - return ~0; - const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable); - return setTupleIdInNdb(table->m_tableId, val, increase); -} - -bool -Ndb::setTupleIdInNdb(const char* aTableName, Uint64 val, bool increase ) -{ - DEBUG_TRACE("setTupleIdInNdb"); - const NdbTableImpl* table = theDictionary->getTable(aTableName); - if (table == 0) { - theError= theDictionary->getNdbError(); - return false; - } - return setTupleIdInNdb(table->m_tableId, val, increase); -} - -bool -Ndb::setTupleIdInNdb(Uint32 aTableId, Uint64 val, bool increase ) -{ - DEBUG_TRACE("setTupleIdInNdb"); - if (increase) - { - if (theFirstTupleId[aTableId] != theLastTupleId[aTableId]) - { - // We have a cache sequence - if (val <= theFirstTupleId[aTableId]+1) - return false; - if (val <= theLastTupleId[aTableId]) - { - theFirstTupleId[aTableId] = val - 1; - return true; - } - // else continue; - } - return (opTupleIdOnNdb(aTableId, val, 2) == val); - } - else - return (opTupleIdOnNdb(aTableId, val, 1) == val); -} - -Uint64 -Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op) -{ - DBUG_ENTER("Ndb::opTupleIdOnNdb"); - DBUG_PRINT("enter", ("table=%u value=%llu op=%u", aTableId, opValue, op)); - - NdbTransaction* tConnection; - NdbOperation* tOperation= 0; // Compiler warning if not initialized - Uint64 tValue; - NdbRecAttr* tRecAttrResult; - int result; - Uint64 ret; - - CHECK_STATUS_MACRO_ZERO; - - BaseString currentDb(getDatabaseName()); - BaseString currentSchema(getDatabaseSchemaName()); - - setDatabaseName("sys"); - setDatabaseSchemaName("def"); - tConnection = this->startTransaction(); - if (tConnection == NULL) - goto error_return; - - if (usingFullyQualifiedNames()) - tOperation = tConnection->getNdbOperation("SYSTAB_0"); - else - tOperation = tConnection->getNdbOperation("sys/def/SYSTAB_0"); - if (tOperation == NULL) - goto error_handler; - - switch (op) - { - case 0: - tOperation->interpretedUpdateTuple(); - tOperation->equal("SYSKEY_0", aTableId ); - tOperation->incValue("NEXTID", opValue); - tRecAttrResult = tOperation->getValue("NEXTID"); - - if (tConnection->execute( Commit ) == -1 ) - goto error_handler; - - tValue = tRecAttrResult->u_64_value(); - - theFirstTupleId[aTableId] = tValue - opValue; - theLastTupleId[aTableId] = tValue - 1; - ret = theFirstTupleId[aTableId]; - break; - case 1: - tOperation->updateTuple(); - tOperation->equal("SYSKEY_0", aTableId ); - tOperation->setValue("NEXTID", opValue); - - if (tConnection->execute( Commit ) == -1 ) - goto error_handler; - - theFirstTupleId[aTableId] = ~(Uint64)0; - theLastTupleId[aTableId] = ~(Uint64)0; - ret = opValue; - break; - case 2: - tOperation->interpretedUpdateTuple(); - tOperation->equal("SYSKEY_0", aTableId ); - tOperation->load_const_u64(1, opValue); - tOperation->read_attr("NEXTID", 2); - tOperation->branch_le(2, 1, 0); - tOperation->write_attr("NEXTID", 1); - tOperation->interpret_exit_ok(); - tOperation->def_label(0); - tOperation->interpret_exit_nok(9999); - - if ( (result = tConnection->execute( Commit )) == -1 ) - goto error_handler; - - if (result == 9999) - ret = ~(Uint64)0; - else - { - theFirstTupleId[aTableId] = theLastTupleId[aTableId] = opValue - 1; - ret = opValue; - } - break; - case 3: - tOperation->readTuple(); - tOperation->equal("SYSKEY_0", aTableId ); - tRecAttrResult = tOperation->getValue("NEXTID"); - if (tConnection->execute( Commit ) == -1 ) - goto error_handler; - ret = tRecAttrResult->u_64_value(); - break; - default: - goto error_handler; - } - - this->closeTransaction(tConnection); - - // Restore current name space - setDatabaseName(currentDb.c_str()); - setDatabaseSchemaName(currentSchema.c_str()); - - DBUG_RETURN(ret); - - error_handler: - theError.code = tConnection->theError.code; - this->closeTransaction(tConnection); - error_return: - // Restore current name space - setDatabaseName(currentDb.c_str()); - setDatabaseSchemaName(currentSchema.c_str()); - - DBUG_PRINT("error", ("ndb=%d con=%d op=%d", - theError.code, - tConnection ? tConnection->theError.code : -1, - tOperation ? tOperation->theError.code : -1)); - DBUG_RETURN(~0); -} - -Uint32 -convertEndian(Uint32 Data) -{ -#ifdef WORDS_BIGENDIAN - Uint32 t1, t2, t3, t4; - t4 = (Data >> 24) & 255; - t3 = (Data >> 16) & 255; - t4 = t4 + (t3 << 8); - t2 = (Data >> 8) & 255; - t4 = t4 + (t2 << 16); - t1 = Data & 255; - t4 = t4 + (t1 << 24); - return t4; -#else - return Data; -#endif -} -const char * Ndb::getCatalogName() const -{ - return theDataBase; -} - -void Ndb::setCatalogName(const char * a_catalog_name) -{ - if (a_catalog_name) { - BaseString::snprintf(theDataBase, sizeof(theDataBase), "%s", - a_catalog_name ? a_catalog_name : ""); - - int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c", - theDataBase, table_name_separator, - theDataBaseSchema, table_name_separator); - prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len : - sizeof(prefixName) - 1); - } -} - -const char * Ndb::getSchemaName() const -{ - return theDataBaseSchema; -} - -void Ndb::setSchemaName(const char * a_schema_name) -{ - if (a_schema_name) { - BaseString::snprintf(theDataBaseSchema, sizeof(theDataBase), "%s", - a_schema_name ? a_schema_name : ""); - - int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c", - theDataBase, table_name_separator, - theDataBaseSchema, table_name_separator); - prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len : - sizeof(prefixName) - 1); - } -} - -/* -Deprecated functions -*/ -const char * Ndb::getDatabaseName() const -{ - return getCatalogName(); -} - -void Ndb::setDatabaseName(const char * a_catalog_name) -{ - setCatalogName(a_catalog_name); -} - -const char * Ndb::getDatabaseSchemaName() const -{ - return getSchemaName(); -} - -void Ndb::setDatabaseSchemaName(const char * a_schema_name) -{ - setSchemaName(a_schema_name); -} - -bool Ndb::usingFullyQualifiedNames() -{ - return fullyQualifiedNames; -} - -const char * -Ndb::externalizeTableName(const char * internalTableName, bool fullyQualifiedNames) -{ - if (fullyQualifiedNames) { - register const char *ptr = internalTableName; - - // Skip database name - while (*ptr && *ptr++ != table_name_separator); - // Skip schema name - while (*ptr && *ptr++ != table_name_separator); - return ptr; - } - else - return internalTableName; -} - -const char * -Ndb::externalizeTableName(const char * internalTableName) -{ - return externalizeTableName(internalTableName, usingFullyQualifiedNames()); -} - -const char * -Ndb::externalizeIndexName(const char * internalIndexName, bool fullyQualifiedNames) -{ - if (fullyQualifiedNames) { - register const char *ptr = internalIndexName; - - // Scan name from the end - while (*ptr++); ptr--; // strend - while (ptr >= internalIndexName && *ptr != table_name_separator) - ptr--; - - return ptr + 1; - } - else - return internalIndexName; -} - -const char * -Ndb::externalizeIndexName(const char * internalIndexName) -{ - return externalizeIndexName(internalIndexName, usingFullyQualifiedNames()); -} - -const char * -Ndb::internalizeTableName(const char * externalTableName) -{ - if (fullyQualifiedNames) { - strncpy(prefixEnd, externalTableName, NDB_MAX_TAB_NAME_SIZE); - return prefixName; - } - else - return externalTableName; -} - -const char * -Ndb::internalizeIndexName(const NdbTableImpl * table, - const char * externalIndexName) -{ - if (fullyQualifiedNames) { - char tableId[10]; - sprintf(tableId, "%d", table->m_tableId); - Uint32 tabIdLen = strlen(tableId); - strncpy(prefixEnd, tableId, tabIdLen); - prefixEnd[tabIdLen] = table_name_separator; - strncpy(prefixEnd + tabIdLen + 1, - externalIndexName, NDB_MAX_TAB_NAME_SIZE); - return prefixName; - } - else - return externalIndexName; -} - -const BaseString -Ndb::getDatabaseFromInternalName(const char * internalName) -{ - char * databaseName = new char[strlen(internalName) + 1]; - strcpy(databaseName, internalName); - register char *ptr = databaseName; - - /* Scan name for the first table_name_separator */ - while (*ptr && *ptr != table_name_separator) - ptr++; - *ptr = '\0'; - BaseString ret = BaseString(databaseName); - delete [] databaseName; - return ret; -} - -const BaseString -Ndb::getSchemaFromInternalName(const char * internalName) -{ - char * schemaName = new char[strlen(internalName)]; - register const char *ptr1 = internalName; - - /* Scan name for the second table_name_separator */ - while (*ptr1 && *ptr1 != table_name_separator) - ptr1++; - strcpy(schemaName, ptr1 + 1); - register char *ptr = schemaName; - while (*ptr && *ptr != table_name_separator) - ptr++; - *ptr = '\0'; - BaseString ret = BaseString(schemaName); - delete [] schemaName; - return ret; -} - -NdbEventOperation* Ndb::createEventOperation(const char* eventName, - const int bufferLength) -{ - NdbEventOperation* tOp; - - tOp = new NdbEventOperation(this, eventName, bufferLength); - - if (tOp == 0) - { - theError.code= 4000; - return NULL; - } - - if (tOp->getState() != NdbEventOperation::EO_CREATED) { - theError.code= tOp->getNdbError().code; - delete tOp; - tOp = NULL; - } - - //now we have to look up this event in dict - - return tOp; -} - -int Ndb::dropEventOperation(NdbEventOperation* op) { - delete op; - return 0; -} - -NdbGlobalEventBufferHandle* Ndb::getGlobalEventBufferHandle() -{ - return theGlobalEventBufferHandle; -} - -//void Ndb::monitorEvent(NdbEventOperation *op, NdbEventCallback cb, void* rs) -//{ -//} - -int -Ndb::pollEvents(int aMillisecondNumber) -{ - return NdbEventOperation::wait(theGlobalEventBufferHandle, - aMillisecondNumber); -} - -#ifdef VM_TRACE -#include <NdbMutex.h> -extern NdbMutex *ndb_print_state_mutex; - -static bool -checkdups(NdbTransaction** list, unsigned no) -{ - for (unsigned i = 0; i < no; i++) - for (unsigned j = i + 1; j < no; j++) - if (list[i] == list[j]) - return true; - return false; -} -void -Ndb::printState(const char* fmt, ...) -{ - char buf[200]; - va_list ap; - va_start(ap, fmt); - vsprintf(buf, fmt, ap); - va_end(ap); - NdbMutex_Lock(ndb_print_state_mutex); - bool dups = false; - unsigned i; - ndbout << buf << " ndb=" << hex << this << dec; -#ifndef NDB_WIN32 - ndbout << " thread=" << (int)pthread_self(); -#endif - ndbout << endl; - for (unsigned n = 0; n < MAX_NDB_NODES; n++) { - NdbTransaction* con = theConnectionArray[n]; - if (con != 0) { - ndbout << "conn " << n << ":" << endl; - while (con != 0) { - con->printState(); - con = con->theNext; - } - } - } - ndbout << "prepared: " << theNoOfPreparedTransactions<< endl; - if (checkdups(thePreparedTransactionsArray, theNoOfPreparedTransactions)) { - ndbout << "!! DUPS !!" << endl; - dups = true; - } - for (i = 0; i < theNoOfPreparedTransactions; i++) - thePreparedTransactionsArray[i]->printState(); - ndbout << "sent: " << theNoOfSentTransactions<< endl; - if (checkdups(theSentTransactionsArray, theNoOfSentTransactions)) { - ndbout << "!! DUPS !!" << endl; - dups = true; - } - for (i = 0; i < theNoOfSentTransactions; i++) - theSentTransactionsArray[i]->printState(); - ndbout << "completed: " << theNoOfCompletedTransactions<< endl; - if (checkdups(theCompletedTransactionsArray, theNoOfCompletedTransactions)) { - ndbout << "!! DUPS !!" << endl; - dups = true; - } - for (i = 0; i < theNoOfCompletedTransactions; i++) - theCompletedTransactionsArray[i]->printState(); - NdbMutex_Unlock(ndb_print_state_mutex); -} -#endif - - diff --git a/ndb/src/ndbapi/NdbApiSignal.cpp b/ndb/src/ndbapi/NdbApiSignal.cpp deleted file mode 100644 index b1671e593e1..00000000000 --- a/ndb/src/ndbapi/NdbApiSignal.cpp +++ /dev/null @@ -1,279 +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 */ - - -#include "API.hpp" -#include "NdbApiSignal.hpp" - -/** - * The following include includes - * definitions directly from the kernel - * - * Definitions that is shared between kernel and the API - */ -#include <signaldata/TcKeyReq.hpp> -#include <signaldata/KeyInfo.hpp> -#include <signaldata/AttrInfo.hpp> -#include <signaldata/TestOrd.hpp> -#include <signaldata/CreateIndx.hpp> -#include <signaldata/DropIndx.hpp> -#include <signaldata/TcIndx.hpp> -#include <signaldata/IndxKeyInfo.hpp> -#include <signaldata/IndxAttrInfo.hpp> -#include <signaldata/TcHbRep.hpp> -#include <signaldata/ScanTab.hpp> - -#include <NdbOut.hpp> - -/****************************************************************************** -NdbApiSignal(); - -Return Value: None -Remark: Creates a NdbApiSignal object. -******************************************************************************/ -NdbApiSignal::NdbApiSignal(BlockReference ref) -{ - theVerId_signalNumber = 0; // 4 bit ver id - 16 bit gsn - theReceiversBlockNumber = 0; // Only 16 bit blocknum - theSendersBlockRef = refToBlock(ref); - theLength = 0; - theSendersSignalId = 0; - theSignalId = 0; - theTrace = 0; - m_noOfSections = 0; - m_fragmentInfo = 0; - for (int i = 0; i < 25; i++) - theData[i] = 0x13579753; - - setDataPtr(&theData[0]); - theNextSignal = 0; -} - -/** - * Copy constructor - */ -NdbApiSignal::NdbApiSignal(const NdbApiSignal &src) { - copyFrom(&src); -} -/****************************************************************************** -~NdbApiSignal(); - -Return Value: None -Remark: Delete a NdbApiSignal object. -******************************************************************************/ -NdbApiSignal::~NdbApiSignal() -{ -} -/****************************************************************************** -int setSignal(NdbSignalType aNdbSignalType); - -Return Value: Return 0 : setSignal was successful. - Return tErrorCode In all other case. -Parameters: aNdbSignalType: Type of signal. -Remark: Set signal header and allocate 128 byte. -******************************************************************************/ -int -NdbApiSignal::setSignal(int aNdbSignalType) -{ - theSendersSignalId = 0; - switch (aNdbSignalType) - { - case GSN_DIHNDBTAMPER: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBDIH; - theVerId_signalNumber = GSN_DIHNDBTAMPER; - theLength = 3; - } - break; - - case GSN_TCSEIZEREQ: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_TCSEIZEREQ; - theLength = 2; - } - break; - - case GSN_TCKEYREQ: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_TCKEYREQ; - theLength = TcKeyReq::SignalLength; - } - break; - - case GSN_TCRELEASEREQ: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_TCRELEASEREQ; - theLength = 3; - } - break; - - case GSN_ATTRINFO: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_ATTRINFO; - theLength = AttrInfo::MaxSignalLength; - } - break; - - case GSN_KEYINFO: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_KEYINFO; - theLength = KeyInfo::MaxSignalLength; - } - break; - - case GSN_TCROLLBACKREQ: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_TCROLLBACKREQ; - theLength = 3; - } - break; - - case GSN_TC_HBREP: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_TC_HBREP; - theLength = TcHbRep::SignalLength; - } - break; - - case GSN_TC_COMMITREQ: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_TC_COMMITREQ; - theLength = 3; - } - break; - - case GSN_SCAN_TABREQ: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_SCAN_TABREQ; - theLength = ScanTabReq::StaticLength; - } - break; - - case GSN_SCAN_NEXTREQ: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_SCAN_NEXTREQ; - theLength = ScanNextReq::SignalLength; - } - break; - - case GSN_CREATE_INDX_REQ: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBDICT; - theVerId_signalNumber = GSN_CREATE_INDX_REQ; - theLength = CreateIndxReq::SignalLength; - } - break; - - case GSN_DROP_INDX_REQ: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBDICT; - theVerId_signalNumber = GSN_DROP_INDX_REQ; - theLength = DropIndxReq::SignalLength; - } - break; - - case GSN_TCINDXREQ: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_TCINDXREQ; - theLength = TcKeyReq::SignalLength; - } - break; - - case GSN_INDXKEYINFO: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_INDXKEYINFO; - theLength = IndxKeyInfo::MaxSignalLength; - } - break; - - case GSN_INDXATTRINFO: - { - theTrace = TestOrd::TraceAPI; - theReceiversBlockNumber = DBTC; - theVerId_signalNumber = GSN_INDXATTRINFO; - theLength = IndxAttrInfo::MaxSignalLength; - } - break; - - default: - { - return -1; - } - } - return 0; -} - -void -NdbApiSignal::set(Uint8 trace, - Uint16 receiversBlockNumber, - Uint16 signalNumber, - Uint32 length){ - - theTrace = trace; - theReceiversBlockNumber = receiversBlockNumber; - theVerId_signalNumber = signalNumber; - theLength = length; -} - -void -NdbApiSignal::copyFrom(const NdbApiSignal * src){ - theVerId_signalNumber = src->theVerId_signalNumber; - theReceiversBlockNumber = src->theReceiversBlockNumber; - theSendersBlockRef = src->theSendersBlockRef; - theLength = src->theLength; - theTrace = src->theTrace; - - Uint32 * dstData = getDataPtrSend(); - const Uint32 * srcData = src->getDataPtr(); - for (Uint32 i = 0; i < theLength; i++) - dstData[i] = srcData[i]; - - setDataPtr(dstData); - - /** - * NOTE that theSignalId is used as data ptr - * and should not be copied - * NOTE that theSendersSignalId is used as next pointer - * and should not be copied - */ -} diff --git a/ndb/src/ndbapi/NdbApiSignal.hpp b/ndb/src/ndbapi/NdbApiSignal.hpp deleted file mode 100644 index 353c575d420..00000000000 --- a/ndb/src/ndbapi/NdbApiSignal.hpp +++ /dev/null @@ -1,224 +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 */ - -/********************************************************************** - * Name: NdbApiSignal.H - * Include: - * Link: - * Author: UABMNST Mona Natterkvist UAB/B/SD - * Date: 97---- - * Version: 0.1 - * Description: Interface between TIS and NDB - * Documentation: - * Adjust: 971204 UABMNST First version. - * Adjust: 000705 QABANAB Changes in Protocol2 - * Comment: - *****************************************************************************/ -#ifndef NdbApiSignal_H -#define NdbApiSignal_H - -#include <kernel_types.h> -#include "TransporterFacade.hpp" -#include <TransporterDefinitions.hpp> -#include "Ndb.hpp" - -#define CAST_PTR(X,Y) static_cast<X*>(static_cast<void*>(Y)) -#define CAST_CONSTPTR(X,Y) static_cast<const X*>(static_cast<const void*>(Y)) - -/** - * A NdbApiSignal : public SignalHeader - * - * Stores the address to theData in theSignalId - */ -class NdbApiSignal : public SignalHeader - { -public: - NdbApiSignal(BlockReference myRef); - NdbApiSignal(const NdbApiSignal &); - NdbApiSignal(const SignalHeader &header) - : SignalHeader(header), theNextSignal(0), theRealData(0) {}; - ~NdbApiSignal(); - - void set(Uint8 trace, - Uint16 receiversBlockNumber, - Uint16 signalNumber, - Uint32 length); - - - void setData(Uint32 aWord, Uint32 aDataNo); - Uint32 readData(Uint32 aDataNo) const; // Read word in signal - - int setSignal(int NdbSignalType); // Set signal header - int readSignalNumber(); // Read signal number - Uint32 getLength() const; - void setLength(Uint32 aLength); - void next(NdbApiSignal* anApiSignal); - NdbApiSignal* next(); - - const Uint32 * getDataPtr() const; - Uint32 * getDataPtrSend(); - - NodeId get_sender_node(); - - /** - * Fragmentation - */ - bool isFirstFragment() const { return m_fragmentInfo <= 1;} - bool isLastFragment() const { - return m_fragmentInfo == 0 || m_fragmentInfo == 3; - } - - Uint32 getFragmentId() const { - return (m_fragmentInfo == 0 ? 0 : getDataPtr()[theLength - 1]); - } - -private: - friend void execute(void * callbackObj, - struct SignalHeader * const header, - Uint8 prio, Uint32 * const theData, - LinearSectionPtr ptr[3]); - - void setDataPtr(Uint32 *); - - friend class NdbTransaction; - friend class NdbScanReceiver; - friend class Table; - void copyFrom(const NdbApiSignal * src); - - /** - * Only used when creating a signal in the api - */ - Uint32 theData[25]; - NdbApiSignal *theNextSignal; - Uint32 *theRealData; -}; -/********************************************************************** -NodeId get_sender_node -Remark: Get the node id of the sender -***********************************************************************/ -inline -NodeId -NdbApiSignal::get_sender_node() -{ - return refToNode(theSendersBlockRef); -} - -/********************************************************************** -void getLength -Remark: Get the length of the signal. -******************************************************************************/ -inline -Uint32 -NdbApiSignal::getLength() const{ - return theLength; -} - -/********************************************************************** -void setLength -Parameters: aLength: Signal length -Remark: Set the length in the signal. -******************************************************************************/ -inline -void -NdbApiSignal::setLength(Uint32 aLength){ - theLength = aLength; -} - -/********************************************************************** -void next(NdbApiSignal* aSignal); - -Parameters: aSignal: Signal object. -Remark: Insert signal rear in a linked list. -*****************************************************************************/ -inline -void -NdbApiSignal::next(NdbApiSignal* aSignal){ - theNextSignal = aSignal; -} -/********************************************************************** -NdbApiSignal* next(); - -Return Value: Return theNext signal object if the next was successful. - Return NULL: In all other case. -Remark: Read the theNext in signal. -*****************************************************************************/ -inline -NdbApiSignal* -NdbApiSignal::next(){ - return theNextSignal; -} -/********************************************************************** -int readSignalNo(); - -Return Value: Return the signalNumber. -Remark: Read signal number -*****************************************************************************/ -inline -int -NdbApiSignal::readSignalNumber() -{ - return (int)theVerId_signalNumber; -} -/********************************************************************** -Uint32 readData(Uint32 aDataNo); - -Return Value: Return Data word in a signal. - Return -1: In all other case. - aDataNo: Data number in signal. -Remark: Return the dataWord information in a signal for a dataNo. -******************************************************************************/ -inline -Uint32 -NdbApiSignal::readData(Uint32 aDataNo) const { - return getDataPtr()[aDataNo-1]; -} -/********************************************************************** -int setData(Uint32 aWord, int aDataNo); - -Return Value: Return 0 : setData was successful. - Return -1: In all other case. -Parameters: aWord: Data word. - aDataNo: Data number in signal. -Remark: Set Data word in signal 1 - 25 -******************************************************************************/ -inline -void -NdbApiSignal::setData(Uint32 aWord, Uint32 aDataNo){ - getDataPtrSend()[aDataNo -1] = aWord; -} - -/** - * Return pointer to data structure - */ -inline -const Uint32 * -NdbApiSignal::getDataPtr() const { - return theRealData; -} - -inline -Uint32 * -NdbApiSignal::getDataPtrSend(){ - return (Uint32*)&theData[0]; -} - -inline -void -NdbApiSignal::setDataPtr(Uint32 * ptr){ - theRealData = ptr; -} - -#endif diff --git a/ndb/src/ndbapi/NdbBlob.cpp b/ndb/src/ndbapi/NdbBlob.cpp deleted file mode 100644 index 0638f6e4c51..00000000000 --- a/ndb/src/ndbapi/NdbBlob.cpp +++ /dev/null @@ -1,1602 +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 */ - -#include <Ndb.hpp> -#include <NdbDictionaryImpl.hpp> -#include <NdbTransaction.hpp> -#include <NdbOperation.hpp> -#include <NdbIndexOperation.hpp> -#include <NdbRecAttr.hpp> -#include <NdbBlob.hpp> -#include "NdbBlobImpl.hpp" -#include <NdbScanOperation.hpp> - -#ifdef NDB_BLOB_DEBUG -#define DBG(x) \ - do { \ - static const char* p = getenv("NDB_BLOB_DEBUG"); \ - if (p == 0 || *p == 0 || *p == '0') break; \ - static char* prefix = "BLOB"; \ - const char* cname = theColumn == NULL ? "-" : theColumn->m_name.c_str(); \ - ndbout << prefix << " " << hex << (void*)this << " " << cname; \ - ndbout << " " << dec << __LINE__ << " " << x << " " << *this << endl; \ - } while (0) - -static char* -ndb_blob_debug(const Uint32* data, unsigned size) -{ - static char buf[200]; // MT irrelevant - buf[0] = 0; - for (unsigned i = 0; i < size; i++) { - unsigned n = strlen(buf); - if (n + 10 < sizeof(buf)) - sprintf(buf + n, "%*s%08x", i != 0, "", data[i]); - } - return buf; -} - -#else -#define DBG(x) -#endif - -/* - * Reading index table directly (as a table) is faster but there are - * bugs or limitations. Keep the code and make possible to choose. - */ -static const bool g_ndb_blob_ok_to_read_index_table = false; - -// state (inline) - -inline void -NdbBlob::setState(State newState) -{ - DBG("setState " << newState); - theState = newState; -} - -// define blob table - -int -NdbBlob::getBlobTableName(char* btname, Ndb* anNdb, const char* tableName, const char* columnName) -{ - NdbTableImpl* t = anNdb->theDictionary->m_impl.getTable(tableName); - if (t == NULL) - return -1; - NdbColumnImpl* c = t->getColumn(columnName); - if (c == NULL) - return -1; - getBlobTableName(btname, t, c); - return 0; -} - -void -NdbBlob::getBlobTableName(char* btname, const NdbTableImpl* t, const NdbColumnImpl* c) -{ - assert(t != 0 && c != 0 && c->getBlobType()); - memset(btname, 0, NdbBlobImpl::BlobTableNameSize); - sprintf(btname, "NDB$BLOB_%d_%d", (int)t->m_tableId, (int)c->m_attrId); -} - -void -NdbBlob::getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c) -{ - char btname[NdbBlobImpl::BlobTableNameSize]; - getBlobTableName(btname, t, c); - bt.setName(btname); - bt.setLogging(t->getLogging()); - bt.setFragmentType(t->getFragmentType()); - { NdbDictionary::Column bc("PK"); - bc.setType(NdbDictionary::Column::Unsigned); - assert(t->m_keyLenInWords != 0); - bc.setLength(t->m_keyLenInWords); - bc.setPrimaryKey(true); - bc.setDistributionKey(true); - bt.addColumn(bc); - } - { NdbDictionary::Column bc("DIST"); - bc.setType(NdbDictionary::Column::Unsigned); - bc.setPrimaryKey(true); - bc.setDistributionKey(true); - bt.addColumn(bc); - } - { NdbDictionary::Column bc("PART"); - bc.setType(NdbDictionary::Column::Unsigned); - bc.setPrimaryKey(true); - bc.setDistributionKey(false); - bt.addColumn(bc); - } - { NdbDictionary::Column bc("DATA"); - switch (c->m_type) { - case NdbDictionary::Column::Blob: - bc.setType(NdbDictionary::Column::Binary); - break; - case NdbDictionary::Column::Text: - bc.setType(NdbDictionary::Column::Char); - break; - default: - assert(false); - break; - } - bc.setLength(c->getPartSize()); - bt.addColumn(bc); - } -} - -// initialization - -NdbBlob::NdbBlob() -{ - init(); -} - -void -NdbBlob::init() -{ - theState = Idle; - theNdb = NULL; - theNdbCon = NULL; - theNdbOp = NULL; - theTable = NULL; - theAccessTable = NULL; - theBlobTable = NULL; - theColumn = NULL; - theFillChar = 0; - theInlineSize = 0; - thePartSize = 0; - theStripeSize = 0; - theGetFlag = false; - theGetBuf = NULL; - theSetFlag = false; - theSetBuf = NULL; - theGetSetBytes = 0; - thePendingBlobOps = 0; - theActiveHook = NULL; - theActiveHookArg = NULL; - theHead = NULL; - theInlineData = NULL; - theHeadInlineRecAttr = NULL; - theHeadInlineReadOp = NULL; - theHeadInlineUpdateFlag = false; - theNullFlag = -1; - theLength = 0; - thePos = 0; - theNext = NULL; -} - -void -NdbBlob::release() -{ - setState(Idle); -} - -// buffers - -NdbBlob::Buf::Buf() : - data(NULL), - size(0), - maxsize(0) -{ -} - -NdbBlob::Buf::~Buf() -{ - delete [] data; -} - -void -NdbBlob::Buf::alloc(unsigned n) -{ - size = n; - if (maxsize < n) { - delete [] data; - // align to Uint64 - if (n % 8 != 0) - n += 8 - n % 8; - data = new char [n]; - maxsize = n; - } -#ifdef VM_TRACE - memset(data, 'X', maxsize); -#endif -} - -void -NdbBlob::Buf::copyfrom(const NdbBlob::Buf& src) -{ - assert(size == src.size); - memcpy(data, src.data, size); -} - -// classify operations (inline) - -inline bool -NdbBlob::isTableOp() -{ - return theTable == theAccessTable; -} - -inline bool -NdbBlob::isIndexOp() -{ - return theTable != theAccessTable; -} - -inline bool -NdbBlob::isKeyOp() -{ - return - theNdbOp->theOperationType == NdbOperation::InsertRequest || - theNdbOp->theOperationType == NdbOperation::UpdateRequest || - theNdbOp->theOperationType == NdbOperation::WriteRequest || - theNdbOp->theOperationType == NdbOperation::ReadRequest || - theNdbOp->theOperationType == NdbOperation::ReadExclusive || - theNdbOp->theOperationType == NdbOperation::DeleteRequest; -} - -inline bool -NdbBlob::isReadOp() -{ - return - theNdbOp->theOperationType == NdbOperation::ReadRequest || - theNdbOp->theOperationType == NdbOperation::ReadExclusive; -} - -inline bool -NdbBlob::isInsertOp() -{ - return - theNdbOp->theOperationType == NdbOperation::InsertRequest; -} - -inline bool -NdbBlob::isUpdateOp() -{ - return - theNdbOp->theOperationType == NdbOperation::UpdateRequest; -} - -inline bool -NdbBlob::isWriteOp() -{ - return - theNdbOp->theOperationType == NdbOperation::WriteRequest; -} - -inline bool -NdbBlob::isDeleteOp() -{ - return - theNdbOp->theOperationType == NdbOperation::DeleteRequest; -} - -inline bool -NdbBlob::isScanOp() -{ - return - theNdbOp->theOperationType == NdbOperation::OpenScanRequest || - theNdbOp->theOperationType == NdbOperation::OpenRangeScanRequest; -} - -// computations (inline) - -inline Uint32 -NdbBlob::getPartNumber(Uint64 pos) -{ - assert(thePartSize != 0 && pos >= theInlineSize); - return (pos - theInlineSize) / thePartSize; -} - -inline Uint32 -NdbBlob::getPartCount() -{ - if (theLength <= theInlineSize) - return 0; - return 1 + getPartNumber(theLength - 1); -} - -inline Uint32 -NdbBlob::getDistKey(Uint32 part) -{ - assert(theStripeSize != 0); - return (part / theStripeSize) % theStripeSize; -} - -// getters and setters - -int -NdbBlob::getTableKeyValue(NdbOperation* anOp) -{ - Uint32* data = (Uint32*)theKeyBuf.data; - unsigned pos = 0; - DBG("getTableKeyValue"); - for (unsigned i = 0; i < theTable->m_columns.size(); i++) { - NdbColumnImpl* c = theTable->m_columns[i]; - assert(c != NULL); - if (c->m_pk) { - unsigned len = c->m_attrSize * c->m_arraySize; - if (anOp->getValue_impl(c, (char*)&data[pos]) == NULL) { - setErrorCode(anOp); - return -1; - } - // odd bytes receive no data and must be zeroed - while (len % 4 != 0) { - char* p = (char*)&data[pos] + len++; - *p = 0; - } - pos += len / 4; - } - } - assert(pos == theKeyBuf.size / 4); - return 0; -} - -int -NdbBlob::setTableKeyValue(NdbOperation* anOp) -{ - const Uint32* data = (const Uint32*)theKeyBuf.data; - DBG("setTableKeyValue key=" << ndb_blob_debug(data, theTable->m_keyLenInWords)); - const unsigned columns = theTable->m_columns.size(); - unsigned pos = 0; - for (unsigned i = 0; i < columns; i++) { - NdbColumnImpl* c = theTable->m_columns[i]; - assert(c != NULL); - if (c->m_pk) { - unsigned len = c->m_attrSize * c->m_arraySize; - if (anOp->equal_impl(c, (const char*)&data[pos], len) == -1) { - setErrorCode(anOp); - return -1; - } - pos += (len + 3) / 4; - } - } - assert(pos == theKeyBuf.size / 4); - return 0; -} - -int -NdbBlob::setAccessKeyValue(NdbOperation* anOp) -{ - const Uint32* data = (const Uint32*)theAccessKeyBuf.data; - DBG("setAccessKeyValue key=" << ndb_blob_debug(data, theAccessTable->m_keyLenInWords)); - const unsigned columns = theAccessTable->m_columns.size(); - unsigned pos = 0; - for (unsigned i = 0; i < columns; i++) { - NdbColumnImpl* c = theAccessTable->m_columns[i]; - assert(c != NULL); - if (c->m_pk) { - unsigned len = c->m_attrSize * c->m_arraySize; - if (anOp->equal_impl(c, (const char*)&data[pos], len) == -1) { - setErrorCode(anOp); - return -1; - } - pos += (len + 3) / 4; - } - } - assert(pos == theAccessKeyBuf.size / 4); - return 0; -} - -int -NdbBlob::setPartKeyValue(NdbOperation* anOp, Uint32 part) -{ - Uint32* data = (Uint32*)theKeyBuf.data; - unsigned size = theTable->m_keyLenInWords; - DBG("setPartKeyValue dist=" << getDistKey(part) << " part=" << part << " key=" << ndb_blob_debug(data, size)); - // TODO use attr ids after compatibility with 4.1.7 not needed - if (anOp->equal("PK", theKeyBuf.data) == -1 || - anOp->equal("DIST", getDistKey(part)) == -1 || - anOp->equal("PART", part) == -1) { - setErrorCode(anOp); - return -1; - } - return 0; -} - -int -NdbBlob::getHeadInlineValue(NdbOperation* anOp) -{ - DBG("getHeadInlineValue"); - theHeadInlineRecAttr = anOp->getValue_impl(theColumn, theHeadInlineBuf.data); - if (theHeadInlineRecAttr == NULL) { - setErrorCode(anOp); - return -1; - } - return 0; -} - -void -NdbBlob::getHeadFromRecAttr() -{ - assert(theHeadInlineRecAttr != NULL); - theNullFlag = theHeadInlineRecAttr->isNULL(); - assert(theNullFlag != -1); - theLength = ! theNullFlag ? theHead->length : 0; - DBG("getHeadFromRecAttr [out]"); -} - -int -NdbBlob::setHeadInlineValue(NdbOperation* anOp) -{ - DBG("setHeadInlineValue"); - theHead->length = theLength; - if (theLength < theInlineSize) - memset(theInlineData + theLength, 0, theInlineSize - theLength); - assert(theNullFlag != -1); - const char* aValue = theNullFlag ? 0 : theHeadInlineBuf.data; - if (anOp->setValue(theColumn, aValue, theHeadInlineBuf.size) == -1) { - setErrorCode(anOp); - return -1; - } - theHeadInlineUpdateFlag = false; - return 0; -} - -// getValue/setValue - -int -NdbBlob::getValue(void* data, Uint32 bytes) -{ - DBG("getValue data=" << hex << data << " bytes=" << dec << bytes); - if (theGetFlag || theState != Prepared) { - setErrorCode(NdbBlobImpl::ErrState); - return -1; - } - if (! isReadOp() && ! isScanOp()) { - setErrorCode(NdbBlobImpl::ErrUsage); - return -1; - } - if (data == NULL && bytes != 0) { - setErrorCode(NdbBlobImpl::ErrUsage); - return -1; - } - theGetFlag = true; - theGetBuf = static_cast<char*>(data); - theGetSetBytes = bytes; - return 0; -} - -int -NdbBlob::setValue(const void* data, Uint32 bytes) -{ - DBG("setValue data=" << hex << data << " bytes=" << dec << bytes); - if (theSetFlag || theState != Prepared) { - setErrorCode(NdbBlobImpl::ErrState); - return -1; - } - if (! isInsertOp() && ! isUpdateOp() && ! isWriteOp()) { - setErrorCode(NdbBlobImpl::ErrUsage); - return -1; - } - if (data == NULL && bytes != 0) { - setErrorCode(NdbBlobImpl::ErrUsage); - return -1; - } - theSetFlag = true; - theSetBuf = static_cast<const char*>(data); - theGetSetBytes = bytes; - if (isInsertOp()) { - // write inline part now - if (theSetBuf != NULL) { - Uint32 n = theGetSetBytes; - if (n > theInlineSize) - n = theInlineSize; - assert(thePos == 0); - if (writeDataPrivate(theSetBuf, n) == -1) - return -1; - } else { - theNullFlag = true; - theLength = 0; - } - if (setHeadInlineValue(theNdbOp) == -1) - return -1; - } - return 0; -} - -// activation hook - -int -NdbBlob::setActiveHook(ActiveHook activeHook, void* arg) -{ - DBG("setActiveHook hook=" << hex << (void*)activeHook << " arg=" << hex << arg); - if (theState != Prepared) { - setErrorCode(NdbBlobImpl::ErrState); - return -1; - } - theActiveHook = activeHook; - theActiveHookArg = arg; - return 0; -} - -// misc operations - -int -NdbBlob::getNull(bool& isNull) -{ - DBG("getNull"); - if (theState == Prepared && theSetFlag) { - isNull = (theSetBuf == NULL); - return 0; - } - if (theNullFlag == -1) { - setErrorCode(NdbBlobImpl::ErrState); - return -1; - } - isNull = theNullFlag; - return 0; -} - -int -NdbBlob::setNull() -{ - DBG("setNull"); - if (theNullFlag == -1) { - if (theState == Prepared) { - return setValue(0, 0); - } - setErrorCode(NdbBlobImpl::ErrState); - return -1; - } - if (theNullFlag) - return 0; - if (deleteParts(0, getPartCount()) == -1) - return -1; - theNullFlag = true; - theLength = 0; - theHeadInlineUpdateFlag = true; - return 0; -} - -int -NdbBlob::getLength(Uint64& len) -{ - DBG("getLength"); - if (theState == Prepared && theSetFlag) { - len = theGetSetBytes; - return 0; - } - if (theNullFlag == -1) { - setErrorCode(NdbBlobImpl::ErrState); - return -1; - } - len = theLength; - return 0; -} - -int -NdbBlob::truncate(Uint64 length) -{ - DBG("truncate [in] length=" << length); - if (theNullFlag == -1) { - setErrorCode(NdbBlobImpl::ErrState); - return -1; - } - if (theLength > length) { - if (length > theInlineSize) { - Uint32 part1 = getPartNumber(length - 1); - Uint32 part2 = getPartNumber(theLength - 1); - assert(part2 >= part1); - if (part2 > part1 && deleteParts(part1 + 1, part2 - part1) == -1) - return -1; - } else { - if (deleteParts(0, getPartCount()) == -1) - return -1; - } - theLength = length; - theHeadInlineUpdateFlag = true; - if (thePos > length) - thePos = length; - } - DBG("truncate [out]"); - return 0; -} - -int -NdbBlob::getPos(Uint64& pos) -{ - DBG("getPos"); - if (theNullFlag == -1) { - setErrorCode(NdbBlobImpl::ErrState); - return -1; - } - pos = thePos; - return 0; -} - -int -NdbBlob::setPos(Uint64 pos) -{ - DBG("setPos pos=" << pos); - if (theNullFlag == -1) { - setErrorCode(NdbBlobImpl::ErrState); - return -1; - } - if (pos > theLength) { - setErrorCode(NdbBlobImpl::ErrSeek); - return -1; - } - thePos = pos; - return 0; -} - -// read/write - -int -NdbBlob::readData(void* data, Uint32& bytes) -{ - if (theState != Active) { - setErrorCode(NdbBlobImpl::ErrState); - return -1; - } - char* buf = static_cast<char*>(data); - return readDataPrivate(buf, bytes); -} - -int -NdbBlob::readDataPrivate(char* buf, Uint32& bytes) -{ - DBG("readData [in] bytes=" << bytes); - assert(thePos <= theLength); - Uint64 pos = thePos; - if (bytes > theLength - pos) - bytes = theLength - pos; - Uint32 len = bytes; - if (len > 0) { - // inline part - if (pos < theInlineSize) { - Uint32 n = theInlineSize - pos; - if (n > len) - n = len; - memcpy(buf, theInlineData + pos, n); - pos += n; - buf += n; - len -= n; - } - } - if (len > 0 && thePartSize == 0) { - setErrorCode(NdbBlobImpl::ErrSeek); - return -1; - } - if (len > 0) { - assert(pos >= theInlineSize); - Uint32 off = (pos - theInlineSize) % thePartSize; - // partial first block - if (off != 0) { - DBG("partial first block pos=" << pos << " len=" << len); - Uint32 part = (pos - theInlineSize) / thePartSize; - if (readParts(thePartBuf.data, part, 1) == -1) - return -1; - // need result now - if (executePendingBlobReads() == -1) - return -1; - Uint32 n = thePartSize - off; - if (n > len) - n = len; - memcpy(buf, thePartBuf.data + off, n); - pos += n; - buf += n; - len -= n; - } - } - if (len > 0) { - assert((pos - theInlineSize) % thePartSize == 0); - // complete blocks in the middle - if (len >= thePartSize) { - Uint32 part = (pos - theInlineSize) / thePartSize; - Uint32 count = len / thePartSize; - if (readParts(buf, part, count) == -1) - return -1; - Uint32 n = thePartSize * count; - pos += n; - buf += n; - len -= n; - } - } - if (len > 0) { - // partial last block - DBG("partial last block pos=" << pos << " len=" << len); - assert((pos - theInlineSize) % thePartSize == 0 && len < thePartSize); - Uint32 part = (pos - theInlineSize) / thePartSize; - if (readParts(thePartBuf.data, part, 1) == -1) - return -1; - // need result now - if (executePendingBlobReads() == -1) - return -1; - memcpy(buf, thePartBuf.data, len); - Uint32 n = len; - pos += n; - buf += n; - len -= n; - } - assert(len == 0); - thePos = pos; - assert(thePos <= theLength); - DBG("readData [out]"); - return 0; -} - -int -NdbBlob::writeData(const void* data, Uint32 bytes) -{ - if (theState != Active) { - setErrorCode(NdbBlobImpl::ErrState); - return -1; - } - const char* buf = static_cast<const char*>(data); - return writeDataPrivate(buf, bytes); -} - -int -NdbBlob::writeDataPrivate(const char* buf, Uint32 bytes) -{ - DBG("writeData [in] bytes=" << bytes); - assert(thePos <= theLength); - Uint64 pos = thePos; - Uint32 len = bytes; - // any write makes blob not NULL - if (theNullFlag) { - theNullFlag = false; - theHeadInlineUpdateFlag = true; - } - if (len > 0) { - // inline part - if (pos < theInlineSize) { - Uint32 n = theInlineSize - pos; - if (n > len) - n = len; - memcpy(theInlineData + pos, buf, n); - theHeadInlineUpdateFlag = true; - pos += n; - buf += n; - len -= n; - } - } - if (len > 0 && thePartSize == 0) { - setErrorCode(NdbBlobImpl::ErrSeek); - return -1; - } - if (len > 0) { - assert(pos >= theInlineSize); - Uint32 off = (pos - theInlineSize) % thePartSize; - // partial first block - if (off != 0) { - DBG("partial first block pos=" << pos << " len=" << len); - // flush writes to guarantee correct read - if (executePendingBlobWrites() == -1) - return -1; - Uint32 part = (pos - theInlineSize) / thePartSize; - if (readParts(thePartBuf.data, part, 1) == -1) - return -1; - // need result now - if (executePendingBlobReads() == -1) - return -1; - Uint32 n = thePartSize - off; - if (n > len) { - memset(thePartBuf.data + off + len, theFillChar, n - len); - n = len; - } - memcpy(thePartBuf.data + off, buf, n); - if (updateParts(thePartBuf.data, part, 1) == -1) - return -1; - pos += n; - buf += n; - len -= n; - } - } - if (len > 0) { - assert((pos - theInlineSize) % thePartSize == 0); - // complete blocks in the middle - if (len >= thePartSize) { - Uint32 part = (pos - theInlineSize) / thePartSize; - Uint32 count = len / thePartSize; - for (unsigned i = 0; i < count; i++) { - if (part + i < getPartCount()) { - if (updateParts(buf, part + i, 1) == -1) - return -1; - } else { - if (insertParts(buf, part + i, 1) == -1) - return -1; - } - Uint32 n = thePartSize; - pos += n; - buf += n; - len -= n; - } - } - } - if (len > 0) { - // partial last block - DBG("partial last block pos=" << pos << " len=" << len); - assert((pos - theInlineSize) % thePartSize == 0 && len < thePartSize); - Uint32 part = (pos - theInlineSize) / thePartSize; - if (theLength > pos + len) { - // flush writes to guarantee correct read - if (executePendingBlobWrites() == -1) - return -1; - if (readParts(thePartBuf.data, part, 1) == -1) - return -1; - // need result now - if (executePendingBlobReads() == -1) - return -1; - memcpy(thePartBuf.data, buf, len); - if (updateParts(thePartBuf.data, part, 1) == -1) - return -1; - } else { - memcpy(thePartBuf.data, buf, len); - memset(thePartBuf.data + len, theFillChar, thePartSize - len); - if (part < getPartCount()) { - if (updateParts(thePartBuf.data, part, 1) == -1) - return -1; - } else { - if (insertParts(thePartBuf.data, part, 1) == -1) - return -1; - } - } - Uint32 n = len; - pos += n; - buf += n; - len -= n; - } - assert(len == 0); - if (theLength < pos) { - theLength = pos; - theHeadInlineUpdateFlag = true; - } - thePos = pos; - assert(thePos <= theLength); - DBG("writeData [out]"); - return 0; -} - -int -NdbBlob::readParts(char* buf, Uint32 part, Uint32 count) -{ - DBG("readParts [in] part=" << part << " count=" << count); - Uint32 n = 0; - while (n < count) { - NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); - if (tOp == NULL || - tOp->committedRead() == -1 || - setPartKeyValue(tOp, part + n) == -1 || - tOp->getValue((Uint32)3, buf) == NULL) { - setErrorCode(tOp); - return -1; - } - tOp->m_abortOption = NdbTransaction::AbortOnError; - buf += thePartSize; - n++; - thePendingBlobOps |= (1 << NdbOperation::ReadRequest); - theNdbCon->thePendingBlobOps |= (1 << NdbOperation::ReadRequest); - } - return 0; -} - -int -NdbBlob::insertParts(const char* buf, Uint32 part, Uint32 count) -{ - DBG("insertParts [in] part=" << part << " count=" << count); - Uint32 n = 0; - while (n < count) { - NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); - if (tOp == NULL || - tOp->insertTuple() == -1 || - setPartKeyValue(tOp, part + n) == -1 || - tOp->setValue((Uint32)3, buf) == -1) { - setErrorCode(tOp); - return -1; - } - tOp->m_abortOption = NdbTransaction::AbortOnError; - buf += thePartSize; - n++; - thePendingBlobOps |= (1 << NdbOperation::InsertRequest); - theNdbCon->thePendingBlobOps |= (1 << NdbOperation::InsertRequest); - } - return 0; -} - -int -NdbBlob::updateParts(const char* buf, Uint32 part, Uint32 count) -{ - DBG("updateParts [in] part=" << part << " count=" << count); - Uint32 n = 0; - while (n < count) { - NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); - if (tOp == NULL || - tOp->updateTuple() == -1 || - setPartKeyValue(tOp, part + n) == -1 || - tOp->setValue((Uint32)3, buf) == -1) { - setErrorCode(tOp); - return -1; - } - tOp->m_abortOption = NdbTransaction::AbortOnError; - buf += thePartSize; - n++; - thePendingBlobOps |= (1 << NdbOperation::UpdateRequest); - theNdbCon->thePendingBlobOps |= (1 << NdbOperation::UpdateRequest); - } - return 0; -} - -int -NdbBlob::deleteParts(Uint32 part, Uint32 count) -{ - DBG("deleteParts [in] part=" << part << " count=" << count); - Uint32 n = 0; - while (n < count) { - NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); - if (tOp == NULL || - tOp->deleteTuple() == -1 || - setPartKeyValue(tOp, part + n) == -1) { - setErrorCode(tOp); - return -1; - } - tOp->m_abortOption = NdbTransaction::AbortOnError; - n++; - thePendingBlobOps |= (1 << NdbOperation::DeleteRequest); - theNdbCon->thePendingBlobOps |= (1 << NdbOperation::DeleteRequest); - } - return 0; -} - -/* - * Number of blob parts not known. Used to check for race condition - * when writeTuple is used for insert. Deletes all parts found. - */ -int -NdbBlob::deletePartsUnknown(Uint32 part) -{ - DBG("deletePartsUnknown [in] part=" << part << " count=all"); - static const unsigned maxbat = 256; - static const unsigned minbat = 1; - unsigned bat = minbat; - NdbOperation* tOpList[maxbat]; - Uint32 count = 0; - while (true) { - Uint32 n; - n = 0; - while (n < bat) { - NdbOperation*& tOp = tOpList[n]; // ref - tOp = theNdbCon->getNdbOperation(theBlobTable); - if (tOp == NULL || - tOp->deleteTuple() == -1 || - setPartKeyValue(tOp, part + count + n) == -1) { - setErrorCode(tOp); - return -1; - } - tOp->m_abortOption= NdbTransaction::AO_IgnoreError; - n++; - } - DBG("deletePartsUnknown: executeNoBlobs [in] bat=" << bat); - if (theNdbCon->executeNoBlobs(NdbTransaction::NoCommit) == -1) - return -1; - DBG("deletePartsUnknown: executeNoBlobs [out]"); - n = 0; - while (n < bat) { - NdbOperation* tOp = tOpList[n]; - if (tOp->theError.code != 0) { - if (tOp->theError.code != 626) { - setErrorCode(tOp); - return -1; - } - // first non-existent part - DBG("deletePartsUnknown [out] count=" << count); - return 0; - } - n++; - count++; - } - bat *= 4; - if (bat > maxbat) - bat = maxbat; - } -} - -// pending ops - -int -NdbBlob::executePendingBlobReads() -{ - Uint8 flags = (1 << NdbOperation::ReadRequest); - if (thePendingBlobOps & flags) { - DBG("executePendingBlobReads: executeNoBlobs [in]"); - if (theNdbCon->executeNoBlobs(NdbTransaction::NoCommit) == -1) - return -1; - DBG("executePendingBlobReads: executeNoBlobs [out]"); - thePendingBlobOps = 0; - theNdbCon->thePendingBlobOps = 0; - } - return 0; -} - -int -NdbBlob::executePendingBlobWrites() -{ - Uint8 flags = 0xFF & ~(1 << NdbOperation::ReadRequest); - if (thePendingBlobOps & flags) { - DBG("executePendingBlobWrites: executeNoBlobs [in]"); - if (theNdbCon->executeNoBlobs(NdbTransaction::NoCommit) == -1) - return -1; - DBG("executePendingBlobWrites: executeNoBlobs [out]"); - thePendingBlobOps = 0; - theNdbCon->thePendingBlobOps = 0; - } - return 0; -} - -// callbacks - -int -NdbBlob::invokeActiveHook() -{ - DBG("invokeActiveHook [in]"); - assert(theState == Active && theActiveHook != NULL); - int ret = (*theActiveHook)(this, theActiveHookArg); - DBG("invokeActiveHook [out] ret=" << ret); - if (ret != 0) { - // no error is set on blob level - return -1; - } - return 0; -} - -// blob handle maintenance - -/* - * Prepare blob handle linked to an operation. Checks blob table. - * Allocates buffers. For key operation fetches key data from signal - * data. For read operation adds read of head+inline. - */ -int -NdbBlob::atPrepare(NdbTransaction* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn) -{ - assert(theState == Idle); - // ndb api stuff - theNdb = anOp->theNdb; - theNdbCon = aCon; // for scan, this is the real transaction (m_transConnection) - theNdbOp = anOp; - theTable = anOp->m_currentTable; - theAccessTable = anOp->m_accessTable; - theColumn = aColumn; - DBG("atPrepare [in]"); - NdbDictionary::Column::Type partType = NdbDictionary::Column::Undefined; - switch (theColumn->getType()) { - case NdbDictionary::Column::Blob: - partType = NdbDictionary::Column::Binary; - theFillChar = 0x0; - break; - case NdbDictionary::Column::Text: - partType = NdbDictionary::Column::Char; - theFillChar = 0x20; - break; - default: - setErrorCode(NdbBlobImpl::ErrUsage); - return -1; - } - // sizes - theInlineSize = theColumn->getInlineSize(); - thePartSize = theColumn->getPartSize(); - theStripeSize = theColumn->getStripeSize(); - // sanity check - assert((NDB_BLOB_HEAD_SIZE << 2) == sizeof(Head)); - assert(theColumn->m_attrSize * theColumn->m_arraySize == sizeof(Head) + theInlineSize); - if (thePartSize > 0) { - const NdbDictionary::Table* bt = NULL; - const NdbDictionary::Column* bc = NULL; - if (theStripeSize == 0 || - (bt = theColumn->getBlobTable()) == NULL || - (bc = bt->getColumn("DATA")) == NULL || - bc->getType() != partType || - bc->getLength() != (int)thePartSize) { - setErrorCode(NdbBlobImpl::ErrTable); - return -1; - } - theBlobTable = &NdbTableImpl::getImpl(*bt); - } - // buffers - theKeyBuf.alloc(theTable->m_keyLenInWords << 2); - theAccessKeyBuf.alloc(theAccessTable->m_keyLenInWords << 2); - theHeadInlineBuf.alloc(sizeof(Head) + theInlineSize); - theHeadInlineCopyBuf.alloc(sizeof(Head) + theInlineSize); - thePartBuf.alloc(thePartSize); - theHead = (Head*)theHeadInlineBuf.data; - theInlineData = theHeadInlineBuf.data + sizeof(Head); - // handle different operation types - bool supportedOp = false; - if (isKeyOp()) { - if (isTableOp()) { - // get table key - Uint32* data = (Uint32*)theKeyBuf.data; - unsigned size = theTable->m_keyLenInWords; - if (theNdbOp->getKeyFromTCREQ(data, size) == -1) { - setErrorCode(NdbBlobImpl::ErrUsage); - return -1; - } - } - if (isIndexOp()) { - // get index key - Uint32* data = (Uint32*)theAccessKeyBuf.data; - unsigned size = theAccessTable->m_keyLenInWords; - if (theNdbOp->getKeyFromTCREQ(data, size) == -1) { - setErrorCode(NdbBlobImpl::ErrUsage); - return -1; - } - } - if (isReadOp()) { - // add read of head+inline in this op - if (getHeadInlineValue(theNdbOp) == -1) - return -1; - } - if (isInsertOp()) { - // becomes NULL unless set before execute - theNullFlag = true; - theLength = 0; - } - if (isWriteOp()) { - // becomes NULL unless set before execute - theNullFlag = true; - theLength = 0; - theHeadInlineUpdateFlag = true; - } - supportedOp = true; - } - if (isScanOp()) { - // add read of head+inline in this op - if (getHeadInlineValue(theNdbOp) == -1) - return -1; - supportedOp = true; - } - if (! supportedOp) { - setErrorCode(NdbBlobImpl::ErrUsage); - return -1; - } - setState(Prepared); - DBG("atPrepare [out]"); - return 0; -} - -/* - * Before execute of prepared operation. May add new operations before - * this one. May ask that this operation and all before it (a "batch") - * is executed immediately in no-commit mode. In this case remaining - * prepared operations are saved in a separate list. They are added - * back after postExecute. - */ -int -NdbBlob::preExecute(NdbTransaction::ExecType anExecType, bool& batch) -{ - DBG("preExecute [in]"); - if (theState == Invalid) - return -1; - assert(theState == Prepared); - // handle different operation types - assert(isKeyOp()); - if (isReadOp()) { - if (theGetFlag && theGetSetBytes > theInlineSize) { - // need blob head before proceeding - batch = true; - } - } - if (isInsertOp()) { - if (theSetFlag && theGetSetBytes > theInlineSize) { - // add ops to write rest of a setValue - assert(theSetBuf != NULL); - const char* buf = theSetBuf + theInlineSize; - Uint32 bytes = theGetSetBytes - theInlineSize; - assert(thePos == theInlineSize); - if (writeDataPrivate(buf, bytes) == -1) - return -1; - if (theHeadInlineUpdateFlag) { - // add an operation to update head+inline - NdbOperation* tOp = theNdbCon->getNdbOperation(theTable); - if (tOp == NULL || - tOp->updateTuple() == -1 || - setTableKeyValue(tOp) == -1 || - setHeadInlineValue(tOp) == -1) { - setErrorCode(NdbBlobImpl::ErrAbort); - return -1; - } - DBG("add op to update head+inline"); - } - } - } - if (isTableOp()) { - if (isUpdateOp() || isWriteOp() || isDeleteOp()) { - // add operation before this one to read head+inline - NdbOperation* tOp = theNdbCon->getNdbOperation(theTable, theNdbOp); - if (tOp == NULL || - tOp->readTuple() == -1 || - setTableKeyValue(tOp) == -1 || - getHeadInlineValue(tOp) == -1) { - setErrorCode(tOp); - return -1; - } - if (isWriteOp()) { - tOp->m_abortOption = NdbTransaction::AO_IgnoreError; - } - theHeadInlineReadOp = tOp; - // execute immediately - batch = true; - DBG("add op before to read head+inline"); - } - } - if (isIndexOp()) { - // add op before this one to read table key - NdbBlob* tFirstBlob = theNdbOp->theBlobList; - if (this == tFirstBlob) { - // first blob does it for all - if (g_ndb_blob_ok_to_read_index_table) { - Uint32 pkAttrId = theAccessTable->getNoOfColumns() - 1; - NdbOperation* tOp = theNdbCon->getNdbOperation(theAccessTable, theNdbOp); - if (tOp == NULL || - tOp->readTuple() == -1 || - setAccessKeyValue(tOp) == -1 || - tOp->getValue(pkAttrId, theKeyBuf.data) == NULL) { - setErrorCode(tOp); - return -1; - } - } else { - NdbIndexOperation* tOp = theNdbCon->getNdbIndexOperation(theAccessTable->m_index, theTable, theNdbOp); - if (tOp == NULL || - tOp->readTuple() == -1 || - setAccessKeyValue(tOp) == -1 || - getTableKeyValue(tOp) == -1) { - setErrorCode(tOp); - return -1; - } - } - } - DBG("added op before to read table key"); - if (isUpdateOp() || isDeleteOp()) { - // add op before this one to read head+inline via index - NdbIndexOperation* tOp = theNdbCon->getNdbIndexOperation(theAccessTable->m_index, theTable, theNdbOp); - if (tOp == NULL || - tOp->readTuple() == -1 || - setAccessKeyValue(tOp) == -1 || - getHeadInlineValue(tOp) == -1) { - setErrorCode(tOp); - return -1; - } - if (isWriteOp()) { - tOp->m_abortOption = NdbTransaction::AO_IgnoreError; - } - theHeadInlineReadOp = tOp; - // execute immediately - batch = true; - DBG("added index op before to read head+inline"); - } - if (isWriteOp()) { - // XXX until IgnoreError fixed for index op - batch = true; - } - } - if (isWriteOp()) { - if (theSetFlag) { - // write head+inline now - theNullFlag = true; - theLength = 0; - if (theSetBuf != NULL) { - Uint32 n = theGetSetBytes; - if (n > theInlineSize) - n = theInlineSize; - assert(thePos == 0); - if (writeDataPrivate(theSetBuf, n) == -1) - return -1; - } - if (setHeadInlineValue(theNdbOp) == -1) - return -1; - // the read op before us may overwrite - theHeadInlineCopyBuf.copyfrom(theHeadInlineBuf); - } - } - if (theActiveHook != NULL) { - // need blob head for callback - batch = true; - } - DBG("preExecute [out] batch=" << batch); - return 0; -} - -/* - * After execute, for any operation. If already Active, this routine - * has been done previously. Operations which requested a no-commit - * batch can add new operations after this one. They are added before - * any remaining prepared operations. - */ -int -NdbBlob::postExecute(NdbTransaction::ExecType anExecType) -{ - DBG("postExecute [in] type=" << anExecType); - if (theState == Invalid) - return -1; - if (theState == Active) { - setState(anExecType == NdbTransaction::NoCommit ? Active : Closed); - DBG("postExecute [skip]"); - return 0; - } - assert(theState == Prepared); - setState(anExecType == NdbTransaction::NoCommit ? Active : Closed); - assert(isKeyOp()); - if (isIndexOp()) { - NdbBlob* tFirstBlob = theNdbOp->theBlobList; - if (this != tFirstBlob) { - // copy key from first blob - assert(theKeyBuf.size == tFirstBlob->theKeyBuf.size); - memcpy(theKeyBuf.data, tFirstBlob->theKeyBuf.data, tFirstBlob->theKeyBuf.size); - } - } - if (isReadOp()) { - getHeadFromRecAttr(); - if (setPos(0) == -1) - return -1; - if (theGetFlag) { - assert(theGetSetBytes == 0 || theGetBuf != 0); - assert(theGetSetBytes <= theInlineSize || - anExecType == NdbTransaction::NoCommit); - Uint32 bytes = theGetSetBytes; - if (readDataPrivate(theGetBuf, bytes) == -1) - return -1; - } - } - if (isUpdateOp()) { - assert(anExecType == NdbTransaction::NoCommit); - getHeadFromRecAttr(); - if (theSetFlag) { - // setValue overwrites everything - if (theSetBuf != NULL) { - if (truncate(0) == -1) - return -1; - assert(thePos == 0); - if (writeDataPrivate(theSetBuf, theGetSetBytes) == -1) - return -1; - } else { - if (setNull() == -1) - return -1; - } - } - } - if (isWriteOp() && isTableOp()) { - assert(anExecType == NdbTransaction::NoCommit); - if (theHeadInlineReadOp->theError.code == 0) { - int tNullFlag = theNullFlag; - Uint64 tLength = theLength; - Uint64 tPos = thePos; - getHeadFromRecAttr(); - DBG("tuple found"); - if (truncate(0) == -1) - return -1; - // restore previous head+inline - theHeadInlineBuf.copyfrom(theHeadInlineCopyBuf); - theNullFlag = tNullFlag; - theLength = tLength; - thePos = tPos; - } else { - if (theHeadInlineReadOp->theError.code != 626) { - setErrorCode(theHeadInlineReadOp); - return -1; - } - DBG("tuple not found"); - /* - * Read found no tuple but it is possible that a tuple was - * created after the read by another transaction. Delete all - * blob parts which may exist. - */ - if (deletePartsUnknown(0) == -1) - return -1; - } - if (theSetFlag && theGetSetBytes > theInlineSize) { - assert(theSetBuf != NULL); - const char* buf = theSetBuf + theInlineSize; - Uint32 bytes = theGetSetBytes - theInlineSize; - assert(thePos == theInlineSize); - if (writeDataPrivate(buf, bytes) == -1) - return -1; - } - } - if (isWriteOp() && isIndexOp()) { - // XXX until IgnoreError fixed for index op - if (deletePartsUnknown(0) == -1) - return -1; - if (theSetFlag && theGetSetBytes > theInlineSize) { - assert(theSetBuf != NULL); - const char* buf = theSetBuf + theInlineSize; - Uint32 bytes = theGetSetBytes - theInlineSize; - assert(thePos == theInlineSize); - if (writeDataPrivate(buf, bytes) == -1) - return -1; - } - } - if (isDeleteOp()) { - assert(anExecType == NdbTransaction::NoCommit); - getHeadFromRecAttr(); - if (deleteParts(0, getPartCount()) == -1) - return -1; - } - setState(anExecType == NdbTransaction::NoCommit ? Active : Closed); - // activation callback - if (theActiveHook != NULL) { - if (invokeActiveHook() == -1) - return -1; - } - if (anExecType == NdbTransaction::NoCommit && theHeadInlineUpdateFlag) { - NdbOperation* tOp = theNdbCon->getNdbOperation(theTable); - if (tOp == NULL || - tOp->updateTuple() == -1 || - setTableKeyValue(tOp) == -1 || - setHeadInlineValue(tOp) == -1) { - setErrorCode(NdbBlobImpl::ErrAbort); - return -1; - } - tOp->m_abortOption = NdbTransaction::AbortOnError; - DBG("added op to update head+inline"); - } - DBG("postExecute [out]"); - return 0; -} - -/* - * Before commit of completed operation. For write add operation to - * update head+inline. - */ -int -NdbBlob::preCommit() -{ - DBG("preCommit [in]"); - if (theState == Invalid) - return -1; - assert(theState == Active); - assert(isKeyOp()); - if (isInsertOp() || isUpdateOp() || isWriteOp()) { - if (theHeadInlineUpdateFlag) { - // add an operation to update head+inline - NdbOperation* tOp = theNdbCon->getNdbOperation(theTable); - if (tOp == NULL || - tOp->updateTuple() == -1 || - setTableKeyValue(tOp) == -1 || - setHeadInlineValue(tOp) == -1) { - setErrorCode(NdbBlobImpl::ErrAbort); - return -1; - } - tOp->m_abortOption = NdbTransaction::AbortOnError; - DBG("added op to update head+inline"); - } - } - DBG("preCommit [out]"); - return 0; -} - -/* - * After next scan result. Handle like read op above. - */ -int -NdbBlob::atNextResult() -{ - DBG("atNextResult [in]"); - if (theState == Invalid) - return -1; - assert(isScanOp()); - // get primary key - { Uint32* data = (Uint32*)theKeyBuf.data; - unsigned size = theTable->m_keyLenInWords; - if (((NdbScanOperation*)theNdbOp)->getKeyFromKEYINFO20(data, size) == -1) { - setErrorCode(NdbBlobImpl::ErrUsage); - return -1; - } - } - getHeadFromRecAttr(); - if (setPos(0) == -1) - return -1; - if (theGetFlag) { - assert(theGetSetBytes == 0 || theGetBuf != 0); - Uint32 bytes = theGetSetBytes; - if (readDataPrivate(theGetBuf, bytes) == -1) - return -1; - } - setState(Active); - // activation callback - if (theActiveHook != NULL) { - if (invokeActiveHook() == -1) - return -1; - } - DBG("atNextResult [out]"); - return 0; -} - -// misc - -const NdbDictionary::Column* -NdbBlob::getColumn() -{ - return theColumn; -} - -// errors - -void -NdbBlob::setErrorCode(int anErrorCode, bool invalidFlag) -{ - DBG("setErrorCode code=" << anErrorCode); - theError.code = anErrorCode; - // conditionally copy error to operation level - if (theNdbOp != NULL && theNdbOp->theError.code == 0) - theNdbOp->setErrorCode(theError.code); - if (invalidFlag) - setState(Invalid); -} - -void -NdbBlob::setErrorCode(NdbOperation* anOp, bool invalidFlag) -{ - int code = 0; - if (anOp != NULL && (code = anOp->theError.code) != 0) - ; - else if ((code = theNdbCon->theError.code) != 0) - ; - else if ((code = theNdb->theError.code) != 0) - ; - else - code = NdbBlobImpl::ErrUnknown; - setErrorCode(code, invalidFlag); -} - -void -NdbBlob::setErrorCode(NdbTransaction* aCon, bool invalidFlag) -{ - int code = 0; - if (theNdbCon != NULL && (code = theNdbCon->theError.code) != 0) - ; - else if ((code = theNdb->theError.code) != 0) - ; - else - code = NdbBlobImpl::ErrUnknown; - setErrorCode(code, invalidFlag); -} - -// info about all blobs in this operation - -NdbBlob* -NdbBlob::blobsFirstBlob() -{ - return theNdbOp->theBlobList; -} - -NdbBlob* -NdbBlob::blobsNextBlob() -{ - return theNext; -} - -// debug - -#ifdef VM_TRACE -inline int -NdbBlob::getOperationType() const -{ - return theNdbOp != NULL ? theNdbOp->theOperationType : -1; -} - -NdbOut& -operator<<(NdbOut& out, const NdbBlob& blob) -{ - ndbout << dec << "o=" << blob.getOperationType(); - ndbout << dec << " s=" << (Uint32) blob.theState; - ndbout << dec << " n=" << blob.theNullFlag;; - ndbout << dec << " l=" << blob.theLength; - ndbout << dec << " p=" << blob.thePos; - ndbout << dec << " u=" << (Uint32)blob.theHeadInlineUpdateFlag; - ndbout << dec << " g=" << (Uint32)blob.theGetSetBytes; - return out; -} -#endif diff --git a/ndb/src/ndbapi/NdbBlobImpl.hpp b/ndb/src/ndbapi/NdbBlobImpl.hpp deleted file mode 100644 index 0030e910c52..00000000000 --- a/ndb/src/ndbapi/NdbBlobImpl.hpp +++ /dev/null @@ -1,39 +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 NdbBlobImpl_H -#define NdbBlobImpl_H - -class NdbBlobImpl { -public: - STATIC_CONST( BlobTableNameSize = 40 ); - // "Invalid blob attributes or invalid blob parts table" - STATIC_CONST( ErrTable = 4263 ); - // "Invalid usage of blob attribute" - STATIC_CONST( ErrUsage = 4264 ); - // "Method is not valid in current blob state" - STATIC_CONST( ErrState = 4265 ); - // "Invalid blob seek position" - STATIC_CONST( ErrSeek = 4266 ); - // "Corrupted blob value" - STATIC_CONST( ErrCorrupt = 4267 ); - // "Error in blob head update forced rollback of transaction" - STATIC_CONST( ErrAbort = 4268 ); - // "Unknown blob error" - STATIC_CONST( ErrUnknown = 4269 ); -}; - -#endif diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp deleted file mode 100644 index 4cc47543cec..00000000000 --- a/ndb/src/ndbapi/NdbDictionary.cpp +++ /dev/null @@ -1,1050 +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 */ - -#include <NdbDictionary.hpp> -#include "NdbDictionaryImpl.hpp" -#include <NdbOut.hpp> - -/***************************************************************** - * Column facade - */ -NdbDictionary::Column::Column(const char * name) - : m_impl(* new NdbColumnImpl(* this)) -{ - setName(name); -} - -NdbDictionary::Column::Column(const NdbDictionary::Column & org) - : m_impl(* new NdbColumnImpl(* this)) -{ - m_impl = org.m_impl; -} - -NdbDictionary::Column::Column(NdbColumnImpl& impl) - : m_impl(impl) -{ -} - -NdbDictionary::Column::~Column(){ - NdbColumnImpl * tmp = &m_impl; - if(this != tmp){ - delete tmp; - } -} - -NdbDictionary::Column& -NdbDictionary::Column::operator=(const NdbDictionary::Column& column) -{ - m_impl = column.m_impl; - - return *this; -} - -void -NdbDictionary::Column::setName(const char * name){ - m_impl.m_name.assign(name); -} - -const char* -NdbDictionary::Column::getName() const { - return m_impl.m_name.c_str(); -} - -void -NdbDictionary::Column::setType(Type t){ - m_impl.init(t); -} - -NdbDictionary::Column::Type -NdbDictionary::Column::getType() const { - return m_impl.m_type; -} - -void -NdbDictionary::Column::setPrecision(int val){ - m_impl.m_precision = val; -} - -int -NdbDictionary::Column::getPrecision() const { - return m_impl.m_precision; -} - -void -NdbDictionary::Column::setScale(int val){ - m_impl.m_scale = val; -} - -int -NdbDictionary::Column::getScale() const{ - return m_impl.m_scale; -} - -void -NdbDictionary::Column::setLength(int length){ - m_impl.m_length = length; -} - -int -NdbDictionary::Column::getLength() const{ - return m_impl.m_length; -} - -void -NdbDictionary::Column::setInlineSize(int size) -{ - m_impl.m_precision = size; -} - -void -NdbDictionary::Column::setCharset(CHARSET_INFO* cs) -{ - m_impl.m_cs = cs; -} - -CHARSET_INFO* -NdbDictionary::Column::getCharset() const -{ - return m_impl.m_cs; -} - -int -NdbDictionary::Column::getInlineSize() const -{ - return m_impl.m_precision; -} - -void -NdbDictionary::Column::setPartSize(int size) -{ - m_impl.m_scale = size; -} - -int -NdbDictionary::Column::getPartSize() const -{ - return m_impl.m_scale; -} - -void -NdbDictionary::Column::setStripeSize(int size) -{ - m_impl.m_length = size; -} - -int -NdbDictionary::Column::getStripeSize() const -{ - return m_impl.m_length; -} - -int -NdbDictionary::Column::getSize() const{ - return m_impl.m_attrSize; -} - -void -NdbDictionary::Column::setNullable(bool val){ - m_impl.m_nullable = val; -} - -bool -NdbDictionary::Column::getNullable() const { - return m_impl.m_nullable; -} - -void -NdbDictionary::Column::setPrimaryKey(bool val){ - m_impl.m_pk = val; -} - -bool -NdbDictionary::Column::getPrimaryKey() const { - return m_impl.m_pk; -} - -void -NdbDictionary::Column::setPartitionKey(bool val){ - m_impl.m_distributionKey = val; -} - -bool -NdbDictionary::Column::getPartitionKey() const{ - return m_impl.m_distributionKey; -} - -const NdbDictionary::Table * -NdbDictionary::Column::getBlobTable() const { - NdbTableImpl * t = m_impl.m_blobTable; - if (t) - return t->m_facade; - return 0; -} - -void -NdbDictionary::Column::setAutoIncrement(bool val){ - m_impl.m_autoIncrement = val; -} - -bool -NdbDictionary::Column::getAutoIncrement() const { - return m_impl.m_autoIncrement; -} - -void -NdbDictionary::Column::setAutoIncrementInitialValue(Uint64 val){ - m_impl.m_autoIncrementInitialValue = val; -} - -void -NdbDictionary::Column::setDefaultValue(const char* defaultValue) -{ - m_impl.m_defaultValue.assign(defaultValue); -} - -const char* -NdbDictionary::Column::getDefaultValue() const -{ - return m_impl.m_defaultValue.c_str(); -} - -int -NdbDictionary::Column::getColumnNo() const { - return m_impl.m_attrId; -} - -bool -NdbDictionary::Column::equal(const NdbDictionary::Column & col) const { - return m_impl.equal(col.m_impl); -} - -int -NdbDictionary::Column::getSizeInBytes() const -{ - return m_impl.m_attrSize * m_impl.m_arraySize; -} - -/***************************************************************** - * Table facade - */ -NdbDictionary::Table::Table(const char * name) - : m_impl(* new NdbTableImpl(* this)) -{ - setName(name); -} - -NdbDictionary::Table::Table(const NdbDictionary::Table & org) - : NdbDictionary::Object(), - m_impl(* new NdbTableImpl(* this)) -{ - m_impl.assign(org.m_impl); -} - -NdbDictionary::Table::Table(NdbTableImpl & impl) - : m_impl(impl) -{ -} - -NdbDictionary::Table::~Table(){ - NdbTableImpl * tmp = &m_impl; - if(this != tmp){ - delete tmp; - } -} - -NdbDictionary::Table& -NdbDictionary::Table::operator=(const NdbDictionary::Table& table) -{ - m_impl.assign(table.m_impl); - - m_impl.m_facade = this; - return *this; -} - -void -NdbDictionary::Table::setName(const char * name){ - m_impl.setName(name); -} - -const char * -NdbDictionary::Table::getName() const { - return m_impl.getName(); -} - -int -NdbDictionary::Table::getTableId() const { - return m_impl.m_tableId; -} - -void -NdbDictionary::Table::addColumn(const Column & c){ - NdbColumnImpl* col = new NdbColumnImpl; - (* col) = NdbColumnImpl::getImpl(c); - m_impl.m_columns.push_back(col); - if(c.getPrimaryKey()){ - m_impl.m_noOfKeys++; - } - if (col->getBlobType()) { - m_impl.m_noOfBlobs++; - } - m_impl.buildColumnHash(); -} - -const NdbDictionary::Column* -NdbDictionary::Table::getColumn(const char * name) const { - return m_impl.getColumn(name); -} - -const NdbDictionary::Column* -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; -} - -bool -NdbDictionary::Table::getLogging() const { - return m_impl.m_logging; -} - -void -NdbDictionary::Table::setFragmentType(FragmentType ft){ - m_impl.m_fragmentType = ft; -} - -NdbDictionary::Object::FragmentType -NdbDictionary::Table::getFragmentType() const { - return m_impl.m_fragmentType; -} - -void -NdbDictionary::Table::setKValue(int kValue){ - m_impl.m_kvalue = kValue; -} - -int -NdbDictionary::Table::getKValue() const { - return m_impl.m_kvalue; -} - -void -NdbDictionary::Table::setMinLoadFactor(int lf){ - m_impl.m_minLoadFactor = lf; -} - -int -NdbDictionary::Table::getMinLoadFactor() const { - return m_impl.m_minLoadFactor; -} - -void -NdbDictionary::Table::setMaxLoadFactor(int lf){ - m_impl.m_maxLoadFactor = lf; -} - -int -NdbDictionary::Table::getMaxLoadFactor() const { - return m_impl.m_maxLoadFactor; -} - -int -NdbDictionary::Table::getNoOfColumns() const { - return m_impl.m_columns.size(); -} - -int -NdbDictionary::Table::getNoOfPrimaryKeys() const { - return m_impl.m_noOfKeys; -} - -const char* -NdbDictionary::Table::getPrimaryKey(int no) const { - int count = 0; - for (unsigned i = 0; i < m_impl.m_columns.size(); i++) { - if (m_impl.m_columns[i]->m_pk) { - if (count++ == no) - return m_impl.m_columns[i]->m_name.c_str(); - } - } - return 0; -} - -const void* -NdbDictionary::Table::getFrmData() const { - return m_impl.m_frm.get_data(); -} - -Uint32 -NdbDictionary::Table::getFrmLength() const { - return m_impl.m_frm.length(); -} - -void -NdbDictionary::Table::setFrm(const void* data, Uint32 len){ - m_impl.m_frm.assign(data, len); -} - -NdbDictionary::Object::Status -NdbDictionary::Table::getObjectStatus() const { - return m_impl.m_status; -} - -int -NdbDictionary::Table::getObjectVersion() const { - return m_impl.m_version; -} - -bool -NdbDictionary::Table::equal(const NdbDictionary::Table & col) const { - return m_impl.equal(col.m_impl); -} - -int -NdbDictionary::Table::getRowSizeInBytes() const { - int sz = 0; - for(int i = 0; i<getNoOfColumns(); i++){ - const NdbDictionary::Column * c = getColumn(i); - sz += (c->getSizeInBytes()+ 3) / 4; - } - return sz * 4; -} - -int -NdbDictionary::Table::getReplicaCount() const { - return m_impl.m_replicaCount; -} - -int -NdbDictionary::Table::createTableInDb(Ndb* pNdb, bool equalOk) const { - const NdbDictionary::Table * pTab = - pNdb->getDictionary()->getTable(getName()); - if(pTab != 0 && equal(* pTab)) - return 0; - if(pTab != 0 && !equal(* pTab)) - return -1; - return pNdb->getDictionary()->createTable(* this); -} - -/***************************************************************** - * Index facade - */ -NdbDictionary::Index::Index(const char * name) - : m_impl(* new NdbIndexImpl(* this)) -{ - setName(name); -} - -NdbDictionary::Index::Index(NdbIndexImpl & impl) - : m_impl(impl) -{ -} - -NdbDictionary::Index::~Index(){ - NdbIndexImpl * tmp = &m_impl; - if(this != tmp){ - delete tmp; - } -} - -void -NdbDictionary::Index::setName(const char * name){ - m_impl.setName(name); -} - -const char * -NdbDictionary::Index::getName() const { - return m_impl.getName(); -} - -void -NdbDictionary::Index::setTable(const char * table){ - m_impl.setTable(table); -} - -const char * -NdbDictionary::Index::getTable() const { - return m_impl.getTable(); -} - -unsigned -NdbDictionary::Index::getNoOfColumns() const { - return m_impl.m_columns.size(); -} - -int -NdbDictionary::Index::getNoOfIndexColumns() const { - return m_impl.m_columns.size(); -} - -const NdbDictionary::Column * -NdbDictionary::Index::getColumn(unsigned no) const { - if(no < m_impl.m_columns.size()) - return m_impl.m_columns[no]; - return NULL; -} - -const char * -NdbDictionary::Index::getIndexColumn(int no) const { - const NdbDictionary::Column* col = getColumn(no); - - if (col) - return col->getName(); - else - return NULL; -} - -void -NdbDictionary::Index::addColumn(const Column & c){ - NdbColumnImpl* col = new NdbColumnImpl; - (* col) = NdbColumnImpl::getImpl(c); - m_impl.m_columns.push_back(col); -} - -void -NdbDictionary::Index::addColumnName(const char * name){ - const Column c(name); - addColumn(c); -} - -void -NdbDictionary::Index::addIndexColumn(const char * name){ - const Column c(name); - addColumn(c); -} - -void -NdbDictionary::Index::addColumnNames(unsigned noOfNames, const char ** names){ - for(unsigned i = 0; i < noOfNames; i++) { - const Column c(names[i]); - addColumn(c); - } -} - -void -NdbDictionary::Index::addIndexColumns(int noOfNames, const char ** names){ - for(int i = 0; i < noOfNames; i++) { - const Column c(names[i]); - addColumn(c); - } -} - -void -NdbDictionary::Index::setType(NdbDictionary::Index::Type t){ - m_impl.m_type = t; -} - -NdbDictionary::Index::Type -NdbDictionary::Index::getType() const { - return m_impl.m_type; -} - -void -NdbDictionary::Index::setLogging(bool val){ - m_impl.m_logging = val; -} - -bool -NdbDictionary::Index::getLogging() const { - return m_impl.m_logging; -} - -NdbDictionary::Object::Status -NdbDictionary::Index::getObjectStatus() const { - return m_impl.m_status; -} - -int -NdbDictionary::Index::getObjectVersion() const { - return m_impl.m_version; -} - -/***************************************************************** - * Event facade - */ -NdbDictionary::Event::Event(const char * name) - : m_impl(* new NdbEventImpl(* this)) -{ - setName(name); -} - -NdbDictionary::Event::Event(const char * name, const Table& table) - : m_impl(* new NdbEventImpl(* this)) -{ - setName(name); - setTable(table); -} - -NdbDictionary::Event::Event(NdbEventImpl & impl) - : m_impl(impl) -{ -} - -NdbDictionary::Event::~Event() -{ - NdbEventImpl * tmp = &m_impl; - if(this != tmp){ - delete tmp; - } -} - -void -NdbDictionary::Event::setName(const char * name) -{ - m_impl.setName(name); -} - -const char * -NdbDictionary::Event::getName() const -{ - return m_impl.getName(); -} - -void -NdbDictionary::Event::setTable(const Table& table) -{ - m_impl.setTable(table); -} - -void -NdbDictionary::Event::setTable(const char * table) -{ - m_impl.setTable(table); -} - -const char* -NdbDictionary::Event::getTableName() const -{ - return m_impl.getTableName(); -} - -void -NdbDictionary::Event::addTableEvent(const TableEvent t) -{ - m_impl.addTableEvent(t); -} - -void -NdbDictionary::Event::setDurability(EventDurability d) -{ - m_impl.setDurability(d); -} - -NdbDictionary::Event::EventDurability -NdbDictionary::Event::getDurability() const -{ - return m_impl.getDurability(); -} - -void -NdbDictionary::Event::addColumn(const Column & c){ - NdbColumnImpl* col = new NdbColumnImpl; - (* col) = NdbColumnImpl::getImpl(c); - m_impl.m_columns.push_back(col); -} - -void -NdbDictionary::Event::addEventColumn(unsigned attrId) -{ - m_impl.m_attrIds.push_back(attrId); -} - -void -NdbDictionary::Event::addEventColumn(const char * name) -{ - const Column c(name); - addColumn(c); -} - -void -NdbDictionary::Event::addEventColumns(int n, const char ** names) -{ - for (int i = 0; i < n; i++) - addEventColumn(names[i]); -} - -int NdbDictionary::Event::getNoOfEventColumns() const -{ - return m_impl.getNoOfEventColumns(); -} - -NdbDictionary::Object::Status -NdbDictionary::Event::getObjectStatus() const -{ - return m_impl.m_status; -} - -int -NdbDictionary::Event::getObjectVersion() const -{ - return m_impl.m_version; -} - -void NdbDictionary::Event::print() -{ - m_impl.print(); -} - -/***************************************************************** - * Dictionary facade - */ -NdbDictionary::Dictionary::Dictionary(Ndb & ndb) - : m_impl(* new NdbDictionaryImpl(ndb, *this)) -{ -} - -NdbDictionary::Dictionary::Dictionary(NdbDictionaryImpl & impl) - : m_impl(impl) -{ -} -NdbDictionary::Dictionary::~Dictionary(){ - NdbDictionaryImpl * tmp = &m_impl; - if(this != tmp){ - delete tmp; - } -} - -int -NdbDictionary::Dictionary::createTable(const Table & t){ - return m_impl.createTable(NdbTableImpl::getImpl(t)); -} - -int -NdbDictionary::Dictionary::dropTable(Table & t){ - return m_impl.dropTable(NdbTableImpl::getImpl(t)); -} - -int -NdbDictionary::Dictionary::dropTable(const char * name){ - return m_impl.dropTable(name); -} - -int -NdbDictionary::Dictionary::alterTable(const Table & t){ - return m_impl.alterTable(NdbTableImpl::getImpl(t)); -} - -const NdbDictionary::Table * -NdbDictionary::Dictionary::getTable(const char * name, void **data) const -{ - NdbTableImpl * t = m_impl.getTable(name, data); - if(t) - return t->m_facade; - return 0; -} - -void NdbDictionary::Dictionary::set_local_table_data_size(unsigned sz) -{ - m_impl.m_local_table_data_size= sz; -} - -const NdbDictionary::Table * -NdbDictionary::Dictionary::getTable(const char * name) const -{ - return getTable(name, 0); -} - -void -NdbDictionary::Dictionary::invalidateTable(const char * name){ - NdbTableImpl * t = m_impl.getTable(name); - if(t) - m_impl.invalidateObject(* t); -} - -void -NdbDictionary::Dictionary::removeCachedTable(const char * name){ - NdbTableImpl * t = m_impl.getTable(name); - if(t) - m_impl.removeCachedObject(* t); -} - -int -NdbDictionary::Dictionary::createIndex(const Index & ind) -{ - return m_impl.createIndex(NdbIndexImpl::getImpl(ind)); -} - -int -NdbDictionary::Dictionary::dropIndex(const char * indexName, - const char * tableName) -{ - return m_impl.dropIndex(indexName, tableName); -} - -const NdbDictionary::Index * -NdbDictionary::Dictionary::getIndex(const char * indexName, - const char * tableName) const -{ - NdbIndexImpl * i = m_impl.getIndex(indexName, tableName); - if(i) - return i->m_facade; - return 0; -} - -void -NdbDictionary::Dictionary::invalidateIndex(const char * indexName, - const char * tableName){ - NdbIndexImpl * i = m_impl.getIndex(indexName, tableName); - if(i) { - assert(i->m_table != 0); - m_impl.invalidateObject(* i->m_table); - } -} - -void -NdbDictionary::Dictionary::removeCachedIndex(const char * indexName, - const char * tableName){ - NdbIndexImpl * i = m_impl.getIndex(indexName, tableName); - if(i) { - assert(i->m_table != 0); - m_impl.removeCachedObject(* i->m_table); - } -} - -const NdbDictionary::Table * -NdbDictionary::Dictionary::getIndexTable(const char * indexName, - const char * tableName) const -{ - NdbIndexImpl * i = m_impl.getIndex(indexName, tableName); - NdbTableImpl * t = m_impl.getTable(tableName); - if(i && t) { - NdbTableImpl * it = m_impl.getIndexTable(i, t); - return it->m_facade; - } - return 0; -} - - -int -NdbDictionary::Dictionary::createEvent(const Event & ev) -{ - return m_impl.createEvent(NdbEventImpl::getImpl(ev)); -} - -int -NdbDictionary::Dictionary::dropEvent(const char * eventName) -{ - return m_impl.dropEvent(eventName); -} - -const NdbDictionary::Event * -NdbDictionary::Dictionary::getEvent(const char * eventName) -{ - NdbEventImpl * t = m_impl.getEvent(eventName); - if(t) - return t->m_facade; - return 0; -} - -int -NdbDictionary::Dictionary::listObjects(List& list, Object::Type type) -{ - return m_impl.listObjects(list, type); -} - -int -NdbDictionary::Dictionary::listObjects(List& list, Object::Type type) const -{ - return m_impl.listObjects(list, type); -} - -int -NdbDictionary::Dictionary::listIndexes(List& list, const char * tableName) -{ - const NdbDictionary::Table* tab= getTable(tableName); - if(tab == 0) - { - return -1; - } - return m_impl.listIndexes(list, tab->getTableId()); -} - -int -NdbDictionary::Dictionary::listIndexes(List& list, - const char * tableName) const -{ - const NdbDictionary::Table* tab= getTable(tableName); - if(tab == 0) - { - return -1; - } - return m_impl.listIndexes(list, tab->getTableId()); -} - -const struct NdbError & -NdbDictionary::Dictionary::getNdbError() const { - return m_impl.getNdbError(); -} - -// printers - -NdbOut& -operator<<(NdbOut& out, const NdbDictionary::Column& col) -{ - const CHARSET_INFO *cs = col.getCharset(); - const char *csname = cs ? cs->name : "?"; - out << col.getName() << " "; - switch (col.getType()) { - case NdbDictionary::Column::Tinyint: - out << "Tinyint"; - break; - case NdbDictionary::Column::Tinyunsigned: - out << "Tinyunsigned"; - break; - case NdbDictionary::Column::Smallint: - out << "Smallint"; - break; - case NdbDictionary::Column::Smallunsigned: - out << "Smallunsigned"; - break; - case NdbDictionary::Column::Mediumint: - out << "Mediumint"; - break; - case NdbDictionary::Column::Mediumunsigned: - out << "Mediumunsigned"; - break; - case NdbDictionary::Column::Int: - out << "Int"; - break; - case NdbDictionary::Column::Unsigned: - out << "Unsigned"; - break; - case NdbDictionary::Column::Bigint: - out << "Bigint"; - break; - case NdbDictionary::Column::Bigunsigned: - out << "Bigunsigned"; - break; - case NdbDictionary::Column::Float: - out << "Float"; - break; - case NdbDictionary::Column::Double: - out << "Double"; - break; - case NdbDictionary::Column::Olddecimal: - out << "Olddecimal(" << col.getPrecision() << "," << col.getScale() << ")"; - break; - case NdbDictionary::Column::Olddecimalunsigned: - out << "Olddecimalunsigned(" << col.getPrecision() << "," << col.getScale() << ")"; - break; - case NdbDictionary::Column::Decimal: - out << "Decimal(" << col.getPrecision() << "," << col.getScale() << ")"; - break; - case NdbDictionary::Column::Decimalunsigned: - out << "Decimalunsigned(" << col.getPrecision() << "," << col.getScale() << ")"; - break; - case NdbDictionary::Column::Char: - out << "Char(" << col.getLength() << ";" << csname << ")"; - break; - case NdbDictionary::Column::Varchar: - out << "Varchar(" << col.getLength() << ";" << csname << ")"; - break; - case NdbDictionary::Column::Binary: - out << "Binary(" << col.getLength() << ")"; - break; - case NdbDictionary::Column::Varbinary: - out << "Varbinary(" << col.getLength() << ")"; - break; - case NdbDictionary::Column::Datetime: - out << "Datetime"; - break; - case NdbDictionary::Column::Date: - out << "Date"; - break; - case NdbDictionary::Column::Blob: - out << "Blob(" << col.getInlineSize() << "," << col.getPartSize() - << ";" << col.getStripeSize() << ")"; - break; - case NdbDictionary::Column::Text: - out << "Text(" << col.getInlineSize() << "," << col.getPartSize() - << ";" << col.getStripeSize() << ";" << csname << ")"; - break; - case NdbDictionary::Column::Time: - out << "Time"; - break; - case NdbDictionary::Column::Year: - out << "Year"; - break; - case NdbDictionary::Column::Timestamp: - out << "Timestamp"; - break; - case NdbDictionary::Column::Undefined: - out << "Undefined"; - break; - case NdbDictionary::Column::Bit: - out << "Bit(" << col.getLength() << ")"; - break; - case NdbDictionary::Column::Longvarchar: - out << "Longvarchar(" << col.getLength() << ";" << csname << ")"; - break; - case NdbDictionary::Column::Longvarbinary: - out << "Longvarbinary(" << col.getLength() << ")"; - break; - default: - out << "Type" << (Uint32)col.getType(); - break; - } - // show unusual (non-MySQL) array size - if (col.getLength() != 1) { - switch (col.getType()) { - case NdbDictionary::Column::Char: - case NdbDictionary::Column::Varchar: - case NdbDictionary::Column::Binary: - case NdbDictionary::Column::Varbinary: - case NdbDictionary::Column::Blob: - case NdbDictionary::Column::Text: - case NdbDictionary::Column::Bit: - case NdbDictionary::Column::Longvarchar: - case NdbDictionary::Column::Longvarbinary: - break; - default: - out << " [" << col.getLength() << "]"; - break; - } - } - if (col.getPrimaryKey()) - out << " PRIMARY KEY"; - else if (! col.getNullable()) - out << " NOT NULL"; - else - out << " NULL"; - - if(col.getDistributionKey()) - out << " DISTRIBUTION KEY"; - - return out; -} - -const NdbDictionary::Column * NdbDictionary::Column::FRAGMENT = 0; -const NdbDictionary::Column * NdbDictionary::Column::FRAGMENT_MEMORY = 0; -const NdbDictionary::Column * NdbDictionary::Column::ROW_COUNT = 0; -const NdbDictionary::Column * NdbDictionary::Column::COMMIT_COUNT = 0; -const NdbDictionary::Column * NdbDictionary::Column::ROW_SIZE = 0; -const NdbDictionary::Column * NdbDictionary::Column::RANGE_NO = 0; diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp deleted file mode 100644 index ff87a72f636..00000000000 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ /dev/null @@ -1,3124 +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 */ - -#include "NdbDictionaryImpl.hpp" -#include "API.hpp" -#include <NdbOut.hpp> -#include "NdbApiSignal.hpp" -#include "TransporterFacade.hpp" -#include <signaldata/GetTabInfo.hpp> -#include <signaldata/DictTabInfo.hpp> -#include <signaldata/CreateTable.hpp> -#include <signaldata/CreateIndx.hpp> -#include <signaldata/CreateEvnt.hpp> -#include <signaldata/SumaImpl.hpp> -#include <signaldata/DropTable.hpp> -#include <signaldata/AlterTable.hpp> -#include <signaldata/DropIndx.hpp> -#include <signaldata/ListTables.hpp> -#include <SimpleProperties.hpp> -#include <Bitmask.hpp> -#include <AttributeList.hpp> -#include <NdbEventOperation.hpp> -#include "NdbEventOperationImpl.hpp" -#include <NdbBlob.hpp> -#include "NdbBlobImpl.hpp" -#include <AttributeHeader.hpp> -#include <my_sys.h> - -#define DEBUG_PRINT 0 -#define INCOMPATIBLE_VERSION -2 - -//#define EVENT_DEBUG - -/** - * Column - */ -NdbColumnImpl::NdbColumnImpl() - : NdbDictionary::Column(* this), m_attrId(-1), m_facade(this) -{ - init(); -} - -NdbColumnImpl::NdbColumnImpl(NdbDictionary::Column & f) - : NdbDictionary::Column(* this), m_attrId(-1), m_facade(&f) -{ - init(); -} - -NdbColumnImpl& -NdbColumnImpl::operator=(const NdbColumnImpl& col) -{ - m_attrId = col.m_attrId; - m_name = col.m_name; - m_type = col.m_type; - m_precision = col.m_precision; - m_cs = col.m_cs; - m_scale = col.m_scale; - m_length = col.m_length; - m_pk = col.m_pk; - m_distributionKey = col.m_distributionKey; - m_nullable = col.m_nullable; - m_autoIncrement = col.m_autoIncrement; - m_autoIncrementInitialValue = col.m_autoIncrementInitialValue; - m_defaultValue = col.m_defaultValue; - m_attrSize = col.m_attrSize; - m_arraySize = col.m_arraySize; - m_keyInfoPos = col.m_keyInfoPos; - m_blobTable = col.m_blobTable; - // Do not copy m_facade !! - - return *this; -} - -void -NdbColumnImpl::init(Type t) -{ - // do not use default_charset_info as it may not be initialized yet - // use binary collation until NDB tests can handle charsets - CHARSET_INFO* default_cs = &my_charset_bin; - m_type = t; - switch (m_type) { - case Tinyint: - case Tinyunsigned: - case Smallint: - case Smallunsigned: - case Mediumint: - case Mediumunsigned: - case Int: - case Unsigned: - case Bigint: - case Bigunsigned: - case Float: - case Double: - m_precision = 0; - m_scale = 0; - m_length = 1; - m_cs = NULL; - break; - case Olddecimal: - case Olddecimalunsigned: - case Decimal: - case Decimalunsigned: - m_precision = 10; - m_scale = 0; - m_length = 1; - m_cs = NULL; - break; - case Char: - case Varchar: - m_precision = 0; - m_scale = 0; - m_length = 1; - m_cs = default_cs; - break; - case Binary: - case Varbinary: - case Datetime: - case Date: - m_precision = 0; - m_scale = 0; - m_length = 1; - m_cs = NULL; - break; - case Blob: - m_precision = 256; - m_scale = 8000; - m_length = 4; - m_cs = NULL; - break; - case Text: - m_precision = 256; - m_scale = 8000; - m_length = 4; - m_cs = default_cs; - break; - case Time: - case Year: - case Timestamp: - m_precision = 0; - m_scale = 0; - m_length = 1; - m_cs = NULL; - break; - case Bit: - m_precision = 0; - m_scale = 0; - m_length = 1; - m_cs = NULL; - break; - case Longvarchar: - m_precision = 0; - m_scale = 0; - m_length = 1; // legal - m_cs = default_cs; - break; - case Longvarbinary: - m_precision = 0; - m_scale = 0; - m_length = 1; // legal - m_cs = NULL; - break; - case Undefined: - assert(false); - break; - } - m_pk = false; - m_nullable = false; - m_distributionKey = false; - m_keyInfoPos = 0; - // next 2 are set at run time - m_attrSize = 0; - m_arraySize = 0; - m_autoIncrement = false; - m_autoIncrementInitialValue = 1; - m_blobTable = NULL; -} - -NdbColumnImpl::~NdbColumnImpl() -{ -} - -bool -NdbColumnImpl::equal(const NdbColumnImpl& col) const -{ - DBUG_ENTER("NdbColumnImpl::equal"); - if(strcmp(m_name.c_str(), col.m_name.c_str()) != 0){ - DBUG_RETURN(false); - } - if(m_type != col.m_type){ - DBUG_RETURN(false); - } - if(m_pk != col.m_pk){ - DBUG_RETURN(false); - } - if(m_nullable != col.m_nullable){ - DBUG_RETURN(false); - } - if(m_pk){ - if(m_distributionKey != col.m_distributionKey){ - DBUG_RETURN(false); - } - } - if (m_precision != col.m_precision || - m_scale != col.m_scale || - m_length != col.m_length || - m_cs != col.m_cs) { - DBUG_RETURN(false); - } - if (m_autoIncrement != col.m_autoIncrement){ - DBUG_RETURN(false); - } - if(strcmp(m_defaultValue.c_str(), col.m_defaultValue.c_str()) != 0){ - DBUG_RETURN(false); - } - - DBUG_RETURN(true); -} - -NdbDictionary::Column * -NdbColumnImpl::create_psuedo(const char * name){ - NdbDictionary::Column * col = new NdbDictionary::Column(); - col->setName(name); - if(!strcmp(name, "NDB$FRAGMENT")){ - col->setType(NdbDictionary::Column::Unsigned); - col->m_impl.m_attrId = AttributeHeader::FRAGMENT; - col->m_impl.m_attrSize = 4; - col->m_impl.m_arraySize = 1; - } else if(!strcmp(name, "NDB$FRAGMENT_MEMORY")){ - col->setType(NdbDictionary::Column::Bigunsigned); - col->m_impl.m_attrId = AttributeHeader::FRAGMENT_MEMORY; - col->m_impl.m_attrSize = 8; - col->m_impl.m_arraySize = 1; - } else if(!strcmp(name, "NDB$ROW_COUNT")){ - col->setType(NdbDictionary::Column::Bigunsigned); - col->m_impl.m_attrId = AttributeHeader::ROW_COUNT; - col->m_impl.m_attrSize = 8; - col->m_impl.m_arraySize = 1; - } else if(!strcmp(name, "NDB$COMMIT_COUNT")){ - col->setType(NdbDictionary::Column::Bigunsigned); - col->m_impl.m_attrId = AttributeHeader::COMMIT_COUNT; - col->m_impl.m_attrSize = 8; - col->m_impl.m_arraySize = 1; - } else if(!strcmp(name, "NDB$ROW_SIZE")){ - col->setType(NdbDictionary::Column::Unsigned); - col->m_impl.m_attrId = AttributeHeader::ROW_SIZE; - col->m_impl.m_attrSize = 4; - col->m_impl.m_arraySize = 1; - } else if(!strcmp(name, "NDB$RANGE_NO")){ - col->setType(NdbDictionary::Column::Unsigned); - col->m_impl.m_attrId = AttributeHeader::RANGE_NO; - col->m_impl.m_attrSize = 4; - col->m_impl.m_arraySize = 1; - } else { - abort(); - } - return col; -} - -/** - * NdbTableImpl - */ - -NdbTableImpl::NdbTableImpl() - : NdbDictionary::Table(* this), m_facade(this) -{ - init(); -} - -NdbTableImpl::NdbTableImpl(NdbDictionary::Table & f) - : NdbDictionary::Table(* this), m_facade(&f) -{ - init(); -} - -NdbTableImpl::~NdbTableImpl() -{ - if (m_index != 0) { - delete m_index; - m_index = 0; - } - for (unsigned i = 0; i < m_columns.size(); i++) - delete m_columns[i]; -} - -void -NdbTableImpl::init(){ - clearNewProperties(); - m_frm.clear(); - m_fragmentType = NdbDictionary::Object::FragAllSmall; - m_logging = true; - m_kvalue = 6; - m_minLoadFactor = 78; - m_maxLoadFactor = 80; - - m_index = 0; - m_indexType = NdbDictionary::Index::Undefined; - - m_noOfKeys = 0; - m_noOfDistributionKeys = 0; - m_fragmentCount = 0; - m_keyLenInWords = 0; - m_noOfBlobs = 0; -} - -bool -NdbTableImpl::equal(const NdbTableImpl& obj) const -{ - DBUG_ENTER("NdbTableImpl::equal"); - if ((m_internalName.c_str() == NULL) || - (strcmp(m_internalName.c_str(), "") == 0) || - (obj.m_internalName.c_str() == NULL) || - (strcmp(obj.m_internalName.c_str(), "") == 0)) { - // Shallow equal - if(strcmp(getName(), obj.getName()) != 0){ - DBUG_PRINT("info",("name %s != %s",getName(),obj.getName())); - DBUG_RETURN(false); - } - } else - // Deep equal - if(strcmp(m_internalName.c_str(), obj.m_internalName.c_str()) != 0){ - { - DBUG_PRINT("info",("m_internalName %s != %s", - m_internalName.c_str(),obj.m_internalName.c_str())); - DBUG_RETURN(false); - } - } - if(m_fragmentType != obj.m_fragmentType){ - DBUG_PRINT("info",("m_fragmentType %d != %d",m_fragmentType,obj.m_fragmentType)); - DBUG_RETURN(false); - } - if(m_columns.size() != obj.m_columns.size()){ - DBUG_PRINT("info",("m_columns.size %d != %d",m_columns.size(),obj.m_columns.size())); - DBUG_RETURN(false); - } - - for(unsigned i = 0; i<obj.m_columns.size(); i++){ - if(!m_columns[i]->equal(* obj.m_columns[i])){ - DBUG_PRINT("info",("m_columns [%d] != [%d]",i,i)); - DBUG_RETURN(false); - } - } - - if(m_logging != obj.m_logging){ - DBUG_PRINT("info",("m_logging %d != %d",m_logging,obj.m_logging)); - DBUG_RETURN(false); - } - - if(m_kvalue != obj.m_kvalue){ - DBUG_PRINT("info",("m_kvalue %d != %d",m_kvalue,obj.m_kvalue)); - DBUG_RETURN(false); - } - - if(m_minLoadFactor != obj.m_minLoadFactor){ - DBUG_PRINT("info",("m_minLoadFactor %d != %d",m_minLoadFactor,obj.m_minLoadFactor)); - DBUG_RETURN(false); - } - - if(m_maxLoadFactor != obj.m_maxLoadFactor){ - DBUG_PRINT("info",("m_maxLoadFactor %d != %d",m_maxLoadFactor,obj.m_maxLoadFactor)); - DBUG_RETURN(false); - } - - DBUG_RETURN(true); -} - -void -NdbTableImpl::assign(const NdbTableImpl& org) -{ - m_tableId = org.m_tableId; - m_internalName.assign(org.m_internalName); - m_externalName.assign(org.m_externalName); - m_newExternalName.assign(org.m_newExternalName); - m_frm.assign(org.m_frm.get_data(), org.m_frm.length()); - m_fragmentType = org.m_fragmentType; - m_fragmentCount = org.m_fragmentCount; - - for(unsigned i = 0; i<org.m_columns.size(); i++){ - NdbColumnImpl * col = new NdbColumnImpl(); - const NdbColumnImpl * iorg = org.m_columns[i]; - (* col) = (* iorg); - m_columns.push_back(col); - } - - m_logging = org.m_logging; - m_kvalue = org.m_kvalue; - m_minLoadFactor = org.m_minLoadFactor; - m_maxLoadFactor = org.m_maxLoadFactor; - - if (m_index != 0) - delete m_index; - m_index = org.m_index; - - m_noOfDistributionKeys = org.m_noOfDistributionKeys; - m_noOfKeys = org.m_noOfKeys; - m_keyLenInWords = org.m_keyLenInWords; - m_noOfBlobs = org.m_noOfBlobs; - - m_version = org.m_version; - m_status = org.m_status; -} - -void NdbTableImpl::setName(const char * name) -{ - m_newExternalName.assign(name); -} - -const char * -NdbTableImpl::getName() const -{ - if (m_newExternalName.empty()) - return m_externalName.c_str(); - else - return m_newExternalName.c_str(); -} - -void NdbTableImpl::clearNewProperties() -{ - m_newExternalName.assign(""); - m_changeMask = 0; -} - -void NdbTableImpl::copyNewProperties() -{ - if (!m_newExternalName.empty()) { - m_externalName.assign(m_newExternalName); - AlterTableReq::setNameFlag(m_changeMask, true); - } -} - -void -NdbTableImpl::buildColumnHash(){ - const Uint32 size = m_columns.size(); - - int i; - for(i = 31; i >= 0; i--){ - if(((1 << i) & size) != 0){ - m_columnHashMask = (1 << (i + 1)) - 1; - break; - } - } - - Vector<Uint32> hashValues; - Vector<Vector<Uint32> > chains; chains.fill(size, hashValues); - for(i = 0; i< (int) size; i++){ - Uint32 hv = Hash(m_columns[i]->getName()) & 0xFFFE; - Uint32 bucket = hv & m_columnHashMask; - bucket = (bucket < size ? bucket : bucket - size); - assert(bucket < size); - hashValues.push_back(hv); - chains[bucket].push_back(i); - } - - m_columnHash.clear(); - Uint32 tmp = 1; - m_columnHash.fill((unsigned)size-1, tmp); // Default no chaining - - Uint32 pos = 0; // In overflow vector - for(i = 0; i< (int) size; i++){ - Uint32 sz = chains[i].size(); - if(sz == 1){ - Uint32 col = chains[i][0]; - Uint32 hv = hashValues[col]; - Uint32 bucket = hv & m_columnHashMask; - bucket = (bucket < size ? bucket : bucket - size); - m_columnHash[bucket] = (col << 16) | hv | 1; - } else if(sz > 1){ - Uint32 col = chains[i][0]; - Uint32 hv = hashValues[col]; - Uint32 bucket = hv & m_columnHashMask; - bucket = (bucket < size ? bucket : bucket - size); - m_columnHash[bucket] = (sz << 16) | (((size - bucket) + pos) << 1); - for(size_t j = 0; j<sz; j++, pos++){ - Uint32 col = chains[i][j]; - Uint32 hv = hashValues[col]; - m_columnHash.push_back((col << 16) | hv); - } - } - } - - m_columnHash.push_back(0); // Overflow when looping in end of array - -#if 0 - for(size_t i = 0; i<m_columnHash.size(); i++){ - Uint32 tmp = m_columnHash[i]; - int col = -1; - if(i < size && (tmp & 1) == 1){ - col = (tmp >> 16); - } else if(i >= size){ - col = (tmp >> 16); - } - ndbout_c("m_columnHash[%d] %s = %x", - i, col > 0 ? m_columns[col]->getName() : "" , m_columnHash[i]); - } -#endif -} - -Uint32 -NdbTableImpl::get_nodes(Uint32 hashValue, const Uint16 ** nodes) const -{ - if(m_replicaCount > 0) - { - Uint32 fragmentId = hashValue & m_hashValueMask; - if(fragmentId < m_hashpointerValue) - { - fragmentId = hashValue & ((m_hashValueMask << 1) + 1); - } - Uint32 pos = fragmentId * m_replicaCount; - if(pos + m_replicaCount <= m_fragments.size()) - { - * nodes = m_fragments.getBase()+pos; - return m_replicaCount; - } - } - return 0; -} - -/** - * NdbIndexImpl - */ - -NdbIndexImpl::NdbIndexImpl() : - NdbDictionary::Index(* this), - m_facade(this) -{ - m_logging = true; -} - -NdbIndexImpl::NdbIndexImpl(NdbDictionary::Index & f) : - NdbDictionary::Index(* this), - m_facade(&f) -{ - m_logging = true; -} - -NdbIndexImpl::~NdbIndexImpl(){ - for (unsigned i = 0; i < m_columns.size(); i++) - delete m_columns[i]; -} - -void NdbIndexImpl::setName(const char * name) -{ - m_externalName.assign(name); -} - -const char * -NdbIndexImpl::getName() const -{ - return m_externalName.c_str(); -} - -void -NdbIndexImpl::setTable(const char * table) -{ - m_tableName.assign(table); -} - -const char * -NdbIndexImpl::getTable() const -{ - return m_tableName.c_str(); -} - -const NdbTableImpl * -NdbIndexImpl::getIndexTable() const -{ - return m_table; -} - -/** - * NdbEventImpl - */ - -NdbEventImpl::NdbEventImpl() : - NdbDictionary::Event(* this), - m_facade(this) -{ - mi_type = 0; - m_dur = NdbDictionary::Event::ED_UNDEFINED; - eventOp = NULL; - m_tableImpl = NULL; -} - -NdbEventImpl::NdbEventImpl(NdbDictionary::Event & f) : - NdbDictionary::Event(* this), - m_facade(&f) -{ - mi_type = 0; - m_dur = NdbDictionary::Event::ED_UNDEFINED; - eventOp = NULL; - m_tableImpl = NULL; -} - -NdbEventImpl::~NdbEventImpl() -{ - for (unsigned i = 0; i < m_columns.size(); i++) - delete m_columns[i]; -} - -void NdbEventImpl::setName(const char * name) -{ - m_externalName.assign(name); -} - -const char *NdbEventImpl::getName() const -{ - return m_externalName.c_str(); -} - -void -NdbEventImpl::setTable(const NdbDictionary::Table& table) -{ - m_tableImpl= &NdbTableImpl::getImpl(table); - m_tableName.assign(m_tableImpl->getName()); -} - -void -NdbEventImpl::setTable(const char * table) -{ - m_tableName.assign(table); -} - -const char * -NdbEventImpl::getTableName() const -{ - return m_tableName.c_str(); -} - -void -NdbEventImpl::addTableEvent(const NdbDictionary::Event::TableEvent t = NdbDictionary::Event::TE_ALL) -{ - switch (t) { - case NdbDictionary::Event::TE_INSERT : mi_type |= 1; break; - case NdbDictionary::Event::TE_DELETE : mi_type |= 2; break; - case NdbDictionary::Event::TE_UPDATE : mi_type |= 4; break; - default: mi_type = 4 | 2 | 1; // all types - } -} - -void -NdbEventImpl::setDurability(NdbDictionary::Event::EventDurability d) -{ - m_dur = d; -} - -NdbDictionary::Event::EventDurability -NdbEventImpl::getDurability() const -{ - return m_dur; -} - -int NdbEventImpl::getNoOfEventColumns() const -{ - return m_attrIds.size() + m_columns.size(); -} - -/** - * NdbDictionaryImpl - */ - -NdbDictionaryImpl::NdbDictionaryImpl(Ndb &ndb) - : NdbDictionary::Dictionary(* this), - m_facade(this), - m_receiver(m_error), - m_ndb(ndb) -{ - m_globalHash = 0; - m_local_table_data_size= 0; -} - -NdbDictionaryImpl::NdbDictionaryImpl(Ndb &ndb, - NdbDictionary::Dictionary & f) - : NdbDictionary::Dictionary(* this), - m_facade(&f), - m_receiver(m_error), - m_ndb(ndb) -{ - m_globalHash = 0; - m_local_table_data_size= 0; -} - -static int f_dictionary_count = 0; - -NdbDictionaryImpl::~NdbDictionaryImpl() -{ - NdbElement_t<Ndb_local_table_info> * curr = m_localHash.m_tableHash.getNext(0); - if(m_globalHash){ - while(curr != 0){ - m_globalHash->lock(); - m_globalHash->release(curr->theData->m_table_impl); - Ndb_local_table_info::destroy(curr->theData); - m_globalHash->unlock(); - - curr = m_localHash.m_tableHash.getNext(curr); - } - - m_globalHash->lock(); - if(--f_dictionary_count == 0){ - delete NdbDictionary::Column::FRAGMENT; - delete NdbDictionary::Column::FRAGMENT_MEMORY; - delete NdbDictionary::Column::ROW_COUNT; - delete NdbDictionary::Column::COMMIT_COUNT; - delete NdbDictionary::Column::ROW_SIZE; - NdbDictionary::Column::FRAGMENT= 0; - NdbDictionary::Column::FRAGMENT_MEMORY= 0; - NdbDictionary::Column::ROW_COUNT= 0; - NdbDictionary::Column::COMMIT_COUNT= 0; - NdbDictionary::Column::ROW_SIZE= 0; - } - m_globalHash->unlock(); - } else { - assert(curr == 0); - } -} - -Ndb_local_table_info * -NdbDictionaryImpl::fetchGlobalTableImpl(const char * internalTableName) -{ - NdbTableImpl *impl; - - m_globalHash->lock(); - impl = m_globalHash->get(internalTableName); - m_globalHash->unlock(); - - if (impl == 0){ - impl = m_receiver.getTable(internalTableName, - m_ndb.usingFullyQualifiedNames()); - m_globalHash->lock(); - m_globalHash->put(internalTableName, impl); - m_globalHash->unlock(); - - if(impl == 0){ - return 0; - } - } - - Ndb_local_table_info *info= - Ndb_local_table_info::create(impl, m_local_table_data_size); - - m_localHash.put(internalTableName, info); - - m_ndb.theFirstTupleId[impl->getTableId()] = ~0; - m_ndb.theLastTupleId[impl->getTableId()] = ~0; - - return info; -} - -#if 0 -bool -NdbDictionaryImpl::setTransporter(class TransporterFacade * tf) -{ - if(tf != 0){ - m_globalHash = &tf->m_globalDictCache; - return m_receiver.setTransporter(tf); - } - - return false; -} -#endif - -bool -NdbDictionaryImpl::setTransporter(class Ndb* ndb, - class TransporterFacade * tf) -{ - m_globalHash = &tf->m_globalDictCache; - if(m_receiver.setTransporter(ndb, tf)){ - m_globalHash->lock(); - if(f_dictionary_count++ == 0){ - NdbDictionary::Column::FRAGMENT= - NdbColumnImpl::create_psuedo("NDB$FRAGMENT"); - NdbDictionary::Column::FRAGMENT_MEMORY= - NdbColumnImpl::create_psuedo("NDB$FRAGMENT_MEMORY"); - NdbDictionary::Column::ROW_COUNT= - NdbColumnImpl::create_psuedo("NDB$ROW_COUNT"); - NdbDictionary::Column::COMMIT_COUNT= - NdbColumnImpl::create_psuedo("NDB$COMMIT_COUNT"); - NdbDictionary::Column::ROW_SIZE= - NdbColumnImpl::create_psuedo("NDB$ROW_SIZE"); - NdbDictionary::Column::RANGE_NO= - NdbColumnImpl::create_psuedo("NDB$RANGE_NO"); - } - m_globalHash->unlock(); - return true; - } - return false; -} - -NdbTableImpl * -NdbDictionaryImpl::getIndexTable(NdbIndexImpl * index, - NdbTableImpl * table) -{ - const char * internalName = - m_ndb.internalizeIndexName(table, index->getName()); - - return getTable(m_ndb.externalizeTableName(internalName)); -} - -#if 0 -bool -NdbDictInterface::setTransporter(class TransporterFacade * tf) -{ - if(tf == 0) - return false; - - Guard g(tf->theMutexPtr); - - m_blockNumber = tf->open(this, - execSignal, - execNodeStatus); - - if ( m_blockNumber == -1 ) { - m_error.code= 4105; - return false; // no more free blocknumbers - }//if - Uint32 theNode = tf->ownId(); - m_reference = numberToRef(m_blockNumber, theNode); - m_transporter = tf; - m_waiter.m_mutex = tf->theMutexPtr; - - return true; -} -#endif - -bool -NdbDictInterface::setTransporter(class Ndb* ndb, class TransporterFacade * tf) -{ - m_reference = ndb->getReference(); - m_transporter = tf; - m_waiter.m_mutex = tf->theMutexPtr; - - return true; -} - -NdbDictInterface::~NdbDictInterface() -{ -} - -void -NdbDictInterface::execSignal(void* dictImpl, - class NdbApiSignal* signal, - class LinearSectionPtr ptr[3]) -{ - NdbDictInterface * tmp = (NdbDictInterface*)dictImpl; - - const Uint32 gsn = signal->readSignalNumber(); - switch(gsn){ - case GSN_GET_TABINFOREF: - tmp->execGET_TABINFO_REF(signal, ptr); - break; - case GSN_GET_TABINFO_CONF: - tmp->execGET_TABINFO_CONF(signal, ptr); - break; - case GSN_CREATE_TABLE_REF: - tmp->execCREATE_TABLE_REF(signal, ptr); - break; - case GSN_CREATE_TABLE_CONF: - tmp->execCREATE_TABLE_CONF(signal, ptr); - break; - case GSN_DROP_TABLE_REF: - tmp->execDROP_TABLE_REF(signal, ptr); - break; - case GSN_DROP_TABLE_CONF: - tmp->execDROP_TABLE_CONF(signal, ptr); - break; - case GSN_ALTER_TABLE_REF: - tmp->execALTER_TABLE_REF(signal, ptr); - break; - case GSN_ALTER_TABLE_CONF: - tmp->execALTER_TABLE_CONF(signal, ptr); - break; - case GSN_CREATE_INDX_REF: - tmp->execCREATE_INDX_REF(signal, ptr); - break; - case GSN_CREATE_INDX_CONF: - tmp->execCREATE_INDX_CONF(signal, ptr); - break; - case GSN_DROP_INDX_REF: - tmp->execDROP_INDX_REF(signal, ptr); - break; - case GSN_DROP_INDX_CONF: - tmp->execDROP_INDX_CONF(signal, ptr); - break; - case GSN_CREATE_EVNT_REF: - tmp->execCREATE_EVNT_REF(signal, ptr); - break; - case GSN_CREATE_EVNT_CONF: - tmp->execCREATE_EVNT_CONF(signal, ptr); - break; - case GSN_SUB_START_CONF: - tmp->execSUB_START_CONF(signal, ptr); - break; - case GSN_SUB_START_REF: - tmp->execSUB_START_REF(signal, ptr); - break; - case GSN_SUB_TABLE_DATA: - tmp->execSUB_TABLE_DATA(signal, ptr); - break; - case GSN_SUB_GCP_COMPLETE_REP: - tmp->execSUB_GCP_COMPLETE_REP(signal, ptr); - break; - case GSN_SUB_STOP_CONF: - tmp->execSUB_STOP_CONF(signal, ptr); - break; - case GSN_SUB_STOP_REF: - tmp->execSUB_STOP_REF(signal, ptr); - break; - case GSN_DROP_EVNT_REF: - tmp->execDROP_EVNT_REF(signal, ptr); - break; - case GSN_DROP_EVNT_CONF: - tmp->execDROP_EVNT_CONF(signal, ptr); - break; - case GSN_LIST_TABLES_CONF: - tmp->execLIST_TABLES_CONF(signal, ptr); - break; - default: - abort(); - } -} - -void -NdbDictInterface::execNodeStatus(void* dictImpl, Uint32 aNode, - bool alive, bool nfCompleted) -{ - NdbDictInterface * tmp = (NdbDictInterface*)dictImpl; - - if(!alive && !nfCompleted){ - return; - } - - if (!alive && nfCompleted){ - tmp->m_waiter.nodeFail(aNode); - } -} - -int -NdbDictInterface::dictSignal(NdbApiSignal* signal, - LinearSectionPtr ptr[3],int noLSP, - const int useMasterNodeId, - const Uint32 RETRIES, - const WaitSignalType wst, - const int theWait, - const int *errcodes, - const int noerrcodes, - const int temporaryMask) -{ - DBUG_ENTER("NdbDictInterface::dictSignal"); - DBUG_PRINT("enter", ("useMasterNodeId: %d", useMasterNodeId)); - for(Uint32 i = 0; i<RETRIES; i++){ - //if (useMasterNodeId == 0) - m_buffer.clear(); - - // Protected area - m_transporter->lock_mutex(); - Uint32 aNodeId; - if (useMasterNodeId) { - if ((m_masterNodeId == 0) || - (!m_transporter->get_node_alive(m_masterNodeId))) { - m_masterNodeId = m_transporter->get_an_alive_node(); - }//if - aNodeId = m_masterNodeId; - } else { - aNodeId = m_transporter->get_an_alive_node(); - } - if(aNodeId == 0){ - m_error.code= 4009; - m_transporter->unlock_mutex(); - DBUG_RETURN(-1); - } - { - int r; - if (ptr) { -#ifdef EVENT_DEBUG - printf("Long signal %d ptr", noLSP); - for (int q=0;q<noLSP;q++) { - printf(" sz %d", ptr[q].sz); - } - printf("\n"); -#endif - r = m_transporter->sendFragmentedSignal(signal, aNodeId, ptr, noLSP); - } else { -#ifdef EVENT_DEBUG - printf("Short signal\n"); -#endif - r = m_transporter->sendSignal(signal, aNodeId); - } - if(r != 0){ - m_transporter->unlock_mutex(); - continue; - } - } - - m_error.code= 0; - - m_waiter.m_node = aNodeId; - m_waiter.m_state = wst; - - m_waiter.wait(theWait); - m_transporter->unlock_mutex(); - // End of Protected area - - if(m_waiter.m_state == NO_WAIT && m_error.code == 0){ - // Normal return - DBUG_RETURN(0); - } - - /** - * Handle error codes - */ - if(m_waiter.m_state == WAIT_NODE_FAILURE) - continue; - - if(m_waiter.m_state == WST_WAIT_TIMEOUT) - { - m_error.code = 4008; - DBUG_RETURN(-1); - } - - if ( (temporaryMask & m_error.code) != 0 ) { - continue; - } - if (errcodes) { - int doContinue = 0; - for (int j=0; j < noerrcodes; j++) - if(m_error.code == errcodes[j]) { - doContinue = 1; - break; - } - if (doContinue) - continue; - } - - DBUG_RETURN(-1); - } - DBUG_RETURN(-1); -} - -/***************************************************************** - * get tab info - */ -NdbTableImpl * -NdbDictInterface::getTable(int tableId, bool fullyQualifiedNames) -{ - NdbApiSignal tSignal(m_reference); - GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend()); - - req->senderRef = m_reference; - req->senderData = 0; - req->requestType = - GetTabInfoReq::RequestById | GetTabInfoReq::LongSignalConf; - req->tableId = tableId; - tSignal.theReceiversBlockNumber = DBDICT; - tSignal.theVerId_signalNumber = GSN_GET_TABINFOREQ; - tSignal.theLength = GetTabInfoReq::SignalLength; - - return getTable(&tSignal, 0, 0, fullyQualifiedNames); -} - -NdbTableImpl * -NdbDictInterface::getTable(const char * name, bool fullyQualifiedNames) -{ - NdbApiSignal tSignal(m_reference); - GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend()); - - const Uint32 strLen = strlen(name) + 1; // NULL Terminated - if(strLen > MAX_TAB_NAME_SIZE) {//sizeof(req->tableName)){ - m_error.code= 4307; - return 0; - } - - req->senderRef = m_reference; - req->senderData = 0; - req->requestType = - GetTabInfoReq::RequestByName | GetTabInfoReq::LongSignalConf; - req->tableNameLen = strLen; - tSignal.theReceiversBlockNumber = DBDICT; - tSignal.theVerId_signalNumber = GSN_GET_TABINFOREQ; - // tSignal.theLength = GetTabInfoReq::HeaderLength + ((strLen + 3) / 4); - tSignal.theLength = GetTabInfoReq::SignalLength; - LinearSectionPtr ptr[1]; - ptr[0].p = (Uint32*)name; - ptr[0].sz = strLen; - - return getTable(&tSignal, ptr, 1, fullyQualifiedNames); -} - -NdbTableImpl * -NdbDictInterface::getTable(class NdbApiSignal * signal, - LinearSectionPtr ptr[3], - Uint32 noOfSections, bool fullyQualifiedNames) -{ - //GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, signal->getDataPtrSend()); - int errCodes[] = {GetTabInfoRef::Busy }; - - int r = dictSignal(signal,ptr,noOfSections, - 0/*do not use masternode id*/, - 100, - WAIT_GET_TAB_INFO_REQ, - WAITFOR_RESPONSE_TIMEOUT, - errCodes, 1); - if (r) return 0; - - NdbTableImpl * rt = 0; - m_error.code= parseTableInfo(&rt, - (Uint32*)m_buffer.get_data(), - m_buffer.length() / 4, fullyQualifiedNames); - rt->buildColumnHash(); - return rt; -} - -void -NdbDictInterface::execGET_TABINFO_CONF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - const GetTabInfoConf* conf = CAST_CONSTPTR(GetTabInfoConf, signal->getDataPtr()); - if(signal->isFirstFragment()){ - m_fragmentId = signal->getFragmentId(); - m_buffer.grow(4 * conf->totalLen); - } else { - if(m_fragmentId != signal->getFragmentId()){ - abort(); - } - } - - const Uint32 i = GetTabInfoConf::DICT_TAB_INFO; - m_buffer.append(ptr[i].p, 4 * ptr[i].sz); - - if(!signal->isLastFragment()){ - return; - } - - m_waiter.signal(NO_WAIT); -} - -void -NdbDictInterface::execGET_TABINFO_REF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - const GetTabInfoRef* ref = CAST_CONSTPTR(GetTabInfoRef, signal->getDataPtr()); - - m_error.code= ref->errorCode; - m_waiter.signal(NO_WAIT); -} - -/***************************************************************** - * Pack/Unpack tables - */ -struct ApiKernelMapping { - Int32 kernelConstant; - Int32 apiConstant; -}; - -Uint32 -getApiConstant(Int32 kernelConstant, const ApiKernelMapping map[], Uint32 def) -{ - int i = 0; - while(map[i].kernelConstant != kernelConstant){ - if(map[i].kernelConstant == -1 && - map[i].apiConstant == -1){ - return def; - } - i++; - } - return map[i].apiConstant; -} - -Uint32 -getKernelConstant(Int32 apiConstant, const ApiKernelMapping map[], Uint32 def) -{ - int i = 0; - while(map[i].apiConstant != apiConstant){ - if(map[i].kernelConstant == -1 && - map[i].apiConstant == -1){ - return def; - } - i++; - } - return map[i].kernelConstant; -} - -static const -ApiKernelMapping -fragmentTypeMapping[] = { - { DictTabInfo::AllNodesSmallTable, NdbDictionary::Object::FragAllSmall }, - { DictTabInfo::AllNodesMediumTable, NdbDictionary::Object::FragAllMedium }, - { DictTabInfo::AllNodesLargeTable, NdbDictionary::Object::FragAllLarge }, - { DictTabInfo::SingleFragment, NdbDictionary::Object::FragSingle }, - { -1, -1 } -}; - -static const -ApiKernelMapping -objectTypeMapping[] = { - { DictTabInfo::SystemTable, NdbDictionary::Object::SystemTable }, - { DictTabInfo::UserTable, NdbDictionary::Object::UserTable }, - { DictTabInfo::UniqueHashIndex, NdbDictionary::Object::UniqueHashIndex }, - { DictTabInfo::OrderedIndex, NdbDictionary::Object::OrderedIndex }, - { DictTabInfo::HashIndexTrigger, NdbDictionary::Object::HashIndexTrigger }, - { DictTabInfo::IndexTrigger, NdbDictionary::Object::IndexTrigger }, - { DictTabInfo::SubscriptionTrigger,NdbDictionary::Object::SubscriptionTrigger }, - { DictTabInfo::ReadOnlyConstraint ,NdbDictionary::Object::ReadOnlyConstraint }, - { -1, -1 } -}; - -static const -ApiKernelMapping -objectStateMapping[] = { - { DictTabInfo::StateOffline, NdbDictionary::Object::StateOffline }, - { DictTabInfo::StateBuilding, NdbDictionary::Object::StateBuilding }, - { DictTabInfo::StateDropping, NdbDictionary::Object::StateDropping }, - { DictTabInfo::StateOnline, NdbDictionary::Object::StateOnline }, - { DictTabInfo::StateBroken, NdbDictionary::Object::StateBroken }, - { -1, -1 } -}; - -static const -ApiKernelMapping -objectStoreMapping[] = { - { DictTabInfo::StoreTemporary, NdbDictionary::Object::StoreTemporary }, - { DictTabInfo::StorePermanent, NdbDictionary::Object::StorePermanent }, - { -1, -1 } -}; - -static const -ApiKernelMapping -indexTypeMapping[] = { - { DictTabInfo::UniqueHashIndex, NdbDictionary::Index::UniqueHashIndex }, - { DictTabInfo::OrderedIndex, NdbDictionary::Index::OrderedIndex }, - { -1, -1 } -}; - -int -NdbDictInterface::parseTableInfo(NdbTableImpl ** ret, - const Uint32 * data, Uint32 len, - bool fullyQualifiedNames) -{ - DBUG_ENTER("NdbDictInterface::parseTableInfo"); - - SimplePropertiesLinearReader it(data, len); - DictTabInfo::Table tableDesc; tableDesc.init(); - SimpleProperties::UnpackStatus s; - s = SimpleProperties::unpack(it, &tableDesc, - DictTabInfo::TableMapping, - DictTabInfo::TableMappingSize, - true, true); - - if(s != SimpleProperties::Break){ - DBUG_RETURN(703); - } - const char * internalName = tableDesc.TableName; - const char * externalName = Ndb::externalizeTableName(internalName, fullyQualifiedNames); - - NdbTableImpl * impl = new NdbTableImpl(); - impl->m_tableId = tableDesc.TableId; - impl->m_version = tableDesc.TableVersion; - impl->m_status = NdbDictionary::Object::Retrieved; - impl->m_internalName.assign(internalName); - impl->m_externalName.assign(externalName); - - impl->m_frm.assign(tableDesc.FrmData, tableDesc.FrmLen); - - impl->m_fragmentType = (NdbDictionary::Object::FragmentType) - getApiConstant(tableDesc.FragmentType, - fragmentTypeMapping, - (Uint32)NdbDictionary::Object::FragUndefined); - - impl->m_logging = tableDesc.TableLoggedFlag; - impl->m_kvalue = tableDesc.TableKValue; - impl->m_minLoadFactor = tableDesc.MinLoadFactor; - impl->m_maxLoadFactor = tableDesc.MaxLoadFactor; - - impl->m_indexType = (NdbDictionary::Index::Type) - getApiConstant(tableDesc.TableType, - indexTypeMapping, - NdbDictionary::Index::Undefined); - - if(impl->m_indexType == NdbDictionary::Index::Undefined){ - } else { - const char * externalPrimary = - Ndb::externalizeTableName(tableDesc.PrimaryTable, fullyQualifiedNames); - impl->m_primaryTable.assign(externalPrimary); - } - - Uint32 keyInfoPos = 0; - Uint32 keyCount = 0; - Uint32 blobCount = 0; - Uint32 distKeys = 0; - - Uint32 i; - for(i = 0; i < tableDesc.NoOfAttributes; i++) { - DictTabInfo::Attribute attrDesc; attrDesc.init(); - s = SimpleProperties::unpack(it, - &attrDesc, - DictTabInfo::AttributeMapping, - DictTabInfo::AttributeMappingSize, - true, true); - if(s != SimpleProperties::Break){ - delete impl; - DBUG_RETURN(703); - } - - NdbColumnImpl * col = new NdbColumnImpl(); - col->m_attrId = attrDesc.AttributeId; - col->setName(attrDesc.AttributeName); - - // check type and compute attribute size and array size - if (! attrDesc.translateExtType()) { - delete impl; - DBUG_RETURN(703); - } - col->m_type = (NdbDictionary::Column::Type)attrDesc.AttributeExtType; - col->m_precision = (attrDesc.AttributeExtPrecision & 0xFFFF); - col->m_scale = attrDesc.AttributeExtScale; - col->m_length = attrDesc.AttributeExtLength; - // charset in upper half of precision - unsigned cs_number = (attrDesc.AttributeExtPrecision >> 16); - // charset is defined exactly for char types - if (col->getCharType() != (cs_number != 0)) { - delete impl; - DBUG_RETURN(703); - } - if (col->getCharType()) { - col->m_cs = get_charset(cs_number, MYF(0)); - if (col->m_cs == NULL) { - delete impl; - DBUG_RETURN(743); - } - } - col->m_attrSize = (1 << attrDesc.AttributeSize) / 8; - col->m_arraySize = attrDesc.AttributeArraySize; - if(attrDesc.AttributeSize == 0) - { - col->m_attrSize = 4; - col->m_arraySize = (attrDesc.AttributeArraySize + 31) >> 5; - } - - col->m_pk = attrDesc.AttributeKeyFlag; - col->m_distributionKey = attrDesc.AttributeDKey; - col->m_nullable = attrDesc.AttributeNullableFlag; - col->m_autoIncrement = (attrDesc.AttributeAutoIncrement ? true : false); - col->m_autoIncrementInitialValue = ~0; - col->m_defaultValue.assign(attrDesc.AttributeDefaultValue); - - if(attrDesc.AttributeKeyFlag){ - col->m_keyInfoPos = keyInfoPos + 1; - keyInfoPos += ((col->m_attrSize * col->m_arraySize + 3) / 4); - keyCount++; - - if(attrDesc.AttributeDKey) - distKeys++; - } else { - col->m_keyInfoPos = 0; - } - if (col->getBlobType()) - blobCount++; - NdbColumnImpl * null = 0; - impl->m_columns.fill(attrDesc.AttributeId, null); - if(impl->m_columns[attrDesc.AttributeId] != 0){ - delete col; - delete impl; - DBUG_RETURN(703); - } - impl->m_columns[attrDesc.AttributeId] = col; - it.next(); - } - - impl->m_noOfKeys = keyCount; - impl->m_keyLenInWords = keyInfoPos; - impl->m_noOfBlobs = blobCount; - impl->m_noOfDistributionKeys = distKeys; - - if(tableDesc.FragmentDataLen > 0) - { - Uint32 replicaCount = tableDesc.FragmentData[0]; - Uint32 fragCount = tableDesc.FragmentData[1]; - - impl->m_replicaCount = replicaCount; - impl->m_fragmentCount = fragCount; - - for(i = 0; i<(fragCount*replicaCount); i++) - { - impl->m_fragments.push_back(tableDesc.FragmentData[i+2]); - } - - Uint32 topBit = (1 << 31); - for(; topBit && !(fragCount & topBit); ){ - topBit >>= 1; - } - impl->m_hashValueMask = topBit - 1; - impl->m_hashpointerValue = fragCount - (impl->m_hashValueMask + 1); - } - else - { - impl->m_fragmentCount = tableDesc.FragmentCount; - impl->m_replicaCount = 0; - impl->m_hashValueMask = 0; - impl->m_hashpointerValue = 0; - } - - if(distKeys == 0) - { - for(i = 0; i < tableDesc.NoOfAttributes; i++) - { - if(impl->m_columns[i]->getPrimaryKey()) - impl->m_columns[i]->m_distributionKey = true; - } - } - - * ret = impl; - - DBUG_RETURN(0); -} - -/***************************************************************** - * Create table and alter table - */ -int -NdbDictionaryImpl::createTable(NdbTableImpl &t) -{ - if (m_receiver.createTable(m_ndb, t) != 0) - return -1; - if (t.m_noOfBlobs == 0) - return 0; - // update table def from DICT - Ndb_local_table_info *info= - get_local_table_info(t.m_internalName.c_str(),false); - if (info == NULL) { - m_error.code= 709; - return -1; - } - if (createBlobTables(*(info->m_table_impl)) != 0) { - int save_code = m_error.code; - (void)dropTable(t); - m_error.code= save_code; - return -1; - } - return 0; -} - -int -NdbDictionaryImpl::createBlobTables(NdbTableImpl &t) -{ - for (unsigned i = 0; i < t.m_columns.size(); i++) { - NdbColumnImpl & c = *t.m_columns[i]; - if (! c.getBlobType() || c.getPartSize() == 0) - continue; - NdbTableImpl bt; - NdbBlob::getBlobTable(bt, &t, &c); - if (createTable(bt) != 0) - return -1; - // Save BLOB table handle - Ndb_local_table_info *info= - get_local_table_info(bt.m_internalName.c_str(),false); - if (info == 0) { - return -1; - } - c.m_blobTable = info->m_table_impl; - } - - return 0; -} - -int -NdbDictionaryImpl::addBlobTables(NdbTableImpl &t) -{ - unsigned n= t.m_noOfBlobs; - // optimized for blob column being the last one - // and not looking for more than one if not neccessary - for (unsigned i = t.m_columns.size(); i > 0 && n > 0;) { - i--; - NdbColumnImpl & c = *t.m_columns[i]; - if (! c.getBlobType() || c.getPartSize() == 0) - continue; - n--; - char btname[NdbBlobImpl::BlobTableNameSize]; - NdbBlob::getBlobTableName(btname, &t, &c); - // Save BLOB table handle - NdbTableImpl * cachedBlobTable = getTable(btname); - if (cachedBlobTable == 0) { - return -1; - } - c.m_blobTable = cachedBlobTable; - } - - return 0; -} - -int -NdbDictInterface::createTable(Ndb & ndb, - NdbTableImpl & impl) -{ - return createOrAlterTable(ndb, impl, false); -} - -int NdbDictionaryImpl::alterTable(NdbTableImpl &impl) -{ - BaseString internalName = impl.m_internalName; - const char * originalInternalName = internalName.c_str(); - BaseString externalName = impl.m_externalName; - - DBUG_ENTER("NdbDictionaryImpl::alterTable"); - if(!get_local_table_info(originalInternalName, false)){ - m_error.code= 709; - DBUG_RETURN(-1); - } - // Alter the table - int ret = m_receiver.alterTable(m_ndb, impl); - if(ret == 0){ - // Remove cached information and let it be refreshed at next access - if (m_localHash.get(originalInternalName) != NULL) { - m_localHash.drop(originalInternalName); - m_globalHash->lock(); - NdbTableImpl * cachedImpl = m_globalHash->get(originalInternalName); - // If in local cache it must be in global - if (!cachedImpl) - abort(); - m_globalHash->drop(cachedImpl); - m_globalHash->unlock(); - } - } - DBUG_RETURN(ret); -} - -int -NdbDictInterface::alterTable(Ndb & ndb, - NdbTableImpl & impl) -{ - return createOrAlterTable(ndb, impl, true); -} - -int -NdbDictInterface::createOrAlterTable(Ndb & ndb, - NdbTableImpl & impl, - bool alter) -{ - DBUG_ENTER("NdbDictInterface::createOrAlterTable"); - unsigned i; - if((unsigned)impl.getNoOfPrimaryKeys() > NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY){ - m_error.code= 4317; - DBUG_RETURN(-1); - } - unsigned sz = impl.m_columns.size(); - if (sz > NDB_MAX_ATTRIBUTES_IN_TABLE){ - m_error.code= 4318; - DBUG_RETURN(-1); - } - - impl.copyNewProperties(); - //validate(); - //aggregate(); - - const char * internalName = - ndb.internalizeTableName(impl.m_externalName.c_str()); - impl.m_internalName.assign(internalName); - UtilBufferWriter w(m_buffer); - DictTabInfo::Table tmpTab; tmpTab.init(); - BaseString::snprintf(tmpTab.TableName, - sizeof(tmpTab.TableName), - internalName); - - bool haveAutoIncrement = false; - Uint64 autoIncrementValue = 0; - for(i = 0; i<sz; i++){ - const NdbColumnImpl * col = impl.m_columns[i]; - if(col == 0) - continue; - if (col->m_autoIncrement) { - if (haveAutoIncrement) { - m_error.code= 4335; - DBUG_RETURN(-1); - } - haveAutoIncrement = true; - autoIncrementValue = col->m_autoIncrementInitialValue; - } - } - - // Check max length of frm data - if (impl.m_frm.length() > MAX_FRM_DATA_SIZE){ - m_error.code= 1229; - DBUG_RETURN(-1); - } - tmpTab.FrmLen = impl.m_frm.length(); - memcpy(tmpTab.FrmData, impl.m_frm.get_data(), impl.m_frm.length()); - - tmpTab.TableLoggedFlag = impl.m_logging; - tmpTab.TableKValue = impl.m_kvalue; - tmpTab.MinLoadFactor = impl.m_minLoadFactor; - tmpTab.MaxLoadFactor = impl.m_maxLoadFactor; - tmpTab.TableType = DictTabInfo::UserTable; - tmpTab.NoOfAttributes = sz; - - tmpTab.FragmentType = getKernelConstant(impl.m_fragmentType, - fragmentTypeMapping, - DictTabInfo::AllNodesSmallTable); - tmpTab.TableVersion = rand(); - - SimpleProperties::UnpackStatus s; - s = SimpleProperties::pack(w, - &tmpTab, - DictTabInfo::TableMapping, - DictTabInfo::TableMappingSize, true); - - if(s != SimpleProperties::Eof){ - abort(); - } - - int distKeys= impl.m_noOfDistributionKeys; - for(i = 0; i<sz; i++){ - const NdbColumnImpl * col = impl.m_columns[i]; - if(col == 0) - continue; - - DictTabInfo::Attribute tmpAttr; tmpAttr.init(); - BaseString::snprintf(tmpAttr.AttributeName, sizeof(tmpAttr.AttributeName), - col->m_name.c_str()); - tmpAttr.AttributeId = i; - tmpAttr.AttributeKeyFlag = col->m_pk; - tmpAttr.AttributeNullableFlag = col->m_nullable; - tmpAttr.AttributeDKey = col->m_distributionKey; - - tmpAttr.AttributeExtType = (Uint32)col->m_type; - tmpAttr.AttributeExtPrecision = ((unsigned)col->m_precision & 0xFFFF); - tmpAttr.AttributeExtScale = col->m_scale; - tmpAttr.AttributeExtLength = col->m_length; - - // check type and compute attribute size and array size - if (! tmpAttr.translateExtType()) { - m_error.code= 703; - DBUG_RETURN(-1); - } - // charset is defined exactly for char types - if (col->getCharType() != (col->m_cs != NULL)) { - m_error.code= 703; - DBUG_RETURN(-1); - } - // primary key type check - if (col->m_pk && ! NdbSqlUtil::usable_in_pk(col->m_type, col->m_cs)) { - m_error.code= (col->m_cs != 0 ? 743 : 739); - DBUG_RETURN(-1); - } - // distribution key not supported for Char attribute - if (distKeys && col->m_distributionKey && col->m_cs != NULL) { - m_error.code= 745; - DBUG_RETURN(-1); - } - // charset in upper half of precision - if (col->getCharType()) { - tmpAttr.AttributeExtPrecision |= (col->m_cs->number << 16); - } - - tmpAttr.AttributeAutoIncrement = col->m_autoIncrement; - BaseString::snprintf(tmpAttr.AttributeDefaultValue, - sizeof(tmpAttr.AttributeDefaultValue), - col->m_defaultValue.c_str()); - s = SimpleProperties::pack(w, - &tmpAttr, - DictTabInfo::AttributeMapping, - DictTabInfo::AttributeMappingSize, true); - w.add(DictTabInfo::AttributeEnd, 1); - } - - NdbApiSignal tSignal(m_reference); - tSignal.theReceiversBlockNumber = DBDICT; - - 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()); - - req->senderRef = m_reference; - req->senderData = 0; - req->changeMask = impl.m_changeMask; - req->tableId = impl.m_tableId; - req->tableVersion = impl.m_version;; - tSignal.theVerId_signalNumber = GSN_ALTER_TABLE_REQ; - tSignal.theLength = AlterTableReq::SignalLength; - ret= alterTable(&tSignal, ptr); - } - else - { - CreateTableReq * const req = - CAST_PTR(CreateTableReq, tSignal.getDataPtrSend()); - - req->senderRef = m_reference; - req->senderData = 0; - tSignal.theVerId_signalNumber = GSN_CREATE_TABLE_REQ; - tSignal.theLength = CreateTableReq::SignalLength; - ret= createTable(&tSignal, ptr); - - if (ret) - DBUG_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 - } - } - } - DBUG_RETURN(ret); -} - -int -NdbDictInterface::createTable(NdbApiSignal* signal, LinearSectionPtr ptr[3]) -{ -#if DEBUG_PRINT - ndbout_c("BufferLen = %d", ptr[0].sz); - SimplePropertiesLinearReader r(ptr[0].p, ptr[0].sz); - r.printAll(ndbout); -#endif - const int noErrCodes = 2; - int errCodes[noErrCodes] = - {CreateTableRef::Busy, - CreateTableRef::NotMaster}; - return dictSignal(signal,ptr,1, - 1/*use masternode id*/, - 100, - WAIT_CREATE_INDX_REQ, - WAITFOR_RESPONSE_TIMEOUT, - errCodes,noErrCodes); -} - - -void -NdbDictInterface::execCREATE_TABLE_CONF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ -#if 0 - const CreateTableConf* const conf= - CAST_CONSTPTR(CreateTableConf, signal->getDataPtr()); - Uint32 tableId= conf->tableId; - Uint32 tableVersion= conf->tableVersion; -#endif - m_waiter.signal(NO_WAIT); -} - -void -NdbDictInterface::execCREATE_TABLE_REF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - const CreateTableRef* const ref= - CAST_CONSTPTR(CreateTableRef, signal->getDataPtr()); - m_error.code= ref->errorCode; - m_masterNodeId = ref->masterNodeId; - m_waiter.signal(NO_WAIT); -} - -int -NdbDictInterface::alterTable(NdbApiSignal* signal, LinearSectionPtr ptr[3]) -{ -#if DEBUG_PRINT - ndbout_c("BufferLen = %d", ptr[0].sz); - SimplePropertiesLinearReader r(ptr[0].p, ptr[0].sz); - r.printAll(ndbout); -#endif - const int noErrCodes = 2; - int errCodes[noErrCodes] = - {AlterTableRef::NotMaster, - AlterTableRef::Busy}; - int r = dictSignal(signal,ptr,1, - 1/*use masternode id*/, - 100,WAIT_ALTER_TAB_REQ, - WAITFOR_RESPONSE_TIMEOUT, - errCodes, noErrCodes); - if(m_error.code == AlterTableRef::InvalidTableVersion) { - // Clear caches and try again - return INCOMPATIBLE_VERSION; - } - - return r; -} - -void -NdbDictInterface::execALTER_TABLE_CONF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - //AlterTableConf* const conf = CAST_CONSTPTR(AlterTableConf, signal->getDataPtr()); - m_waiter.signal(NO_WAIT); -} - -void -NdbDictInterface::execALTER_TABLE_REF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - const AlterTableRef * const ref = - CAST_CONSTPTR(AlterTableRef, signal->getDataPtr()); - m_error.code= ref->errorCode; - m_masterNodeId = ref->masterNodeId; - m_waiter.signal(NO_WAIT); -} - -/***************************************************************** - * Drop table - */ -int -NdbDictionaryImpl::dropTable(const char * name) -{ - DBUG_ENTER("NdbDictionaryImpl::dropTable"); - DBUG_PRINT("enter",("name: %s", name)); - NdbTableImpl * tab = getTable(name); - if(tab == 0){ - DBUG_RETURN(-1); - } - int ret = dropTable(* tab); - // If table stored in cache is incompatible with the one in the kernel - // we must clear the cache and try again - if (ret == INCOMPATIBLE_VERSION) { - const char * internalTableName = m_ndb.internalizeTableName(name); - - DBUG_PRINT("info",("INCOMPATIBLE_VERSION internal_name: %s", internalTableName)); - m_localHash.drop(internalTableName); - - m_globalHash->lock(); - m_globalHash->drop(tab); - m_globalHash->unlock(); - DBUG_RETURN(dropTable(name)); - } - - DBUG_RETURN(ret); -} - -int -NdbDictionaryImpl::dropTable(NdbTableImpl & impl) -{ - int res; - const char * name = impl.getName(); - if(impl.m_status == NdbDictionary::Object::New){ - return dropTable(name); - } - - if (impl.m_indexType != NdbDictionary::Index::Undefined) { - m_receiver.m_error.code= 1228; - return -1; - } - - List list; - if ((res = listIndexes(list, impl.m_tableId)) == -1){ - return -1; - } - for (unsigned i = 0; i < list.count; i++) { - const List::Element& element = list.elements[i]; - if ((res = dropIndex(element.name, name)) == -1) - { - return -1; - } - } - - if (impl.m_noOfBlobs != 0) { - if (dropBlobTables(impl) != 0){ - return -1; - } - } - - int ret = m_receiver.dropTable(impl); - if(ret == 0 || m_error.code == 709){ - const char * internalTableName = impl.m_internalName.c_str(); - - m_localHash.drop(internalTableName); - - m_globalHash->lock(); - m_globalHash->drop(&impl); - m_globalHash->unlock(); - - return 0; - } - - return ret; -} - -int -NdbDictionaryImpl::dropBlobTables(NdbTableImpl & t) -{ - DBUG_ENTER("NdbDictionaryImpl::dropBlobTables"); - for (unsigned i = 0; i < t.m_columns.size(); i++) { - NdbColumnImpl & c = *t.m_columns[i]; - if (! c.getBlobType() || c.getPartSize() == 0) - continue; - char btname[NdbBlobImpl::BlobTableNameSize]; - NdbBlob::getBlobTableName(btname, &t, &c); - if (dropTable(btname) != 0) { - if (m_error.code != 709){ - DBUG_PRINT("exit",("error %u - exiting",m_error.code)); - DBUG_RETURN(-1); - } - DBUG_PRINT("info",("error %u - continuing",m_error.code)); - } - } - DBUG_RETURN(0); -} - -int -NdbDictInterface::dropTable(const NdbTableImpl & impl) -{ - NdbApiSignal tSignal(m_reference); - tSignal.theReceiversBlockNumber = DBDICT; - tSignal.theVerId_signalNumber = GSN_DROP_TABLE_REQ; - tSignal.theLength = DropTableReq::SignalLength; - - DropTableReq * const req = CAST_PTR(DropTableReq, tSignal.getDataPtrSend()); - req->senderRef = m_reference; - req->senderData = 0; - req->tableId = impl.m_tableId; - req->tableVersion = impl.m_version; - - return dropTable(&tSignal, 0); -} - -int -NdbDictInterface::dropTable(NdbApiSignal* signal, LinearSectionPtr ptr[3]) -{ - const int noErrCodes = 3; - int errCodes[noErrCodes] = - {DropTableRef::NoDropTableRecordAvailable, - DropTableRef::NotMaster, - DropTableRef::Busy}; - int r = dictSignal(signal,NULL,0, - 1/*use masternode id*/, - 100,WAIT_DROP_TAB_REQ, - WAITFOR_RESPONSE_TIMEOUT, - errCodes, noErrCodes); - if(m_error.code == DropTableRef::InvalidTableVersion) { - // Clear caches and try again - return INCOMPATIBLE_VERSION; - } - return r; -} - -void -NdbDictInterface::execDROP_TABLE_CONF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - DBUG_ENTER("NdbDictInterface::execDROP_TABLE_CONF"); - //DropTableConf* const conf = CAST_CONSTPTR(DropTableConf, signal->getDataPtr()); - - m_waiter.signal(NO_WAIT); - DBUG_VOID_RETURN; -} - -void -NdbDictInterface::execDROP_TABLE_REF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - DBUG_ENTER("NdbDictInterface::execDROP_TABLE_REF"); - const DropTableRef* const ref = CAST_CONSTPTR(DropTableRef, signal->getDataPtr()); - m_error.code= ref->errorCode; - m_masterNodeId = ref->masterNodeId; - m_waiter.signal(NO_WAIT); - DBUG_VOID_RETURN; -} - -int -NdbDictionaryImpl::invalidateObject(NdbTableImpl & impl) -{ - const char * internalTableName = impl.m_internalName.c_str(); - - m_localHash.drop(internalTableName); - m_globalHash->lock(); - m_globalHash->drop(&impl); - m_globalHash->unlock(); - return 0; -} - -int -NdbDictionaryImpl::removeCachedObject(NdbTableImpl & impl) -{ - const char * internalTableName = impl.m_internalName.c_str(); - - m_localHash.drop(internalTableName); - m_globalHash->lock(); - m_globalHash->release(&impl); - m_globalHash->unlock(); - return 0; -} - -/***************************************************************** - * Get index info - */ -NdbIndexImpl* -NdbDictionaryImpl::getIndexImpl(const char * externalName, - const char * internalName) -{ - Ndb_local_table_info * info = get_local_table_info(internalName, - false); - if(info == 0){ - m_error.code = 4243; - return 0; - } - NdbTableImpl * tab = info->m_table_impl; - - if(tab->m_indexType == NdbDictionary::Index::Undefined){ - // Not an index - m_error.code = 4243; - return 0; - } - - NdbTableImpl* prim = getTable(tab->m_primaryTable.c_str()); - if(prim == 0){ - m_error.code = 4243; - return 0; - } - - /** - * Create index impl - */ - NdbIndexImpl* idx; - if(NdbDictInterface::create_index_obj_from_table(&idx, tab, prim) == 0){ - idx->m_table = tab; - idx->m_externalName.assign(externalName); - idx->m_internalName.assign(internalName); - // TODO Assign idx to tab->m_index - // Don't do it right now since assign can't asign a table with index - // tab->m_index = idx; - return idx; - } - return 0; -} - -int -NdbDictInterface::create_index_obj_from_table(NdbIndexImpl** dst, - NdbTableImpl* tab, - const NdbTableImpl* prim){ - NdbIndexImpl *idx = new NdbIndexImpl(); - idx->m_version = tab->m_version; - idx->m_status = tab->m_status; - idx->m_indexId = tab->m_tableId; - idx->m_externalName.assign(tab->getName()); - idx->m_tableName.assign(prim->m_externalName); - NdbDictionary::Index::Type type = idx->m_type = tab->m_indexType; - idx->m_logging = tab->m_logging; - // skip last attribute (NDB$PK or NDB$TNODE) - - const Uint32 distKeys = prim->m_noOfDistributionKeys; - Uint32 keyCount = (distKeys ? distKeys : prim->m_noOfKeys); - - unsigned i; - for(i = 0; i+1<tab->m_columns.size(); i++){ - NdbColumnImpl* org = tab->m_columns[i]; - - NdbColumnImpl* col = new NdbColumnImpl; - // Copy column definition - *col = * org; - idx->m_columns.push_back(col); - - /** - * reverse map - */ - const NdbColumnImpl* primCol = prim->getColumn(col->getName()); - int key_id = primCol->getColumnNo(); - int fill = -1; - idx->m_key_ids.fill(key_id, fill); - idx->m_key_ids[key_id] = i; - col->m_keyInfoPos = key_id; - - if(type == NdbDictionary::Index::OrderedIndex && - (primCol->m_distributionKey || - (distKeys == 0 && primCol->getPrimaryKey()))) - { - keyCount--; - org->m_distributionKey = 1; - } - } - - if(keyCount == 0) - { - tab->m_noOfDistributionKeys = (distKeys ? distKeys : prim->m_noOfKeys); - } - else - { - for(i = 0; i+1<tab->m_columns.size(); i++) - tab->m_columns[i]->m_distributionKey = 0; - } - - * dst = idx; - return 0; -} - -/***************************************************************** - * Create index - */ -int -NdbDictionaryImpl::createIndex(NdbIndexImpl &ix) -{ - NdbTableImpl* tab = getTable(ix.getTable()); - if(tab == 0){ - m_error.code = 4249; - return -1; - } - - return m_receiver.createIndex(m_ndb, ix, * tab); -} - -int -NdbDictInterface::createIndex(Ndb & ndb, - NdbIndexImpl & impl, - const NdbTableImpl & table) -{ - //validate(); - //aggregate(); - unsigned i; - UtilBufferWriter w(m_buffer); - const size_t len = strlen(impl.m_externalName.c_str()) + 1; - if(len > MAX_TAB_NAME_SIZE) { - m_error.code = 4241; - return -1; - } - const char * internalName = - ndb.internalizeIndexName(&table, impl.getName()); - - impl.m_internalName.assign(internalName); - - w.add(DictTabInfo::TableName, internalName); - w.add(DictTabInfo::TableLoggedFlag, impl.m_logging); - - NdbApiSignal tSignal(m_reference); - tSignal.theReceiversBlockNumber = DBDICT; - tSignal.theVerId_signalNumber = GSN_CREATE_INDX_REQ; - tSignal.theLength = CreateIndxReq::SignalLength; - - CreateIndxReq * const req = CAST_PTR(CreateIndxReq, tSignal.getDataPtrSend()); - - req->setUserRef(m_reference); - req->setConnectionPtr(0); - req->setRequestType(CreateIndxReq::RT_USER); - - Uint32 it = getKernelConstant(impl.m_type, - indexTypeMapping, - DictTabInfo::UndefTableType); - - if(it == DictTabInfo::UndefTableType){ - m_error.code = 4250; - return -1; - } - req->setIndexType((DictTabInfo::TableType) it); - - req->setTableId(table.m_tableId); - req->setOnline(true); - AttributeList attributeList; - attributeList.sz = impl.m_columns.size(); - for(i = 0; i<attributeList.sz; i++){ - const NdbColumnImpl* col = - table.getColumn(impl.m_columns[i]->m_name.c_str()); - if(col == 0){ - m_error.code = 4247; - return -1; - } - // Copy column definition - *impl.m_columns[i] = *col; - - // index key type check - if (it == DictTabInfo::UniqueHashIndex && - ! NdbSqlUtil::usable_in_hash_index(col->m_type, col->m_cs) || - it == DictTabInfo::OrderedIndex && - ! NdbSqlUtil::usable_in_ordered_index(col->m_type, col->m_cs)) { - m_error.code = 743; - return -1; - } - attributeList.id[i] = col->m_attrId; - } - LinearSectionPtr ptr[3]; - ptr[0].p = (Uint32*)&attributeList; - ptr[0].sz = 1 + attributeList.sz; - ptr[1].p = (Uint32*)m_buffer.get_data(); - ptr[1].sz = m_buffer.length() >> 2; //BUG? - return createIndex(&tSignal, ptr); -} - -int -NdbDictInterface::createIndex(NdbApiSignal* signal, - LinearSectionPtr ptr[3]) -{ - const int noErrCodes = 2; - int errCodes[noErrCodes] = {CreateIndxRef::Busy, CreateIndxRef::NotMaster}; - return dictSignal(signal,ptr,2, - 1 /*use masternode id*/, - 100, - WAIT_CREATE_INDX_REQ, - -1, - errCodes,noErrCodes); -} - -void -NdbDictInterface::execCREATE_INDX_CONF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - //CreateTableConf* const conf = CAST_CONSTPTR(CreateTableConf, signal->getDataPtr()); - - m_waiter.signal(NO_WAIT); -} - -void -NdbDictInterface::execCREATE_INDX_REF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - const CreateIndxRef* const ref = CAST_CONSTPTR(CreateIndxRef, signal->getDataPtr()); - m_error.code = ref->getErrorCode(); - if(m_error.code == ref->NotMaster) - m_masterNodeId= ref->masterNodeId; - m_waiter.signal(NO_WAIT); -} - -/***************************************************************** - * Drop index - */ -int -NdbDictionaryImpl::dropIndex(const char * indexName, - const char * tableName) -{ - NdbIndexImpl * idx = getIndex(indexName, tableName); - if (idx == 0) { - m_error.code = 4243; - return -1; - } - int ret = dropIndex(*idx, tableName); - // If index stored in cache is incompatible with the one in the kernel - // we must clear the cache and try again - if (ret == INCOMPATIBLE_VERSION) { - const char * internalIndexName = (tableName) - ? - m_ndb.internalizeIndexName(getTable(tableName), indexName) - : - m_ndb.internalizeTableName(indexName); // Index is also a table - - m_localHash.drop(internalIndexName); - - m_globalHash->lock(); - m_globalHash->drop(idx->m_table); - m_globalHash->unlock(); - return dropIndex(indexName, tableName); - } - - return ret; -} - -int -NdbDictionaryImpl::dropIndex(NdbIndexImpl & impl, const char * tableName) -{ - const char * indexName = impl.getName(); - if (tableName || m_ndb.usingFullyQualifiedNames()) { - NdbTableImpl * timpl = impl.m_table; - - if (timpl == 0) { - m_error.code = 709; - return -1; - } - - const char * internalIndexName = (tableName) - ? - m_ndb.internalizeIndexName(getTable(tableName), indexName) - : - m_ndb.internalizeTableName(indexName); // Index is also a table - - if(impl.m_status == NdbDictionary::Object::New){ - return dropIndex(indexName, tableName); - } - - int ret = m_receiver.dropIndex(impl, *timpl); - if(ret == 0){ - m_localHash.drop(internalIndexName); - - m_globalHash->lock(); - m_globalHash->drop(impl.m_table); - m_globalHash->unlock(); - } - return ret; - } - - m_error.code = 4243; - return -1; -} - -int -NdbDictInterface::dropIndex(const NdbIndexImpl & impl, - const NdbTableImpl & timpl) -{ - NdbApiSignal tSignal(m_reference); - tSignal.theReceiversBlockNumber = DBDICT; - tSignal.theVerId_signalNumber = GSN_DROP_INDX_REQ; - tSignal.theLength = DropIndxReq::SignalLength; - - DropIndxReq * const req = CAST_PTR(DropIndxReq, tSignal.getDataPtrSend()); - req->setUserRef(m_reference); - req->setConnectionPtr(0); - req->setRequestType(DropIndxReq::RT_USER); - req->setTableId(~0); // DICT overwrites - req->setIndexId(timpl.m_tableId); - req->setIndexVersion(timpl.m_version); - - return dropIndex(&tSignal, 0); -} - -int -NdbDictInterface::dropIndex(NdbApiSignal* signal, LinearSectionPtr ptr[3]) -{ - const int noErrCodes = 2; - int errCodes[noErrCodes] = {DropIndxRef::Busy, DropIndxRef::NotMaster}; - int r = dictSignal(signal,NULL,0, - 1/*Use masternode id*/, - 100, - WAIT_DROP_INDX_REQ, - WAITFOR_RESPONSE_TIMEOUT, - errCodes,noErrCodes); - if(m_error.code == DropIndxRef::InvalidIndexVersion) { - // Clear caches and try again - return INCOMPATIBLE_VERSION; - } - return r; -} - -void -NdbDictInterface::execDROP_INDX_CONF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - m_waiter.signal(NO_WAIT); -} - -void -NdbDictInterface::execDROP_INDX_REF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - const DropIndxRef* const ref = CAST_CONSTPTR(DropIndxRef, signal->getDataPtr()); - m_error.code = ref->getErrorCode(); - if(m_error.code == ref->NotMaster) - m_masterNodeId= ref->masterNodeId; - m_waiter.signal(NO_WAIT); -} - -/***************************************************************** - * Create event - */ - -int -NdbDictionaryImpl::createEvent(NdbEventImpl & evnt) -{ - int i; - NdbTableImpl* tab = getTable(evnt.getTableName()); - - if(tab == 0){ -#ifdef EVENT_DEBUG - ndbout_c("NdbDictionaryImpl::createEvent: table not found: %s", - evnt.getTableName()); -#endif - return -1; - } - - evnt.m_tableId = tab->m_tableId; - evnt.m_tableImpl = tab; -#ifdef EVENT_DEBUG - ndbout_c("Event on tableId=%d", evnt.m_tableId); -#endif - - NdbTableImpl &table = *evnt.m_tableImpl; - - - int attributeList_sz = evnt.m_attrIds.size(); - - for (i = 0; i < attributeList_sz; i++) { - NdbColumnImpl *col_impl = table.getColumn(evnt.m_attrIds[i]); - if (col_impl) { - evnt.m_facade->addColumn(*(col_impl->m_facade)); - } else { - ndbout_c("Attr id %u in table %s not found", evnt.m_attrIds[i], - evnt.getTableName()); - m_error.code= 4713; - return -1; - } - } - - evnt.m_attrIds.clear(); - - attributeList_sz = evnt.m_columns.size(); -#ifdef EVENT_DEBUG - ndbout_c("creating event %s", evnt.m_externalName.c_str()); - ndbout_c("no of columns %d", evnt.m_columns.size()); -#endif - int pk_count = 0; - evnt.m_attrListBitmask.clear(); - - for(i = 0; i<attributeList_sz; i++){ - const NdbColumnImpl* col = - table.getColumn(evnt.m_columns[i]->m_name.c_str()); - if(col == 0){ - m_error.code= 4247; - return -1; - } - // Copy column definition - *evnt.m_columns[i] = *col; - - if(col->m_pk){ - pk_count++; - } - - evnt.m_attrListBitmask.set(col->m_attrId); - } - - // Sort index attributes according to primary table (using insertion sort) - for(i = 1; i < attributeList_sz; i++) { - NdbColumnImpl* temp = evnt.m_columns[i]; - unsigned int j = i; - while((j > 0) && (evnt.m_columns[j - 1]->m_attrId > temp->m_attrId)) { - evnt.m_columns[j] = evnt.m_columns[j - 1]; - j--; - } - evnt.m_columns[j] = temp; - } - // Check for illegal duplicate attributes - for(i = 1; i<attributeList_sz; i++) { - if (evnt.m_columns[i-1]->m_attrId == evnt.m_columns[i]->m_attrId) { - m_error.code= 4258; - return -1; - } - } - -#ifdef EVENT_DEBUG - char buf[128] = {0}; - evnt.m_attrListBitmask.getText(buf); - ndbout_c("createEvent: mask = %s", buf); -#endif - - // NdbDictInterface m_receiver; - return m_receiver.createEvent(m_ndb, evnt, 0 /* getFlag unset */); -} - -int -NdbDictInterface::createEvent(class Ndb & ndb, - NdbEventImpl & evnt, - int getFlag) -{ - NdbApiSignal tSignal(m_reference); - tSignal.theReceiversBlockNumber = DBDICT; - tSignal.theVerId_signalNumber = GSN_CREATE_EVNT_REQ; - if (getFlag) - tSignal.theLength = CreateEvntReq::SignalLengthGet; - else - tSignal.theLength = CreateEvntReq::SignalLengthCreate; - - CreateEvntReq * const req = CAST_PTR(CreateEvntReq, tSignal.getDataPtrSend()); - - req->setUserRef(m_reference); - req->setUserData(0); - - if (getFlag) { - // getting event from Dictionary - req->setRequestType(CreateEvntReq::RT_USER_GET); - } else { - // creating event in Dictionary - req->setRequestType(CreateEvntReq::RT_USER_CREATE); - req->setTableId(evnt.m_tableId); - req->setAttrListBitmask(evnt.m_attrListBitmask); - req->setEventType(evnt.mi_type); - } - - UtilBufferWriter w(m_buffer); - - const size_t len = strlen(evnt.m_externalName.c_str()) + 1; - if(len > MAX_TAB_NAME_SIZE) { - m_error.code= 4241; - return -1; - } - - w.add(SimpleProperties::StringValue, evnt.m_externalName.c_str()); - - if (getFlag == 0) - w.add(SimpleProperties::StringValue, - ndb.internalizeTableName(evnt.m_tableName.c_str())); - - LinearSectionPtr ptr[3]; - ptr[0].p = (Uint32*)m_buffer.get_data(); - ptr[0].sz = (m_buffer.length()+3) >> 2; - - int ret = createEvent(&tSignal, ptr, 1); - - if (ret) { - return ret; - } - - char *dataPtr = (char *)m_buffer.get_data(); - unsigned int lenCreateEvntConf = *((unsigned int *)dataPtr); - dataPtr += sizeof(lenCreateEvntConf); - CreateEvntConf const * evntConf = (CreateEvntConf *)dataPtr; - dataPtr += lenCreateEvntConf; - - // NdbEventImpl *evntImpl = (NdbEventImpl *)evntConf->getUserData(); - - if (getFlag) { - evnt.m_tableId = evntConf->getTableId(); - evnt.m_attrListBitmask = evntConf->getAttrListBitmask(); - evnt.mi_type = evntConf->getEventType(); - evnt.setTable(dataPtr); - } else { - if (evnt.m_tableId != evntConf->getTableId() || - //evnt.m_attrListBitmask != evntConf->getAttrListBitmask() || - evnt.mi_type != evntConf->getEventType()) { - ndbout_c("ERROR*************"); - return 1; - } - } - - evnt.m_eventId = evntConf->getEventId(); - evnt.m_eventKey = evntConf->getEventKey(); - - return ret; -} - -int -NdbDictInterface::createEvent(NdbApiSignal* signal, - LinearSectionPtr ptr[3], int noLSP) -{ - const int noErrCodes = 1; - int errCodes[noErrCodes] = {CreateEvntRef::Busy}; - return dictSignal(signal,ptr,noLSP, - 1 /*use masternode id*/, - 100, - WAIT_CREATE_INDX_REQ /*WAIT_CREATE_EVNT_REQ*/, - -1, - errCodes,noErrCodes, CreateEvntRef::Temporary); -} - -int -NdbDictionaryImpl::executeSubscribeEvent(NdbEventImpl & ev) -{ - // NdbDictInterface m_receiver; - return m_receiver.executeSubscribeEvent(m_ndb, ev); -} - -int -NdbDictInterface::executeSubscribeEvent(class Ndb & ndb, - NdbEventImpl & evnt) -{ - DBUG_ENTER("NdbDictInterface::executeSubscribeEvent"); - NdbApiSignal tSignal(m_reference); - // tSignal.theReceiversBlockNumber = SUMA; - tSignal.theReceiversBlockNumber = DBDICT; - tSignal.theVerId_signalNumber = GSN_SUB_START_REQ; - tSignal.theLength = SubStartReq::SignalLength2; - - SubStartReq * sumaStart = CAST_PTR(SubStartReq, tSignal.getDataPtrSend()); - - sumaStart->subscriptionId = evnt.m_eventId; - sumaStart->subscriptionKey = evnt.m_eventKey; - sumaStart->part = SubscriptionData::TableData; - sumaStart->subscriberData = evnt.m_bufferId & 0xFF; - sumaStart->subscriberRef = m_reference; - - DBUG_RETURN(executeSubscribeEvent(&tSignal, NULL)); -} - -int -NdbDictInterface::executeSubscribeEvent(NdbApiSignal* signal, - LinearSectionPtr ptr[3]) -{ - return dictSignal(signal,NULL,0, - 1 /*use masternode id*/, - 100, - WAIT_CREATE_INDX_REQ /*WAIT_CREATE_EVNT_REQ*/, - -1, - NULL,0); -} - -int -NdbDictionaryImpl::stopSubscribeEvent(NdbEventImpl & ev) -{ - // NdbDictInterface m_receiver; - return m_receiver.stopSubscribeEvent(m_ndb, ev); -} - -int -NdbDictInterface::stopSubscribeEvent(class Ndb & ndb, - NdbEventImpl & evnt) -{ - DBUG_ENTER("NdbDictInterface::stopSubscribeEvent"); - - NdbApiSignal tSignal(m_reference); - // tSignal.theReceiversBlockNumber = SUMA; - tSignal.theReceiversBlockNumber = DBDICT; - tSignal.theVerId_signalNumber = GSN_SUB_STOP_REQ; - tSignal.theLength = SubStopReq::SignalLength; - - SubStopReq * sumaStop = CAST_PTR(SubStopReq, tSignal.getDataPtrSend()); - - sumaStop->subscriptionId = evnt.m_eventId; - sumaStop->subscriptionKey = evnt.m_eventKey; - sumaStop->subscriberData = evnt.m_bufferId & 0xFF; - sumaStop->part = (Uint32) SubscriptionData::TableData; - sumaStop->subscriberRef = m_reference; - - DBUG_RETURN(stopSubscribeEvent(&tSignal, NULL)); -} - -int -NdbDictInterface::stopSubscribeEvent(NdbApiSignal* signal, - LinearSectionPtr ptr[3]) -{ - return dictSignal(signal,NULL,0, - 1 /*use masternode id*/, - 100, - WAIT_CREATE_INDX_REQ /*WAIT_SUB_STOP__REQ*/, - -1, - NULL,0); -} - -NdbEventImpl * -NdbDictionaryImpl::getEvent(const char * eventName) -{ - NdbEventImpl *ev = new NdbEventImpl(); - - if (ev == NULL) { - return NULL; - } - - ev->setName(eventName); - - int ret = m_receiver.createEvent(m_ndb, *ev, 1 /* getFlag set */); - - if (ret) { - delete ev; - return NULL; - } - - // We only have the table name with internal name - ev->setTable(m_ndb.externalizeTableName(ev->getTableName())); - ev->m_tableImpl = getTable(ev->getTableName()); - - // get the columns from the attrListBitmask - - NdbTableImpl &table = *ev->m_tableImpl; - AttributeMask & mask = ev->m_attrListBitmask; - int attributeList_sz = mask.count(); - int id = -1; - -#ifdef EVENT_DEBUG - ndbout_c("NdbDictionaryImpl::getEvent attributeList_sz = %d", - attributeList_sz); - char buf[128] = {0}; - mask.getText(buf); - ndbout_c("mask = %s", buf); -#endif - - for(int i = 0; i < attributeList_sz; i++) { - id++; while (!mask.get(id)) id++; - - const NdbColumnImpl* col = table.getColumn(id); - if(col == 0) { -#ifdef EVENT_DEBUG - ndbout_c("NdbDictionaryImpl::getEvent could not find column id %d", id); -#endif - m_error.code= 4247; - delete ev; - return NULL; - } - NdbColumnImpl* new_col = new NdbColumnImpl; - // Copy column definition - *new_col = *col; - - ev->m_columns.push_back(new_col); - } - - return ev; -} - -void -NdbDictInterface::execCREATE_EVNT_CONF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - DBUG_ENTER("NdbDictInterface::execCREATE_EVNT_CONF"); - - m_buffer.clear(); - unsigned int len = signal->getLength() << 2; - m_buffer.append((char *)&len, sizeof(len)); - m_buffer.append(signal->getDataPtr(), len); - - if (signal->m_noOfSections > 0) { - m_buffer.append((char *)ptr[0].p, strlen((char *)ptr[0].p)+1); - } - - const CreateEvntConf * const createEvntConf= - CAST_CONSTPTR(CreateEvntConf, signal->getDataPtr()); - - Uint32 subscriptionId = createEvntConf->getEventId(); - Uint32 subscriptionKey = createEvntConf->getEventKey(); - - DBUG_PRINT("info",("subscriptionId=%d,subscriptionKey=%d", - subscriptionId,subscriptionKey)); - m_waiter.signal(NO_WAIT); - DBUG_VOID_RETURN; -} - -void -NdbDictInterface::execCREATE_EVNT_REF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - DBUG_ENTER("NdbDictInterface::execCREATE_EVNT_REF"); - - const CreateEvntRef* const ref= - CAST_CONSTPTR(CreateEvntRef, signal->getDataPtr()); - m_error.code= ref->getErrorCode(); - DBUG_PRINT("error",("error=%d,line=%d,node=%d",ref->getErrorCode(), - ref->getErrorLine(),ref->getErrorNode())); - m_waiter.signal(NO_WAIT); - DBUG_VOID_RETURN; -} - -void -NdbDictInterface::execSUB_STOP_CONF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - DBUG_ENTER("NdbDictInterface::execSUB_STOP_CONF"); - const SubStopConf * const subStopConf= - CAST_CONSTPTR(SubStopConf, signal->getDataPtr()); - - Uint32 subscriptionId = subStopConf->subscriptionId; - Uint32 subscriptionKey = subStopConf->subscriptionKey; - Uint32 subscriberData = subStopConf->subscriberData; - - DBUG_PRINT("info",("subscriptionId=%d,subscriptionKey=%d,subscriberData=%d", - subscriptionId,subscriptionKey,subscriberData)); - m_waiter.signal(NO_WAIT); - DBUG_VOID_RETURN; -} - -void -NdbDictInterface::execSUB_STOP_REF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - DBUG_ENTER("NdbDictInterface::execSUB_STOP_REF"); - const SubStopRef * const subStopRef= - CAST_CONSTPTR(SubStopRef, signal->getDataPtr()); - - Uint32 subscriptionId = subStopRef->subscriptionId; - Uint32 subscriptionKey = subStopRef->subscriptionKey; - Uint32 subscriberData = subStopRef->subscriberData; - m_error.code= subStopRef->errorCode; - - DBUG_PRINT("error",("subscriptionId=%d,subscriptionKey=%d,subscriberData=%d,error=%d", - subscriptionId,subscriptionKey,subscriberData,m_error.code)); - m_waiter.signal(NO_WAIT); - DBUG_VOID_RETURN; -} - -void -NdbDictInterface::execSUB_START_CONF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - DBUG_ENTER("NdbDictInterface::execSUB_START_CONF"); - const SubStartConf * const subStartConf= - CAST_CONSTPTR(SubStartConf, signal->getDataPtr()); - - Uint32 subscriptionId = subStartConf->subscriptionId; - Uint32 subscriptionKey = subStartConf->subscriptionKey; - SubscriptionData::Part part = - (SubscriptionData::Part)subStartConf->part; - Uint32 subscriberData = subStartConf->subscriberData; - - switch(part) { - case SubscriptionData::MetaData: { - DBUG_PRINT("error",("SubscriptionData::MetaData")); - m_error.code= 1; - break; - } - case SubscriptionData::TableData: { - DBUG_PRINT("info",("SubscriptionData::TableData")); - break; - } - default: { - DBUG_PRINT("error",("wrong data")); - m_error.code= 2; - break; - } - } - DBUG_PRINT("info",("subscriptionId=%d,subscriptionKey=%d,subscriberData=%d", - subscriptionId,subscriptionKey,subscriberData)); - m_waiter.signal(NO_WAIT); - DBUG_VOID_RETURN; -} - -void -NdbDictInterface::execSUB_START_REF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - DBUG_ENTER("NdbDictInterface::execSUB_START_REF"); - const SubStartRef * const subStartRef= - CAST_CONSTPTR(SubStartRef, signal->getDataPtr()); - m_error.code= subStartRef->errorCode; - m_waiter.signal(NO_WAIT); - DBUG_VOID_RETURN; -} -void -NdbDictInterface::execSUB_GCP_COMPLETE_REP(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - const SubGcpCompleteRep * const rep= - CAST_CONSTPTR(SubGcpCompleteRep, signal->getDataPtr()); - - const Uint32 gci = rep->gci; - // const Uint32 senderRef = rep->senderRef; - const Uint32 subscriberData = rep->subscriberData; - - const Uint32 bufferId = subscriberData; - - const Uint32 ref = signal->theSendersBlockRef; - - NdbApiSignal tSignal(m_reference); - SubGcpCompleteAcc * acc= - CAST_PTR(SubGcpCompleteAcc, tSignal.getDataPtrSend()); - - acc->rep = *rep; - - tSignal.theReceiversBlockNumber = refToBlock(ref); - tSignal.theVerId_signalNumber = GSN_SUB_GCP_COMPLETE_ACC; - tSignal.theLength = SubGcpCompleteAcc::SignalLength; - - Uint32 aNodeId = refToNode(ref); - - // m_transporter->lock_mutex(); - int r; - r = m_transporter->sendSignal(&tSignal, aNodeId); - // m_transporter->unlock_mutex(); - - NdbGlobalEventBufferHandle::latestGCI(bufferId, gci); -} - -void -NdbDictInterface::execSUB_TABLE_DATA(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ -#ifdef EVENT_DEBUG - const char * FNAME = "NdbDictInterface::execSUB_TABLE_DATA"; -#endif - //TODO - const SubTableData * const sdata = CAST_CONSTPTR(SubTableData, signal->getDataPtr()); - - // const Uint32 gci = sdata->gci; - // const Uint32 operation = sdata->operation; - // const Uint32 tableId = sdata->tableId; - // const Uint32 noOfAttrs = sdata->noOfAttributes; - // const Uint32 dataLen = sdata->dataSize; - const Uint32 subscriberData = sdata->subscriberData; - // const Uint32 logType = sdata->logType; - - for (int i=signal->m_noOfSections;i < 3; i++) { - ptr[i].p = NULL; - ptr[i].sz = 0; - } -#ifdef EVENT_DEBUG - ndbout_c("%s: senderData %d, gci %d, operation %d, tableId %d, noOfAttrs %d, dataLen %d", - FNAME, subscriberData, gci, operation, tableId, noOfAttrs, dataLen); - ndbout_c("ptr[0] %u %u ptr[1] %u %u ptr[2] %u %u\n", - ptr[0].p,ptr[0].sz,ptr[1].p,ptr[1].sz,ptr[2].p,ptr[2].sz); -#endif - const Uint32 bufferId = subscriberData; - - NdbGlobalEventBufferHandle::insertDataL(bufferId, - sdata, ptr); -} - -/***************************************************************** - * Drop event - */ -int -NdbDictionaryImpl::dropEvent(const char * eventName) -{ - NdbEventImpl *ev= new NdbEventImpl(); - ev->setName(eventName); - int ret= m_receiver.dropEvent(*ev); - delete ev; - - // printf("__________________RET %u\n", ret); - return ret; -} - -int -NdbDictInterface::dropEvent(const NdbEventImpl &evnt) -{ - NdbApiSignal tSignal(m_reference); - tSignal.theReceiversBlockNumber = DBDICT; - tSignal.theVerId_signalNumber = GSN_DROP_EVNT_REQ; - tSignal.theLength = DropEvntReq::SignalLength; - - DropEvntReq * const req = CAST_PTR(DropEvntReq, tSignal.getDataPtrSend()); - - req->setUserRef(m_reference); - req->setUserData(0); - - UtilBufferWriter w(m_buffer); - - w.add(SimpleProperties::StringValue, evnt.m_externalName.c_str()); - - LinearSectionPtr ptr[1]; - ptr[0].p = (Uint32*)m_buffer.get_data(); - ptr[0].sz = (m_buffer.length()+3) >> 2; - - return dropEvent(&tSignal, ptr, 1); -} - -int -NdbDictInterface::dropEvent(NdbApiSignal* signal, - LinearSectionPtr ptr[3], int noLSP) -{ - //TODO - const int noErrCodes = 1; - int errCodes[noErrCodes] = {DropEvntRef::Busy}; - return dictSignal(signal,ptr,noLSP, - 1 /*use masternode id*/, - 100, - WAIT_CREATE_INDX_REQ /*WAIT_CREATE_EVNT_REQ*/, - -1, - errCodes,noErrCodes, DropEvntRef::Temporary); -} -void -NdbDictInterface::execDROP_EVNT_CONF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - DBUG_ENTER("NdbDictInterface::execDROP_EVNT_CONF"); - m_waiter.signal(NO_WAIT); - DBUG_VOID_RETURN; -} - -void -NdbDictInterface::execDROP_EVNT_REF(NdbApiSignal * signal, - LinearSectionPtr ptr[3]) -{ - DBUG_ENTER("NdbDictInterface::execDROP_EVNT_REF"); - const DropEvntRef* const ref= - CAST_CONSTPTR(DropEvntRef, signal->getDataPtr()); - m_error.code= ref->getErrorCode(); - - DBUG_PRINT("info",("ErrorCode=%u Errorline=%u ErrorNode=%u", - ref->getErrorCode(), ref->getErrorLine(), ref->getErrorNode())); - - m_waiter.signal(NO_WAIT); - DBUG_VOID_RETURN; -} - -/***************************************************************** - * List objects or indexes - */ -int -NdbDictionaryImpl::listObjects(List& list, NdbDictionary::Object::Type type) -{ - ListTablesReq req; - req.requestData = 0; - req.setTableType(getKernelConstant(type, objectTypeMapping, 0)); - req.setListNames(true); - return m_receiver.listObjects(list, req.requestData, m_ndb.usingFullyQualifiedNames()); -} - -int -NdbDictionaryImpl::listIndexes(List& list, Uint32 indexId) -{ - ListTablesReq req; - req.requestData = 0; - req.setTableId(indexId); - req.setListNames(true); - req.setListIndexes(true); - return m_receiver.listObjects(list, req.requestData, m_ndb.usingFullyQualifiedNames()); -} - -int -NdbDictInterface::listObjects(NdbDictionary::Dictionary::List& list, - Uint32 requestData, bool fullyQualifiedNames) -{ - NdbApiSignal tSignal(m_reference); - ListTablesReq* const req = CAST_PTR(ListTablesReq, tSignal.getDataPtrSend()); - req->senderRef = m_reference; - req->senderData = 0; - req->requestData = requestData; - tSignal.theReceiversBlockNumber = DBDICT; - tSignal.theVerId_signalNumber = GSN_LIST_TABLES_REQ; - tSignal.theLength = ListTablesReq::SignalLength; - if (listObjects(&tSignal) != 0) - return -1; - // count - const Uint32* data = (const Uint32*)m_buffer.get_data(); - const unsigned length = m_buffer.length() / 4; - list.count = 0; - bool ok = true; - unsigned pos, count; - pos = count = 0; - while (pos < length) { - // table id - name length - name - pos++; - if (pos >= length) { - ok = false; - break; - } - Uint32 n = (data[pos++] + 3) >> 2; - pos += n; - if (pos > length) { - ok = false; - break; - } - count++; - } - if (! ok) { - // bad signal data - m_error.code= 4213; - return -1; - } - list.count = count; - list.elements = new NdbDictionary::Dictionary::List::Element[count]; - pos = count = 0; - while (pos < length) { - NdbDictionary::Dictionary::List::Element& element = list.elements[count]; - Uint32 d = data[pos++]; - element.id = ListTablesConf::getTableId(d); - element.type = (NdbDictionary::Object::Type) - getApiConstant(ListTablesConf::getTableType(d), objectTypeMapping, 0); - element.state = (NdbDictionary::Object::State) - getApiConstant(ListTablesConf::getTableState(d), objectStateMapping, 0); - element.store = (NdbDictionary::Object::Store) - getApiConstant(ListTablesConf::getTableStore(d), objectStoreMapping, 0); - // table or index name - Uint32 n = (data[pos++] + 3) >> 2; - BaseString databaseName; - BaseString schemaName; - BaseString objectName; - if ((element.type == NdbDictionary::Object::UniqueHashIndex) || - (element.type == NdbDictionary::Object::OrderedIndex)) { - char * indexName = new char[n << 2]; - memcpy(indexName, &data[pos], n << 2); - databaseName = Ndb::getDatabaseFromInternalName(indexName); - schemaName = Ndb::getSchemaFromInternalName(indexName); - objectName = BaseString(Ndb::externalizeIndexName(indexName, fullyQualifiedNames)); - delete [] indexName; - } else if ((element.type == NdbDictionary::Object::SystemTable) || - (element.type == NdbDictionary::Object::UserTable)) { - char * tableName = new char[n << 2]; - memcpy(tableName, &data[pos], n << 2); - databaseName = Ndb::getDatabaseFromInternalName(tableName); - schemaName = Ndb::getSchemaFromInternalName(tableName); - objectName = BaseString(Ndb::externalizeTableName(tableName, fullyQualifiedNames)); - delete [] tableName; - } - else { - char * otherName = new char[n << 2]; - memcpy(otherName, &data[pos], n << 2); - objectName = BaseString(otherName); - delete [] otherName; - } - element.database = new char[databaseName.length() + 1]; - strcpy(element.database, databaseName.c_str()); - element.schema = new char[schemaName.length() + 1]; - strcpy(element.schema, schemaName.c_str()); - element.name = new char[objectName.length() + 1]; - strcpy(element.name, objectName.c_str()); - pos += n; - count++; - } - return 0; -} - -int -NdbDictInterface::listObjects(NdbApiSignal* signal) -{ - const Uint32 RETRIES = 100; - for (Uint32 i = 0; i < RETRIES; i++) { - m_buffer.clear(); - // begin protected - m_transporter->lock_mutex(); - Uint16 aNodeId = m_transporter->get_an_alive_node(); - if (aNodeId == 0) { - m_error.code= 4009; - m_transporter->unlock_mutex(); - return -1; - } - if (m_transporter->sendSignal(signal, aNodeId) != 0) { - m_transporter->unlock_mutex(); - continue; - } - m_error.code= 0; - m_waiter.m_node = aNodeId; - m_waiter.m_state = WAIT_LIST_TABLES_CONF; - m_waiter.wait(WAITFOR_RESPONSE_TIMEOUT); - m_transporter->unlock_mutex(); - // end protected - if (m_waiter.m_state == NO_WAIT && m_error.code == 0) - return 0; - if (m_waiter.m_state == WAIT_NODE_FAILURE) - continue; - return -1; - } - return -1; -} - -void -NdbDictInterface::execLIST_TABLES_CONF(NdbApiSignal* signal, - LinearSectionPtr ptr[3]) -{ - const unsigned off = ListTablesConf::HeaderLength; - const unsigned len = (signal->getLength() - off); - m_buffer.append(signal->getDataPtr() + off, len << 2); - if (signal->getLength() < ListTablesConf::SignalLength) { - // last signal has less than full length - m_waiter.signal(NO_WAIT); - } -} - -template class Vector<int>; -template class Vector<Uint16>; -template class Vector<Uint32>; -template class Vector<Vector<Uint32> >; -template class Vector<NdbTableImpl*>; -template class Vector<NdbColumnImpl*>; - diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp deleted file mode 100644 index 59a5956715a..00000000000 --- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp +++ /dev/null @@ -1,704 +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 NdbDictionaryImpl_H -#define NdbDictionaryImpl_H - -#include <ndb_types.h> -#include <kernel_types.h> -#include <ndb_limits.h> -#include <NdbError.hpp> -#include <BaseString.hpp> -#include <Vector.hpp> -#include <UtilBuffer.hpp> -#include <NdbDictionary.hpp> -#include <Bitmask.hpp> -#include <AttributeList.hpp> -#include <Ndb.hpp> -#include "NdbWaiter.hpp" -#include "DictCache.hpp" - -class NdbDictObjectImpl { -public: - Uint32 m_version; - NdbDictionary::Object::Status m_status; - - bool change(); -protected: - NdbDictObjectImpl() : - m_status(NdbDictionary::Object::New) { - } -}; - -/** - * Column - */ -class NdbColumnImpl : public NdbDictionary::Column { -public: - NdbColumnImpl(); - NdbColumnImpl(NdbDictionary::Column &); // This is not a copy constructor - ~NdbColumnImpl(); - NdbColumnImpl& operator=(const NdbColumnImpl&); - void init(Type t = Unsigned); - - int m_attrId; - BaseString m_name; - NdbDictionary::Column::Type m_type; - int m_precision; - int m_scale; - int m_length; - CHARSET_INFO * m_cs; // not const in MySQL - - bool m_pk; - bool m_distributionKey; - bool m_nullable; - bool m_autoIncrement; - Uint64 m_autoIncrementInitialValue; - BaseString m_defaultValue; - NdbTableImpl * m_blobTable; - - /** - * Internal types and sizes, and aggregates - */ - Uint32 m_attrSize; // element size (size when arraySize==1) - Uint32 m_arraySize; // length or length+2 for Var* types - Uint32 m_keyInfoPos; - // TODO: use bits in attr desc 2 - bool getInterpretableType() const ; - bool getCharType() const; - bool getStringType() const; - bool getBlobType() const; - - /** - * Equality/assign - */ - bool equal(const NdbColumnImpl&) const; - - static NdbColumnImpl & getImpl(NdbDictionary::Column & t); - static const NdbColumnImpl & getImpl(const NdbDictionary::Column & t); - NdbDictionary::Column * m_facade; - - static NdbDictionary::Column * create_psuedo(const char *); -}; - -class NdbTableImpl : public NdbDictionary::Table, public NdbDictObjectImpl { -public: - NdbTableImpl(); - NdbTableImpl(NdbDictionary::Table &); - ~NdbTableImpl(); - - void init(); - void setName(const char * name); - const char * getName() const; - - Uint32 m_changeMask; - Uint32 m_tableId; - BaseString m_internalName; - BaseString m_externalName; - BaseString m_newExternalName; // Used for alter table - UtilBuffer m_frm; - NdbDictionary::Object::FragmentType m_fragmentType; - - /** - * - */ - Uint32 m_columnHashMask; - Vector<Uint32> m_columnHash; - Vector<NdbColumnImpl *> m_columns; - void buildColumnHash(); - - /** - * Fragment info - */ - Uint32 m_hashValueMask; - Uint32 m_hashpointerValue; - Vector<Uint16> m_fragments; - - bool m_logging; - int m_kvalue; - int m_minLoadFactor; - int m_maxLoadFactor; - Uint16 m_keyLenInWords; - Uint16 m_fragmentCount; - - NdbDictionaryImpl * m_dictionary; - NdbIndexImpl * m_index; - NdbColumnImpl * getColumn(unsigned attrId); - NdbColumnImpl * getColumn(const char * name); - const NdbColumnImpl * getColumn(unsigned attrId) const; - const NdbColumnImpl * getColumn(const char * name) const; - - /** - * Index only stuff - */ - BaseString m_primaryTable; - NdbDictionary::Index::Type m_indexType; - - /** - * Aggregates - */ - Uint8 m_noOfKeys; - Uint8 m_noOfDistributionKeys; - Uint8 m_noOfBlobs; - - Uint8 m_replicaCount; - - /** - * Equality/assign - */ - bool equal(const NdbTableImpl&) const; - void assign(const NdbTableImpl&); - void clearNewProperties(); - void copyNewProperties(); - - static NdbTableImpl & getImpl(NdbDictionary::Table & t); - static NdbTableImpl & getImpl(const NdbDictionary::Table & t); - NdbDictionary::Table * m_facade; - - /** - * Return count - */ - Uint32 get_nodes(Uint32 hashValue, const Uint16** nodes) const ; -}; - -class NdbIndexImpl : public NdbDictionary::Index, public NdbDictObjectImpl { -public: - NdbIndexImpl(); - NdbIndexImpl(NdbDictionary::Index &); - ~NdbIndexImpl(); - - void setName(const char * name); - const char * getName() const; - void setTable(const char * table); - const char * getTable() const; - const NdbTableImpl * getIndexTable() const; - - Uint32 m_indexId; - BaseString m_internalName; - BaseString m_externalName; - BaseString m_tableName; - Vector<NdbColumnImpl *> m_columns; - Vector<int> m_key_ids; - NdbDictionary::Index::Type m_type; - - bool m_logging; - - NdbTableImpl * m_table; - - static NdbIndexImpl & getImpl(NdbDictionary::Index & t); - static NdbIndexImpl & getImpl(const NdbDictionary::Index & t); - NdbDictionary::Index * m_facade; -}; - -class NdbEventImpl : public NdbDictionary::Event, public NdbDictObjectImpl { -public: - NdbEventImpl(); - NdbEventImpl(NdbDictionary::Event &); - ~NdbEventImpl(); - - void setName(const char * name); - const char * getName() const; - void setTable(const NdbDictionary::Table& table); - void setTable(const char * table); - const char * getTableName() const; - void addTableEvent(const NdbDictionary::Event::TableEvent t); - void setDurability(NdbDictionary::Event::EventDurability d); - NdbDictionary::Event::EventDurability getDurability() const; - void addEventColumn(const NdbColumnImpl &c); - int getNoOfEventColumns() const; - - void print() { - ndbout_c("NdbEventImpl: id=%d, key=%d", - m_eventId, - m_eventKey); - }; - - Uint32 m_eventId; - Uint32 m_eventKey; - Uint32 m_tableId; - AttributeMask m_attrListBitmask; - //BaseString m_internalName; - BaseString m_externalName; - Uint32 mi_type; - NdbDictionary::Event::EventDurability m_dur; - - - NdbTableImpl *m_tableImpl; - BaseString m_tableName; - Vector<NdbColumnImpl *> m_columns; - Vector<unsigned> m_attrIds; - - int m_bufferId; - - NdbEventOperation *eventOp; - - static NdbEventImpl & getImpl(NdbDictionary::Event & t); - static NdbEventImpl & getImpl(const NdbDictionary::Event & t); - NdbDictionary::Event * m_facade; -}; - - -class NdbDictInterface { -public: - NdbDictInterface(NdbError& err) : m_error(err) { - m_reference = 0; - m_masterNodeId = 0; - m_transporter= NULL; - } - ~NdbDictInterface(); - - bool setTransporter(class Ndb * ndb, class TransporterFacade * tf); - bool setTransporter(class TransporterFacade * tf); - - // To abstract the stuff thats made in all create/drop/lists below - int - dictSignal(NdbApiSignal* signal, - LinearSectionPtr ptr[3], int noLPTR, - const int useMasterNodeId, - const Uint32 RETRIES, - const WaitSignalType wst, - const int theWait, - const int *errcodes, - const int noerrcodes, - const int temporaryMask = 0); - - int createOrAlterTable(class Ndb & ndb, NdbTableImpl &, bool alter); - - int createTable(class Ndb & ndb, NdbTableImpl &); - int createTable(NdbApiSignal* signal, LinearSectionPtr ptr[3]); - - int alterTable(class Ndb & ndb, NdbTableImpl &); - int alterTable(NdbApiSignal* signal, LinearSectionPtr ptr[3]); - - int createIndex(class Ndb & ndb, - NdbIndexImpl &, - const NdbTableImpl &); - int createIndex(NdbApiSignal* signal, LinearSectionPtr ptr[3]); - - int createEvent(class Ndb & ndb, NdbEventImpl &, int getFlag); - int createEvent(NdbApiSignal* signal, LinearSectionPtr ptr[3], int noLSP); - - int dropTable(const NdbTableImpl &); - int dropTable(NdbApiSignal* signal, LinearSectionPtr ptr[3]); - - int dropIndex(const NdbIndexImpl &, const NdbTableImpl &); - int dropIndex(NdbApiSignal* signal, LinearSectionPtr ptr[3]); - - int dropEvent(const NdbEventImpl &); - int dropEvent(NdbApiSignal* signal, LinearSectionPtr ptr[3], int noLSP); - - int executeSubscribeEvent(class Ndb & ndb, NdbEventImpl &); - int executeSubscribeEvent(NdbApiSignal* signal, LinearSectionPtr ptr[3]); - - int stopSubscribeEvent(class Ndb & ndb, NdbEventImpl &); - int stopSubscribeEvent(NdbApiSignal* signal, LinearSectionPtr ptr[3]); - - int listObjects(NdbDictionary::Dictionary::List& list, Uint32 requestData, bool fullyQualifiedNames); - int listObjects(NdbApiSignal* signal); - - NdbTableImpl * getTable(int tableId, bool fullyQualifiedNames); - NdbTableImpl * getTable(const char * name, bool fullyQualifiedNames); - NdbTableImpl * getTable(class NdbApiSignal * signal, - LinearSectionPtr ptr[3], - Uint32 noOfSections, bool fullyQualifiedNames); - - static int parseTableInfo(NdbTableImpl ** dst, - const Uint32 * data, Uint32 len, - bool fullyQualifiedNames); - - static int create_index_obj_from_table(NdbIndexImpl ** dst, - NdbTableImpl* index_table, - const NdbTableImpl* primary_table); - - NdbError & m_error; -private: - Uint32 m_reference; - Uint32 m_masterNodeId; - - NdbWaiter m_waiter; - class TransporterFacade * m_transporter; - - friend class Ndb; - static void execSignal(void* dictImpl, - class NdbApiSignal* signal, - struct LinearSectionPtr ptr[3]); - - static void execNodeStatus(void* dictImpl, Uint32, - bool alive, bool nfCompleted); - - void execGET_TABINFO_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execGET_TABINFO_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execCREATE_TABLE_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execCREATE_TABLE_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execALTER_TABLE_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execALTER_TABLE_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); - - void execCREATE_INDX_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execCREATE_INDX_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execDROP_INDX_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execDROP_INDX_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); - - void execCREATE_EVNT_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execCREATE_EVNT_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execSUB_START_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execSUB_START_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execSUB_TABLE_DATA(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execSUB_GCP_COMPLETE_REP(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execSUB_STOP_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execSUB_STOP_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execDROP_EVNT_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execDROP_EVNT_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); - - void execDROP_TABLE_REF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execDROP_TABLE_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); - void execLIST_TABLES_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]); - - Uint32 m_fragmentId; - UtilBuffer m_buffer; -}; - -class NdbDictionaryImpl : public NdbDictionary::Dictionary { -public: - NdbDictionaryImpl(Ndb &ndb); - NdbDictionaryImpl(Ndb &ndb, NdbDictionary::Dictionary & f); - ~NdbDictionaryImpl(); - - bool setTransporter(class Ndb * ndb, class TransporterFacade * tf); - bool setTransporter(class TransporterFacade * tf); - - int createTable(NdbTableImpl &t); - int createBlobTables(NdbTableImpl &); - int addBlobTables(NdbTableImpl &); - int alterTable(NdbTableImpl &t); - int dropTable(const char * name); - int dropTable(NdbTableImpl &); - int dropBlobTables(NdbTableImpl &); - int invalidateObject(NdbTableImpl &); - int removeCachedObject(NdbTableImpl &); - - int createIndex(NdbIndexImpl &ix); - int dropIndex(const char * indexName, - const char * tableName); - int dropIndex(NdbIndexImpl &, const char * tableName); - NdbTableImpl * getIndexTable(NdbIndexImpl * index, - NdbTableImpl * table); - - int createEvent(NdbEventImpl &); - int dropEvent(const char * eventName); - - int executeSubscribeEvent(NdbEventImpl &); - int stopSubscribeEvent(NdbEventImpl &); - - int listObjects(List& list, NdbDictionary::Object::Type type); - int listIndexes(List& list, Uint32 indexId); - - NdbTableImpl * getTable(const char * tableName, void **data= 0); - Ndb_local_table_info * get_local_table_info(const char * internalName, - bool do_add_blob_tables); - NdbIndexImpl * getIndex(const char * indexName, - const char * tableName); - NdbIndexImpl * getIndexImpl(const char * name, const char * internalName); - NdbEventImpl * getEvent(const char * eventName); - NdbEventImpl * getEventImpl(const char * internalName); - - const NdbError & getNdbError() const; - NdbError m_error; - Uint32 m_local_table_data_size; - - LocalDictCache m_localHash; - GlobalDictCache * m_globalHash; - - static NdbDictionaryImpl & getImpl(NdbDictionary::Dictionary & t); - static const NdbDictionaryImpl & getImpl(const NdbDictionary::Dictionary &t); - NdbDictionary::Dictionary * m_facade; - - NdbDictInterface m_receiver; - Ndb & m_ndb; -private: - Ndb_local_table_info * fetchGlobalTableImpl(const char * internalName); -}; - -inline -NdbEventImpl & -NdbEventImpl::getImpl(const NdbDictionary::Event & t){ - return t.m_impl; -} - -inline -NdbEventImpl & -NdbEventImpl::getImpl(NdbDictionary::Event & t){ - return t.m_impl; -} - -inline -NdbColumnImpl & -NdbColumnImpl::getImpl(NdbDictionary::Column & t){ - return t.m_impl; -} - -inline -const NdbColumnImpl & -NdbColumnImpl::getImpl(const NdbDictionary::Column & t){ - return t.m_impl; -} - -inline -bool -NdbColumnImpl::getInterpretableType() const { - return (m_type == NdbDictionary::Column::Unsigned || - m_type == NdbDictionary::Column::Bigunsigned); -} - -inline -bool -NdbColumnImpl::getCharType() const { - return (m_type == NdbDictionary::Column::Char || - m_type == NdbDictionary::Column::Varchar || - m_type == NdbDictionary::Column::Text || - m_type == NdbDictionary::Column::Longvarchar); -} - -inline -bool -NdbColumnImpl::getStringType() const { - return (m_type == NdbDictionary::Column::Char || - m_type == NdbDictionary::Column::Varchar || - m_type == NdbDictionary::Column::Longvarchar || - m_type == NdbDictionary::Column::Binary || - m_type == NdbDictionary::Column::Varbinary || - m_type == NdbDictionary::Column::Longvarbinary); -} - -inline -bool -NdbColumnImpl::getBlobType() const { - return (m_type == NdbDictionary::Column::Blob || - m_type == NdbDictionary::Column::Text); -} - -inline -NdbTableImpl & -NdbTableImpl::getImpl(NdbDictionary::Table & t){ - return t.m_impl; -} - -inline -NdbTableImpl & -NdbTableImpl::getImpl(const NdbDictionary::Table & t){ - return t.m_impl; -} - -inline -NdbColumnImpl * -NdbTableImpl::getColumn(unsigned attrId){ - if(m_columns.size() > attrId){ - return m_columns[attrId]; - } - return 0; -} - -inline -Uint32 -Hash( const char* str ){ - Uint32 h = 0; - Uint32 len = strlen(str); - while(len >= 4){ - h = (h << 5) + h + str[0]; - h = (h << 5) + h + str[1]; - h = (h << 5) + h + str[2]; - h = (h << 5) + h + str[3]; - len -= 4; - str += 4; - } - - switch(len){ - case 3: - h = (h << 5) + h + *str++; - case 2: - h = (h << 5) + h + *str++; - case 1: - h = (h << 5) + h + *str++; - } - return h + h; -} - - -inline -NdbColumnImpl * -NdbTableImpl::getColumn(const char * name){ - - Uint32 sz = m_columns.size(); - NdbColumnImpl** cols = m_columns.getBase(); - const Uint32 * hashtable = m_columnHash.getBase(); - - if(sz > 5 && false){ - Uint32 hashValue = Hash(name) & 0xFFFE; - Uint32 bucket = hashValue & m_columnHashMask; - bucket = (bucket < sz ? bucket : bucket - sz); - hashtable += bucket; - Uint32 tmp = * hashtable; - if((tmp & 1) == 1 ){ // No chaining - sz = 1; - } else { - sz = (tmp >> 16); - hashtable += (tmp & 0xFFFE) >> 1; - tmp = * hashtable; - } - do { - if(hashValue == (tmp & 0xFFFE)){ - NdbColumnImpl* col = cols[tmp >> 16]; - if(strncmp(name, col->m_name.c_str(), NDB_MAX_ATTR_NAME_SIZE-1) == 0){ - return col; - } - } - hashtable++; - tmp = * hashtable; - } while(--sz > 0); -#if 0 - Uint32 dir = m_columnHash[bucket]; - Uint32 pos = bucket + ((dir & 0xFFFE) >> 1); - Uint32 cnt = dir >> 16; - ndbout_c("col: %s hv: %x bucket: %d dir: %x pos: %d cnt: %d tmp: %d -> 0", - name, hashValue, bucket, dir, pos, cnt, tmp); -#endif - return 0; - } else { - for(Uint32 i = 0; i<sz; i++){ - NdbColumnImpl* col = * cols++; - if(col != 0 && strncmp(name, col->m_name.c_str(), NDB_MAX_ATTR_NAME_SIZE-1) == 0) - return col; - } - } - return 0; -} - -inline -const NdbColumnImpl * -NdbTableImpl::getColumn(unsigned attrId) const { - if(m_columns.size() > attrId){ - return m_columns[attrId]; - } - return 0; -} - -inline -const NdbColumnImpl * -NdbTableImpl::getColumn(const char * name) const { - Uint32 sz = m_columns.size(); - NdbColumnImpl* const * cols = m_columns.getBase(); - for(Uint32 i = 0; i<sz; i++, cols++){ - NdbColumnImpl* col = * cols; - if(col != 0 && strcmp(name, col->m_name.c_str()) == 0) - return col; - } - return 0; -} - -inline -NdbIndexImpl & -NdbIndexImpl::getImpl(NdbDictionary::Index & t){ - return t.m_impl; -} - -inline -NdbIndexImpl & -NdbIndexImpl::getImpl(const NdbDictionary::Index & t){ - return t.m_impl; -} - -inline -NdbDictionaryImpl & -NdbDictionaryImpl::getImpl(NdbDictionary::Dictionary & t){ - return t.m_impl; -} - -inline -const NdbDictionaryImpl & -NdbDictionaryImpl::getImpl(const NdbDictionary::Dictionary & t){ - return t.m_impl; -} - -/***************************************************************** - * Inline:d getters - */ - -inline -NdbTableImpl * -NdbDictionaryImpl::getTable(const char * tableName, void **data) -{ - Ndb_local_table_info *info= - get_local_table_info(m_ndb.internalizeTableName(tableName), true); - if (info == 0) { - return 0; - } - if (data) { - *data= info->m_local_data; - } - return info->m_table_impl; -} - -inline -Ndb_local_table_info * -NdbDictionaryImpl::get_local_table_info(const char * internalTableName, - bool do_add_blob_tables) -{ - Ndb_local_table_info *info= m_localHash.get(internalTableName); - if (info == 0) { - info= fetchGlobalTableImpl(internalTableName); - if (info == 0) { - return 0; - } - } - if (do_add_blob_tables && info->m_table_impl->m_noOfBlobs) - addBlobTables(*(info->m_table_impl)); - - return info; // autoincrement already initialized -} - -inline -NdbIndexImpl * -NdbDictionaryImpl::getIndex(const char * indexName, - const char * tableName) -{ - if (tableName || m_ndb.usingFullyQualifiedNames()) { - const char * internalIndexName = 0; - if (tableName) { - NdbTableImpl * t = getTable(tableName); - if (t != 0) - internalIndexName = m_ndb.internalizeIndexName(t, indexName); - } else { - internalIndexName = - m_ndb.internalizeTableName(indexName); // Index is also a table - } - if (internalIndexName) { - Ndb_local_table_info * info = get_local_table_info(internalIndexName, - false); - if (info) { - NdbTableImpl * tab = info->m_table_impl; - if (tab->m_index == 0) - tab->m_index = getIndexImpl(indexName, internalIndexName); - if (tab->m_index != 0) - tab->m_index->m_table = tab; - return tab->m_index; - } - } - } - - m_error.code = 4243; - return 0; -} - -#endif diff --git a/ndb/src/ndbapi/NdbErrorOut.cpp b/ndb/src/ndbapi/NdbErrorOut.cpp deleted file mode 100644 index 07e0b2fe6e8..00000000000 --- a/ndb/src/ndbapi/NdbErrorOut.cpp +++ /dev/null @@ -1,45 +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 */ - - -#include <ndb_global.h> - -#include <NdbOut.hpp> - -#include <NdbError.hpp> - -/** - * operators - */ -NdbOut & -operator<<(NdbOut & out, const NdbError & error){ - if(error.message != 0) - out << error.code << ": " << error.message; - else - out << error.code << ": "; - return out; -} - -NdbOut & -operator<<(NdbOut & out, const NdbError::Status & status){ - return out << ndberror_status_message((ndberror_status)status); -} - -NdbOut & -operator<<(NdbOut & out, const NdbError::Classification & classification){ - return out << ndberror_classification_message((ndberror_classification)classification); -} - diff --git a/ndb/src/ndbapi/NdbEventOperation.cpp b/ndb/src/ndbapi/NdbEventOperation.cpp deleted file mode 100644 index e99cad918c5..00000000000 --- a/ndb/src/ndbapi/NdbEventOperation.cpp +++ /dev/null @@ -1,115 +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 */ - - -#include <Ndb.hpp> -#include <NdbError.hpp> -#include <portlib/NdbMem.h> -#include "NdbEventOperationImpl.hpp" -#include "NdbDictionaryImpl.hpp" - -NdbEventOperation::NdbEventOperation(Ndb *theNdb, - const char* eventName, - int bufferLength) - : m_impl(* new NdbEventOperationImpl(*this,theNdb, - eventName, - bufferLength)) -{ -} - -NdbEventOperation::~NdbEventOperation() -{ - NdbEventOperationImpl * tmp = &m_impl; - if (this != tmp) - delete tmp; -} - -NdbEventOperation::State NdbEventOperation::getState() -{ - return m_impl.getState(); -} - -NdbRecAttr * -NdbEventOperation::getValue(const char *colName, char *aValue) -{ - return m_impl.getValue(colName, aValue, 0); -} - -NdbRecAttr * -NdbEventOperation::getPreValue(const char *colName, char *aValue) -{ - return m_impl.getValue(colName, aValue, 1); -} - -int -NdbEventOperation::execute() -{ - return m_impl.execute(); -} - -int -NdbEventOperation::next(int *pOverrun) -{ - return m_impl.next(pOverrun); -} - -bool -NdbEventOperation::isConsistent() -{ - return m_impl.isConsistent(); -} - -Uint32 -NdbEventOperation::getGCI() -{ - return m_impl.getGCI(); -} - -Uint32 -NdbEventOperation::getLatestGCI() -{ - return m_impl.getLatestGCI(); -} - -NdbDictionary::Event::TableEvent -NdbEventOperation::getEventType() -{ - return m_impl.getEventType(); -} - -void -NdbEventOperation::print() -{ - m_impl.print(); -} - -/* - * Private members - */ - -int -NdbEventOperation::wait(void *p, int aMillisecondNumber) -{ - return NdbEventOperationImpl::wait(p, aMillisecondNumber); -} - -NdbEventOperation::NdbEventOperation(NdbEventOperationImpl& impl) - : m_impl(impl) {} - -const struct NdbError & -NdbEventOperation::getNdbError() const { - return m_impl.getNdbError(); -} diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/ndb/src/ndbapi/NdbEventOperationImpl.cpp deleted file mode 100644 index 208525bfc15..00000000000 --- a/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ /dev/null @@ -1,1366 +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 */ - - -#include <ndb_global.h> -#include <kernel_types.h> - -#include "NdbDictionaryImpl.hpp" -#include "API.hpp" -#include <NdbOut.hpp> -#include "NdbApiSignal.hpp" -#include "TransporterFacade.hpp" -#include <signaldata/CreateEvnt.hpp> -#include <signaldata/SumaImpl.hpp> -#include <SimpleProperties.hpp> -#include <Bitmask.hpp> -#include <AttributeHeader.hpp> -#include <AttributeList.hpp> -#include <NdbError.hpp> -#include <BaseString.hpp> -#include <UtilBuffer.hpp> -#include <NdbDictionary.hpp> -#include <Ndb.hpp> -#include "NdbImpl.hpp" -#include "DictCache.hpp" -#include <portlib/NdbMem.h> -#include <NdbRecAttr.hpp> -#include <NdbEventOperation.hpp> -#include "NdbEventOperationImpl.hpp" - -/* - * Class NdbEventOperationImpl - * - * - */ - -//#define EVENT_DEBUG - - -NdbEventOperationImpl::NdbEventOperationImpl(NdbEventOperation &N, - Ndb *theNdb, - const char* eventName, - const int bufferLength) - : NdbEventOperation(*this), m_ndb(theNdb), - m_state(EO_ERROR), m_bufferL(bufferLength) -{ - m_eventId = 0; - theFirstPkAttrs[0] = NULL; - theCurrentPkAttrs[0] = NULL; - theFirstPkAttrs[1] = NULL; - theCurrentPkAttrs[1] = NULL; - theFirstDataAttrs[0] = NULL; - theCurrentDataAttrs[0] = NULL; - theFirstDataAttrs[1] = NULL; - theCurrentDataAttrs[1] = NULL; - sdata = NULL; - ptr[0].p = NULL; - ptr[1].p = NULL; - ptr[2].p = NULL; - - // we should lookup id in Dictionary, TODO - // also make sure we only have one listener on each event - - if (!m_ndb) abort(); - - NdbDictionary::Dictionary *myDict = m_ndb->getDictionary(); - if (!myDict) { m_error.code= m_ndb->getNdbError().code; return; } - - const NdbDictionary::Event *myEvnt = myDict->getEvent(eventName); - if (!myEvnt) { m_error.code= myDict->getNdbError().code; return; } - - m_eventImpl = &myEvnt->m_impl; - - m_eventId = m_eventImpl->m_eventId; - - m_bufferHandle = m_ndb->getGlobalEventBufferHandle(); - if (m_bufferHandle->m_bufferL > 0) - m_bufferL =m_bufferHandle->m_bufferL; - else - m_bufferHandle->m_bufferL = m_bufferL; - - m_state = EO_CREATED; -} - -NdbEventOperationImpl::~NdbEventOperationImpl() -{ - int i; - if (sdata) NdbMem_Free((char*)sdata); - for (i=0 ; i<2; i++) { - NdbRecAttr *p = theFirstPkAttrs[i]; - while (p) { - NdbRecAttr *p_next = p->next(); - m_ndb->releaseRecAttr(p); - p = p_next; - } - } - for (i=0 ; i<2; i++) { - NdbRecAttr *p = theFirstDataAttrs[i]; - while (p) { - NdbRecAttr *p_next = p->next(); - m_ndb->releaseRecAttr(p); - p = p_next; - } - } - if (m_state == EO_EXECUTING) { - stop(); - // m_bufferHandle->dropSubscribeEvent(m_bufferId); - ; // We should send stop signal here - } -} - -NdbEventOperation::State -NdbEventOperationImpl::getState() -{ - return m_state; -} - -NdbRecAttr* -NdbEventOperationImpl::getValue(const char *colName, char *aValue, int n) -{ - DBUG_ENTER("NdbEventOperationImpl::getValue"); - if (m_state != EO_CREATED) { - ndbout_c("NdbEventOperationImpl::getValue may only be called between instantiation and execute()"); - DBUG_RETURN(NULL); - } - - NdbColumnImpl *tAttrInfo = m_eventImpl->m_tableImpl->getColumn(colName); - - if (tAttrInfo == NULL) { - ndbout_c("NdbEventOperationImpl::getValue attribute %s not found",colName); - DBUG_RETURN(NULL); - } - - DBUG_RETURN(NdbEventOperationImpl::getValue(tAttrInfo, aValue, n)); -} - -NdbRecAttr* -NdbEventOperationImpl::getValue(const NdbColumnImpl *tAttrInfo, char *aValue, int n) -{ - DBUG_ENTER("NdbEventOperationImpl::getValue"); - // Insert Attribute Id into ATTRINFO part. - - NdbRecAttr **theFirstAttr; - NdbRecAttr **theCurrentAttr; - - if (tAttrInfo->getPrimaryKey()) - { - theFirstAttr = &theFirstPkAttrs[n]; - theCurrentAttr = &theCurrentPkAttrs[n]; - } - else - { - theFirstAttr = &theFirstDataAttrs[n]; - theCurrentAttr = &theCurrentDataAttrs[n]; - } - - /************************************************************************ - * Get a Receive Attribute object and link it into the operation object. - ************************************************************************/ - NdbRecAttr *tAttr = m_ndb->getRecAttr(); - if (tAttr == NULL) { - exit(-1); - //setErrorCodeAbort(4000); - DBUG_RETURN(NULL); - } - - /********************************************************************** - * Now set the attribute identity and the pointer to the data in - * the RecAttr object - * Also set attribute size, array size and attribute type - ********************************************************************/ - if (tAttr->setup(tAttrInfo, aValue)) { - //setErrorCodeAbort(4000); - m_ndb->releaseRecAttr(tAttr); - exit(-1); - DBUG_RETURN(NULL); - } - //theErrorLine++; - - tAttr->setUNDEFINED(); - - // We want to keep the list sorted to make data insertion easier later - - if (*theFirstAttr == NULL) { - *theFirstAttr = tAttr; - *theCurrentAttr = tAttr; - tAttr->next(NULL); - } else { - Uint32 tAttrId = tAttrInfo->m_attrId; - if (tAttrId > (*theCurrentAttr)->attrId()) { // right order - (*theCurrentAttr)->next(tAttr); - tAttr->next(NULL); - *theCurrentAttr = tAttr; - } else if ((*theFirstAttr)->next() == NULL || // only one in list - (*theFirstAttr)->attrId() > tAttrId) {// or first - tAttr->next(*theFirstAttr); - *theFirstAttr = tAttr; - } else { // at least 2 in list and not first and not last - NdbRecAttr *p = *theFirstAttr; - NdbRecAttr *p_next = p->next(); - while (tAttrId > p_next->attrId()) { - p = p_next; - p_next = p->next(); - } - if (tAttrId == p_next->attrId()) { // Using same attribute twice - tAttr->release(); // do I need to do this? - m_ndb->releaseRecAttr(tAttr); - exit(-1); - DBUG_RETURN(NULL); - } - // this is it, between p and p_next - p->next(tAttr); - tAttr->next(p_next); - } - } - DBUG_RETURN(tAttr); -} - -int -NdbEventOperationImpl::execute() -{ - DBUG_ENTER("NdbEventOperationImpl::execute"); - NdbDictionary::Dictionary *myDict = m_ndb->getDictionary(); - if (!myDict) { - m_error.code= m_ndb->getNdbError().code; - DBUG_RETURN(-1); - } - - if (theFirstPkAttrs[0] == NULL && - theFirstDataAttrs[0] == NULL) { // defaults to get all - - } - - NdbDictionaryImpl & myDictImpl = NdbDictionaryImpl::getImpl(*myDict); - - - int hasSubscriber; - int r= m_bufferHandle->prepareAddSubscribeEvent(this, - hasSubscriber /*return value*/); - m_error.code= 4709; - - if (r < 0) - { - DBUG_RETURN(-1); - } - - m_eventImpl->m_bufferId = m_bufferId = (Uint32)r; - - r = -1; - if (m_bufferId >= 0) { - // now we check if there's already a subscriber - - if (hasSubscriber == 0) { // only excute if there's no other subscribers - r = myDictImpl.executeSubscribeEvent(*m_eventImpl); - } else { - r = 0; - } - if (r) { - //Error - m_bufferHandle->unprepareAddSubscribeEvent(m_bufferId); - m_state = EO_ERROR; - } else { - m_bufferHandle->addSubscribeEvent(m_bufferId, this); - m_state = EO_EXECUTING; - } - } else { - //Error - m_state = EO_ERROR; - } - DBUG_RETURN(r); -} - -int -NdbEventOperationImpl::stop() -{ - DBUG_ENTER("NdbEventOperationImpl::stop"); - if (m_state != EO_EXECUTING) - { - DBUG_RETURN(-1); - } - - // ndbout_c("NdbEventOperation::stopping()"); - - NdbDictionary::Dictionary *myDict = m_ndb->getDictionary(); - if (!myDict) { - m_error.code= m_ndb->getNdbError().code; - DBUG_RETURN(-1); - } - - NdbDictionaryImpl & myDictImpl = NdbDictionaryImpl::getImpl(*myDict); - - int hasSubscriber; - int ret = - m_bufferHandle->prepareDropSubscribeEvent(m_bufferId, - hasSubscriber /* return value */); - - if (ret < 0) { - m_error.code= 4712; - DBUG_RETURN(-1); - } - // m_eventImpl->m_bufferId = m_bufferId; - - int r = -1; - - if (hasSubscriber == 0) { // only excute if there's no other subscribers - r = myDictImpl.stopSubscribeEvent(*m_eventImpl); -#ifdef EVENT_DEBUG - ndbout_c("NdbEventOperation::stopping() done"); -#endif - } else - r = 0; - - if (r) { - //Error - m_bufferHandle->unprepareDropSubscribeEvent(m_bufferId); - m_error.code= myDictImpl.m_error.code; - m_state = EO_ERROR; - } else { -#ifdef EVENT_DEBUG - ndbout_c("NdbEventOperation::dropping()"); -#endif - m_bufferHandle->dropSubscribeEvent(m_bufferId); - m_state = EO_CREATED; - } - - DBUG_RETURN(r); -} - -bool -NdbEventOperationImpl::isConsistent() -{ - return sdata->isGCIConsistent(); -} - -Uint32 -NdbEventOperationImpl::getGCI() -{ - return sdata->gci; -} - -Uint32 -NdbEventOperationImpl::getLatestGCI() -{ - return NdbGlobalEventBufferHandle::getLatestGCI(); -} - -int -NdbEventOperationImpl::next(int *pOverrun) -{ - DBUG_ENTER("NdbEventOperationImpl::next"); - int nr = 10000; // a high value - int tmpOverrun = 0; - int *ptmpOverrun; - if (pOverrun) { - ptmpOverrun = &tmpOverrun; - } else - ptmpOverrun = NULL; - - while (nr > 0) { - int r=NdbGlobalEventBufferHandle::getDataL(m_bufferId, sdata, - ptr, pOverrun); - if (pOverrun) { - tmpOverrun += *pOverrun; - *pOverrun = tmpOverrun; - } - - if (r <= 0) - { - DBUG_RETURN(r); // no data - } - - if (r < nr) r = nr; else nr--; // we don't want to be stuck here forever - -#ifdef EVENT_DEBUG - ndbout_c("!!!!!!!sdata->operation %u", (Uint32)sdata->operation); -#endif - - // now move the data into the RecAttrs - if ((theFirstPkAttrs[0] == NULL) && - (theFirstPkAttrs[1] == NULL) && - (theFirstDataAttrs[0] == NULL) && - (theFirstDataAttrs[1] == NULL)) - { - DBUG_RETURN(r); - } - // no copying since no RecAttr's - - - Uint32 *aAttrPtr = ptr[0].p; - Uint32 *aAttrEndPtr = aAttrPtr + ptr[0].sz; - Uint32 *aDataPtr = ptr[1].p; - -#ifdef EVENT_DEBUG - int i; - printf("after values sz=%u\n", ptr[1].sz); - for(i=0; i < (int)ptr[1].sz; i++) - printf ("H'%.8X ",ptr[1].p[i]); - printf("\n"); - printf("before values sz=%u\n", ptr[2].sz); - for(i=0; i < (int)ptr[2].sz; i++) - printf ("H'%.8X ",ptr[2].p[i]); - printf("\n"); -#endif - - // copy data into the RecAttr's - // we assume that the respective attribute lists are sorted - - // first the pk's - { - NdbRecAttr *tAttr= theFirstPkAttrs[0]; - while(tAttr) - { - assert(aAttrPtr < aAttrEndPtr); - unsigned tDataSz= AttributeHeader(*aAttrPtr).getDataSize(); - assert(tAttr->attrId() == - AttributeHeader(*aAttrPtr).getAttributeId()); - assert(tAttr->receive_data(aDataPtr, tDataSz)); - // next - aAttrPtr++; - aDataPtr+= tDataSz; - tAttr= tAttr->next(); - } - } - - NdbRecAttr *tWorkingRecAttr = theFirstDataAttrs[0]; - - Uint32 tRecAttrId; - Uint32 tAttrId; - Uint32 tDataSz; - int hasSomeData=0; - while ((aAttrPtr < aAttrEndPtr) && (tWorkingRecAttr != NULL)) { - tRecAttrId = tWorkingRecAttr->attrId(); - tAttrId = AttributeHeader(*aAttrPtr).getAttributeId(); - tDataSz = AttributeHeader(*aAttrPtr).getDataSize(); - - while (tAttrId > tRecAttrId) { - //printf("[%u] %u %u [%u]\n", tAttrId, tDataSz, *aDataPtr, tRecAttrId); - tWorkingRecAttr->setUNDEFINED(); - tWorkingRecAttr = tWorkingRecAttr->next(); - if (tWorkingRecAttr == NULL) - break; - tRecAttrId = tWorkingRecAttr->attrId(); - } - if (tWorkingRecAttr == NULL) - break; - - //printf("[%u] %u %u [%u]\n", tAttrId, tDataSz, *aDataPtr, tRecAttrId); - - if (tAttrId == tRecAttrId) { - hasSomeData++; - - //printf("set!\n"); - - assert(tWorkingRecAttr->receive_data(aDataPtr, tDataSz)); - tWorkingRecAttr = tWorkingRecAttr->next(); - } - aAttrPtr++; - aDataPtr += tDataSz; - } - - while (tWorkingRecAttr != NULL) { - tRecAttrId = tWorkingRecAttr->attrId(); - //printf("set undefined [%u] %u %u [%u]\n", tAttrId, tDataSz, *aDataPtr, tRecAttrId); - tWorkingRecAttr->setUNDEFINED(); - tWorkingRecAttr = tWorkingRecAttr->next(); - } - - tWorkingRecAttr = theFirstDataAttrs[1]; - aDataPtr = ptr[2].p; - Uint32 *aDataEndPtr = aDataPtr + ptr[2].sz; - while ((aDataPtr < aDataEndPtr) && (tWorkingRecAttr != NULL)) { - tRecAttrId = tWorkingRecAttr->attrId(); - tAttrId = AttributeHeader(*aDataPtr).getAttributeId(); - tDataSz = AttributeHeader(*aDataPtr).getDataSize(); - aDataPtr++; - while (tAttrId > tRecAttrId) { - tWorkingRecAttr->setUNDEFINED(); - tWorkingRecAttr = tWorkingRecAttr->next(); - if (tWorkingRecAttr == NULL) - break; - tRecAttrId = tWorkingRecAttr->attrId(); - } - if (tWorkingRecAttr == NULL) - break; - if (tAttrId == tRecAttrId) { - assert(!m_eventImpl->m_tableImpl->getColumn(tRecAttrId)->getPrimaryKey()); - hasSomeData++; - - assert(tWorkingRecAttr->receive_data(aDataPtr, tDataSz)); - tWorkingRecAttr = tWorkingRecAttr->next(); - } - aDataPtr += tDataSz; - } - while (tWorkingRecAttr != NULL) { - tWorkingRecAttr->setUNDEFINED(); - tWorkingRecAttr = tWorkingRecAttr->next(); - } - - if (hasSomeData) - { - DBUG_RETURN(r); - } - } - DBUG_RETURN(0); -} - -NdbDictionary::Event::TableEvent -NdbEventOperationImpl::getEventType() -{ - switch (sdata->operation) { - case TriggerEvent::TE_INSERT: - return NdbDictionary::Event::TE_INSERT; - case TriggerEvent::TE_DELETE: - return NdbDictionary::Event::TE_DELETE; - case TriggerEvent::TE_UPDATE: - return NdbDictionary::Event::TE_UPDATE; - default: - return NdbDictionary::Event::TE_ALL; - } -} - - - -void -NdbEventOperationImpl::print() -{ - int i; - ndbout << "EventId " << m_eventId << "\n"; - - for (i = 0; i < 2; i++) { - NdbRecAttr *p = theFirstPkAttrs[i]; - ndbout << " %u " << i; - while (p) { - ndbout << " : " << p->attrId() << " = " << *p; - p = p->next(); - } - ndbout << "\n"; - } - for (i = 0; i < 2; i++) { - NdbRecAttr *p = theFirstDataAttrs[i]; - ndbout << " %u " << i; - while (p) { - ndbout << " : " << p->attrId() << " = " << *p; - p = p->next(); - } - ndbout << "\n"; - } -} - -void -NdbEventOperationImpl::printAll() -{ - Uint32 *aAttrPtr = ptr[0].p; - Uint32 *aAttrEndPtr = aAttrPtr + ptr[0].sz; - Uint32 *aDataPtr = ptr[1].p; - - //tRecAttr->setup(tAttrInfo, aValue)) { - - Uint32 tAttrId; - Uint32 tDataSz; - for (; aAttrPtr < aAttrEndPtr; ) { - tAttrId = AttributeHeader(*aAttrPtr).getAttributeId(); - tDataSz = AttributeHeader(*aAttrPtr).getDataSize(); - - aAttrPtr++; - aDataPtr += tDataSz; - } -} - - -int NdbEventOperationImpl::wait(void *p, int aMillisecondNumber) -{ - return ((NdbGlobalEventBufferHandle*)p)->wait(aMillisecondNumber); -} - -/* - * Global variable ndbGlobalEventBuffer - * Class NdbGlobalEventBufferHandle - * Class NdbGlobalEventBuffer - * - */ - -#define ADD_DROP_LOCK_GUARDR(TYPE, FN) \ -{ \ - ndbGlobalEventBuffer->add_drop_lock(); \ - ndbGlobalEventBuffer->lock(); \ - TYPE r = ndbGlobalEventBuffer->FN; \ - ndbGlobalEventBuffer->unlock(); \ - if (r < 0) { \ - ndbGlobalEventBuffer->add_drop_unlock(); \ - } \ - return r;\ -} -#define GUARDR(TYPE, FN) \ -{ \ - ndbGlobalEventBuffer->lock(); \ - TYPE r = ndbGlobalEventBuffer->FN; \ - ndbGlobalEventBuffer->unlock(); \ - return r;\ -} -#define GUARD(FN) \ -{ \ - ndbGlobalEventBuffer->lock(); \ - ndbGlobalEventBuffer->FN; \ - ndbGlobalEventBuffer->unlock(); \ -} -#define ADD_DROP_UNLOCK_GUARD(FN) \ -{ \ - GUARD(FN); \ - ndbGlobalEventBuffer->add_drop_unlock(); \ -} -#define GUARDBLOCK(BLOCK) \ -{ \ - ndbGlobalEventBuffer->lock(); \ - BLOCK \ - ndbGlobalEventBuffer->unlock(); \ -} - -/* - * Global variable ndbGlobalEventBuffer - * - */ - -extern NdbMutex * ndb_global_event_buffer_mutex; -static NdbGlobalEventBuffer *ndbGlobalEventBuffer=NULL; - -/* - * Class NdbGlobalEventBufferHandle - * Each Ndb object has a Handle. This Handle is used to access the - * global NdbGlobalEventBuffer instance ndbGlobalEventBuffer - */ - -NdbGlobalEventBufferHandle * -NdbGlobalEventBuffer_init(int n) -{ - return new NdbGlobalEventBufferHandle(n); - // return NdbGlobalEventBufferHandle::init(n); -} - -void -NdbGlobalEventBuffer_drop(NdbGlobalEventBufferHandle *h) -{ - delete h; -} - -NdbGlobalEventBufferHandle::NdbGlobalEventBufferHandle -(int MAX_NUMBER_ACTIVE_EVENTS) : m_bufferL(0), m_nids(0) -{ - if ((p_cond = NdbCondition_Create()) == NULL) { - ndbout_c("NdbGlobalEventBufferHandle: NdbCondition_Create() failed"); - exit(-1); - } - - NdbMutex_Lock(ndb_global_event_buffer_mutex); - if (ndbGlobalEventBuffer == NULL) { - if (ndbGlobalEventBuffer == NULL) { - ndbGlobalEventBuffer = new NdbGlobalEventBuffer(); - if (!ndbGlobalEventBuffer) { - NdbMutex_Unlock(ndb_global_event_buffer_mutex); - ndbout_c("NdbGlobalEventBufferHandle:: failed to allocate ndbGlobalEventBuffer"); - exit(-1); - } - } - } - NdbMutex_Unlock(ndb_global_event_buffer_mutex); - - GUARD(real_init(this,MAX_NUMBER_ACTIVE_EVENTS)); -} - -NdbGlobalEventBufferHandle::~NdbGlobalEventBufferHandle() -{ - NdbCondition_Destroy(p_cond); - - ndbGlobalEventBuffer->lock(); - ndbGlobalEventBuffer->real_remove(this); - ndbGlobalEventBuffer->unlock(); - - NdbMutex_Lock(ndb_global_event_buffer_mutex); - if (ndbGlobalEventBuffer->m_handlers.size() == 0) { - delete ndbGlobalEventBuffer; - ndbGlobalEventBuffer = NULL; - } - NdbMutex_Unlock(ndb_global_event_buffer_mutex); -} - -void -NdbGlobalEventBufferHandle::addBufferId(int bufferId) -{ - DBUG_ENTER("NdbGlobalEventBufferHandle::addBufferId"); - DBUG_PRINT("enter",("bufferId=%d",bufferId)); - if (m_nids >= NDB_MAX_ACTIVE_EVENTS) { - ndbout_c("NdbGlobalEventBufferHandle::addBufferId error in paramerer setting"); - exit(-1); - } - m_bufferIds[m_nids] = bufferId; - m_nids++; - DBUG_VOID_RETURN; -} - -void -NdbGlobalEventBufferHandle::dropBufferId(int bufferId) -{ - DBUG_ENTER("NdbGlobalEventBufferHandle::dropBufferId"); - DBUG_PRINT("enter",("bufferId=%d",bufferId)); - for (int i = 0; i < m_nids; i++) - if (m_bufferIds[i] == bufferId) { - m_nids--; - for (; i < m_nids; i++) - m_bufferIds[i] = m_bufferIds[i+1]; - DBUG_VOID_RETURN; - } - ndbout_c("NdbGlobalEventBufferHandle::dropBufferId %d does not exist", - bufferId); - exit(-1); -} -/* -NdbGlobalEventBufferHandle * -NdbGlobalEventBufferHandle::init (int MAX_NUMBER_ACTIVE_EVENTS) -{ - return new NdbGlobalEventBufferHandle(); -} -void -NdbGlobalEventBufferHandle::drop(NdbGlobalEventBufferHandle *handle) -{ - delete handle; -} -*/ -int -NdbGlobalEventBufferHandle::prepareAddSubscribeEvent -(NdbEventOperationImpl *eventOp, int& hasSubscriber) -{ - ADD_DROP_LOCK_GUARDR(int,real_prepareAddSubscribeEvent(this, eventOp, - hasSubscriber)); -} -void -NdbGlobalEventBufferHandle::addSubscribeEvent -(int bufferId, NdbEventOperationImpl *ndbEventOperationImpl) -{ - ADD_DROP_UNLOCK_GUARD(real_addSubscribeEvent(bufferId, ndbEventOperationImpl)); -} -void -NdbGlobalEventBufferHandle::unprepareAddSubscribeEvent(int bufferId) -{ - ADD_DROP_UNLOCK_GUARD(real_unprepareAddSubscribeEvent(bufferId)); -} - -int -NdbGlobalEventBufferHandle::prepareDropSubscribeEvent(int bufferId, - int& hasSubscriber) -{ - ADD_DROP_LOCK_GUARDR(int,real_prepareDropSubscribeEvent(bufferId, hasSubscriber)); -} - -void -NdbGlobalEventBufferHandle::unprepareDropSubscribeEvent(int bufferId) -{ - ADD_DROP_UNLOCK_GUARD(real_unprepareDropSubscribeEvent(bufferId)); -} - -void -NdbGlobalEventBufferHandle::dropSubscribeEvent(int bufferId) -{ - ADD_DROP_UNLOCK_GUARD(real_dropSubscribeEvent(bufferId)); -} - -int -NdbGlobalEventBufferHandle::insertDataL(int bufferId, - const SubTableData * const sdata, - LinearSectionPtr ptr[3]) -{ - GUARDR(int,real_insertDataL(bufferId,sdata,ptr)); -} - -void -NdbGlobalEventBufferHandle::latestGCI(int bufferId, Uint32 gci) -{ - GUARD(real_latestGCI(bufferId,gci)); -} - -Uint32 -NdbGlobalEventBufferHandle::getLatestGCI() -{ - GUARDR(Uint32, real_getLatestGCI()); -} - -inline void -NdbGlobalEventBufferHandle::group_lock() -{ - ndbGlobalEventBuffer->group_lock(); -} - -inline void -NdbGlobalEventBufferHandle::group_unlock() -{ - ndbGlobalEventBuffer->group_unlock(); -} - -int -NdbGlobalEventBufferHandle::wait(int aMillisecondNumber) -{ - GUARDR(int, real_wait(this, aMillisecondNumber)); -} - -int NdbGlobalEventBufferHandle::getDataL(const int bufferId, - SubTableData * &sdata, - LinearSectionPtr ptr[3], - int *pOverrun) -{ - GUARDR(int,real_getDataL(bufferId,sdata,ptr,pOverrun)); -} - -/* - * Class NdbGlobalEventBuffer - * - * - */ - - -void -NdbGlobalEventBuffer::lock() -{ - if (!m_group_lock_flag) - NdbMutex_Lock(ndb_global_event_buffer_mutex); -} -void -NdbGlobalEventBuffer::unlock() -{ - if (!m_group_lock_flag) - NdbMutex_Unlock(ndb_global_event_buffer_mutex); -} -void -NdbGlobalEventBuffer::add_drop_lock() -{ - NdbMutex_Lock(p_add_drop_mutex); -} -void -NdbGlobalEventBuffer::add_drop_unlock() -{ - NdbMutex_Unlock(p_add_drop_mutex); -} -inline void -NdbGlobalEventBuffer::group_lock() -{ - lock(); - m_group_lock_flag = 1; -} - -inline void -NdbGlobalEventBuffer::group_unlock() -{ - m_group_lock_flag = 0; - unlock(); -} - -void -NdbGlobalEventBuffer::lockB(int bufferId) -{ - NdbMutex_Lock(m_buf[ID(bufferId)].p_buf_mutex); -} -void -NdbGlobalEventBuffer::unlockB(int bufferId) -{ - NdbMutex_Lock(m_buf[ID(bufferId)].p_buf_mutex); -} - -// Private methods - -NdbGlobalEventBuffer::NdbGlobalEventBuffer() : - m_handlers(), - m_group_lock_flag(0), - m_latestGCI(0), - m_no(0) // must start at ZERO! -{ - if ((p_add_drop_mutex = NdbMutex_Create()) == NULL) { - ndbout_c("NdbGlobalEventBuffer: NdbMutex_Create() failed"); - exit(-1); - } -} - -NdbGlobalEventBuffer::~NdbGlobalEventBuffer() -{ - NdbMutex_Destroy(p_add_drop_mutex); - // NdbMem_Deallocate(m_eventBufferIdToEventId); -} -void -NdbGlobalEventBuffer::real_init (NdbGlobalEventBufferHandle *h, - int MAX_NUMBER_ACTIVE_EVENTS) -{ - DBUG_ENTER("NdbGlobalEventBuffer::real_init"); - DBUG_PRINT("enter",("m_handles.size()=%u %u", m_handlers.size(), h)); - if (m_handlers.size() == 0) - { // First init - DBUG_PRINT("info",("first to come")); - m_max = MAX_NUMBER_ACTIVE_EVENTS; - m_buf = new BufItem[m_max]; - for (int i=0; i<m_max; i++) { - m_buf[i].gId= 0; - } - } - assert(m_max == MAX_NUMBER_ACTIVE_EVENTS); - // TODO make sure we don't hit roof - m_handlers.push_back(h); - DBUG_VOID_RETURN; -} -void -NdbGlobalEventBuffer::real_remove(NdbGlobalEventBufferHandle *h) -{ - DBUG_ENTER("NdbGlobalEventBuffer::real_remove"); - DBUG_PRINT("enter",("m_handles.size()=%u %u", m_handlers.size(), h)); - for (Uint32 i=0 ; i < m_handlers.size(); i++) - { - DBUG_PRINT("info",("m_handlers[%u] %u", i, m_handlers[i])); - if (m_handlers[i] == h) - { - m_handlers.erase(i); - if (m_handlers.size() == 0) - { - DBUG_PRINT("info",("last to go")); - delete[] m_buf; - m_buf = NULL; - } - DBUG_VOID_RETURN; - } - } - ndbout_c("NdbGlobalEventBuffer::real_remove() non-existing handle"); - DBUG_PRINT("error",("non-existing handle")); - abort(); - DBUG_VOID_RETURN; -} - -int -NdbGlobalEventBuffer::real_prepareAddSubscribeEvent -(NdbGlobalEventBufferHandle *aHandle, NdbEventOperationImpl *eventOp, - int& hasSubscriber) -{ - DBUG_ENTER("NdbGlobalEventBuffer::real_prepareAddSubscribeEvent"); - int i; - int bufferId= -1; - Uint32 eventId= eventOp->m_eventId; - - DBUG_PRINT("enter",("eventId: %u", eventId)); - // add_drop_lock(); // only one thread can do add or drop at a time - - // Find place where eventId already set - for (i=0; i<m_no; i++) { - if (m_buf[i].gId == eventId) { - bufferId= i; - break; - } - } - if (bufferId < 0) { - // find space for new bufferId - for (i=0; i<m_no; i++) { - if (m_buf[i].gId == 0) { - bufferId= i; // we found an empty spot - goto found_bufferId; - } - } - if (bufferId < 0 && - m_no < m_max) { - // room for more so get that - bufferId= m_no; - m_buf[m_no].gId= 0; - m_no++; - } else { - // add_drop_unlock(); - DBUG_PRINT("error",("Can't accept more subscribers:" - " bufferId=%d, m_no=%d, m_max=%d", - bufferId, m_no, m_max)); - DBUG_RETURN(-1); - } - } -found_bufferId: - - BufItem &b= m_buf[ID(bufferId)]; - - if (b.gId == 0) { // first subscriber needs some initialization - - bufferId= NO_ID(0, bufferId); - - b.gId= eventId; - b.eventType= (Uint32)eventOp->m_eventImpl->mi_type; - - if ((b.p_buf_mutex= NdbMutex_Create()) == NULL) { - ndbout_c("NdbGlobalEventBuffer: NdbMutex_Create() failed"); - abort(); - } - - b.subs= 0; - b.f= 0; - b.sz= 0; - b.max_sz= aHandle->m_bufferL; - b.data= - (BufItem::Data *)NdbMem_Allocate(b.max_sz*sizeof(BufItem::Data)); - for (int i = 0; i < b.max_sz; i++) { - b.data[i].sdata= NULL; - b.data[i].ptr[0].p= NULL; - b.data[i].ptr[1].p= NULL; - b.data[i].ptr[2].p= NULL; - } - } else { - DBUG_PRINT("info", - ("TRYING handle one subscriber per event b.subs=%u",b.subs)); - int ni = -1; - for(int i=0; i < b.subs;i++) { - if (b.ps[i].theHandle == NULL) { - ni = i; - break; - } - } - if (ni < 0) { - if (b.subs < MAX_SUBSCRIBERS_PER_EVENT) { - ni = b.subs; - } else { - DBUG_PRINT("error", - ("Can't accept more subscribers: b.subs=%d",b.subs)); - // add_drop_unlock(); - DBUG_RETURN(-1); - } - } - bufferId = NO_ID(ni, bufferId); - } - - // initialize BufItem::Ps - { - int n = NO(bufferId); - NdbGlobalEventBuffer::BufItem::Ps &e = b.ps[n]; - e.theHandle = aHandle; - e.b=0; - e.bufferempty = 1; - e.overrun=0; // set to -1 to handle first insert - } - - if (b.subs > 0) - hasSubscriber = 1; - else - hasSubscriber = 0; - - DBUG_PRINT("info",("handed out bufferId=%d for eventId=%d hasSubscriber=%d", - bufferId, eventId, hasSubscriber)); - - /* we now have a lock on the prepare so that no one can mess with this - * unlock comes in unprepareAddSubscribeEvent or addSubscribeEvent - */ - DBUG_RETURN(bufferId); -} - -void -NdbGlobalEventBuffer::real_unprepareAddSubscribeEvent(int bufferId) -{ - DBUG_ENTER("NdbGlobalEventBuffer::real_unprepareAddSubscribeEvent"); - BufItem &b = m_buf[ID(bufferId)]; - int n = NO(bufferId); - - DBUG_PRINT("enter", ("bufferId=%d,ID(bufferId)=%d,NO(bufferId)=%d", - bufferId, ID(bufferId), NO(bufferId))); - - b.ps[n].theHandle = NULL; - - // remove subscribers from the end, - // we have to keep gaps since the position - // has been handed out in bufferId - for (int i = b.subs-1; i >= 0; i--) - if (b.ps[i].theHandle == NULL) - b.subs--; - else - break; - - if (b.subs == 0) { - DBUG_PRINT("info",("no more subscribers left on eventId %d", b.gId)); - b.gId= 0; // We don't have any subscribers, reuse BufItem - if (b.data) { - NdbMem_Free((void *)b.data); - b.data = NULL; - } - if (b.p_buf_mutex) { - NdbMutex_Destroy(b.p_buf_mutex); - b.p_buf_mutex = NULL; - } - } - // add_drop_unlock(); - DBUG_VOID_RETURN; -} - -void -NdbGlobalEventBuffer::real_addSubscribeEvent(int bufferId, - void *ndbEventOperation) -{ - DBUG_ENTER("NdbGlobalEventBuffer::real_addSubscribeEvent"); - BufItem &b = m_buf[ID(bufferId)]; - int n = NO(bufferId); - - b.subs++; - b.ps[n].theHandle->addBufferId(bufferId); - - // add_drop_unlock(); - DBUG_PRINT("info",("added bufferId %d", bufferId)); - DBUG_VOID_RETURN; -} - -void -NdbGlobalEventBuffer::real_unprepareDropSubscribeEvent(int bufferId) -{ - // add_drop_unlock(); // only one thread can do add or drop at a time -} - -int -NdbGlobalEventBuffer::real_prepareDropSubscribeEvent(int bufferId, - int& hasSubscriber) -{ - DBUG_ENTER("NdbGlobalEventBuffer::real_prepareDropSubscribeEvent"); - // add_drop_lock(); // only one thread can do add or drop at a time - - BufItem &b = m_buf[ID(bufferId)]; - - int n = 0; - for(int i=0; i < b.subs;i++) { - if (b.ps[i].theHandle != NULL) - n++; - } - - if (n > 1) - hasSubscriber = 1; - else if (n == 1) - hasSubscriber = 0; - else - { - DBUG_RETURN(-1); - } - - DBUG_RETURN(0); -} - -void -NdbGlobalEventBuffer::real_dropSubscribeEvent(int bufferId) -{ - DBUG_ENTER("NdbGlobalEventBuffer::real_dropSubscribeEvent"); - // add_drop_lock(); // only one thread can do add-drop at a time - - BufItem &b = m_buf[ID(bufferId)]; - int n = NO(bufferId); - - b.ps[n].overrun=0; - b.ps[n].bufferempty=1; - b.ps[n].b=0; - b.ps[n].theHandle->dropBufferId(bufferId); - - real_unprepareAddSubscribeEvent(bufferId); // does add_drop_unlock(); - -#ifdef EVENT_DEBUG - ndbout_c("dropSubscribeEvent:: dropped bufferId %d", bufferId); -#endif - DBUG_VOID_RETURN; -} - -void -NdbGlobalEventBuffer::real_latestGCI(int bufferId, Uint32 gci) -{ - if (gci > m_latestGCI) - m_latestGCI = gci; - else if ((m_latestGCI-gci) > 0xffff) // If NDB stays up :-) - m_latestGCI = gci; -} - -Uint32 -NdbGlobalEventBuffer::real_getLatestGCI() -{ - return m_latestGCI; -} - -int -NdbGlobalEventBuffer::real_insertDataL(int bufferId, - const SubTableData * const sdata, - LinearSectionPtr ptr[3]) -{ - DBUG_ENTER("NdbGlobalEventBuffer::real_insertDataL"); - BufItem &b = m_buf[ID(bufferId)]; -#ifdef EVENT_DEBUG - int n = NO(bufferId); -#endif - - if ( b.eventType & (1 << (Uint32)sdata->operation) ) - { - if (b.subs) { -#ifdef EVENT_DEBUG - ndbout_c("data insertion in buffer %d with eventId %d", bufferId, b.gId); -#endif - // move front forward - if (copy_data_alloc(sdata, ptr, - b.data[b.f].sdata, b.data[b.f].ptr)) - { - DBUG_RETURN(-1); - } - for (int i=0; i < b.subs; i++) { - NdbGlobalEventBuffer::BufItem::Ps &e = b.ps[i]; - if (e.theHandle) { // active subscriber - if (b.f == e.b) { // next-to-read == written - if (e.bufferempty == 0) { - e.overrun++; // another item has been overwritten - e.b++; // move next-to-read next since old item was overwritten - if (e.b == b.max_sz) e.b= 0; // start from beginning - } - } - e.bufferempty = 0; - // signal subscriber that there's more to get - NdbCondition_Signal(e.theHandle->p_cond); - } - } - b.f++; // move next-to-write - if (b.f == b.max_sz) b.f = 0; // start from beginning -#ifdef EVENT_DEBUG - ndbout_c("Front= %d Back = %d overun = %d", b.f, - b.ps[n].b, b.ps[n].overrun); -#endif - } else { -#ifdef EVENT_DEBUG - ndbout_c("Data arrived before ready eventId", b.gId); -#endif - } - } - else - { -#ifdef EVENT_DEBUG - ndbout_c("skipped"); -#endif - } - - DBUG_RETURN(0); -} - -int NdbGlobalEventBuffer::hasData(int bufferId) { - DBUG_ENTER("NdbGlobalEventBuffer::hasData"); - BufItem &b = m_buf[ID(bufferId)]; - int n = NO(bufferId); - NdbGlobalEventBuffer::BufItem::Ps &e = b.ps[n]; - - if(e.bufferempty) - { - DBUG_RETURN(0); - } - - if (b.f <= e.b) - { - DBUG_RETURN(b.max_sz-e.b + b.f); - } - else - { - DBUG_RETURN(b.f-e.b); - } -} - -int NdbGlobalEventBuffer::real_getDataL(const int bufferId, - SubTableData * &sdata, - LinearSectionPtr ptr[3], - int *pOverrun) -{ - DBUG_ENTER("NdbGlobalEventBuffer::real_getDataL"); - BufItem &b = m_buf[ID(bufferId)]; - int n = NO(bufferId); - NdbGlobalEventBuffer::BufItem::Ps &e = b.ps[n]; - - if (pOverrun) { - *pOverrun = e.overrun; - e.overrun = 0; // if pOverrun is returned to user reset e.overrun - } - - if (e.bufferempty) - { - DBUG_RETURN(0); // nothing to get - } - - DBUG_PRINT("info",("ID(bufferId) %d NO(bufferId) %d e.b %d", - ID(bufferId), NO(bufferId), e.b)); - - if (copy_data_alloc(b.data[e.b].sdata, b.data[e.b].ptr, - sdata, ptr)) - { - DBUG_RETURN(-1); - } - - e.b++; if (e.b == b.max_sz) e.b= 0; // move next-to-read forward - - if (b.f == e.b) // back has cought up with front - e.bufferempty = 1; - -#ifdef EVENT_DEBUG - ndbout_c("getting data from buffer %d with eventId %d", bufferId, b.gId); -#endif - - DBUG_RETURN(hasData(bufferId)+1); -} -int -NdbGlobalEventBuffer::copy_data_alloc(const SubTableData * const f_sdata, - LinearSectionPtr f_ptr[3], - SubTableData * &t_sdata, - LinearSectionPtr t_ptr[3]) -{ - DBUG_ENTER("NdbGlobalEventBuffer::copy_data_alloc"); - unsigned sz4= (sizeof(SubTableData)+3)>>2; - Uint32 *ptr= (Uint32*)NdbMem_Allocate((sz4 + - f_ptr[0].sz + - f_ptr[1].sz + - f_ptr[2].sz) * sizeof(Uint32)); - if (t_sdata) - NdbMem_Free((char*)t_sdata); - t_sdata= (SubTableData *)ptr; - memcpy(t_sdata,f_sdata,sizeof(SubTableData)); - ptr+= sz4; - - for (int i = 0; i < 3; i++) { - LinearSectionPtr & f_p = f_ptr[i]; - LinearSectionPtr & t_p = t_ptr[i]; - if (f_p.sz > 0) { - t_p.p= (Uint32 *)ptr; - memcpy(t_p.p, f_p.p, sizeof(Uint32)*f_p.sz); - ptr+= f_p.sz; - t_p.sz= f_p.sz; - } else { - t_p.p= NULL; - t_p.sz= 0; - } - } - DBUG_RETURN(0); -} -int -NdbGlobalEventBuffer::real_wait(NdbGlobalEventBufferHandle *h, - int aMillisecondNumber) -{ - DBUG_ENTER("NdbGlobalEventBuffer::real_wait"); - // check if there are anything in any of the buffers - int i; - int n = 0; - for (i = 0; i < h->m_nids; i++) - n += hasData(h->m_bufferIds[i]); - if (n) - { - DBUG_RETURN(n); - } - - int r = NdbCondition_WaitTimeout(h->p_cond, ndb_global_event_buffer_mutex, - aMillisecondNumber); - if (r > 0) - { - DBUG_RETURN(-1); - } - - n = 0; - for (i = 0; i < h->m_nids; i++) - n += hasData(h->m_bufferIds[i]); - DBUG_RETURN(n); -} - -template class Vector<NdbGlobalEventBufferHandle*>; diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.hpp b/ndb/src/ndbapi/NdbEventOperationImpl.hpp deleted file mode 100644 index 96958979c76..00000000000 --- a/ndb/src/ndbapi/NdbEventOperationImpl.hpp +++ /dev/null @@ -1,204 +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 NdbEventOperationImpl_H -#define NdbEventOperationImpl_H - -#include <NdbEventOperation.hpp> -#include <signaldata/SumaImpl.hpp> -#include <transporter/TransporterDefinitions.hpp> - -class NdbGlobalEventBufferHandle; -class NdbEventOperationImpl : public NdbEventOperation { -public: - NdbEventOperationImpl(NdbEventOperation &N, - Ndb *theNdb, - const char* eventName, - const int bufferLength); - ~NdbEventOperationImpl(); - - NdbEventOperation::State getState(); - - int execute(); - int stop(); - NdbRecAttr *getValue(const char *colName, char *aValue, int n); - NdbRecAttr *getValue(const NdbColumnImpl *, char *aValue, int n); - static int wait(void *p, int aMillisecondNumber); - int next(int *pOverrun); - bool isConsistent(); - Uint32 getGCI(); - Uint32 getLatestGCI(); - - NdbDictionary::Event::TableEvent getEventType(); - - /* - getOperation(); - getGCI(); - getLogType(); - */ - - void print(); - void printAll(); - - const NdbError & getNdbError() const; - NdbError m_error; - - Ndb *m_ndb; - NdbEventImpl *m_eventImpl; - NdbGlobalEventBufferHandle *m_bufferHandle; - - NdbRecAttr *theFirstPkAttrs[2]; - NdbRecAttr *theCurrentPkAttrs[2]; - NdbRecAttr *theFirstDataAttrs[2]; - NdbRecAttr *theCurrentDataAttrs[2]; - - NdbEventOperation::State m_state; - Uint32 m_eventId; - int m_bufferId; - int m_bufferL; - SubTableData *sdata; - LinearSectionPtr ptr[3]; -}; - -class NdbGlobalEventBuffer; -class NdbGlobalEventBufferHandle { -public: - NdbGlobalEventBufferHandle (int MAX_NUMBER_ACTIVE_EVENTS); - ~NdbGlobalEventBufferHandle (); - //static NdbGlobalEventBufferHandle *init(int MAX_NUMBER_ACTIVE_EVENTS); - - // returns bufferId 0-N if ok otherwise -1 - int prepareAddSubscribeEvent(NdbEventOperationImpl *, int& hasSubscriber); - void unprepareAddSubscribeEvent(int bufferId); - void addSubscribeEvent(int bufferId, - NdbEventOperationImpl *ndbEventOperationImpl); - - void unprepareDropSubscribeEvent(int bufferId); - int prepareDropSubscribeEvent(int bufferId, int& hasSubscriber); - void dropSubscribeEvent(int bufferId); - - static int getDataL(const int bufferId, - SubTableData * &sdata, - LinearSectionPtr ptr[3], - int *pOverrun); - static int insertDataL(int bufferId, - const SubTableData * const sdata, - LinearSectionPtr ptr[3]); - static void latestGCI(int bufferId, Uint32 gci); - static Uint32 getLatestGCI(); - static Uint32 getEventId(int bufferId); - - void group_lock(); - void group_unlock(); - int wait(int aMillisecondNumber); - int m_bufferL; -private: - friend class NdbGlobalEventBuffer; - void addBufferId(int bufferId); - void dropBufferId(int bufferId); - - struct NdbCondition *p_cond; - int m_nids; - int m_bufferIds[NDB_MAX_ACTIVE_EVENTS]; -}; - -class NdbGlobalEventBuffer { -private: - friend class NdbGlobalEventBufferHandle; - void lockB(int bufferId); - void unlockB(int bufferId); - void group_lock(); - void group_unlock(); - void lock(); - void unlock(); - void add_drop_lock(); - void add_drop_unlock(); - - NdbGlobalEventBuffer(); - ~NdbGlobalEventBuffer(); - - void real_remove(NdbGlobalEventBufferHandle *h); - void real_init(NdbGlobalEventBufferHandle *h, - int MAX_NUMBER_ACTIVE_EVENTS); - - int real_prepareAddSubscribeEvent(NdbGlobalEventBufferHandle *h, - NdbEventOperationImpl *, - int& hasSubscriber); - void real_unprepareAddSubscribeEvent(int bufferId); - void real_addSubscribeEvent(int bufferId, void *ndbEventOperation); - - void real_unprepareDropSubscribeEvent(int bufferId); - int real_prepareDropSubscribeEvent(int bufferId, - int& hasSubscriber); - void real_dropSubscribeEvent(int bufferId); - - int real_getDataL(const int bufferId, - SubTableData * &sdata, - LinearSectionPtr ptr[3], - int *pOverrun); - int real_insertDataL(int bufferId, - const SubTableData * const sdata, - LinearSectionPtr ptr[3]); - void real_latestGCI(int bufferId, Uint32 gci); - Uint32 real_getLatestGCI(); - int copy_data_alloc(const SubTableData * const f_sdata, - LinearSectionPtr f_ptr[3], - SubTableData * &t_sdata, - LinearSectionPtr t_ptr[3]); - - int real_wait(NdbGlobalEventBufferHandle *, int aMillisecondNumber); - int hasData(int bufferId); - int ID (int bufferId) {return bufferId & 0xFF;}; - int NO (int bufferId) {return bufferId >> 16;}; - int NO_ID (int n, int bufferId) {return (n << 16) | ID(bufferId);}; - - Vector<NdbGlobalEventBufferHandle*> m_handlers; - - // Global Mutex used for some things - NdbMutex *p_add_drop_mutex; - - int m_group_lock_flag; - Uint32 m_latestGCI; - - int m_no; - int m_max; -#define MAX_SUBSCRIBERS_PER_EVENT 16 - struct BufItem { - // local mutex for each event/buffer - NdbMutex *p_buf_mutex; - Uint32 gId; - Uint32 eventType; - struct Data { - SubTableData *sdata; - LinearSectionPtr ptr[3]; - } * data; - - struct Ps { - NdbGlobalEventBufferHandle *theHandle; - int b; - int overrun; - int bufferempty; - //void *ndbEventOperation; - } ps[MAX_SUBSCRIBERS_PER_EVENT]; // only supports 1 subscriber so far - - int subs; - int f; - int sz; - int max_sz; - }; - BufItem *m_buf; -}; -#endif diff --git a/ndb/src/ndbapi/NdbImpl.hpp b/ndb/src/ndbapi/NdbImpl.hpp deleted file mode 100644 index d649b39c5eb..00000000000 --- a/ndb/src/ndbapi/NdbImpl.hpp +++ /dev/null @@ -1,136 +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 NDB_IMPL_HPP -#define NDB_IMPL_HPP - -#include <ndb_global.h> -#include <Ndb.hpp> -#include <NdbOut.hpp> -#include <NdbError.hpp> -#include <NdbCondition.h> -#include <NdbReceiver.hpp> -#include <NdbOperation.hpp> -#include <kernel/ndb_limits.h> - -#include <NdbTick.h> - -#include "ndb_cluster_connection_impl.hpp" -#include "NdbDictionaryImpl.hpp" -#include "ObjectMap.hpp" - -/** - * Private parts of the Ndb object (corresponding to Ndb.hpp in public API) - */ -class NdbImpl { -public: - NdbImpl(Ndb_cluster_connection *, Ndb&); - ~NdbImpl(); - - Ndb_cluster_connection_impl &m_ndb_cluster_connection; - - NdbDictionaryImpl m_dictionary; - - // Ensure good distribution of connects - Uint32 theCurrentConnectIndex; - Ndb_cluster_connection_node_iter m_node_iter; - - NdbObjectIdMap theNdbObjectIdMap; - - Uint32 theNoOfDBnodes; // The number of DB nodes - Uint8 theDBnodes[MAX_NDB_NODES]; // The node number of the DB nodes - - // 1 indicates to release all connections to node - Uint32 the_release_ind[MAX_NDB_NODES]; - - NdbWaiter theWaiter; - - int m_optimized_node_selection; -}; - -#ifdef VM_TRACE -#define TRACE_DEBUG(x) ndbout << x << endl; -#else -#define TRACE_DEBUG(x) -#endif - -#define CHECK_STATUS_MACRO \ - {if (checkInitState() == -1) { theError.code = 4100; return -1;}} -#define CHECK_STATUS_MACRO_VOID \ - {if (checkInitState() == -1) { theError.code = 4100; return;}} -#define CHECK_STATUS_MACRO_ZERO \ - {if (checkInitState() == -1) { theError.code = 4100; return 0;}} -#define CHECK_STATUS_MACRO_NULL \ - {if (checkInitState() == -1) { theError.code = 4100; return NULL;}} - -inline -void * -Ndb::int2void(Uint32 val){ - return theImpl->theNdbObjectIdMap.getObject(val); -} - -inline -NdbReceiver * -Ndb::void2rec(void* val){ - return (NdbReceiver*)val; -} - -inline -NdbTransaction * -Ndb::void2con(void* val){ - return (NdbTransaction*)val; -} - -inline -NdbOperation* -Ndb::void2rec_op(void* val){ - return (NdbOperation*)(void2rec(val)->getOwner()); -} - -inline -NdbIndexOperation* -Ndb::void2rec_iop(void* val){ - return (NdbIndexOperation*)(void2rec(val)->getOwner()); -} - -inline -NdbTransaction * -NdbReceiver::getTransaction(){ - return ((NdbOperation*)m_owner)->theNdbCon; -} - - -inline -int -Ndb::checkInitState() -{ - theError.code = 0; - - if (theInitState != Initialised) - return -1; - return 0; -} - -Uint32 convertEndian(Uint32 Data); - -enum LockMode { - Read, - Update, - Insert, - Delete -}; - -#endif diff --git a/ndb/src/ndbapi/NdbIndexOperation.cpp b/ndb/src/ndbapi/NdbIndexOperation.cpp deleted file mode 100644 index 4cedffed4a2..00000000000 --- a/ndb/src/ndbapi/NdbIndexOperation.cpp +++ /dev/null @@ -1,412 +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 */ - -#include <ndb_global.h> -#include <NdbIndexOperation.hpp> -#include <Ndb.hpp> -#include <NdbTransaction.hpp> -#include "NdbApiSignal.hpp" -#include <AttributeHeader.hpp> -#include <signaldata/TcIndx.hpp> -#include <signaldata/TcKeyReq.hpp> -#include <signaldata/IndxKeyInfo.hpp> -#include <signaldata/IndxAttrInfo.hpp> - -NdbIndexOperation::NdbIndexOperation(Ndb* aNdb) : - NdbOperation(aNdb), - m_theIndex(NULL) -{ - m_tcReqGSN = GSN_TCINDXREQ; - m_attrInfoGSN = GSN_INDXATTRINFO; - m_keyInfoGSN = GSN_INDXKEYINFO; - - /** - * Change receiver type - */ - theReceiver.init(NdbReceiver::NDB_INDEX_OPERATION, this); -} - -NdbIndexOperation::~NdbIndexOperation() -{ -} - -/***************************************************************************** - * int indxInit(); - * - * Return Value: Return 0 : init was successful. - * Return -1: In all other case. - * Remark: Initiates operation record after allocation. - *****************************************************************************/ -int -NdbIndexOperation::indxInit(const NdbIndexImpl * anIndex, - const NdbTableImpl * aTable, - NdbTransaction* myConnection) -{ - NdbOperation::init(aTable, myConnection); - - switch (anIndex->m_type) { - case(NdbDictionary::Index::UniqueHashIndex): - break; - case(NdbDictionary::Index::Undefined): - case(NdbDictionary::Index::OrderedIndex): - setErrorCodeAbort(4003); - return -1; - } - m_theIndex = anIndex; - m_accessTable = anIndex->m_table; - theNoOfTupKeyLeft = m_accessTable->getNoOfPrimaryKeys(); - return 0; -} - -int NdbIndexOperation::readTuple(NdbOperation::LockMode lm) -{ - switch(lm) { - case LM_Read: - return readTuple(); - break; - case LM_Exclusive: - return readTupleExclusive(); - break; - case LM_CommittedRead: - return readTuple(); - break; - default: - return -1; - }; -} - -int NdbIndexOperation::insertTuple() -{ - setErrorCode(4200); - return -1; -} - -int NdbIndexOperation::readTuple() -{ - // First check that index is unique - - return NdbOperation::readTuple(); -} - -int NdbIndexOperation::readTupleExclusive() -{ - // First check that index is unique - - return NdbOperation::readTupleExclusive(); -} - -int NdbIndexOperation::simpleRead() -{ - // First check that index is unique - - return NdbOperation::readTuple(); -} - -int NdbIndexOperation::dirtyRead() -{ - // First check that index is unique - - return NdbOperation::readTuple(); -} - -int NdbIndexOperation::committedRead() -{ - // First check that index is unique - - return NdbOperation::readTuple(); -} - -int NdbIndexOperation::updateTuple() -{ - // First check that index is unique - - return NdbOperation::updateTuple(); -} - -int NdbIndexOperation::deleteTuple() -{ - // First check that index is unique - - return NdbOperation::deleteTuple(); -} - -int NdbIndexOperation::dirtyUpdate() -{ - // First check that index is unique - - return NdbOperation::dirtyUpdate(); -} - -int NdbIndexOperation::interpretedUpdateTuple() -{ - // First check that index is unique - - return NdbOperation::interpretedUpdateTuple(); -} - -int NdbIndexOperation::interpretedDeleteTuple() -{ - // First check that index is unique - - return NdbOperation::interpretedDeleteTuple(); -} - -int -NdbIndexOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransactionId) -{ - Uint32 tTransId1, tTransId2; - Uint32 tReqInfo; - Uint32 tSignalCount = 0; - Uint32 tInterpretInd = theInterpretIndicator; - - theErrorLine = 0; - - if (tInterpretInd != 1) { - OperationType tOpType = theOperationType; - OperationStatus tStatus = theStatus; - if ((tOpType == UpdateRequest) || - (tOpType == InsertRequest) || - (tOpType == WriteRequest)) { - if (tStatus != SetValue) { - setErrorCodeAbort(4506); - return -1; - }//if - } else if ((tOpType == ReadRequest) || (tOpType == ReadExclusive) || - (tOpType == DeleteRequest)) { - if (tStatus != GetValue) { - setErrorCodeAbort(4506); - return -1; - }//if - } else { - setErrorCodeAbort(4507); - return -1; - }//if - } else { - if (prepareSendInterpreted() == -1) { - return -1; - }//if - }//if - -//------------------------------------------------------------- -// We start by filling in the first 8 unconditional words of the -// TCINDXREQ signal. -//------------------------------------------------------------- - TcKeyReq * tcKeyReq = - CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend()); - - Uint32 tTotalCurrAI_Len = theTotalCurrAI_Len; - Uint32 tIndexId = m_theIndex->m_indexId; - Uint32 tSchemaVersion = m_theIndex->m_version; - - tcKeyReq->apiConnectPtr = aTC_ConnectPtr; - tcKeyReq->senderData = ptr2int(); - tcKeyReq->attrLen = tTotalCurrAI_Len; - tcKeyReq->tableId = tIndexId; - tcKeyReq->tableSchemaVersion = tSchemaVersion; - - tTransId1 = (Uint32) aTransactionId; - tTransId2 = (Uint32) (aTransactionId >> 32); - -//------------------------------------------------------------- -// Simple is simple if simple or both start and commit is set. -//------------------------------------------------------------- -// Temporarily disable simple stuff - Uint8 tSimpleIndicator = 0; -// Uint8 tSimpleIndicator = theSimpleIndicator; - Uint8 tCommitIndicator = theCommitIndicator; - Uint8 tStartIndicator = theStartIndicator; -// if ((theNdbCon->theLastOpInList == this) && (theCommitIndicator == 0)) -// abort(); -// Temporarily disable simple stuff - Uint8 tSimpleAlt = 0; -// Uint8 tSimpleAlt = tStartIndicator & tCommitIndicator; - tSimpleIndicator = tSimpleIndicator | tSimpleAlt; - -//------------------------------------------------------------- -// Simple state is set if start and commit is set and it is -// a read request. Otherwise it is set to zero. -//------------------------------------------------------------- - Uint8 tReadInd = (theOperationType == ReadRequest); - Uint8 tSimpleState = tReadInd & tSimpleAlt; - //theNdbCon->theSimpleState = tSimpleState; - - tcKeyReq->transId1 = tTransId1; - tcKeyReq->transId2 = tTransId2; - - tReqInfo = 0; - - if (tTotalCurrAI_Len <= TcKeyReq::MaxAttrInfo) { - tcKeyReq->setAIInTcKeyReq(tReqInfo, tTotalCurrAI_Len); - } else { - tcKeyReq->setAIInTcKeyReq(tReqInfo, TcKeyReq::MaxAttrInfo); - }//if - - tcKeyReq->setSimpleFlag(tReqInfo, tSimpleIndicator); - tcKeyReq->setCommitFlag(tReqInfo, tCommitIndicator); - tcKeyReq->setStartFlag(tReqInfo, tStartIndicator); - const Uint8 tInterpretIndicator = theInterpretIndicator; - tcKeyReq->setInterpretedFlag(tReqInfo, tInterpretIndicator); - - Uint8 tDirtyIndicator = theDirtyIndicator; - OperationType tOperationType = theOperationType; - Uint32 tIndexLen = theTupKeyLen; - Uint8 abortOption = theNdbCon->m_abortOption; - - tcKeyReq->setDirtyFlag(tReqInfo, tDirtyIndicator); - tcKeyReq->setOperationType(tReqInfo, tOperationType); - tcKeyReq->setKeyLength(tReqInfo, tIndexLen); - tcKeyReq->setAbortOption(tReqInfo, abortOption); - - Uint8 tDistrKeyIndicator = theDistrKeyIndicator_; - Uint8 tScanIndicator = theScanInfo & 1; - - tcKeyReq->setDistributionKeyFlag(tReqInfo, tDistrKeyIndicator); - tcKeyReq->setScanIndFlag(tReqInfo, tScanIndicator); - - tcKeyReq->requestInfo = tReqInfo; - -//------------------------------------------------------------- -// The next step is to fill in the upto three conditional words. -//------------------------------------------------------------- - Uint32* tOptionalDataPtr = &tcKeyReq->scanInfo; - Uint32 tDistrGHIndex = tScanIndicator; - Uint32 tDistrKeyIndex = tDistrGHIndex; - - Uint32 tScanInfo = theScanInfo; - Uint32 tDistrKey = theDistributionKey; - - tOptionalDataPtr[0] = tScanInfo; - tOptionalDataPtr[tDistrKeyIndex] = tDistrKey; - -//------------------------------------------------------------- -// The next is step is to compress the key data part of the -// TCKEYREQ signal. -//------------------------------------------------------------- - Uint32 tKeyIndex = tDistrKeyIndex + tDistrKeyIndicator; - Uint32* tKeyDataPtr = &tOptionalDataPtr[tKeyIndex]; - Uint32 Tdata1 = tcKeyReq->keyInfo[0]; - Uint32 Tdata2 = tcKeyReq->keyInfo[1]; - Uint32 Tdata3 = tcKeyReq->keyInfo[2]; - Uint32 Tdata4 = tcKeyReq->keyInfo[3]; - Uint32 Tdata5; - - tKeyDataPtr[0] = Tdata1; - tKeyDataPtr[1] = Tdata2; - tKeyDataPtr[2] = Tdata3; - tKeyDataPtr[3] = Tdata4; - if (tIndexLen > 4) { - Tdata1 = tcKeyReq->keyInfo[4]; - Tdata2 = tcKeyReq->keyInfo[5]; - Tdata3 = tcKeyReq->keyInfo[6]; - Tdata4 = tcKeyReq->keyInfo[7]; - - tKeyDataPtr[4] = Tdata1; - tKeyDataPtr[5] = Tdata2; - tKeyDataPtr[6] = Tdata3; - tKeyDataPtr[7] = Tdata4; - }//if -//------------------------------------------------------------- -// Finally we also compress the INDXATTRINFO part of the signal. -// We optimise by using the if-statement for sending INDXKEYINFO -// signals to calculating the new Attrinfo Index. -//------------------------------------------------------------- - Uint32 tAttrInfoIndex; - - if (tIndexLen > TcKeyReq::MaxKeyInfo) { - /** - * Set transid and TC connect ptr in the INDXKEYINFO signals - */ - NdbApiSignal* tSignal = theTCREQ->next(); - Uint32 remainingKey = tIndexLen - TcKeyReq::MaxKeyInfo; - - do { - Uint32* tSigDataPtr = tSignal->getDataPtrSend(); - NdbApiSignal* tnextSignal = tSignal->next(); - tSignalCount++; - tSigDataPtr[0] = aTC_ConnectPtr; - tSigDataPtr[1] = tTransId1; - tSigDataPtr[2] = tTransId2; - if (remainingKey > IndxKeyInfo::DataLength) { - // The signal is full - tSignal->setLength(IndxKeyInfo::MaxSignalLength); - remainingKey -= IndxKeyInfo::DataLength; - } - else { - // Last signal - tSignal->setLength(IndxKeyInfo::HeaderLength + remainingKey); - remainingKey = 0; - } - tSignal = tnextSignal; - } while (tSignal != NULL); - tAttrInfoIndex = tKeyIndex + TcKeyReq::MaxKeyInfo; - } else { - tAttrInfoIndex = tKeyIndex + tIndexLen; - }//if - -//------------------------------------------------------------- -// Perform the Attrinfo packing in the TCKEYREQ signal started -// above. -//------------------------------------------------------------- - Uint32* tAIDataPtr = &tOptionalDataPtr[tAttrInfoIndex]; - Tdata1 = tcKeyReq->attrInfo[0]; - Tdata2 = tcKeyReq->attrInfo[1]; - Tdata3 = tcKeyReq->attrInfo[2]; - Tdata4 = tcKeyReq->attrInfo[3]; - Tdata5 = tcKeyReq->attrInfo[4]; - - theTCREQ->setLength(tcKeyReq->getAIInTcKeyReq(tReqInfo) + - tAttrInfoIndex + TcKeyReq::StaticLength); - tAIDataPtr[0] = Tdata1; - tAIDataPtr[1] = Tdata2; - tAIDataPtr[2] = Tdata3; - tAIDataPtr[3] = Tdata4; - tAIDataPtr[4] = Tdata5; - -/*************************************************** -* Send the INDXATTRINFO signals. -***************************************************/ - if (tTotalCurrAI_Len > 5) { - // Set the last signal's length. - NdbApiSignal* tSignal = theFirstATTRINFO; - theCurrentATTRINFO->setLength(theAI_LenInCurrAI); - do { - Uint32* tSigDataPtr = tSignal->getDataPtrSend(); - NdbApiSignal* tnextSignal = tSignal->next(); - tSignalCount++; - tSigDataPtr[0] = aTC_ConnectPtr; - tSigDataPtr[1] = tTransId1; - tSigDataPtr[2] = tTransId2; - tSignal = tnextSignal; - } while (tSignal != NULL); - }//if - theStatus = WaitResponse; - theReceiver.prepareSend(); - return 0; -} - -/*************************************************************************** -int receiveTCINDXREF( NdbApiSignal* aSignal) - -Return Value: Return 0 : send was succesful. - Return -1: In all other case. -Parameters: aSignal: the signal object that contains the TCINDXREF signal from TC. -Remark: Handles the reception of the TCKEYREF signal. -***************************************************************************/ -int -NdbIndexOperation::receiveTCINDXREF( NdbApiSignal* aSignal) -{ - return receiveTCKEYREF(aSignal); -}//NdbIndexOperation::receiveTCINDXREF() diff --git a/ndb/src/ndbapi/NdbLinHash.hpp b/ndb/src/ndbapi/NdbLinHash.hpp deleted file mode 100644 index f245a261a04..00000000000 --- a/ndb/src/ndbapi/NdbLinHash.hpp +++ /dev/null @@ -1,447 +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 NdbLinHash_H -#define NdbLinHash_H - -#include <ndb_types.h> - -#define SEGMENTSIZE 64 -#define SEGMENTLOGSIZE 6 -#define DIRECTORYSIZE 64 -#define DIRINDEX(adress) ((adress) >> SEGMENTLOGSIZE) -#define SEGINDEX(adress) ((adress) & (SEGMENTSIZE-1)) - -#if !defined(MAXLOADFCTR) -#define MAXLOADFCTR 2 -#endif -#if !defined(MINLOADFCTR) -#define MINLOADFCTR (MAXLOADFCTR/2) -#endif - -template<class C> -class NdbElement_t { -public: - NdbElement_t(); - ~NdbElement_t(); - - Uint32 len; - Uint32 hash; - Uint32 localkey1; - Uint32 *str; - NdbElement_t<C> *next; - C* theData; -private: - NdbElement_t(const NdbElement_t<C> & aElement_t); - NdbElement_t & operator = (const NdbElement_t<C> & aElement_t); -}; - - -template <class C> -class NdbLinHash { -public: - NdbLinHash(); - ~NdbLinHash(); - void createHashTable(void); - void releaseHashTable(void); - - int insertKey(const char * str, Uint32 len, Uint32 lkey1, C* data); - C *deleteKey(const char * str, Uint32 len); - - C* getData(const char *, Uint32); - Uint32* getKey(const char *, Uint32); - - void shrinkTable(void); - void expandHashTable(void); - - Uint32 Hash(const char *str, Uint32 len); - Uint32 Hash(Uint32 h); - - NdbElement_t<C> * getNext(NdbElement_t<C> * curr); - -private: - void getBucket(Uint32 hash, int * dirindex, int * segindex); - - struct Segment_t { - NdbElement_t<C> * elements[SEGMENTSIZE]; - }; - - Uint32 p; /*bucket to be split*/ - Uint32 max; /*max is the upper bound*/ - Int32 slack; /*number of insertions before splits*/ - Segment_t * directory[DIRECTORYSIZE]; - - NdbLinHash(const NdbLinHash<C> & aLinHash); - NdbLinHash<C> & operator = (const NdbLinHash<C> & aLinHash); -}; - -// All template methods must be inline - -template <class C> -inline -NdbLinHash<C>::NdbLinHash() { -} - -template <class C> -inline -NdbLinHash<C>::NdbLinHash(const NdbLinHash<C>& aLinHash) -{ -} - -template <class C> -inline -NdbLinHash<C>::~NdbLinHash() -{ -} - -template <class C> -inline -Uint32 -NdbLinHash<C>::Hash( const char* str, Uint32 len ) -{ - Uint32 h = 0; - while(len >= 4){ - h = (h << 5) + h + str[0]; - h = (h << 5) + h + str[1]; - h = (h << 5) + h + str[2]; - h = (h << 5) + h + str[3]; - len -= 4; - str += 4; - } - - while(len > 0){ - h = (h << 5) + h + *str++; - len--; - } - return h; -} - -template <class C> -inline -Uint32 -NdbLinHash<C>::Hash( Uint32 h ){ - return h; -} - -template <class C> -inline -NdbElement_t<C>::NdbElement_t() : - len(0), - hash(0), - localkey1(0), - str(NULL), - next(NULL), - theData(NULL) -{ -} - -template <class C> -inline -NdbElement_t<C>::~NdbElement_t() -{ - delete []str; -} - - -/* Initialize the hashtable HASH_T */ -template <class C> -inline -void -NdbLinHash<C>::createHashTable() { - p = 0; - max = SEGMENTSIZE - 1; - slack = SEGMENTSIZE * MAXLOADFCTR; - directory[0] = new Segment_t(); - int i; - - /* The first segment cleared before used */ - for(i = 0; i < SEGMENTSIZE; i++ ) - directory[0]->elements[i] = 0; - - /* clear the rest of the directory */ - for(i = 1; i < DIRECTORYSIZE; i++) - directory[i] = 0; -} - -template <class C> -inline -void -NdbLinHash<C>::getBucket(Uint32 hash, int * dir, int * seg){ - Uint32 adress = hash & max; - if(adress < p) - adress = hash & (2 * max + 1); - - * dir = DIRINDEX(adress); - * seg = SEGINDEX(adress); -} - -template <class C> -inline -Int32 -NdbLinHash<C>::insertKey( const char* str, Uint32 len, Uint32 lkey1, C* data ) -{ - const Uint32 hash = Hash(str, len); - int dir, seg; - getBucket(hash, &dir, &seg); - - NdbElement_t<C> **chainp = &directory[dir]->elements[seg]; - - /** - * Check if the string already are in the hash table - * chain=chainp will copy the contents of HASH_T into chain - */ - NdbElement_t<C> * oldChain = 0; - NdbElement_t<C> * chain; - for(chain = *chainp; chain != 0; chain = chain->next){ - if(chain->len == len && !memcmp(chain->str, str, len)) - return -1; /* Element already exists */ - else - oldChain = chain; - } - - /* New entry */ - chain = new NdbElement_t<C>(); - chain->len = len; - chain->hash = hash; - chain->localkey1 = lkey1; - chain->next = 0; - chain->theData = data; - chain->str = new Uint32[((len + 3) >> 2)]; - memcpy( &chain->str[0], str, len ); - if (oldChain != 0) - oldChain->next = chain; - else - *chainp = chain; - -#if 0 - if(--(slack) < 0) - expandHashTable(); -#endif - - return chain->localkey1; -} - - -template <class C> -inline -Uint32* -NdbLinHash<C>::getKey( const char* str, Uint32 len ) -{ - const Uint32 tHash = Hash(str, len); - int dir, seg; - getBucket(tHash, &dir, &seg); - - NdbElement_t<C> ** keyp = &directory[dir]->elements[seg]; - - /*Check if the string are in the hash table*/ - for(NdbElement_t<C> * key = *keyp; key != 0; key = key->next ) { - if(key->len == len && !memcmp(key->str, str, len)) { - return &key->localkey1; - } - } - return NULL ; /* The key was not found */ -} - -template <class C> -inline -C* -NdbLinHash<C>::getData( const char* str, Uint32 len ){ - - const Uint32 tHash = Hash(str, len); - int dir, seg; - getBucket(tHash, &dir, &seg); - - NdbElement_t<C> ** keyp = &directory[dir]->elements[seg]; - - /*Check if the string are in the hash table*/ - for(NdbElement_t<C> * key = *keyp; key != 0; key = key->next ) { - if(key->len == len && !memcmp(key->str, str, len)) { - return key->theData; - } - } - return NULL ; /* The key was not found */ -} - -template <class C> -inline -C * -NdbLinHash<C>::deleteKey ( const char* str, Uint32 len){ - const Uint32 hash = Hash(str, len); - int dir, seg; - getBucket(hash, &dir, &seg); - - NdbElement_t<C> *oldChain = 0; - NdbElement_t<C> **chainp = &directory[dir]->elements[seg]; - for(NdbElement_t<C> * chain = *chainp; chain != 0; chain = chain->next){ - if(chain->len == len && !memcmp(chain->str, str, len)){ - C *data= chain->theData; - if (oldChain == 0) { - * chainp = chain->next; - } else { - oldChain->next = chain->next; - } - delete chain; - return data; - } else { - oldChain = chain; - } - } - return 0; /* Element doesn't exist */ -} - -template <class C> -inline -void -NdbLinHash<C>::releaseHashTable( void ){ - NdbElement_t<C>* tNextElement; - NdbElement_t<C>* tElement; - - //Traverse the whole directory structure - for(int countd = 0; countd < DIRECTORYSIZE;countd++ ){ - if (directory[countd] != 0) { - //Traverse whole hashtable - for(int counts = 0; counts < SEGMENTSIZE; counts++ ) - if (directory[countd]->elements[counts] != 0) { - tElement = directory[countd]->elements[counts]; - //Delete all elements even those who is linked - do { - tNextElement = tElement->next; - delete tElement; - tElement = tNextElement; - } while (tNextElement != 0); - } - delete directory[countd]; - } - } -} - -template <class C> -inline -void -NdbLinHash<C>::shrinkTable( void ) -{ - Segment_t *lastseg; - NdbElement_t<C> **chainp; - Uint32 oldlast = p + max; - - if( oldlast == 0 ) - return; - - // Adjust the state variables. - if( p == 0 ) { - max >>= 1; - p = max; - } - else - --(p); - - // Update slack after shrink. - - slack -= MAXLOADFCTR; - - // Insert the chain oldlast at the end of chain p. - - chainp = &directory[DIRINDEX(p)]->elements[SEGINDEX(p)]; - while( *chainp != 0 ) { - chainp = &((*chainp)->next); - lastseg = directory[DIRINDEX(oldlast)]; - *chainp = lastseg->elements[SEGINDEX(oldlast)]; - - // If necessary free last segment. - if( SEGINDEX(oldlast) == 0) - delete lastseg; - } -} - -template <class C> -inline -void -NdbLinHash<C>::expandHashTable( void ) -{ - - NdbElement_t<C> **oldbucketp, *chain, *headofold, *headofnew, *next; - Uint32 maxp = max + 1; - Uint32 newadress = maxp + p; - - - // Still room in the adress space? - if( newadress >= DIRECTORYSIZE * SEGMENTSIZE ) { - return; - } - - // If necessary, create a new segment. - if( SEGINDEX(newadress) == 0 ) - directory[DIRINDEX(newadress)] = new Segment_t(); - - // Locate the old (to be split) bucket. - oldbucketp = &directory[DIRINDEX(p)]->elements[SEGINDEX(p)]; - - // Adjust the state variables. - p++; - if( p > max ) { - max = 2 *max + 1; - p = 0; - } - - // Update slack after expandation. - slack += MAXLOADFCTR; - - // Relocate records to the new bucket. - headofold = 0; - headofnew = 0; - - for( chain = *oldbucketp; chain != 0; chain = next ) { - next = chain->next; - if( chain->hash & maxp ) { - chain->next = headofnew; - headofnew = chain; - } - else { - chain->next = headofold; - headofold = chain; - } - } - *oldbucketp = headofold; - directory[DIRINDEX(newadress)]->elements[SEGINDEX(newadress)] = headofnew; -} - -template <class C> -inline -NdbElement_t<C> * -NdbLinHash<C>::getNext(NdbElement_t<C> * curr){ - if(curr != 0 && curr->next != 0) - return curr->next; - - int dir = 0, seg = 0; - - if(curr != 0){ - getBucket(curr->hash, &dir, &seg); - } - - for(int countd = dir; countd < DIRECTORYSIZE;countd++ ){ - if (directory[countd] != 0) { - for(int counts = seg + 1; counts < SEGMENTSIZE; counts++ ){ - if (directory[countd]->elements[counts] != 0) { - return directory[countd]->elements[counts]; - } - } - } - } - - return 0; -} - -#endif diff --git a/ndb/src/ndbapi/NdbOperation.cpp b/ndb/src/ndbapi/NdbOperation.cpp deleted file mode 100644 index c9143444908..00000000000 --- a/ndb/src/ndbapi/NdbOperation.cpp +++ /dev/null @@ -1,400 +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 */ - -#include <ndb_global.h> -#include <NdbTransaction.hpp> -#include <NdbOperation.hpp> -#include "NdbApiSignal.hpp" -#include "NdbRecAttr.hpp" -#include "NdbUtil.hpp" -#include "NdbBlob.hpp" -#include "ndbapi_limits.h" -#include <signaldata/TcKeyReq.hpp> -#include "NdbDictionaryImpl.hpp" - -#include "API.hpp" -#include <NdbOut.hpp> - - -/****************************************************************************** - * NdbOperation(Ndb* aNdb, Table* aTable); - * - * Return Value: None - * Parameters: aNdb: Pointers to the Ndb object. - * aTable: Pointers to the Table object - * Remark: Creat an object of NdbOperation. - ****************************************************************************/ -NdbOperation::NdbOperation(Ndb* aNdb) : - theReceiver(aNdb), - theErrorLine(0), - theNdb(aNdb), - //theTable(aTable), - theNdbCon(NULL), - theNext(NULL), - theTCREQ(NULL), - theFirstATTRINFO(NULL), - theCurrentATTRINFO(NULL), - theTotalCurrAI_Len(0), - theAI_LenInCurrAI(0), - theLastKEYINFO(NULL), - - theFirstLabel(NULL), - theLastLabel(NULL), - theFirstBranch(NULL), - theLastBranch(NULL), - theFirstCall(NULL), - theLastCall(NULL), - theFirstSubroutine(NULL), - theLastSubroutine(NULL), - theNoOfLabels(0), - theNoOfSubroutines(0), - - m_currentTable(NULL), //theTableId(0xFFFF), - m_accessTable(NULL), //theAccessTableId(0xFFFF), - //theSchemaVersion(0), - theTotalNrOfKeyWordInSignal(8), - theTupKeyLen(0), - theNoOfTupKeyLeft(0), - theOperationType(NotDefined), - theStatus(Init), - theMagicNumber(0xFE11D0), - theScanInfo(0), - m_tcReqGSN(GSN_TCKEYREQ), - m_keyInfoGSN(GSN_KEYINFO), - m_attrInfoGSN(GSN_ATTRINFO), - theBlobList(NULL), - m_abortOption(-1) -{ - theReceiver.init(NdbReceiver::NDB_OPERATION, this); - theError.code = 0; -} -/***************************************************************************** - * ~NdbOperation(); - * - * Remark: Delete tables for connection pointers (id). - *****************************************************************************/ -NdbOperation::~NdbOperation( ) -{ -} -/****************************************************************************** - *void setErrorCode(int anErrorCode); - * - * Remark: Set an Error Code on operation and - * on connection set an error status. - *****************************************************************************/ -void -NdbOperation::setErrorCode(int anErrorCode) -{ - theError.code = anErrorCode; - theNdbCon->theErrorLine = theErrorLine; - theNdbCon->theErrorOperation = this; - theNdbCon->setOperationErrorCode(anErrorCode); -} - -/****************************************************************************** - * void setErrorCodeAbort(int anErrorCode); - * - * Remark: Set an Error Code on operation and on connection set - * an error status. - *****************************************************************************/ -void -NdbOperation::setErrorCodeAbort(int anErrorCode) -{ - theError.code = anErrorCode; - theNdbCon->theErrorLine = theErrorLine; - theNdbCon->theErrorOperation = this; - theNdbCon->setOperationErrorCodeAbort(anErrorCode); -} - -/***************************************************************************** - * int init(); - * - * Return Value: Return 0 : init was successful. - * Return -1: In all other case. - * Remark: Initiates operation record after allocation. - *****************************************************************************/ - -int -NdbOperation::init(const NdbTableImpl* tab, NdbTransaction* myConnection){ - NdbApiSignal* tSignal; - theStatus = Init; - theError.code = 0; - theErrorLine = 1; - m_currentTable = m_accessTable = tab; - - theNdbCon = myConnection; - for (Uint32 i=0; i<NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY; i++) - for (int j=0; j<3; j++) - theTupleKeyDefined[i][j] = 0; - - theFirstATTRINFO = NULL; - theCurrentATTRINFO = NULL; - theLastKEYINFO = NULL; - - - theTupKeyLen = 0; - theNoOfTupKeyLeft = tab->getNoOfPrimaryKeys(); - - theTotalCurrAI_Len = 0; - theAI_LenInCurrAI = 0; - theStartIndicator = 0; - theCommitIndicator = 0; - theSimpleIndicator = 0; - theDirtyIndicator = 0; - theInterpretIndicator = 0; - theDistrKeyIndicator_ = 0; - theScanInfo = 0; - theTotalNrOfKeyWordInSignal = 8; - theMagicNumber = 0xABCDEF01; - theBlobList = NULL; - m_abortOption = -1; - - tSignal = theNdb->getSignal(); - if (tSignal == NULL) - { - setErrorCode(4000); - return -1; - } - theTCREQ = tSignal; - theTCREQ->setSignal(m_tcReqGSN); - - theAI_LenInCurrAI = 20; - TcKeyReq * const tcKeyReq = CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend()); - tcKeyReq->scanInfo = 0; - theKEYINFOptr = &tcKeyReq->keyInfo[0]; - theATTRINFOptr = &tcKeyReq->attrInfo[0]; - theReceiver.init(NdbReceiver::NDB_OPERATION, this); - return 0; -} - - -/****************************************************************************** - * void release(); - * - * Remark: Release all objects connected to the operation object. - *****************************************************************************/ -void -NdbOperation::release() -{ - NdbApiSignal* tSignal; - NdbApiSignal* tSaveSignal; - NdbBranch* tBranch; - NdbBranch* tSaveBranch; - NdbLabel* tLabel; - NdbLabel* tSaveLabel; - NdbCall* tCall; - NdbCall* tSaveCall; - NdbSubroutine* tSubroutine; - NdbSubroutine* tSaveSubroutine; - NdbBlob* tBlob; - NdbBlob* tSaveBlob; - - tSignal = theTCREQ; - while (tSignal != NULL) - { - tSaveSignal = tSignal; - tSignal = tSignal->next(); - theNdb->releaseSignal(tSaveSignal); - } - theTCREQ = NULL; - theLastKEYINFO = NULL; - - tSignal = theFirstATTRINFO; - while (tSignal != NULL) - { - tSaveSignal = tSignal; - tSignal = tSignal->next(); - theNdb->releaseSignal(tSaveSignal); - } - theFirstATTRINFO = NULL; - theCurrentATTRINFO = NULL; - - if (theInterpretIndicator == 1) - { - tBranch = theFirstBranch; - while (tBranch != NULL) - { - tSaveBranch = tBranch; - tBranch = tBranch->theNext; - theNdb->releaseNdbBranch(tSaveBranch); - } - tLabel = theFirstLabel; - while (tLabel != NULL) - { - tSaveLabel = tLabel; - tLabel = tLabel->theNext; - theNdb->releaseNdbLabel(tSaveLabel); - } - tCall = theFirstCall; - while (tCall != NULL) - { - tSaveCall = tCall; - tCall = tCall->theNext; - theNdb->releaseNdbCall(tSaveCall); - } - tSubroutine = theFirstSubroutine; - while (tSubroutine != NULL) - { - tSaveSubroutine = tSubroutine; - tSubroutine = tSubroutine->theNext; - theNdb->releaseNdbSubroutine(tSaveSubroutine); - } - } - tBlob = theBlobList; - while (tBlob != NULL) - { - tSaveBlob = tBlob; - tBlob = tBlob->theNext; - theNdb->releaseNdbBlob(tSaveBlob); - } - theBlobList = NULL; - theReceiver.release(); -} - -NdbRecAttr* -NdbOperation::getValue(const char* anAttrName, char* aValue) -{ - return getValue_impl(m_currentTable->getColumn(anAttrName), aValue); -} - -NdbRecAttr* -NdbOperation::getValue(Uint32 anAttrId, char* aValue) -{ - return getValue_impl(m_currentTable->getColumn(anAttrId), aValue); -} - -NdbRecAttr* -NdbOperation::getValue(const NdbDictionary::Column* col, char* aValue) -{ - return getValue_impl(&NdbColumnImpl::getImpl(*col), aValue); -} - -int -NdbOperation::equal(const char* anAttrName, - const char* aValuePassed, - Uint32 aVariableKeyLen) -{ - return equal_impl(m_accessTable->getColumn(anAttrName), aValuePassed, aVariableKeyLen); -} - -int -NdbOperation::equal(Uint32 anAttrId, - const char* aValuePassed, - Uint32 aVariableKeyLen) -{ - return equal_impl(m_accessTable->getColumn(anAttrId), aValuePassed, aVariableKeyLen); -} - -int -NdbOperation::setValue( const char* anAttrName, - const char* aValuePassed, - Uint32 len) -{ - return setValue(m_currentTable->getColumn(anAttrName), aValuePassed, len); -} - - -int -NdbOperation::setValue( Uint32 anAttrId, - const char* aValuePassed, - Uint32 len) -{ - return setValue(m_currentTable->getColumn(anAttrId), aValuePassed, len); -} - -NdbBlob* -NdbOperation::getBlobHandle(const char* anAttrName) -{ - return getBlobHandle(theNdbCon, m_currentTable->getColumn(anAttrName)); -} - -NdbBlob* -NdbOperation::getBlobHandle(Uint32 anAttrId) -{ - return getBlobHandle(theNdbCon, m_currentTable->getColumn(anAttrId)); -} - -int -NdbOperation::incValue(const char* anAttrName, Uint32 aValue) -{ - return incValue(m_currentTable->getColumn(anAttrName), aValue); -} - -int -NdbOperation::incValue(const char* anAttrName, Uint64 aValue) -{ - return incValue(m_currentTable->getColumn(anAttrName), aValue); -} - -int -NdbOperation::incValue(Uint32 anAttrId, Uint32 aValue) -{ - return incValue(m_currentTable->getColumn(anAttrId), aValue); -} - -int -NdbOperation::incValue(Uint32 anAttrId, Uint64 aValue) -{ - return incValue(m_currentTable->getColumn(anAttrId), aValue); -} - -int -NdbOperation::subValue( const char* anAttrName, Uint32 aValue) -{ - return subValue(m_currentTable->getColumn(anAttrName), aValue); -} - -int -NdbOperation::subValue(Uint32 anAttrId, Uint32 aValue) -{ - return subValue(m_currentTable->getColumn(anAttrId), aValue); -} - -int -NdbOperation::read_attr(const char* anAttrName, Uint32 RegDest) -{ - return read_attr(m_currentTable->getColumn(anAttrName), RegDest); -} - -int -NdbOperation::read_attr(Uint32 anAttrId, Uint32 RegDest) -{ - return read_attr(m_currentTable->getColumn(anAttrId), RegDest); -} - -int -NdbOperation::write_attr(const char* anAttrName, Uint32 RegDest) -{ - return write_attr(m_currentTable->getColumn(anAttrName), RegDest); -} - -int -NdbOperation::write_attr(Uint32 anAttrId, Uint32 RegDest) -{ - return write_attr(m_currentTable->getColumn(anAttrId), RegDest); -} - -const char* -NdbOperation::getTableName() const -{ - return m_currentTable->m_externalName.c_str(); -} - -const NdbDictionary::Table* -NdbOperation::getTable() const -{ - return m_currentTable; -} diff --git a/ndb/src/ndbapi/NdbOperationDefine.cpp b/ndb/src/ndbapi/NdbOperationDefine.cpp deleted file mode 100644 index 835e33dfb40..00000000000 --- a/ndb/src/ndbapi/NdbOperationDefine.cpp +++ /dev/null @@ -1,723 +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 */ - -#include <ndb_global.h> -#include <NdbOperation.hpp> -#include "NdbApiSignal.hpp" -#include <NdbTransaction.hpp> -#include <Ndb.hpp> -#include <NdbRecAttr.hpp> -#include "NdbUtil.hpp" -#include "NdbOut.hpp" -#include "NdbImpl.hpp" -#include <NdbIndexScanOperation.hpp> -#include <NdbBlob.hpp> - -#include <Interpreter.hpp> - -#include <AttributeHeader.hpp> -#include <signaldata/TcKeyReq.hpp> - -/***************************************************************************** - * int insertTuple(); - *****************************************************************************/ -int -NdbOperation::insertTuple() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - theOperationType = InsertRequest; - tNdbCon->theSimpleState = 0; - theErrorLine = tErrorLine++; - theLockMode = LM_Exclusive; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::insertTuple() -/****************************************************************************** - * int updateTuple(); - *****************************************************************************/ -int -NdbOperation::updateTuple() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - tNdbCon->theSimpleState = 0; - theOperationType = UpdateRequest; - theErrorLine = tErrorLine++; - theLockMode = LM_Exclusive; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::updateTuple() -/***************************************************************************** - * int writeTuple(); - *****************************************************************************/ -int -NdbOperation::writeTuple() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - tNdbCon->theSimpleState = 0; - theOperationType = WriteRequest; - theErrorLine = tErrorLine++; - theLockMode = LM_Exclusive; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::writeTuple() -/****************************************************************************** - * int readTuple(); - *****************************************************************************/ -int -NdbOperation::readTuple(NdbOperation::LockMode lm) -{ - switch(lm) { - case LM_Read: - return readTuple(); - break; - case LM_Exclusive: - return readTupleExclusive(); - break; - case LM_CommittedRead: - return committedRead(); - break; - default: - return -1; - }; -} -/****************************************************************************** - * int readTuple(); - *****************************************************************************/ -int -NdbOperation::readTuple() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - tNdbCon->theSimpleState = 0; - theOperationType = ReadRequest; - theErrorLine = tErrorLine++; - theLockMode = LM_Read; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::readTuple() - -/***************************************************************************** - * int deleteTuple(); - *****************************************************************************/ -int -NdbOperation::deleteTuple() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - tNdbCon->theSimpleState = 0; - theOperationType = DeleteRequest; - theErrorLine = tErrorLine++; - theLockMode = LM_Exclusive; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::deleteTuple() - -/****************************************************************************** - * int readTupleExclusive(); - *****************************************************************************/ -int -NdbOperation::readTupleExclusive() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - tNdbCon->theSimpleState = 0; - theOperationType = ReadExclusive; - theErrorLine = tErrorLine++; - theLockMode = LM_Exclusive; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::readTupleExclusive() - -/***************************************************************************** - * int simpleRead(); - *****************************************************************************/ -int -NdbOperation::simpleRead() -{ - /** - * Currently/still disabled - */ - return readTuple(); -#if 0 - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - theOperationType = ReadRequest; - theSimpleIndicator = 1; - theErrorLine = tErrorLine++; - theLockMode = LM_Read; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -#endif -}//NdbOperation::simpleRead() - -/***************************************************************************** - * int dirtyRead(); - *****************************************************************************/ -int -NdbOperation::dirtyRead() -{ - return committedRead(); -}//NdbOperation::dirtyRead() - -/***************************************************************************** - * int committedRead(); - *****************************************************************************/ -int -NdbOperation::committedRead() -{ - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - theOperationType = ReadRequest; - theSimpleIndicator = 1; - theDirtyIndicator = 1; - theErrorLine = tErrorLine++; - theLockMode = LM_CommittedRead; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::committedRead() - -/***************************************************************************** - * int dirtyUpdate(); - ****************************************************************************/ -int -NdbOperation::dirtyUpdate() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - theOperationType = UpdateRequest; - tNdbCon->theSimpleState = 0; - theSimpleIndicator = 1; - theDirtyIndicator = 1; - theErrorLine = tErrorLine++; - theLockMode = LM_CommittedRead; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::dirtyUpdate() - -/****************************************************************************** - * int dirtyWrite(); - *****************************************************************************/ -int -NdbOperation::dirtyWrite() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - theOperationType = WriteRequest; - tNdbCon->theSimpleState = 0; - theSimpleIndicator = 1; - theDirtyIndicator = 1; - theErrorLine = tErrorLine++; - theLockMode = LM_CommittedRead; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::dirtyWrite() - -/****************************************************************************** - * int interpretedUpdateTuple(); - ****************************************************************************/ -int -NdbOperation::interpretedUpdateTuple() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - tNdbCon->theSimpleState = 0; - theOperationType = UpdateRequest; - theAI_LenInCurrAI = 25; - theLockMode = LM_Exclusive; - theErrorLine = tErrorLine++; - initInterpreter(); - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::interpretedUpdateTuple() - -/***************************************************************************** - * int interpretedDeleteTuple(); - *****************************************************************************/ -int -NdbOperation::interpretedDeleteTuple() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - tNdbCon->theSimpleState = 0; - theOperationType = DeleteRequest; - - theErrorLine = tErrorLine++; - theAI_LenInCurrAI = 25; - theLockMode = LM_Exclusive; - initInterpreter(); - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::interpretedDeleteTuple() - - - -/****************************************************************************** - * int getValue(AttrInfo* tAttrInfo, char* aRef ) - * - * Return Value Return 0 : GetValue was successful. - * Return -1: In all other case. - * Parameters: tAttrInfo : Attribute object of the retrieved attribute - * value. - * Remark: Define an attribute to retrieve in query. - *****************************************************************************/ -NdbRecAttr* -NdbOperation::getValue_impl(const NdbColumnImpl* tAttrInfo, char* aValue) -{ - NdbRecAttr* tRecAttr; - if ((tAttrInfo != NULL) && - (theStatus != Init)){ - if (theStatus != GetValue) { - if (theInterpretIndicator == 1) { - if (theStatus == FinalGetValue) { - ; // Simply continue with getValue - } else if (theStatus == ExecInterpretedValue) { - if (insertATTRINFO(Interpreter::EXIT_OK) == -1) - return NULL; - theInterpretedSize = theTotalCurrAI_Len - - (theInitialReadSize + 5); - } else if (theStatus == SetValueInterpreted) { - theFinalUpdateSize = theTotalCurrAI_Len - - (theInitialReadSize + theInterpretedSize + 5); - } else { - setErrorCodeAbort(4230); - return NULL; - }//if - // MASV - How would execution come here? - theStatus = FinalGetValue; - } else { - setErrorCodeAbort(4230); - return NULL; - }//if - }//if - Uint32 ah; - AttributeHeader::init(&ah, tAttrInfo->m_attrId, 0); - if (insertATTRINFO(ah) != -1) { - // Insert Attribute Id into ATTRINFO part. - - /************************************************************************ - * Get a Receive Attribute object and link it into the operation object. - ***********************************************************************/ - if((tRecAttr = theReceiver.getValue(tAttrInfo, aValue)) != 0){ - theErrorLine++; - return tRecAttr; - } else { - setErrorCodeAbort(4000); - return NULL; - } - } else { - return NULL; - }//if insertATTRINFO failure - } else { - if (tAttrInfo == NULL) { - setErrorCodeAbort(4004); - return NULL; - }//if - }//if - setErrorCodeAbort(4200); - return NULL; -} - -/***************************************************************************** - * int setValue(AttrInfo* tAttrInfo, char* aValue, Uint32 len) - * - * Return Value: Return 0 : SetValue was succesful. - * Return -1: In all other case. - * Parameters: tAttrInfo : Attribute object where the attribute - * info exists. - * aValue : Reference to the variable with the new value. - * len : Length of the value - * Remark: Define a attribute to set in a query. -******************************************************************************/ -int -NdbOperation::setValue( const NdbColumnImpl* tAttrInfo, - const char* aValuePassed, Uint32 len) -{ - DBUG_ENTER("NdbOperation::setValue"); - DBUG_PRINT("enter", ("col=%s op=%d val=0x%x len=%u", - tAttrInfo->m_name.c_str(), - theOperationType, - aValuePassed, len)); - if (aValuePassed != NULL) - DBUG_DUMP("value", (char*)aValuePassed, len); - - int tReturnCode; - Uint32 tAttrId; - Uint32 tData; - Uint32 tempData[2000]; - OperationType tOpType = theOperationType; - OperationStatus tStatus = theStatus; - - - if ((tOpType == UpdateRequest) || - (tOpType == WriteRequest)) { - if (theInterpretIndicator == 0) { - if (tStatus == SetValue) { - ; - } else { - setErrorCodeAbort(4234); - DBUG_RETURN(-1); - }//if - } else { - if (tStatus == GetValue) { - theInitialReadSize = theTotalCurrAI_Len - 5; - } else if (tStatus == ExecInterpretedValue) { - //-------------------------------------------------------------------- - // We insert an exit from interpretation since we are now starting - // to set values in the tuple by setValue. - //-------------------------------------------------------------------- - if (insertATTRINFO(Interpreter::EXIT_OK) == -1){ - DBUG_RETURN(-1); - } - theInterpretedSize = theTotalCurrAI_Len - - (theInitialReadSize + 5); - } else if (tStatus == SetValueInterpreted) { - ; // Simply continue adding new setValue - } else { - //-------------------------------------------------------------------- - // setValue used in the wrong context. Application coding error. - //------------------------------------------------------------------- - setErrorCodeAbort(4234); //Wrong error code - DBUG_RETURN(-1); - }//if - theStatus = SetValueInterpreted; - }//if - } else if (tOpType == InsertRequest) { - if ((theStatus != SetValue) && (theStatus != OperationDefined)) { - setErrorCodeAbort(4234); - DBUG_RETURN(-1); - }//if - } else if (tOpType == ReadRequest || tOpType == ReadExclusive) { - setErrorCodeAbort(4504); - DBUG_RETURN(-1); - } else if (tOpType == DeleteRequest) { - setErrorCodeAbort(4504); - DBUG_RETURN(-1); - } else if (tOpType == OpenScanRequest || tOpType == OpenRangeScanRequest) { - setErrorCodeAbort(4228); - DBUG_RETURN(-1); - } else { - //--------------------------------------------------------------------- - // setValue with undefined operation type. - // Probably application coding error. - //--------------------------------------------------------------------- - setErrorCodeAbort(4108); - DBUG_RETURN(-1); - }//if - if (tAttrInfo == NULL) { - setErrorCodeAbort(4004); - DBUG_RETURN(-1); - }//if - if (tAttrInfo->m_pk) { - if (theOperationType == InsertRequest) { - DBUG_RETURN(equal_impl(tAttrInfo, aValuePassed, len)); - } else { - setErrorCodeAbort(4202); - DBUG_RETURN(-1); - }//if - }//if - if (len > 8000) { - setErrorCodeAbort(4216); - DBUG_RETURN(-1); - }//if - - tAttrId = tAttrInfo->m_attrId; - const char *aValue = aValuePassed; - Uint32 ahValue; - if (aValue == NULL) { - if (tAttrInfo->m_nullable) { - AttributeHeader& ah = AttributeHeader::init(&ahValue, tAttrId, 0); - ah.setNULL(); - insertATTRINFO(ahValue); - // Insert Attribute Id with the value - // NULL into ATTRINFO part. - DBUG_RETURN(0); - } else { - /*********************************************************************** - * Setting a NULL value on a NOT NULL attribute is not allowed. - **********************************************************************/ - setErrorCodeAbort(4203); - DBUG_RETURN(-1); - }//if - }//if - - // Insert Attribute Id into ATTRINFO part. - const Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize; - -#if 0 - tAttrSize = tAttrInfo->theAttrSize; - tArraySize = tAttrInfo->theArraySize; - if (tArraySize == 0) { - setErrorCodeAbort(4201); - return -1; - }//if - tAttrSizeInBits = tAttrSize*tArraySize; - tAttrSizeInWords = tAttrSizeInBits >> 5; -#endif - const Uint32 bitsInLastWord = 8 * (sizeInBytes & 3) ; - if (len != sizeInBytes && (len != 0)) { - setErrorCodeAbort(4209); - DBUG_RETURN(-1); - }//if - const Uint32 totalSizeInWords = (sizeInBytes + 3)/4; // Including bits in last word - const Uint32 sizeInWords = sizeInBytes / 4; // Excluding bits in last word - AttributeHeader& ah = AttributeHeader::init(&ahValue, tAttrId, - totalSizeInWords); - insertATTRINFO( ahValue ); - - /*********************************************************************** - * Check if the pointer of the value passed is aligned on a 4 byte boundary. - * If so only assign the pointer to the internal variable aValue. - * If it is not aligned then we start by copying the value to tempData and - * use this as aValue instead. - *************************************************************************/ - const int attributeSize = sizeInBytes; - const int slack = sizeInBytes & 3; - - if (((UintPtr)aValue & 3) != 0 || (slack != 0)){ - memcpy(&tempData[0], aValue, attributeSize); - aValue = (char*)&tempData[0]; - if(slack != 0) { - char * tmp = (char*)&tempData[0]; - memset(&tmp[attributeSize], 0, (4 - slack)); - }//if - }//if - - tReturnCode = insertATTRINFOloop((Uint32*)aValue, sizeInWords); - if (tReturnCode == -1) { - DBUG_RETURN(tReturnCode); - }//if - if (bitsInLastWord != 0) { - tData = *(Uint32*)(aValue + sizeInWords*4); - tData = convertEndian(tData); - tData = tData & ((1 << bitsInLastWord) - 1); - tData = convertEndian(tData); - tReturnCode = insertATTRINFO(tData); - if (tReturnCode == -1) { - DBUG_RETURN(tReturnCode); - }//if - }//if - theErrorLine++; - DBUG_RETURN(0); -}//NdbOperation::setValue() - -NdbBlob* -NdbOperation::getBlobHandle(NdbTransaction* aCon, const NdbColumnImpl* tAttrInfo) -{ - NdbBlob* tBlob = theBlobList; - NdbBlob* tLastBlob = NULL; - while (tBlob != NULL) { - if (tBlob->theColumn == tAttrInfo) - return tBlob; - tLastBlob = tBlob; - tBlob = tBlob->theNext; - } - tBlob = theNdb->getNdbBlob(); - if (tBlob == NULL) - return NULL; - if (tBlob->atPrepare(aCon, this, tAttrInfo) == -1) { - theNdb->releaseNdbBlob(tBlob); - return NULL; - } - if (tLastBlob == NULL) - theBlobList = tBlob; - else - tLastBlob->theNext = tBlob; - tBlob->theNext = NULL; - theNdbCon->theBlobFlag = true; - return tBlob; -} - -/**************************************************************************** - * int insertATTRINFO( Uint32 aData ); - * - * Return Value: Return 0 : insertATTRINFO was succesful. - * Return -1: In all other case. - * Parameters: aData: the data to insert into ATTRINFO. - * Remark: Puts the the data into either TCKEYREQ signal or - * ATTRINFO signal. - *****************************************************************************/ -int -NdbOperation::insertATTRINFO( Uint32 aData ) -{ - NdbApiSignal* tSignal; - register Uint32 tAI_LenInCurrAI = theAI_LenInCurrAI; - register Uint32* tAttrPtr = theATTRINFOptr; - register Uint32 tTotCurrAILen = theTotalCurrAI_Len; - - if (tAI_LenInCurrAI >= 25) { - Ndb* tNdb = theNdb; - NdbApiSignal* tFirstAttrinfo = theFirstATTRINFO; - tAI_LenInCurrAI = 3; - tSignal = tNdb->getSignal(); - if (tSignal != NULL) { - tSignal->setSignal(m_attrInfoGSN); - tAttrPtr = &tSignal->getDataPtrSend()[3]; - if (tFirstAttrinfo == NULL) { - tSignal->next(NULL); - theFirstATTRINFO = tSignal; - theCurrentATTRINFO = tSignal; - } else { - NdbApiSignal* tCurrentAttrinfoBeforeUpdate = theCurrentATTRINFO; - tSignal->next(NULL); - theCurrentATTRINFO = tSignal; - tCurrentAttrinfoBeforeUpdate->next(tSignal); - }//if - } else { - goto insertATTRINFO_error1; - }//if - }//if - *tAttrPtr = aData; - tAttrPtr++; - tTotCurrAILen++; - tAI_LenInCurrAI++; - theTotalCurrAI_Len = tTotCurrAILen; - theAI_LenInCurrAI = tAI_LenInCurrAI; - theATTRINFOptr = tAttrPtr; - return 0; - -insertATTRINFO_error1: - setErrorCodeAbort(4000); - return -1; - -}//NdbOperation::insertATTRINFO() - -/***************************************************************************** - * int insertATTRINFOloop(Uint32* aDataPtr, Uint32 aLength ); - * - * Return Value: Return 0 : insertATTRINFO was succesful. - * Return -1: In all other case. - * Parameters: aDataPtr: Pointer to the data to insert into ATTRINFO. - * aLength: Length of data to be copied - * Remark: Puts the the data into either TCKEYREQ signal or - * ATTRINFO signal. - *****************************************************************************/ -int -NdbOperation::insertATTRINFOloop(register const Uint32* aDataPtr, - register Uint32 aLength) -{ - NdbApiSignal* tSignal; - register Uint32 tAI_LenInCurrAI = theAI_LenInCurrAI; - register Uint32 tTotCurrAILen = theTotalCurrAI_Len; - register Uint32* tAttrPtr = theATTRINFOptr; - Ndb* tNdb = theNdb; - - while (aLength > 0) { - if (tAI_LenInCurrAI >= 25) { - NdbApiSignal* tFirstAttrinfo = theFirstATTRINFO; - tAI_LenInCurrAI = 3; - tSignal = tNdb->getSignal(); - if (tSignal != NULL) { - tSignal->setSignal(m_attrInfoGSN); - tAttrPtr = &tSignal->getDataPtrSend()[3]; - if (tFirstAttrinfo == NULL) { - tSignal->next(NULL); - theFirstATTRINFO = tSignal; - theCurrentATTRINFO = tSignal; - } else { - NdbApiSignal* tCurrentAttrinfoBeforeUpdate = theCurrentATTRINFO; - tSignal->next(NULL); - theCurrentATTRINFO = tSignal; - tCurrentAttrinfoBeforeUpdate->next(tSignal); - }//if - } else { - goto insertATTRINFO_error1; - }//if - }//if - { - register Uint32 tData = *aDataPtr; - aDataPtr++; - aLength--; - tAI_LenInCurrAI++; - *tAttrPtr = tData; - tAttrPtr++; - tTotCurrAILen++; - } - }//while - theATTRINFOptr = tAttrPtr; - theTotalCurrAI_Len = tTotCurrAILen; - theAI_LenInCurrAI = tAI_LenInCurrAI; - return 0; - -insertATTRINFO_error1: - setErrorCodeAbort(4000); - return -1; - -}//NdbOperation::insertATTRINFOloop() - - - - diff --git a/ndb/src/ndbapi/NdbOperationExec.cpp b/ndb/src/ndbapi/NdbOperationExec.cpp deleted file mode 100644 index 4200300615d..00000000000 --- a/ndb/src/ndbapi/NdbOperationExec.cpp +++ /dev/null @@ -1,580 +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 */ - -#include <ndb_global.h> -#include <NdbOperation.hpp> -#include <NdbTransaction.hpp> -#include "NdbApiSignal.hpp" -#include <Ndb.hpp> -#include <NdbRecAttr.hpp> -#include "NdbUtil.hpp" - -#include "Interpreter.hpp" -#include <AttributeHeader.hpp> -#include <signaldata/TcKeyReq.hpp> -#include <signaldata/KeyInfo.hpp> -#include <signaldata/AttrInfo.hpp> -#include <signaldata/ScanTab.hpp> - -#include <ndb_version.h> - -#include "API.hpp" -#include <NdbOut.hpp> - - - -void -NdbOperation::setLastFlag(NdbApiSignal* signal, Uint32 lastFlag) -{ - TcKeyReq * const req = CAST_PTR(TcKeyReq, signal->getDataPtrSend()); - TcKeyReq::setExecuteFlag(req->requestInfo, lastFlag); -} - -/****************************************************************************** -int doSend() - -Return Value: Return >0 : send was succesful, returns number of signals sent - Return -1: In all other case. -Parameters: aProcessorId: Receiving processor node -Remark: Sends the TCKEYREQ signal and optional KEYINFO and ATTRINFO - signals. -******************************************************************************/ -int -NdbOperation::doSend(int aNodeId, Uint32 lastFlag) -{ - int tReturnCode; - int tSignalCount = 0; - assert(theTCREQ != NULL); - setLastFlag(theTCREQ, lastFlag); - TransporterFacade *tp = TransporterFacade::instance(); - tReturnCode = tp->sendSignal(theTCREQ, aNodeId); - tSignalCount++; - if (tReturnCode == -1) { - return -1; - } - NdbApiSignal *tSignal = theTCREQ->next(); - while (tSignal != NULL) { - NdbApiSignal* tnextSignal = tSignal->next(); - tReturnCode = tp->sendSignal(tSignal, aNodeId); - tSignal = tnextSignal; - if (tReturnCode == -1) { - return -1; - } - tSignalCount++; - }//while - tSignal = theFirstATTRINFO; - while (tSignal != NULL) { - NdbApiSignal* tnextSignal = tSignal->next(); - tReturnCode = tp->sendSignal(tSignal, aNodeId); - tSignal = tnextSignal; - if (tReturnCode == -1) { - return -1; - } - tSignalCount++; - }//while - theNdbCon->OpSent(); - return tSignalCount; -}//NdbOperation::doSend() - -/*************************************************************************** -int prepareSend(Uint32 aTC_ConnectPtr, - Uint64 aTransactionId) - -Return Value: Return 0 : preparation of send was succesful. - Return -1: In all other case. -Parameters: aTC_ConnectPtr: the Connect pointer to TC. - aTransactionId: the Transaction identity of the transaction. -Remark: Puts the the data into TCKEYREQ signal and optional KEYINFO and ATTRINFO signals. -***************************************************************************/ -int -NdbOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransId) -{ - Uint32 tTransId1, tTransId2; - Uint32 tReqInfo; - Uint32 tInterpretInd = theInterpretIndicator; - - theErrorLine = 0; - - if (tInterpretInd != 1) { - OperationType tOpType = theOperationType; - OperationStatus tStatus = theStatus; - if ((tOpType == UpdateRequest) || - (tOpType == InsertRequest) || - (tOpType == WriteRequest)) { - if (tStatus != SetValue) { - setErrorCodeAbort(4116); - return -1; - }//if - } else if ((tOpType == ReadRequest) || (tOpType == ReadExclusive) || - (tOpType == DeleteRequest)) { - if (tStatus != GetValue) { - setErrorCodeAbort(4116); - return -1; - }//if - } else { - setErrorCodeAbort(4005); - return -1; - }//if - } else { - if (prepareSendInterpreted() == -1) { - return -1; - }//if - }//if - -//------------------------------------------------------------- -// We start by filling in the first 9 unconditional words of the -// TCKEYREQ signal. -//------------------------------------------------------------- - TcKeyReq * const tcKeyReq = CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend()); - - Uint32 tTotalCurrAI_Len = theTotalCurrAI_Len; - Uint32 tTableId = m_currentTable->m_tableId; - Uint32 tSchemaVersion = m_currentTable->m_version; - - tcKeyReq->apiConnectPtr = aTC_ConnectPtr; - tcKeyReq->apiOperationPtr = ptr2int(); - // Check if too much attrinfo have been defined - if (tTotalCurrAI_Len > TcKeyReq::MaxTotalAttrInfo){ - setErrorCodeAbort(4257); - return -1; - } - Uint32 TattrLen = 0; - tcKeyReq->setAttrinfoLen(TattrLen, tTotalCurrAI_Len); - tcKeyReq->setAPIVersion(TattrLen, NDB_VERSION); - tcKeyReq->attrLen = TattrLen; - - tcKeyReq->tableId = tTableId; - tcKeyReq->tableSchemaVersion = tSchemaVersion; - tTransId1 = (Uint32) aTransId; - tTransId2 = (Uint32) (aTransId >> 32); - - Uint8 tSimpleIndicator = theSimpleIndicator; - Uint8 tCommitIndicator = theCommitIndicator; - Uint8 tStartIndicator = theStartIndicator; - Uint8 tInterpretIndicator = theInterpretIndicator; - -//------------------------------------------------------------- -// Simple state is set if start and commit is set and it is -// a read request. Otherwise it is set to zero. -//------------------------------------------------------------- - Uint8 tReadInd = (theOperationType == ReadRequest); - Uint8 tSimpleState = tReadInd & tSimpleIndicator; - - tcKeyReq->transId1 = tTransId1; - tcKeyReq->transId2 = tTransId2; - - tReqInfo = 0; - if (tTotalCurrAI_Len <= TcKeyReq::MaxAttrInfo) { - tcKeyReq->setAIInTcKeyReq(tReqInfo, tTotalCurrAI_Len); - } else { - tcKeyReq->setAIInTcKeyReq(tReqInfo, TcKeyReq::MaxAttrInfo); - }//if - - tcKeyReq->setSimpleFlag(tReqInfo, tSimpleIndicator); - tcKeyReq->setCommitFlag(tReqInfo, tCommitIndicator); - tcKeyReq->setStartFlag(tReqInfo, tStartIndicator); - tcKeyReq->setInterpretedFlag(tReqInfo, tInterpretIndicator); - - Uint8 tDirtyIndicator = theDirtyIndicator; - OperationType tOperationType = theOperationType; - Uint32 tTupKeyLen = theTupKeyLen; - Uint8 abortOption = - m_abortOption != -1 ? m_abortOption : theNdbCon->m_abortOption; - - tcKeyReq->setDirtyFlag(tReqInfo, tDirtyIndicator); - tcKeyReq->setOperationType(tReqInfo, tOperationType); - tcKeyReq->setKeyLength(tReqInfo, tTupKeyLen); - - // A simple read is always ignore error - abortOption = tSimpleIndicator ? AO_IgnoreError : abortOption; - tcKeyReq->setAbortOption(tReqInfo, abortOption); - - Uint8 tDistrKeyIndicator = theDistrKeyIndicator_; - Uint8 tScanIndicator = theScanInfo & 1; - - tcKeyReq->setDistributionKeyFlag(tReqInfo, tDistrKeyIndicator); - tcKeyReq->setScanIndFlag(tReqInfo, tScanIndicator); - - tcKeyReq->requestInfo = tReqInfo; - -//------------------------------------------------------------- -// The next step is to fill in the upto three conditional words. -//------------------------------------------------------------- - Uint32* tOptionalDataPtr = &tcKeyReq->scanInfo; - Uint32 tDistrGHIndex = tScanIndicator; - Uint32 tDistrKeyIndex = tDistrGHIndex; - - Uint32 tScanInfo = theScanInfo; - Uint32 tDistrKey = theDistributionKey; - - tOptionalDataPtr[0] = tScanInfo; - tOptionalDataPtr[tDistrKeyIndex] = tDistrKey; - -//------------------------------------------------------------- -// The next is step is to compress the key data part of the -// TCKEYREQ signal. -//------------------------------------------------------------- - Uint32 tKeyIndex = tDistrKeyIndex + tDistrKeyIndicator; - Uint32* tKeyDataPtr = &tOptionalDataPtr[tKeyIndex]; - Uint32 Tdata1 = tcKeyReq->keyInfo[0]; - Uint32 Tdata2 = tcKeyReq->keyInfo[1]; - Uint32 Tdata3 = tcKeyReq->keyInfo[2]; - Uint32 Tdata4 = tcKeyReq->keyInfo[3]; - Uint32 Tdata5; - - tKeyDataPtr[0] = Tdata1; - tKeyDataPtr[1] = Tdata2; - tKeyDataPtr[2] = Tdata3; - tKeyDataPtr[3] = Tdata4; - if (tTupKeyLen > 4) { - Tdata1 = tcKeyReq->keyInfo[4]; - Tdata2 = tcKeyReq->keyInfo[5]; - Tdata3 = tcKeyReq->keyInfo[6]; - Tdata4 = tcKeyReq->keyInfo[7]; - - tKeyDataPtr[4] = Tdata1; - tKeyDataPtr[5] = Tdata2; - tKeyDataPtr[6] = Tdata3; - tKeyDataPtr[7] = Tdata4; - }//if -//------------------------------------------------------------- -// Finally we also compress the ATTRINFO part of the signal. -// We optimise by using the if-statement for sending KEYINFO -// signals to calculating the new Attrinfo Index. -//------------------------------------------------------------- - Uint32 tAttrInfoIndex; - - if (tTupKeyLen > TcKeyReq::MaxKeyInfo) { - /** - * Set transid, TC connect ptr and length in the KEYINFO signals - */ - NdbApiSignal* tSignal = theTCREQ->next(); - Uint32 remainingKey = tTupKeyLen - TcKeyReq::MaxKeyInfo; - do { - Uint32* tSigDataPtr = tSignal->getDataPtrSend(); - NdbApiSignal* tnextSignal = tSignal->next(); - tSigDataPtr[0] = aTC_ConnectPtr; - tSigDataPtr[1] = tTransId1; - tSigDataPtr[2] = tTransId2; - if (remainingKey > KeyInfo::DataLength) { - // The signal is full - tSignal->setLength(KeyInfo::MaxSignalLength); - remainingKey -= KeyInfo::DataLength; - } - else { - // Last signal - tSignal->setLength(KeyInfo::HeaderLength + remainingKey); - remainingKey = 0; - } - tSignal = tnextSignal; - } while (tSignal != NULL); - tAttrInfoIndex = tKeyIndex + TcKeyReq::MaxKeyInfo; - } else { - tAttrInfoIndex = tKeyIndex + tTupKeyLen; - }//if - -//------------------------------------------------------------- -// Perform the Attrinfo packing in the TCKEYREQ signal started -// above. -//------------------------------------------------------------- - Uint32* tAIDataPtr = &tOptionalDataPtr[tAttrInfoIndex]; - Tdata1 = tcKeyReq->attrInfo[0]; - Tdata2 = tcKeyReq->attrInfo[1]; - Tdata3 = tcKeyReq->attrInfo[2]; - Tdata4 = tcKeyReq->attrInfo[3]; - Tdata5 = tcKeyReq->attrInfo[4]; - - theTCREQ->setLength(tcKeyReq->getAIInTcKeyReq(tReqInfo) + - tAttrInfoIndex + TcKeyReq::StaticLength); - - tAIDataPtr[0] = Tdata1; - tAIDataPtr[1] = Tdata2; - tAIDataPtr[2] = Tdata3; - tAIDataPtr[3] = Tdata4; - tAIDataPtr[4] = Tdata5; - -/*************************************************** -* Send the ATTRINFO signals. -***************************************************/ - if (tTotalCurrAI_Len > 5) { - // Set the last signal's length. - NdbApiSignal* tSignal = theFirstATTRINFO; - theCurrentATTRINFO->setLength(theAI_LenInCurrAI); - do { - Uint32* tSigDataPtr = tSignal->getDataPtrSend(); - NdbApiSignal* tnextSignal = tSignal->next(); - tSigDataPtr[0] = aTC_ConnectPtr; - tSigDataPtr[1] = tTransId1; - tSigDataPtr[2] = tTransId2; - tSignal = tnextSignal; - } while (tSignal != NULL); - }//if - theStatus = WaitResponse; - theReceiver.prepareSend(); - return 0; -}//NdbOperation::prepareSend() - -/*************************************************************************** -int prepareSendInterpreted() - -Make preparations to send an interpreted operation. -Return Value: Return 0 : succesful. - Return -1: In all other case. -***************************************************************************/ -int -NdbOperation::prepareSendInterpreted() -{ - Uint32 tTotalCurrAI_Len = theTotalCurrAI_Len; - Uint32 tInitReadSize = theInitialReadSize; - if (theStatus == ExecInterpretedValue) { - if (insertATTRINFO(Interpreter::EXIT_OK) != -1) { -//------------------------------------------------------------------------- -// Since we read the total length before inserting the last entry in the -// signals we need to add one to the total length. -//------------------------------------------------------------------------- - - theInterpretedSize = (tTotalCurrAI_Len + 1) - - (tInitReadSize + 5); - - } else { - return -1; - }//if - } else if (theStatus == FinalGetValue) { - - theFinalReadSize = tTotalCurrAI_Len - - (tInitReadSize + theInterpretedSize + theFinalUpdateSize + 5); - - } else if (theStatus == SetValueInterpreted) { - - theFinalUpdateSize = tTotalCurrAI_Len - - (tInitReadSize + theInterpretedSize + 5); - - } else if (theStatus == SubroutineEnd) { - - theSubroutineSize = tTotalCurrAI_Len - - (tInitReadSize + theInterpretedSize + - theFinalUpdateSize + theFinalReadSize + 5); - - } else if (theStatus == GetValue) { - theInitialReadSize = tTotalCurrAI_Len - 5; - } else { - setErrorCodeAbort(4116); - return -1; - } - - while (theFirstBranch != NULL) { - Uint32 tRelAddress; - Uint32 tLabelAddress = 0; - int tAddress = -1; - NdbBranch* tNdbBranch = theFirstBranch; - Uint32 tBranchLabel = tNdbBranch->theBranchLabel; - NdbLabel* tNdbLabel = theFirstLabel; - if (tBranchLabel >= theNoOfLabels) { - setErrorCodeAbort(4221); - return -1; - }//if - - // Find the label address - while (tNdbLabel != NULL) { - for(tLabelAddress = 0; tLabelAddress<16; tLabelAddress++){ - const Uint32 labelNo = tNdbLabel->theLabelNo[tLabelAddress]; - if(tBranchLabel == labelNo){ - tAddress = tNdbLabel->theLabelAddress[tLabelAddress]; - break; - } - } - - if(tAddress != -1) - break; - tNdbLabel = tNdbLabel->theNext; - }//while - if (tAddress == -1) { -//------------------------------------------------------------------------- -// We were unable to find any label which the branch refers to. This means -// that the application have not programmed the interpreter program correctly. -//------------------------------------------------------------------------- - setErrorCodeAbort(4222); - return -1; - }//if - if (tNdbLabel->theSubroutine[tLabelAddress] != tNdbBranch->theSubroutine) { - setErrorCodeAbort(4224); - return -1; - }//if - // Now it is time to update the signal data with the relative branch jump. - if (tAddress < int(tNdbBranch->theBranchAddress)) { - tRelAddress = (tNdbBranch->theBranchAddress - tAddress) << 16; - - // Indicate backward jump direction - tRelAddress = tRelAddress + (1 << 31); - - } else if (tAddress > int(tNdbBranch->theBranchAddress)) { - tRelAddress = (tAddress - tNdbBranch->theBranchAddress) << 16; - } else { - setErrorCodeAbort(4223); - return -1; - }//if - NdbApiSignal* tSignal = tNdbBranch->theSignal; - Uint32 tReadData = tSignal->readData(tNdbBranch->theSignalAddress); - tSignal->setData((tRelAddress + tReadData), tNdbBranch->theSignalAddress); - - theFirstBranch = theFirstBranch->theNext; - theNdb->releaseNdbBranch(tNdbBranch); - }//while - - while (theFirstCall != NULL) { - Uint32 tSubroutineCount = 0; - int tAddress = -1; - NdbSubroutine* tNdbSubroutine; - NdbCall* tNdbCall = theFirstCall; - if (tNdbCall->theSubroutine >= theNoOfSubroutines) { - setErrorCodeAbort(4221); - return -1; - }//if -// Find the subroutine address - tNdbSubroutine = theFirstSubroutine; - while (tNdbSubroutine != NULL) { - tSubroutineCount += 16; - if (tNdbCall->theSubroutine < tSubroutineCount) { -// Subroutine Found - Uint32 tSubroutineAddress = tNdbCall->theSubroutine - (tSubroutineCount - 16); - tAddress = tNdbSubroutine->theSubroutineAddress[tSubroutineAddress]; - break; - }//if - tNdbSubroutine = tNdbSubroutine->theNext; - }//while - if (tAddress == -1) { - setErrorCodeAbort(4222); - return -1; - }//if -// Now it is time to update the signal data with the relative branch jump. - NdbApiSignal* tSignal = tNdbCall->theSignal; - Uint32 tReadData = tSignal->readData(tNdbCall->theSignalAddress); - tSignal->setData(((tAddress << 16) + tReadData), tNdbCall->theSignalAddress); - - theFirstCall = theFirstCall->theNext; - theNdb->releaseNdbCall(tNdbCall); - }//while - - Uint32 tInitialReadSize = theInitialReadSize; - Uint32 tInterpretedSize = theInterpretedSize; - Uint32 tFinalUpdateSize = theFinalUpdateSize; - Uint32 tFinalReadSize = theFinalReadSize; - Uint32 tSubroutineSize = theSubroutineSize; - if (theOperationType != OpenScanRequest && - theOperationType != OpenRangeScanRequest) { - TcKeyReq * const tcKeyReq = CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend()); - - tcKeyReq->attrInfo[0] = tInitialReadSize; - tcKeyReq->attrInfo[1] = tInterpretedSize; - tcKeyReq->attrInfo[2] = tFinalUpdateSize; - tcKeyReq->attrInfo[3] = tFinalReadSize; - tcKeyReq->attrInfo[4] = tSubroutineSize; - } else { - // If a scan is defined we use the first ATTRINFO instead of TCKEYREQ. - theFirstATTRINFO->setData(tInitialReadSize, 4); - theFirstATTRINFO->setData(tInterpretedSize, 5); - theFirstATTRINFO->setData(tFinalUpdateSize, 6); - theFirstATTRINFO->setData(tFinalReadSize, 7); - theFirstATTRINFO->setData(tSubroutineSize, 8); - }//if - theReceiver.prepareSend(); - return 0; -}//NdbOperation::prepareSendInterpreted() - -int -NdbOperation::checkState_TransId(NdbApiSignal* aSignal) -{ - Uint64 tRecTransId, tCurrTransId; - Uint32 tTmp1, tTmp2; - - if (theStatus != WaitResponse) { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - return -1; - }//if - - tTmp1 = aSignal->readData(2); - tTmp2 = aSignal->readData(3); - - tRecTransId = (Uint64)tTmp1 + ((Uint64)tTmp2 << 32); - tCurrTransId = theNdbCon->getTransactionId(); - if (tCurrTransId != tRecTransId) { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - return -1; - }//if - return 0; -}//NdbOperation::checkState_TransId() - -/*************************************************************************** -int receiveTCKEYREF( NdbApiSignal* aSignal) - -Return Value: Return 0 : send was succesful. - Return -1: In all other case. -Parameters: aSignal: the signal object that contains the TCKEYREF signal from TC. -Remark: Handles the reception of the TCKEYREF signal. -***************************************************************************/ -int -NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal) -{ - if (checkState_TransId(aSignal) == -1) { - return -1; - }//if - - AbortOption ao = (AbortOption) - (m_abortOption != -1 ? m_abortOption : theNdbCon->m_abortOption); - theReceiver.m_received_result_length = ~0; - - theStatus = Finished; - // blobs want this - if (m_abortOption != AO_IgnoreError) - { - theNdbCon->theReturnStatus = NdbTransaction::ReturnFailure; - } - theError.code = aSignal->readData(4); - theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4), ao); - - if(theOperationType != ReadRequest || !theSimpleIndicator) // not simple read - return theNdbCon->OpCompleteFailure(ao, m_abortOption != AO_IgnoreError); - - /** - * If TCKEYCONF has arrived - * op has completed (maybe trans has completed) - */ - if(theReceiver.m_expected_result_length) - { - return theNdbCon->OpCompleteFailure(AbortOnError); - } - - return -1; -} - - -void -NdbOperation::handleFailedAI_ElemLen() -{ - NdbRecAttr* tRecAttr = theReceiver.theFirstRecAttr; - while (tRecAttr != NULL) { - tRecAttr->setNULL(); - tRecAttr = tRecAttr->next(); - }//while -}//NdbOperation::handleFailedAI_ElemLen() - - - - diff --git a/ndb/src/ndbapi/NdbOperationInt.cpp b/ndb/src/ndbapi/NdbOperationInt.cpp deleted file mode 100644 index 41e0cb1d140..00000000000 --- a/ndb/src/ndbapi/NdbOperationInt.cpp +++ /dev/null @@ -1,1168 +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 */ - -#include <ndb_global.h> -#include <NdbOperation.hpp> -#include "NdbApiSignal.hpp" -#include <NdbTransaction.hpp> -#include <Ndb.hpp> -#include <NdbRecAttr.hpp> -#include "NdbUtil.hpp" -#include "Interpreter.hpp" -#include <NdbIndexScanOperation.hpp> - -#ifdef VM_TRACE -#include <NdbEnv.h> -#define INT_DEBUG(x) \ - { const char* tmp = NdbEnv_GetEnv("INT_DEBUG", (char*)0, 0); \ - if (tmp != 0 && strlen(tmp) != 0) { ndbout << "INT:"; ndbout_c x; } } -#else -#define INT_DEBUG(x) -#endif - -void -NdbOperation::initInterpreter(){ - theFirstLabel = NULL; - theLastLabel = NULL; - theFirstBranch = NULL; - theLastBranch = NULL; - - theFirstCall = NULL; - theLastCall = NULL; - theFirstSubroutine = NULL; - theLastSubroutine = NULL; - - theNoOfLabels = 0; - theNoOfSubroutines = 0; - - theSubroutineSize = 0; - theInitialReadSize = 0; - theInterpretedSize = 0; - theFinalUpdateSize = 0; - theFinalReadSize = 0; - theInterpretIndicator = 1; - - theTotalCurrAI_Len = 5; -} - -int -NdbOperation::incCheck(const NdbColumnImpl* tNdbColumnImpl) -{ - if ((theInterpretIndicator == 1)) { - if ((tNdbColumnImpl == NULL) || - (theOperationType == OpenScanRequest || - theOperationType == OpenRangeScanRequest)) - goto inc_check_error1; - if ((tNdbColumnImpl->getInterpretableType() != true) || - (tNdbColumnImpl->m_pk != false) || - (tNdbColumnImpl->m_nullable)) - goto inc_check_error2; - if (theStatus == ExecInterpretedValue) { - ; // Simply continue with interpretation - } else if (theStatus == GetValue) { - theInitialReadSize = theTotalCurrAI_Len - 5; - theStatus = ExecInterpretedValue; - } else if (theStatus == SubroutineExec) { - ; // Simply continue with interpretation - } else { - setErrorCodeAbort(4231); - return -1; - } - return tNdbColumnImpl->m_attrId; - } else { - if (theNdbCon->theCommitStatus == NdbTransaction::Started) - setErrorCodeAbort(4200); - } - return -1; - - inc_check_error1: - if (theOperationType == OpenScanRequest || - theOperationType == OpenRangeScanRequest) { - setErrorCodeAbort(4228); - return -1; - } - setErrorCodeAbort(4004); - return -1; - - inc_check_error2: - if (tNdbColumnImpl->m_pk){ - setErrorCodeAbort(4202); - return -1; - }//if - if (!tNdbColumnImpl->getInterpretableType()){ - setErrorCodeAbort(4217); - return -1; - }//if - if (tNdbColumnImpl->m_nullable){ - setErrorCodeAbort(4218); - return -1; - }//if - setErrorCodeAbort(4219); - return -1; -} - -int -NdbOperation::write_attrCheck(const NdbColumnImpl* tNdbColumnImpl) -{ - if ((theInterpretIndicator == 1)) { - if ((tNdbColumnImpl == NULL) || - (theOperationType == OpenScanRequest || - theOperationType == OpenRangeScanRequest)) - goto write_attr_check_error1; - if ((tNdbColumnImpl->getInterpretableType() == false) || - (tNdbColumnImpl->m_pk)) - goto write_attr_check_error2; - if (theStatus == ExecInterpretedValue) { - ; // Simply continue with interpretation - } else if (theStatus == SubroutineExec) { - ; // Simply continue with interpretation - } else { - setErrorCodeAbort(4231); - return -1; - } - return tNdbColumnImpl->m_attrId; - } else { - if (theNdbCon->theCommitStatus == NdbTransaction::Started) - setErrorCodeAbort(4200); - } - return -1; - -write_attr_check_error1: - if (theOperationType == OpenScanRequest || - theOperationType == OpenRangeScanRequest) { - setErrorCodeAbort(4228); - return -1; - } - setErrorCodeAbort(4004); - return -1; - -write_attr_check_error2: - if (tNdbColumnImpl->m_pk) { - setErrorCodeAbort(4202); - return -1; - }//if - if (tNdbColumnImpl->getInterpretableType() == false){ - setErrorCodeAbort(4217); - return -1; - }//if - setErrorCodeAbort(4219); - return -1; -} - -int -NdbOperation::read_attrCheck(const NdbColumnImpl* tNdbColumnImpl) -{ - if ((theInterpretIndicator == 1)) { - if (tNdbColumnImpl == NULL) - goto read_attr_check_error1; - if (tNdbColumnImpl->getInterpretableType() == false) - goto read_attr_check_error2; - if (theStatus == ExecInterpretedValue) { - ; // Simply continue with interpretation - } else if (theStatus == GetValue) { - theInitialReadSize = theTotalCurrAI_Len - 5; - theStatus = ExecInterpretedValue; - } else if (theStatus == SubroutineExec) { - ; // Simply continue with interpretation - } else { - setErrorCodeAbort(4231); - return -1; - } - return tNdbColumnImpl->m_attrId; - } else { - if (theNdbCon->theCommitStatus == NdbTransaction::Started) - setErrorCodeAbort(4200); - } - return -1; - - read_attr_check_error1: - setErrorCodeAbort(4004); - return -1; - - read_attr_check_error2: - if (tNdbColumnImpl->getInterpretableType() == false) - setErrorCodeAbort(4217); - else - setErrorCodeAbort(4219); - return -1; - -} - -int -NdbOperation::initial_interpreterCheck() -{ - if ((theInterpretIndicator == 1)) { - if (theStatus == ExecInterpretedValue) { - return 0; // Simply continue with interpretation - } else if (theStatus == GetValue) { - theInitialReadSize = theTotalCurrAI_Len - 5; - theStatus = ExecInterpretedValue; - return 0; - } else if (theStatus == SubroutineExec) { - return 0; // Simply continue with interpretation - } else { - setErrorCodeAbort(4231); - return -1; - } - return 0; - } else { - if (theNdbCon->theCommitStatus == NdbTransaction::Started) - setErrorCodeAbort(4200); - } - return -1; -} - -int -NdbOperation::labelCheck() -{ - if ((theInterpretIndicator == 1)) { - if (theStatus == ExecInterpretedValue) { - return 0; // Simply continue with interpretation - } else if (theStatus == GetValue) { - theInitialReadSize = theTotalCurrAI_Len - 5; - theStatus = ExecInterpretedValue; - return 0; - } else if (theStatus == SubroutineExec) { - return 0; // Simply continue with interpretation - } else if (theStatus == SubroutineEnd) { - theStatus = SubroutineExec; - } else { - setErrorCodeAbort(4231); - return -1; - } - return 0; - } else { - if (theNdbCon->theCommitStatus == NdbTransaction::Started) - setErrorCodeAbort(4200); - } - return -1; -} - -int -NdbOperation::intermediate_interpreterCheck() -{ - if ((theInterpretIndicator == 1)) { - if (theStatus == ExecInterpretedValue) { - return 0; // Simply continue with interpretation - } else if (theStatus == SubroutineExec) { - return 0; // Simply continue with interpretation - } else { - setErrorCodeAbort(4231); - return -1; - } - return 0; - } else { - if (theNdbCon->theCommitStatus == NdbTransaction::Started) - setErrorCodeAbort(4200); - } - return -1; -} - -/***************************************************************************** - * int incValue(const char* anAttrName, char* aValue, Uint32 aValue) - * - * Return Value: Return 0 : incValue was succesful. - * Return -1: In all other case. - * Parameters: anAttrName : Attribute name where the attribute value - * will be save. - * aValue : The constant to increment the attribute value with. - *****************************************************************************/ -int -NdbOperation::incValue(const NdbColumnImpl* tNdbColumnImpl, Uint32 aValue) -{ - INT_DEBUG(("incValue32 %d %u", tNdbColumnImpl->m_attrId, aValue)); - int tAttrId; - - tAttrId = incCheck(tNdbColumnImpl); - if (tAttrId == -1) - goto incValue_error1; - -// Load Attribute into register 6 - - if (insertATTRINFO( Interpreter::Read(tAttrId, 6)) == -1) - goto incValue_error1; -// Load aValue into register 7 - if (aValue < 65536) - { - if (insertATTRINFO(Interpreter::LoadConst16(7, aValue)) == -1) - goto incValue_error1; - } else { - if (insertATTRINFO(Interpreter::LoadConst32(7)) == -1) - goto incValue_error1; - if (insertATTRINFO(aValue) == -1) - goto incValue_error1; - } - // Add register 6 and 7 and put result in register 7 - - if (insertATTRINFO( Interpreter::Add(7, 6, 7)) == -1) - goto incValue_error1; - if (insertATTRINFO( Interpreter::Write(tAttrId, 7)) == -1) - goto incValue_error1; - - theErrorLine++; - return 0; - -incValue_error1: - return -1; -} - -/***************************************************************************** - * int subValue(const char* anAttrName, char* aValue, Uint32 aValue) - * - * Return Value: Return 0 : incValue was succesful. - * Return -1: In all other case. - * Parameters: anAttrName : Attribute name where the attribute value - * will be save. - * aValue : The constant to increment the attribute value with. -******************************************************************************/ -int -NdbOperation::subValue(const NdbColumnImpl* tNdbColumnImpl, Uint32 aValue) -{ - INT_DEBUG(("subValue32 %d %u", tNdbColumnImpl->m_attrId, aValue)); - int tAttrId; - - tAttrId = incCheck(tNdbColumnImpl); - if (tAttrId == -1) - goto subValue_error1; - -// Load Attribute into register 6 - - if (insertATTRINFO( Interpreter::Read(tAttrId, 6)) == -1) - goto subValue_error1; -// Load aValue into register 7 - if (aValue < 65536) - { - if (insertATTRINFO( Interpreter::LoadConst16(7, aValue)) == -1) - goto subValue_error1; - } else { - if (insertATTRINFO( Interpreter::LoadConst32(7)) == -1) - goto subValue_error1; - if (insertATTRINFO(aValue) == -1) - goto subValue_error1; - } - // Subtract register 6 and 7 and put result in register 7 - - if (insertATTRINFO( Interpreter::Sub(7, 6, 7)) == -1) - goto subValue_error1; - if (insertATTRINFO( Interpreter::Write(tAttrId, 7)) == -1) - goto subValue_error1; - - theErrorLine++; - return 0; - - subValue_error1: - return -1; -} - -/****************************************************************************** - * int incValue(const char* anAttrName, char* aValue, Uint64 aValue) - * - * Return Value: Return 0 : incValue was succesful. - * Return -1: In all other case. - * Parameters: anAttrName : Attribute name where the attribute value will - * be save. - * aValue : The constant to increment the attribute value with. - *****************************************************************************/ -int -NdbOperation::incValue(const NdbColumnImpl* tNdbColumnImpl, Uint64 aValue) -{ - INT_DEBUG(("incValue64 %d %llu", tNdbColumnImpl->m_attrId, aValue)); - int tAttrId; - - tAttrId = incCheck(tNdbColumnImpl); - if (tAttrId == -1) - goto incValue_error1; - -// Load Attribute into register 6 - - if (insertATTRINFO( Interpreter::Read(tAttrId, 6)) == -1) - goto incValue_error1; -// Load aValue into register 7 - if (insertATTRINFO( Interpreter::LoadConst64(7)) == -1) - goto incValue_error1; - if (insertATTRINFOloop((Uint32*)&aValue, 2) == -1) - goto incValue_error1; - // Add register 6 and 7 and put result in register 7 - if (insertATTRINFO( Interpreter::Add(7, 6, 7)) == -1) - goto incValue_error1; - if (insertATTRINFO( Interpreter::Write(tAttrId, 7)) == -1) - goto incValue_error1; - - theErrorLine++; - return 0; - -incValue_error1: - return -1; -} - -/***************************************************************************** - * int subValue(const char* anAttrName, char* aValue, Uint64 aValue) - * - * Return Value: Return 0 : incValue was succesful. - * Return -1: In all other case. - * Parameters: anAttrName : Attribute name where the attribute value will - * be save. - * aValue : The constant to increment the attribute value with. -******************************************************************************/ -int -NdbOperation::subValue(const NdbColumnImpl* tNdbColumnImpl, Uint64 aValue) -{ - INT_DEBUG(("subValue64 %d %llu", tNdbColumnImpl->m_attrId, aValue)); - int tAttrId; - - tAttrId = incCheck(tNdbColumnImpl); - if (tAttrId == -1) - goto subValue_error1; - -// Load Attribute into register 6 - - if (insertATTRINFO( Interpreter::Read(6, tAttrId)) == -1) - goto subValue_error1; -// Load aValue into register 7 - if (insertATTRINFO( Interpreter::LoadConst64(7)) == -1) - goto subValue_error1; - if (insertATTRINFOloop((Uint32*)&aValue, 2) == -1) - goto subValue_error1; -// Subtract register 6 and 7 and put result in register 7 - if (insertATTRINFO( Interpreter::Sub(7, 6, 7)) == -1) - goto subValue_error1; - if (insertATTRINFO( Interpreter::Write(tAttrId, 7)) == -1) - goto subValue_error1; - - theErrorLine++; - return 0; - -subValue_error1: - return -1; -} - -/***************************************************************************** - * int NdbOperation::def_label() - *****************************************************************************/ -int -NdbOperation::def_label(int tLabelNo) -{ - INT_DEBUG(("def_label %d", tLabelNo)); - Uint32 tLabelIndex; - if (labelCheck() == -1) - return -1; - - tLabelIndex = theNoOfLabels - ((theNoOfLabels >> 4) << 4); - if (tLabelIndex == 0) - { - NdbLabel* tNdbLabel = theNdb->getNdbLabel(); - if (tNdbLabel == NULL) - { - setErrorCodeAbort(4000); - return -1; - } - if (theFirstLabel == NULL) - theFirstLabel = tNdbLabel; - else - theLastLabel->theNext = tNdbLabel; - - theLastLabel = tNdbLabel; - tNdbLabel->theNext = NULL; - } - - /** - * Here we set the address that the label should point to (jump address), - * the first 5 words are excluded since they are length specifications and - * not part of the data. - * We need to add 1 to the current ATTRINFO length since the last inserted - * item is not where we want to jump to. - * Later on we will update the branch items with this address, this is done in - * the NdbOperation::prepareSendInterpreted method. - */ - - theLastLabel->theLabelNo[tLabelIndex] = tLabelNo; - theLastLabel->theLabelAddress[tLabelIndex] = (theTotalCurrAI_Len + 1) - (theInitialReadSize + 5); - theLastLabel->theSubroutine[tLabelIndex] = theNoOfSubroutines; - theNoOfLabels++; - theErrorLine++; - return (theNoOfLabels - 1); -} - -/************************************************************************************************ -int NdbOperation::def_subroutine() - -************************************************************************************************/ -int -NdbOperation::def_subroutine(int tSubNo) -{ - INT_DEBUG(("def_subroutine %d", tSubNo)); - Uint32 tSubroutineIndex; - - if (theInterpretIndicator != 1) - { - setErrorCodeAbort(4200); - return -1; - } - - if (int(theNoOfSubroutines) != tSubNo) - { - setErrorCodeAbort(4227); - return -1; - } - if (theStatus == FinalGetValue) - { - theFinalReadSize = theTotalCurrAI_Len - - (theInitialReadSize + theInterpretedSize + - theFinalUpdateSize + 5); - - } else if (theStatus == SubroutineEnd) - { - ; // Correct Status, last call was ret_sub() - } else if (theStatus == ExecInterpretedValue) - { - if (insertATTRINFO(Interpreter::EXIT_OK) == -1) - return -1; - theInterpretedSize = theTotalCurrAI_Len - (theInitialReadSize + 5); - } else if (theStatus == SetValueInterpreted) - { - theFinalUpdateSize = theTotalCurrAI_Len - - (theInitialReadSize + theInterpretedSize + 5); - - } else if (theStatus == GetValue) - { - - theInitialReadSize = theTotalCurrAI_Len - 5; - - } else - { - setErrorCodeAbort(4200); - return -1; - } - theStatus = SubroutineExec; - tSubroutineIndex = theNoOfSubroutines - ((theNoOfSubroutines >> 4) << 4); - if (tSubroutineIndex == 0) - { - NdbSubroutine* tNdbSubroutine = theNdb->getNdbSubroutine(); - if (tNdbSubroutine == NULL) - { - setErrorCodeAbort(4000); - return -1; - } - if (theFirstSubroutine == NULL) - theFirstSubroutine = tNdbSubroutine; - else - theLastSubroutine->theNext = tNdbSubroutine; - - theLastSubroutine = tNdbSubroutine; - tNdbSubroutine->theNext = NULL; - } - theLastSubroutine->theSubroutineAddress[tSubroutineIndex] = theTotalCurrAI_Len - - (theInitialReadSize + theInterpretedSize + - theFinalUpdateSize + theFinalReadSize); - theNoOfSubroutines++; - theErrorLine++; - return (theNoOfSubroutines - 1); -} - -/************************************************************************************************ -int NdbOperation::add_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest) - -************************************************************************************************/ -int -NdbOperation::add_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest) -{ - INT_DEBUG(("add_reg %u %u %u", RegSource1, RegSource2, RegDest)); - if (intermediate_interpreterCheck() == -1) - return -1; - - if (RegSource1 >= 8) - { - setErrorCodeAbort(4229); - return -1; - } - if (RegSource2 >= 8) - { - setErrorCodeAbort(4229); - return -1; - } - if (RegDest >= 8) - { - setErrorCodeAbort(4229); - return -1; - } - if (insertATTRINFO( Interpreter::Add(RegDest, RegSource1, RegSource2)) == -1) - return -1; - theErrorLine++; - return 0; -} - -/************************************************************************************************ -int NdbOperation::sub_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest) - -************************************************************************************************/ -int -NdbOperation::sub_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest) -{ - INT_DEBUG(("sub_reg %u %u %u", RegSource1, RegSource2, RegDest)); - if (intermediate_interpreterCheck() == -1) - return -1; - - if (RegSource1 >= 8) - { - setErrorCodeAbort(4229); - return -1; - } - if (RegSource2 >= 8) - { - setErrorCodeAbort(4229); - return -1; - } - if (RegDest >= 8) - { - setErrorCodeAbort(4229); - return -1; - } - if (insertATTRINFO( Interpreter::Sub(RegDest, RegSource1, RegSource2)) == -1) - return -1; - theErrorLine++; - return 0; -} - -/************************************************************************************************ -int NdbOperation::load_const_u32(Uint32 RegDest, Uint32 Constant) - -************************************************************************************************/ -int -NdbOperation::load_const_u32(Uint32 RegDest, Uint32 Constant) -{ - INT_DEBUG(("load_const_u32 %u %u", RegDest, Constant)); - if (initial_interpreterCheck() == -1) - goto l_u32_error1; - if (RegDest >= 8) - goto l_u32_error2; - if (insertATTRINFO( Interpreter::LoadConst32(RegDest)) == -1) - goto l_u32_error1; - if (insertATTRINFO(Constant) == -1) - goto l_u32_error1; - theErrorLine++; - return 0; - - l_u32_error1: - return -1; - - l_u32_error2: - setErrorCodeAbort(4229); - return -1; -} - -/************************************************************************************************ -int NdbOperation::load_const_u64(Uint32 RegDest, Uint64 Constant) - -************************************************************************************************/ -int -NdbOperation::load_const_u64(Uint32 RegDest, Uint64 Constant) -{ - INT_DEBUG(("load_const_u64 %u %llu", RegDest, Constant)); - if (initial_interpreterCheck() == -1) - return -1; - if (RegDest >= 8) - { - setErrorCodeAbort(4229); - return -1; - } - - // 64 bit value - if (insertATTRINFO( Interpreter::LoadConst64(RegDest)) == -1) - return -1; - if (insertATTRINFOloop((Uint32*)&Constant, 2) == -1) - return -1; - theErrorLine++; - return 0; -} - -/************************************************************************************************ -int NdbOperation::load_const_null(Uint32 RegDest) - -************************************************************************************************/ -int -NdbOperation::load_const_null(Uint32 RegDest) -{ - INT_DEBUG(("load_const_null %u", RegDest)); - if (initial_interpreterCheck() == -1) - return -1; - if (RegDest >= 8) - { - setErrorCodeAbort(4229); - return -1; - } - if (insertATTRINFO( Interpreter::LOAD_CONST_NULL) == -1) - return -1; - theErrorLine++; - return 0; -} - -/************************************************************************************************ -int NdbOperation::read_attr(const char* anAttrName, Uint32 RegDest) - -************************************************************************************************/ -int -NdbOperation::read_attr(const NdbColumnImpl* anAttrObject, Uint32 RegDest) -{ - INT_DEBUG(("read_attr %d %u", anAttrObject->m_attrId, RegDest)); - if (initial_interpreterCheck() == -1) - return -1; - - int tAttrId = read_attrCheck(anAttrObject); - if (tAttrId == -1) - goto read_attr_error1; - if (RegDest >= 8) - goto read_attr_error2; - if (insertATTRINFO( Interpreter::Read(tAttrId, RegDest)) != -1) { - return 0; - theErrorLine++; - }//if - return -1; - -read_attr_error1: - return -1; - -read_attr_error2: - setErrorCodeAbort(4229); - return -1; -} - -/************************************************************************************************ -int NdbOperation::write_attr(const char* anAttrName, Uint32 RegSource) - -************************************************************************************************/ -int -NdbOperation::write_attr(const NdbColumnImpl* anAttrObject, Uint32 RegSource) -{ - INT_DEBUG(("write_attr %d %u", anAttrObject->m_attrId, RegSource)); - int tAttrId = write_attrCheck(anAttrObject); - if (tAttrId == -1) - return -1; - if (insertATTRINFO( Interpreter::Write(tAttrId, RegSource)) == -1) - return -1; - theErrorLine++; - return 0; -} - -int -NdbOperation::branch_reg_reg(Uint32 type, - Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) -{ - if (intermediate_interpreterCheck() == -1) - return -1; - if (insertATTRINFO(Interpreter::Branch(type, RegLvalue, RegRvalue)) == -1) - return -1; - if (insertBranch(Label) == -1) - return -1; - theErrorLine++; - return 0; -} - -int -NdbOperation::branch_ge(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) -{ - INT_DEBUG(("branch_ge %u %u %u", RegLvalue, RegRvalue, Label)); - return branch_reg_reg(Interpreter::BRANCH_GE_REG_REG, - RegLvalue, RegRvalue, Label); -} - -int -NdbOperation::branch_gt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) -{ - INT_DEBUG(("branch_gt %u %u %u", RegLvalue, RegRvalue, Label)); - return branch_reg_reg(Interpreter::BRANCH_GT_REG_REG, - RegLvalue, RegRvalue, Label); -} - -int -NdbOperation::branch_le(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) -{ - INT_DEBUG(("branch_le %u %u %u", RegLvalue, RegRvalue, Label)); - return branch_reg_reg(Interpreter::BRANCH_LE_REG_REG, - RegLvalue, RegRvalue, Label); -} - -int -NdbOperation::branch_lt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) -{ - INT_DEBUG(("branch_lt %u %u %u", RegLvalue, RegRvalue, Label)); - return branch_reg_reg(Interpreter::BRANCH_LT_REG_REG, - RegLvalue, RegRvalue, Label); -} - -int -NdbOperation::branch_eq(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) -{ - INT_DEBUG(("branch_eq %u %u %u", RegLvalue, RegRvalue, Label)); - return branch_reg_reg(Interpreter::BRANCH_EQ_REG_REG, - RegLvalue, RegRvalue, Label); -} - -int -NdbOperation::branch_ne(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) -{ - INT_DEBUG(("branch_ne %u %u %u", RegLvalue, RegRvalue, Label)); - return branch_reg_reg(Interpreter::BRANCH_NE_REG_REG, - RegLvalue, RegRvalue, Label); -} - -int -NdbOperation::branch_ne_null(Uint32 RegLvalue, Uint32 Label) -{ - INT_DEBUG(("branch_ne_null %u %u", RegLvalue, Label)); - if (intermediate_interpreterCheck() == -1) - return -1; - if (insertATTRINFO((RegLvalue << 6) + Interpreter::BRANCH_REG_NE_NULL) == -1) - return -1; - if (insertBranch(Label) == -1) - return -1; - theErrorLine++; - return 0; -} - -int -NdbOperation::branch_eq_null(Uint32 RegLvalue, Uint32 Label) -{ - INT_DEBUG(("branch_eq_null %u %u", RegLvalue, Label)); - if (intermediate_interpreterCheck() == -1) - return -1; - if (insertATTRINFO((RegLvalue << 6) + Interpreter::BRANCH_REG_EQ_NULL) == -1) - return -1; - if (insertBranch(Label) == -1) - return -1; - theErrorLine++; - return 0; -} - -int -NdbOperation::branch_label(Uint32 Label) -{ - INT_DEBUG(("branch_label %u", Label)); - if (initial_interpreterCheck() == -1) - return -1; - if (insertATTRINFO(Interpreter::BRANCH) == -1) - return -1; - if (insertBranch(Label) == -1) - return -1; - theErrorLine++; - return 0; -} - -/************************************************************************************************ -int NdbOperation::interpret_exit_ok() - -************************************************************************************************/ -int -NdbOperation::interpret_exit_ok() -{ - INT_DEBUG(("interpret_exit_ok")); - if (initial_interpreterCheck() == -1) - return -1; - if (insertATTRINFO(Interpreter::EXIT_OK) == -1) - return -1; - theErrorLine++; - return 0; -} - -int -NdbOperation::interpret_exit_last_row() -{ - INT_DEBUG(("interpret_exit_last_row")); - if (initial_interpreterCheck() == -1) - return -1; - if (insertATTRINFO(Interpreter::EXIT_OK_LAST) == -1) - return -1; - theErrorLine++; - return 0; -} - -/************************************************************************************************ -int NdbOperation::interpret_exit_nok(Uint32 ErrorCode) - -************************************************************************************************/ -int -NdbOperation::interpret_exit_nok(Uint32 ErrorCode) -{ - INT_DEBUG(("interpret_exit_nok %u", ErrorCode)); - if (initial_interpreterCheck() == -1) - return -1; - if (insertATTRINFO( (ErrorCode << 16) + Interpreter::EXIT_REFUSE) == -1) - return -1; - theErrorLine++; - return 0; -} - -int -NdbOperation::interpret_exit_nok() -{ - INT_DEBUG(("interpret_exit_nok")); - Uint32 ErrorCode = 899; - - if (initial_interpreterCheck() == -1) - return -1; - if (insertATTRINFO( (ErrorCode << 16) + Interpreter::EXIT_REFUSE) == -1) - return -1; - theErrorLine++; - return 0; -} - -int -NdbOperation::call_sub(Uint32 Subroutine) -{ - INT_DEBUG(("call_sub %u", Subroutine)); - if (initial_interpreterCheck() == -1) - return -1; - if (insertATTRINFO( (Subroutine << 16) + Interpreter::CALL) == -1) - return -1; - if (insertCall(Subroutine) == -1) - return -1; - theErrorLine++; - return 0; -} - -int -NdbOperation::ret_sub() -{ - INT_DEBUG(("ret_sub")); - if (theInterpretIndicator != 1) - { - setErrorCodeAbort(4200); - return -1; - } - if (theStatus == SubroutineExec) - { - ; // Simply continue with interpretation - } else - { - setErrorCodeAbort(4200); - return -1; - } - if (insertATTRINFO(Interpreter::RETURN) == -1) - return -1; - theStatus = SubroutineEnd; - theErrorLine++; - return 0; -} - -int -NdbOperation::insertBranch(Uint32 aLabel) -{ - Uint32 tAddress; - NdbBranch* tBranch = theNdb->getNdbBranch(); - if (tBranch == NULL) - goto insertBranch_error1; - if (theFirstBranch == NULL) - theFirstBranch = tBranch; - else - theLastBranch->theNext = tBranch; - theLastBranch = tBranch; - if (theNoOfSubroutines == 0) - tAddress = theTotalCurrAI_Len - - (theInitialReadSize + 5); - else - tAddress = theTotalCurrAI_Len - - (theInitialReadSize + theInterpretedSize + - theFinalUpdateSize + theFinalReadSize + 5); - - tBranch->theBranchAddress = tAddress; - tBranch->theSignal = theCurrentATTRINFO; - tBranch->theSignalAddress = theAI_LenInCurrAI; // + 1; theAI_LenInCurrAI has already been updated in - tBranch->theSubroutine = theNoOfSubroutines; // insertATTRINFO which was done before insertBranch!! - tBranch->theBranchLabel = aLabel; - return 0; - -insertBranch_error1: - setErrorCodeAbort(4000); - return -1; -} - -int -NdbOperation::insertCall(Uint32 aCall) -{ - NdbCall* tCall = theNdb->getNdbCall(); - if (tCall == NULL) - { - setErrorCodeAbort(4000); - return -1; - } - if (theFirstCall == NULL) - theFirstCall = tCall; - else - theLastCall->theNext = tCall; - theLastCall = tCall; - - tCall->theSignal = theCurrentATTRINFO; - tCall->theSignalAddress = theAI_LenInCurrAI; - tCall->theSubroutine = aCall; - return 0; -} - -int -NdbOperation::branch_col(Uint32 type, - Uint32 ColId, const void * val, Uint32 len, - bool nopad, Uint32 Label){ - - DBUG_ENTER("NdbOperation::branch_col"); - DBUG_PRINT("enter", ("type=%u col=%u val=0x%x len=%u label=%u", - type, ColId, val, len, Label)); - if (val != NULL) - DBUG_DUMP("value", (char*)val, len); - - if (initial_interpreterCheck() == -1) - DBUG_RETURN(-1); - - Interpreter::BinaryCondition c = (Interpreter::BinaryCondition)type; - - const NdbColumnImpl * col = - m_currentTable->getColumn(ColId); - - if(col == 0){ - abort(); - } - - if (val == NULL) - len = 0; - else { - if (! col->getStringType()) { - // prevent assert in NdbSqlUtil on length error - Uint32 sizeInBytes = col->m_attrSize * col->m_arraySize; - if (len != 0 && len != sizeInBytes) - { - setErrorCodeAbort(4209); - DBUG_RETURN(-1); - } - len = sizeInBytes; - } - } - - Uint32 tempData[2000]; - if (((UintPtr)val & 3) != 0) { - memcpy(tempData, val, len); - val = tempData; - } - - if (insertATTRINFO(Interpreter::BranchCol(c, 0, 0, false)) == -1) - DBUG_RETURN(-1); - - if (insertBranch(Label) == -1) - DBUG_RETURN(-1); - - if (insertATTRINFO(Interpreter::BranchCol_2(ColId, len))) - DBUG_RETURN(-1); - - Uint32 len2 = Interpreter::mod4(len); - if(len2 == len){ - insertATTRINFOloop((Uint32*)val, len2 >> 2); - } else { - len2 -= 4; - insertATTRINFOloop((Uint32*)val, len2 >> 2); - Uint32 tmp = 0; - for (Uint32 i = 0; i < len-len2; i++) { - char* p = (char*)&tmp; - p[i] = ((char*)val)[len2+i]; - } - insertATTRINFO(tmp); - } - - theErrorLine++; - DBUG_RETURN(0); -} - -int -NdbOperation::branch_col_eq(Uint32 ColId, const void * val, Uint32 len, - bool nopad, Uint32 Label){ - INT_DEBUG(("branch_col_eq %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); - return branch_col(Interpreter::EQ, ColId, val, len, nopad, Label); -} - -int -NdbOperation::branch_col_ne(Uint32 ColId, const void * val, Uint32 len, - bool nopad, Uint32 Label){ - INT_DEBUG(("branch_col_ne %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); - return branch_col(Interpreter::NE, ColId, val, len, nopad, Label); -} -int -NdbOperation::branch_col_lt(Uint32 ColId, const void * val, Uint32 len, - bool nopad, Uint32 Label){ - INT_DEBUG(("branch_col_lt %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); - return branch_col(Interpreter::LT, ColId, val, len, nopad, Label); -} -int -NdbOperation::branch_col_le(Uint32 ColId, const void * val, Uint32 len, - bool nopad, Uint32 Label){ - INT_DEBUG(("branch_col_le %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); - return branch_col(Interpreter::LE, ColId, val, len, nopad, Label); -} -int -NdbOperation::branch_col_gt(Uint32 ColId, const void * val, Uint32 len, - bool nopad, Uint32 Label){ - INT_DEBUG(("branch_col_gt %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); - return branch_col(Interpreter::GT, ColId, val, len, nopad, Label); -} - -int -NdbOperation::branch_col_ge(Uint32 ColId, const void * val, Uint32 len, - bool nopad, Uint32 Label){ - INT_DEBUG(("branch_col_ge %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); - return branch_col(Interpreter::GE, ColId, val, len, nopad, Label); -} - -int -NdbOperation::branch_col_like(Uint32 ColId, const void * val, Uint32 len, - bool nopad, Uint32 Label){ - INT_DEBUG(("branch_col_like %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); - return branch_col(Interpreter::LIKE, ColId, val, len, nopad, Label); -} - -int -NdbOperation::branch_col_notlike(Uint32 ColId, const void * val, Uint32 len, - bool nopad, Uint32 Label){ - INT_DEBUG(("branch_col_notlike %u %.*s(%u,%d) -> %u", ColId,len,val,len,nopad,Label)); - return branch_col(Interpreter::NOT_LIKE, ColId, val, len, nopad, Label); -} - -int -NdbOperation::branch_col_null(Uint32 type, Uint32 ColId, Uint32 Label){ - - if (initial_interpreterCheck() == -1) - return -1; - - if (insertATTRINFO(type) == -1) - return -1; - - if (insertBranch(Label) == -1) - return -1; - - if (insertATTRINFO(Interpreter::BranchCol_2(ColId))) - return -1; - - theErrorLine++; - return 0; -} - -int -NdbOperation::branch_col_eq_null(Uint32 ColId, Uint32 Label){ - - INT_DEBUG(("branch_col_eq_null %u -> %u", ColId, Label)); - return branch_col_null(Interpreter::BRANCH_ATTR_EQ_NULL, ColId, Label); -} - -int -NdbOperation::branch_col_ne_null(Uint32 ColId, Uint32 Label){ - - INT_DEBUG(("branch_col_ne_null %u -> %u", ColId, Label)); - return branch_col_null(Interpreter::BRANCH_ATTR_NE_NULL, ColId, Label); -} - diff --git a/ndb/src/ndbapi/NdbOperationScan.cpp b/ndb/src/ndbapi/NdbOperationScan.cpp deleted file mode 100644 index 283eb591bdb..00000000000 --- a/ndb/src/ndbapi/NdbOperationScan.cpp +++ /dev/null @@ -1,16 +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 */ - diff --git a/ndb/src/ndbapi/NdbOperationSearch.cpp b/ndb/src/ndbapi/NdbOperationSearch.cpp deleted file mode 100644 index 06d8ddd412b..00000000000 --- a/ndb/src/ndbapi/NdbOperationSearch.cpp +++ /dev/null @@ -1,592 +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 */ - - -/****************************************************************************** -Name: NdbOperationSearch.C -Include: -Link: -Author: UABMNST Mona Natterkvist UAB/B/SD -Date: 970829 -Version: 0.1 -Description: Interface between TIS and NDB -Documentation: -Adjust: 971022 UABMNST First version. - 971206 UABRONM - *****************************************************************************/ -#include "API.hpp" - -#include <NdbOperation.hpp> -#include "NdbApiSignal.hpp" -#include <NdbTransaction.hpp> -#include <Ndb.hpp> -#include "NdbImpl.hpp" -#include <NdbOut.hpp> - -#include <AttributeHeader.hpp> -#include <signaldata/TcKeyReq.hpp> -#include <signaldata/KeyInfo.hpp> -#include "NdbDictionaryImpl.hpp" -#include <md5_hash.hpp> - -/****************************************************************************** -CondIdType equal(const char* anAttrName, char* aValue, Uint32 aVarKeylen); - -Return Value Return 0 : Equal was successful. - Return -1: In all other case. -Parameters: anAttrName : Attribute name for search condition.. - aValue : Referense to the search value. - aVariableKeylen : The length of key in bytes -Remark: Defines search condition with equality anAttrName. -******************************************************************************/ -int -NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo, - const char* aValuePassed, - Uint32 aVariableKeyLen) -{ - DBUG_ENTER("NdbOperation::equal_impl"); - DBUG_PRINT("enter", ("col=%s op=%d val=0x%x len=%u", - tAttrInfo->m_name.c_str(), - theOperationType, - aValuePassed, aVariableKeyLen)); - if (aValuePassed != NULL) - DBUG_DUMP("value", (char*)aValuePassed, aVariableKeyLen); - - register Uint32 tAttrId; - - Uint32 tData; - Uint32 tKeyInfoPosition; - const char* aValue = aValuePassed; - Uint64 tempData[512]; - - if ((theStatus == OperationDefined) && - (aValue != NULL) && - (tAttrInfo != NULL )) { -/****************************************************************************** - * Start by checking that the attribute is a tuple key. - * This value is also the word order in the tuple key of this - * tuple key attribute. - * Then check that this tuple key has not already been defined. - * Finally check if all tuple key attributes have been defined. If - * this is true then set Operation state to tuple key defined. - *****************************************************************************/ - tAttrId = tAttrInfo->m_attrId; - tKeyInfoPosition = tAttrInfo->m_keyInfoPos; - bool tDistrKey = tAttrInfo->m_distributionKey; - - Uint32 i = 0; - if (tAttrInfo->m_pk) { - Uint32 tKeyDefined = theTupleKeyDefined[0][2]; - Uint32 tKeyAttrId = theTupleKeyDefined[0][0]; - do { - if (tKeyDefined == false) { - goto keyEntryFound; - } else { - if (tKeyAttrId != tAttrId) { - /****************************************************************** - * We read the key defined variable in advance. - * It could potentially read outside its area when - * i = MAXNROFTUPLEKEY - 1, - * it is not a problem as long as the variable - * theTupleKeyDefined is defined - * in the middle of the object. - * Reading wrong data and not using it causes no problems. - *****************************************************************/ - i++; - tKeyAttrId = theTupleKeyDefined[i][0]; - tKeyDefined = theTupleKeyDefined[i][2]; - continue; - } else { - goto equal_error2; - }//if - }//if - } while (i < NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY); - goto equal_error2; - } else { - goto equal_error1; - } - /************************************************************************* - * Now it is time to retrieve the tuple key data from the pointer supplied - * by the application. - * We have to retrieve the size of the attribute in words and bits. - *************************************************************************/ - keyEntryFound: - theTupleKeyDefined[i][0] = tAttrId; - theTupleKeyDefined[i][1] = tKeyInfoPosition; - theTupleKeyDefined[i][2] = true; - - OperationType tOpType = theOperationType; - Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize; - - { - /************************************************************************ - * Check if the pointer of the value passed is aligned on a 4 byte - * boundary. If so only assign the pointer to the internal variable - * aValue. If it is not aligned then we start by copying the value to - * tempData and use this as aValue instead. - ***********************************************************************/ - const int attributeSize = sizeInBytes; - const int slack = sizeInBytes & 3; - const int align = UintPtr(aValue) & 7; - - if (((align & 3) != 0) || (slack != 0) || (tDistrKey && (align != 0))) - { - ((Uint32*)tempData)[attributeSize >> 2] = 0; - memcpy(&tempData[0], aValue, attributeSize); - aValue = (char*)&tempData[0]; - }//if - } - - Uint32 totalSizeInWords = (sizeInBytes + 3)/4; // Inc. bits in last word - - if (true){ //tArraySize != 0) { - Uint32 tTupKeyLen = theTupKeyLen; - - theTupKeyLen = tTupKeyLen + totalSizeInWords; - if ((aVariableKeyLen == sizeInBytes) || - (aVariableKeyLen == 0)) { - ; - } else { - goto equal_error3; - } - } -#if 0 - else { - /************************************************************************ - * The attribute is a variable array. We need to use the length parameter - * to know the size of this attribute in the key information and - * variable area. A key is however not allowed to be larger than 4 - * kBytes and this is checked for variable array attributes - * used as keys. - ************************************************************************/ - Uint32 tMaxVariableKeyLenInWord = (MAXTUPLEKEYLENOFATTERIBUTEINWORD - - tKeyInfoPosition); - tAttrSizeInBits = aVariableKeyLen << 3; - tAttrSizeInWords = tAttrSizeInBits >> 5; - tAttrBitsInLastWord = tAttrSizeInBits - (tAttrSizeInWords << 5); - tAttrLenInWords = ((tAttrSizeInBits + 31) >> 5); - if (tAttrLenInWords > tMaxVariableKeyLenInWord) { - setErrorCodeAbort(4207); - return -1; - }//if - theTupKeyLen = theTupKeyLen + tAttrLenInWords; - }//if -#endif - - /************************************************************************** - * If the operation is an insert request and the attribute is stored then - * we also set the value in the stored part through putting the - * information in the ATTRINFO signals. - *************************************************************************/ - if ((tOpType == InsertRequest) || - (tOpType == WriteRequest)) { - Uint32 ahValue; - const Uint32 sz = totalSizeInWords; - - // XXX - if(m_accessTable == m_currentTable) - { - AttributeHeader::init(&ahValue, tAttrId, sz); - } - else - { - assert(m_accessTable->m_index); - int attr_id_current_table = - m_accessTable->m_index->m_columns[tAttrId]->m_keyInfoPos; - AttributeHeader::init(&ahValue, attr_id_current_table, sz); - } - - insertATTRINFO( ahValue ); - insertATTRINFOloop((Uint32*)aValue, sz); - }//if - - /************************************************************************** - * Store the Key information in the TCKEYREQ and KEYINFO signals. - *************************************************************************/ - if (insertKEYINFO(aValue, tKeyInfoPosition, totalSizeInWords) != -1) { - /************************************************************************ - * Add one to number of tuple key attributes defined. - * If all have been defined then set the operation state to indicate - * that tuple key is defined. - * Thereby no more search conditions are allowed in this version. - ***********************************************************************/ - Uint32 tNoKeysDef = theNoOfTupKeyLeft - 1; - Uint32 tErrorLine = theErrorLine; - unsigned char tInterpretInd = theInterpretIndicator; - theNoOfTupKeyLeft = tNoKeysDef; - tErrorLine++; - theErrorLine = tErrorLine; - - if (tNoKeysDef == 0) { - if (tOpType == UpdateRequest) { - if (tInterpretInd == 1) { - theStatus = GetValue; - } else { - theStatus = SetValue; - }//if - DBUG_RETURN(0); - } else if ((tOpType == ReadRequest) || (tOpType == DeleteRequest) || - (tOpType == ReadExclusive)) { - theStatus = GetValue; - // create blob handles automatically - if (tOpType == DeleteRequest && m_currentTable->m_noOfBlobs != 0) { - for (unsigned i = 0; i < m_currentTable->m_columns.size(); i++) { - NdbColumnImpl* c = m_currentTable->m_columns[i]; - assert(c != 0); - if (c->getBlobType()) { - if (getBlobHandle(theNdbCon, c) == NULL) - DBUG_RETURN(-1); - } - } - } - DBUG_RETURN(0); - } else if ((tOpType == InsertRequest) || (tOpType == WriteRequest)) { - theStatus = SetValue; - DBUG_RETURN(0); - } else { - setErrorCodeAbort(4005); - DBUG_RETURN(-1); - }//if - DBUG_RETURN(0); - }//if - } else { - DBUG_RETURN(-1); - }//if - DBUG_RETURN(0); - } - - if (aValue == NULL) { - // NULL value in primary key - setErrorCodeAbort(4505); - DBUG_RETURN(-1); - }//if - - if ( tAttrInfo == NULL ) { - // Attribute name not found in table - setErrorCodeAbort(4004); - DBUG_RETURN(-1); - }//if - - if (theStatus == GetValue || theStatus == SetValue){ - // All pk's defined - setErrorCodeAbort(4225); - DBUG_RETURN(-1); - }//if - - ndbout_c("theStatus: %d", theStatus); - - // If we come here, set a general errorcode - // and exit - setErrorCodeAbort(4200); - DBUG_RETURN(-1); - - equal_error1: - setErrorCodeAbort(4205); - DBUG_RETURN(-1); - - equal_error2: - setErrorCodeAbort(4206); - DBUG_RETURN(-1); - - equal_error3: - setErrorCodeAbort(4209); - DBUG_RETURN(-1); -} - -/****************************************************************************** - * int insertKEYINFO(const char* aValue, aStartPosition, - * anAttrSizeInWords, Uint32 anAttrBitsInLastWord); - * - * Return Value: Return 0 : insertKEYINFO was succesful. - * Return -1: In all other case. - * Parameters: aValue: the data to insert into KEYINFO. - * aStartPosition : Start position for Tuplekey in - * KEYINFO (TCKEYREQ). - * aKeyLenInByte : Length of tuplekey or part of tuplekey - * anAttrBitsInLastWord : Nr of bits in last word. - * Remark: Puts the the data into either TCKEYREQ signal - * or KEYINFO signal. - *****************************************************************************/ -int -NdbOperation::insertKEYINFO(const char* aValue, - register Uint32 aStartPosition, - register Uint32 anAttrSizeInWords) -{ - NdbApiSignal* tSignal; - NdbApiSignal* tCurrentKEYINFO; - //register NdbApiSignal* tTCREQ = theTCREQ; - register Uint32 tAttrPos; - Uint32 tPosition; - Uint32 tEndPos; - Uint32 tPos; - Uint32 signalCounter; - Uint32 tData; - -/***************************************************************************** - * Calculate the end position of the attribute in the key information. * - * Since the first attribute starts at position one we need to subtract * - * one to get the correct end position. * - * We must also remember the last word with only partial information. * - *****************************************************************************/ - tEndPos = aStartPosition + anAttrSizeInWords - 1; - - if ((tEndPos < 9)) { - register Uint32 tkeyData = *(Uint32*)aValue; - //TcKeyReq* tcKeyReq = CAST_PTR(TcKeyReq, tTCREQ->getDataPtrSend()); - register Uint32* tDataPtr = (Uint32*)aValue; - tAttrPos = 1; - register Uint32* tkeyDataPtr = theKEYINFOptr + aStartPosition - 1; - // (Uint32*)&tcKeyReq->keyInfo[aStartPosition - 1]; - do { - tDataPtr++; - *tkeyDataPtr = tkeyData; - if (tAttrPos < anAttrSizeInWords) { - ; - } else { - return 0; - }//if - tkeyData = *tDataPtr; - tkeyDataPtr++; - tAttrPos++; - } while (1); - return 0; - }//if -/***************************************************************************** - * Allocate all the KEYINFO signals needed for this key before starting * - * to fill the signals with data. This simplifies error handling and * - * avoids duplication of code. * - *****************************************************************************/ - tAttrPos = 0; - signalCounter = 1; - while(tEndPos > theTotalNrOfKeyWordInSignal) - { - tSignal = theNdb->getSignal(); - if (tSignal == NULL) - { - setErrorCodeAbort(4000); - return -1; - } - if (tSignal->setSignal(m_keyInfoGSN) == -1) - { - setErrorCodeAbort(4001); - return -1; - } - if (theTCREQ->next() != NULL) - theLastKEYINFO->next(tSignal); - else - theTCREQ->next(tSignal); - - theLastKEYINFO = tSignal; - theLastKEYINFO->next(NULL); - theTotalNrOfKeyWordInSignal += 20; - } - -/***************************************************************************** - * Change to variable tPosition for more appropriate naming of rest of * - * the code. We must set up current KEYINFO already here if the last * - * word is a word which is set at LastWordLabel and at the same time * - * this is the first word in a KEYINFO signal. * - *****************************************************************************/ - tPosition = aStartPosition; - tCurrentKEYINFO = theTCREQ->next(); - -/***************************************************************************** - * Start by filling up Key information in the 8 words allocated in the * - * TC[KEY/INDX]REQ signal. * - *****************************************************************************/ - while (tPosition < 9) - { - theKEYINFOptr[tPosition-1] = * (Uint32*)(aValue + (tAttrPos << 2)); - tAttrPos++; - if (anAttrSizeInWords == tAttrPos) - goto LastWordLabel; - tPosition++; - } - -/***************************************************************************** - * We must set up the start position of the writing of Key information * - * before we start the writing of KEYINFO signals. If the start is not * - * the first word of the first KEYINFO signals then we must step forward* - * to the proper KEYINFO signal and set the signalCounter properly. * - * signalCounter is set to the actual position in the signal ( = 4 for * - * first key word in KEYINFO signal. * - *****************************************************************************/ - tPos = 8; - while ((tPosition - tPos) > 20) - { - tCurrentKEYINFO = tCurrentKEYINFO->next(); - tPos += 20; - } - signalCounter = tPosition - tPos + 3; - -/***************************************************************************** - * The loop that actually fills in the Key information into the KEYINFO * - * signals. Can be optimised by writing larger chunks than 4 bytes at a * - * time. * - *****************************************************************************/ - do - { - if (signalCounter > 23) - { - tCurrentKEYINFO = tCurrentKEYINFO->next(); - signalCounter = 4; - } - tCurrentKEYINFO->setData(*(Uint32*)(aValue + (tAttrPos << 2)), - signalCounter); - tAttrPos++; - if (anAttrSizeInWords == tAttrPos) - goto LastWordLabel; - tPosition++; - signalCounter++; - } while (1); - -LastWordLabel: - return 0; -} - -int -NdbOperation::getKeyFromTCREQ(Uint32* data, unsigned size) -{ - assert(m_accessTable != 0 && m_accessTable->m_keyLenInWords != 0); - assert(m_accessTable->m_keyLenInWords == size); - unsigned pos = 0; - while (pos < 8 && pos < size) { - data[pos] = theKEYINFOptr[pos]; - pos++; - } - NdbApiSignal* tSignal = theTCREQ->next(); - unsigned n = 0; - while (pos < size) { - if (n == 20) { - tSignal = tSignal->next(); - n = 0; - } - data[pos++] = tSignal->getDataPtrSend()[3 + n++]; - } - return 0; -} - -int -NdbOperation::handle_distribution_key(const Uint64* value, Uint32 len) -{ - if(theDistrKeyIndicator_ == 1 || - (theNoOfTupKeyLeft > 0 && m_accessTable->m_noOfDistributionKeys > 1)) - { - return 0; - } - - if(m_accessTable->m_noOfDistributionKeys == 1) - { - setPartitionHash(value, len); - } - else if(theTCREQ->readSignalNumber() == GSN_TCKEYREQ) - { - // No support for combined distribution key and scan - - /** - * Copy distribution key to linear memory - */ - NdbColumnImpl* const * cols = m_accessTable->m_columns.getBase(); - Uint32 len = 0; - Uint64 tmp[1000]; - - Uint32 chunk = 8; - Uint32* dst = (Uint32*)tmp; - NdbApiSignal* tSignal = theTCREQ; - Uint32* src = ((TcKeyReq*)tSignal->getDataPtrSend())->keyInfo; - if(tSignal->readSignalNumber() == GSN_SCAN_TABREQ) - { - tSignal = tSignal->next(); - src = ((KeyInfo*)tSignal->getDataPtrSend())->keyData; - chunk = KeyInfo::DataLength; - } - - for(unsigned i = m_accessTable->m_columns.size(); i>0; cols++, i--) - { - if (!(* cols)->getPrimaryKey()) - continue; - - NdbColumnImpl* tAttrInfo = * cols; - Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize; - Uint32 currLen = (sizeInBytes + 3) >> 2; - if (tAttrInfo->getDistributionKey()) - { - while (currLen >= chunk) - { - memcpy(dst, src, 4*chunk); - dst += chunk; - tSignal = tSignal->next(); - src = ((KeyInfo*)tSignal->getDataPtrSend())->keyData; - currLen -= chunk; - chunk = KeyInfo::DataLength; - } - - memcpy(dst, src, 4*currLen); - dst += currLen; - src += currLen; - chunk -= currLen; - } - else - { - while (currLen >= chunk) - { - tSignal = tSignal->next(); - src = ((KeyInfo*)tSignal->getDataPtrSend())->keyData; - currLen -= chunk; - chunk = KeyInfo::DataLength; - } - - src += currLen; - chunk -= currLen; - } - } - setPartitionHash(tmp, dst - (Uint32*)tmp); - } - return 0; -} - -void -NdbOperation::setPartitionHash(Uint32 value) -{ - union { - Uint32 tmp32; - Uint64 tmp64; - }; - - tmp32 = value; - setPartitionHash(&tmp64, 1); -} - -void -NdbOperation::setPartitionHash(const Uint64* value, Uint32 len) -{ - Uint32 buf[4]; - md5_hash(buf, value, len); - setPartitionId(buf[1]); -} - -void -NdbOperation::setPartitionId(Uint32 value) -{ - theDistributionKey = value; - theDistrKeyIndicator_ = 1; -} - -Uint32 -NdbOperation::getPartitionId() const -{ - return theDistributionKey; -} diff --git a/ndb/src/ndbapi/NdbPool.cpp b/ndb/src/ndbapi/NdbPool.cpp deleted file mode 100644 index a8263f564f1..00000000000 --- a/ndb/src/ndbapi/NdbPool.cpp +++ /dev/null @@ -1,71 +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 */ - -#include <Ndb.hpp> -#include "NdbPoolImpl.hpp" -#include <NdbPool.hpp> - -static NdbPool* m_pool = 0; - -bool -create_instance(Ndb_cluster_connection* cc, - Uint32 max_ndb_objects, - Uint32 no_conn_obj, - Uint32 init_no_ndb_objects) -{ - if (m_pool != NULL) { - return false; - } - m_pool = NdbPool::create_instance(cc, - max_ndb_objects, - no_conn_obj, - init_no_ndb_objects); - if (m_pool == NULL) { - return false; - } - return true; -} - -void -drop_instance() -{ - if (m_pool == NULL) { - return; - } - NdbPool::drop_instance(); - m_pool = NULL; -} - -Ndb* -get_ndb_object(Uint32 &hint_id, - const char* a_catalog_name, - const char* a_schema_name) -{ - if (m_pool == NULL) { - return NULL; - } - return m_pool->get_ndb_object(hint_id, a_catalog_name, a_schema_name); -} - -void -return_ndb_object(Ndb* returned_object, Uint32 id) -{ - if (m_pool == NULL) { - return; - } - m_pool->return_ndb_object(returned_object, id); -} - diff --git a/ndb/src/ndbapi/NdbPoolImpl.cpp b/ndb/src/ndbapi/NdbPoolImpl.cpp deleted file mode 100644 index 32e0a6f1410..00000000000 --- a/ndb/src/ndbapi/NdbPoolImpl.cpp +++ /dev/null @@ -1,528 +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 */ - -#include "NdbPoolImpl.hpp" - -NdbMutex *NdbPool::pool_mutex = NULL; -NdbPool *the_pool = NULL; - -NdbPool* -NdbPool::create_instance(Ndb_cluster_connection* cc, - Uint32 max_ndb_obj, - Uint32 no_conn_obj, - Uint32 init_no_ndb_objects) -{ - if (!initPoolMutex()) { - return NULL; - } - NdbMutex_Lock(pool_mutex); - NdbPool* a_pool; - if (the_pool != NULL) { - a_pool = NULL; - } else { - the_pool = new NdbPool(cc, max_ndb_obj, no_conn_obj); - if (!the_pool->init(init_no_ndb_objects)) { - delete the_pool; - the_pool = NULL; - } - a_pool = the_pool; - } - NdbMutex* temp = pool_mutex; - if (a_pool == NULL) { - pool_mutex = NULL; - } - NdbMutex_Unlock(pool_mutex); - if (a_pool == NULL) { - NdbMutex_Destroy(temp); - } - return a_pool; -} - -void -NdbPool::drop_instance() -{ - if (pool_mutex == NULL) { - return; - } - NdbMutex_Lock(pool_mutex); - the_pool->release_all(); - delete the_pool; - the_pool = NULL; - NdbMutex* temp = pool_mutex; - NdbMutex_Unlock(temp); - NdbMutex_Destroy(temp); -} - -bool -NdbPool::initPoolMutex() -{ - bool ret_result = false; - if (pool_mutex == NULL) { - pool_mutex = NdbMutex_Create(); - ret_result = ((pool_mutex == NULL) ? false : true); - } - return ret_result; -} - -NdbPool::NdbPool(Ndb_cluster_connection* cc, - Uint32 max_no_objects, - Uint32 no_conn_objects) -{ - if (no_conn_objects > 1024) { - no_conn_objects = 1024; - } - if (max_no_objects > MAX_NDB_OBJECTS) { - max_no_objects = MAX_NDB_OBJECTS; - } else if (max_no_objects == 0) { - max_no_objects = 1; - } - m_max_ndb_objects = max_no_objects; - m_no_of_conn_objects = no_conn_objects; - m_no_of_objects = 0; - m_waiting = 0; - m_pool_reference = NULL; - m_hash_entry = NULL; - m_first_free = NULL_POOL; - m_first_not_in_use = NULL_POOL; - m_last_free = NULL_POOL; - input_pool_cond = NULL; - output_pool_cond = NULL; - m_output_queue = 0; - m_input_queue = 0; - m_signal_count = 0; - m_cluster_connection = cc; -} - -NdbPool::~NdbPool() -{ - NdbCondition_Destroy(input_pool_cond); - NdbCondition_Destroy(output_pool_cond); -} - -void -NdbPool::release_all() -{ - int i; - for (i = 0; i < m_max_ndb_objects + 1; i++) { - if (m_pool_reference[i].ndb_reference != NULL) { - assert(m_pool_reference[i].in_use); - assert(m_pool_reference[i].free_entry); - delete m_pool_reference[i].ndb_reference; - } - } - delete [] m_pool_reference; - delete [] m_hash_entry; - m_pool_reference = NULL; - m_hash_entry = NULL; -} - -bool -NdbPool::init(Uint32 init_no_objects) -{ - bool ret_result = false; - int i; - do { - input_pool_cond = NdbCondition_Create(); - output_pool_cond = NdbCondition_Create(); - if (input_pool_cond == NULL || output_pool_cond == NULL) { - break; - } - if (init_no_objects > m_max_ndb_objects) { - init_no_objects = m_max_ndb_objects; - } - if (init_no_objects == 0) { - init_no_objects = 1; - } - m_pool_reference = new NdbPool::POOL_STRUCT[m_max_ndb_objects + 1]; - m_hash_entry = new Uint8[POOL_HASH_TABLE_SIZE]; - - if ((m_pool_reference == NULL) || (m_hash_entry == NULL)) { - delete [] m_pool_reference; - delete [] m_hash_entry; - break; - } - for (i = 0; i < m_max_ndb_objects + 1; i++) { - m_pool_reference[i].ndb_reference = NULL; - m_pool_reference[i].in_use = false; - m_pool_reference[i].next_free_object = i+1; - m_pool_reference[i].prev_free_object = i-1; - m_pool_reference[i].next_db_object = NULL_POOL; - m_pool_reference[i].prev_db_object = NULL_POOL; - } - for (i = 0; i < POOL_HASH_TABLE_SIZE; i++) { - m_hash_entry[i] = NULL_HASH; - } - m_pool_reference[m_max_ndb_objects].next_free_object = NULL_POOL; - m_pool_reference[1].prev_free_object = NULL_POOL; - m_first_not_in_use = 1; - m_no_of_objects = init_no_objects; - for (i = init_no_objects; i > 0 ; i--) { - Uint32 fake_id; - if (!allocate_ndb(fake_id, (const char*)NULL, (const char*)NULL)) { - release_all(); - break; - } - } - ret_result = true; - break; - } while (1); - return ret_result; -} - -/* -Get an Ndb object. -Input: -hint_id: 0 = no hint, otherwise a hint of which Ndb object the thread - used the last time. -a_db_name: NULL = don't check for database specific Ndb object, otherwise - a hint of which database is preferred. -Output: -hint_id: Returns id of Ndb object returned -Return value: Ndb object pointer -*/ -Ndb* -NdbPool::get_ndb_object(Uint32 &hint_id, - const char* a_catalog_name, - const char* a_schema_name) -{ - Ndb* ret_ndb = NULL; - Uint32 hash_entry = compute_hash(a_schema_name); - NdbMutex_Lock(pool_mutex); - while (1) { - /* - We start by checking if we can use the hinted Ndb object. - */ - if ((ret_ndb = get_hint_ndb(hint_id, hash_entry)) != NULL) { - break; - } - /* - The hinted Ndb object was not free. We need to allocate another object. - We start by checking for a free Ndb object connected to the same database. - */ - if (a_schema_name && (ret_ndb = get_db_hash(hint_id, - hash_entry, - a_catalog_name, - a_schema_name))) { - break; - } - /* - No Ndb object connected to the preferred database was found. - We look for a free Ndb object in general. - */ - if ((ret_ndb = get_free_list(hint_id, hash_entry)) != NULL) { - break; - } - /* - No free Ndb object was found. If we haven't allocated objects up until the - maximum number yet then we can allocate a new Ndb object here. - */ - if (m_no_of_objects < m_max_ndb_objects) { - if (allocate_ndb(hint_id, a_catalog_name, a_schema_name)) { - assert((ret_ndb = get_hint_ndb(hint_id, hash_entry)) != NULL); - break; - } - } - /* - We need to wait until an Ndb object becomes - available. - */ - if ((ret_ndb = wait_free_ndb(hint_id)) != NULL) { - break; - } - /* - Not even after waiting were we able to get hold of an Ndb object. We - return NULL to indicate this problem. - */ - ret_ndb = NULL; - break; - } - NdbMutex_Unlock(pool_mutex); - if (ret_ndb != NULL) { - /* - We need to set the catalog and schema name of the Ndb object before - returning it to the caller. - */ - ret_ndb->setCatalogName(a_catalog_name); - ret_ndb->setSchemaName(a_schema_name); - } - return ret_ndb; -} - -void -NdbPool::return_ndb_object(Ndb* returned_ndb, Uint32 id) -{ - NdbMutex_Lock(pool_mutex); - assert(id <= m_max_ndb_objects); - assert(id != 0); - assert(returned_ndb == m_pool_reference[id].ndb_reference); - bool wait_cond = m_waiting; - if (wait_cond) { - NdbCondition* pool_cond; - if (m_signal_count > 0) { - pool_cond = output_pool_cond; - m_signal_count--; - } else { - pool_cond = input_pool_cond; - } - add_wait_list(id); - NdbMutex_Unlock(pool_mutex); - NdbCondition_Signal(pool_cond); - } else { - add_free_list(id); - add_db_hash(id); - NdbMutex_Unlock(pool_mutex); - } -} - -bool -NdbPool::allocate_ndb(Uint32 &id, - const char* a_catalog_name, - const char* a_schema_name) -{ - Ndb* a_ndb; - if (m_first_not_in_use == NULL_POOL) { - return false; - } - if (a_schema_name) { - a_ndb = new Ndb(m_cluster_connection, a_schema_name, a_catalog_name); - } else { - a_ndb = new Ndb(m_cluster_connection, ""); - } - if (a_ndb == NULL) { - return false; - } - a_ndb->init(m_no_of_conn_objects); - m_no_of_objects++; - - id = m_first_not_in_use; - Uint32 allocated_id = m_first_not_in_use; - m_first_not_in_use = m_pool_reference[allocated_id].next_free_object; - - m_pool_reference[allocated_id].ndb_reference = a_ndb; - m_pool_reference[allocated_id].in_use = true; - m_pool_reference[allocated_id].free_entry = false; - - add_free_list(allocated_id); - add_db_hash(allocated_id); - return true; -} - -void -NdbPool::add_free_list(Uint32 id) -{ - assert(!m_pool_reference[id].free_entry); - assert(m_pool_reference[id].in_use); - m_pool_reference[id].free_entry = true; - m_pool_reference[id].next_free_object = m_first_free; - m_pool_reference[id].prev_free_object = (Uint8)NULL_POOL; - m_first_free = (Uint8)id; - if (m_last_free == (Uint8)NULL_POOL) { - m_last_free = (Uint8)id; - } -} - -void -NdbPool::add_db_hash(Uint32 id) -{ - Ndb* t_ndb = m_pool_reference[id].ndb_reference; - const char* schema_name = t_ndb->getSchemaName(); - Uint32 hash_entry = compute_hash(schema_name); - Uint8 next_db_entry = m_hash_entry[hash_entry]; - m_pool_reference[id].next_db_object = next_db_entry; - m_pool_reference[id].prev_db_object = (Uint8)NULL_HASH; - m_hash_entry[hash_entry] = (Uint8)id; -} - -Ndb* -NdbPool::get_free_list(Uint32 &id, Uint32 hash_entry) -{ - if (m_first_free == NULL_POOL) { - return NULL; - } - id = m_first_free; - Ndb* ret_ndb = get_hint_ndb(m_first_free, hash_entry); - assert(ret_ndb != NULL); - return ret_ndb; -} - -Ndb* -NdbPool::get_db_hash(Uint32 &id, - Uint32 hash_entry, - const char *a_catalog_name, - const char *a_schema_name) -{ - Uint32 entry_id = m_hash_entry[hash_entry]; - bool found = false; - while (entry_id != NULL_HASH) { - Ndb* t_ndb = m_pool_reference[entry_id].ndb_reference; - const char *a_ndb_catalog_name = t_ndb->getCatalogName(); - if (strcmp(a_catalog_name, a_ndb_catalog_name) == 0) { - const char *a_ndb_schema_name = t_ndb->getSchemaName(); - if (strcmp(a_schema_name, a_ndb_schema_name) == 0) { - found = true; - break; - } - } - entry_id = m_pool_reference[entry_id].next_db_object; - } - if (found) { - id = entry_id; - Ndb* ret_ndb = get_hint_ndb(entry_id, hash_entry); - assert(ret_ndb != NULL); - return ret_ndb; - } - return NULL; -} - -Ndb* -NdbPool::get_hint_ndb(Uint32 hint_id, Uint32 hash_entry) -{ - Ndb* ret_ndb = NULL; - do { - if ((hint_id != 0) && - (hint_id <= m_max_ndb_objects) && - (m_pool_reference[hint_id].in_use) && - (m_pool_reference[hint_id].free_entry)) { - ret_ndb = m_pool_reference[hint_id].ndb_reference; - if (ret_ndb != NULL) { - break; - } else { - assert(false); - } - } - return NULL; - } while (1); - /* - This is where we remove the entry from the free list and from the db hash - table. - */ - remove_free_list(hint_id); - remove_db_hash(hint_id, hash_entry); - return ret_ndb; -} - -void -NdbPool::remove_free_list(Uint32 id) -{ - Uint8 next_free_entry = m_pool_reference[id].next_free_object; - Uint8 prev_free_entry = m_pool_reference[id].prev_free_object; - if (prev_free_entry == (Uint8)NULL_POOL) { - m_first_free = next_free_entry; - } else { - m_pool_reference[prev_free_entry].next_free_object = next_free_entry; - } - if (next_free_entry == (Uint8)NULL_POOL) { - m_last_free = prev_free_entry; - } else { - m_pool_reference[next_free_entry].prev_free_object = prev_free_entry; - } - m_pool_reference[id].next_free_object = NULL_POOL; - m_pool_reference[id].prev_free_object = NULL_POOL; - m_pool_reference[id].free_entry = false; -} - -void -NdbPool::remove_db_hash(Uint32 id, Uint32 hash_entry) -{ - Uint8 next_free_entry = m_pool_reference[id].next_db_object; - Uint8 prev_free_entry = m_pool_reference[id].prev_db_object; - if (prev_free_entry == (Uint8)NULL_HASH) { - m_hash_entry[hash_entry] = next_free_entry; - } else { - m_pool_reference[prev_free_entry].next_db_object = next_free_entry; - } - if (next_free_entry == (Uint8)NULL_HASH) { - ; - } else { - m_pool_reference[next_free_entry].prev_db_object = prev_free_entry; - } - m_pool_reference[id].next_db_object = NULL_HASH; - m_pool_reference[id].prev_db_object = NULL_HASH; -} - -Uint32 -NdbPool::compute_hash(const char *a_schema_name) -{ - Uint32 len = strlen(a_schema_name); - Uint32 h = 147; - for (Uint32 i = 0; i < len; i++) { - Uint32 c = a_schema_name[i]; - h = (h << 5) + h + c; - } - h &= (POOL_HASH_TABLE_SIZE - 1); - return h; -} - -Ndb* -NdbPool::wait_free_ndb(Uint32 &id) -{ - int res; - int time_out = 3500; - do { - NdbCondition* tmp = input_pool_cond; - m_waiting++; - m_input_queue++; - time_out -= 500; - res = NdbCondition_WaitTimeout(input_pool_cond, pool_mutex, time_out); - if (tmp == input_pool_cond) { - m_input_queue--; - } else { - m_output_queue--; - if (m_output_queue == 0) { - switch_condition_queue(); - } - } - m_waiting--; - } while (res == 0 && m_first_wait == NULL_POOL); - if (res != 0 && m_first_wait == NULL_POOL) { - return NULL; - } - id = m_first_wait; - remove_wait_list(); - assert(m_waiting != 0 || m_first_wait == NULL_POOL); - return m_pool_reference[id].ndb_reference; -} - -void -NdbPool::remove_wait_list() -{ - Uint32 id = m_first_wait; - m_first_wait = m_pool_reference[id].next_free_object; - m_pool_reference[id].next_free_object = NULL_POOL; - m_pool_reference[id].prev_free_object = NULL_POOL; - m_pool_reference[id].free_entry = false; -} - -void -NdbPool::add_wait_list(Uint32 id) -{ - m_pool_reference[id].next_free_object = m_first_wait; - m_first_wait = id; -} - -void -NdbPool::switch_condition_queue() -{ - m_signal_count = m_input_queue; - Uint8 move_queue = m_input_queue; - m_input_queue = m_output_queue; - m_output_queue = move_queue; - - NdbCondition* move_cond = input_pool_cond; - input_pool_cond = output_pool_cond; - output_pool_cond = move_cond; -} - diff --git a/ndb/src/ndbapi/NdbPoolImpl.hpp b/ndb/src/ndbapi/NdbPoolImpl.hpp deleted file mode 100644 index cd36f30e90b..00000000000 --- a/ndb/src/ndbapi/NdbPoolImpl.hpp +++ /dev/null @@ -1,166 +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 */ - -/** - @section ndbPool Pooling of NDB objects - This class implements pooling of NDB objects to support MySQL, ODBC and - any application with a great number of threads. - - The general idea is to let the NdbPool class administer all Ndb objects. - When a thread needs a Ndb object it request a Ndb object from the Pool. - This interface contains some hints to ensure that the proper Ndb object - is returned. - - The object contains an array of references to all Ndb objects together with - an indication of whether the object is free or not. - - The idea is that the thread should keep track of the Ndb object it used the - last time. If this object is still free it will simply get this object - back. If the number of threads do not exceed the number of Ndb objects this - will always be successful. In certain situations the number of threads will - be much greater than the number of Ndb objects. In this situation the Pool - will attempt to provide an object that is attached to the same schema - as the thread is connected to. If this is not possible it will attempt to - get any free Ndb object. If not even this is possible the Pool will wait - until an Ndb object becomes free. If an Ndb object becomes available in - time it will deliver this Ndb object. In the worst case the call will - time-out and return NULL to indicate no free Ndb object was found in time. - - The implementation uses an array of structs which contain a reference to a - Ndb object, whether it is in use currently and a number of references to - set up linked lists of - 1) Free objects on a schema - 2) Free objects in LIFO order - - Usage: - The class is a singleton. - The first step is to call create_instance(..). If successful this will - create the NdbPool object and return a reference to it. When completed - drop_instance is called to remove the NdbPool object and all memory and - other resources attached to it. - - After initialising the NdbPool object all threads can now start using the - NdbPool. There are two methods in normal usage mode. The first - get_ndb_object gets a Ndb object and the second return_ndb_object returns - an Ndb object. The user of the NdbPool must keep track of the identity - of the Ndb object. The idea is that this identity can also be used to - find the object quickly again unless another thread have taken it. If the - user wants any Ndb object it requests identity 0 which means any here. - - When constructing the NdbPool one can set the number of NdbConnection - objects which are allowed in all Ndb objects. For use in synchronous - applications such as the MySQL server 4 objects should be enough. When - using the NdbPool for asynchronous applications one should use 1024 to - enable a high level of parallelism. It is also possible to set the - maximum number of Ndb objects in the pool and the initial number of - Ndb objects allocated. -*/ - -#ifndef NdbPool_H -#define NdbPool_H - -#include <Ndb.hpp> -#include <NdbMutex.h> -#include <NdbCondition.h> -#include <NdbOut.hpp> - -class NdbPool { -#define NULL_POOL 0 -#define NULL_HASH 0xFF -#define POOL_HASH_TABLE_SIZE 32 -#define MAX_NDB_OBJECTS 240 - struct POOL_STRUCT { - Ndb* ndb_reference; - bool in_use; - bool free_entry; - Uint16 next_free_object; - Uint16 prev_free_object; - Uint16 next_db_object; - Uint16 prev_db_object; - }; - public: - static NdbPool* create_instance(Ndb_cluster_connection*, - Uint32 max_ndb_objects = 240, - Uint32 no_conn_obj = 4, - Uint32 init_no_ndb_objects = 8); - static void drop_instance(); - Ndb* get_ndb_object(Uint32 &hint_id, - const char* a_catalog_name, - const char* a_schema_name); - void return_ndb_object(Ndb* returned_object, Uint32 id); - private: - bool init(Uint32 initial_no_of_ndb_objects = 8); - void release_all(); - static bool initPoolMutex(); - NdbPool(Ndb_cluster_connection*, - Uint32 max_no_of_ndb_objects, Uint32 no_conn_objects); - ~NdbPool(); - /* - We have three lists: - 1) A list for entries not in use - 2) A list for free entries - 3) A hash table with schema name and database name as key - - These lists are all initialised in the init call. - The list for entries not in use is very simple since the current - implementation have not yet any handling of dropping Ndb objects - until all Ndb objects are dropped. - */ - void add_free_list(Uint32 id); - void remove_free_list(Uint32 id); - Ndb* get_free_list(Uint32 &id, Uint32 hash_entry); - - void add_db_hash(Uint32 id); - void remove_db_hash(Uint32 id, Uint32 hash_entry); - Ndb* get_db_hash(Uint32 &id, - Uint32 hash_entry, - const char* a_catalog_name, - const char* a_schema_name); - - bool allocate_ndb(Uint32 &id, - const char* a_catalog_name, - const char* a_schema_name); - Ndb* get_hint_ndb(Uint32 id, Uint32 hash_entry); - Ndb* wait_free_ndb(Uint32 &id); - Uint32 compute_hash(const char *a_schema_name); - void add_wait_list(Uint32 id); - void remove_wait_list(); - void switch_condition_queue(); - - static NdbMutex *pool_mutex; - struct NdbCondition *input_pool_cond; - struct NdbCondition *output_pool_cond; - - POOL_STRUCT *m_pool_reference; - Uint8 *m_hash_entry; - - bool m_inited; - Uint32 m_no_of_conn_objects; - - Uint16 m_no_of_objects; - Uint16 m_max_ndb_objects; - Uint16 m_first_free; - Uint16 m_last_free; - Uint16 m_first_not_in_use; - Uint16 m_waiting; - Uint16 m_first_wait; - Uint16 m_input_queue; - Uint16 m_output_queue; - Uint16 m_signal_count; - - Ndb_cluster_connection * m_cluster_connection; -}; -#endif diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp deleted file mode 100644 index 5e5306fc33a..00000000000 --- a/ndb/src/ndbapi/NdbRecAttr.cpp +++ /dev/null @@ -1,415 +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 */ - - -#include <ndb_global.h> -#include <NdbOut.hpp> -#include <NdbRecAttr.hpp> -#include <NdbBlob.hpp> -#include "NdbDictionaryImpl.hpp" -#include <NdbTCP.h> - -NdbRecAttr::NdbRecAttr() -{ - init(); -} - -NdbRecAttr::~NdbRecAttr() -{ - release(); -} - -int -NdbRecAttr::setup(const class NdbDictionary::Column* col, char* aValue) -{ - return setup(&(col->m_impl), aValue); -} -int -NdbRecAttr::setup(const NdbColumnImpl* anAttrInfo, char* aValue) -{ - Uint32 tAttrSize = anAttrInfo->m_attrSize; - Uint32 tArraySize = anAttrInfo->m_arraySize; - Uint32 tAttrByteSize = tAttrSize * tArraySize; - - m_column = anAttrInfo; - - theAttrId = anAttrInfo->m_attrId; - theAttrSize = tAttrSize; - theArraySize = tArraySize; - theValue = aValue; - theNULLind = 0; - m_nullable = anAttrInfo->m_nullable; - - // check alignment to signal data - // a future version could check alignment per data type as well - - if (aValue != NULL && (UintPtr(aValue)&3) == 0 && (tAttrByteSize&3) == 0) { - theStorageX = NULL; - theRef = aValue; - return 0; - } - if (tAttrByteSize <= 32) { - theStorageX = NULL; - theStorage[0] = 0; - theStorage[1] = 0; - theStorage[2] = 0; - theStorage[3] = 0; - theRef = theStorage; - return 0; - } - Uint32 tSize = (tAttrByteSize + 7) >> 3; - Uint64* tRef = new Uint64[tSize]; - if (tRef != NULL) { - for (Uint32 i = 0; i < tSize; i++) { - tRef[i] = 0; - } - theStorageX = tRef; - theRef = tRef; - return 0; - } - return -1; -} - -void -NdbRecAttr::copyout() -{ - char* tRef = (char*)theRef; - char* tValue = theValue; - if (tRef != tValue && tRef != NULL && tValue != NULL) { - Uint32 n = theAttrSize * theArraySize; - while (n-- > 0) { - *tValue++ = *tRef++; - } - } -} - -NdbRecAttr * -NdbRecAttr::clone() const { - NdbRecAttr * ret = new NdbRecAttr(); - - ret->theAttrId = theAttrId; - ret->theNULLind = theNULLind; - ret->theAttrSize = theAttrSize; - ret->theArraySize = theArraySize; - ret->m_column = m_column; - - Uint32 n = theAttrSize * theArraySize; - if(n <= 32){ - ret->theRef = (char*)&ret->theStorage[0]; - ret->theStorageX = 0; - ret->theValue = 0; - } else { - ret->theStorageX = new Uint64[((n + 7) >> 3)]; - ret->theRef = (char*)ret->theStorageX; - ret->theValue = 0; - } - memcpy(ret->theRef, theRef, n); - return ret; -} - -bool -NdbRecAttr::receive_data(const Uint32 * data, Uint32 sz){ - const Uint32 n = (theAttrSize * theArraySize + 3) >> 2; - if(n == sz){ - theNULLind = 0; - if(!copyoutRequired()) - memcpy(theRef, data, 4 * sz); - else - memcpy(theValue, data, theAttrSize * theArraySize); - return true; - } else if(sz == 0){ - setNULL(); - return true; - } - return false; -} - -static void -ndbrecattr_print_string(NdbOut& out, const char *type, - const char *aref, unsigned sz) -{ - const unsigned char* ref = (const unsigned char*)aref; - int i, len, printable= 1; - // trailing zeroes are not printed - for (i=sz-1; i >= 0; i--) - if (ref[i] == 0) sz--; - else break; - if (sz == 0) return; // empty - - for (len=0; len < (int)sz && ref[i] != 0; len++) - if (printable && !isprint((int)ref[i])) - printable= 0; - - if (printable) - out.print("%.*s", len, ref); - else - { - out.print("0x"); - for (i=0; i < len; i++) - out.print("%02X", (int)ref[i]); - } - if (len != (int)sz) - { - out.print("["); - for (i= len+1; ref[i] != 0; i++) - out.print("%u]",len-i); - assert((int)sz > i); - ndbrecattr_print_string(out,type,aref+i,sz-i); - } -} - -NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) -{ - if (r.isNULL()) - { - out << "[NULL]"; - return out; - } - - const NdbDictionary::Column* c = r.getColumn(); - uint length = c->getLength(); - if (length > 1) - out << "["; - - for (Uint32 j = 0; j < length; j++) - { - if (j > 0) - out << " "; - - switch(r.getType()) - { - case NdbDictionary::Column::Bigunsigned: - out << r.u_64_value(); - break; - case NdbDictionary::Column::Bit: - out << hex << "H'" << r.u_32_value() << dec; - break; - case NdbDictionary::Column::Unsigned: - out << r.u_32_value(); - break; - case NdbDictionary::Column::Smallunsigned: - out << r.u_short_value(); - break; - case NdbDictionary::Column::Tinyunsigned: - out << (unsigned) r.u_char_value(); - break; - case NdbDictionary::Column::Bigint: - out << r.int64_value(); - break; - case NdbDictionary::Column::Int: - out << r.int32_value(); - break; - case NdbDictionary::Column::Smallint: - out << r.short_value(); - break; - case NdbDictionary::Column::Tinyint: - out << (int) r.char_value(); - break; - case NdbDictionary::Column::Binary: - ndbrecattr_print_string(out,"Binary",r.aRef(),r.arraySize()); - j = r.arraySize(); - break; - case NdbDictionary::Column::Char: - ndbrecattr_print_string(out,"Char",r.aRef(),r.arraySize()); - j = length; - break; - case NdbDictionary::Column::Varchar: - { - unsigned len = *(const unsigned char*)r.aRef(); - ndbrecattr_print_string(out,"Varchar", r.aRef()+1,len); - j = length; - } - break; - case NdbDictionary::Column::Float: - out << r.float_value(); - break; - case NdbDictionary::Column::Double: - out << r.double_value(); - break; - case NdbDictionary::Column::Olddecimal: - { - short len = 1 + c->getPrecision() + (c->getScale() > 0); - out.print("%.*s", len, r.aRef()); - } - break; - case NdbDictionary::Column::Olddecimalunsigned: - { - short len = 0 + c->getPrecision() + (c->getScale() > 0); - out.print("%.*s", len, r.aRef()); - } - break; - case NdbDictionary::Column::Decimal: - case NdbDictionary::Column::Decimalunsigned: - goto unknown; // TODO - break; - // for dates cut-and-paste from field.cc - case NdbDictionary::Column::Datetime: - { - ulonglong tmp=r.u_64_value(); - long part1,part2,part3; - part1=(long) (tmp/LL(1000000)); - part2=(long) (tmp - (ulonglong) part1*LL(1000000)); - char buf[40]; - char* pos=(char*) buf+19; - *pos--=0; - *pos--= (char) ('0'+(char) (part2%10)); part2/=10; - *pos--= (char) ('0'+(char) (part2%10)); part3= (int) (part2 / 10); - *pos--= ':'; - *pos--= (char) ('0'+(char) (part3%10)); part3/=10; - *pos--= (char) ('0'+(char) (part3%10)); part3/=10; - *pos--= ':'; - *pos--= (char) ('0'+(char) (part3%10)); part3/=10; - *pos--= (char) ('0'+(char) part3); - *pos--= '/'; - *pos--= (char) ('0'+(char) (part1%10)); part1/=10; - *pos--= (char) ('0'+(char) (part1%10)); part1/=10; - *pos--= '-'; - *pos--= (char) ('0'+(char) (part1%10)); part1/=10; - *pos--= (char) ('0'+(char) (part1%10)); part3= (int) (part1/10); - *pos--= '-'; - *pos--= (char) ('0'+(char) (part3%10)); part3/=10; - *pos--= (char) ('0'+(char) (part3%10)); part3/=10; - *pos--= (char) ('0'+(char) (part3%10)); part3/=10; - *pos=(char) ('0'+(char) part3); - out << buf; - } - break; - case NdbDictionary::Column::Date: - { - uint32 tmp=(uint32) uint3korr(r.aRef()); - int part; - char buf[40]; - char *pos=(char*) buf+10; - *pos--=0; - part=(int) (tmp & 31); - *pos--= (char) ('0'+part%10); - *pos--= (char) ('0'+part/10); - *pos--= '-'; - part=(int) (tmp >> 5 & 15); - *pos--= (char) ('0'+part%10); - *pos--= (char) ('0'+part/10); - *pos--= '-'; - part=(int) (tmp >> 9); - *pos--= (char) ('0'+part%10); part/=10; - *pos--= (char) ('0'+part%10); part/=10; - *pos--= (char) ('0'+part%10); part/=10; - *pos= (char) ('0'+part); - out << buf; - } - break; - case NdbDictionary::Column::Time: - { - long tmp=(long) sint3korr(r.aRef()); - int hour=(uint) (tmp/10000); - int minute=(uint) (tmp/100 % 100); - int second=(uint) (tmp % 100); - char buf[40]; - sprintf(buf, "%02d:%02d:%02d", hour, minute, second); - out << buf; - } - break; - case NdbDictionary::Column::Year: - { - uint year = 1900 + r.u_char_value(); - char buf[40]; - sprintf(buf, "%04d", year); - out << buf; - } - break; - case NdbDictionary::Column::Timestamp: - { - time_t time = r.u_32_value(); - out << (uint)time; - } - break; - case NdbDictionary::Column::Blob: - { - const NdbBlob::Head* h = (const NdbBlob::Head*)r.aRef(); - out << h->length << ":"; - const unsigned char* p = (const unsigned char*)(h + 1); - unsigned n = r.arraySize() - sizeof(*h); - for (unsigned k = 0; k < n && k < h->length; k++) - out.print("%02X", (int)p[k]); - j = length; - } - break; - case NdbDictionary::Column::Text: - { - const NdbBlob::Head* h = (const NdbBlob::Head*)r.aRef(); - out << h->length << ":"; - const unsigned char* p = (const unsigned char*)(h + 1); - unsigned n = r.arraySize() - sizeof(*h); - for (unsigned k = 0; k < n && k < h->length; k++) - out.print("%c", (int)p[k]); - j = length; - } - break; - case NdbDictionary::Column::Longvarchar: - { - unsigned len = uint2korr(r.aRef()); - ndbrecattr_print_string(out,"Longvarchar", r.aRef()+2,len); - j = length; - } - break; - unknown: - default: /* no print functions for the rest, just print type */ - out << (int) r.getType(); - j = length; - if (j > 1) - out << " " << j << " times"; - break; - } - } - - if (length > 1) - { - out << "]"; - } - - return out; -} - -Int64 -NdbRecAttr::int64_value() const -{ - Int64 val; - memcpy(&val,theRef,8); - return val; -} - -Uint64 -NdbRecAttr::u_64_value() const -{ - Uint64 val; - memcpy(&val,theRef,8); - return val; -} - -float -NdbRecAttr::float_value() const -{ - float val; - memcpy(&val,theRef,sizeof(val)); - return val; -} - -double -NdbRecAttr::double_value() const -{ - double val; - memcpy(&val,theRef,sizeof(val)); - return val; -} diff --git a/ndb/src/ndbapi/NdbReceiver.cpp b/ndb/src/ndbapi/NdbReceiver.cpp deleted file mode 100644 index df16ae66915..00000000000 --- a/ndb/src/ndbapi/NdbReceiver.cpp +++ /dev/null @@ -1,295 +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 */ - -#include <ndb_global.h> -#include "NdbImpl.hpp" -#include <NdbReceiver.hpp> -#include "NdbDictionaryImpl.hpp" -#include <NdbRecAttr.hpp> -#include <AttributeHeader.hpp> -#include <NdbTransaction.hpp> -#include <TransporterFacade.hpp> -#include <signaldata/TcKeyConf.hpp> - -NdbReceiver::NdbReceiver(Ndb *aNdb) : - theMagicNumber(0), - m_ndb(aNdb), - m_id(NdbObjectIdMap::InvalidId), - m_type(NDB_UNINITIALIZED), - m_owner(0) -{ - theCurrentRecAttr = theFirstRecAttr = 0; - m_defined_rows = 0; - m_rows = new NdbRecAttr*[0]; -} - -NdbReceiver::~NdbReceiver() -{ - DBUG_ENTER("NdbReceiver::~NdbReceiver"); - if (m_id != NdbObjectIdMap::InvalidId) { - m_ndb->theImpl->theNdbObjectIdMap.unmap(m_id, this); - } - delete[] m_rows; - DBUG_VOID_RETURN; -} - -void -NdbReceiver::init(ReceiverType type, void* owner) -{ - theMagicNumber = 0x11223344; - m_type = type; - m_owner = owner; - if (m_id == NdbObjectIdMap::InvalidId) { - if (m_ndb) - m_id = m_ndb->theImpl->theNdbObjectIdMap.map(this); - } - - theFirstRecAttr = NULL; - theCurrentRecAttr = NULL; -} - -void -NdbReceiver::release(){ - NdbRecAttr* tRecAttr = theFirstRecAttr; - while (tRecAttr != NULL) - { - NdbRecAttr* tSaveRecAttr = tRecAttr; - tRecAttr = tRecAttr->next(); - m_ndb->releaseRecAttr(tSaveRecAttr); - } - theFirstRecAttr = NULL; - theCurrentRecAttr = NULL; -} - -NdbRecAttr * -NdbReceiver::getValue(const NdbColumnImpl* tAttrInfo, char * user_dst_ptr){ - NdbRecAttr* tRecAttr = m_ndb->getRecAttr(); - if(tRecAttr && !tRecAttr->setup(tAttrInfo, user_dst_ptr)){ - if (theFirstRecAttr == NULL) - theFirstRecAttr = tRecAttr; - else - theCurrentRecAttr->next(tRecAttr); - theCurrentRecAttr = tRecAttr; - tRecAttr->next(NULL); - return tRecAttr; - } - if(tRecAttr){ - m_ndb->releaseRecAttr(tRecAttr); - } - return 0; -} - -#define KEY_ATTR_ID (~(Uint32)0) - -void -NdbReceiver::calculate_batch_size(Uint32 key_size, - Uint32 parallelism, - Uint32& batch_size, - Uint32& batch_byte_size, - Uint32& first_batch_size) -{ - TransporterFacade *tp= TransporterFacade::instance(); - Uint32 max_scan_batch_size= tp->get_scan_batch_size(); - Uint32 max_batch_byte_size= tp->get_batch_byte_size(); - Uint32 max_batch_size= tp->get_batch_size(); - Uint32 tot_size= (key_size ? (key_size + 32) : 0); //key + signal overhead - NdbRecAttr *rec_attr= theFirstRecAttr; - while (rec_attr != NULL) { - Uint32 attr_size= rec_attr->attrSize() * rec_attr->arraySize(); - attr_size= ((attr_size + 7) >> 2) << 2; //Even to word + overhead - tot_size+= attr_size; - rec_attr= rec_attr->next(); - } - tot_size+= 32; //include signal overhead - - /** - * Now we calculate the batch size by trying to get upto SCAN_BATCH_SIZE - * bytes sent for each batch from each node. We do however ensure that - * no more than MAX_SCAN_BATCH_SIZE is sent from all nodes in total per - * batch. - */ - batch_byte_size= max_batch_byte_size; - if (batch_byte_size * parallelism > max_scan_batch_size) { - batch_byte_size= max_scan_batch_size / parallelism; - } - batch_size= batch_byte_size / tot_size; - if (batch_size == 0) { - batch_size= 1; - } else { - if (batch_size > max_batch_size) { - batch_size= max_batch_size; - } else if (batch_size > MAX_PARALLEL_OP_PER_SCAN) { - batch_size= MAX_PARALLEL_OP_PER_SCAN; - } - } - first_batch_size= batch_size; - return; -} - -void -NdbReceiver::do_get_value(NdbReceiver * org, - Uint32 rows, - Uint32 key_size, - Uint32 range_no){ - if(rows > m_defined_rows){ - delete[] m_rows; - m_defined_rows = rows; - m_rows = new NdbRecAttr*[rows + 1]; - } - m_rows[rows] = 0; - - NdbColumnImpl key; - if(key_size){ - key.m_attrId = KEY_ATTR_ID; - key.m_arraySize = key_size+1; - key.m_attrSize = 4; - key.m_nullable = true; // So that receive works w.r.t KEYINFO20 - } - m_hidden_count = (key_size ? 1 : 0) + range_no ; - - for(Uint32 i = 0; i<rows; i++){ - NdbRecAttr * prev = theCurrentRecAttr; - assert(prev == 0 || i > 0); - - // Put key-recAttr fir on each row - if(key_size && !getValue(&key, (char*)0)){ - abort(); - return ; // -1 - } - - if(range_no && - !getValue(&NdbColumnImpl::getImpl(* NdbDictionary::Column::RANGE_NO),0)) - { - abort(); - } - - NdbRecAttr* tRecAttr = org->theFirstRecAttr; - while(tRecAttr != 0){ - if(getValue(&NdbColumnImpl::getImpl(*tRecAttr->m_column), (char*)0) != 0) - tRecAttr = tRecAttr->next(); - else - break; - } - - if(tRecAttr){ - abort(); - return ;// -1; - } - - // Store first recAttr for each row in m_rows[i] - if(prev){ - m_rows[i] = prev->next(); - } else { - m_rows[i] = theFirstRecAttr; - } - } - - prepareSend(); - return; -} - -NdbRecAttr* -NdbReceiver::copyout(NdbReceiver & dstRec){ - NdbRecAttr *src = m_rows[m_current_row++]; - NdbRecAttr *dst = dstRec.theFirstRecAttr; - NdbRecAttr *start = src; - Uint32 tmp = m_hidden_count; - while(tmp--) - src = src->next(); - - while(dst){ - Uint32 len = ((src->theAttrSize * src->theArraySize)+3)/4; - dst->receive_data((Uint32*)src->aRef(), src->isNULL() ? 0 : len); - src = src->next(); - dst = dst->next(); - } - - return start; -} - -int -NdbReceiver::execTRANSID_AI(const Uint32* aDataPtr, Uint32 aLength) -{ - bool ok = true; - NdbRecAttr* currRecAttr = theCurrentRecAttr; - - for (Uint32 used = 0; used < aLength ; used++){ - AttributeHeader ah(* aDataPtr++); - const Uint32 tAttrId = ah.getAttributeId(); - const Uint32 tAttrSize = ah.getDataSize(); - - /** - * Set all results to NULL if not found... - */ - while(currRecAttr && currRecAttr->attrId() != tAttrId){ - ok &= currRecAttr->setNULL(); - currRecAttr = currRecAttr->next(); - } - - if(ok && currRecAttr && currRecAttr->receive_data(aDataPtr, tAttrSize)){ - used += tAttrSize; - aDataPtr += tAttrSize; - currRecAttr = currRecAttr->next(); - } else { - ndbout_c("%p: ok: %d tAttrId: %d currRecAttr: %p", - this,ok, tAttrId, currRecAttr); - currRecAttr = theCurrentRecAttr; - while(currRecAttr != 0){ - ndbout_c("%d ", currRecAttr->attrId()); - currRecAttr = currRecAttr->next(); - } - abort(); - return -1; - } - } - - theCurrentRecAttr = currRecAttr; - - /** - * Update m_received_result_length - */ - Uint32 exp = m_expected_result_length; - Uint32 tmp = m_received_result_length + aLength; - m_received_result_length = tmp; - - return (tmp == exp || (exp > TcKeyConf::SimpleReadBit) ? 1 : 0); -} - -int -NdbReceiver::execKEYINFO20(Uint32 info, const Uint32* aDataPtr, Uint32 aLength) -{ - NdbRecAttr* currRecAttr = m_rows[m_current_row++]; - assert(currRecAttr->attrId() == KEY_ATTR_ID); - currRecAttr->receive_data(aDataPtr, aLength + 1); - - /** - * Save scanInfo in the end of keyinfo - */ - ((Uint32*)currRecAttr->aRef())[aLength] = info; - - Uint32 tmp = m_received_result_length + aLength; - m_received_result_length = tmp; - - return (tmp == m_expected_result_length ? 1 : 0); -} - -void -NdbReceiver::setErrorCode(int code) -{ - theMagicNumber = 0; - NdbOperation* op = (NdbOperation*)getOwner(); - op->setErrorCode(code); -} diff --git a/ndb/src/ndbapi/NdbScanFilter.cpp b/ndb/src/ndbapi/NdbScanFilter.cpp deleted file mode 100644 index b39fd10fe95..00000000000 --- a/ndb/src/ndbapi/NdbScanFilter.cpp +++ /dev/null @@ -1,577 +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 */ - -#include <NdbScanFilter.hpp> -#include <NdbOperation.hpp> -#include "NdbDictionaryImpl.hpp" -#include <Vector.hpp> -#include <NdbOut.hpp> -#include <Interpreter.hpp> - -#ifdef VM_TRACE -#include <NdbEnv.h> -#define INT_DEBUG(x) \ - { const char* tmp = NdbEnv_GetEnv("INT_DEBUG", (char*)0, 0); \ - if (tmp != 0 && strlen(tmp) != 0) { ndbout << "INT:"; ndbout_c x; } } -#else -#define INT_DEBUG(x) -#endif - -class NdbScanFilterImpl { -public: - struct State { - NdbScanFilter::Group m_group; - Uint32 m_popCount; - Uint32 m_ownLabel; - Uint32 m_trueLabel; - Uint32 m_falseLabel; - }; - - int m_label; - State m_current; - Vector<State> m_stack; - NdbOperation * m_operation; - Uint32 m_latestAttrib; - - int cond_col(Interpreter::UnaryCondition, Uint32 attrId); - - int cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, - const void * value, Uint32 len); -}; - -const Uint32 LabelExit = ~0; - - -NdbScanFilter::NdbScanFilter(class NdbOperation * op) - : m_impl(* new NdbScanFilterImpl()) -{ - m_impl.m_current.m_group = (NdbScanFilter::Group)0; - m_impl.m_current.m_popCount = 0; - m_impl.m_current.m_ownLabel = 0; - m_impl.m_current.m_trueLabel = ~0; - m_impl.m_current.m_falseLabel = ~0; - m_impl.m_label = 0; - m_impl.m_latestAttrib = ~0; - m_impl.m_operation = op; -} - -NdbScanFilter::~NdbScanFilter(){ - delete &m_impl; -} - -int -NdbScanFilter::begin(Group group){ - - switch(group){ - case NdbScanFilter::AND: - INT_DEBUG(("Begin(AND)")); - break; - case NdbScanFilter::OR: - INT_DEBUG(("Begin(OR)")); - break; - case NdbScanFilter::NAND: - INT_DEBUG(("Begin(NAND)")); - break; - case NdbScanFilter::NOR: - INT_DEBUG(("Begin(NOR)")); - break; - } - - if(group == m_impl.m_current.m_group){ - switch(group){ - case NdbScanFilter::AND: - case NdbScanFilter::OR: - m_impl.m_current.m_popCount++; - return 0; - case NdbScanFilter::NOR: - case NdbScanFilter::NAND: - break; - } - } - - NdbScanFilterImpl::State tmp = m_impl.m_current; - m_impl.m_stack.push_back(m_impl.m_current); - m_impl.m_current.m_group = group; - m_impl.m_current.m_ownLabel = m_impl.m_label++; - m_impl.m_current.m_popCount = 0; - - switch(group){ - case NdbScanFilter::AND: - case NdbScanFilter::NAND: - m_impl.m_current.m_falseLabel = m_impl.m_current.m_ownLabel; - m_impl.m_current.m_trueLabel = tmp.m_trueLabel; - break; - case NdbScanFilter::OR: - case NdbScanFilter::NOR: - m_impl.m_current.m_falseLabel = tmp.m_falseLabel; - m_impl.m_current.m_trueLabel = m_impl.m_current.m_ownLabel; - break; - default: - m_impl.m_operation->setErrorCodeAbort(4260); - return -1; - } - - return 0; -} - -int -NdbScanFilter::end(){ - - switch(m_impl.m_current.m_group){ - case NdbScanFilter::AND: - INT_DEBUG(("End(AND pc=%d)", m_impl.m_current.m_popCount)); - break; - case NdbScanFilter::OR: - INT_DEBUG(("End(OR pc=%d)", m_impl.m_current.m_popCount)); - break; - case NdbScanFilter::NAND: - INT_DEBUG(("End(NAND pc=%d)", m_impl.m_current.m_popCount)); - break; - case NdbScanFilter::NOR: - INT_DEBUG(("End(NOR pc=%d)", m_impl.m_current.m_popCount)); - break; - } - - if(m_impl.m_current.m_popCount > 0){ - m_impl.m_current.m_popCount--; - return 0; - } - - NdbScanFilterImpl::State tmp = m_impl.m_current; - m_impl.m_current = m_impl.m_stack.back(); - m_impl.m_stack.erase(m_impl.m_stack.size() - 1); - - switch(tmp.m_group){ - case NdbScanFilter::AND: - if(tmp.m_trueLabel == (Uint32)~0){ - m_impl.m_operation->interpret_exit_ok(); - } else { - m_impl.m_operation->branch_label(tmp.m_trueLabel); - } - break; - case NdbScanFilter::NAND: - if(tmp.m_trueLabel == (Uint32)~0){ - m_impl.m_operation->interpret_exit_nok(); - } else { - m_impl.m_operation->branch_label(tmp.m_falseLabel); - } - break; - case NdbScanFilter::OR: - if(tmp.m_falseLabel == (Uint32)~0){ - m_impl.m_operation->interpret_exit_nok(); - } else { - m_impl.m_operation->branch_label(tmp.m_falseLabel); - } - break; - case NdbScanFilter::NOR: - if(tmp.m_falseLabel == (Uint32)~0){ - m_impl.m_operation->interpret_exit_ok(); - } else { - m_impl.m_operation->branch_label(tmp.m_trueLabel); - } - break; - default: - m_impl.m_operation->setErrorCodeAbort(4260); - return -1; - } - - m_impl.m_operation->def_label(tmp.m_ownLabel); - - if(m_impl.m_stack.size() == 0){ - switch(tmp.m_group){ - case NdbScanFilter::AND: - case NdbScanFilter::NOR: - m_impl.m_operation->interpret_exit_nok(); - break; - case NdbScanFilter::OR: - case NdbScanFilter::NAND: - m_impl.m_operation->interpret_exit_ok(); - break; - default: - m_impl.m_operation->setErrorCodeAbort(4260); - return -1; - } - } - - return 0; -} - -int -NdbScanFilter::istrue(){ - if(m_impl.m_current.m_group < NdbScanFilter::AND || - m_impl.m_current.m_group > NdbScanFilter::NOR){ - m_impl.m_operation->setErrorCodeAbort(4260); - return -1; - } - - if(m_impl.m_current.m_trueLabel == (Uint32)~0){ - return m_impl.m_operation->interpret_exit_ok(); - } else { - return m_impl.m_operation->branch_label(m_impl.m_current.m_trueLabel); - } -} - -int -NdbScanFilter::isfalse(){ - if(m_impl.m_current.m_group < NdbScanFilter::AND || - m_impl.m_current.m_group > NdbScanFilter::NOR){ - m_impl.m_operation->setErrorCodeAbort(4260); - return -1; - } - - if(m_impl.m_current.m_falseLabel == (Uint32)~0){ - return m_impl.m_operation->interpret_exit_nok(); - } else { - return m_impl.m_operation->branch_label(m_impl.m_current.m_falseLabel); - } -} - - -#define action(x, y, z) - - -typedef int (NdbOperation:: * Branch1)(Uint32, Uint32 label); -typedef int (NdbOperation:: * StrBranch2)(Uint32, const void*, Uint32, bool, Uint32); - -struct tab2 { - Branch1 m_branches[5]; -}; - -static const tab2 table2[] = { - /** - * IS NULL - */ - { { 0, - &NdbOperation::branch_col_ne_null, - &NdbOperation::branch_col_eq_null, - &NdbOperation::branch_col_eq_null, - &NdbOperation::branch_col_ne_null } } - - /** - * IS NOT NULL - */ - ,{ { 0, - &NdbOperation::branch_col_eq_null, - &NdbOperation::branch_col_ne_null, - &NdbOperation::branch_col_ne_null, - &NdbOperation::branch_col_eq_null } } -}; - -const int tab2_sz = sizeof(table2)/sizeof(table2[0]); - -int -NdbScanFilterImpl::cond_col(Interpreter::UnaryCondition op, Uint32 AttrId){ - - if(op < 0 || op >= tab2_sz){ - m_operation->setErrorCodeAbort(4262); - return -1; - } - - if(m_current.m_group < NdbScanFilter::AND || - m_current.m_group > NdbScanFilter::NOR){ - m_operation->setErrorCodeAbort(4260); - return -1; - } - - Branch1 branch = table2[op].m_branches[m_current.m_group]; - (m_operation->* branch)(AttrId, m_current.m_ownLabel); - return 0; -} - -int -NdbScanFilter::isnull(int AttrId){ - return m_impl.cond_col(Interpreter::IS_NULL, AttrId); -} - -int -NdbScanFilter::isnotnull(int AttrId){ - return m_impl.cond_col(Interpreter::IS_NOT_NULL, AttrId); -} - -struct tab3 { - StrBranch2 m_branches[5]; -}; - -static const tab3 table3[] = { - /** - * EQ (AND, OR, NAND, NOR) - */ - { { 0, - &NdbOperation::branch_col_ne, - &NdbOperation::branch_col_eq, - &NdbOperation::branch_col_ne, - &NdbOperation::branch_col_eq } } - - /** - * NEQ - */ - ,{ { 0, - &NdbOperation::branch_col_eq, - &NdbOperation::branch_col_ne, - &NdbOperation::branch_col_eq, - &NdbOperation::branch_col_ne } } - - /** - * LT - */ - ,{ { 0, - &NdbOperation::branch_col_le, - &NdbOperation::branch_col_gt, - &NdbOperation::branch_col_le, - &NdbOperation::branch_col_gt } } - - /** - * LE - */ - ,{ { 0, - &NdbOperation::branch_col_lt, - &NdbOperation::branch_col_ge, - &NdbOperation::branch_col_lt, - &NdbOperation::branch_col_ge } } - - /** - * GT - */ - ,{ { 0, - &NdbOperation::branch_col_ge, - &NdbOperation::branch_col_lt, - &NdbOperation::branch_col_ge, - &NdbOperation::branch_col_lt } } - - /** - * GE - */ - ,{ { 0, - &NdbOperation::branch_col_gt, - &NdbOperation::branch_col_le, - &NdbOperation::branch_col_gt, - &NdbOperation::branch_col_le } } - - /** - * LIKE - */ - ,{ { 0, - &NdbOperation::branch_col_notlike, - &NdbOperation::branch_col_like, - &NdbOperation::branch_col_notlike, - &NdbOperation::branch_col_like } } - - /** - * NOT LIKE - */ - ,{ { 0, - &NdbOperation::branch_col_like, - &NdbOperation::branch_col_notlike, - &NdbOperation::branch_col_like, - &NdbOperation::branch_col_notlike } } -}; - -const int tab3_sz = sizeof(table3)/sizeof(table3[0]); - -int -NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition op, - Uint32 AttrId, - const void * value, Uint32 len){ - if(op < 0 || op >= tab3_sz){ - m_operation->setErrorCodeAbort(4260); - return -1; - } - - if(m_current.m_group < NdbScanFilter::AND || - m_current.m_group > NdbScanFilter::NOR){ - m_operation->setErrorCodeAbort(4260); - return -1; - } - - StrBranch2 branch = table3[op].m_branches[m_current.m_group]; - const NdbDictionary::Column * col = - m_operation->m_currentTable->getColumn(AttrId); - - if(col == 0){ - m_operation->setErrorCodeAbort(4261); - return -1; - } - - int ret = (m_operation->* branch)(AttrId, value, len, false, m_current.m_ownLabel); - return ret; -} - -int -NdbScanFilter::cmp(BinaryCondition cond, int ColId, - const void *val, Uint32 len) -{ - switch(cond){ - case COND_LE: - return m_impl.cond_col_const(Interpreter::LE, ColId, val, len); - case COND_LT: - return m_impl.cond_col_const(Interpreter::LT, ColId, val, len); - case COND_GE: - return m_impl.cond_col_const(Interpreter::GE, ColId, val, len); - case COND_GT: - return m_impl.cond_col_const(Interpreter::GT, ColId, val, len); - case COND_EQ: - return m_impl.cond_col_const(Interpreter::EQ, ColId, val, len); - case COND_NE: - return m_impl.cond_col_const(Interpreter::NE, ColId, val, len); - case COND_LIKE: - return m_impl.cond_col_const(Interpreter::LIKE, ColId, val, len); - case COND_NOT_LIKE: - return m_impl.cond_col_const(Interpreter::NOT_LIKE, ColId, val, len); - } - return -1; -} - - -#if 0 -int -main(void){ - if(0) - { - ndbout << "a > 7 AND b < 9 AND c = 4" << endl; - NdbScanFilter f(0); - f.begin(NdbScanFilter::AND); - f.gt(0, 7); - f.lt(1, 9); - f.eq(2, 4); - f.end(); - ndbout << endl; - } - - if(0) - { - ndbout << "a > 7 OR b < 9 OR c = 4" << endl; - NdbScanFilter f(0); - f.begin(NdbScanFilter::OR); - f.gt(0, 7); - f.lt(1, 9); - f.eq(2, 4); - f.end(); - ndbout << endl; - } - - if(0) - { - ndbout << "a > 7 AND (b < 9 OR c = 4)" << endl; - NdbScanFilter f(0); - f.begin(NdbScanFilter::AND); - f.gt(0, 7); - f.begin(NdbScanFilter::OR); - f.lt(1, 9); - f.eq(2, 4); - f.end(); - f.end(); - ndbout << endl; - } - - if(0) - { - ndbout << "a > 7 AND (b < 9 AND c = 4)" << endl; - NdbScanFilter f(0); - f.begin(NdbScanFilter::AND); - f.gt(0, 7); - f.begin(NdbScanFilter::AND); - f.lt(1, 9); - f.eq(2, 4); - f.end(); - f.end(); - ndbout << endl; - } - - if(0) - { - ndbout << "(a > 7 AND b < 9) AND c = 4" << endl; - NdbScanFilter f(0); - f.begin(NdbScanFilter::AND); - f.begin(NdbScanFilter::AND); - f.gt(0, 7); - f.lt(1, 9); - f.end(); - f.eq(2, 4); - f.end(); - ndbout << endl; - } - - if(1) - { - ndbout << "(a > 7 OR b < 9) AND (c = 4 OR c = 5)" << endl; - NdbScanFilter f(0); - f.begin(NdbScanFilter::AND); - f.begin(NdbScanFilter::OR); - f.gt(0, 7); - f.lt(1, 9); - f.end(); - f.begin(NdbScanFilter::OR); - f.eq(2, 4); - f.eq(2, 5); - f.end(); - f.end(); - ndbout << endl; - } - - if(1) - { - ndbout << "(a > 7 AND b < 9) OR (c = 4 AND c = 5)" << endl; - NdbScanFilter f(0); - f.begin(NdbScanFilter::OR); - f.begin(NdbScanFilter::AND); - f.gt(0, 7); - f.lt(1, 9); - f.end(); - f.begin(NdbScanFilter::AND); - f.eq(2, 4); - f.eq(2, 5); - f.end(); - f.end(); - ndbout << endl; - } - - if(1) - { - ndbout << - "((a > 7 AND b < 9) OR (c = 4 AND d = 5)) AND " - "((e > 6 AND f < 8) OR (g = 2 AND h = 3)) " << endl; - NdbScanFilter f(0); - f.begin(NdbScanFilter::AND); - f.begin(NdbScanFilter::OR); - f.begin(NdbScanFilter::AND); - f.gt(0, 7); - f.lt(1, 9); - f.end(); - f.begin(NdbScanFilter::AND); - f.eq(2, 4); - f.eq(3, 5); - f.end(); - f.end(); - - f.begin(NdbScanFilter::OR); - f.begin(NdbScanFilter::AND); - f.gt(4, 6); - f.lt(5, 8); - f.end(); - f.begin(NdbScanFilter::AND); - f.eq(6, 2); - f.eq(7, 3); - f.end(); - f.end(); - f.end(); - } - - return 0; -} -#endif - -template class Vector<NdbScanFilterImpl::State>; - diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp deleted file mode 100644 index 9cd78ec721b..00000000000 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ /dev/null @@ -1,1669 +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 */ - -#include <ndb_global.h> -#include <Ndb.hpp> -#include <NdbScanOperation.hpp> -#include <NdbIndexScanOperation.hpp> -#include <NdbTransaction.hpp> -#include "NdbApiSignal.hpp" -#include <NdbOut.hpp> -#include "NdbDictionaryImpl.hpp" -#include <NdbBlob.hpp> - -#include <NdbRecAttr.hpp> -#include <NdbReceiver.hpp> - -#include <stdlib.h> -#include <NdbSqlUtil.hpp> - -#include <signaldata/ScanTab.hpp> -#include <signaldata/KeyInfo.hpp> -#include <signaldata/AttrInfo.hpp> -#include <signaldata/TcKeyReq.hpp> - -#define DEBUG_NEXT_RESULT 0 - -NdbScanOperation::NdbScanOperation(Ndb* aNdb) : - NdbOperation(aNdb), - m_transConnection(NULL) -{ - theParallelism = 0; - m_allocated_receivers = 0; - m_prepared_receivers = 0; - m_api_receivers = 0; - m_conf_receivers = 0; - m_sent_receivers = 0; - m_receivers = 0; - m_array = new Uint32[1]; // skip if on delete in fix_receivers - theSCAN_TABREQ = 0; -} - -NdbScanOperation::~NdbScanOperation() -{ - for(Uint32 i = 0; i<m_allocated_receivers; i++){ - m_receivers[i]->release(); - theNdb->releaseNdbScanRec(m_receivers[i]); - } - delete[] m_array; -} - -void -NdbScanOperation::setErrorCode(int aErrorCode){ - NdbTransaction* tmp = theNdbCon; - theNdbCon = m_transConnection; - NdbOperation::setErrorCode(aErrorCode); - theNdbCon = tmp; -} - -void -NdbScanOperation::setErrorCodeAbort(int aErrorCode){ - NdbTransaction* tmp = theNdbCon; - theNdbCon = m_transConnection; - NdbOperation::setErrorCodeAbort(aErrorCode); - theNdbCon = tmp; -} - - -/***************************************************************************** - * int init(); - * - * Return Value: Return 0 : init was successful. - * Return -1: In all other case. - * Remark: Initiates operation record after allocation. - *****************************************************************************/ -int -NdbScanOperation::init(const NdbTableImpl* tab, NdbTransaction* myConnection) -{ - m_transConnection = myConnection; - //NdbTransaction* aScanConnection = theNdb->startTransaction(myConnection); - NdbTransaction* aScanConnection = theNdb->hupp(myConnection); - if (!aScanConnection){ - setErrorCodeAbort(theNdb->getNdbError().code); - return -1; - } - - // NOTE! The hupped trans becomes the owner of the operation - if(NdbOperation::init(tab, aScanConnection) != 0){ - return -1; - } - - initInterpreter(); - - theStatus = GetValue; - theOperationType = OpenScanRequest; - theNdbCon->theMagicNumber = 0xFE11DF; - theNoOfTupKeyLeft = tab->m_noOfDistributionKeys; - m_read_range_no = 0; - return 0; -} - -int -NdbScanOperation::readTuples(NdbScanOperation::LockMode lm, - Uint32 batch, - Uint32 parallel) -{ - m_ordered = m_descending = false; - Uint32 fragCount = m_currentTable->m_fragmentCount; - - if (parallel > fragCount || parallel == 0) { - parallel = fragCount; - } - - // It is only possible to call openScan if - // 1. this transcation don't already contain another scan operation - // 2. this transaction don't already contain other operations - // 3. theScanOp contains a NdbScanOperation - if (theNdbCon->theScanningOp != NULL){ - setErrorCode(4605); - return -1; - } - - theNdbCon->theScanningOp = this; - theLockMode = lm; - - bool lockExcl, lockHoldMode, readCommitted; - switch(lm){ - case NdbScanOperation::LM_Read: - lockExcl = false; - lockHoldMode = true; - readCommitted = false; - break; - case NdbScanOperation::LM_Exclusive: - lockExcl = true; - lockHoldMode = true; - readCommitted = false; - break; - case NdbScanOperation::LM_CommittedRead: - lockExcl = false; - lockHoldMode = false; - readCommitted = true; - break; - default: - setErrorCode(4003); - return -1; - } - - m_keyInfo = lockExcl ? 1 : 0; - - bool range = false; - if (m_accessTable->m_indexType == NdbDictionary::Index::OrderedIndex) - { - if (m_currentTable == m_accessTable){ - // Old way of scanning indexes, should not be allowed - m_currentTable = theNdb->theDictionary-> - getTable(m_currentTable->m_primaryTable.c_str()); - assert(m_currentTable != NULL); - } - assert (m_currentTable != m_accessTable); - // Modify operation state - theStatus = GetValue; - theOperationType = OpenRangeScanRequest; - range = true; - } - - theParallelism = parallel; - - if(fix_receivers(parallel) == -1){ - setErrorCodeAbort(4000); - return -1; - } - - theSCAN_TABREQ = (!theSCAN_TABREQ ? theNdb->getSignal() : theSCAN_TABREQ); - if (theSCAN_TABREQ == NULL) { - setErrorCodeAbort(4000); - return -1; - }//if - - theSCAN_TABREQ->setSignal(GSN_SCAN_TABREQ); - ScanTabReq * req = CAST_PTR(ScanTabReq, theSCAN_TABREQ->getDataPtrSend()); - req->apiConnectPtr = theNdbCon->theTCConPtr; - req->tableId = m_accessTable->m_tableId; - req->tableSchemaVersion = m_accessTable->m_version; - req->storedProcId = 0xFFFF; - req->buddyConPtr = theNdbCon->theBuddyConPtr; - - Uint32 reqInfo = 0; - ScanTabReq::setParallelism(reqInfo, parallel); - ScanTabReq::setScanBatch(reqInfo, 0); - ScanTabReq::setLockMode(reqInfo, lockExcl); - ScanTabReq::setHoldLockFlag(reqInfo, lockHoldMode); - ScanTabReq::setReadCommittedFlag(reqInfo, readCommitted); - ScanTabReq::setRangeScanFlag(reqInfo, range); - req->requestInfo = reqInfo; - - Uint64 transId = theNdbCon->getTransactionId(); - req->transId1 = (Uint32) transId; - req->transId2 = (Uint32) (transId >> 32); - - NdbApiSignal* tSignal = theSCAN_TABREQ->next(); - if(!tSignal) - { - theSCAN_TABREQ->next(tSignal = theNdb->getSignal()); - } - theLastKEYINFO = tSignal; - - tSignal->setSignal(GSN_KEYINFO); - theKEYINFOptr = ((KeyInfo*)tSignal->getDataPtrSend())->keyData; - theTotalNrOfKeyWordInSignal= 0; - - getFirstATTRINFOScan(); - return 0; -} - -int -NdbScanOperation::fix_receivers(Uint32 parallel){ - assert(parallel > 0); - if(parallel > m_allocated_receivers){ - const Uint32 sz = parallel * (4*sizeof(char*)+sizeof(Uint32)); - - Uint64 * tmp = new Uint64[(sz+7)/8]; - // Save old receivers - memcpy(tmp, m_receivers, m_allocated_receivers*sizeof(char*)); - delete[] m_array; - m_array = (Uint32*)tmp; - - m_receivers = (NdbReceiver**)tmp; - m_api_receivers = m_receivers + parallel; - m_conf_receivers = m_api_receivers + parallel; - m_sent_receivers = m_conf_receivers + parallel; - m_prepared_receivers = (Uint32*)(m_sent_receivers + parallel); - - // Only get/init "new" receivers - NdbReceiver* tScanRec; - for (Uint32 i = m_allocated_receivers; i < parallel; i ++) { - tScanRec = theNdb->getNdbScanRec(); - if (tScanRec == NULL) { - setErrorCodeAbort(4000); - return -1; - }//if - m_receivers[i] = tScanRec; - tScanRec->init(NdbReceiver::NDB_SCANRECEIVER, this); - } - m_allocated_receivers = parallel; - } - - reset_receivers(parallel, 0); - return 0; -} - -/** - * Move receiver from send array to conf:ed array - */ -void -NdbScanOperation::receiver_delivered(NdbReceiver* tRec){ - if(theError.code == 0){ - if(DEBUG_NEXT_RESULT) - ndbout_c("receiver_delivered"); - - Uint32 idx = tRec->m_list_index; - Uint32 last = m_sent_receivers_count - 1; - if(idx != last){ - NdbReceiver * move = m_sent_receivers[last]; - m_sent_receivers[idx] = move; - move->m_list_index = idx; - } - m_sent_receivers_count = last; - - last = m_conf_receivers_count; - m_conf_receivers[last] = tRec; - m_conf_receivers_count = last + 1; - tRec->m_list_index = last; - tRec->m_current_row = 0; - } -} - -/** - * Remove receiver as it's completed - */ -void -NdbScanOperation::receiver_completed(NdbReceiver* tRec){ - if(theError.code == 0){ - if(DEBUG_NEXT_RESULT) - ndbout_c("receiver_completed"); - - Uint32 idx = tRec->m_list_index; - Uint32 last = m_sent_receivers_count - 1; - if(idx != last){ - NdbReceiver * move = m_sent_receivers[last]; - m_sent_receivers[idx] = move; - move->m_list_index = idx; - } - m_sent_receivers_count = last; - } -} - -/***************************************************************************** - * int getFirstATTRINFOScan( U_int32 aData ) - * - * Return Value: Return 0: Successful - * Return -1: All other cases - * Parameters: None: Only allocate the first signal. - * Remark: When a scan is defined we need to use this method instead - * of insertATTRINFO for the first signal. - * This is because we need not to mess up the code in - * insertATTRINFO with if statements since we are not - * interested in the TCKEYREQ signal. - *****************************************************************************/ -int -NdbScanOperation::getFirstATTRINFOScan() -{ - NdbApiSignal* tSignal; - - tSignal = theNdb->getSignal(); - if (tSignal == NULL){ - setErrorCodeAbort(4000); - return -1; - } - tSignal->setSignal(m_attrInfoGSN); - theAI_LenInCurrAI = 8; - theATTRINFOptr = &tSignal->getDataPtrSend()[8]; - theFirstATTRINFO = tSignal; - theCurrentATTRINFO = tSignal; - theCurrentATTRINFO->next(NULL); - - return 0; -} - -/** - * Constats for theTupleKeyDefined[][0] - */ -#define SETBOUND_EQ 1 -#define FAKE_PTR 2 -#define API_PTR 3 - -#define WAITFOR_SCAN_TIMEOUT 120000 - -int -NdbScanOperation::executeCursor(int nodeId){ - NdbTransaction * tCon = theNdbCon; - TransporterFacade* tp = TransporterFacade::instance(); - Guard guard(tp->theMutexPtr); - - Uint32 magic = tCon->theMagicNumber; - Uint32 seq = tCon->theNodeSequence; - - if (tp->get_node_alive(nodeId) && - (tp->getNodeSequence(nodeId) == seq)) { - - /** - * Only call prepareSendScan first time (incase of restarts) - * - check with theMagicNumber - */ - tCon->theMagicNumber = 0x37412619; - if(magic != 0x37412619 && - prepareSendScan(tCon->theTCConPtr, tCon->theTransactionId) == -1) - return -1; - - - if (doSendScan(nodeId) == -1) - return -1; - - return 0; - } else { - if (!(tp->get_node_stopping(nodeId) && - (tp->getNodeSequence(nodeId) == seq))){ - TRACE_DEBUG("The node is hard dead when attempting to start a scan"); - setErrorCode(4029); - tCon->theReleaseOnClose = true; - } else { - TRACE_DEBUG("The node is stopping when attempting to start a scan"); - setErrorCode(4030); - }//if - tCon->theCommitStatus = NdbTransaction::Aborted; - }//if - return -1; -} - - -int NdbScanOperation::nextResult(bool fetchAllowed, bool forceSend) -{ - int res; - if ((res = nextResultImpl(fetchAllowed, forceSend)) == 0) { - // handle blobs - NdbBlob* tBlob = theBlobList; - while (tBlob != 0) { - if (tBlob->atNextResult() == -1) - return -1; - tBlob = tBlob->theNext; - } - /* - * Flush blob part ops on behalf of user because - * - nextResult is analogous to execute(NoCommit) - * - user is likely to want blob value before next execute - */ - if (m_transConnection->executePendingBlobOps() == -1) - return -1; - return 0; - } - return res; -} - -int NdbScanOperation::nextResultImpl(bool fetchAllowed, bool forceSend) -{ - if(m_ordered) - return ((NdbIndexScanOperation*)this)->next_result_ordered(fetchAllowed, - forceSend); - - /** - * Check current receiver - */ - int retVal = 2; - Uint32 idx = m_current_api_receiver; - Uint32 last = m_api_receivers_count; - m_curr_row = 0; - - if(DEBUG_NEXT_RESULT) - ndbout_c("nextResult(%d) idx=%d last=%d", fetchAllowed, idx, last); - - /** - * Check next buckets - */ - for(; idx < last; idx++){ - NdbReceiver* tRec = m_api_receivers[idx]; - if(tRec->nextResult()){ - m_curr_row = tRec->copyout(theReceiver); - retVal = 0; - break; - } - } - - /** - * We have advanced atleast one bucket - */ - if(!fetchAllowed || !retVal){ - m_current_api_receiver = idx; - if(DEBUG_NEXT_RESULT) ndbout_c("return %d", retVal); - return retVal; - } - - Uint32 nodeId = theNdbCon->theDBnode; - TransporterFacade* tp = TransporterFacade::instance(); - Guard guard(tp->theMutexPtr); - if(theError.code) - return -1; - - Uint32 seq = theNdbCon->theNodeSequence; - if(seq == tp->getNodeSequence(nodeId) && send_next_scan(idx, false, - forceSend) == 0){ - - idx = m_current_api_receiver; - last = m_api_receivers_count; - - do { - if(theError.code){ - setErrorCode(theError.code); - if(DEBUG_NEXT_RESULT) ndbout_c("return -1"); - return -1; - } - - Uint32 cnt = m_conf_receivers_count; - Uint32 sent = m_sent_receivers_count; - - if(DEBUG_NEXT_RESULT) - ndbout_c("idx=%d last=%d cnt=%d sent=%d", idx, last, cnt, sent); - - if(cnt > 0){ - /** - * Just move completed receivers - */ - memcpy(m_api_receivers+last, m_conf_receivers, cnt * sizeof(char*)); - last += cnt; - m_conf_receivers_count = 0; - } else if(retVal == 2 && sent > 0){ - /** - * No completed... - */ - theNdb->theImpl->theWaiter.m_node = nodeId; - theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; - int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); - if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) { - continue; - } else { - idx = last; - retVal = -2; //return_code; - } - } else if(retVal == 2){ - /** - * No completed & no sent -> EndOfData - */ - theError.code = -1; // make sure user gets error if he tries again - if(DEBUG_NEXT_RESULT) ndbout_c("return 1"); - return 1; - } - - if(retVal == 0) - break; - - for(; idx < last; idx++){ - NdbReceiver* tRec = m_api_receivers[idx]; - if(tRec->nextResult()){ - m_curr_row = tRec->copyout(theReceiver); - retVal = 0; - break; - } - } - } while(retVal == 2); - } else { - retVal = -3; - } - - m_api_receivers_count = last; - m_current_api_receiver = idx; - - switch(retVal){ - case 0: - case 1: - case 2: - if(DEBUG_NEXT_RESULT) ndbout_c("return %d", retVal); - return retVal; - case -1: - setErrorCode(4008); // Timeout - break; - case -2: - setErrorCode(4028); // Node fail - break; - case -3: // send_next_scan -> return fail (set error-code self) - if(theError.code == 0) - setErrorCode(4028); // seq changed = Node fail - break; - } - - theNdbCon->theTransactionIsStarted = false; - theNdbCon->theReleaseOnClose = true; - if(DEBUG_NEXT_RESULT) ndbout_c("return -1", retVal); - return -1; -} - -int -NdbScanOperation::send_next_scan(Uint32 cnt, bool stopScanFlag, - bool forceSend){ - if(cnt > 0){ - NdbApiSignal tSignal(theNdb->theMyRef); - tSignal.setSignal(GSN_SCAN_NEXTREQ); - - Uint32* theData = tSignal.getDataPtrSend(); - theData[0] = theNdbCon->theTCConPtr; - theData[1] = stopScanFlag == true ? 1 : 0; - Uint64 transId = theNdbCon->theTransactionId; - theData[2] = transId; - theData[3] = (Uint32) (transId >> 32); - - /** - * Prepare ops - */ - Uint32 last = m_sent_receivers_count; - Uint32 * prep_array = (cnt > 21 ? m_prepared_receivers : theData + 4); - Uint32 sent = 0; - for(Uint32 i = 0; i<cnt; i++){ - NdbReceiver * tRec = m_api_receivers[i]; - if((prep_array[sent] = tRec->m_tcPtrI) != RNIL) - { - m_sent_receivers[last+sent] = tRec; - tRec->m_list_index = last+sent; - tRec->prepareSend(); - sent++; - } - } - memmove(m_api_receivers, m_api_receivers+cnt, - (theParallelism-cnt) * sizeof(char*)); - - int ret = 0; - if(sent) - { - Uint32 nodeId = theNdbCon->theDBnode; - TransporterFacade * tp = TransporterFacade::instance(); - if(cnt > 21){ - tSignal.setLength(4); - LinearSectionPtr ptr[3]; - ptr[0].p = prep_array; - ptr[0].sz = sent; - ret = tp->sendSignal(&tSignal, nodeId, ptr, 1); - } else { - tSignal.setLength(4+sent); - ret = tp->sendSignal(&tSignal, nodeId); - } - } - - if (!ret) checkForceSend(forceSend); - - m_sent_receivers_count = last + sent; - m_api_receivers_count -= cnt; - m_current_api_receiver = 0; - - return ret; - } - return 0; -} - -void NdbScanOperation::checkForceSend(bool forceSend) -{ - if (forceSend) { - TransporterFacade::instance()->forceSend(theNdb->theNdbBlockNumber); - } else { - TransporterFacade::instance()->checkForceSend(theNdb->theNdbBlockNumber); - }//if -} - -int -NdbScanOperation::prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId) -{ - printf("NdbScanOperation::prepareSend\n"); - abort(); - return 0; -} - -int -NdbScanOperation::doSend(int ProcessorId) -{ - printf("NdbScanOperation::doSend\n"); - return 0; -} - -void NdbScanOperation::close(bool forceSend) -{ - if(m_transConnection){ - if(DEBUG_NEXT_RESULT) - ndbout_c("close() theError.code = %d " - "m_api_receivers_count = %d " - "m_conf_receivers_count = %d " - "m_sent_receivers_count = %d", - theError.code, - m_api_receivers_count, - m_conf_receivers_count, - m_sent_receivers_count); - - TransporterFacade* tp = TransporterFacade::instance(); - Guard guard(tp->theMutexPtr); - close_impl(tp, forceSend); - - } while(0); - - theNdbCon->theScanningOp = 0; - theNdb->closeTransaction(theNdbCon); - - theNdbCon = 0; - m_transConnection = NULL; -} - -void -NdbScanOperation::execCLOSE_SCAN_REP(){ - m_conf_receivers_count = 0; - m_sent_receivers_count = 0; -} - -void NdbScanOperation::release() -{ - if(theNdbCon != 0 || m_transConnection != 0){ - close(); - } - for(Uint32 i = 0; i<m_allocated_receivers; i++){ - m_receivers[i]->release(); - } - - NdbOperation::release(); - - if(theSCAN_TABREQ) - { - theNdb->releaseSignal(theSCAN_TABREQ); - theSCAN_TABREQ = 0; - } -} - -/*************************************************************************** -int prepareSendScan(Uint32 aTC_ConnectPtr, - Uint64 aTransactionId) - -Return Value: Return 0 : preparation of send was succesful. - Return -1: In all other case. -Parameters: aTC_ConnectPtr: the Connect pointer to TC. - aTransactionId: the Transaction identity of the transaction. -Remark: Puts the the final data into ATTRINFO signal(s) after this - we know the how many signal to send and their sizes -***************************************************************************/ -int NdbScanOperation::prepareSendScan(Uint32 aTC_ConnectPtr, - Uint64 aTransactionId){ - - if (theInterpretIndicator != 1 || - (theOperationType != OpenScanRequest && - theOperationType != OpenRangeScanRequest)) { - setErrorCodeAbort(4005); - return -1; - } - - theErrorLine = 0; - - // In preapareSendInterpreted we set the sizes (word 4-8) in the - // first ATTRINFO signal. - if (prepareSendInterpreted() == -1) - return -1; - - if(m_ordered){ - ((NdbIndexScanOperation*)this)->fix_get_values(); - } - - theCurrentATTRINFO->setLength(theAI_LenInCurrAI); - - /** - * Prepare all receivers - */ - theReceiver.prepareSend(); - bool keyInfo = m_keyInfo; - Uint32 key_size = keyInfo ? m_currentTable->m_keyLenInWords : 0; - /** - * The number of records sent by each LQH is calculated and the kernel - * is informed of this number by updating the SCAN_TABREQ signal - */ - Uint32 batch_size, batch_byte_size, first_batch_size; - theReceiver.calculate_batch_size(key_size, - theParallelism, - batch_size, - batch_byte_size, - first_batch_size); - ScanTabReq * req = CAST_PTR(ScanTabReq, theSCAN_TABREQ->getDataPtrSend()); - ScanTabReq::setScanBatch(req->requestInfo, batch_size); - req->batch_byte_size= batch_byte_size; - req->first_batch_size= first_batch_size; - - /** - * Set keyinfo flag - * (Always keyinfo when using blobs) - */ - Uint32 reqInfo = req->requestInfo; - ScanTabReq::setKeyinfoFlag(reqInfo, keyInfo); - req->requestInfo = reqInfo; - - for(Uint32 i = 0; i<theParallelism; i++){ - m_receivers[i]->do_get_value(&theReceiver, batch_size, - key_size, - m_read_range_no); - } - return 0; -} - -/***************************************************************************** -int doSend() - -Return Value: Return >0 : send was succesful, returns number of signals sent - Return -1: In all other case. -Parameters: aProcessorId: Receiving processor node -Remark: Sends the ATTRINFO signal(s) -*****************************************************************************/ -int -NdbScanOperation::doSendScan(int aProcessorId) -{ - Uint32 tSignalCount = 0; - NdbApiSignal* tSignal; - - if (theInterpretIndicator != 1 || - (theOperationType != OpenScanRequest && - theOperationType != OpenRangeScanRequest)) { - setErrorCodeAbort(4005); - return -1; - } - - assert(theSCAN_TABREQ != NULL); - tSignal = theSCAN_TABREQ; - - Uint32 tupKeyLen = theTupKeyLen; - Uint32 len = theTotalNrOfKeyWordInSignal; - Uint32 aTC_ConnectPtr = theNdbCon->theTCConPtr; - Uint64 transId = theNdbCon->theTransactionId; - - // Update the "attribute info length in words" in SCAN_TABREQ before - // sending it. This could not be done in openScan because - // we created the ATTRINFO signals after the SCAN_TABREQ signal. - ScanTabReq * const req = CAST_PTR(ScanTabReq, tSignal->getDataPtrSend()); - req->attrLenKeyLen = (tupKeyLen << 16) | theTotalCurrAI_Len; - Uint32 tmp = req->requestInfo; - ScanTabReq::setDistributionKeyFlag(tmp, theDistrKeyIndicator_); - req->distributionKey = theDistributionKey; - req->requestInfo = tmp; - tSignal->setLength(ScanTabReq::StaticLength + theDistrKeyIndicator_); - - TransporterFacade *tp = TransporterFacade::instance(); - LinearSectionPtr ptr[3]; - ptr[0].p = m_prepared_receivers; - ptr[0].sz = theParallelism; - if (tp->sendSignal(tSignal, aProcessorId, ptr, 1) == -1) { - setErrorCode(4002); - return -1; - } - - if (tupKeyLen > 0){ - // must have at least one signal since it contains attrLen for bounds - assert(theLastKEYINFO != NULL); - tSignal = theLastKEYINFO; - tSignal->setLength(KeyInfo::HeaderLength + theTotalNrOfKeyWordInSignal); - - assert(theSCAN_TABREQ->next() != NULL); - tSignal = theSCAN_TABREQ->next(); - - NdbApiSignal* last; - do { - KeyInfo * keyInfo = CAST_PTR(KeyInfo, tSignal->getDataPtrSend()); - keyInfo->connectPtr = aTC_ConnectPtr; - keyInfo->transId[0] = Uint32(transId); - keyInfo->transId[1] = Uint32(transId >> 32); - - if (tp->sendSignal(tSignal,aProcessorId) == -1){ - setErrorCode(4002); - return -1; - } - - tSignalCount++; - last = tSignal; - tSignal = tSignal->next(); - } while(last != theLastKEYINFO); - } - - tSignal = theFirstATTRINFO; - while (tSignal != NULL) { - AttrInfo * attrInfo = CAST_PTR(AttrInfo, tSignal->getDataPtrSend()); - attrInfo->connectPtr = aTC_ConnectPtr; - attrInfo->transId[0] = Uint32(transId); - attrInfo->transId[1] = Uint32(transId >> 32); - - if (tp->sendSignal(tSignal,aProcessorId) == -1){ - setErrorCode(4002); - return -1; - } - tSignalCount++; - tSignal = tSignal->next(); - } - theStatus = WaitResponse; - - m_curr_row = 0; - m_sent_receivers_count = theParallelism; - if(m_ordered) - { - m_current_api_receiver = theParallelism; - m_api_receivers_count = theParallelism; - } - - return tSignalCount; -}//NdbOperation::doSendScan() - -/***************************************************************************** - * NdbOperation* takeOverScanOp(NdbTransaction* updateTrans); - * - * Parameters: The update transactions NdbTransaction pointer. - * Return Value: A reference to the transferred operation object - * or NULL if no success. - * Remark: Take over the scanning transactions NdbOperation - * object for a tuple to an update transaction, - * which is the last operation read in nextScanResult() - * (theNdbCon->thePreviousScanRec) - * - * FUTURE IMPLEMENTATION: (This note was moved from header file.) - * In the future, it will even be possible to transfer - * to a NdbTransaction on another Ndb-object. - * In this case the receiving NdbTransaction-object must call - * a method receiveOpFromScan to actually receive the information. - * This means that the updating transactions can be placed - * in separate threads and thus increasing the parallelism during - * the scan process. - ****************************************************************************/ -int -NdbScanOperation::getKeyFromKEYINFO20(Uint32* data, unsigned size) -{ - NdbRecAttr * tRecAttr = m_curr_row; - if(tRecAttr) - { - const Uint32 * src = (Uint32*)tRecAttr->aRef(); - memcpy(data, src, 4*size); - return 0; - } - return -1; -} - -NdbOperation* -NdbScanOperation::takeOverScanOp(OperationType opType, NdbTransaction* pTrans) -{ - - NdbRecAttr * tRecAttr = m_curr_row; - if(tRecAttr) - { - NdbOperation * newOp = pTrans->getNdbOperation(m_currentTable); - if (newOp == NULL){ - return NULL; - } - pTrans->theSimpleState = 0; - - const Uint32 len = (tRecAttr->attrSize() * tRecAttr->arraySize() + 3)/4-1; - - newOp->theTupKeyLen = len; - newOp->theOperationType = opType; - if (opType == DeleteRequest) { - newOp->theStatus = GetValue; - } else { - newOp->theStatus = SetValue; - } - - const Uint32 * src = (Uint32*)tRecAttr->aRef(); - const Uint32 tScanInfo = src[len] & 0x3FFFF; - const Uint32 tTakeOverFragment = src[len] >> 20; - { - UintR scanInfo = 0; - TcKeyReq::setTakeOverScanFlag(scanInfo, 1); - TcKeyReq::setTakeOverScanFragment(scanInfo, tTakeOverFragment); - TcKeyReq::setTakeOverScanInfo(scanInfo, tScanInfo); - newOp->theScanInfo = scanInfo; - newOp->theDistrKeyIndicator_ = 1; - newOp->theDistributionKey = tTakeOverFragment; - } - - // Copy the first 8 words of key info from KEYINF20 into TCKEYREQ - TcKeyReq * tcKeyReq = CAST_PTR(TcKeyReq,newOp->theTCREQ->getDataPtrSend()); - Uint32 i = 0; - for (i = 0; i < TcKeyReq::MaxKeyInfo && i < len; i++) { - tcKeyReq->keyInfo[i] = * src++; - } - - if(i < len){ - NdbApiSignal* tSignal = theNdb->getSignal(); - newOp->theTCREQ->next(tSignal); - - Uint32 left = len - i; - while(tSignal && left > KeyInfo::DataLength){ - tSignal->setSignal(GSN_KEYINFO); - KeyInfo * keyInfo = CAST_PTR(KeyInfo, tSignal->getDataPtrSend()); - memcpy(keyInfo->keyData, src, 4 * KeyInfo::DataLength); - src += KeyInfo::DataLength; - left -= KeyInfo::DataLength; - - tSignal->next(theNdb->getSignal()); - tSignal = tSignal->next(); - } - - if(tSignal && left > 0){ - tSignal->setSignal(GSN_KEYINFO); - KeyInfo * keyInfo = CAST_PTR(KeyInfo, tSignal->getDataPtrSend()); - memcpy(keyInfo->keyData, src, 4 * left); - } - } - // create blob handles automatically - if (opType == DeleteRequest && m_currentTable->m_noOfBlobs != 0) { - for (unsigned i = 0; i < m_currentTable->m_columns.size(); i++) { - NdbColumnImpl* c = m_currentTable->m_columns[i]; - assert(c != 0); - if (c->getBlobType()) { - if (newOp->getBlobHandle(pTrans, c) == NULL) - return NULL; - } - } - } - - return newOp; - } - return 0; -} - -NdbBlob* -NdbScanOperation::getBlobHandle(const char* anAttrName) -{ - m_keyInfo = 1; - return NdbOperation::getBlobHandle(m_transConnection, - m_currentTable->getColumn(anAttrName)); -} - -NdbBlob* -NdbScanOperation::getBlobHandle(Uint32 anAttrId) -{ - m_keyInfo = 1; - return NdbOperation::getBlobHandle(m_transConnection, - m_currentTable->getColumn(anAttrId)); -} - -NdbIndexScanOperation::NdbIndexScanOperation(Ndb* aNdb) - : NdbScanOperation(aNdb) -{ -} - -NdbIndexScanOperation::~NdbIndexScanOperation(){ -} - -int -NdbIndexScanOperation::setBound(const char* anAttrName, int type, - const void* aValue, Uint32 len) -{ - return setBound(m_accessTable->getColumn(anAttrName), type, aValue, len); -} - -int -NdbIndexScanOperation::setBound(Uint32 anAttrId, int type, - const void* aValue, Uint32 len) -{ - return setBound(m_accessTable->getColumn(anAttrId), type, aValue, len); -} - -int -NdbIndexScanOperation::equal_impl(const NdbColumnImpl* anAttrObject, - const char* aValue, - Uint32 len){ - return setBound(anAttrObject, BoundEQ, aValue, len); -} - -NdbRecAttr* -NdbIndexScanOperation::getValue_impl(const NdbColumnImpl* attrInfo, - char* aValue){ - if(!m_ordered){ - return NdbScanOperation::getValue_impl(attrInfo, aValue); - } - - int id = attrInfo->m_attrId; // In "real" table - assert(m_accessTable->m_index); - int sz = (int)m_accessTable->m_index->m_key_ids.size(); - if(id >= sz || (id = m_accessTable->m_index->m_key_ids[id]) == -1){ - return NdbScanOperation::getValue_impl(attrInfo, aValue); - } - - assert(id < NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY); - Uint32 marker = theTupleKeyDefined[id][0]; - - if(marker == SETBOUND_EQ){ - return NdbScanOperation::getValue_impl(attrInfo, aValue); - } else if(marker == API_PTR){ - return NdbScanOperation::getValue_impl(attrInfo, aValue); - } - - assert(marker == FAKE_PTR); - - UintPtr oldVal; - oldVal = theTupleKeyDefined[id][1]; -#if (SIZEOF_CHARP == 8) - oldVal = oldVal | (((UintPtr)theTupleKeyDefined[id][2]) << 32); -#endif - theTupleKeyDefined[id][0] = API_PTR; - - NdbRecAttr* tmp = (NdbRecAttr*)oldVal; - tmp->setup(attrInfo, aValue); - - return tmp; -} - -#include <AttributeHeader.hpp> -/* - * Define bound on index column in range scan. - */ -int -NdbIndexScanOperation::setBound(const NdbColumnImpl* tAttrInfo, - int type, const void* aValue, Uint32 len) -{ - if (theOperationType == OpenRangeScanRequest && - (0 <= type && type <= 4) && - len <= 8000) { - // insert bound type - Uint32 currLen = theTotalNrOfKeyWordInSignal; - Uint32 remaining = KeyInfo::DataLength - currLen; - Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize; - bool tDistrKey = tAttrInfo->m_distributionKey; - - len = aValue != NULL ? sizeInBytes : 0; - if (len != sizeInBytes && (len != 0)) { - setErrorCodeAbort(4209); - return -1; - } - - // insert attribute header - Uint32 tIndexAttrId = tAttrInfo->m_attrId; - Uint32 sizeInWords = (len + 3) / 4; - AttributeHeader ah(tIndexAttrId, sizeInWords); - const Uint32 ahValue = ah.m_value; - - const Uint32 align = (UintPtr(aValue) & 7); - const bool aligned = (tDistrKey && type == BoundEQ) ? - (align == 0) : (align & 3) == 0; - - const bool nobytes = (len & 0x3) == 0; - const Uint32 totalLen = 2 + sizeInWords; - Uint32 tupKeyLen = theTupKeyLen; - if(remaining > totalLen && aligned && nobytes){ - Uint32 * dst = theKEYINFOptr + currLen; - * dst ++ = type; - * dst ++ = ahValue; - memcpy(dst, aValue, 4 * sizeInWords); - theTotalNrOfKeyWordInSignal = currLen + totalLen; - } else { - if(!aligned || !nobytes){ - Uint32 tempData[2000]; - tempData[0] = type; - tempData[1] = ahValue; - tempData[2 + (len >> 2)] = 0; - memcpy(tempData+2, aValue, len); - - insertBOUNDS(tempData, 2+sizeInWords); - } else { - Uint32 buf[2] = { type, ahValue }; - insertBOUNDS(buf, 2); - insertBOUNDS((Uint32*)aValue, sizeInWords); - } - } - theTupKeyLen = tupKeyLen + totalLen; - - /** - * Do sorted stuff - */ - - /** - * The primary keys for an ordered index is defined in the beginning - * so it's safe to use [tIndexAttrId] - * (instead of looping as is NdbOperation::equal_impl) - */ - if(type == BoundEQ && tDistrKey) - { - theNoOfTupKeyLeft--; - return handle_distribution_key((Uint64*)aValue, sizeInWords); - } - return 0; - } else { - setErrorCodeAbort(4228); // XXX wrong code - return -1; - } -} - -int -NdbIndexScanOperation::insertBOUNDS(Uint32 * data, Uint32 sz){ - Uint32 len; - Uint32 remaining = KeyInfo::DataLength - theTotalNrOfKeyWordInSignal; - Uint32 * dst = theKEYINFOptr + theTotalNrOfKeyWordInSignal; - do { - len = (sz < remaining ? sz : remaining); - memcpy(dst, data, 4 * len); - - if(sz >= remaining){ - NdbApiSignal* tCurr = theLastKEYINFO; - tCurr->setLength(KeyInfo::MaxSignalLength); - NdbApiSignal* tSignal = tCurr->next(); - if(tSignal) - ; - else if((tSignal = theNdb->getSignal()) != 0) - { - tCurr->next(tSignal); - tSignal->setSignal(GSN_KEYINFO); - } else { - goto error; - } - theLastKEYINFO = tSignal; - theKEYINFOptr = dst = ((KeyInfo*)tSignal->getDataPtrSend())->keyData; - remaining = KeyInfo::DataLength; - sz -= len; - data += len; - } else { - len = (KeyInfo::DataLength - remaining) + len; - break; - } - } while(true); - theTotalNrOfKeyWordInSignal = len; - return 0; - -error: - setErrorCodeAbort(4228); // XXX wrong code - return -1; -} - -int -NdbIndexScanOperation::readTuples(LockMode lm, - Uint32 batch, - Uint32 parallel, - bool order_by, - bool order_desc, - bool read_range_no){ - int res = NdbScanOperation::readTuples(lm, batch, 0); - if(!res && read_range_no) - { - m_read_range_no = 1; - Uint32 word = 0; - AttributeHeader::init(&word, AttributeHeader::RANGE_NO, 0); - if(insertATTRINFO(word) == -1) - res = -1; - } - if(!res && order_by){ - m_ordered = true; - if (order_desc) { - m_descending = true; - ScanTabReq * req = CAST_PTR(ScanTabReq, theSCAN_TABREQ->getDataPtrSend()); - ScanTabReq::setDescendingFlag(req->requestInfo, true); - } - Uint32 cnt = m_accessTable->getNoOfColumns() - 1; - m_sort_columns = cnt; // -1 for NDB$NODE - m_current_api_receiver = m_sent_receivers_count; - m_api_receivers_count = m_sent_receivers_count; - - m_sort_columns = cnt; - for(Uint32 i = 0; i<cnt; i++){ - const NdbColumnImpl* key = m_accessTable->m_index->m_columns[i]; - const NdbColumnImpl* col = m_currentTable->getColumn(key->m_keyInfoPos); - NdbRecAttr* tmp = NdbScanOperation::getValue_impl(col, (char*)-1); - UintPtr newVal = UintPtr(tmp); - theTupleKeyDefined[i][0] = FAKE_PTR; - theTupleKeyDefined[i][1] = (newVal & 0xFFFFFFFF); -#if (SIZEOF_CHARP == 8) - theTupleKeyDefined[i][2] = (newVal >> 32); -#endif - } - } - m_this_bound_start = 0; - m_first_bound_word = theKEYINFOptr; - - return res; -} - -void -NdbIndexScanOperation::fix_get_values(){ - /** - * Loop through all getValues and set buffer pointer to "API" pointer - */ - NdbRecAttr * curr = theReceiver.theFirstRecAttr; - Uint32 cnt = m_accessTable->getNoOfColumns() - 1; - assert(cnt < NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY); - - const NdbIndexImpl * idx = m_accessTable->m_index; - const NdbTableImpl * tab = m_currentTable; - for(Uint32 i = 0; i<cnt; i++){ - Uint32 val = theTupleKeyDefined[i][0]; - switch(val){ - case FAKE_PTR: - curr->setup(curr->m_column, 0); - case API_PTR: - curr = curr->next(); - break; - case SETBOUND_EQ: - break; -#ifdef VM_TRACE - default: - abort(); -#endif - } - } -} - -int -NdbIndexScanOperation::compare(Uint32 skip, Uint32 cols, - const NdbReceiver* t1, - const NdbReceiver* t2){ - - NdbRecAttr * r1 = t1->m_rows[t1->m_current_row]; - NdbRecAttr * r2 = t2->m_rows[t2->m_current_row]; - - r1 = (skip ? r1->next() : r1); - r2 = (skip ? r2->next() : r2); - const int jdir = 1 - 2 * (int)m_descending; - assert(jdir == 1 || jdir == -1); - while(cols > 0){ - Uint32 * d1 = (Uint32*)r1->aRef(); - Uint32 * d2 = (Uint32*)r2->aRef(); - unsigned r1_null = r1->isNULL(); - if((r1_null ^ (unsigned)r2->isNULL())){ - return (r1_null ? -1 : 1) * jdir; - } - const NdbColumnImpl & col = NdbColumnImpl::getImpl(* r1->m_column); - Uint32 len = r1->theAttrSize * r1->theArraySize; - if(!r1_null){ - const NdbSqlUtil::Type& sqlType = NdbSqlUtil::getType(col.m_type); - int r = (*sqlType.m_cmp)(col.m_cs, d1, len, d2, len, true); - if(r){ - assert(r != NdbSqlUtil::CmpUnknown); - return r * jdir; - } - } - cols--; - r1 = r1->next(); - r2 = r2->next(); - } - return 0; -} - -int -NdbIndexScanOperation::next_result_ordered(bool fetchAllowed, - bool forceSend){ - - m_curr_row = 0; - Uint32 u_idx = 0, u_last = 0; - Uint32 s_idx = m_current_api_receiver; // first sorted - Uint32 s_last = theParallelism; // last sorted - - NdbReceiver** arr = m_api_receivers; - NdbReceiver* tRec = arr[s_idx]; - - if(DEBUG_NEXT_RESULT) ndbout_c("nextOrderedResult(%d) nextResult: %d", - fetchAllowed, - (s_idx < s_last ? tRec->nextResult() : 0)); - - if(DEBUG_NEXT_RESULT) ndbout_c("u=[%d %d] s=[%d %d]", - u_idx, u_last, - s_idx, s_last); - - bool fetchNeeded = (s_idx == s_last) || !tRec->nextResult(); - - if(fetchNeeded){ - if(fetchAllowed){ - if(DEBUG_NEXT_RESULT) ndbout_c("performing fetch..."); - TransporterFacade* tp = TransporterFacade::instance(); - Guard guard(tp->theMutexPtr); - if(theError.code) - return -1; - Uint32 seq = theNdbCon->theNodeSequence; - Uint32 nodeId = theNdbCon->theDBnode; - if(seq == tp->getNodeSequence(nodeId) && - !send_next_scan_ordered(s_idx, forceSend)){ - Uint32 tmp = m_sent_receivers_count; - s_idx = m_current_api_receiver; - while(m_sent_receivers_count > 0 && !theError.code){ - theNdb->theImpl->theWaiter.m_node = nodeId; - theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; - int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); - if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) { - continue; - } - if(DEBUG_NEXT_RESULT) ndbout_c("return -1"); - setErrorCode(4028); - return -1; - } - - if(theError.code){ - setErrorCode(theError.code); - if(DEBUG_NEXT_RESULT) ndbout_c("return -1"); - return -1; - } - - u_idx = 0; - u_last = m_conf_receivers_count; - m_conf_receivers_count = 0; - memcpy(arr, m_conf_receivers, u_last * sizeof(char*)); - - if(DEBUG_NEXT_RESULT) ndbout_c("sent: %d recv: %d", tmp, u_last); - } else { - setErrorCode(4028); - return -1; - } - } else { - if(DEBUG_NEXT_RESULT) ndbout_c("return 2"); - return 2; - } - } else { - u_idx = s_idx; - u_last = s_idx + 1; - s_idx++; - } - - if(DEBUG_NEXT_RESULT) ndbout_c("u=[%d %d] s=[%d %d]", - u_idx, u_last, - s_idx, s_last); - - - Uint32 cols = m_sort_columns + m_read_range_no; - Uint32 skip = m_keyInfo; - while(u_idx < u_last){ - u_last--; - tRec = arr[u_last]; - - // Do binary search instead to find place - Uint32 place = s_idx; - for(; place < s_last; place++){ - if(compare(skip, cols, tRec, arr[place]) <= 0){ - break; - } - } - - if(place != s_idx){ - if(DEBUG_NEXT_RESULT) - ndbout_c("memmove(%d, %d, %d)", s_idx-1, s_idx, (place - s_idx)); - memmove(arr+s_idx-1, arr+s_idx, sizeof(char*)*(place - s_idx)); - } - - if(DEBUG_NEXT_RESULT) ndbout_c("putting %d @ %d", u_last, place - 1); - m_api_receivers[place-1] = tRec; - s_idx--; - } - - if(DEBUG_NEXT_RESULT) ndbout_c("u=[%d %d] s=[%d %d]", - u_idx, u_last, - s_idx, s_last); - - m_current_api_receiver = s_idx; - - if(DEBUG_NEXT_RESULT) - for(Uint32 i = s_idx; i<s_last; i++) - ndbout_c("%p", arr[i]); - - tRec = m_api_receivers[s_idx]; - if(s_idx < s_last && tRec->nextResult()){ - m_curr_row = tRec->copyout(theReceiver); - if(DEBUG_NEXT_RESULT) ndbout_c("return 0"); - return 0; - } - - theError.code = -1; - if(DEBUG_NEXT_RESULT) ndbout_c("return 1"); - return 1; -} - -int -NdbIndexScanOperation::send_next_scan_ordered(Uint32 idx, bool forceSend){ - if(idx == theParallelism) - return 0; - - NdbReceiver* tRec = m_api_receivers[idx]; - NdbApiSignal tSignal(theNdb->theMyRef); - tSignal.setSignal(GSN_SCAN_NEXTREQ); - - Uint32 last = m_sent_receivers_count; - Uint32* theData = tSignal.getDataPtrSend(); - Uint32* prep_array = theData + 4; - - m_current_api_receiver = idx + 1; - if((prep_array[0] = tRec->m_tcPtrI) == RNIL) - { - if(DEBUG_NEXT_RESULT) - ndbout_c("receiver completed, don't send"); - return 0; - } - - theData[0] = theNdbCon->theTCConPtr; - theData[1] = 0; - Uint64 transId = theNdbCon->theTransactionId; - theData[2] = transId; - theData[3] = (Uint32) (transId >> 32); - - /** - * Prepare ops - */ - m_sent_receivers[last] = tRec; - tRec->m_list_index = last; - tRec->prepareSend(); - m_sent_receivers_count = last + 1; - - Uint32 nodeId = theNdbCon->theDBnode; - TransporterFacade * tp = TransporterFacade::instance(); - tSignal.setLength(4+1); - int ret= tp->sendSignal(&tSignal, nodeId); - if (!ret) checkForceSend(forceSend); - return ret; -} - -int -NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){ - Uint32 seq = theNdbCon->theNodeSequence; - Uint32 nodeId = theNdbCon->theDBnode; - - if(seq != tp->getNodeSequence(nodeId)) - { - theNdbCon->theReleaseOnClose = true; - return -1; - } - - /** - * Wait for outstanding - */ - while(theError.code == 0 && m_sent_receivers_count) - { - theNdb->theImpl->theWaiter.m_node = nodeId; - theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; - int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); - switch(return_code){ - case 0: - break; - case -1: - setErrorCode(4008); - case -2: - m_api_receivers_count = 0; - m_conf_receivers_count = 0; - m_sent_receivers_count = 0; - theNdbCon->theReleaseOnClose = true; - return -1; - } - } - - if(theError.code) - { - m_api_receivers_count = 0; - m_current_api_receiver = m_ordered ? theParallelism : 0; - } - - - /** - * move all conf'ed into api - * so that send_next_scan can check if they needs to be closed - */ - Uint32 api = m_api_receivers_count; - Uint32 conf = m_conf_receivers_count; - - if(m_ordered) - { - /** - * Ordered scan, keep the m_api_receivers "to the right" - */ - memmove(m_api_receivers, m_api_receivers+m_current_api_receiver, - (theParallelism - m_current_api_receiver) * sizeof(char*)); - api = (theParallelism - m_current_api_receiver); - m_api_receivers_count = api; - } - - if(DEBUG_NEXT_RESULT) - ndbout_c("close_impl: [order api conf sent curr parr] %d %d %d %d %d %d", - m_ordered, api, conf, - m_sent_receivers_count, m_current_api_receiver, theParallelism); - - if(api+conf) - { - /** - * There's something to close - * setup m_api_receivers (for send_next_scan) - */ - memcpy(m_api_receivers+api, m_conf_receivers, conf * sizeof(char*)); - m_api_receivers_count = api + conf; - m_conf_receivers_count = 0; - } - - // Send close scan - if(send_next_scan(api+conf, true, forceSend) == -1) - { - theNdbCon->theReleaseOnClose = true; - return -1; - } - - /** - * wait for close scan conf - */ - while(m_sent_receivers_count+m_api_receivers_count+m_conf_receivers_count) - { - theNdb->theImpl->theWaiter.m_node = nodeId; - theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; - int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); - switch(return_code){ - case 0: - break; - case -1: - setErrorCode(4008); - case -2: - m_api_receivers_count = 0; - m_conf_receivers_count = 0; - m_sent_receivers_count = 0; - theNdbCon->theReleaseOnClose = true; - return -1; - } - } - - return 0; -} - -void -NdbScanOperation::reset_receivers(Uint32 parallell, Uint32 ordered){ - for(Uint32 i = 0; i<parallell; i++){ - m_receivers[i]->m_list_index = i; - m_prepared_receivers[i] = m_receivers[i]->getId(); - m_sent_receivers[i] = m_receivers[i]; - m_conf_receivers[i] = 0; - m_api_receivers[i] = 0; - m_receivers[i]->prepareSend(); - } - - m_api_receivers_count = 0; - m_current_api_receiver = 0; - m_sent_receivers_count = 0; - m_conf_receivers_count = 0; -} - -int -NdbScanOperation::restart(bool forceSend) -{ - - TransporterFacade* tp = TransporterFacade::instance(); - Guard guard(tp->theMutexPtr); - Uint32 nodeId = theNdbCon->theDBnode; - - { - int res; - if((res= close_impl(tp, forceSend))) - { - return res; - } - } - - /** - * Reset receivers - */ - reset_receivers(theParallelism, m_ordered); - - theError.code = 0; - if (doSendScan(nodeId) == -1) - return -1; - - return 0; -} - -int -NdbIndexScanOperation::reset_bounds(bool forceSend){ - int res; - - { - TransporterFacade* tp = TransporterFacade::instance(); - Guard guard(tp->theMutexPtr); - res= close_impl(tp, forceSend); - } - - if(!res) - { - theError.code = 0; - reset_receivers(theParallelism, m_ordered); - - theLastKEYINFO = theSCAN_TABREQ->next(); - theKEYINFOptr = ((KeyInfo*)theLastKEYINFO->getDataPtrSend())->keyData; - theTupKeyLen = 0; - theTotalNrOfKeyWordInSignal = 0; - theNoOfTupKeyLeft = m_accessTable->m_noOfDistributionKeys; - theDistrKeyIndicator_ = 0; - m_this_bound_start = 0; - m_first_bound_word = theKEYINFOptr; - m_transConnection - ->remove_list((NdbOperation*&)m_transConnection->m_firstExecutedScanOp, - this); - m_transConnection->define_scan_op(this); - return 0; - } - return res; -} - -int -NdbIndexScanOperation::end_of_bound(Uint32 no) -{ - if(no < (1 << 13)) // Only 12-bits no of ranges - { - Uint32 bound_head = * m_first_bound_word; - bound_head |= (theTupKeyLen - m_this_bound_start) << 16 | (no << 4); - * m_first_bound_word = bound_head; - - m_first_bound_word = theKEYINFOptr + theTotalNrOfKeyWordInSignal;; - m_this_bound_start = theTupKeyLen; - return 0; - } - return -1; -} - -int -NdbIndexScanOperation::get_range_no() -{ - NdbRecAttr* tRecAttr = m_curr_row; - if(m_read_range_no && tRecAttr) - { - if(m_keyInfo) - tRecAttr = tRecAttr->next(); - Uint32 ret = *(Uint32*)tRecAttr->aRef(); - return ret; - } - return -1; -} diff --git a/ndb/src/ndbapi/NdbTransaction.cpp b/ndb/src/ndbapi/NdbTransaction.cpp deleted file mode 100644 index 67581e4a0f8..00000000000 --- a/ndb/src/ndbapi/NdbTransaction.cpp +++ /dev/null @@ -1,2124 +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 */ - -#include <ndb_global.h> -#include <NdbOut.hpp> -#include <NdbTransaction.hpp> -#include <NdbOperation.hpp> -#include <NdbScanOperation.hpp> -#include <NdbIndexScanOperation.hpp> -#include <NdbIndexOperation.hpp> -#include "NdbApiSignal.hpp" -#include "TransporterFacade.hpp" -#include "API.hpp" -#include "NdbBlob.hpp" -#include <ndb_limits.h> - -#include <signaldata/TcKeyConf.hpp> -#include <signaldata/TcIndx.hpp> -#include <signaldata/TcCommit.hpp> -#include <signaldata/TcKeyFailConf.hpp> -#include <signaldata/TcHbRep.hpp> - -/***************************************************************************** -NdbTransaction( Ndb* aNdb ); - -Return Value: None -Parameters: aNdb: Pointers to the Ndb object -Remark: Creates a connection object. -*****************************************************************************/ -NdbTransaction::NdbTransaction( Ndb* aNdb ) : - theSendStatus(NotInit), - theCallbackFunction(NULL), - theCallbackObject(NULL), - theTransArrayIndex(0), - theStartTransTime(0), - theErrorLine(0), - theErrorOperation(NULL), - theNdb(aNdb), - theNext(NULL), - theFirstOpInList(NULL), - theLastOpInList(NULL), - theFirstExecOpInList(NULL), - theLastExecOpInList(NULL), - theCompletedFirstOp(NULL), - theCompletedLastOp(NULL), - theNoOfOpSent(0), - theNoOfOpCompleted(0), - theNoOfOpFetched(0), - theMyRef(0), - theTCConPtr(0), - theTransactionId(0), - theGlobalCheckpointId(0), - theStatus(NotConnected), - theCompletionStatus(NotCompleted), - theCommitStatus(NotStarted), - theMagicNumber(0xFE11DC), - theTransactionIsStarted(false), - theDBnode(0), - theReleaseOnClose(false), - // Scan operations - m_waitForReply(true), - m_theFirstScanOperation(NULL), - m_theLastScanOperation(NULL), - m_firstExecutedScanOp(NULL), - // Scan operations - theScanningOp(NULL), - theBuddyConPtr(0xFFFFFFFF), - theBlobFlag(false), - thePendingBlobOps(0) -{ - theListState = NotInList; - theError.code = 0; - theId = theNdb->theImpl->theNdbObjectIdMap.map(this); - -#define CHECK_SZ(mask, sz) assert((sizeof(mask)/sizeof(mask[0])) == sz) - - CHECK_SZ(m_db_nodes, NdbNodeBitmask::Size); - CHECK_SZ(m_failed_db_nodes, NdbNodeBitmask::Size); -}//NdbTransaction::NdbTransaction() - -/***************************************************************************** -~NdbTransaction(); - -Remark: Deletes the connection object. -*****************************************************************************/ -NdbTransaction::~NdbTransaction() -{ - DBUG_ENTER("NdbTransaction::~NdbTransaction"); - theNdb->theImpl->theNdbObjectIdMap.unmap(theId, this); - DBUG_VOID_RETURN; -}//NdbTransaction::~NdbTransaction() - -/***************************************************************************** -void init(); - -Remark: Initialise connection object for new transaction. -*****************************************************************************/ -void -NdbTransaction::init() -{ - theListState = NotInList; - theInUseState = true; - theTransactionIsStarted = false; - theNext = NULL; - - theFirstOpInList = NULL; - theLastOpInList = NULL; - - theScanningOp = NULL; - - theFirstExecOpInList = NULL; - theLastExecOpInList = NULL; - - theCompletedFirstOp = NULL; - theCompletedLastOp = NULL; - - theGlobalCheckpointId = 0; - theCommitStatus = Started; - theCompletionStatus = NotCompleted; - m_abortOption = AbortOnError; - - theError.code = 0; - theErrorLine = 0; - theErrorOperation = NULL; - - theReleaseOnClose = false; - theSimpleState = true; - theSendStatus = InitState; - theMagicNumber = 0x37412619; - // Scan operations - m_waitForReply = true; - m_theFirstScanOperation = NULL; - m_theLastScanOperation = NULL; - m_firstExecutedScanOp = 0; - theBuddyConPtr = 0xFFFFFFFF; - // - theBlobFlag = false; - thePendingBlobOps = 0; -}//NdbTransaction::init() - -/***************************************************************************** -setOperationErrorCode(int error); - -Remark: Sets an error code on the connection object from an - operation object. -*****************************************************************************/ -void -NdbTransaction::setOperationErrorCode(int error) -{ - DBUG_ENTER("NdbTransaction::setOperationErrorCode"); - setErrorCode(error); - DBUG_VOID_RETURN; -} - -/***************************************************************************** -setOperationErrorCodeAbort(int error); - -Remark: Sets an error code on the connection object from an - operation object. -*****************************************************************************/ -void -NdbTransaction::setOperationErrorCodeAbort(int error, int abortOption) -{ - DBUG_ENTER("NdbTransaction::setOperationErrorCodeAbort"); - if (abortOption == -1) - abortOption = m_abortOption; - if (theTransactionIsStarted == false) { - theCommitStatus = Aborted; - } else if ((abortOption == AbortOnError) && - (theCommitStatus != Committed) && - (theCommitStatus != Aborted)) { - theCommitStatus = NeedAbort; - }//if - setErrorCode(error); - DBUG_VOID_RETURN; -} - -/***************************************************************************** -setErrorCode(int anErrorCode); - -Remark: Sets an error indication on the connection object. -*****************************************************************************/ -void -NdbTransaction::setErrorCode(int error) -{ - DBUG_ENTER("NdbTransaction::setErrorCode"); - DBUG_PRINT("enter", ("error: %d, theError.code: %d", error, theError.code)); - - if (theError.code == 0) - theError.code = error; - - DBUG_VOID_RETURN; -}//NdbTransaction::setErrorCode() - -int -NdbTransaction::restart(){ - DBUG_ENTER("NdbTransaction::restart"); - if(theCompletionStatus == CompletedSuccess){ - releaseCompletedOperations(); - Uint64 tTransid = theNdb->theFirstTransId; - theTransactionId = tTransid; - if ((tTransid & 0xFFFFFFFF) == 0xFFFFFFFF) { - theNdb->theFirstTransId = (tTransid >> 32) << 32; - } else { - theNdb->theFirstTransId = tTransid + 1; - } - theCommitStatus = Started; - theCompletionStatus = NotCompleted; - theTransactionIsStarted = false; - DBUG_RETURN(0); - } - DBUG_PRINT("error",("theCompletionStatus != CompletedSuccess")); - DBUG_RETURN(-1); -} - -/***************************************************************************** -void handleExecuteCompletion(void); - -Remark: Handle time-out on a transaction object. -*****************************************************************************/ -void -NdbTransaction::handleExecuteCompletion() -{ - /*************************************************************************** - * Move the NdbOperation objects from the list of executing - * operations to list of completed - **************************************************************************/ - NdbOperation* tFirstExecOp = theFirstExecOpInList; - NdbOperation* tLastExecOp = theLastExecOpInList; - if (tLastExecOp != NULL) { - tLastExecOp->next(theCompletedFirstOp); - theCompletedFirstOp = tFirstExecOp; - if (theCompletedLastOp == NULL) - theCompletedLastOp = tLastExecOp; - theFirstExecOpInList = NULL; - theLastExecOpInList = NULL; - }//if - theSendStatus = InitState; - return; -}//NdbTransaction::handleExecuteCompletion() - -/***************************************************************************** -int execute(ExecType aTypeOfExec, CommitType aTypeOfCommit, int forceSend); - -Return Value: Return 0 : execute was successful. - Return -1: In all other case. -Parameters : aTypeOfExec: Type of execute. -Remark: Initialise connection object for new transaction. -*****************************************************************************/ -int -NdbTransaction::execute(ExecType aTypeOfExec, - AbortOption abortOption, - int forceSend) -{ - DBUG_ENTER("NdbTransaction::execute"); - DBUG_PRINT("enter", ("aTypeOfExec: %d, abortOption: %d", - aTypeOfExec, abortOption)); - - if (! theBlobFlag) - DBUG_RETURN(executeNoBlobs(aTypeOfExec, abortOption, forceSend)); - - /* - * execute prepared ops in batches, as requested by blobs - * - blob error does not terminate execution - * - blob error sets error on operation - * - if error on operation skip blob calls - */ - - ExecType tExecType; - NdbOperation* tPrepOp; - NdbOperation* tCompletedFirstOp = NULL; - NdbOperation* tCompletedLastOp = NULL; - - int ret = 0; - do { - tExecType = aTypeOfExec; - tPrepOp = theFirstOpInList; - while (tPrepOp != NULL) { - if (tPrepOp->theError.code == 0) { - bool batch = false; - NdbBlob* tBlob = tPrepOp->theBlobList; - while (tBlob != NULL) { - if (tBlob->preExecute(tExecType, batch) == -1) - ret = -1; - tBlob = tBlob->theNext; - } - if (batch) { - // blob asked to execute all up to here now - tExecType = NoCommit; - break; - } - } - tPrepOp = tPrepOp->next(); - } - - // save rest of prepared ops if batch - NdbOperation* tRestOp= 0; - NdbOperation* tLastOp= 0; - if (tPrepOp != NULL) { - tRestOp = tPrepOp->next(); - tPrepOp->next(NULL); - tLastOp = theLastOpInList; - theLastOpInList = tPrepOp; - } - - if (tExecType == Commit) { - NdbOperation* tOp = theCompletedFirstOp; - while (tOp != NULL) { - if (tOp->theError.code == 0) { - NdbBlob* tBlob = tOp->theBlobList; - while (tBlob != NULL) { - if (tBlob->preCommit() == -1) - ret = -1; - tBlob = tBlob->theNext; - } - } - tOp = tOp->next(); - } - } - - // 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; -#ifdef ndb_api_crash_on_complex_blob_abort - assert(theFirstOpInList == NULL && theLastOpInList == NULL); -#else - theFirstOpInList = theLastOpInList = NULL; -#endif - - { - NdbOperation* tOp = theCompletedFirstOp; - while (tOp != NULL) { - if (tOp->theError.code == 0) { - NdbBlob* tBlob = tOp->theBlobList; - while (tBlob != NULL) { - // may add new operations if batch - if (tBlob->postExecute(tExecType) == -1) - ret = -1; - tBlob = tBlob->theNext; - } - } - tOp = tOp->next(); - } - } - - // add saved prepared ops if batch - if (tPrepOp != NULL && tRestOp != NULL) { - if (theFirstOpInList == NULL) - theFirstOpInList = tRestOp; - else - theLastOpInList->next(tRestOp); - theLastOpInList = tLastOp; - } - 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); -} - -int -NdbTransaction::executeNoBlobs(ExecType aTypeOfExec, - AbortOption abortOption, - int forceSend) -{ - DBUG_ENTER("NdbTransaction::executeNoBlobs"); - DBUG_PRINT("enter", ("aTypeOfExec: %d, abortOption: %d", - aTypeOfExec, abortOption)); - -//------------------------------------------------------------------------ -// We will start by preparing all operations in the transaction defined -// since last execute or since beginning. If this works ok we will continue -// by calling the poll with wait method. This method will return when -// the NDB kernel has completed its task or when 10 seconds have passed. -// The NdbTransactionCallBack-method will receive the return code of the -// transaction. The normal methods of reading error codes still apply. -//------------------------------------------------------------------------ - Ndb* tNdb = theNdb; - - m_waitForReply = false; - executeAsynchPrepare(aTypeOfExec, NULL, NULL, abortOption); - if (m_waitForReply){ - while (1) { - int noOfComp = tNdb->sendPollNdb((3 * WAITFOR_RESPONSE_TIMEOUT), - 1, forceSend); - if (noOfComp == 0) { - /** - * This timeout situation can occur if NDB crashes. - */ - ndbout << "This timeout should never occur, execute(..)" << endl; - setOperationErrorCodeAbort(4012); // Error code for "Cluster Failure" - DBUG_RETURN(-1); - }//if - - /* - * Check that the completed transactions include this one. There - * could be another thread running asynchronously. Even in pure - * async case rollback is done synchronously. - */ - if (theListState != NotInList) - continue; -#ifdef VM_TRACE - unsigned anyway = 0; - for (unsigned i = 0; i < theNdb->theNoOfPreparedTransactions; i++) - anyway += theNdb->thePreparedTransactionsArray[i] == this; - for (unsigned i = 0; i < theNdb->theNoOfSentTransactions; i++) - anyway += theNdb->theSentTransactionsArray[i] == this; - for (unsigned i = 0; i < theNdb->theNoOfCompletedTransactions; i++) - anyway += theNdb->theCompletedTransactionsArray[i] == this; - if (anyway) { - theNdb->printState("execute %x", this); - abort(); - } -#endif - if (theReturnStatus == ReturnFailure) { - DBUG_RETURN(-1); - }//if - break; - } - } - thePendingBlobOps = 0; - DBUG_RETURN(0); -}//NdbTransaction::execute() - -/***************************************************************************** -void executeAsynchPrepare(ExecType aTypeOfExec, - NdbAsynchCallback callBack, - void* anyObject, - CommitType aTypeOfCommit); - -Return Value: No return value -Parameters : aTypeOfExec: Type of execute. - anyObject: An object provided in the callback method - callBack: The callback method - aTypeOfCommit: What to do when read/updated/deleted records - are missing or inserted records already exist. - -Remark: Prepare a part of a transaction in an asynchronous manner. -*****************************************************************************/ -void -NdbTransaction::executeAsynchPrepare( ExecType aTypeOfExec, - NdbAsynchCallback aCallback, - void* anyObject, - AbortOption abortOption) -{ - DBUG_ENTER("NdbTransaction::executeAsynchPrepare"); - DBUG_PRINT("enter", ("aTypeOfExec: %d, aCallback: %x, anyObject: %x", - aTypeOfExec, aCallback, anyObject)); - - /** - * Reset error.code on execute - */ - if (theError.code != 0) - DBUG_PRINT("enter", ("Resetting error %d on execute", theError.code)); - theError.code = 0; - NdbScanOperation* tcOp = m_theFirstScanOperation; - if (tcOp != 0){ - // Execute any cursor operations - while (tcOp != NULL) { - int tReturnCode; - tReturnCode = tcOp->executeCursor(theDBnode); - if (tReturnCode == -1) { - DBUG_VOID_RETURN; - }//if - tcOp = (NdbScanOperation*)tcOp->next(); - } // while - m_theLastScanOperation->next(m_firstExecutedScanOp); - m_firstExecutedScanOp = m_theFirstScanOperation; - // Discard cursor operations, since these are also - // in the complete operations list we do not need - // to release them. - m_theFirstScanOperation = m_theLastScanOperation = NULL; - } - - bool tTransactionIsStarted = theTransactionIsStarted; - NdbOperation* tLastOp = theLastOpInList; - Ndb* tNdb = theNdb; - CommitStatusType tCommitStatus = theCommitStatus; - Uint32 tnoOfPreparedTransactions = tNdb->theNoOfPreparedTransactions; - - theReturnStatus = ReturnSuccess; - theCallbackFunction = aCallback; - theCallbackObject = anyObject; - m_abortOption = abortOption; - m_waitForReply = true; - tNdb->thePreparedTransactionsArray[tnoOfPreparedTransactions] = this; - theTransArrayIndex = tnoOfPreparedTransactions; - theListState = InPreparedList; - tNdb->theNoOfPreparedTransactions = tnoOfPreparedTransactions + 1; - - if ((tCommitStatus != Started) || - (aTypeOfExec == Rollback)) { -/***************************************************************************** - * Rollback have been ordered on a started transaction. Call rollback. - * Could also be state problem or previous problem which leads to the - * same action. - ****************************************************************************/ - if (aTypeOfExec == Rollback) { - if (theTransactionIsStarted == false || theSimpleState) { - theCommitStatus = Aborted; - theSendStatus = sendCompleted; - } else { - theSendStatus = sendABORT; - } - } else { - theSendStatus = sendABORTfail; - }//if - if (theCommitStatus == Aborted){ - DBUG_PRINT("exit", ("theCommitStatus: Aborted")); - setErrorCode(4350); - } - DBUG_VOID_RETURN; - }//if - if (tTransactionIsStarted == true) { - if (tLastOp != NULL) { - if (aTypeOfExec == Commit) { -/***************************************************************************** - * Set commit indicator on last operation when commit has been ordered - * and also a number of operations. -******************************************************************************/ - tLastOp->theCommitIndicator = 1; - }//if - } else { - if (aTypeOfExec == Commit && !theSimpleState) { - /********************************************************************** - * A Transaction have been started and no more operations exist. - * We will use the commit method. - *********************************************************************/ - theSendStatus = sendCOMMITstate; - DBUG_VOID_RETURN; - } else { - /********************************************************************** - * We need to put it into the array of completed transactions to - * ensure that we report the completion in a proper way. - * We cannot do this here since that would endanger the completed - * transaction array since that is also updated from the receiver - * thread and thus we need to do it under mutex lock and thus we - * set the sendStatus to ensure that the send method will - * put it into the completed array. - **********************************************************************/ - theSendStatus = sendCompleted; - DBUG_VOID_RETURN; // No Commit with no operations is OK - }//if - }//if - } else if (tTransactionIsStarted == false) { - NdbOperation* tFirstOp = theFirstOpInList; - if (tLastOp != NULL) { - tFirstOp->setStartIndicator(); - if (aTypeOfExec == Commit) { - tLastOp->theCommitIndicator = 1; - }//if - } else { - /*********************************************************************** - * No operations are defined and we have not started yet. - * Simply return OK. Set commit status if Commit. - ***********************************************************************/ - if (aTypeOfExec == Commit) { - theCommitStatus = Committed; - }//if - /*********************************************************************** - * We need to put it into the array of completed transactions to - * ensure that we report the completion in a proper way. We - * cannot do this here since that would endanger the completed - * transaction array since that is also updated from the - * receiver thread and thus we need to do it under mutex lock - * and thus we set the sendStatus to ensure that the send method - * will put it into the completed array. - ***********************************************************************/ - theSendStatus = sendCompleted; - DBUG_VOID_RETURN; - }//if - } - - NdbOperation* tOp = theFirstOpInList; - theCompletionStatus = NotCompleted; - while (tOp) { - int tReturnCode; - NdbOperation* tNextOp = tOp->next(); - - tReturnCode = tOp->prepareSend(theTCConPtr, theTransactionId); - if (tReturnCode == -1) { - theSendStatus = sendABORTfail; - DBUG_VOID_RETURN; - }//if - - /************************************************************************* - * Now that we have successfully prepared the send of this operation we - * move it to the list of executing operations and remove it from the - * list of defined operations. - ************************************************************************/ - tOp = tNextOp; - } - - NdbOperation* tLastOpInList = theLastOpInList; - NdbOperation* tFirstOpInList = theFirstOpInList; - - theFirstOpInList = NULL; - theLastOpInList = NULL; - theFirstExecOpInList = tFirstOpInList; - theLastExecOpInList = tLastOpInList; - - theCompletionStatus = CompletedSuccess; - theNoOfOpSent = 0; - theNoOfOpCompleted = 0; - theSendStatus = sendOperations; - NdbNodeBitmask::clear(m_db_nodes); - NdbNodeBitmask::clear(m_failed_db_nodes); - DBUG_VOID_RETURN; -}//NdbTransaction::executeAsynchPrepare() - -void NdbTransaction::close() -{ - theNdb->closeTransaction(this); -} - -int NdbTransaction::refresh(){ - return sendTC_HBREP(); -} - -/***************************************************************************** -int sendTC_HBREP(); - -Return Value: No return value. -Parameters : None. -Remark: Order NDB to refresh the timeout counter of the transaction. -******************************************************************************/ -int -NdbTransaction::sendTC_HBREP() // Send a TC_HBREP signal; -{ - NdbApiSignal* tSignal; - Ndb* tNdb = theNdb; - Uint32 tTransId1, tTransId2; - - tSignal = tNdb->getSignal(); - if (tSignal == NULL) { - return -1; - } - - if (tSignal->setSignal(GSN_TC_HBREP) == -1) { - return -1; - } - - TcHbRep * const tcHbRep = CAST_PTR(TcHbRep, tSignal->getDataPtrSend()); - - tcHbRep->apiConnectPtr = theTCConPtr; - - tTransId1 = (Uint32) theTransactionId; - tTransId2 = (Uint32) (theTransactionId >> 32); - tcHbRep->transId1 = tTransId1; - tcHbRep->transId2 = tTransId2; - - TransporterFacade *tp = TransporterFacade::instance(); - tp->lock_mutex(); - const int res = tp->sendSignal(tSignal,theDBnode); - tp->unlock_mutex(); - tNdb->releaseSignal(tSignal); - - if (res == -1){ - return -1; - } - - return 0; -}//NdbTransaction::sendTC_HBREP() - -/***************************************************************************** -int doSend(); - -Return Value: Return 0 : send was successful. - Return -1: In all other case. -Remark: Send all operations belonging to this connection. - The caller of this method has the responsibility to remove the - object from the prepared transactions array on the Ndb-object. -*****************************************************************************/ -int -NdbTransaction::doSend() -{ - DBUG_ENTER("NdbTransaction::doSend"); - - /* - This method assumes that at least one operation have been defined. This - is ensured by the caller of this routine (=execute). - */ - - switch(theSendStatus){ - case sendOperations: { - NdbOperation * tOp = theFirstExecOpInList; - do { - NdbOperation* tNextOp = tOp->next(); - const Uint32 lastFlag = ((tNextOp == NULL) ? 1 : 0); - const int tReturnCode = tOp->doSend(theDBnode, lastFlag); - if (tReturnCode == -1) { - theReturnStatus = ReturnFailure; - break; - }//if - tOp = tNextOp; - } while (tOp != NULL); - Ndb* tNdb = theNdb; - theSendStatus = sendTC_OP; - theTransactionIsStarted = true; - tNdb->insert_sent_list(this); - DBUG_RETURN(0); - }//case - case sendABORT: - case sendABORTfail:{ - /*********************************************************************** - * Rollback have been ordered on a not started transaction. - * Simply return OK and set abort status. - ***********************************************************************/ - if (theSendStatus == sendABORTfail) { - theReturnStatus = ReturnFailure; - }//if - if (sendROLLBACK() == 0) { - DBUG_RETURN(0); - }//if - break; - }//case - case sendCOMMITstate: - if (sendCOMMIT() == 0) { - DBUG_RETURN(0); - }//if - break; - case sendCompleted: - theNdb->insert_completed_list(this); - DBUG_RETURN(0); - default: - ndbout << "Inconsistent theSendStatus = " - << (Uint32) theSendStatus << endl; - abort(); - break; - }//switch - setOperationErrorCodeAbort(4002); - theReleaseOnClose = true; - theTransactionIsStarted = false; - theCommitStatus = Aborted; - DBUG_RETURN(-1); -}//NdbTransaction::doSend() - -/************************************************************************** -int sendROLLBACK(); - -Return Value: Return -1 if send unsuccessful. -Parameters : None. -Remark: Order NDB to rollback the transaction. -**************************************************************************/ -int -NdbTransaction::sendROLLBACK() // Send a TCROLLBACKREQ signal; -{ - Ndb* tNdb = theNdb; - if ((theTransactionIsStarted == true) && - (theCommitStatus != Committed) && - (theCommitStatus != Aborted)) { -/************************************************************************** - * The user did not perform any rollback but simply closed the - * transaction. We must rollback Ndb since Ndb have been contacted. - *************************************************************************/ - NdbApiSignal tSignal(tNdb->theMyRef); - Uint32 tTransId1, tTransId2; - TransporterFacade *tp = TransporterFacade::instance(); - int tReturnCode; - - tTransId1 = (Uint32) theTransactionId; - tTransId2 = (Uint32) (theTransactionId >> 32); - tSignal.setSignal(GSN_TCROLLBACKREQ); - tSignal.setData(theTCConPtr, 1); - tSignal.setData(tTransId1, 2); - tSignal.setData(tTransId2, 3); - tReturnCode = tp->sendSignal(&tSignal,theDBnode); - if (tReturnCode != -1) { - theSendStatus = sendTC_ROLLBACK; - tNdb->insert_sent_list(this); - return 0; - }//if - /********************************************************************* - * It was not possible to abort the transaction towards the NDB kernel - * and thus we put it into the array of completed transactions that - * are ready for reporting to the application. - *********************************************************************/ - return -1; - } else { - /* - It is not necessary to abort the transaction towards the NDB kernel and - thus we put it into the array of completed transactions that are ready - for reporting to the application. - */ - theSendStatus = sendCompleted; - tNdb->insert_completed_list(this); - return 0; - ; - }//if -}//NdbTransaction::sendROLLBACK() - -/*************************************************************************** -int sendCOMMIT(); - -Return Value: Return 0 : send was successful. - Return -1: In all other case. -Parameters : None. -Remark: Order NDB to commit the transaction. -***************************************************************************/ -int -NdbTransaction::sendCOMMIT() // Send a TC_COMMITREQ signal; -{ - NdbApiSignal tSignal(theNdb->theMyRef); - Uint32 tTransId1, tTransId2; - TransporterFacade *tp = TransporterFacade::instance(); - int tReturnCode; - - tTransId1 = (Uint32) theTransactionId; - tTransId2 = (Uint32) (theTransactionId >> 32); - tSignal.setSignal(GSN_TC_COMMITREQ); - tSignal.setData(theTCConPtr, 1); - tSignal.setData(tTransId1, 2); - tSignal.setData(tTransId2, 3); - - tReturnCode = tp->sendSignal(&tSignal,theDBnode); - if (tReturnCode != -1) { - theSendStatus = sendTC_COMMIT; - theNdb->insert_sent_list(this); - return 0; - } else { - return -1; - }//if -}//NdbTransaction::sendCOMMIT() - -/****************************************************************************** -void release(); - -Remark: Release all operations. -******************************************************************************/ -void -NdbTransaction::release(){ - releaseOperations(); - if ( (theTransactionIsStarted == true) && - ((theCommitStatus != Committed) && - (theCommitStatus != Aborted))) { - /************************************************************************ - * The user did not perform any rollback but simply closed the - * transaction. We must rollback Ndb since Ndb have been contacted. - ************************************************************************/ - execute(Rollback); - }//if - theMagicNumber = 0xFE11DC; - theInUseState = false; -#ifdef VM_TRACE - if (theListState != NotInList) { - theNdb->printState("release %x", this); - abort(); - } -#endif -}//NdbTransaction::release() - -void -NdbTransaction::releaseOps(NdbOperation* tOp){ - while (tOp != NULL) { - NdbOperation* tmp = tOp; - tOp->release(); - tOp = tOp->next(); - theNdb->releaseOperation(tmp); - }//while -} - -/****************************************************************************** -void releaseOperations(); - -Remark: Release all operations. -******************************************************************************/ -void -NdbTransaction::releaseOperations() -{ - // Release any open scans - releaseScanOperations(m_theFirstScanOperation); - releaseScanOperations(m_firstExecutedScanOp); - - releaseOps(theCompletedFirstOp); - releaseOps(theFirstOpInList); - releaseOps(theFirstExecOpInList); - - theCompletedFirstOp = NULL; - theCompletedLastOp = NULL; - theFirstOpInList = NULL; - theFirstExecOpInList = NULL; - theLastOpInList = NULL; - theLastExecOpInList = NULL; - theScanningOp = NULL; - m_theFirstScanOperation = NULL; - m_theLastScanOperation = NULL; - m_firstExecutedScanOp = NULL; -}//NdbTransaction::releaseOperations() - -void -NdbTransaction::releaseCompletedOperations() -{ - releaseOps(theCompletedFirstOp); - theCompletedFirstOp = NULL; - theCompletedLastOp = NULL; -}//NdbTransaction::releaseOperations() - -/****************************************************************************** -void releaseScanOperations(); - -Remark: Release all cursor operations. - (NdbScanOperation and NdbIndexOperation) -******************************************************************************/ -void -NdbTransaction::releaseScanOperations(NdbIndexScanOperation* cursorOp) -{ - while(cursorOp != 0){ - NdbIndexScanOperation* next = (NdbIndexScanOperation*)cursorOp->next(); - cursorOp->release(); - theNdb->releaseScanOperation(cursorOp); - cursorOp = next; - } -}//NdbTransaction::releaseScanOperations() - -/***************************************************************************** -NdbOperation* getNdbOperation(const char* aTableName); - -Return Value Return a pointer to a NdbOperation object if getNdbOperation - was succesful. - Return NULL : In all other case. -Parameters: aTableName : Name of the database table. -Remark: Get an operation from NdbOperation idlelist and get the - NdbTransaction object - who was fetch by startTransaction pointing to this operation - getOperation will set the theTableId in the NdbOperation object. - synchronous -******************************************************************************/ -NdbOperation* -NdbTransaction::getNdbOperation(const char* aTableName) -{ - if (theCommitStatus == Started){ - NdbTableImpl* table = theNdb->theDictionary->getTable(aTableName); - if (table != 0){ - return getNdbOperation(table); - } else { - setErrorCode(theNdb->theDictionary->getNdbError().code); - return NULL; - }//if - } - - setOperationErrorCodeAbort(4114); - - return NULL; -}//NdbTransaction::getNdbOperation() - -/***************************************************************************** -NdbOperation* getNdbOperation(int aTableId); - -Return Value Return a pointer to a NdbOperation object if getNdbOperation - was succesful. - Return NULL: In all other case. -Parameters: tableId : Id of the database table beeing deleted. -Remark: Get an operation from NdbOperation object idlelist and - get the NdbTransaction object who was fetch by - startTransaction pointing to this operation - getOperation will set the theTableId in the NdbOperation - object, synchronous. -*****************************************************************************/ -NdbOperation* -NdbTransaction::getNdbOperation(const NdbTableImpl * tab, NdbOperation* aNextOp) -{ - NdbOperation* tOp; - - if (theScanningOp != NULL){ - setErrorCode(4607); - return NULL; - } - - tOp = theNdb->getOperation(); - if (tOp == NULL) - goto getNdbOp_error1; - if (aNextOp == NULL) { - if (theLastOpInList != NULL) { - theLastOpInList->next(tOp); - theLastOpInList = tOp; - } else { - theLastOpInList = tOp; - theFirstOpInList = tOp; - }//if - tOp->next(NULL); - } else { - // add before the given op - if (theFirstOpInList == aNextOp) { - theFirstOpInList = tOp; - } else { - NdbOperation* aLoopOp = theFirstOpInList; - while (aLoopOp != NULL && aLoopOp->next() != aNextOp) - aLoopOp = aLoopOp->next(); - assert(aLoopOp != NULL); - aLoopOp->next(tOp); - } - tOp->next(aNextOp); - } - if (tOp->init(tab, this) != -1) { - return tOp; - } else { - theNdb->releaseOperation(tOp); - }//if - return NULL; - - getNdbOp_error1: - setOperationErrorCodeAbort(4000); - return NULL; -}//NdbTransaction::getNdbOperation() - -NdbOperation* NdbTransaction::getNdbOperation(const NdbDictionary::Table * table) -{ - if (table) - return getNdbOperation(& NdbTableImpl::getImpl(*table)); - else - return NULL; -}//NdbTransaction::getNdbOperation() - -// NdbScanOperation -/***************************************************************************** -NdbScanOperation* getNdbScanOperation(const char* aTableName); - -Return Value Return a pointer to a NdbScanOperation object if getNdbScanOperation was succesful. - Return NULL : In all other case. -Parameters: aTableName : Name of the database table. -Remark: Get an operation from NdbScanOperation idlelist and get the NdbTransaction object - who was fetch by startTransaction pointing to this operation - getOperation will set the theTableId in the NdbOperation object.synchronous -******************************************************************************/ -NdbScanOperation* -NdbTransaction::getNdbScanOperation(const char* aTableName) -{ - if (theCommitStatus == Started){ - NdbTableImpl* tab = theNdb->theDictionary->getTable(aTableName); - if (tab != 0){ - return getNdbScanOperation(tab); - } else { - setOperationErrorCodeAbort(theNdb->theDictionary->m_error.code); - return NULL; - }//if - } - - setOperationErrorCodeAbort(4114); - return NULL; -}//NdbTransaction::getNdbScanOperation() - -/***************************************************************************** -NdbScanOperation* getNdbIndexScanOperation(const char* anIndexName, const char* aTableName); - -Return Value Return a pointer to a NdbIndexScanOperation object if getNdbIndexScanOperation was succesful. - Return NULL : In all other case. -Parameters: anIndexName : Name of the index to use. - aTableName : Name of the database table. -Remark: Get an operation from NdbIndexScanOperation idlelist and get the NdbTransaction object - who was fetch by startTransaction pointing to this operation - getOperation will set the theTableId in the NdbIndexScanOperation object.synchronous -******************************************************************************/ -NdbIndexScanOperation* -NdbTransaction::getNdbIndexScanOperation(const char* anIndexName, - const char* aTableName) -{ - NdbIndexImpl* index = - theNdb->theDictionary->getIndex(anIndexName, aTableName); - if (index == 0) - { - setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code); - return 0; - } - NdbTableImpl* table = theNdb->theDictionary->getTable(aTableName); - if (table == 0) - { - setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code); - return 0; - } - - return getNdbIndexScanOperation(index, table); -} - -NdbIndexScanOperation* -NdbTransaction::getNdbIndexScanOperation(const NdbIndexImpl* index, - const NdbTableImpl* table) -{ - if (theCommitStatus == Started){ - const NdbTableImpl * indexTable = index->getIndexTable(); - if (indexTable != 0){ - NdbIndexScanOperation* tOp = getNdbScanOperation(indexTable); - if(tOp) - { - tOp->m_currentTable = table; - } - return tOp; - } else { - setOperationErrorCodeAbort(4271); - return NULL; - }//if - } - - setOperationErrorCodeAbort(4114); - return NULL; -}//NdbTransaction::getNdbIndexScanOperation() - -NdbIndexScanOperation* -NdbTransaction::getNdbIndexScanOperation(const NdbDictionary::Index * index) -{ - if (index) - { - const NdbDictionary::Table *table= - theNdb->theDictionary->getTable(index->getTable()); - - if (table) - return getNdbIndexScanOperation(index, table); - - setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code); - return NULL; - } - setOperationErrorCodeAbort(4271); - return NULL; -} - -NdbIndexScanOperation* -NdbTransaction::getNdbIndexScanOperation(const NdbDictionary::Index * index, - const NdbDictionary::Table * table) -{ - if (index && table) - return getNdbIndexScanOperation(& NdbIndexImpl::getImpl(*index), - & NdbTableImpl::getImpl(*table)); - setOperationErrorCodeAbort(4271); - return NULL; -}//NdbTransaction::getNdbIndexScanOperation() - -/***************************************************************************** -NdbScanOperation* getNdbScanOperation(int aTableId); - -Return Value Return a pointer to a NdbScanOperation object if getNdbScanOperation was succesful. - Return NULL: In all other case. -Parameters: tableId : Id of the database table beeing deleted. -Remark: Get an operation from NdbScanOperation object idlelist and get the NdbTransaction - object who was fetch by startTransaction pointing to this operation - getOperation will set the theTableId in the NdbScanOperation object, synchronous. -*****************************************************************************/ -NdbIndexScanOperation* -NdbTransaction::getNdbScanOperation(const NdbTableImpl * tab) -{ - NdbIndexScanOperation* tOp; - - tOp = theNdb->getScanOperation(); - if (tOp == NULL) - goto getNdbOp_error1; - - if (tOp->init(tab, this) != -1) { - define_scan_op(tOp); - return tOp; - } else { - theNdb->releaseScanOperation(tOp); - }//if - return NULL; - -getNdbOp_error1: - setOperationErrorCodeAbort(4000); - return NULL; -}//NdbTransaction::getNdbScanOperation() - -void -NdbTransaction::remove_list(NdbOperation*& list, NdbOperation* op){ - NdbOperation* tmp= list; - if(tmp == op) - list = op->next(); - else { - while(tmp && tmp->next() != op) tmp = tmp->next(); - if(tmp) - tmp->next(op->next()); - } - op->next(NULL); -} - -void -NdbTransaction::define_scan_op(NdbIndexScanOperation * tOp){ - // Link scan operation into list of cursor operations - if (m_theLastScanOperation == NULL) - m_theFirstScanOperation = m_theLastScanOperation = tOp; - else { - m_theLastScanOperation->next(tOp); - m_theLastScanOperation = tOp; - } - tOp->next(NULL); -} - -NdbScanOperation* -NdbTransaction::getNdbScanOperation(const NdbDictionary::Table * table) -{ - if (table) - return getNdbScanOperation(& NdbTableImpl::getImpl(*table)); - else - return NULL; -}//NdbTransaction::getNdbScanOperation() - - -// IndexOperation -/***************************************************************************** -NdbIndexOperation* getNdbIndexOperation(const char* anIndexName, - const char* aTableName); - -Return Value Return a pointer to a NdbOperation object if getNdbIndexOperation was succesful. - Return NULL : In all other case. -Parameters: aTableName : Name of the database table. -Remark: Get an operation from NdbIndexOperation idlelist and get the NdbTransaction object - who was fetch by startTransaction pointing to this operation - getOperation will set the theTableId in the NdbIndexOperation object.synchronous -******************************************************************************/ -NdbIndexOperation* -NdbTransaction::getNdbIndexOperation(const char* anIndexName, - const char* aTableName) -{ - if (theCommitStatus == Started) { - NdbTableImpl * table = theNdb->theDictionary->getTable(aTableName); - NdbIndexImpl * index; - - if (table == 0) - { - setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code); - return NULL; - } - - if (table->m_frm.get_data()) - { - // This unique index is defined from SQL level - static const char* uniqueSuffix= "$unique"; - char uniqueIndexName[MAX_TAB_NAME_SIZE]; - - strxnmov(uniqueIndexName, MAX_TAB_NAME_SIZE, anIndexName, uniqueSuffix, NullS); - index = theNdb->theDictionary->getIndex(uniqueIndexName, - aTableName); - } - else - index = theNdb->theDictionary->getIndex(anIndexName, - aTableName); - if(table != 0 && index != 0){ - return getNdbIndexOperation(index, table); - } - - if(index == 0){ - setOperationErrorCodeAbort(4243); - return NULL; - } - - setOperationErrorCodeAbort(4243); - return NULL; - } - - setOperationErrorCodeAbort(4114); - return 0; -}//NdbTransaction::getNdbIndexOperation() - -/***************************************************************************** -NdbIndexOperation* getNdbIndexOperation(int anIndexId, int aTableId); - -Return Value Return a pointer to a NdbIndexOperation object if getNdbIndexOperation was succesful. - Return NULL: In all other case. -Parameters: tableId : Id of the database table beeing deleted. -Remark: Get an operation from NdbIndexOperation object idlelist and get the NdbTransaction - object who was fetch by startTransaction pointing to this operation - getOperation will set the theTableId in the NdbIndexOperation object, synchronous. -*****************************************************************************/ -NdbIndexOperation* -NdbTransaction::getNdbIndexOperation(const NdbIndexImpl * anIndex, - const NdbTableImpl * aTable, - NdbOperation* aNextOp) -{ - NdbIndexOperation* tOp; - - tOp = theNdb->getIndexOperation(); - if (tOp == NULL) - goto getNdbOp_error1; - if (aNextOp == NULL) { - if (theLastOpInList != NULL) { - theLastOpInList->next(tOp); - theLastOpInList = tOp; - } else { - theLastOpInList = tOp; - theFirstOpInList = tOp; - }//if - tOp->next(NULL); - } else { - // add before the given op - if (theFirstOpInList == aNextOp) { - theFirstOpInList = tOp; - } else { - NdbOperation* aLoopOp = theFirstOpInList; - while (aLoopOp != NULL && aLoopOp->next() != aNextOp) - aLoopOp = aLoopOp->next(); - assert(aLoopOp != NULL); - aLoopOp->next(tOp); - } - tOp->next(aNextOp); - } - if (tOp->indxInit(anIndex, aTable, this)!= -1) { - return tOp; - } else { - theNdb->releaseOperation(tOp); - }//if - return NULL; - - getNdbOp_error1: - setOperationErrorCodeAbort(4000); - return NULL; -}//NdbTransaction::getNdbIndexOperation() - -NdbIndexOperation* -NdbTransaction::getNdbIndexOperation(const NdbDictionary::Index * index) -{ - if (index) - { - const NdbDictionary::Table *table= - theNdb->theDictionary->getTable(index->getTable()); - - if (table) - return getNdbIndexOperation(index, table); - - setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code); - return NULL; - } - setOperationErrorCodeAbort(4271); - return NULL; -} - -NdbIndexOperation* -NdbTransaction::getNdbIndexOperation(const NdbDictionary::Index * index, - const NdbDictionary::Table * table) -{ - if (index && table) - return getNdbIndexOperation(& NdbIndexImpl::getImpl(*index), - & NdbTableImpl::getImpl(*table)); - - setOperationErrorCodeAbort(4271); - return NULL; -}//NdbTransaction::getNdbIndexOperation() - - -/******************************************************************************* -int receiveDIHNDBTAMPER(NdbApiSignal* aSignal) - -Return Value: Return 0 : receiveDIHNDBTAMPER was successful. - Return -1: In all other case. -Parameters: aSignal: The signal object pointer. -Remark: Sets theRestartGCI in the NDB object. -*******************************************************************************/ -int -NdbTransaction::receiveDIHNDBTAMPER(NdbApiSignal* aSignal) -{ - if (theStatus != Connecting) { - return -1; - } else { - theNdb->RestartGCI((Uint32)aSignal->readData(2)); - theStatus = Connected; - }//if - return 0; -}//NdbTransaction::receiveDIHNDBTAMPER() - -/******************************************************************************* -int receiveTCSEIZECONF(NdbApiSignal* aSignal); - -Return Value: Return 0 : receiveTCSEIZECONF was successful. - Return -1: In all other case. -Parameters: aSignal: The signal object pointer. -Remark: Sets TC Connect pointer at reception of TCSEIZECONF. -*******************************************************************************/ -int -NdbTransaction::receiveTCSEIZECONF(NdbApiSignal* aSignal) -{ - if (theStatus != Connecting) - { - return -1; - } else - { - theTCConPtr = (Uint32)aSignal->readData(2); - theStatus = Connected; - } - return 0; -}//NdbTransaction::receiveTCSEIZECONF() - -/******************************************************************************* -int receiveTCSEIZEREF(NdbApiSignal* aSignal); - -Return Value: Return 0 : receiveTCSEIZEREF was successful. - Return -1: In all other case. -Parameters: aSignal: The signal object pointer. -Remark: Sets TC Connect pointer. -*******************************************************************************/ -int -NdbTransaction::receiveTCSEIZEREF(NdbApiSignal* aSignal) -{ - DBUG_ENTER("NdbTransaction::receiveTCSEIZEREF"); - if (theStatus != Connecting) - { - DBUG_RETURN(-1); - } else - { - theStatus = ConnectFailure; - theNdb->theError.code = aSignal->readData(2); - DBUG_PRINT("info",("error code %d, %s", - theNdb->getNdbError().code, - theNdb->getNdbError().message)); - DBUG_RETURN(0); - } -}//NdbTransaction::receiveTCSEIZEREF() - -/******************************************************************************* -int receiveTCRELEASECONF(NdbApiSignal* aSignal); - -Return Value: Return 0 : receiveTCRELEASECONF was successful. - Return -1: In all other case. -Parameters: aSignal: The signal object pointer. -Remark: DisConnect TC Connect pointer to NDBAPI. -*******************************************************************************/ -int -NdbTransaction::receiveTCRELEASECONF(NdbApiSignal* aSignal) -{ - if (theStatus != DisConnecting) - { - return -1; - } else - { - theStatus = NotConnected; - } - return 0; -}//NdbTransaction::receiveTCRELEASECONF() - -/******************************************************************************* -int receiveTCRELEASEREF(NdbApiSignal* aSignal); - -Return Value: Return 0 : receiveTCRELEASEREF was successful. - Return -1: In all other case. -Parameters: aSignal: The signal object pointer. -Remark: DisConnect TC Connect pointer to NDBAPI Failure. -*******************************************************************************/ -int -NdbTransaction::receiveTCRELEASEREF(NdbApiSignal* aSignal) -{ - if (theStatus != DisConnecting) { - return -1; - } else { - theStatus = ConnectFailure; - theNdb->theError.code = aSignal->readData(2); - return 0; - }//if -}//NdbTransaction::receiveTCRELEASEREF() - -/****************************************************************************** -int receiveTC_COMMITCONF(NdbApiSignal* aSignal); - -Return Value: Return 0 : receiveTC_COMMITCONF was successful. - Return -1: In all other case. -Parameters: aSignal: The signal object pointer. -Remark: -******************************************************************************/ -int -NdbTransaction::receiveTC_COMMITCONF(const TcCommitConf * commitConf) -{ - if(checkState_TransId(&commitConf->transId1)){ - theCommitStatus = Committed; - theCompletionStatus = CompletedSuccess; - return 0; - } else { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - } - return -1; -}//NdbTransaction::receiveTC_COMMITCONF() - -/****************************************************************************** -int receiveTC_COMMITREF(NdbApiSignal* aSignal); - -Return Value: Return 0 : receiveTC_COMMITREF was successful. - Return -1: In all other case. -Parameters: aSignal: The signal object pointer. -Remark: -******************************************************************************/ -int -NdbTransaction::receiveTC_COMMITREF(NdbApiSignal* aSignal) -{ - const TcCommitRef * ref = CAST_CONSTPTR(TcCommitRef, aSignal->getDataPtr()); - if(checkState_TransId(&ref->transId1)){ - setOperationErrorCodeAbort(ref->errorCode); - theCommitStatus = Aborted; - theCompletionStatus = CompletedFailure; - theReturnStatus = ReturnFailure; - return 0; - } else { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - } - - return -1; -}//NdbTransaction::receiveTC_COMMITREF() - -/****************************************************************************** -int receiveTCROLLBACKCONF(NdbApiSignal* aSignal); - -Return Value: Return 0 : receiveTCROLLBACKCONF was successful. - Return -1: In all other case. -Parameters: aSignal: The signal object pointer. -Remark: -******************************************************************************/ -int -NdbTransaction::receiveTCROLLBACKCONF(NdbApiSignal* aSignal) -{ - if(checkState_TransId(aSignal->getDataPtr() + 1)){ - theCommitStatus = Aborted; - theCompletionStatus = CompletedSuccess; - return 0; - } else { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - } - - return -1; -}//NdbTransaction::receiveTCROLLBACKCONF() - -/******************************************************************************* -int receiveTCROLLBACKREF(NdbApiSignal* aSignal); - -Return Value: Return 0 : receiveTCROLLBACKREF was successful. - Return -1: In all other case. -Parameters: aSignal: The signal object pointer. -Remark: -*******************************************************************************/ -int -NdbTransaction::receiveTCROLLBACKREF(NdbApiSignal* aSignal) -{ - if(checkState_TransId(aSignal->getDataPtr() + 1)){ - setOperationErrorCodeAbort(aSignal->readData(4)); - theCommitStatus = Aborted; - theCompletionStatus = CompletedFailure; - theReturnStatus = ReturnFailure; - return 0; - } else { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - } - - return -1; -}//NdbTransaction::receiveTCROLLBACKREF() - -/***************************************************************************** -int receiveTCROLLBACKREP( NdbApiSignal* aSignal) - -Return Value: Return 0 : send was succesful. - Return -1: In all other case. -Parameters: aSignal: the signal object that contains the - TCROLLBACKREP signal from TC. -Remark: Handles the reception of the ROLLBACKREP signal. -*****************************************************************************/ -int -NdbTransaction::receiveTCROLLBACKREP( NdbApiSignal* aSignal) -{ - /**************************************************************************** -Check that we are expecting signals from this transaction and that it doesn't -belong to a transaction already completed. Simply ignore messages from other -transactions. - ****************************************************************************/ - if(checkState_TransId(aSignal->getDataPtr() + 1)){ - theError.code = aSignal->readData(4);// Override any previous errors - - /**********************************************************************/ - /* A serious error has occured. This could be due to deadlock or */ - /* lack of resources or simply a programming error in NDB. This */ - /* transaction will be aborted. Actually it has already been */ - /* and we only need to report completion and return with the */ - /* error code to the application. */ - /**********************************************************************/ - theCompletionStatus = CompletedFailure; - theCommitStatus = Aborted; - theReturnStatus = ReturnFailure; - return 0; - } else { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - } - - return -1; -}//NdbTransaction::receiveTCROLLBACKREP() - -/******************************************************************************* -int receiveTCKEYCONF(NdbApiSignal* aSignal, Uint32 long_short_ind); - -Return Value: Return 0 : receiveTCKEYCONF was successful. - Return -1: In all other case. -Parameters: aSignal: The signal object pointer. -Remark: -*******************************************************************************/ -int -NdbTransaction::receiveTCKEYCONF(const TcKeyConf * keyConf, Uint32 aDataLength) -{ - NdbReceiver* tOp; - const Uint32 tTemp = keyConf->confInfo; - /*************************************************************************** -Check that we are expecting signals from this transaction and that it -doesn't belong to a transaction already completed. Simply ignore messages -from other transactions. - ***************************************************************************/ - if(checkState_TransId(&keyConf->transId1)){ - - const Uint32 tNoOfOperations = TcKeyConf::getNoOfOperations(tTemp); - const Uint32 tCommitFlag = TcKeyConf::getCommitFlag(tTemp); - - const Uint32* tPtr = (Uint32 *)&keyConf->operations[0]; - Uint32 tNoComp = theNoOfOpCompleted; - for (Uint32 i = 0; i < tNoOfOperations ; i++) { - tOp = theNdb->void2rec(theNdb->int2void(*tPtr++)); - const Uint32 tAttrInfoLen = *tPtr++; - if (tOp && tOp->checkMagicNumber()) { - Uint32 done = tOp->execTCOPCONF(tAttrInfoLen); - if(tAttrInfoLen > TcKeyConf::SimpleReadBit){ - Uint32 node = tAttrInfoLen & (~TcKeyConf::SimpleReadBit); - NdbNodeBitmask::set(m_db_nodes, node); - if(NdbNodeBitmask::get(m_failed_db_nodes, node) && !done) - { - done = 1; - tOp->setErrorCode(4119); - theCompletionStatus = CompletedFailure; - theReturnStatus = NdbTransaction::ReturnFailure; - } - } - tNoComp += done; - } else { - return -1; - }//if - }//for - Uint32 tNoSent = theNoOfOpSent; - theNoOfOpCompleted = tNoComp; - Uint32 tGCI = keyConf->gci; - if (tCommitFlag == 1) { - theCommitStatus = Committed; - theGlobalCheckpointId = tGCI; - } else if ((tNoComp >= tNoSent) && - (theLastExecOpInList->theCommitIndicator == 1)){ - - - if (m_abortOption == AO_IgnoreError && theError.code != 0){ - /** - * There's always a TCKEYCONF when using IgnoreError - */ - return -1; - } -/**********************************************************************/ -// We sent the transaction with Commit flag set and received a CONF with -// no Commit flag set. This is clearly an anomaly. -/**********************************************************************/ - theError.code = 4011; - theCompletionStatus = CompletedFailure; - theReturnStatus = NdbTransaction::ReturnFailure; - theCommitStatus = Aborted; - return 0; - }//if - if (tNoComp >= tNoSent) { - return 0; // No more operations to wait for - }//if - // Not completed the reception yet. - } else { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - } - - return -1; -}//NdbTransaction::receiveTCKEYCONF() - -/***************************************************************************** -int receiveTCKEY_FAILCONF( NdbApiSignal* aSignal) - -Return Value: Return 0 : receive was completed. - Return -1: In all other case. -Parameters: aSignal: the signal object that contains the - TCKEY_FAILCONF signal from TC. -Remark: Handles the reception of the TCKEY_FAILCONF signal. -*****************************************************************************/ -int -NdbTransaction::receiveTCKEY_FAILCONF(const TcKeyFailConf * failConf) -{ - NdbOperation* tOp; - /* - Check that we are expecting signals from this transaction and that it - doesn't belong to a transaction already completed. Simply ignore - messages from other transactions. - */ - if(checkState_TransId(&failConf->transId1)){ - /* - A node failure of the TC node occured. The transaction has - been committed. - */ - theCommitStatus = Committed; - tOp = theFirstExecOpInList; - while (tOp != NULL) { - /* - * Check if the transaction expected read values... - * If it did some of them might have gotten lost even if we succeeded - * in committing the transaction. - */ - switch(tOp->theOperationType){ - case NdbOperation::UpdateRequest: - case NdbOperation::InsertRequest: - case NdbOperation::DeleteRequest: - case NdbOperation::WriteRequest: - tOp = tOp->next(); - break; - case NdbOperation::ReadRequest: - case NdbOperation::ReadExclusive: - case NdbOperation::OpenScanRequest: - case NdbOperation::OpenRangeScanRequest: - theCompletionStatus = CompletedFailure; - theReturnStatus = NdbTransaction::ReturnFailure; - setOperationErrorCodeAbort(4115); - tOp = NULL; - break; - case NdbOperation::NotDefined: - case NdbOperation::NotDefined2: - assert(false); - break; - }//if - }//while - theReleaseOnClose = true; - return 0; - } else { -#ifdef VM_TRACE - ndbout_c("Recevied TCKEY_FAILCONF wo/ operation"); -#endif - } - return -1; -}//NdbTransaction::receiveTCKEY_FAILCONF() - -/************************************************************************* -int receiveTCKEY_FAILREF( NdbApiSignal* aSignal) - -Return Value: Return 0 : receive was completed. - Return -1: In all other case. -Parameters: aSignal: the signal object that contains the - TCKEY_FAILREF signal from TC. -Remark: Handles the reception of the TCKEY_FAILREF signal. -**************************************************************************/ -int -NdbTransaction::receiveTCKEY_FAILREF(NdbApiSignal* aSignal) -{ - /* - Check that we are expecting signals from this transaction and - that it doesn't belong to a transaction already - completed. Simply ignore messages from other transactions. - */ - if(checkState_TransId(aSignal->getDataPtr()+1)){ - /* - We received an indication of that this transaction was aborted due to a - node failure. - */ - if (theSendStatus == NdbTransaction::sendTC_ROLLBACK) { - /* - We were in the process of sending a rollback anyways. We will - report it as a success. - */ - theCompletionStatus = NdbTransaction::CompletedSuccess; - } else { - theReturnStatus = NdbTransaction::ReturnFailure; - theCompletionStatus = NdbTransaction::CompletedFailure; - theError.code = 4031; - }//if - theReleaseOnClose = true; - theCommitStatus = NdbTransaction::Aborted; - return 0; - } else { -#ifdef VM_TRACE - ndbout_c("Recevied TCKEY_FAILREF wo/ operation"); -#endif - } - return -1; -}//NdbTransaction::receiveTCKEY_FAILREF() - -/****************************************************************************** -int receiveTCINDXCONF(NdbApiSignal* aSignal, Uint32 long_short_ind); - -Return Value: Return 0 : receiveTCINDXCONF was successful. - Return -1: In all other case. -Parameters: aSignal: The signal object pointer. -Remark: -******************************************************************************/ -int -NdbTransaction::receiveTCINDXCONF(const TcIndxConf * indxConf, - Uint32 aDataLength) -{ - if(checkState_TransId(&indxConf->transId1)){ - const Uint32 tTemp = indxConf->confInfo; - const Uint32 tNoOfOperations = TcIndxConf::getNoOfOperations(tTemp); - const Uint32 tCommitFlag = TcKeyConf::getCommitFlag(tTemp); - - const Uint32* tPtr = (Uint32 *)&indxConf->operations[0]; - Uint32 tNoComp = theNoOfOpCompleted; - for (Uint32 i = 0; i < tNoOfOperations ; i++) { - NdbReceiver* tOp = theNdb->void2rec(theNdb->int2void(*tPtr)); - tPtr++; - const Uint32 tAttrInfoLen = *tPtr; - tPtr++; - if (tOp && tOp->checkMagicNumber()) { - tNoComp += tOp->execTCOPCONF(tAttrInfoLen); - } else { - return -1; - }//if - }//for - Uint32 tNoSent = theNoOfOpSent; - Uint32 tGCI = indxConf->gci; - theNoOfOpCompleted = tNoComp; - if (tCommitFlag == 1) { - theCommitStatus = Committed; - theGlobalCheckpointId = tGCI; - } else if ((tNoComp >= tNoSent) && - (theLastExecOpInList->theCommitIndicator == 1)){ - /**********************************************************************/ - // We sent the transaction with Commit flag set and received a CONF with - // no Commit flag set. This is clearly an anomaly. - /**********************************************************************/ - theError.code = 4011; - theCompletionStatus = NdbTransaction::CompletedFailure; - theCommitStatus = NdbTransaction::Aborted; - theReturnStatus = NdbTransaction::ReturnFailure; - return 0; - }//if - if (tNoComp >= tNoSent) { - return 0; // No more operations to wait for - }//if - // Not completed the reception yet. - } else { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - } - - return -1; -}//NdbTransaction::receiveTCINDXCONF() - -/***************************************************************************** -int receiveTCINDXREF( NdbApiSignal* aSignal) - -Return Value: Return 0 : send was succesful. - Return -1: In all other case. -Parameters: aSignal: the signal object that contains the - TCINDXREF signal from TC. -Remark: Handles the reception of the TCINDXREF signal. -*****************************************************************************/ -int -NdbTransaction::receiveTCINDXREF( NdbApiSignal* aSignal) -{ - if(checkState_TransId(aSignal->getDataPtr()+1)){ - theError.code = aSignal->readData(4); // Override any previous errors - - /**********************************************************************/ - /* A serious error has occured. This could be due to deadlock or */ - /* lack of resources or simply a programming error in NDB. This */ - /* transaction will be aborted. Actually it has already been */ - /* and we only need to report completion and return with the */ - /* error code to the application. */ - /**********************************************************************/ - theCompletionStatus = NdbTransaction::CompletedFailure; - theCommitStatus = NdbTransaction::Aborted; - theReturnStatus = NdbTransaction::ReturnFailure; - return 0; - } else { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - } - - return -1; -}//NdbTransaction::receiveTCINDXREF() - -/******************************************************************************* -int OpCompletedFailure(); - -Return Value: Return 0 : OpCompleteSuccess was successful. - Return -1: In all other case. -Parameters: aErrorCode: The error code. -Remark: An operation was completed with failure. -*******************************************************************************/ -int -NdbTransaction::OpCompleteFailure(Uint8 abortOption, bool setFailure) -{ - Uint32 tNoComp = theNoOfOpCompleted; - Uint32 tNoSent = theNoOfOpSent; - if (setFailure) - theCompletionStatus = NdbTransaction::CompletedFailure; - tNoComp++; - theNoOfOpCompleted = tNoComp; - if (tNoComp == tNoSent) { - //------------------------------------------------------------------------ - //If the transaction consists of only simple reads we can set - //Commit state Aborted. Otherwise this simple operation cannot - //decide the success of the whole transaction since a simple - //operation is not really part of that transaction. - //------------------------------------------------------------------------ - if (abortOption == AO_IgnoreError){ - /** - * There's always a TCKEYCONF when using IgnoreError - */ - return -1; - } - - return 0; // Last operation received - } else if (tNoComp > tNoSent) { - setOperationErrorCodeAbort(4113); // Too many operations, - // stop waiting for more - return 0; - } else { - return -1; // Continue waiting for more signals - }//if -}//NdbTransaction::OpCompleteFailure() - -/****************************************************************************** -int OpCompleteSuccess(); - -Return Value: Return 0 : OpCompleteSuccess was successful. - Return -1: In all other case. -Remark: An operation was completed with success. -*******************************************************************************/ -int -NdbTransaction::OpCompleteSuccess() -{ - Uint32 tNoComp = theNoOfOpCompleted; - Uint32 tNoSent = theNoOfOpSent; - tNoComp++; - theNoOfOpCompleted = tNoComp; - if (tNoComp == tNoSent) { // Last operation completed - return 0; - } else if (tNoComp < tNoSent) { - return -1; // Continue waiting for more signals - } else { - setOperationErrorCodeAbort(4113); // Too many operations, - // stop waiting for more - theCompletionStatus = NdbTransaction::CompletedFailure; - theReturnStatus = NdbTransaction::ReturnFailure; - return 0; - }//if -}//NdbTransaction::OpCompleteSuccess() - -/****************************************************************************** - int getGCI(); - -Remark: Get global checkpoint identity of the transaction -*******************************************************************************/ -int -NdbTransaction::getGCI() -{ - if (theCommitStatus == NdbTransaction::Committed) { - return theGlobalCheckpointId; - }//if - return 0; -}//NdbTransaction::getGCI() - -/******************************************************************************* -Uint64 getTransactionId(void); - -Remark: Get the transaction identity. -*******************************************************************************/ -Uint64 -NdbTransaction::getTransactionId() -{ - return theTransactionId; -}//NdbTransaction::getTransactionId() - -NdbTransaction::CommitStatusType -NdbTransaction::commitStatus() -{ - return theCommitStatus; -}//NdbTransaction::commitStatus() - -int -NdbTransaction::getNdbErrorLine() -{ - return theErrorLine; -} - -NdbOperation* -NdbTransaction::getNdbErrorOperation() -{ - return theErrorOperation; -}//NdbTransaction::getNdbErrorOperation() - -const NdbOperation * -NdbTransaction::getNextCompletedOperation(const NdbOperation * current) const { - if(current == 0) - return theCompletedFirstOp; - return current->theNext; -} - -#ifdef VM_TRACE -#define CASE(x) case x: ndbout << " " << #x; break -void -NdbTransaction::printState() -{ - ndbout << "con=" << hex << this << dec; - ndbout << " node=" << getConnectedNodeId(); - switch (theStatus) { - CASE(NotConnected); - CASE(Connecting); - CASE(Connected); - CASE(DisConnecting); - CASE(ConnectFailure); - default: ndbout << (Uint32) theStatus; - } - switch (theListState) { - CASE(NotInList); - CASE(InPreparedList); - CASE(InSendList); - CASE(InCompletedList); - default: ndbout << (Uint32) theListState; - } - switch (theSendStatus) { - CASE(NotInit); - CASE(InitState); - CASE(sendOperations); - CASE(sendCompleted); - CASE(sendCOMMITstate); - CASE(sendABORT); - CASE(sendABORTfail); - CASE(sendTC_ROLLBACK); - CASE(sendTC_COMMIT); - CASE(sendTC_OP); - default: ndbout << (Uint32) theSendStatus; - } - switch (theCommitStatus) { - CASE(NotStarted); - CASE(Started); - CASE(Committed); - CASE(Aborted); - CASE(NeedAbort); - default: ndbout << (Uint32) theCommitStatus; - } - switch (theCompletionStatus) { - CASE(NotCompleted); - CASE(CompletedSuccess); - CASE(CompletedFailure); - CASE(DefinitionFailure); - default: ndbout << (Uint32) theCompletionStatus; - } - ndbout << endl; -} -#undef CASE -#endif - -int -NdbTransaction::report_node_failure(Uint32 id){ - NdbNodeBitmask::set(m_failed_db_nodes, id); - if(!NdbNodeBitmask::get(m_db_nodes, id)) - { - return 0; - } - - /** - * Arrived - * TCKEYCONF TRANSIDAI - * 1) - - - * 2) - X - * 3) X - - * 4) X X - */ - NdbOperation* tmp = theFirstExecOpInList; - const Uint32 len = TcKeyConf::SimpleReadBit | id; - Uint32 tNoComp = theNoOfOpCompleted; - Uint32 tNoSent = theNoOfOpSent; - Uint32 count = 0; - while(tmp != 0) - { - if(tmp->theReceiver.m_expected_result_length == len && - tmp->theReceiver.m_received_result_length == 0) - { - count++; - tmp->theError.code = 4119; - } - tmp = tmp->next(); - } - tNoComp += count; - theNoOfOpCompleted = tNoComp; - if(count) - { - theReturnStatus = NdbTransaction::ReturnFailure; - if(tNoComp == tNoSent) - { - theError.code = 4119; - theCompletionStatus = NdbTransaction::CompletedFailure; - return 1; - } - } - return 0; -} diff --git a/ndb/src/ndbapi/NdbTransactionScan.cpp b/ndb/src/ndbapi/NdbTransactionScan.cpp deleted file mode 100644 index 4c507f6ab8c..00000000000 --- a/ndb/src/ndbapi/NdbTransactionScan.cpp +++ /dev/null @@ -1,122 +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 */ - - -#include <ndb_global.h> - -#include <Ndb.hpp> -#include <NdbTransaction.hpp> -#include <NdbOperation.hpp> -#include <NdbScanOperation.hpp> -#include "NdbApiSignal.hpp" -#include "TransporterFacade.hpp" -#include "NdbUtil.hpp" -#include "API.hpp" -#include "NdbImpl.hpp" - -#include <signaldata/ScanTab.hpp> - -#include <NdbOut.hpp> - - -/*************************************************************************** - * int receiveSCAN_TABREF(NdbApiSignal* aSignal) - * - * This means the scan could not be started, set status(s) to indicate - * the failure - * - ****************************************************************************/ -int -NdbTransaction::receiveSCAN_TABREF(NdbApiSignal* aSignal){ - const ScanTabRef * ref = CAST_CONSTPTR(ScanTabRef, aSignal->getDataPtr()); - - if(checkState_TransId(&ref->transId1)){ - theScanningOp->setErrorCode(ref->errorCode); - theScanningOp->execCLOSE_SCAN_REP(); - if(!ref->closeNeeded){ - return 0; - } - - /** - * Setup so that close_impl will actually perform a close - * and not "close scan"-optimze it away - */ - theScanningOp->m_conf_receivers_count++; - theScanningOp->m_conf_receivers[0] = theScanningOp->m_receivers[0]; - theScanningOp->m_conf_receivers[0]->m_tcPtrI = ~0; - return 0; - } else { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - } - - return -1; -} - -/***************************************************************************** - * int receiveSCAN_TABCONF(NdbApiSignal* aSignal) - * - * Receive SCAN_TABCONF - * If scanStatus == 0 there is more records to read. Since signals may be - * received in any order we have to go through the lists with saved signals - * and check if all expected signals are there so that we can start to - * execute them. - * - * If scanStatus > 0 this indicates that the scan is finished and there are - * no more data to be read. - * - *****************************************************************************/ -int -NdbTransaction::receiveSCAN_TABCONF(NdbApiSignal* aSignal, - const Uint32 * ops, Uint32 len) -{ - const ScanTabConf * conf = CAST_CONSTPTR(ScanTabConf, aSignal->getDataPtr()); - if(checkState_TransId(&conf->transId1)){ - - if (conf->requestInfo == ScanTabConf::EndOfData) { - theScanningOp->execCLOSE_SCAN_REP(); - return 0; - } - - for(Uint32 i = 0; i<len; i += 3){ - Uint32 opCount, totalLen; - Uint32 ptrI = * ops++; - Uint32 tcPtrI = * ops++; - Uint32 info = * ops++; - opCount = ScanTabConf::getRows(info); - totalLen = ScanTabConf::getLength(info); - - void * tPtr = theNdb->int2void(ptrI); - assert(tPtr); // For now - NdbReceiver* tOp = theNdb->void2rec(tPtr); - if (tOp && tOp->checkMagicNumber()) - { - if (tcPtrI == RNIL && opCount == 0) - theScanningOp->receiver_completed(tOp); - else if (tOp->execSCANOPCONF(tcPtrI, totalLen, opCount)) - theScanningOp->receiver_delivered(tOp); - } - } - return 0; - } else { -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - } - - return -1; -} diff --git a/ndb/src/ndbapi/NdbUtil.cpp b/ndb/src/ndbapi/NdbUtil.cpp deleted file mode 100644 index 5c74d251ff9..00000000000 --- a/ndb/src/ndbapi/NdbUtil.cpp +++ /dev/null @@ -1,69 +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 */ - - -/************************************************************************************************ -Name: NdbUtil.C -Include: -Link: -Author: UABRONM Mikael Ronström UAB/B/SD -Date: 991029 -Version: 0.4 -Description: Utility classes for NDB API -Documentation: -Adjust: 991029 UABRONM First version. -Comment: -************************************************************************************************/ - -#include "NdbUtil.hpp" - -NdbLabel::NdbLabel() : - theNext(NULL) -{ -} - -NdbLabel::~NdbLabel() -{ -} - -NdbSubroutine::NdbSubroutine() : - theNext(NULL) -{ -} - -NdbSubroutine::~NdbSubroutine() -{ -} - -NdbBranch::NdbBranch() : - theSignal(NULL), - theNext(NULL) -{ -} - -NdbBranch::~NdbBranch() -{ -} - -NdbCall::NdbCall() : - theSignal(NULL), - theNext(NULL) -{ -} - -NdbCall::~NdbCall() -{ -} diff --git a/ndb/src/ndbapi/NdbUtil.hpp b/ndb/src/ndbapi/NdbUtil.hpp deleted file mode 100644 index 80fc15ddd8c..00000000000 --- a/ndb/src/ndbapi/NdbUtil.hpp +++ /dev/null @@ -1,97 +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 */ - -/************************************************************************************************ -Name: NdbUtil.H -Include: -Link: -Author: UABRONM Mikael Ronström UAB/B/SD -Date: 991029 -Version: 0.4 -Description: Utility classes for NDB API -Documentation: -Adjust: 991029 UABRONM First version. -Comment: -************************************************************************************************/ -#ifndef NdbUtil_H -#define NdbUtil_H - -#include <ndb_global.h> - -class NdbApiSignal; -class NdbOperation; - -class NdbLabel -{ -friend class NdbOperation; -friend class Ndb; - -private: - NdbLabel(); - ~NdbLabel(); - - NdbLabel* theNext; - Uint32 theSubroutine[16]; - Uint32 theLabelAddress[16]; - Uint32 theLabelNo[16]; -}; - -class NdbSubroutine -{ -friend class NdbOperation; -friend class Ndb; - -private: - NdbSubroutine(); - ~NdbSubroutine(); - - NdbSubroutine* theNext; - Uint32 theSubroutineAddress[16]; -}; - -class NdbBranch -{ -friend class NdbOperation; -friend class Ndb; - -private: - NdbBranch(); - ~NdbBranch(); - - NdbApiSignal* theSignal; - Uint32 theSignalAddress; - Uint32 theBranchAddress; - Uint32 theBranchLabel; - Uint32 theSubroutine; - NdbBranch* theNext; -}; - -class NdbCall -{ -friend class NdbOperation; -friend class Ndb; - -private: - NdbCall(); - ~NdbCall(); - - NdbApiSignal* theSignal; - Uint32 theSignalAddress; - Uint32 theSubroutine; - NdbCall* theNext; -}; - -#endif diff --git a/ndb/src/ndbapi/NdbWaiter.hpp b/ndb/src/ndbapi/NdbWaiter.hpp deleted file mode 100644 index 8b7b2a75879..00000000000 --- a/ndb/src/ndbapi/NdbWaiter.hpp +++ /dev/null @@ -1,102 +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 NDB_WAITER_HPP -#define NDB_WAITER_HPP - -#include <ndb_global.h> -#include <NdbOut.hpp> -#include <NdbError.hpp> -#include <NdbCondition.h> -#include <NdbReceiver.hpp> -#include <NdbOperation.hpp> -#include <kernel/ndb_limits.h> - -#include <NdbTick.h> - -enum WaitSignalType { - NO_WAIT = 0, - WAIT_NODE_FAILURE = 1, // Node failure during wait - WST_WAIT_TIMEOUT = 2, // Timeout during wait - - WAIT_TC_SEIZE = 3, - WAIT_TC_RELEASE = 4, - WAIT_NDB_TAMPER = 5, - WAIT_SCAN = 6, - - // DICT stuff - WAIT_GET_TAB_INFO_REQ = 11, - WAIT_CREATE_TAB_REQ = 12, - WAIT_DROP_TAB_REQ = 13, - WAIT_ALTER_TAB_REQ = 14, - WAIT_CREATE_INDX_REQ = 15, - WAIT_DROP_INDX_REQ = 16, - WAIT_LIST_TABLES_CONF = 17 -}; - -class NdbWaiter { -public: - NdbWaiter(); - ~NdbWaiter(); - - void wait(int waitTime); - void nodeFail(Uint32 node); - void signal(Uint32 state); - - Uint32 m_node; - Uint32 m_state; - void * m_mutex; - struct NdbCondition * m_condition; -}; - -inline -void -NdbWaiter::wait(int waitTime) -{ - const bool forever = (waitTime == -1); - const NDB_TICKS maxTime = NdbTick_CurrentMillisecond() + waitTime; - while (1) { - if (m_state == NO_WAIT || m_state == WAIT_NODE_FAILURE) - break; - if (forever) { - NdbCondition_Wait(m_condition, (NdbMutex*)m_mutex); - } else { - if (waitTime <= 0) { - m_state = WST_WAIT_TIMEOUT; - break; - } - NdbCondition_WaitTimeout(m_condition, (NdbMutex*)m_mutex, waitTime); - waitTime = maxTime - NdbTick_CurrentMillisecond(); - } - } -} - -inline -void -NdbWaiter::nodeFail(Uint32 aNodeId){ - if (m_state != NO_WAIT && m_node == aNodeId){ - m_state = WAIT_NODE_FAILURE; - NdbCondition_Signal(m_condition); - } -} - -inline -void -NdbWaiter::signal(Uint32 state){ - m_state = state; - NdbCondition_Signal(m_condition); -} - -#endif diff --git a/ndb/src/ndbapi/Ndberr.cpp b/ndb/src/ndbapi/Ndberr.cpp deleted file mode 100644 index b05818de6f1..00000000000 --- a/ndb/src/ndbapi/Ndberr.cpp +++ /dev/null @@ -1,82 +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 */ - - -#include <NdbError.hpp> -#include "NdbImpl.hpp" -#include "NdbDictionaryImpl.hpp" -#include <NdbOperation.hpp> -#include <NdbTransaction.hpp> -#include <NdbBlob.hpp> -#include "NdbEventOperationImpl.hpp" - -static void -update(const NdbError & _err){ - NdbError & error = (NdbError &) _err; - ndberror_struct ndberror = (ndberror_struct)error; - ndberror_update(&ndberror); - error = NdbError(ndberror); -} - -const -NdbError & -Ndb::getNdbError(int code){ - theError.code = code; - update(theError); - return theError; -} - -const -NdbError & -Ndb::getNdbError() const { - update(theError); - return theError; -} - -const -NdbError & -NdbDictionaryImpl::getNdbError() const { - update(m_error); - return m_error; -} - -const -NdbError & -NdbTransaction::getNdbError() const { - update(theError); - return theError; -} - -const -NdbError & -NdbOperation::getNdbError() const { - update(theError); - return theError; -} - -const -NdbError & -NdbBlob::getNdbError() const { - update(theError); - return theError; -} - -const -NdbError & -NdbEventOperationImpl::getNdbError() const { - update(m_error); - return m_error; -} diff --git a/ndb/src/ndbapi/Ndbif.cpp b/ndb/src/ndbapi/Ndbif.cpp deleted file mode 100644 index 40aaa1e3daa..00000000000 --- a/ndb/src/ndbapi/Ndbif.cpp +++ /dev/null @@ -1,1368 +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 */ - - -#include <ndb_global.h> - -#include "NdbApiSignal.hpp" -#include "NdbImpl.hpp" -#include <NdbTransaction.hpp> -#include <NdbOperation.hpp> -#include <NdbIndexOperation.hpp> -#include <NdbScanOperation.hpp> -#include <NdbRecAttr.hpp> -#include <NdbReceiver.hpp> -#include "API.hpp" - -#include <signaldata/TcCommit.hpp> -#include <signaldata/TcKeyFailConf.hpp> -#include <signaldata/TcKeyConf.hpp> -#include <signaldata/TestOrd.hpp> -#include <signaldata/CreateIndx.hpp> -#include <signaldata/DropIndx.hpp> -#include <signaldata/TcIndx.hpp> -#include <signaldata/TransIdAI.hpp> -#include <signaldata/ScanFrag.hpp> -#include <signaldata/ScanTab.hpp> - -#include <ndb_limits.h> -#include <NdbOut.hpp> -#include <NdbTick.h> - - -/****************************************************************************** - * int init( int aNrOfCon, int aNrOfOp ); - * - * Return Value: Return 0 : init was successful. - * Return -1: In all other case. - * Parameters: aNrOfCon : Number of connections offered to the application. - * aNrOfOp : Number of operations offered to the application. - * Remark: Create pointers and idle list Synchronous. - ****************************************************************************/ -int -Ndb::init(int aMaxNoOfTransactions) -{ - DBUG_ENTER("Ndb::init"); - - int i; - int aNrOfCon; - int aNrOfOp; - int tMaxNoOfTransactions; - NdbApiSignal* tSignal[16]; // Initiate free list of 16 signal objects - if (theInitState != NotInitialised) { - switch(theInitState){ - case InitConfigError: - theError.code = 4117; - break; - default: - theError.code = 4104; - break; - } - DBUG_RETURN(-1); - }//if - theInitState = StartingInit; - TransporterFacade * theFacade = TransporterFacade::instance(); - theFacade->lock_mutex(); - - const int tBlockNo = theFacade->open(this, - executeMessage, - statusMessage); - if ( tBlockNo == -1 ) { - theError.code = 4105; - theFacade->unlock_mutex(); - DBUG_RETURN(-1); // no more free blocknumbers - }//if - - theNdbBlockNumber = tBlockNo; - - theFacade->unlock_mutex(); - - theDictionary->setTransporter(this, theFacade); - - aNrOfCon = theImpl->theNoOfDBnodes; - aNrOfOp = 2*theImpl->theNoOfDBnodes; - - // Create connection object in a linked list - if((createConIdleList(aNrOfCon)) == -1){ - theError.code = 4000; - goto error_handler; - } - - // Create operations in a linked list - if((createOpIdleList(aNrOfOp)) == -1){ - theError.code = 4000; - goto error_handler; - } - - tMaxNoOfTransactions = aMaxNoOfTransactions * 3; - if (tMaxNoOfTransactions > 1024) { - tMaxNoOfTransactions = 1024; - }//if - theMaxNoOfTransactions = tMaxNoOfTransactions; - - thePreparedTransactionsArray = new NdbTransaction* [tMaxNoOfTransactions]; - theSentTransactionsArray = new NdbTransaction* [tMaxNoOfTransactions]; - theCompletedTransactionsArray = new NdbTransaction* [tMaxNoOfTransactions]; - - if ((thePreparedTransactionsArray == NULL) || - (theSentTransactionsArray == NULL) || - (theCompletedTransactionsArray == NULL)) { - goto error_handler; - }//if - - for (i = 0; i < tMaxNoOfTransactions; i++) { - thePreparedTransactionsArray[i] = NULL; - theSentTransactionsArray[i] = NULL; - theCompletedTransactionsArray[i] = NULL; - }//for - for (i = 0; i < 16; i++){ - tSignal[i] = getSignal(); - if(tSignal[i] == NULL) { - theError.code = 4000; - goto error_handler; - } - } - for (i = 0; i < 16; i++) - releaseSignal(tSignal[i]); - theInitState = Initialised; - DBUG_RETURN(0); - -error_handler: - ndbout << "error_handler" << endl; - releaseTransactionArrays(); - while ( theConIdleList != NULL ) - freeNdbCon(); - while ( theSignalIdleList != NULL ) - freeSignal(); - while (theRecAttrIdleList != NULL) - freeRecAttr(); - while (theOpIdleList != NULL) - freeOperation(); - - delete theDictionary; - TransporterFacade::instance()->close(theNdbBlockNumber, 0); - DBUG_RETURN(-1); -} - -void -Ndb::releaseTransactionArrays() -{ - DBUG_ENTER("Ndb::releaseTransactionArrays"); - if (thePreparedTransactionsArray != NULL) { - delete [] thePreparedTransactionsArray; - }//if - if (theSentTransactionsArray != NULL) { - delete [] theSentTransactionsArray; - }//if - if (theCompletedTransactionsArray != NULL) { - delete [] theCompletedTransactionsArray; - }//if - DBUG_VOID_RETURN; -}//Ndb::releaseTransactionArrays() - -void -Ndb::executeMessage(void* NdbObject, - NdbApiSignal * aSignal, - LinearSectionPtr ptr[3]) -{ - Ndb* tNdb = (Ndb*)NdbObject; - tNdb->handleReceivedSignal(aSignal, ptr); -} - -void Ndb::connected(Uint32 ref) -{ - theMyRef= ref; - Uint32 tmpTheNode= refToNode(ref); - Uint64 tBlockNo= refToBlock(ref); - if (theNdbBlockNumber >= 0){ - assert(theMyRef == numberToRef(theNdbBlockNumber, tmpTheNode)); - } - - TransporterFacade * theFacade = TransporterFacade::instance(); - int i, n= 0; - for (i = 1; i < MAX_NDB_NODES; i++){ - if (theFacade->getIsDbNode(i)){ - theImpl->theDBnodes[n] = i; - n++; - } - } - theImpl->theNoOfDBnodes= n; - theFirstTransId = ((Uint64)tBlockNo << 52)+ - ((Uint64)tmpTheNode << 40); - theFirstTransId += theFacade->m_max_trans_id; - // assert(0); - DBUG_PRINT("info",("connected with ref=%x, id=%d, no_db_nodes=%d, first_trans_id=%lx", - theMyRef, - tmpTheNode, - theImpl->theNoOfDBnodes, - theFirstTransId)); - theCommitAckSignal = new NdbApiSignal(theMyRef); - - theDictionary->m_receiver.m_reference= theMyRef; - theNode= tmpTheNode; // flag that Ndb object is initialized -} - -void -Ndb::statusMessage(void* NdbObject, Uint32 a_node, bool alive, bool nfComplete) -{ - DBUG_ENTER("Ndb::statusMessage"); - Ndb* tNdb = (Ndb*)NdbObject; - if (alive) { - if (nfComplete) { - tNdb->connected(a_node); - DBUG_VOID_RETURN; - }//if - } else { - if (nfComplete) { - tNdb->report_node_failure_completed(a_node); - } else { - tNdb->report_node_failure(a_node); - }//if - }//if - NdbDictInterface::execNodeStatus(&tNdb->theDictionary->m_receiver, - a_node, alive, nfComplete); - DBUG_VOID_RETURN; -} - -void -Ndb::report_node_failure(Uint32 node_id) -{ - /** - * We can only set the state here since this object can execute - * simultaneously. - * - * This method is only called by ClusterMgr (via lots of methods) - */ - theImpl->the_release_ind[node_id] = 1; - // must come after - theImpl->the_release_ind[0] = 1; - theImpl->theWaiter.nodeFail(node_id); - return; -}//Ndb::report_node_failure() - - -void -Ndb::report_node_failure_completed(Uint32 node_id) -{ - abortTransactionsAfterNodeFailure(node_id); - -}//Ndb::report_node_failure_completed() - -/*************************************************************************** -void abortTransactionsAfterNodeFailure(); - -Remark: Abort all transactions in theSentTransactionsArray after connection - to one node has failed -****************************************************************************/ -void -Ndb::abortTransactionsAfterNodeFailure(Uint16 aNodeId) -{ - Uint32 tNoSentTransactions = theNoOfSentTransactions; - for (int i = tNoSentTransactions - 1; i >= 0; i--) { - NdbTransaction* localCon = theSentTransactionsArray[i]; - if (localCon->getConnectedNodeId() == aNodeId) { - const NdbTransaction::SendStatusType sendStatus = localCon->theSendStatus; - if (sendStatus == NdbTransaction::sendTC_OP || - sendStatus == NdbTransaction::sendTC_COMMIT) { - /* - A transaction was interrupted in the prepare phase by a node - failure. Since the transaction was not found in the phase - after the node failure it cannot have been committed and - we report a normal node failure abort. - */ - localCon->setOperationErrorCodeAbort(4010); - localCon->theCompletionStatus = NdbTransaction::CompletedFailure; - } else if (sendStatus == NdbTransaction::sendTC_ROLLBACK) { - /* - We aimed for abort and abort we got even if it was by a node - failure. We will thus report it as a success. - */ - localCon->theCompletionStatus = NdbTransaction::CompletedSuccess; - } else { -#ifdef VM_TRACE - printState("abortTransactionsAfterNodeFailure %x", this); - abort(); -#endif - } - /* - All transactions arriving here have no connection to the kernel - intact since the node was failing and they were aborted. Thus we - set commit state to Aborted and set state to release on close. - */ - localCon->theReturnStatus = NdbTransaction::ReturnFailure; - localCon->theCommitStatus = NdbTransaction::Aborted; - localCon->theReleaseOnClose = true; - completedTransaction(localCon); - } - else if(localCon->report_node_failure(aNodeId)) - { - completedTransaction(localCon); - } - }//for - return; -}//Ndb::abortTransactionsAfterNodeFailure() - -/**************************************************************************** -void handleReceivedSignal(NdbApiSignal* aSignal); - -Parameters: aSignal: The signal object. -Remark: Send all operations belonging to this connection. -*****************************************************************************/ -void -Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) -{ - NdbOperation* tOp; - NdbIndexOperation* tIndexOp; - NdbTransaction* tCon; - int tReturnCode = -1; - const Uint32* tDataPtr = aSignal->getDataPtr(); - const Uint32 tWaitState = theImpl->theWaiter.m_state; - const Uint32 tSignalNumber = aSignal->readSignalNumber(); - const Uint32 tFirstData = *tDataPtr; - const Uint32 tLen = aSignal->getLength(); - void * tFirstDataPtr; - - /* - In order to support 64 bit processes in the application we need to use - id's rather than a direct pointer to the object used. It is also a good - idea that one cannot corrupt the application code by sending a corrupt - memory pointer. - - All signals received by the API requires the first data word to be such - an id to the receiving object. - */ - - switch (tSignalNumber){ - case GSN_TCKEYCONF: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - const TcKeyConf * const keyConf = (TcKeyConf *)tDataPtr; - const BlockReference aTCRef = aSignal->theSendersBlockRef; - - tCon = void2con(tFirstDataPtr); - if ((tCon->checkMagicNumber() == 0) && - (tCon->theSendStatus == NdbTransaction::sendTC_OP)) { - tReturnCode = tCon->receiveTCKEYCONF(keyConf, tLen); - if (tReturnCode != -1) { - completedTransaction(tCon); - }//if - - if(TcKeyConf::getMarkerFlag(keyConf->confInfo)){ - NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal, - keyConf->transId1, - keyConf->transId2, - aTCRef); - } - - return; - }//if - goto InvalidSignal; - - return; - } - case GSN_TRANSID_AI:{ - tFirstDataPtr = int2void(tFirstData); - NdbReceiver* tRec; - if (tFirstDataPtr && (tRec = void2rec(tFirstDataPtr)) && - tRec->checkMagicNumber() && (tCon = tRec->getTransaction()) && - tCon->checkState_TransId(((const TransIdAI*)tDataPtr)->transId)){ - Uint32 com; - if(aSignal->m_noOfSections > 0){ - com = tRec->execTRANSID_AI(ptr[0].p, ptr[0].sz); - } else { - com = tRec->execTRANSID_AI(tDataPtr + TransIdAI::HeaderLength, - tLen - TransIdAI::HeaderLength); - } - - if(com == 0) - return; - - switch(tRec->getType()){ - case NdbReceiver::NDB_OPERATION: - case NdbReceiver::NDB_INDEX_OPERATION: - if(tCon->OpCompleteSuccess() != -1){ - completedTransaction(tCon); - } - return; - case NdbReceiver::NDB_SCANRECEIVER: - tCon->theScanningOp->receiver_delivered(tRec); - theImpl->theWaiter.m_state = (((WaitSignalType) tWaitState) == WAIT_SCAN ? - (Uint32) NO_WAIT : tWaitState); - break; - default: - goto InvalidSignal; - } - break; - } else { - /** - * This is ok as transaction can have been aborted before TRANSID_AI - * arrives (if TUP on other node than TC) - */ - return; - } - } - case GSN_TCKEY_FAILCONF: - { - tFirstDataPtr = int2void(tFirstData); - const TcKeyFailConf * failConf = (TcKeyFailConf *)tDataPtr; - const BlockReference aTCRef = aSignal->theSendersBlockRef; - if (tFirstDataPtr != 0){ - tOp = void2rec_op(tFirstDataPtr); - - if (tOp->checkMagicNumber(false) == 0) { - tCon = tOp->theNdbCon; - if (tCon != NULL) { - if ((tCon->theSendStatus == NdbTransaction::sendTC_OP) || - (tCon->theSendStatus == NdbTransaction::sendTC_COMMIT)) { - tReturnCode = tCon->receiveTCKEY_FAILCONF(failConf); - if (tReturnCode != -1) { - completedTransaction(tCon); - }//if - }//if - } - } - } else { -#ifdef VM_TRACE - ndbout_c("Recevied TCKEY_FAILCONF wo/ operation"); -#endif - } - if(tFirstData & 1){ - NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal, - failConf->transId1, - failConf->transId2, - aTCRef); - } - return; - } - case GSN_TCKEY_FAILREF: - { - tFirstDataPtr = int2void(tFirstData); - if(tFirstDataPtr != 0){ - tOp = void2rec_op(tFirstDataPtr); - if (tOp->checkMagicNumber() == 0) { - tCon = tOp->theNdbCon; - if (tCon != NULL) { - if ((tCon->theSendStatus == NdbTransaction::sendTC_OP) || - (tCon->theSendStatus == NdbTransaction::sendTC_ROLLBACK)) { - tReturnCode = tCon->receiveTCKEY_FAILREF(aSignal); - if (tReturnCode != -1) { - completedTransaction(tCon); - return; - }//if - }//if - }//if - }//if - } else { -#ifdef VM_TRACE - ndbout_c("Recevied TCKEY_FAILREF wo/ operation"); -#endif - } - break; - } - case GSN_TCKEYREF: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - tOp = void2rec_op(tFirstDataPtr); - if (tOp->checkMagicNumber() == 0) { - tCon = tOp->theNdbCon; - if (tCon != NULL) { - if (tCon->theSendStatus == NdbTransaction::sendTC_OP) { - tReturnCode = tOp->receiveTCKEYREF(aSignal); - if (tReturnCode != -1) { - completedTransaction(tCon); - return; - }//if - break; - }//if - }//if - } //if - goto InvalidSignal; - return; - } - case GSN_TC_COMMITCONF: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - const TcCommitConf * const commitConf = (TcCommitConf *)tDataPtr; - const BlockReference aTCRef = aSignal->theSendersBlockRef; - - tCon = void2con(tFirstDataPtr); - if ((tCon->checkMagicNumber() == 0) && - (tCon->theSendStatus == NdbTransaction::sendTC_COMMIT)) { - tReturnCode = tCon->receiveTC_COMMITCONF(commitConf); - if (tReturnCode != -1) { - completedTransaction(tCon); - }//if - - if(tFirstData & 1){ - NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal, - commitConf->transId1, - commitConf->transId2, - aTCRef); - } - return; - } - goto InvalidSignal; - return; - } - - case GSN_TC_COMMITREF: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - tCon = void2con(tFirstDataPtr); - if ((tCon->checkMagicNumber() == 0) && - (tCon->theSendStatus == NdbTransaction::sendTC_COMMIT)) { - tReturnCode = tCon->receiveTC_COMMITREF(aSignal); - if (tReturnCode != -1) { - completedTransaction(tCon); - }//if - }//if - return; - } - case GSN_TCROLLBACKCONF: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - tCon = void2con(tFirstDataPtr); - if ((tCon->checkMagicNumber() == 0) && - (tCon->theSendStatus == NdbTransaction::sendTC_ROLLBACK)) { - tReturnCode = tCon->receiveTCROLLBACKCONF(aSignal); - if (tReturnCode != -1) { - completedTransaction(tCon); - }//if - }//if - return; - } - case GSN_TCROLLBACKREF: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - tCon = void2con(tFirstDataPtr); - if ((tCon->checkMagicNumber() == 0) && - (tCon->theSendStatus == NdbTransaction::sendTC_ROLLBACK)) { - tReturnCode = tCon->receiveTCROLLBACKREF(aSignal); - if (tReturnCode != -1) { - completedTransaction(tCon); - }//if - }//if - return; - } - case GSN_TCROLLBACKREP: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - tCon = void2con(tFirstDataPtr); - if (tCon->checkMagicNumber() == 0) { - tReturnCode = tCon->receiveTCROLLBACKREP(aSignal); - if (tReturnCode != -1) { - completedTransaction(tCon); - }//if - }//if - return; - } - case GSN_TCSEIZECONF: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - if (tWaitState != WAIT_TC_SEIZE) { - goto InvalidSignal; - }//if - tCon = void2con(tFirstDataPtr); - if (tCon->checkMagicNumber() != 0) { - goto InvalidSignal; - }//if - tReturnCode = tCon->receiveTCSEIZECONF(aSignal); - if (tReturnCode != -1) { - theImpl->theWaiter.m_state = NO_WAIT; - } else { - goto InvalidSignal; - }//if - break; - } - case GSN_TCSEIZEREF: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - if (tWaitState != WAIT_TC_SEIZE) { - return; - }//if - tCon = void2con(tFirstDataPtr); - if (tCon->checkMagicNumber() != 0) { - return; - }//if - tReturnCode = tCon->receiveTCSEIZEREF(aSignal); - if (tReturnCode != -1) { - theImpl->theWaiter.m_state = NO_WAIT; - } else { - return; - }//if - break; - } - case GSN_TCRELEASECONF: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - if (tWaitState != WAIT_TC_RELEASE) { - goto InvalidSignal; - }//if - tCon = void2con(tFirstDataPtr); - if (tCon->checkMagicNumber() != 0) { - goto InvalidSignal; - }//if - tReturnCode = tCon->receiveTCRELEASECONF(aSignal); - if (tReturnCode != -1) { - theImpl->theWaiter.m_state = NO_WAIT; - }//if - break; - } - case GSN_TCRELEASEREF: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - if (tWaitState != WAIT_TC_RELEASE) { - goto InvalidSignal; - }//if - tCon = void2con(tFirstDataPtr); - if (tCon->checkMagicNumber() != 0) { - goto InvalidSignal; - }//if - tReturnCode = tCon->receiveTCRELEASEREF(aSignal); - if (tReturnCode != -1) { - theImpl->theWaiter.m_state = NO_WAIT; - }//if - break; - } - - case GSN_GET_TABINFOREF: - case GSN_GET_TABINFO_CONF: - case GSN_CREATE_TABLE_REF: - case GSN_CREATE_TABLE_CONF: - case GSN_DROP_TABLE_CONF: - case GSN_DROP_TABLE_REF: - case GSN_ALTER_TABLE_CONF: - case GSN_ALTER_TABLE_REF: - case GSN_CREATE_INDX_CONF: - case GSN_CREATE_INDX_REF: - case GSN_DROP_INDX_CONF: - case GSN_DROP_INDX_REF: - case GSN_CREATE_EVNT_CONF: - case GSN_CREATE_EVNT_REF: - case GSN_DROP_EVNT_CONF: - case GSN_DROP_EVNT_REF: - case GSN_LIST_TABLES_CONF: - NdbDictInterface::execSignal(&theDictionary->m_receiver, - aSignal, ptr); - break; - - case GSN_SUB_META_DATA: - case GSN_SUB_REMOVE_CONF: - case GSN_SUB_REMOVE_REF: - break; // ignore these signals - case GSN_SUB_GCP_COMPLETE_REP: - case GSN_SUB_START_CONF: - case GSN_SUB_START_REF: - case GSN_SUB_TABLE_DATA: - case GSN_SUB_STOP_CONF: - case GSN_SUB_STOP_REF: - NdbDictInterface::execSignal(&theDictionary->m_receiver, - aSignal, ptr); - break; - - case GSN_DIHNDBTAMPER: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - if (tWaitState != WAIT_NDB_TAMPER) - return; - tCon = void2con(tFirstDataPtr); - if (tCon->checkMagicNumber() != 0) - return; - tReturnCode = tCon->receiveDIHNDBTAMPER(aSignal); - if (tReturnCode != -1) - theImpl->theWaiter.m_state = NO_WAIT; - break; - } - case GSN_SCAN_TABCONF: - { - tFirstDataPtr = int2void(tFirstData); - assert(tFirstDataPtr); - assert(void2con(tFirstDataPtr)); - assert(void2con(tFirstDataPtr)->checkMagicNumber() == 0); - if(tFirstDataPtr && - (tCon = void2con(tFirstDataPtr)) && (tCon->checkMagicNumber() == 0)){ - - if(aSignal->m_noOfSections > 0){ - tReturnCode = tCon->receiveSCAN_TABCONF(aSignal, - ptr[0].p, ptr[0].sz); - } else { - tReturnCode = - tCon->receiveSCAN_TABCONF(aSignal, - tDataPtr + ScanTabConf::SignalLength, - tLen - ScanTabConf::SignalLength); - } - if (tReturnCode != -1 && tWaitState == WAIT_SCAN) - theImpl->theWaiter.m_state = NO_WAIT; - break; - } else { - goto InvalidSignal; - } - } - case GSN_SCAN_TABREF: - { - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - tCon = void2con(tFirstDataPtr); - - assert(tFirstDataPtr != 0 && - void2con(tFirstDataPtr)->checkMagicNumber() == 0); - - if (tCon->checkMagicNumber() == 0){ - tReturnCode = tCon->receiveSCAN_TABREF(aSignal); - if (tReturnCode != -1 && tWaitState == WAIT_SCAN){ - theImpl->theWaiter.m_state = NO_WAIT; - } - break; - } - goto InvalidSignal; - } - case GSN_KEYINFO20: { - tFirstDataPtr = int2void(tFirstData); - NdbReceiver* tRec; - if (tFirstDataPtr && (tRec = void2rec(tFirstDataPtr)) && - tRec->checkMagicNumber() && (tCon = tRec->getTransaction()) && - tCon->checkState_TransId(&((const KeyInfo20*)tDataPtr)->transId1)){ - - Uint32 len = ((const KeyInfo20*)tDataPtr)->keyLen; - Uint32 info = ((const KeyInfo20*)tDataPtr)->scanInfo_Node; - int com = -1; - if(aSignal->m_noOfSections > 0 && len == ptr[0].sz){ - com = tRec->execKEYINFO20(info, ptr[0].p, len); - } else if(len == tLen - KeyInfo20::HeaderLength){ - com = tRec->execKEYINFO20(info, tDataPtr+KeyInfo20::HeaderLength, len); - } - - switch(com){ - case 1: - tCon->theScanningOp->receiver_delivered(tRec); - theImpl->theWaiter.m_state = (((WaitSignalType) tWaitState) == WAIT_SCAN ? - (Uint32) NO_WAIT : tWaitState); - break; - case 0: - break; - case -1: - goto InvalidSignal; - } - break; - } else { - /** - * This is ok as transaction can have been aborted before KEYINFO20 - * arrives (if TUP on other node than TC) - */ - return; - } - } - case GSN_TCINDXCONF:{ - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - const TcIndxConf * const indxConf = (TcIndxConf *)tDataPtr; - const BlockReference aTCRef = aSignal->theSendersBlockRef; - tCon = void2con(tFirstDataPtr); - if ((tCon->checkMagicNumber() == 0) && - (tCon->theSendStatus == NdbTransaction::sendTC_OP)) { - tReturnCode = tCon->receiveTCINDXCONF(indxConf, tLen); - if (tReturnCode != -1) { - completedTransaction(tCon); - }//if - }//if - - if(TcIndxConf::getMarkerFlag(indxConf->confInfo)){ - NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal, - indxConf->transId1, - indxConf->transId2, - aTCRef); - } - return; - } - case GSN_TCINDXREF:{ - tFirstDataPtr = int2void(tFirstData); - if (tFirstDataPtr == 0) goto InvalidSignal; - - tIndexOp = void2rec_iop(tFirstDataPtr); - if (tIndexOp->checkMagicNumber() == 0) { - tCon = tIndexOp->theNdbCon; - if (tCon != NULL) { - if (tCon->theSendStatus == NdbTransaction::sendTC_OP) { - tReturnCode = tIndexOp->receiveTCINDXREF(aSignal); - if (tReturnCode != -1) { - completedTransaction(tCon); - }//if - return; - }//if - }//if - }//if - goto InvalidSignal; - return; - } - default: - goto InvalidSignal; - }//switch - - if (theImpl->theWaiter.m_state == NO_WAIT) { - // Wake up the thread waiting for response - NdbCondition_Signal(theImpl->theWaiter.m_condition); - }//if - return; - - InvalidSignal: -#ifdef VM_TRACE - ndbout_c("Ndbif: Error Ndb::handleReceivedSignal " - "(GSN=%d, theImpl->theWaiter.m_state=%d)" - " sender = (Block: %d Node: %d)", - tSignalNumber, - tWaitState, - refToBlock(aSignal->theSendersBlockRef), - refToNode(aSignal->theSendersBlockRef)); -#endif -#ifdef NDB_NO_DROPPED_SIGNAL - abort(); -#endif - - return; -}//Ndb::handleReceivedSignal() - - -/***************************************************************************** -void completedTransaction(NdbTransaction* aCon); - -Remark: One transaction has been completed. - Remove it from send array and put it into the completed - transaction array. Finally check if it is time to wake - up a poller. -******************************************************************************/ -void -Ndb::completedTransaction(NdbTransaction* aCon) -{ - Uint32 tTransArrayIndex = aCon->theTransArrayIndex; - Uint32 tNoSentTransactions = theNoOfSentTransactions; - Uint32 tNoCompletedTransactions = theNoOfCompletedTransactions; - if ((tNoSentTransactions > 0) && (aCon->theListState == NdbTransaction::InSendList) && - (tTransArrayIndex < tNoSentTransactions)) { - NdbTransaction* tMoveCon = theSentTransactionsArray[tNoSentTransactions - 1]; - - theCompletedTransactionsArray[tNoCompletedTransactions] = aCon; - aCon->theTransArrayIndex = tNoCompletedTransactions; - if (tMoveCon != aCon) { - tMoveCon->theTransArrayIndex = tTransArrayIndex; - theSentTransactionsArray[tTransArrayIndex] = tMoveCon; - }//if - theSentTransactionsArray[tNoSentTransactions - 1] = NULL; - theNoOfCompletedTransactions = tNoCompletedTransactions + 1; - - theNoOfSentTransactions = tNoSentTransactions - 1; - aCon->theListState = NdbTransaction::InCompletedList; - aCon->handleExecuteCompletion(); - if ((theMinNoOfEventsToWakeUp != 0) && - (theNoOfCompletedTransactions >= theMinNoOfEventsToWakeUp)) { - theMinNoOfEventsToWakeUp = 0; - NdbCondition_Signal(theImpl->theWaiter.m_condition); - return; - }//if - } else { - ndbout << "theNoOfSentTransactions = " << (int) theNoOfSentTransactions; - ndbout << " theListState = " << (int) aCon->theListState; - ndbout << " theTransArrayIndex = " << aCon->theTransArrayIndex; - ndbout << endl << flush; -#ifdef VM_TRACE - printState("completedTransaction abort"); - abort(); -#endif - }//if -}//Ndb::completedTransaction() - -/***************************************************************************** -void reportCallback(NdbTransaction** aCopyArray, Uint32 aNoOfCompletedTrans); - -Remark: Call the callback methods of the completed transactions. -******************************************************************************/ -void -Ndb::reportCallback(NdbTransaction** aCopyArray, Uint32 aNoOfCompletedTrans) -{ - Uint32 i; - if (aNoOfCompletedTrans > 0) { - for (i = 0; i < aNoOfCompletedTrans; i++) { - void* anyObject = aCopyArray[i]->theCallbackObject; - NdbAsynchCallback aCallback = aCopyArray[i]->theCallbackFunction; - int tResult = 0; - if (aCallback != NULL) { - if (aCopyArray[i]->theReturnStatus == NdbTransaction::ReturnFailure) { - tResult = -1; - }//if - (*aCallback)(tResult, aCopyArray[i], anyObject); - }//if - }//for - }//if -}//Ndb::reportCallback() - -/***************************************************************************** -Uint32 pollCompleted(NdbTransaction** aCopyArray); - -Remark: Transfer the data from the completed transaction to a local array. - This support is used by a number of the poll-methods. -******************************************************************************/ -Uint32 -Ndb::pollCompleted(NdbTransaction** aCopyArray) -{ - check_send_timeout(); - Uint32 i; - Uint32 tNoCompletedTransactions = theNoOfCompletedTransactions; - if (tNoCompletedTransactions > 0) { - for (i = 0; i < tNoCompletedTransactions; i++) { - aCopyArray[i] = theCompletedTransactionsArray[i]; - if (aCopyArray[i]->theListState != NdbTransaction::InCompletedList) { - ndbout << "pollCompleted error "; - ndbout << (int) aCopyArray[i]->theListState << endl; - abort(); - }//if - theCompletedTransactionsArray[i] = NULL; - aCopyArray[i]->theListState = NdbTransaction::NotInList; - }//for - }//if - theNoOfCompletedTransactions = 0; - return tNoCompletedTransactions; -}//Ndb::pollCompleted() - -void -Ndb::check_send_timeout() -{ - NDB_TICKS current_time = NdbTick_CurrentMillisecond(); - if (current_time - the_last_check_time > 1000) { - the_last_check_time = current_time; - Uint32 no_of_sent = theNoOfSentTransactions; - for (Uint32 i = 0; i < no_of_sent; i++) { - NdbTransaction* a_con = theSentTransactionsArray[i]; - if ((current_time - a_con->theStartTransTime) > - WAITFOR_RESPONSE_TIMEOUT) { -#ifdef VM_TRACE - a_con->printState(); - Uint32 t1 = a_con->theTransactionId; - Uint32 t2 = a_con->theTransactionId >> 32; - ndbout_c("[%.8x %.8x]", t1, t2); - abort(); -#endif - a_con->setOperationErrorCodeAbort(4012); - a_con->theCommitStatus = NdbTransaction::Aborted; - a_con->theCompletionStatus = NdbTransaction::CompletedFailure; - a_con->handleExecuteCompletion(); - remove_sent_list(i); - insert_completed_list(a_con); - no_of_sent--; - i--; - }//if - }//for - }//if -} - -void -Ndb::remove_sent_list(Uint32 list_index) -{ - Uint32 last_index = theNoOfSentTransactions - 1; - if (list_index < last_index) { - NdbTransaction* t_con = theSentTransactionsArray[last_index]; - theSentTransactionsArray[list_index] = t_con; - }//if - theNoOfSentTransactions = last_index; - theSentTransactionsArray[last_index] = 0; -} - -Uint32 -Ndb::insert_completed_list(NdbTransaction* a_con) -{ - Uint32 no_of_comp = theNoOfCompletedTransactions; - theCompletedTransactionsArray[no_of_comp] = a_con; - theNoOfCompletedTransactions = no_of_comp + 1; - a_con->theListState = NdbTransaction::InCompletedList; - a_con->theTransArrayIndex = no_of_comp; - return no_of_comp; -} - -Uint32 -Ndb::insert_sent_list(NdbTransaction* a_con) -{ - Uint32 no_of_sent = theNoOfSentTransactions; - theSentTransactionsArray[no_of_sent] = a_con; - theNoOfSentTransactions = no_of_sent + 1; - a_con->theListState = NdbTransaction::InSendList; - a_con->theTransArrayIndex = no_of_sent; - return no_of_sent; -} - -/***************************************************************************** -void sendPrepTrans(int forceSend); - -Remark: Send a batch of transactions prepared for sending to the NDB kernel. -******************************************************************************/ -void -Ndb::sendPrepTrans(int forceSend) -{ - // Always called when holding mutex on TransporterFacade - /* - We will send a list of transactions to the NDB kernel. Before - sending we check the following. - 1) Node connected to is still alive - Checked by both checking node status and node sequence - 2) Send buffer can handle the size of messages we are planning to send - So far this is just a fake check but will soon be a real check - When the connected node has failed we abort the transaction without - responding anymore to the node since the kernel will clean up - automatically. - When sendBuffer cannot handle anymore messages then we will also abort - transaction but by communicating to the kernel since it is still alive - and we keep a small space for messages like that. - */ - Uint32 i; - TransporterFacade* tp = TransporterFacade::instance(); - Uint32 no_of_prep_trans = theNoOfPreparedTransactions; - for (i = 0; i < no_of_prep_trans; i++) { - NdbTransaction * a_con = thePreparedTransactionsArray[i]; - thePreparedTransactionsArray[i] = NULL; - Uint32 node_id = a_con->getConnectedNodeId(); - if ((tp->getNodeSequence(node_id) == a_con->theNodeSequence) && - tp->get_node_alive(node_id) || - (tp->get_node_stopping(node_id) && - ((a_con->theSendStatus == NdbTransaction::sendABORT) || - (a_con->theSendStatus == NdbTransaction::sendABORTfail) || - (a_con->theSendStatus == NdbTransaction::sendCOMMITstate) || - (a_con->theSendStatus == NdbTransaction::sendCompleted)))) { - /* - We will send if - 1) Node is alive and sequences are correct OR - 2) Node is stopping and we only want to commit or abort - In a graceful stop situation we want to ensure quick aborts - of all transactions and commits and thus we allow aborts and - commits to continue but not normal operations. - */ - if (tp->check_send_size(node_id, a_con->get_send_size())) { - if (a_con->doSend() == 0) { - NDB_TICKS current_time = NdbTick_CurrentMillisecond(); - a_con->theStartTransTime = current_time; - continue; - } else { - /* - Although all precautions we did not manage to send the operations - Must have been a dropped connection on the transporter side. - We don't expect to be able to continue using this connection so - we will treat it as a node failure. - */ - TRACE_DEBUG("Send problem even after checking node status"); - }//if - } else { - /* - The send buffer is currently full or at least close to. We will - not allow a send to continue. We will set the connection so that - it is indicated that we need to abort the transaction. If we were - trying to commit or abort and got a send buffer we will not try - again and will thus set the state to Aborted to avoid a more or - less eternal loop of tries. - */ - if (a_con->theSendStatus == NdbTransaction::sendOperations) { - a_con->setOperationErrorCodeAbort(4021); - a_con->theCommitStatus = NdbTransaction::NeedAbort; - TRACE_DEBUG("Send buffer full and sendOperations"); - } else { - a_con->setOperationErrorCodeAbort(4026); - a_con->theCommitStatus = NdbTransaction::Aborted; - TRACE_DEBUG("Send buffer full, set state to Aborted"); - }//if - }//if - } else { -#ifdef VM_TRACE - a_con->printState(); -#endif - if ((tp->getNodeSequence(node_id) == a_con->theNodeSequence) && - tp->get_node_stopping(node_id)) { - /* - The node we are connected to is currently in an early stopping phase - of a graceful stop. We will not send the prepared transactions. We - will simply refuse and let the application code handle the abort. - */ - TRACE_DEBUG("Abort a transaction when stopping a node"); - a_con->setOperationErrorCodeAbort(4023); - a_con->theCommitStatus = NdbTransaction::NeedAbort; - } else { - /* - The node is hard dead and we cannot continue. We will also release - the connection to the free pool. - */ - TRACE_DEBUG("The node was stone dead, inform about abort"); - a_con->setOperationErrorCodeAbort(4025); - a_con->theReleaseOnClose = true; - a_con->theTransactionIsStarted = false; - a_con->theCommitStatus = NdbTransaction::Aborted; - }//if - }//if - a_con->theReturnStatus = NdbTransaction::ReturnFailure; - a_con->theCompletionStatus = NdbTransaction::CompletedFailure; - a_con->handleExecuteCompletion(); - insert_completed_list(a_con); - }//for - theNoOfPreparedTransactions = 0; - if (forceSend == 0) { - tp->checkForceSend(theNdbBlockNumber); - } else if (forceSend == 1) { - tp->forceSend(theNdbBlockNumber); - }//if - return; -}//Ndb::sendPrepTrans() - -/***************************************************************************** -void waitCompletedTransactions(int aMilliSecondsToWait, int noOfEventsToWaitFor); - -Remark: First send all prepared operations and then check if there are any - transactions already completed. Do not wait for not completed - transactions. -******************************************************************************/ -void -Ndb::waitCompletedTransactions(int aMilliSecondsToWait, - int noOfEventsToWaitFor) -{ - theImpl->theWaiter.m_state = NO_WAIT; - /** - * theImpl->theWaiter.m_state = NO_WAIT; - * To ensure no messup with synchronous node fail handling - * (see ReportFailure) - */ - int waitTime = aMilliSecondsToWait; - NDB_TICKS maxTime = NdbTick_CurrentMillisecond() + (NDB_TICKS)waitTime; - theMinNoOfEventsToWakeUp = noOfEventsToWaitFor; - do { - if (waitTime < 1000) waitTime = 1000; - NdbCondition_WaitTimeout(theImpl->theWaiter.m_condition, - (NdbMutex*)theImpl->theWaiter.m_mutex, - waitTime); - if (theNoOfCompletedTransactions >= (Uint32)noOfEventsToWaitFor) { - break; - }//if - theMinNoOfEventsToWakeUp = noOfEventsToWaitFor; - waitTime = (int)(maxTime - NdbTick_CurrentMillisecond()); - } while (waitTime > 0); - return; -}//Ndb::waitCompletedTransactions() - -/***************************************************************************** -void sendPreparedTransactions(int forceSend = 0); - -Remark: First send all prepared operations and then check if there are any - transactions already completed. Do not wait for not completed - transactions. -******************************************************************************/ -void -Ndb::sendPreparedTransactions(int forceSend) -{ - TransporterFacade::instance()->lock_mutex(); - sendPrepTrans(forceSend); - TransporterFacade::instance()->unlock_mutex(); - return; -}//Ndb::sendPreparedTransactions() - -/***************************************************************************** -int sendPollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup = 1, int forceSend = 0); - -Remark: First send all prepared operations and then check if there are any - transactions already completed. Wait for not completed - transactions until the specified number have completed or until the - timeout has occured. Timeout zero means no waiting time. -******************************************************************************/ -int -Ndb::sendPollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup, int forceSend) -{ - NdbTransaction* tConArray[1024]; - Uint32 tNoCompletedTransactions; - - //theCurrentConnectCounter = 0; - //theCurrentConnectIndex++; - TransporterFacade::instance()->lock_mutex(); - sendPrepTrans(forceSend); - if ((minNoOfEventsToWakeup <= 0) || - ((Uint32)minNoOfEventsToWakeup > theNoOfSentTransactions)) { - minNoOfEventsToWakeup = theNoOfSentTransactions; - }//if - if ((theNoOfCompletedTransactions < (Uint32)minNoOfEventsToWakeup) && - (aMillisecondNumber > 0)) { - waitCompletedTransactions(aMillisecondNumber, minNoOfEventsToWakeup); - tNoCompletedTransactions = pollCompleted(tConArray); - } else { - tNoCompletedTransactions = pollCompleted(tConArray); - }//if - TransporterFacade::instance()->unlock_mutex(); - reportCallback(tConArray, tNoCompletedTransactions); - return tNoCompletedTransactions; -}//Ndb::sendPollNdb() - -/***************************************************************************** -int pollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup); - -Remark: Check if there are any transactions already completed. Wait for not - completed transactions until the specified number have completed or - until the timeout has occured. Timeout zero means no waiting time. -******************************************************************************/ -int -Ndb::pollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup) -{ - NdbTransaction* tConArray[1024]; - Uint32 tNoCompletedTransactions; - - //theCurrentConnectCounter = 0; - //theCurrentConnectIndex++; - TransporterFacade::instance()->lock_mutex(); - if ((minNoOfEventsToWakeup == 0) || - ((Uint32)minNoOfEventsToWakeup > theNoOfSentTransactions)) { - minNoOfEventsToWakeup = theNoOfSentTransactions; - }//if - if ((theNoOfCompletedTransactions < (Uint32)minNoOfEventsToWakeup) && - (aMillisecondNumber > 0)) { - waitCompletedTransactions(aMillisecondNumber, minNoOfEventsToWakeup); - tNoCompletedTransactions = pollCompleted(tConArray); - } else { - tNoCompletedTransactions = pollCompleted(tConArray); - }//if - TransporterFacade::instance()->unlock_mutex(); - reportCallback(tConArray, tNoCompletedTransactions); - return tNoCompletedTransactions; -}//Ndb::sendPollNdbWithoutWait() - -/***************************************************************************** -int receiveOptimisedResponse(); - -Return: 0 - Response received - -1 - Timeout occured waiting for response - -2 - Node failure interupted wait for response - -******************************************************************************/ -int -Ndb::receiveResponse(int waitTime){ - int tResultCode; - TransporterFacade::instance()->checkForceSend(theNdbBlockNumber); - - theImpl->theWaiter.wait(waitTime); - - if(theImpl->theWaiter.m_state == NO_WAIT) { - tResultCode = 0; - } else { - -#ifdef VM_TRACE - ndbout << "ERR: receiveResponse - theImpl->theWaiter.m_state = "; - ndbout << theImpl->theWaiter.m_state << endl; -#endif - - if (theImpl->theWaiter.m_state == WAIT_NODE_FAILURE){ - tResultCode = -2; - } else { - tResultCode = -1; - } - theImpl->theWaiter.m_state = NO_WAIT; - } - return tResultCode; -}//Ndb::receiveResponse() - -int -Ndb::sendRecSignal(Uint16 node_id, - Uint32 aWaitState, - NdbApiSignal* aSignal, - Uint32 conn_seq) -{ - /* - In most situations 0 is returned. - In error cases we have 5 different cases - -1: Send ok, time out in waiting for reply - -2: Node has failed - -3: Send buffer not full, send failed yet - -4: Send buffer full - -5: Node is currently stopping - */ - - int return_code; - TransporterFacade* tp = TransporterFacade::instance(); - Uint32 send_size = 1; // Always sends one signal only - tp->lock_mutex(); - // Protected area - if ((tp->get_node_alive(node_id)) && - ((tp->getNodeSequence(node_id) == conn_seq) || - (conn_seq == 0))) { - if (tp->check_send_size(node_id, send_size)) { - return_code = tp->sendSignal(aSignal, node_id); - if (return_code != -1) { - theImpl->theWaiter.m_node = node_id; - theImpl->theWaiter.m_state = aWaitState; - return_code = receiveResponse(); - } else { - return_code = -3; - } - } else { - return_code = -4; - }//if - } else { - if ((tp->get_node_stopping(node_id)) && - ((tp->getNodeSequence(node_id) == conn_seq) || - (conn_seq == 0))) { - return_code = -5; - } else { - return_code = -2; - }//if - }//if - tp->unlock_mutex(); - // End of protected area - return return_code; -}//Ndb::sendRecSignal() - -void -NdbTransaction::sendTC_COMMIT_ACK(NdbApiSignal * aSignal, - Uint32 transId1, Uint32 transId2, - Uint32 aTCRef){ -#ifdef MARKER_TRACE - ndbout_c("Sending TC_COMMIT_ACK(0x%.8x, 0x%.8x) to -> %d", - transId1, - transId2, - refToNode(aTCRef)); -#endif - TransporterFacade *tp = TransporterFacade::instance(); - aSignal->theTrace = TestOrd::TraceAPI; - aSignal->theReceiversBlockNumber = DBTC; - aSignal->theVerId_signalNumber = GSN_TC_COMMIT_ACK; - aSignal->theLength = 2; - - Uint32 * dataPtr = aSignal->getDataPtrSend(); - dataPtr[0] = transId1; - dataPtr[1] = transId2; - - tp->sendSignal(aSignal, refToNode(aTCRef)); -} diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp deleted file mode 100644 index 4db9d05b59c..00000000000 --- a/ndb/src/ndbapi/Ndbinit.cpp +++ /dev/null @@ -1,254 +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 */ - - -#include <ndb_global.h> - -#include "NdbApiSignal.hpp" -#include "NdbImpl.hpp" -#include <NdbOperation.hpp> -#include <NdbTransaction.hpp> -#include <NdbRecAttr.hpp> -#include <IPCConfig.hpp> -#include "TransporterFacade.hpp" -#include <ConfigRetriever.hpp> -#include <ndb_limits.h> -#include <NdbOut.hpp> -#include <NdbSleep.h> -#include "ObjectMap.hpp" - -class NdbGlobalEventBufferHandle; -NdbGlobalEventBufferHandle *NdbGlobalEventBuffer_init(int); -void NdbGlobalEventBuffer_drop(NdbGlobalEventBufferHandle *); - -Ndb::Ndb( Ndb_cluster_connection *ndb_cluster_connection, - const char* aDataBase , const char* aSchema) - : theImpl(NULL) -{ - DBUG_ENTER("Ndb::Ndb()"); - DBUG_PRINT("enter",("Ndb::Ndb this=0x%x", this)); - setup(ndb_cluster_connection, aDataBase, aSchema); - DBUG_VOID_RETURN; -} - -void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection, - const char* aDataBase , const char* aSchema) -{ - DBUG_ENTER("Ndb::setup"); - - assert(theImpl == NULL); - theImpl= new NdbImpl(ndb_cluster_connection,*this); - theDictionary= &(theImpl->m_dictionary); - - thePreparedTransactionsArray= NULL; - theSentTransactionsArray= NULL; - theCompletedTransactionsArray= NULL; - theNoOfPreparedTransactions= 0; - theNoOfSentTransactions= 0; - theNoOfCompletedTransactions= 0; - theNoOfAllocatedTransactions= 0; - theMaxNoOfTransactions= 0; - theMinNoOfEventsToWakeUp= 0; - prefixEnd= NULL; - theConIdleList= NULL; - theOpIdleList= NULL; - theScanOpIdleList= NULL; - theIndexOpIdleList= NULL; - theTransactionList= NULL; - theConnectionArray= NULL; - theRecAttrIdleList= NULL; - theSignalIdleList= NULL; - theLabelList= NULL; - theBranchList= NULL; - theSubroutineList= NULL; - theCallList= NULL; - theScanList= NULL; - theNdbBlobIdleList= NULL; - the_last_check_time= 0; - theFirstTransId= 0; - theRestartGCI= 0; - theNdbBlockNumber= -1; - theInitState= NotConstructed; - - theNode= 0; - theFirstTransId= 0; - theMyRef= 0; - - fullyQualifiedNames = true; - -#ifdef POORMANSPURIFY - cgetSignals =0; - cfreeSignals = 0; - cnewSignals = 0; - creleaseSignals = 0; -#endif - - theError.code = 0; - - theConnectionArray = new NdbConnection * [MAX_NDB_NODES]; - theCommitAckSignal = NULL; - - int i; - for (i = 0; i < MAX_NDB_NODES ; i++) { - theConnectionArray[i] = NULL; - }//forg - for (i = 0; i < 2048 ; i++) { - theFirstTupleId[i] = 0; - theLastTupleId[i] = 0; - }//for - - BaseString::snprintf(theDataBase, sizeof(theDataBase), "%s", - aDataBase ? aDataBase : ""); - BaseString::snprintf(theDataBaseSchema, sizeof(theDataBaseSchema), "%s", - aSchema ? aSchema : ""); - - int len = BaseString::snprintf(prefixName, sizeof(prefixName), "%s%c%s%c", - theDataBase, table_name_separator, - theDataBaseSchema, table_name_separator); - prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len : - sizeof(prefixName) - 1); - - theImpl->theWaiter.m_mutex = TransporterFacade::instance()->theMutexPtr; - - // Signal that the constructor has finished OK - if (theInitState == NotConstructed) - theInitState = NotInitialised; - - { - NdbGlobalEventBufferHandle *h= - NdbGlobalEventBuffer_init(NDB_MAX_ACTIVE_EVENTS); - if (h == NULL) { - ndbout_c("Failed NdbGlobalEventBuffer_init(%d)",NDB_MAX_ACTIVE_EVENTS); - exit(-1); - } - theGlobalEventBufferHandle = h; - } - - DBUG_VOID_RETURN; -} - - -/***************************************************************************** - * ~Ndb(); - * - * Remark: Disconnect with the database. - *****************************************************************************/ -Ndb::~Ndb() -{ - DBUG_ENTER("Ndb::~Ndb()"); - DBUG_PRINT("enter",("Ndb::~Ndb this=0x%x",this)); - doDisconnect(); - - NdbGlobalEventBuffer_drop(theGlobalEventBufferHandle); - - if (TransporterFacade::instance() != NULL && theNdbBlockNumber > 0){ - TransporterFacade::instance()->close(theNdbBlockNumber, theFirstTransId); - } - -// if (theSchemaConToNdbList != NULL) -// closeSchemaTransaction(theSchemaConToNdbList); - while ( theConIdleList != NULL ) - freeNdbCon(); - while (theOpIdleList != NULL) - freeOperation(); - while (theScanOpIdleList != NULL) - freeScanOperation(); - while (theIndexOpIdleList != NULL) - freeIndexOperation(); - while (theLabelList != NULL) - freeNdbLabel(); - while (theBranchList != NULL) - freeNdbBranch(); - while (theSubroutineList != NULL) - freeNdbSubroutine(); - while (theCallList != NULL) - freeNdbCall(); - while (theScanList != NULL) - freeNdbScanRec(); - while (theNdbBlobIdleList != NULL) - freeNdbBlob(); - while (theRecAttrIdleList != NULL) - freeRecAttr(); - while ( theSignalIdleList != NULL ) - freeSignal(); - - releaseTransactionArrays(); - - delete []theConnectionArray; - if(theCommitAckSignal != NULL){ - delete theCommitAckSignal; - theCommitAckSignal = NULL; - } - - delete theImpl; - - /** - * This sleep is to make sure that the transporter - * send thread will come in and send any - * signal buffers that this thread may have allocated. - * If that doesn't happen an error will occur in OSE - * when trying to restore a signal buffer allocated by a thread - * that have been killed. - */ -#ifdef NDB_OSE - NdbSleep_MilliSleep(50); -#endif - -#ifdef POORMANSPURIFY -#ifdef POORMANSGUI - ndbout << "cnewSignals=" << cnewSignals << endl; - ndbout << "cfreeSignals=" << cfreeSignals << endl; - ndbout << "cgetSignals=" << cgetSignals << endl; - ndbout << "creleaseSignals=" << creleaseSignals << endl; -#endif - // Poor mans purifier - assert(cnewSignals == cfreeSignals); - assert(cgetSignals == creleaseSignals); -#endif - DBUG_VOID_RETURN; -} - -NdbWaiter::NdbWaiter(){ - m_node = 0; - m_state = NO_WAIT; - m_mutex = 0; - m_condition = NdbCondition_Create(); -} - -NdbWaiter::~NdbWaiter(){ - NdbCondition_Destroy(m_condition); -} - -NdbImpl::NdbImpl(Ndb_cluster_connection *ndb_cluster_connection, - Ndb& ndb) - : m_ndb_cluster_connection(ndb_cluster_connection->m_impl), - m_dictionary(ndb), - theCurrentConnectIndex(0), - theNdbObjectIdMap(1024,1024), - theNoOfDBnodes(0) -{ - int i; - for (i = 0; i < MAX_NDB_NODES; i++) { - the_release_ind[i] = 0; - } - m_optimized_node_selection= - m_ndb_cluster_connection.m_optimized_node_selection; -} - -NdbImpl::~NdbImpl() -{ -} - diff --git a/ndb/src/ndbapi/Ndblist.cpp b/ndb/src/ndbapi/Ndblist.cpp deleted file mode 100644 index df90f3378ab..00000000000 --- a/ndb/src/ndbapi/Ndblist.cpp +++ /dev/null @@ -1,824 +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 */ - -#include <NdbOut.hpp> -#include <Ndb.hpp> -#include <NdbOperation.hpp> -#include <NdbIndexOperation.hpp> -#include <NdbIndexScanOperation.hpp> -#include "NdbApiSignal.hpp" -#include <NdbRecAttr.hpp> -#include "NdbUtil.hpp" -#include "API.hpp" -#include "NdbBlob.hpp" - -void -Ndb::checkFailedNode() -{ - DBUG_ENTER("Ndb::checkFailedNode"); - Uint32 *the_release_ind= theImpl->the_release_ind; - if (the_release_ind[0] == 0) - { - DBUG_VOID_RETURN; - } - Uint32 tNoOfDbNodes = theImpl->theNoOfDBnodes; - Uint8 *theDBnodes= theImpl->theDBnodes; - - DBUG_PRINT("enter", ("theNoOfDBnodes: %d", tNoOfDbNodes)); - - DBUG_ASSERT(tNoOfDbNodes < MAX_NDB_NODES); - for (Uint32 i = 0; i < tNoOfDbNodes; i++){ - const NodeId node_id = theDBnodes[i]; - DBUG_PRINT("info", ("i: %d, node_id: %d", i, node_id)); - - DBUG_ASSERT(node_id < MAX_NDB_NODES); - if (the_release_ind[node_id] == 1){ - - /** - * Release all connections in idle list (for node) - */ - NdbTransaction * tNdbCon = theConnectionArray[node_id]; - theConnectionArray[node_id] = NULL; - while (tNdbCon != NULL) { - NdbTransaction* tempNdbCon = tNdbCon; - tNdbCon = tNdbCon->next(); - releaseNdbCon(tempNdbCon); - } - the_release_ind[node_id] = 0; - } - } - DBUG_VOID_RETURN; -} - -/*************************************************************************** - * int createConIdleList(int aNrOfCon); - * - * Return Value: Return the number of created connection object - * if createConIdleList was succesful - * Return -1: In all other case. - * Parameters: aNrOfCon : Number of connections offered to the application. - * Remark: Create connection idlelist with NdbTransaction objects. - ***************************************************************************/ -int -Ndb::createConIdleList(int aNrOfCon) -{ - for (int i = 0; i < aNrOfCon; i++) - { - NdbTransaction* tNdbCon = new NdbTransaction(this); - if (tNdbCon == NULL) - { - return -1; - } - if (theConIdleList == NULL) - { - theConIdleList = tNdbCon; - theConIdleList->next(NULL); - } else - { - tNdbCon->next(theConIdleList); - theConIdleList = tNdbCon; - } - tNdbCon->Status(NdbTransaction::NotConnected); - } - theNoOfAllocatedTransactions = aNrOfCon; - return aNrOfCon; -} - -/*************************************************************************** - * int createOpIdleList(int aNrOfOp); - * - * Return Value: Return the number of created operation object if - * createOpIdleList was succesful. - * Return -1: In all other case. - * Parameters: aNrOfOp: Number of operations offered to the application. - * Remark: Create operation idlelist with NdbOperation objects.. - ***************************************************************************/ -int -Ndb::createOpIdleList(int aNrOfOp) -{ - for (int i = 0; i < aNrOfOp; i++){ - NdbOperation* tOp = new NdbOperation(this); - if ( tOp == NULL ){ - return -1; - } - if (theOpIdleList == NULL){ - theOpIdleList = tOp; - theOpIdleList->next(NULL); - } else{ - tOp->next(theOpIdleList); - theOpIdleList = tOp; - } - } - return aNrOfOp; -} - -/*************************************************************************** - * NdbBranch* NdbBranch(); - * - * Return Value: Return a NdbBranch if the getNdbBranch was successful. - * Return NULL : In all other case. - * Remark: Get a NdbBranch from theBranchList and return the object . - ***************************************************************************/ -NdbBranch* -Ndb::getNdbBranch() -{ - NdbBranch* tNdbBranch; - if ( theBranchList == NULL ) - { - tNdbBranch = new NdbBranch; - if (tNdbBranch == NULL) - { - return NULL; - } - tNdbBranch->theNext = NULL; - } else - { - tNdbBranch = theBranchList; - theBranchList = tNdbBranch->theNext; - tNdbBranch->theNext = NULL; - } - return tNdbBranch; -} - -/*************************************************************************** - * NdbCall* NdbCall(); - * - * Return Value: Return a NdbCall if the getNdbCall was successful. - * Return NULL : In all other case. - * Remark: Get a NdbCall from theCallList and return the object . - ***************************************************************************/ -NdbCall* -Ndb::getNdbCall() -{ - NdbCall* tNdbCall; - if ( theCallList == NULL ) - { - tNdbCall = new NdbCall; - if (tNdbCall == NULL) - { - return NULL; - } - tNdbCall->theNext = NULL; - } else - { - tNdbCall = theCallList; - theCallList = tNdbCall->theNext; - tNdbCall->theNext = NULL; - } - return tNdbCall; -} - -/*************************************************************************** - * NdbTransaction* getNdbCon(); - * - * Return Value: Return a connection if the getNdbCon was successful. - * Return NULL : In all other case. - * Remark: Get a connection from theConIdleList and return the object . - ***************************************************************************/ -NdbTransaction* -Ndb::getNdbCon() -{ - NdbTransaction* tNdbCon; - if ( theConIdleList == NULL ) { - if (theNoOfAllocatedTransactions < theMaxNoOfTransactions) { - tNdbCon = new NdbTransaction(this); - if (tNdbCon == NULL) { - return NULL; - }//if - theNoOfAllocatedTransactions++; - } else { - ndbout << "theNoOfAllocatedTransactions = " << theNoOfAllocatedTransactions << " theMaxNoOfTransactions = " << theMaxNoOfTransactions << endl; - return NULL; - }//if - tNdbCon->next(NULL); - } else - { - tNdbCon = theConIdleList; - theConIdleList = tNdbCon->next(); - tNdbCon->next(NULL); - } - tNdbCon->theMagicNumber = 0x37412619; - return tNdbCon; -} - -/*************************************************************************** - * NdbLabel* getNdbLabel(); - * - * Return Value: Return a NdbLabel if the getNdbLabel was successful. - * Return NULL : In all other case. - * Remark: Get a NdbLabel from theLabelList and return the object . - ***************************************************************************/ -NdbLabel* -Ndb::getNdbLabel() -{ - NdbLabel* tNdbLabel; - if ( theLabelList == NULL ) - { - tNdbLabel = new NdbLabel; - if (tNdbLabel == NULL) - { - return NULL; - } - tNdbLabel->theNext = NULL; - } else - { - tNdbLabel = theLabelList; - theLabelList = tNdbLabel->theNext; - tNdbLabel->theNext = NULL; - } - return tNdbLabel; -} - -/*************************************************************************** - * NdbScanReceiver* getNdbScanRec() - * - * Return Value: Return a NdbScanReceiver - * Return NULL : In all other case. - * Remark: Get a NdbScanReceiver from theScanRecList and return the - * object . - ****************************************************************************/ -NdbReceiver* -Ndb::getNdbScanRec() -{ - NdbReceiver* tNdbScanRec; - if ( theScanList == NULL ) - { - tNdbScanRec = new NdbReceiver(this); - if (tNdbScanRec == NULL) - { - return NULL; - } - tNdbScanRec->next(NULL); - } else - { - tNdbScanRec = theScanList; - theScanList = tNdbScanRec->next(); - tNdbScanRec->next(NULL); - } - - return tNdbScanRec; -} - -/*************************************************************************** - * NdbSubroutine* getNdbSubroutine(); - * - * Return Value: Return a NdbSubroutine if the getNdbSubroutine was successful. - * Return NULL : In all other case. - * Remark: Get a NdbSubroutine from theSubroutineList and return the object . - ***************************************************************************/ -NdbSubroutine* -Ndb::getNdbSubroutine() -{ - NdbSubroutine* tNdbSubroutine; - if ( theSubroutineList == NULL ) - { - tNdbSubroutine = new NdbSubroutine; - if (tNdbSubroutine == NULL) - { - return NULL; - } - tNdbSubroutine->theNext = NULL; - } else - { - tNdbSubroutine = theSubroutineList; - theSubroutineList = tNdbSubroutine->theNext; - tNdbSubroutine->theNext = NULL; - } - return tNdbSubroutine; -} - -/*************************************************************************** -NdbOperation* getOperation(); - -Return Value: Return theOpList : if the getOperation was succesful. - Return NULL : In all other case. -Remark: Get an operation from theOpIdleList and return the object . -***************************************************************************/ -NdbOperation* -Ndb::getOperation() -{ - NdbOperation* tOp = theOpIdleList; - if (tOp != NULL ) { - NdbOperation* tOpNext = tOp->next(); - tOp->next(NULL); - theOpIdleList = tOpNext; - return tOp; - } else { - tOp = new NdbOperation(this); - if (tOp != NULL) - tOp->next(NULL); - } - return tOp; -} - -/*************************************************************************** -NdbScanOperation* getScanOperation(); - -Return Value: Return theOpList : if the getScanOperation was succesful. - Return NULL : In all other case. -Remark: Get an operation from theScanOpIdleList and return the object . -***************************************************************************/ -NdbIndexScanOperation* -Ndb::getScanOperation() -{ - NdbIndexScanOperation* tOp = theScanOpIdleList; - if (tOp != NULL ) { - NdbIndexScanOperation* tOpNext = (NdbIndexScanOperation*)tOp->next(); - tOp->next(NULL); - theScanOpIdleList = tOpNext; - return tOp; - } else { - tOp = new NdbIndexScanOperation(this); - if (tOp != NULL) - tOp->next(NULL); - } - return tOp; -} - -/*************************************************************************** -NdbIndexOperation* getIndexOperation(); - -Return Value: Return theOpList : if the getIndexOperation was succesful. - Return NULL : In all other case. -Remark: Get an operation from theIndexOpIdleList and return the object . -***************************************************************************/ -NdbIndexOperation* -Ndb::getIndexOperation() -{ - NdbIndexOperation* tOp = theIndexOpIdleList; - if (tOp != NULL ) { - NdbIndexOperation* tOpNext = (NdbIndexOperation*) tOp->next(); - tOp->next(NULL); - theIndexOpIdleList = tOpNext; - return tOp; - } else { - tOp = new NdbIndexOperation(this); - if (tOp != NULL) - tOp->next(NULL); - } - return tOp; -} - -/*************************************************************************** -NdbRecAttr* getRecAttr(); - -Return Value: Return a reference to a receive attribute object. - Return NULL if it's not possible to get a receive attribute object. -***************************************************************************/ -NdbRecAttr* -Ndb::getRecAttr() -{ - NdbRecAttr* tRecAttr; - tRecAttr = theRecAttrIdleList; - if (tRecAttr != NULL) { - NdbRecAttr* tRecAttrNext = tRecAttr->next(); - tRecAttr->init(); - theRecAttrIdleList = tRecAttrNext; - return tRecAttr; - } else { - tRecAttr = new NdbRecAttr; - if (tRecAttr == NULL) - return NULL; - tRecAttr->next(NULL); - }//if - tRecAttr->init(); - return tRecAttr; -} - -/*************************************************************************** -NdbApiSignal* getSignal(); - -Return Value: Return a reference to a signal object. - Return NULL if not possible to get a signal object. -***************************************************************************/ -NdbApiSignal* -Ndb::getSignal() -{ - NdbApiSignal* tSignal = theSignalIdleList; - if (tSignal != NULL){ - NdbApiSignal* tSignalNext = tSignal->next(); - tSignal->next(NULL); - theSignalIdleList = tSignalNext; - } else { - tSignal = new NdbApiSignal(theMyRef); -#ifdef POORMANSPURIFY - cnewSignals++; -#endif - if (tSignal != NULL) - tSignal->next(NULL); - } -#ifdef POORMANSPURIFY - cgetSignals++; -#endif - return tSignal; -} - -NdbBlob* -Ndb::getNdbBlob() -{ - NdbBlob* tBlob = theNdbBlobIdleList; - if (tBlob != NULL) { - theNdbBlobIdleList = tBlob->theNext; - tBlob->init(); - } else { - tBlob = new NdbBlob; - } - return tBlob; -} - -/*************************************************************************** -void releaseNdbBranch(NdbBranch* aNdbBranch); - -Parameters: NdbBranch: The NdbBranch object. -Remark: Add a NdbBranch object into the Branch idlelist. -***************************************************************************/ -void -Ndb::releaseNdbBranch(NdbBranch* aNdbBranch) -{ - aNdbBranch->theNext = theBranchList; - theBranchList = aNdbBranch; -} - -/*************************************************************************** -void releaseNdbCall(NdbCall* aNdbCall); - -Parameters: NdbBranch: The NdbBranch object. -Remark: Add a NdbBranch object into the Branch idlelist. -***************************************************************************/ -void -Ndb::releaseNdbCall(NdbCall* aNdbCall) -{ - aNdbCall->theNext = theCallList; - theCallList = aNdbCall; -} - -/*************************************************************************** -void releaseNdbCon(NdbTransaction* aNdbCon); - -Parameters: aNdbCon: The NdbTransaction object. -Remark: Add a Connection object into the signal idlelist. -***************************************************************************/ -void -Ndb::releaseNdbCon(NdbTransaction* aNdbCon) -{ - aNdbCon->next(theConIdleList); - aNdbCon->theMagicNumber = 0xFE11DD; - theConIdleList = aNdbCon; -} - -/*************************************************************************** -void releaseNdbLabel(NdbLabel* aNdbLabel); - -Parameters: NdbLabel: The NdbLabel object. -Remark: Add a NdbLabel object into the Label idlelist. -***************************************************************************/ -void -Ndb::releaseNdbLabel(NdbLabel* aNdbLabel) -{ - aNdbLabel->theNext = theLabelList; - theLabelList = aNdbLabel; -} - -/*************************************************************************** -void releaseNdbScanRec(NdbScanReceiver* aNdbScanRec); - -Parameters: aNdbScanRec: The NdbScanReceiver object. -Remark: Add a NdbScanReceiver object into the Scan idlelist. -***************************************************************************/ -void -Ndb::releaseNdbScanRec(NdbReceiver* aNdbScanRec) -{ - aNdbScanRec->next(theScanList); - theScanList = aNdbScanRec; -} - -/*************************************************************************** -void releaseNdbSubroutine(NdbSubroutine* aNdbSubroutine); - -Parameters: NdbSubroutine: The NdbSubroutine object. -Remark: Add a NdbSubroutine object into theSubroutine idlelist. -***************************************************************************/ -void -Ndb::releaseNdbSubroutine(NdbSubroutine* aNdbSubroutine) -{ - aNdbSubroutine->theNext = theSubroutineList; - theSubroutineList = aNdbSubroutine; -} - -/*************************************************************************** -void releaseOperation(NdbOperation* anOperation); - -Parameters: anOperation : The released NdbOperation object. -Remark: Add a NdbOperation object into the signal idlelist. -***************************************************************************/ -void -Ndb::releaseOperation(NdbOperation* anOperation) -{ - if(anOperation->m_tcReqGSN == GSN_TCKEYREQ){ - anOperation->next(theOpIdleList); - anOperation->theNdbCon = NULL; - anOperation->theMagicNumber = 0xFE11D0; - theOpIdleList = anOperation; - } else { - assert(anOperation->m_tcReqGSN == GSN_TCINDXREQ); - anOperation->next(theIndexOpIdleList); - anOperation->theNdbCon = NULL; - anOperation->theMagicNumber = 0xFE11D1; - theIndexOpIdleList = (NdbIndexOperation*)anOperation; - } -} - -/*************************************************************************** -void releaseScanOperation(NdbScanOperation* aScanOperation); - -Parameters: aScanOperation : The released NdbScanOperation object. -Remark: Add a NdbScanOperation object into the signal idlelist. -***************************************************************************/ -void -Ndb::releaseScanOperation(NdbIndexScanOperation* aScanOperation) -{ - aScanOperation->next(theScanOpIdleList); - aScanOperation->theNdbCon = NULL; - aScanOperation->theMagicNumber = 0xFE11D2; - theScanOpIdleList = aScanOperation; -} - -/*************************************************************************** -void releaseRecAttr(NdbRecAttr* aRecAttr); - -Parameters: aRecAttr : The released NdbRecAttr object. -Remark: Add a NdbRecAttr object into the RecAtt idlelist. -***************************************************************************/ -void -Ndb::releaseRecAttr(NdbRecAttr* aRecAttr) -{ - aRecAttr->release(); - aRecAttr->next(theRecAttrIdleList); - theRecAttrIdleList = aRecAttr; -} - -/*************************************************************************** -void releaseSignal(NdbApiSignal* aSignal); - -Parameters: aSignal : The released NdbApiSignal object. -Remark: Add a NdbApiSignal object into the signal idlelist. -***************************************************************************/ -void -Ndb::releaseSignal(NdbApiSignal* aSignal) -{ -#if defined VM_TRACE - // Check that signal is not null - assert(aSignal != NULL); -#if 0 - // Check that signal is not already in list - NdbApiSignal* tmp = theSignalIdleList; - while (tmp != NULL){ - assert(tmp != aSignal); - tmp = tmp->next(); - } -#endif -#endif -#ifdef POORMANSPURIFY - creleaseSignals++; -#endif - aSignal->next(theSignalIdleList); - theSignalIdleList = aSignal; -} - -void -Ndb::releaseSignalsInList(NdbApiSignal** pList){ - NdbApiSignal* tmp; - while (*pList != NULL){ - tmp = *pList; - *pList = (*pList)->next(); - releaseSignal(tmp); - } -} - -void -Ndb::releaseNdbBlob(NdbBlob* aBlob) -{ - aBlob->release(); - aBlob->theNext = theNdbBlobIdleList; - theNdbBlobIdleList = aBlob; -} - -/*************************************************************************** -void freeOperation(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeOperation() -{ - NdbOperation* tOp = theOpIdleList; - theOpIdleList = theOpIdleList->next(); - delete tOp; -} - -/*************************************************************************** -void freeScanOperation(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeScanOperation() -{ - NdbIndexScanOperation* tOp = theScanOpIdleList; - theScanOpIdleList = (NdbIndexScanOperation *)tOp->next(); - delete tOp; -} - -/*************************************************************************** -void freeIndexOperation(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeIndexOperation() -{ - NdbIndexOperation* tOp = theIndexOpIdleList; - theIndexOpIdleList = (NdbIndexOperation *) theIndexOpIdleList->next(); - delete tOp; -} - -/*************************************************************************** -void freeNdbBranch(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbBranch() -{ - NdbBranch* tNdbBranch = theBranchList; - theBranchList = theBranchList->theNext; - delete tNdbBranch; -} - -/*************************************************************************** -void freeNdbCall(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbCall() -{ - NdbCall* tNdbCall = theCallList; - theCallList = theCallList->theNext; - delete tNdbCall; -} - -/*************************************************************************** -void freeNdbScanRec(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbScanRec() -{ - NdbReceiver* tNdbScanRec = theScanList; - theScanList = theScanList->next(); - delete tNdbScanRec; -} - -/*************************************************************************** -void freeNdbCon(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbCon() -{ - NdbTransaction* tNdbCon = theConIdleList; - theConIdleList = theConIdleList->next(); - delete tNdbCon; -} - -/*************************************************************************** -void freeNdbLabel(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbLabel() -{ - NdbLabel* tNdbLabel = theLabelList; - theLabelList = theLabelList->theNext; - delete tNdbLabel; -} - -/*************************************************************************** -void freeNdbSubroutine(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeNdbSubroutine() -{ - NdbSubroutine* tNdbSubroutine = theSubroutineList; - theSubroutineList = theSubroutineList->theNext; - delete tNdbSubroutine; -} - -/*************************************************************************** -void freeRecAttr(); - -Remark: Always release the first item in the free list -***************************************************************************/ -void -Ndb::freeRecAttr() -{ - NdbRecAttr* tRecAttr = theRecAttrIdleList; - theRecAttrIdleList = theRecAttrIdleList->next(); - delete tRecAttr; -} - -/*************************************************************************** -void freeSignal(); - -Remark: Delete a signal object from the signal idlelist. -***************************************************************************/ -void -Ndb::freeSignal() -{ - NdbApiSignal* tSignal = theSignalIdleList; - theSignalIdleList = tSignal->next(); - delete tSignal; -#ifdef POORMANSPURIFY - cfreeSignals++; -#endif -} - -void -Ndb::freeNdbBlob() -{ - NdbBlob* tBlob = theNdbBlobIdleList; - theNdbBlobIdleList = tBlob->theNext; - delete tBlob; -} - -/**************************************************************************** -int releaseConnectToNdb(NdbTransaction* aConnectConnection); - -Return Value: -1 if error -Parameters: aConnectConnection : Seized schema connection to DBTC -Remark: Release and disconnect from DBTC a connection and seize it to theConIdleList. -*****************************************************************************/ -void -Ndb::releaseConnectToNdb(NdbTransaction* a_con) -{ - DBUG_ENTER("Ndb::releaseConnectToNdb"); - NdbApiSignal tSignal(theMyRef); - int tConPtr; - -// I need to close the connection irrespective of whether I -// manage to reach NDB or not. - - if (a_con == NULL) - DBUG_VOID_RETURN; - - Uint32 node_id = a_con->getConnectedNodeId(); - Uint32 conn_seq = a_con->theNodeSequence; - tSignal.setSignal(GSN_TCRELEASEREQ); - tSignal.setData((tConPtr = a_con->getTC_ConnectPtr()), 1); - tSignal.setData(theMyRef, 2); - tSignal.setData(a_con->ptr2int(), 3); - a_con->Status(NdbTransaction::DisConnecting); - a_con->theMagicNumber = 0x37412619; - int ret_code = sendRecSignal(node_id, - WAIT_TC_RELEASE, - &tSignal, - conn_seq); - if (ret_code == 0) { - ; - } else if (ret_code == -1) { - TRACE_DEBUG("Time-out when TCRELEASE sent"); - } else if (ret_code == -2) { - TRACE_DEBUG("Node failed when TCRELEASE sent"); - } else if (ret_code == -3) { - TRACE_DEBUG("Send failed when TCRELEASE sent"); - } else if (ret_code == -4) { - TRACE_DEBUG("Send buffer full when TCRELEASE sent"); - } else if (ret_code == -5) { - TRACE_DEBUG("Node stopping when TCRELEASE sent"); - } else { - ndbout << "Impossible return from sendRecSignal when TCRELEASE" << endl; - abort(); - }//if - releaseNdbCon(a_con); - DBUG_VOID_RETURN; -} - diff --git a/ndb/src/ndbapi/ObjectMap.hpp b/ndb/src/ndbapi/ObjectMap.hpp deleted file mode 100644 index 21407279f0b..00000000000 --- a/ndb/src/ndbapi/ObjectMap.hpp +++ /dev/null @@ -1,151 +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 NDB_OBJECT_ID_MAP_HPP -#define NDB_OBJECT_ID_MAP_HPP - -#include <ndb_global.h> -//#include <NdbMutex.h> -#include <NdbOut.hpp> - -//#define DEBUG_OBJECTMAP - -/** - * Global ObjectMap - */ -class NdbObjectIdMap //: NdbLockable -{ -public: - STATIC_CONST( InvalidId = ~(Uint32)0 ); - NdbObjectIdMap(Uint32 initalSize = 128, Uint32 expandSize = 10); - ~NdbObjectIdMap(); - - Uint32 map(void * object); - void * unmap(Uint32 id, void *object); - - void * getObject(Uint32 id); -private: - Uint32 m_size; - Uint32 m_expandSize; - Uint32 m_firstFree; - union MapEntry { - Uint32 m_next; - void * m_obj; - } * m_map; - - void expand(Uint32 newSize); -}; - -inline -NdbObjectIdMap::NdbObjectIdMap(Uint32 sz, Uint32 eSz) { - m_size = 0; - m_firstFree = InvalidId; - m_map = 0; - m_expandSize = eSz; - expand(sz); -#ifdef DEBUG_OBJECTMAP - ndbout_c("NdbObjectIdMap:::NdbObjectIdMap(%u)", sz); -#endif -} - -inline -NdbObjectIdMap::~NdbObjectIdMap(){ - free(m_map); -} - -inline -Uint32 -NdbObjectIdMap::map(void * object){ - - // lock(); - - if(m_firstFree == InvalidId){ - expand(m_expandSize); - } - - Uint32 ff = m_firstFree; - m_firstFree = m_map[ff].m_next; - m_map[ff].m_obj = object; - - // unlock(); - -#ifdef DEBUG_OBJECTMAP - ndbout_c("NdbObjectIdMap::map(0x%x) %u", object, ff<<2); -#endif - - return ff<<2; -} - -inline -void * -NdbObjectIdMap::unmap(Uint32 id, void *object){ - - Uint32 i = id>>2; - - // lock(); - if(i < m_size){ - void * obj = m_map[i].m_obj; - if (object == obj) { - m_map[i].m_next = m_firstFree; - m_firstFree = i; - } else { - ndbout_c("Error: NdbObjectIdMap::::unmap(%u, 0x%x) obj=0x%x", id, object, obj); - return 0; - } - - // unlock(); - -#ifdef DEBUG_OBJECTMAP - ndbout_c("NdbObjectIdMap::unmap(%u) obj=0x%x", id, obj); -#endif - - return obj; - } - return 0; -} - -inline void * -NdbObjectIdMap::getObject(Uint32 id){ -#ifdef DEBUG_OBJECTMAP - ndbout_c("NdbObjectIdMap::getObject(%u) obj=0x%x", id, m_map[id>>2].m_obj); -#endif - id >>= 2; - if(id < m_size){ - return m_map[id].m_obj; - } - return 0; -} - -inline void -NdbObjectIdMap::expand(Uint32 incSize){ - Uint32 newSize = m_size + incSize; - MapEntry * tmp = (MapEntry*)malloc(newSize * sizeof(MapEntry)); - - if (m_map) { - memcpy(tmp, m_map, m_size * sizeof(MapEntry)); - free((void*)m_map); - } - m_map = tmp; - - for(Uint32 i = m_size; i<newSize; i++){ - m_map[i].m_next = i + 1; - } - m_firstFree = m_size; - m_map[newSize-1].m_next = InvalidId; - m_size = newSize; -} - -#endif diff --git a/ndb/src/ndbapi/ScanOperation.txt b/ndb/src/ndbapi/ScanOperation.txt deleted file mode 100644 index 27e4e8c1755..00000000000 --- a/ndb/src/ndbapi/ScanOperation.txt +++ /dev/null @@ -1,56 +0,0 @@ -x) NdbConnection (main) -m_theFirstCursorOperation -> y - -y) NdbScanOperation -m_transConnection -> x -theNdbCon -> z - -z) NdbConnection (scan) -theScanningOp -> y -theFirstOpInList -> y (until after openScan) - -# SU - -ScanOpLen: includes KeyInfo -New protocol - -# -- Impl. - -1) Scan uses one NdbReceiver per "parallelism" -2) Each NdbReceiver can handle up to "batch size" rows -3) API send one "pointer" per parallelism (prev. was one per row) -4) API handles each receiver independently. - It can "nextResult"-one, receive one and close-one -5) When a recevier has been "nextResult"-ed, the API can fetch from it again -6) After doing "openScan"-req, no wait is performed - (only possible to block on nextResult(true) or closeScan) - -7) Instead of "ack"-ing each row with length, -* Each row is sent in one lonw signal (unless to short) -* Each NdbReceiver is ack-ed with #rows and sum(#length) -* KeyInfo20 is one signal and included in sum(#length) - -8) The API receive(s) the data into NdbRecAttr-objects - (prev. it copied signals using new/delete) -9) KeyInfo20 is also received into a NdbRecAttr-object -10) - -# -- Close of scan - -1) Each NdbReciver gets a signal when it's complete - (0 rows is ack-ed) -2) The API then "closes" this receiver -3) The API can at any time close then scan for other reason(s) - (example dying) -4) This is signal:ed via a NEXT_SCANREQ (close = 1) -5) TC responds with a SCAN_TABCONF (close = 1) - - -# -- Sorted - -1) The sorted scan is transparent to TC - It's a API only impl. -2) The API makes the following adjustements: -* Scan all fragments simultaniously (max parallelism) -* Never return a row to the API if a NdbReciver is "outstanding" -* Sort Receivers (only top row as they already are sorted within) diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp deleted file mode 100644 index 7f1e68a42d3..00000000000 --- a/ndb/src/ndbapi/TransporterFacade.cpp +++ /dev/null @@ -1,1108 +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 */ - -#include <ndb_global.h> -#include <my_pthread.h> -#include <ndb_limits.h> -#include "TransporterFacade.hpp" -#include "ClusterMgr.hpp" -#include <IPCConfig.hpp> -#include <TransporterCallback.hpp> -#include <TransporterRegistry.hpp> -#include "NdbApiSignal.hpp" -#include <NdbOut.hpp> -#include <NdbEnv.h> -#include <NdbSleep.h> - -#include "API.hpp" -#include <ConfigRetriever.hpp> -#include <mgmapi_config_parameters.h> -#include <mgmapi_configuration.hpp> -#include <NdbConfig.h> -#include <ndb_version.h> -#include <SignalLoggerManager.hpp> -#include <kernel/ndb_limits.h> - -//#define REPORT_TRANSPORTER -//#define API_TRACE; - -static int numberToIndex(int number) -{ - return number - MIN_API_BLOCK_NO; -} - -static int indexToNumber(int index) -{ - return index + MIN_API_BLOCK_NO; -} - -#if defined DEBUG_TRANSPORTER -#define TRP_DEBUG(t) ndbout << __FILE__ << ":" << __LINE__ << ":" << t << endl; -#else -#define TRP_DEBUG(t) -#endif - -TransporterFacade* TransporterFacade::theFacadeInstance = NULL; - -/***************************************************************************** - * Call back functions - *****************************************************************************/ - -void -reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode){ -#ifdef REPORT_TRANSPORTER - ndbout_c("REPORT_TRANSP: reportError (nodeId=%d, errorCode=%d)", - (int)nodeId, (int)errorCode); -#endif - if(errorCode & 0x8000) { - ndbout_c("reportError (%d, %d)\n", (int)nodeId, (int)errorCode); - ((TransporterFacade*)(callbackObj))->doDisconnect(nodeId); - } -} - -/** - * Report average send length in bytes (4096 last sends) - */ -void -reportSendLen(void * callbackObj, NodeId nodeId, Uint32 count, Uint64 bytes){ -#ifdef REPORT_TRANSPORTER - ndbout_c("REPORT_TRANSP: reportSendLen (nodeId=%d, bytes/count=%d)", - (int)nodeId, (Uint32)(bytes/count)); -#endif - (void)nodeId; - (void)count; - (void)bytes; -} - -/** - * Report average receive length in bytes (4096 last receives) - */ -void -reportReceiveLen(void * callbackObj, - NodeId nodeId, Uint32 count, Uint64 bytes){ -#ifdef REPORT_TRANSPORTER - ndbout_c("REPORT_TRANSP: reportReceiveLen (nodeId=%d, bytes/count=%d)", - (int)nodeId, (Uint32)(bytes/count)); -#endif - (void)nodeId; - (void)count; - (void)bytes; -} - -/** - * Report connection established - */ -void -reportConnect(void * callbackObj, NodeId nodeId){ -#ifdef REPORT_TRANSPORTER - ndbout_c("REPORT_TRANSP: API reportConnect (nodeId=%d)", (int)nodeId); -#endif - ((TransporterFacade*)(callbackObj))->reportConnected(nodeId); - // TransporterFacade::instance()->reportConnected(nodeId); -} - -/** - * Report connection broken - */ -void -reportDisconnect(void * callbackObj, NodeId nodeId, Uint32 error){ -#ifdef REPORT_TRANSPORTER - ndbout_c("REPORT_TRANSP: API reportDisconnect (nodeId=%d)", (int)nodeId); -#endif - ((TransporterFacade*)(callbackObj))->reportDisconnected(nodeId); - //TransporterFacade::instance()->reportDisconnected(nodeId); -} - - -/**************************************************************************** - * - *****************************************************************************/ - -/** - * Report connection broken - */ -int checkJobBuffer() { - return 0; -} - -#ifdef API_TRACE -static const char * API_SIGNAL_LOG = "API_SIGNAL_LOG"; -static const char * apiSignalLog = 0; -static SignalLoggerManager signalLogger; -static -inline -bool -setSignalLog(){ - signalLogger.flushSignalLog(); - - const char * tmp = NdbEnv_GetEnv(API_SIGNAL_LOG, (char *)0, 0); - if(tmp != 0 && apiSignalLog != 0 && strcmp(tmp,apiSignalLog) == 0){ - return true; - } else if(tmp == 0 && apiSignalLog == 0){ - return false; - } else if(tmp == 0 && apiSignalLog != 0){ - signalLogger.setOutputStream(0); - apiSignalLog = tmp; - return false; - } else if(tmp !=0){ - if (strcmp(tmp, "-") == 0) - signalLogger.setOutputStream(stdout); - else - signalLogger.setOutputStream(fopen(tmp, "w")); - apiSignalLog = tmp; - return true; - } - return false; -} -#ifdef TRACE_APIREGREQ -#define TRACE_GSN(gsn) true -#else -#define TRACE_GSN(gsn) (gsn != GSN_API_REGREQ && gsn != GSN_API_REGCONF) -#endif -#endif - -/** - * The execute function : Handle received signal - */ -void -execute(void * callbackObj, SignalHeader * const header, - Uint8 prio, Uint32 * const theData, - LinearSectionPtr ptr[3]){ - - TransporterFacade * theFacade = (TransporterFacade*)callbackObj; - TransporterFacade::ThreadData::Object_Execute oe; - Uint32 tRecBlockNo = header->theReceiversBlockNumber; - -#ifdef API_TRACE - if(setSignalLog() && TRACE_GSN(header->theVerId_signalNumber)){ - signalLogger.executeSignal(* header, - prio, - theData, - theFacade->ownId(), - ptr, header->m_noOfSections); - signalLogger.flushSignalLog(); - } -#endif - - if (tRecBlockNo >= MIN_API_BLOCK_NO) { - oe = theFacade->m_threads.get(tRecBlockNo); - if (oe.m_object != 0 && oe.m_executeFunction != 0) { - /** - * Handle received signal immediately to avoid any unnecessary - * copying of data, allocation of memory and other things. Copying - * of data could be interesting to support several priority levels - * and to support a special memory structure when executing the - * signals. Neither of those are interesting when receiving data - * in the NDBAPI. The NDBAPI will thus read signal data directly as - * it was written by the sender (SCI sender is other node, Shared - * memory sender is other process and TCP/IP sender is the OS that - * writes the TCP/IP message into a message buffer). - */ - NdbApiSignal tmpSignal(*header); - NdbApiSignal * tSignal = &tmpSignal; - tSignal->setDataPtr(theData); - (* oe.m_executeFunction) (oe.m_object, tSignal, ptr); - }//if - } else if (tRecBlockNo == API_PACKED) { - /** - * Block number == 2047 is used to signal a signal that consists of - * multiple instances of the same signal. This is an effort to - * package the signals so as to avoid unnecessary communication - * overhead since TCP/IP has a great performance impact. - */ - Uint32 Tlength = header->theLength; - Uint32 Tsent = 0; - /** - * Since it contains at least two data packets we will first - * copy the signal data to safe place. - */ - while (Tsent < Tlength) { - Uint32 Theader = theData[Tsent]; - Tsent++; - Uint32 TpacketLen = (Theader & 0x1F) + 3; - tRecBlockNo = Theader >> 16; - if (TpacketLen <= 25) { - if ((TpacketLen + Tsent) <= Tlength) { - /** - * Set the data length of the signal and the receivers block - * reference and then call the API. - */ - header->theLength = TpacketLen; - header->theReceiversBlockNumber = tRecBlockNo; - Uint32* tDataPtr = &theData[Tsent]; - Tsent += TpacketLen; - if (tRecBlockNo >= MIN_API_BLOCK_NO) { - oe = theFacade->m_threads.get(tRecBlockNo); - if(oe.m_object != 0 && oe.m_executeFunction != 0){ - NdbApiSignal tmpSignal(*header); - NdbApiSignal * tSignal = &tmpSignal; - tSignal->setDataPtr(tDataPtr); - (*oe.m_executeFunction)(oe.m_object, tSignal, 0); - } - } - } - } - } - return; - } else if (tRecBlockNo == API_CLUSTERMGR) { - /** - * The signal was aimed for the Cluster Manager. - * We handle it immediately here. - */ - ClusterMgr * clusterMgr = theFacade->theClusterMgr; - const Uint32 gsn = header->theVerId_signalNumber; - - switch (gsn){ - case GSN_API_REGREQ: - clusterMgr->execAPI_REGREQ(theData); - break; - - case GSN_API_REGCONF: - clusterMgr->execAPI_REGCONF(theData); - break; - - case GSN_API_REGREF: - clusterMgr->execAPI_REGREF(theData); - break; - - case GSN_NODE_FAILREP: - clusterMgr->execNODE_FAILREP(theData); - break; - - case GSN_NF_COMPLETEREP: - clusterMgr->execNF_COMPLETEREP(theData); - break; - - case GSN_ARBIT_STARTREQ: - if (theFacade->theArbitMgr != NULL) - theFacade->theArbitMgr->doStart(theData); - break; - - case GSN_ARBIT_CHOOSEREQ: - if (theFacade->theArbitMgr != NULL) - theFacade->theArbitMgr->doChoose(theData); - break; - - case GSN_ARBIT_STOPORD: - if(theFacade->theArbitMgr != NULL) - theFacade->theArbitMgr->doStop(theData); - break; - - default: - break; - - } - return; - } else { - ; // Ignore all other block numbers. - if(header->theVerId_signalNumber!=3) { - TRP_DEBUG( "TransporterFacade received signal to unknown block no." ); - ndbout << "BLOCK NO: " << tRecBlockNo << " sig " - << header->theVerId_signalNumber << endl; - abort(); - } - } -} - -// These symbols are needed, but not used in the API -void -SignalLoggerManager::printSegmentedSection(FILE *, const SignalHeader &, - const SegmentedSectionPtr ptr[3], - unsigned i){ - abort(); -} - -void -copy(Uint32 * & insertPtr, - class SectionSegmentPool & thePool, const SegmentedSectionPtr & _ptr){ - abort(); -} - -/** - * Note that this function need no locking since its - * only called from the constructor of Ndb (the NdbObject) - * - * Which is protected by a mutex - */ - -int -TransporterFacade::start_instance(int nodeId, - const ndb_mgm_configuration* props) -{ - if (! theFacadeInstance->init(nodeId, props)) { - return -1; - } - - /** - * Install signal handler for SIGPIPE - * - * This due to the fact that a socket connection might have - * been closed in between a select and a corresponding send - */ -#if !defined NDB_OSE && !defined NDB_SOFTOSE && !defined NDB_WIN32 - signal(SIGPIPE, SIG_IGN); -#endif - - return 0; -} - -/** - * Note that this function need no locking since its - * only called from the destructor of Ndb (the NdbObject) - * - * Which is protected by a mutex - */ -void -TransporterFacade::stop_instance(){ - DBUG_ENTER("TransporterFacade::stop_instance"); - if(theFacadeInstance) - theFacadeInstance->doStop(); - DBUG_VOID_RETURN; -} - -void -TransporterFacade::doStop(){ - DBUG_ENTER("TransporterFacade::doStop"); - /** - * First stop the ClusterMgr because it needs to send one more signal - * and also uses theFacadeInstance to lock/unlock theMutexPtr - */ - if (theClusterMgr != NULL) theClusterMgr->doStop(); - if (theArbitMgr != NULL) theArbitMgr->doStop(NULL); - - /** - * Now stop the send and receive threads - */ - void *status; - theStopReceive = 1; - if (theReceiveThread) { - NdbThread_WaitFor(theReceiveThread, &status); - NdbThread_Destroy(&theReceiveThread); - theReceiveThread= 0; - } - if (theSendThread) { - NdbThread_WaitFor(theSendThread, &status); - NdbThread_Destroy(&theSendThread); - theSendThread= 0; - } - DBUG_VOID_RETURN; -} - -extern "C" -void* -runSendRequest_C(void * me) -{ - ((TransporterFacade*) me)->threadMainSend(); - return 0; -} - -void TransporterFacade::threadMainSend(void) -{ - theTransporterRegistry->startSending(); - if (!theTransporterRegistry->start_clients()){ - ndbout_c("Unable to start theTransporterRegistry->start_clients"); - exit(0); - } - - m_socket_server.startServer(); - - while(!theStopReceive) { - NdbSleep_MilliSleep(10); - NdbMutex_Lock(theMutexPtr); - if (sendPerformedLastInterval == 0) { - theTransporterRegistry->performSend(); - } - sendPerformedLastInterval = 0; - NdbMutex_Unlock(theMutexPtr); - } - theTransporterRegistry->stopSending(); - - m_socket_server.stopServer(); - m_socket_server.stopSessions(); - - theTransporterRegistry->stop_clients(); -} - -extern "C" -void* -runReceiveResponse_C(void * me) -{ - ((TransporterFacade*) me)->threadMainReceive(); - return 0; -} - -void TransporterFacade::threadMainReceive(void) -{ - theTransporterRegistry->startReceiving(); - NdbMutex_Lock(theMutexPtr); - theTransporterRegistry->update_connections(); - NdbMutex_Unlock(theMutexPtr); - while(!theStopReceive) { - for(int i = 0; i<10; i++){ - const int res = theTransporterRegistry->pollReceive(10); - if(res > 0){ - NdbMutex_Lock(theMutexPtr); - theTransporterRegistry->performReceive(); - NdbMutex_Unlock(theMutexPtr); - } - } - NdbMutex_Lock(theMutexPtr); - theTransporterRegistry->update_connections(); - NdbMutex_Unlock(theMutexPtr); - }//while - theTransporterRegistry->stopReceiving(); -} - -TransporterFacade::TransporterFacade() : - theTransporterRegistry(0), - theStopReceive(0), - theSendThread(NULL), - theReceiveThread(NULL), - m_fragmented_signal_id(0) -{ - theOwnId = 0; - - theMutexPtr = NdbMutex_Create(); - sendPerformedLastInterval = 0; - - checkCounter = 4; - currentSendLimit = 1; - theClusterMgr = NULL; - theArbitMgr = NULL; - theStartNodeId = 1; - m_scan_batch_size= MAX_SCAN_BATCH_SIZE; - m_batch_byte_size= SCAN_BATCH_SIZE; - m_batch_size= DEF_BATCH_SIZE; - m_max_trans_id = 0; - - theClusterMgr = new ClusterMgr(* this); -} - -bool -TransporterFacade::init(Uint32 nodeId, const ndb_mgm_configuration* props) -{ - theOwnId = nodeId; - theTransporterRegistry = new TransporterRegistry(this); - - const int res = IPCConfig::configureTransporters(nodeId, - * props, - * theTransporterRegistry); - if(res <= 0){ - TRP_DEBUG( "configureTransporters returned 0 or less" ); - return false; - } - - ndb_mgm_configuration_iterator iter(* props, CFG_SECTION_NODE); - iter.first(); - theClusterMgr->init(iter); - - iter.first(); - if(iter.find(CFG_NODE_ID, nodeId)){ - TRP_DEBUG( "Node info missing from config." ); - return false; - } - - Uint32 rank = 0; - if(!iter.get(CFG_NODE_ARBIT_RANK, &rank) && rank>0){ - theArbitMgr = new ArbitMgr(* this); - theArbitMgr->setRank(rank); - Uint32 delay = 0; - iter.get(CFG_NODE_ARBIT_DELAY, &delay); - theArbitMgr->setDelay(delay); - } - Uint32 scan_batch_size= 0; - if (!iter.get(CFG_MAX_SCAN_BATCH_SIZE, &scan_batch_size)) { - m_scan_batch_size= scan_batch_size; - } - Uint32 batch_byte_size= 0; - if (!iter.get(CFG_BATCH_BYTE_SIZE, &batch_byte_size)) { - m_batch_byte_size= batch_byte_size; - } - Uint32 batch_size= 0; - if (!iter.get(CFG_BATCH_SIZE, &batch_size)) { - m_batch_size= batch_size; - } - - if (!theTransporterRegistry->start_service(m_socket_server)){ - ndbout_c("Unable to start theTransporterRegistry->start_service"); - return false; - } - - theReceiveThread = NdbThread_Create(runReceiveResponse_C, - (void**)this, - 32768, - "ndb_receive", - NDB_THREAD_PRIO_LOW); - - theSendThread = NdbThread_Create(runSendRequest_C, - (void**)this, - 32768, - "ndb_send", - NDB_THREAD_PRIO_LOW); - theClusterMgr->startThread(); - -#ifdef API_TRACE - signalLogger.logOn(true, 0, SignalLoggerManager::LogInOut); -#endif - - return true; -} - - -void -TransporterFacade::connected() -{ - DBUG_ENTER("TransporterFacade::connected"); - Uint32 sz = m_threads.m_statusNext.size(); - for (Uint32 i = 0; i < sz ; i ++) { - if (m_threads.getInUse(i)){ - void * obj = m_threads.m_objectExecute[i].m_object; - NodeStatusFunction RegPC = m_threads.m_statusFunction[i]; - (*RegPC) (obj, numberToRef(indexToNumber(i), theOwnId), true, true); - } - } - DBUG_VOID_RETURN; -} - -void -TransporterFacade::ReportNodeDead(NodeId tNodeId) -{ - /** - * When a node fails we must report this to each Ndb object. - * The function that is used for communicating node failures is called. - * This is to ensure that the Ndb objects do not think their connections - * are correct after a failure followed by a restart. - * After the restart the node is up again and the Ndb object - * might not have noticed the failure. - */ - Uint32 sz = m_threads.m_statusNext.size(); - for (Uint32 i = 0; i < sz ; i ++) { - if (m_threads.getInUse(i)){ - void * obj = m_threads.m_objectExecute[i].m_object; - NodeStatusFunction RegPC = m_threads.m_statusFunction[i]; - (*RegPC) (obj, tNodeId, false, false); - } - } -} - -void -TransporterFacade::ReportNodeFailureComplete(NodeId tNodeId) -{ - /** - * When a node fails we must report this to each Ndb object. - * The function that is used for communicating node failures is called. - * This is to ensure that the Ndb objects do not think their connections - * are correct after a failure followed by a restart. - * After the restart the node is up again and the Ndb object - * might not have noticed the failure. - */ - - DBUG_ENTER("TransporterFacade::ReportNodeFailureComplete"); - DBUG_PRINT("enter",("nodeid= %d", tNodeId)); - Uint32 sz = m_threads.m_statusNext.size(); - for (Uint32 i = 0; i < sz ; i ++) { - if (m_threads.getInUse(i)){ - void * obj = m_threads.m_objectExecute[i].m_object; - NodeStatusFunction RegPC = m_threads.m_statusFunction[i]; - (*RegPC) (obj, tNodeId, false, true); - } - } - DBUG_VOID_RETURN; -} - -void -TransporterFacade::ReportNodeAlive(NodeId tNodeId) -{ - /** - * When a node fails we must report this to each Ndb object. - * The function that is used for communicating node failures is called. - * This is to ensure that the Ndb objects do not think there connections - * are correct after a failure - * followed by a restart. - * After the restart the node is up again and the Ndb object - * might not have noticed the failure. - */ - Uint32 sz = m_threads.m_statusNext.size(); - for (Uint32 i = 0; i < sz ; i ++) { - if (m_threads.getInUse(i)){ - void * obj = m_threads.m_objectExecute[i].m_object; - NodeStatusFunction RegPC = m_threads.m_statusFunction[i]; - (*RegPC) (obj, tNodeId, true, false); - } - } -} - -int -TransporterFacade::close(BlockNumber blockNumber, Uint64 trans_id) -{ - NdbMutex_Lock(theMutexPtr); - Uint32 low_bits = (Uint32)trans_id; - m_max_trans_id = m_max_trans_id > low_bits ? m_max_trans_id : low_bits; - close_local(blockNumber); - NdbMutex_Unlock(theMutexPtr); - return 0; -} - -int -TransporterFacade::close_local(BlockNumber blockNumber){ - m_threads.close(blockNumber); - return 0; -} - -int -TransporterFacade::open(void* objRef, - ExecuteFunction fun, - NodeStatusFunction statusFun) -{ - DBUG_ENTER("TransporterFacade::open"); - int r= m_threads.open(objRef, fun, statusFun); - if (r < 0) - DBUG_RETURN(r); -#if 1 - if (theOwnId > 0) { - (*statusFun)(objRef, numberToRef(r, theOwnId), true, true); - } -#endif - DBUG_RETURN(r); -} - -TransporterFacade::~TransporterFacade(){ - - NdbMutex_Lock(theMutexPtr); - delete theClusterMgr; - delete theArbitMgr; - delete theTransporterRegistry; - NdbMutex_Unlock(theMutexPtr); - NdbMutex_Destroy(theMutexPtr); -#ifdef API_TRACE - signalLogger.setOutputStream(0); -#endif -} - -void -TransporterFacade::calculateSendLimit() -{ - Uint32 Ti; - Uint32 TthreadCount = 0; - - Uint32 sz = m_threads.m_statusNext.size(); - for (Ti = 0; Ti < sz; Ti++) { - if (m_threads.m_statusNext[Ti] == (ThreadData::ACTIVE)){ - TthreadCount++; - m_threads.m_statusNext[Ti] = ThreadData::INACTIVE; - } - } - currentSendLimit = TthreadCount; - if (currentSendLimit == 0) { - currentSendLimit = 1; - } - checkCounter = currentSendLimit << 2; -} - - -//------------------------------------------------- -// Force sending but still report the sending to the -// adaptive algorithm. -//------------------------------------------------- -void TransporterFacade::forceSend(Uint32 block_number) { - checkCounter--; - m_threads.m_statusNext[numberToIndex(block_number)] = ThreadData::ACTIVE; - sendPerformedLastInterval = 1; - if (checkCounter < 0) { - calculateSendLimit(); - } - theTransporterRegistry->forceSendCheck(0); -} - -//------------------------------------------------- -// Improving API performance -//------------------------------------------------- -void -TransporterFacade::checkForceSend(Uint32 block_number) { - m_threads.m_statusNext[numberToIndex(block_number)] = ThreadData::ACTIVE; - //------------------------------------------------- - // This code is an adaptive algorithm to discover when - // the API should actually send its buffers. The reason - // is that the performance is highly dependent on the - // size of the writes over the communication network. - // Thus we try to ensure that the send size is as big - // as possible. At the same time we don't want response - // time to increase so therefore we have to keep track of - // how the users are performing adaptively. - //------------------------------------------------- - - if (theTransporterRegistry->forceSendCheck(currentSendLimit) == 1) { - sendPerformedLastInterval = 1; - } - checkCounter--; - if (checkCounter < 0) { - calculateSendLimit(); - } -} - - -/****************************************************************************** - * SEND SIGNAL METHODS - *****************************************************************************/ -int -TransporterFacade::sendSignal(NdbApiSignal * aSignal, NodeId aNode){ - Uint32* tDataPtr = aSignal->getDataPtrSend(); - Uint32 Tlen = aSignal->theLength; - Uint32 TBno = aSignal->theReceiversBlockNumber; - if(getIsNodeSendable(aNode) == true){ -#ifdef API_TRACE - if(setSignalLog() && TRACE_GSN(aSignal->theVerId_signalNumber)){ - Uint32 tmp = aSignal->theSendersBlockRef; - aSignal->theSendersBlockRef = numberToRef(tmp, theOwnId); - LinearSectionPtr ptr[3]; - signalLogger.sendSignal(* aSignal, - 1, - aSignal->getDataPtr(), - aNode, ptr, 0); - signalLogger.flushSignalLog(); - aSignal->theSendersBlockRef = tmp; - } -#endif - if ((Tlen != 0) && (Tlen <= 25) && (TBno != 0)) { - SendStatus ss = theTransporterRegistry->prepareSend(aSignal, - 1, // JBB - tDataPtr, - aNode, - 0); - //if (ss != SEND_OK) ndbout << ss << endl; - return (ss == SEND_OK ? 0 : -1); - } else { - ndbout << "ERR: SigLen = " << Tlen << " BlockRec = " << TBno; - ndbout << " SignalNo = " << aSignal->theVerId_signalNumber << endl; - assert(0); - }//if - } - //const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(aNode); - //const Uint32 startLevel = node.m_state.startLevel; - return -1; // Node Dead -} - -int -TransporterFacade::sendSignalUnCond(NdbApiSignal * aSignal, NodeId aNode){ -#ifdef API_TRACE - if(setSignalLog() && TRACE_GSN(aSignal->theVerId_signalNumber)){ - Uint32 tmp = aSignal->theSendersBlockRef; - aSignal->theSendersBlockRef = numberToRef(tmp, theOwnId); - LinearSectionPtr ptr[3]; - signalLogger.sendSignal(* aSignal, - 0, - aSignal->getDataPtr(), - aNode, ptr, 0); - signalLogger.flushSignalLog(); - aSignal->theSendersBlockRef = tmp; - } -#endif - assert((aSignal->theLength != 0) && - (aSignal->theLength <= 25) && - (aSignal->theReceiversBlockNumber != 0)); - SendStatus ss = theTransporterRegistry->prepareSend(aSignal, - 0, - aSignal->getDataPtr(), - aNode, - 0); - - return (ss == SEND_OK ? 0 : -1); -} - -#define CHUNK_SZ NDB_SECTION_SEGMENT_SZ*64 // related to MAX_MESSAGE_SIZE -int -TransporterFacade::sendFragmentedSignal(NdbApiSignal* aSignal, NodeId aNode, - LinearSectionPtr ptr[3], Uint32 secs) -{ - if(getIsNodeSendable(aNode) != true) - return -1; - -#ifdef API_TRACE - if(setSignalLog() && TRACE_GSN(aSignal->theVerId_signalNumber)){ - Uint32 tmp = aSignal->theSendersBlockRef; - aSignal->theSendersBlockRef = numberToRef(tmp, theOwnId); - signalLogger.sendSignal(* aSignal, - 1, - aSignal->getDataPtrSend(), - aNode, - ptr, secs); - aSignal->theSendersBlockRef = tmp; - } -#endif - - NdbApiSignal tmp_signal(*(SignalHeader*)aSignal); - LinearSectionPtr tmp_ptr[3]; - Uint32 unique_id= m_fragmented_signal_id++; // next unique id - unsigned i; - for (i= 0; i < secs; i++) - tmp_ptr[i]= ptr[i]; - - unsigned start_i= 0; - unsigned chunk_sz= 0; - unsigned fragment_info= 0; - Uint32 *tmp_data= tmp_signal.getDataPtrSend(); - for (i= 0; i < secs;) { - unsigned save_sz= tmp_ptr[i].sz; - tmp_data[i-start_i]= i; - if (chunk_sz + save_sz > CHUNK_SZ) { - // truncate - unsigned send_sz= CHUNK_SZ - chunk_sz; - if (i != start_i) // first piece of a new section has to be a multiple of NDB_SECTION_SEGMENT_SZ - { - send_sz= - NDB_SECTION_SEGMENT_SZ - *(send_sz+NDB_SECTION_SEGMENT_SZ-1) - /NDB_SECTION_SEGMENT_SZ; - if (send_sz > save_sz) - send_sz= save_sz; - } - tmp_ptr[i].sz= send_sz; - - if (fragment_info < 2) // 1 = first fragment, 2 = middle fragments - fragment_info++; - - // send tmp_signal - tmp_data[i-start_i+1]= unique_id; - tmp_signal.setLength(i-start_i+2); - tmp_signal.m_fragmentInfo= fragment_info; - tmp_signal.m_noOfSections= i-start_i+1; - // do prepare send - { - SendStatus ss = theTransporterRegistry->prepareSend - (&tmp_signal, - 1, /*JBB*/ - tmp_data, - aNode, - &tmp_ptr[start_i]); - assert(ss != SEND_MESSAGE_TOO_BIG); - if (ss != SEND_OK) return -1; - } - // setup variables for next signal - start_i= i; - chunk_sz= 0; - tmp_ptr[i].sz= save_sz-send_sz; - tmp_ptr[i].p+= send_sz; - if (tmp_ptr[i].sz == 0) - i++; - } - else - { - chunk_sz+=save_sz; - i++; - } - } - - unsigned a_sz= aSignal->getLength(); - - if (fragment_info > 0) { - // update the original signal to include section info - Uint32 *a_data= aSignal->getDataPtrSend(); - unsigned tmp_sz= i-start_i; - memcpy(a_data+a_sz, - tmp_data, - tmp_sz*sizeof(Uint32)); - a_data[a_sz+tmp_sz]= unique_id; - aSignal->setLength(a_sz+tmp_sz+1); - - // send last fragment - aSignal->m_fragmentInfo= 3; // 3 = last fragment - aSignal->m_noOfSections= i-start_i; - } else { - aSignal->m_noOfSections= secs; - } - - // send aSignal - int ret; - { - SendStatus ss = theTransporterRegistry->prepareSend - (aSignal, - 1/*JBB*/, - aSignal->getDataPtrSend(), - aNode, - &tmp_ptr[start_i]); - assert(ss != SEND_MESSAGE_TOO_BIG); - ret = (ss == SEND_OK ? 0 : -1); - } - aSignal->m_noOfSections = 0; - aSignal->m_fragmentInfo = 0; - aSignal->setLength(a_sz); - return ret; -} - -int -TransporterFacade::sendSignal(NdbApiSignal* aSignal, NodeId aNode, - LinearSectionPtr ptr[3], Uint32 secs){ - aSignal->m_noOfSections = secs; - if(getIsNodeSendable(aNode) == true){ -#ifdef API_TRACE - if(setSignalLog() && TRACE_GSN(aSignal->theVerId_signalNumber)){ - Uint32 tmp = aSignal->theSendersBlockRef; - aSignal->theSendersBlockRef = numberToRef(tmp, theOwnId); - signalLogger.sendSignal(* aSignal, - 1, - aSignal->getDataPtrSend(), - aNode, - ptr, secs); - signalLogger.flushSignalLog(); - aSignal->theSendersBlockRef = tmp; - } -#endif - SendStatus ss = theTransporterRegistry->prepareSend - (aSignal, - 1, // JBB - aSignal->getDataPtrSend(), - aNode, - ptr); - assert(ss != SEND_MESSAGE_TOO_BIG); - aSignal->m_noOfSections = 0; - return (ss == SEND_OK ? 0 : -1); - } - aSignal->m_noOfSections = 0; - return -1; -} - -/****************************************************************************** - * CONNECTION METHODS Etc - ******************************************************************************/ - -void -TransporterFacade::doConnect(int aNodeId){ - theTransporterRegistry->setIOState(aNodeId, NoHalt); - theTransporterRegistry->do_connect(aNodeId); -} - -void -TransporterFacade::doDisconnect(int aNodeId) -{ - theTransporterRegistry->do_disconnect(aNodeId); -} - -void -TransporterFacade::reportConnected(int aNodeId) -{ - theClusterMgr->reportConnected(aNodeId); - return; -} - -void -TransporterFacade::reportDisconnected(int aNodeId) -{ - theClusterMgr->reportDisconnected(aNodeId); - return; -} - -NodeId -TransporterFacade::ownId() const -{ - return theOwnId; -} - -bool -TransporterFacade::isConnected(NodeId aNodeId){ - return theTransporterRegistry->is_connected(aNodeId); -} - -NodeId -TransporterFacade::get_an_alive_node() -{ - DBUG_ENTER("TransporterFacade::get_an_alive_node"); - DBUG_PRINT("enter", ("theStartNodeId: %d", theStartNodeId)); -#ifdef VM_TRACE - const char* p = NdbEnv_GetEnv("NDB_ALIVE_NODE_ID", (char*)0, 0); - if (p != 0 && *p != 0) - return atoi(p); -#endif - NodeId i; - for (i = theStartNodeId; i < MAX_NDB_NODES; i++) { - if (get_node_alive(i)){ - DBUG_PRINT("info", ("Node %d is alive", i)); - theStartNodeId = ((i + 1) % MAX_NDB_NODES); - DBUG_RETURN(i); - } - } - for (i = 1; i < theStartNodeId; i++) { - if (get_node_alive(i)){ - DBUG_PRINT("info", ("Node %d is alive", i)); - theStartNodeId = ((i + 1) % MAX_NDB_NODES); - DBUG_RETURN(i); - } - } - DBUG_RETURN((NodeId)0); -} - -TransporterFacade::ThreadData::ThreadData(Uint32 size){ - m_firstFree = END_OF_LIST; - expand(size); -} - -void -TransporterFacade::ThreadData::expand(Uint32 size){ - Object_Execute oe = { 0 ,0 }; - NodeStatusFunction fun = 0; - - const Uint32 sz = m_statusNext.size(); - m_objectExecute.fill(sz + size, oe); - m_statusFunction.fill(sz + size, fun); - for(Uint32 i = 0; i<size; i++){ - m_statusNext.push_back(sz + i + 1); - } - - m_statusNext.back() = m_firstFree; - m_firstFree = m_statusNext.size() - size; -} - - -int -TransporterFacade::ThreadData::open(void* objRef, - ExecuteFunction fun, - NodeStatusFunction fun2) -{ - Uint32 nextFree = m_firstFree; - - if(m_statusNext.size() >= MAX_NO_THREADS && nextFree == END_OF_LIST){ - return -1; - } - - if(nextFree == END_OF_LIST){ - expand(10); - nextFree = m_firstFree; - } - - m_firstFree = m_statusNext[nextFree]; - - Object_Execute oe = { objRef , fun }; - - m_statusNext[nextFree] = INACTIVE; - m_objectExecute[nextFree] = oe; - m_statusFunction[nextFree] = fun2; - - return indexToNumber(nextFree); -} - -int -TransporterFacade::ThreadData::close(int number){ - number= numberToIndex(number); - assert(getInUse(number)); - m_statusNext[number] = m_firstFree; - m_firstFree = number; - Object_Execute oe = { 0, 0 }; - m_objectExecute[number] = oe; - m_statusFunction[number] = 0; - return 0; -} - -template class Vector<NodeStatusFunction>; -template class Vector<TransporterFacade::ThreadData::Object_Execute>; diff --git a/ndb/src/ndbapi/TransporterFacade.hpp b/ndb/src/ndbapi/TransporterFacade.hpp deleted file mode 100644 index e74f4b51e00..00000000000 --- a/ndb/src/ndbapi/TransporterFacade.hpp +++ /dev/null @@ -1,363 +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 TransporterFacade_H -#define TransporterFacade_H - -#include <kernel_types.h> -#include <ndb_limits.h> -#include <NdbThread.h> -#include <TransporterRegistry.hpp> -#include <NdbMutex.h> -#include "DictCache.hpp" -#include <BlockNumbers.h> -#include <mgmapi.h> - -class ClusterMgr; -class ArbitMgr; -class IPCConfig; -struct ndb_mgm_configuration; -class ConfigRetriever; - -class Ndb; -class NdbApiSignal; - -typedef void (* ExecuteFunction)(void *, NdbApiSignal *, LinearSectionPtr ptr[3]); -typedef void (* NodeStatusFunction)(void *, Uint32, bool nodeAlive, bool nfComplete); - -extern "C" { - void* runSendRequest_C(void*); - void* runReceiveResponse_C(void*); - void atexit_stop_instance(); -} - -class TransporterFacade -{ -public: - TransporterFacade(); - virtual ~TransporterFacade(); - bool init(Uint32, const ndb_mgm_configuration *); - - static TransporterFacade* instance(); - int start_instance(int, const ndb_mgm_configuration*); - static void stop_instance(); - - /** - * Register this block for sending/receiving signals - * @return BlockNumber or -1 for failure - */ - int open(void* objRef, ExecuteFunction, NodeStatusFunction); - - // Close this block number - int close(BlockNumber blockNumber, Uint64 trans_id); - - // Only sends to nodes which are alive - int sendSignal(NdbApiSignal * signal, NodeId nodeId); - int sendSignal(NdbApiSignal*, NodeId, - LinearSectionPtr ptr[3], Uint32 secs); - int sendFragmentedSignal(NdbApiSignal*, NodeId, - LinearSectionPtr ptr[3], Uint32 secs); - - // Is node available for running transactions - bool get_node_alive(NodeId nodeId) const; - bool get_node_stopping(NodeId nodeId) const; - bool getIsDbNode(NodeId nodeId) const; - bool getIsNodeSendable(NodeId nodeId) const; - Uint32 getNodeGrp(NodeId nodeId) const; - Uint32 getNodeSequence(NodeId nodeId) const; - - // Is there space in sendBuffer to send messages - bool check_send_size(Uint32 node_id, Uint32 send_size); - - // My own processor id - NodeId ownId() const; - - void connected(); - - void doConnect(int NodeId); - void reportConnected(int NodeId); - void doDisconnect(int NodeId); - void reportDisconnected(int NodeId); - - NodeId get_an_alive_node(); - void ReportNodeAlive(NodeId nodeId); - void ReportNodeDead(NodeId nodeId); - void ReportNodeFailureComplete(NodeId nodeId); - - void lock_mutex(); - void unlock_mutex(); - - // Improving the API performance - void forceSend(Uint32 block_number); - void checkForceSend(Uint32 block_number); - - // Close this block number - int close_local(BlockNumber blockNumber); - - // Scan batch configuration parameters - Uint32 get_scan_batch_size(); - Uint32 get_batch_byte_size(); - Uint32 get_batch_size(); - - TransporterRegistry* get_registry() { return theTransporterRegistry;}; - -private: - /** - * Send a signal unconditional of node status (used by ClusterMgr) - */ - friend class ClusterMgr; - friend class ArbitMgr; - friend class MgmtSrvr; - friend class SignalSender; - friend class GrepPS; - friend class ExtSender; ///< @todo Hack to be able to sendSignalUnCond - friend class GrepSS; - friend class Ndb; - friend class Ndb_cluster_connection_impl; - - int sendSignalUnCond(NdbApiSignal *, NodeId nodeId); - - bool isConnected(NodeId aNodeId); - void doStop(); - - TransporterRegistry* theTransporterRegistry; - SocketServer m_socket_server; - int sendPerformedLastInterval; - int theOwnId; - - NodeId theStartNodeId; - - ClusterMgr* theClusterMgr; - ArbitMgr* theArbitMgr; - - // Improving the API response time - int checkCounter; - Uint32 currentSendLimit; - - void calculateSendLimit(); - - // Scan batch configuration parameters - Uint32 m_scan_batch_size; - Uint32 m_batch_byte_size; - Uint32 m_batch_size; - - // Declarations for the receive and send thread - int theStopReceive; - - void threadMainSend(void); - NdbThread* theSendThread; - void threadMainReceive(void); - NdbThread* theReceiveThread; - - friend void* runSendRequest_C(void*); - friend void* runReceiveResponse_C(void*); - friend void atexit_stop_instance(); - - /** - * Block number handling - */ -public: - /** - * Max number of Ndb objects. - * (Ndb objects should not be shared by different threads.) - */ - STATIC_CONST( MAX_NO_THREADS = 4711 ); -private: - - struct ThreadData { - STATIC_CONST( ACTIVE = (1 << 16) | 1 ); - STATIC_CONST( INACTIVE = (1 << 16) ); - STATIC_CONST( END_OF_LIST = MAX_NO_THREADS + 1 ); - - ThreadData(Uint32 initialSize = 32); - - /** - * Split "object" into 3 list - * This to improve locality - * when iterating over lists - */ - struct Object_Execute { - void * m_object; - ExecuteFunction m_executeFunction; - }; - struct NodeStatus_NextFree { - NodeStatusFunction m_statusFunction; - }; - - Uint32 m_firstFree; - Vector<Uint32> m_statusNext; - Vector<Object_Execute> m_objectExecute; - Vector<NodeStatusFunction> m_statusFunction; - - int open(void* objRef, ExecuteFunction, NodeStatusFunction); - int close(int number); - void expand(Uint32 size); - - inline Object_Execute get(Uint16 blockNo) const { - blockNo -= MIN_API_BLOCK_NO; - if(blockNo < m_objectExecute.size()){ - return m_objectExecute[blockNo]; - } - Object_Execute oe = { 0, 0 }; - return oe; - } - - /** - * Is the block number used currently - */ - inline bool getInUse(Uint16 index) const { - return (m_statusNext[index] & (1 << 16)) != 0; - } - } m_threads; - - Uint32 m_max_trans_id; - Uint32 m_fragmented_signal_id; - - /** - * execute function - */ - friend void execute(void * callbackObj, SignalHeader * const header, - Uint8 prio, - Uint32 * const theData, LinearSectionPtr ptr[3]); - -public: - NdbMutex* theMutexPtr; -private: - static TransporterFacade* theFacadeInstance; - -public: - GlobalDictCache m_globalDictCache; -}; - -inline -TransporterFacade* -TransporterFacade::instance() -{ - return theFacadeInstance; -} - -inline -void -TransporterFacade::lock_mutex() -{ - NdbMutex_Lock(theMutexPtr); -} - -inline -void -TransporterFacade::unlock_mutex() -{ - NdbMutex_Unlock(theMutexPtr); -} - -#include "ClusterMgr.hpp" - -inline -bool -TransporterFacade::check_send_size(Uint32 node_id, Uint32 send_size) -{ - return true; -} - -inline -bool -TransporterFacade::getIsDbNode(NodeId n) const { - return - theClusterMgr->getNodeInfo(n).defined && - theClusterMgr->getNodeInfo(n).m_info.m_type == NodeInfo::DB; -} - -inline -Uint32 -TransporterFacade::getNodeGrp(NodeId n) const { - return theClusterMgr->getNodeInfo(n).m_state.nodeGroup; -} - - -inline -bool -TransporterFacade::get_node_alive(NodeId n) const { - - const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(n); - return node.m_alive; -} - -inline -bool -TransporterFacade::get_node_stopping(NodeId n) const { - const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(n); - return ((node.m_state.startLevel == NodeState::SL_STOPPING_1) || - (node.m_state.startLevel == NodeState::SL_STOPPING_2)); -} - -inline -bool -TransporterFacade::getIsNodeSendable(NodeId n) const { - const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(n); - const Uint32 startLevel = node.m_state.startLevel; - - if (node.m_info.m_type == NodeInfo::DB) { - if(node.m_state.singleUserMode && - ownId() == node.m_state.singleUserApi) { - return (node.compatible && - (node.m_state.startLevel == NodeState::SL_STOPPING_1 || - node.m_state.startLevel == NodeState::SL_STARTED || - node.m_state.startLevel == NodeState::SL_SINGLEUSER)); - } - else - return node.compatible && (startLevel == NodeState::SL_STARTED || - startLevel == NodeState::SL_STOPPING_1); - } else if (node.m_info.m_type == NodeInfo::REP) { - /** - * @todo Check that REP node actually has received API_REG_REQ - */ - return node.compatible; - } else { - ndbout_c("TransporterFacade::getIsNodeSendable: Illegal node type: " - "%d of node: %d", - node.m_info.m_type, n); - abort(); - return false; // to remove compiler warning - } -} - -inline -Uint32 -TransporterFacade::getNodeSequence(NodeId n) const { - return theClusterMgr->getNodeInfo(n).m_info.m_connectCount; -} - -inline -Uint32 -TransporterFacade::get_scan_batch_size() { - return m_scan_batch_size; -} - -inline -Uint32 -TransporterFacade::get_batch_byte_size() { - return m_batch_byte_size; -} - -inline -Uint32 -TransporterFacade::get_batch_size() { - return m_batch_size; -} - - - -#endif // TransporterFacade_H diff --git a/ndb/src/ndbapi/ndb_cluster_connection.cpp b/ndb/src/ndbapi/ndb_cluster_connection.cpp deleted file mode 100644 index 49aded8e0ac..00000000000 --- a/ndb/src/ndbapi/ndb_cluster_connection.cpp +++ /dev/null @@ -1,550 +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 */ - -#include <ndb_global.h> -#include <my_pthread.h> -#include <my_sys.h> - -#include "ndb_cluster_connection_impl.hpp" -#include <mgmapi_configuration.hpp> -#include <mgmapi_config_parameters.h> -#include <TransporterFacade.hpp> -#include <NdbOut.hpp> -#include <NdbSleep.h> -#include <NdbThread.h> -#include <ndb_limits.h> -#include <ConfigRetriever.hpp> -#include <ndb_version.h> -#include <mgmapi_debug.h> -#include <mgmapi_internal.h> -#include <md5_hash.hpp> - -#include <EventLogger.hpp> -EventLogger g_eventLogger; - -static int g_run_connect_thread= 0; - -#include <NdbMutex.h> -NdbMutex *ndb_global_event_buffer_mutex= NULL; -#ifdef VM_TRACE -NdbMutex *ndb_print_state_mutex= NULL; -#endif - -/* - * Ndb_cluster_connection - */ - -Ndb_cluster_connection::Ndb_cluster_connection(const char *connect_string) - : m_impl(* new Ndb_cluster_connection_impl(connect_string)) -{ -} - -Ndb_cluster_connection::Ndb_cluster_connection -(Ndb_cluster_connection_impl& impl) : m_impl(impl) -{ -} - -Ndb_cluster_connection::~Ndb_cluster_connection() -{ - Ndb_cluster_connection_impl *tmp = &m_impl; - if (this != tmp) - delete tmp; -} - -int Ndb_cluster_connection::get_connected_port() const -{ - if (m_impl.m_config_retriever) - return m_impl.m_config_retriever->get_mgmd_port(); - return -1; -} - -const char *Ndb_cluster_connection::get_connected_host() const -{ - if (m_impl.m_config_retriever) - return m_impl.m_config_retriever->get_mgmd_host(); - return 0; -} - -const char *Ndb_cluster_connection::get_connectstring(char *buf, - int buf_sz) const -{ - if (m_impl.m_config_retriever) - return m_impl.m_config_retriever->get_connectstring(buf,buf_sz); - return 0; -} - -extern "C" pthread_handler_decl(run_ndb_cluster_connection_connect_thread, me) -{ - g_run_connect_thread= 1; - ((Ndb_cluster_connection_impl*) me)->connect_thread(); - return me; -} - -int Ndb_cluster_connection::start_connect_thread(int (*connect_callback)(void)) -{ - int r; - DBUG_ENTER("Ndb_cluster_connection::start_connect_thread"); - m_impl.m_connect_callback= connect_callback; - if ((r = connect(0,0,0)) == 1) - { - DBUG_PRINT("info",("starting thread")); - m_impl.m_connect_thread= - NdbThread_Create(run_ndb_cluster_connection_connect_thread, - (void**)&m_impl, 32768, "ndb_cluster_connection", - NDB_THREAD_PRIO_LOW); - } - else if (r < 0) - { - DBUG_RETURN(-1); - } - else if (m_impl.m_connect_callback) - { - (*m_impl.m_connect_callback)(); - } - DBUG_RETURN(0); -} - -void Ndb_cluster_connection::set_optimized_node_selection(int val) -{ - m_impl.m_optimized_node_selection= val; -} - -void -Ndb_cluster_connection_impl::init_get_next_node -(Ndb_cluster_connection_node_iter &iter) -{ - if (iter.scan_state != (Uint8)~0) - iter.cur_pos= iter.scan_state; - if (iter.cur_pos >= no_db_nodes()) - iter.cur_pos= 0; - iter.init_pos= iter.cur_pos; - iter.scan_state= 0; - // fprintf(stderr,"[init %d]",iter.init_pos); - return; -} - -Uint32 -Ndb_cluster_connection_impl::get_next_node(Ndb_cluster_connection_node_iter &iter) -{ - Uint32 cur_pos= iter.cur_pos; - if (cur_pos >= no_db_nodes()) - return 0; - - Ndb_cluster_connection_impl::Node *nodes= m_impl.m_all_nodes.getBase(); - Ndb_cluster_connection_impl::Node &node= nodes[cur_pos]; - - if (iter.scan_state != (Uint8)~0) - { - assert(iter.scan_state < no_db_nodes()); - if (nodes[iter.scan_state].group == node.group) - iter.scan_state= ~0; - else - return nodes[iter.scan_state++].id; - } - - // fprintf(stderr,"[%d]",node.id); - - cur_pos++; - Uint32 init_pos= iter.init_pos; - if (cur_pos == node.next_group) - { - cur_pos= nodes[init_pos].this_group; - } - - // fprintf(stderr,"[cur_pos %d]",cur_pos); - if (cur_pos != init_pos) - iter.cur_pos= cur_pos; - else - { - iter.cur_pos= node.next_group; - iter.init_pos= node.next_group; - } - return node.id; -} - -unsigned -Ndb_cluster_connection::no_db_nodes() -{ - return m_impl.m_all_nodes.size(); -} - -unsigned -Ndb_cluster_connection::node_id() -{ - return m_impl.m_transporter_facade->ownId(); -} - - -int -Ndb_cluster_connection::wait_until_ready(int timeout, - int timeout_after_first_alive) -{ - DBUG_ENTER("Ndb_cluster_connection::wait_until_ready"); - TransporterFacade *tp = TransporterFacade::instance(); - if (tp == 0) - { - DBUG_RETURN(-1); - } - if (tp->ownId() == 0) - { - DBUG_RETURN(-1); - } - int secondsCounter = 0; - int milliCounter = 0; - int noChecksSinceFirstAliveFound = 0; - do { - unsigned int foundAliveNode = 0; - tp->lock_mutex(); - for(unsigned i= 0; i < no_db_nodes(); i++) - { - //************************************************ - // If any node is answering, ndb is answering - //************************************************ - if (tp->get_node_alive(m_impl.m_all_nodes[i].id) != 0) { - foundAliveNode++; - } - } - tp->unlock_mutex(); - - if (foundAliveNode == no_db_nodes()) - { - DBUG_RETURN(0); - } - else if (foundAliveNode > 0) - { - noChecksSinceFirstAliveFound++; - // 100 ms delay -> 10* - if (noChecksSinceFirstAliveFound > 10*timeout_after_first_alive) - DBUG_RETURN(1); - } - else if (secondsCounter >= timeout) - { // no alive nodes and timed out - DBUG_RETURN(-1); - } - NdbSleep_MilliSleep(100); - milliCounter += 100; - if (milliCounter >= 1000) { - secondsCounter++; - milliCounter = 0; - }//if - } while (1); -} - - - -/* - * Ndb_cluster_connection_impl - */ - -Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char * - connect_string) - : Ndb_cluster_connection(*this), - m_optimized_node_selection(1) -{ - DBUG_ENTER("Ndb_cluster_connection"); - DBUG_PRINT("enter",("Ndb_cluster_connection this=0x%x", this)); - - g_eventLogger.createConsoleHandler(); - g_eventLogger.setCategory("NdbApi"); - g_eventLogger.enable(Logger::LL_ON, Logger::LL_ERROR); - - m_connect_thread= 0; - m_connect_callback= 0; - - if (ndb_global_event_buffer_mutex == NULL) - { - ndb_global_event_buffer_mutex= NdbMutex_Create(); - } -#ifdef VM_TRACE - if (ndb_print_state_mutex == NULL) - { - ndb_print_state_mutex= NdbMutex_Create(); - } -#endif - m_config_retriever= - new ConfigRetriever(connect_string, NDB_VERSION, NODE_TYPE_API); - if (m_config_retriever->hasError()) - { - printf("Could not connect initialize handle to management server: %s", - m_config_retriever->getErrorString()); - delete m_config_retriever; - m_config_retriever= 0; - } - - m_transporter_facade= - TransporterFacade::theFacadeInstance= - new TransporterFacade(); - - DBUG_VOID_RETURN; -} - -Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl() -{ - DBUG_ENTER("~Ndb_cluster_connection"); - DBUG_PRINT("enter",("~Ndb_cluster_connection this=0x%x", this)); - TransporterFacade::stop_instance(); - if (m_connect_thread) - { - void *status; - g_run_connect_thread= 0; - NdbThread_WaitFor(m_connect_thread, &status); - NdbThread_Destroy(&m_connect_thread); - m_connect_thread= 0; - } - if (m_transporter_facade != 0) - { - delete m_transporter_facade; - if (m_transporter_facade != TransporterFacade::theFacadeInstance) - abort(); - TransporterFacade::theFacadeInstance= 0; - } - if (m_config_retriever) - delete m_config_retriever; - - // fragmentToNodeMap.release(); - - DBUG_VOID_RETURN; -} - -void -Ndb_cluster_connection_impl::init_nodes_vector(Uint32 nodeid, - const ndb_mgm_configuration - &config) -{ - DBUG_ENTER("Ndb_cluster_connection_impl::init_nodes_vector"); - ndb_mgm_configuration_iterator iter(config, CFG_SECTION_CONNECTION); - - for(iter.first(); iter.valid(); iter.next()) - { - Uint32 nodeid1, nodeid2, remoteNodeId, group= 5; - const char * remoteHostName= 0, * localHostName= 0; - if(iter.get(CFG_CONNECTION_NODE_1, &nodeid1)) continue; - if(iter.get(CFG_CONNECTION_NODE_2, &nodeid2)) continue; - - if(nodeid1 != nodeid && nodeid2 != nodeid) continue; - remoteNodeId = (nodeid == nodeid1 ? nodeid2 : nodeid1); - - iter.get(CFG_CONNECTION_GROUP, &group); - - { - const char * host1= 0, * host2= 0; - iter.get(CFG_CONNECTION_HOSTNAME_1, &host1); - iter.get(CFG_CONNECTION_HOSTNAME_2, &host2); - localHostName = (nodeid == nodeid1 ? host1 : host2); - remoteHostName = (nodeid == nodeid1 ? host2 : host1); - } - - Uint32 type = ~0; - if(iter.get(CFG_TYPE_OF_SECTION, &type)) continue; - - switch(type){ - case CONNECTION_TYPE_SHM:{ - break; - } - case CONNECTION_TYPE_SCI:{ - break; - } - case CONNECTION_TYPE_TCP:{ - // connecting through localhost - // check if config_hostname is local - if (SocketServer::tryBind(0,remoteHostName)) - group--; // upgrade group value - break; - } - case CONNECTION_TYPE_OSE:{ - break; - } - } - m_impl.m_all_nodes.push_back(Node(group,remoteNodeId)); - DBUG_PRINT("info",("saved %d %d", group,remoteNodeId)); - for (int i= m_impl.m_all_nodes.size()-2; - i >= 0 && m_impl.m_all_nodes[i].group > m_impl.m_all_nodes[i+1].group; - i--) - { - Node tmp= m_impl.m_all_nodes[i]; - m_impl.m_all_nodes[i]= m_impl.m_all_nodes[i+1]; - m_impl.m_all_nodes[i+1]= tmp; - } - } - - int i; - Uint32 cur_group, i_group= 0; - cur_group= ~0; - for (i= (int)m_impl.m_all_nodes.size()-1; i >= 0; i--) - { - if (m_impl.m_all_nodes[i].group != cur_group) - { - cur_group= m_impl.m_all_nodes[i].group; - i_group= i+1; - } - m_impl.m_all_nodes[i].next_group= i_group; - } - cur_group= ~0; - for (i= 0; i < (int)m_impl.m_all_nodes.size(); i++) - { - if (m_impl.m_all_nodes[i].group != cur_group) - { - cur_group= m_impl.m_all_nodes[i].group; - i_group= i; - } - m_impl.m_all_nodes[i].this_group= i_group; - } -#if 0 - for (i= 0; i < (int)m_impl.m_all_nodes.size(); i++) - { - fprintf(stderr, "[%d] %d %d %d %d\n", - i, - m_impl.m_all_nodes[i].id, - m_impl.m_all_nodes[i].group, - m_impl.m_all_nodes[i].this_group, - m_impl.m_all_nodes[i].next_group); - } - - do_test(); -#endif - DBUG_VOID_RETURN; -} - -void -Ndb_cluster_connection_impl::do_test() -{ - Ndb_cluster_connection_node_iter iter; - int n= no_db_nodes()+5; - Uint32 *nodes= new Uint32[n+1]; - - for (int g= 0; g < n; g++) - { - for (int h= 0; h < n; h++) - { - Uint32 id; - Ndb_cluster_connection_node_iter iter2; - { - for (int j= 0; j < g; j++) - { - nodes[j]= get_next_node(iter2); - } - } - - for (int i= 0; i < n; i++) - { - init_get_next_node(iter); - fprintf(stderr, "%d dead:(", g); - id= 0; - while (id == 0) - { - if ((id= get_next_node(iter)) == 0) - break; - for (int j= 0; j < g; j++) - { - if (nodes[j] == id) - { - fprintf(stderr, " %d", id); - id= 0; - break; - } - } - } - fprintf(stderr, ")"); - if (id == 0) - { - break; - } - fprintf(stderr, " %d\n", id); - } - fprintf(stderr, "\n"); - } - } - delete [] nodes; -} - -int Ndb_cluster_connection::connect(int no_retries, int retry_delay_in_seconds, - int verbose) -{ - struct ndb_mgm_reply mgm_reply; - - DBUG_ENTER("Ndb_cluster_connection::connect"); - const char* error = 0; - do { - if (m_impl.m_config_retriever == 0) - DBUG_RETURN(-1); - if (m_impl.m_config_retriever->do_connect(no_retries, - retry_delay_in_seconds, - verbose)) - DBUG_RETURN(1); // mgmt server not up yet - - Uint32 nodeId = m_impl.m_config_retriever->allocNodeId(4/*retries*/, - 3/*delay*/); - if(nodeId == 0) - break; - ndb_mgm_configuration * props = m_impl.m_config_retriever->getConfig(); - if(props == 0) - break; - - m_impl.m_transporter_facade->start_instance(nodeId, props); - m_impl.init_nodes_vector(nodeId, *props); - - for(unsigned i=0; - i<m_impl.m_transporter_facade->get_registry()->m_transporter_interface.size(); - i++) - ndb_mgm_set_connection_int_parameter(m_impl.m_config_retriever->get_mgmHandle(), - nodeId, - m_impl.m_transporter_facade->get_registry() - ->m_transporter_interface[i] - .m_remote_nodeId, - CFG_CONNECTION_SERVER_PORT, - m_impl.m_transporter_facade->get_registry() - ->m_transporter_interface[i] - .m_s_service_port, - &mgm_reply); - - ndb_mgm_destroy_configuration(props); - m_impl.m_transporter_facade->connected(); - DBUG_RETURN(0); - } while(0); - - ndbout << "Configuration error: "; - const char* erString = m_impl.m_config_retriever->getErrorString(); - if (erString == 0) { - erString = "No error specified!"; - } - ndbout << erString << endl; - DBUG_RETURN(-1); -} - -void Ndb_cluster_connection_impl::connect_thread() -{ - DBUG_ENTER("Ndb_cluster_connection_impl::connect_thread"); - int r; - do { - NdbSleep_SecSleep(1); - if ((r = connect(0,0,0)) == 0) - break; - if (r == -1) { - printf("Ndb_cluster_connection::connect_thread error\n"); - DBUG_ASSERT(false); - g_run_connect_thread= 0; - } else { - // Wait before making a new connect attempt - NdbSleep_SecSleep(1); - } - } while (g_run_connect_thread); - if (m_connect_callback) - (*m_connect_callback)(); - DBUG_VOID_RETURN; -} - -template class Vector<Ndb_cluster_connection_impl::Node>; - diff --git a/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp b/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp deleted file mode 100644 index 05652f3316a..00000000000 --- a/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp +++ /dev/null @@ -1,82 +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 CLUSTER_CONNECTION_IMPL_HPP -#define CLUSTER_CONNECTION_IMPL_HPP - -#include <ndb_cluster_connection.hpp> -#include <Vector.hpp> - -class TransporterFacade; -class ConfigRetriever; -class NdbThread; -class ndb_mgm_configuration; - -struct Ndb_cluster_connection_node_iter { - Ndb_cluster_connection_node_iter() : scan_state(~0), - init_pos(0), - cur_pos(0) {}; - Uint8 scan_state; - Uint8 init_pos; - Uint8 cur_pos; -}; - -extern "C" { - void* run_ndb_cluster_connection_connect_thread(void*); -} - -class Ndb_cluster_connection_impl : public Ndb_cluster_connection -{ - Ndb_cluster_connection_impl(const char *connectstring); - ~Ndb_cluster_connection_impl(); - - void do_test(); - - void init_get_next_node(Ndb_cluster_connection_node_iter &iter); - Uint32 get_next_node(Ndb_cluster_connection_node_iter &iter); - -private: - friend class Ndb; - friend class NdbImpl; - friend void* run_ndb_cluster_connection_connect_thread(void*); - friend class Ndb_cluster_connection; - - struct Node - { - Node(Uint32 _g= 0, Uint32 _id= 0) : this_group(0), - next_group(0), - group(_g), - id(_id) {}; - Uint32 this_group; - Uint32 next_group; - Uint32 group; - Uint32 id; - }; - - Vector<Node> m_all_nodes; - void init_nodes_vector(Uint32 nodeid, const ndb_mgm_configuration &config); - void connect_thread(); - - TransporterFacade *m_transporter_facade; - ConfigRetriever *m_config_retriever; - NdbThread *m_connect_thread; - int (*m_connect_callback)(void); - - int m_optimized_node_selection; -}; - -#endif diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c deleted file mode 100644 index b033d81fa33..00000000000 --- a/ndb/src/ndbapi/ndberror.c +++ /dev/null @@ -1,692 +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 */ - - -#include <ndb_global.h> -#include <ndberror.h> -#include <m_string.h> - -typedef struct ErrorBundle { - int code; - ndberror_classification classification; - const char * message; -} ErrorBundle; - -/** - * Shorter names in table below - */ - -#define ST_S ndberror_st_success -#define ST_P ndberror_st_permanent -#define ST_T ndberror_st_temporary -#define ST_U ndberror_st_unknown - -#define NE ndberror_cl_none -#define AE ndberror_cl_application -#define CE ndberror_cl_configuration -#define ND ndberror_cl_no_data_found -#define CV ndberror_cl_constraint_violation -#define SE ndberror_cl_schema_error -#define UD ndberror_cl_user_defined - -#define IS ndberror_cl_insufficient_space -#define TR ndberror_cl_temporary_resource -#define NR ndberror_cl_node_recovery -#define OL ndberror_cl_overload -#define TO ndberror_cl_timeout_expired -#define NS ndberror_cl_node_shutdown - -#define UR ndberror_cl_unknown_result - -#define IE ndberror_cl_internal_error -#define NI ndberror_cl_function_not_implemented -#define UE ndberror_cl_unknown_error_code - -#define OE ndberror_cl_schema_object_already_exists - -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 = ""; - -/* - * Error code ranges are reserved for respective block - * - * 200 - TC - * 300 - DIH - * 400 - LQH - * 600 - ACC - * 700 - DICT - * 800 - TUP - * 900 - TUX - * 1200 - LQH - * 1300 - BACKUP - * 4000 - API - * 4100 - "" - * 4200 - "" - * 4300 - "" - * 4400 - "" - * 4500 - "" - * 4600 - "" - * 4700 - "" Event - * 5000 - Management server - */ - -static -const -ErrorBundle ErrorCodes[] = { - /** - * No error - */ - { 0, NE, "No error" }, - - /** - * NoDataFound - */ - { 626, ND, "Tuple did not exist" }, - - /** - * ConstraintViolation - */ - { 630, CV, "Tuple already existed when attempting to insert" }, - { 840, CV, "Trying to set a NOT NULL attribute to NULL" }, - { 893, CV, "Constraint violation e.g. duplicate value in unique index" }, - - /** - * Node recovery errors - */ - { 286, NR, "Node failure caused abort of transaction" }, - { 250, NR, "Node where lock was held crashed, restart scan transaction" }, - { 499, NR, "Scan take over error, restart scan transaction" }, - { 1204, NR, "Temporary failure, distribution changed" }, - { 4002, NR, "Send to NDB failed" }, - { 4010, NR, "Node failure caused abort of transaction" }, - { 4025, NR, "Node failure caused abort of transaction" }, - { 4027, NR, "Node failure caused abort of transaction" }, - { 4028, NR, "Node failure caused abort of transaction" }, - { 4029, NR, "Node failure caused abort of transaction" }, - { 4031, NR, "Node failure caused abort of transaction" }, - { 4033, NR, "Send to NDB failed" }, - { 4115, NR, - "Transaction was committed but all read information was not " - "received due to node crash" }, - { 4119, NR, "Simple/dirty read failed due to node failure" }, - - /** - * Node shutdown - */ - { 280, NS, "Transaction aborted due to node shutdown" }, - /* This scan trans had an active fragment scan in a LQH which have crashed */ - { 270, NS, "Transaction aborted due to node shutdown" }, - { 1223, NS, "Read operation aborted due to node shutdown" }, - { 4023, NS, "Transaction aborted due to node shutdown" }, - { 4030, NS, "Transaction aborted due to node shutdown" }, - { 4034, NS, "Transaction aborted due to node shutdown" }, - - - - /** - * Unknown result - */ - { 4008, UR, "Receive from NDB failed" }, - { 4009, UR, "Cluster Failure" }, - { 4012, UR, - "Time-out, most likely caused by simple read or cluster failure" }, - { 4024, UR, - "Time-out, most likely caused by simple read or cluster failure" }, - - /** - * TemporaryResourceError - */ - { 217, TR, "217" }, - { 218, TR, "218" }, - { 219, TR, "219" }, - { 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" }, - { 418, TR, "Out of transaction buffers in LQH" }, - { 419, TR, "419" }, - { 245, TR, "Too many active scans" }, - { 488, TR, "Too many active scans" }, - { 490, TR, "Too many active scans" }, - { 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, "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" }, - { 4032, TR, "Out of Send Buffer space in NDB API" }, - - /** - * InsufficientSpace - */ - { 623, IS, "623" }, - { 624, IS, "624" }, - { 625, IS, "Out of memory in Ndb Kernel, index part (increase IndexMemory)" }, - { 640, IS, "Too many hash indexes (should not happen)" }, - { 826, IS, "Too many tables and attributes (increase MaxNoOfAttributes or MaxNoOfTables)" }, - { 827, IS, "Out of memory in Ndb Kernel, data part (increase DataMemory)" }, - { 902, IS, "Out of memory in Ndb Kernel, data part (increase DataMemory)" }, - { 903, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" }, - { 904, IS, "Out of fragment records (increase MaxNoOfOrderedIndexes)" }, - { 905, IS, "Out of attribute records (increase MaxNoOfAttributes)" }, - - /** - * TimeoutExpired - */ - { 266, TO, "Time-out in NDB, probably caused by deadlock" }, - { 274, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout */ - { 296, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout */ - { 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, 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)" }, - - - - /** - * Internal errors - */ - { 892, IE, "Inconsistent hash index. The index needs to be dropped and recreated" }, - { 896, IE, "Tuple corrupted - wrong checksum or column data in invalid format" }, - { 901, IE, "Inconsistent ordered index. The index needs to be dropped and recreated" }, - { 202, IE, "202" }, - { 203, IE, "203" }, - { 207, IE, "207" }, - { 208, IE, "208" }, - { 209, IE, "Communication problem, signal error" }, - { 220, IE, "220" }, - { 230, IE, "230" }, - { 232, IE, "232" }, - { 238, IE, "238" }, - { 271, IE, "Simple Read transaction without any attributes to read" }, - { 272, IE, "Update operation without any attributes to update" }, - { 276, IE, "276" }, - { 277, IE, "277" }, - { 278, IE, "278" }, - { 287, IE, "Index corrupted" }, - { 631, IE, "631" }, - { 632, IE, "632" }, - { 702, IE, "Request to non-master" }, - { 706, IE, "Inconsistency during table creation" }, - { 809, IE, "809" }, - { 812, IE, "812" }, - { 829, IE, "829" }, - { 833, IE, "833" }, - { 839, IE, "Illegal null attribute" }, - { 871, IE, "871" }, - { 882, IE, "882" }, - { 883, IE, "883" }, - { 887, IE, "887" }, - { 888, IE, "888" }, - { 890, IE, "890" }, - { 4000, IE, "MEMORY ALLOCATION ERROR" }, - { 4001, IE, "Signal Definition Error" }, - { 4005, IE, "Internal Error in NdbApi" }, - { 4011, IE, "Internal Error in NdbApi" }, - { 4107, IE, "Simple Transaction and Not Start" }, - { 4108, IE, "Faulty operation type" }, - { 4109, IE, "Faulty primary key attribute length" }, - { 4110, IE, "Faulty length in ATTRINFO signal" }, - { 4111, IE, "Status Error in NdbConnection" }, - { 4113, IE, "Too many operations received" }, - { 4320, IE, "Cannot use the same object twice to create table" }, - { 4321, IE, "Trying to start two schema transactions" }, - { 4344, IE, "Only DBDICT and TRIX can send requests to TRIX" }, - { 4345, IE, "TRIX block is not available yet, probably due to node failure" }, - { 4346, IE, "Internal error at index create/build" }, - { 4347, IE, "Bad state at alter index" }, - { 4348, IE, "Inconsistency detected at alter index" }, - { 4349, IE, "Inconsistency detected at index usage" }, - { 4350, IE, "Transaction already aborted" }, - - /** - * Application error - */ - { 823, AE, "Too much attrinfo from application in tuple manager" }, - { 831, AE, "Too many nullable/bitfields in table definition" }, - { 876, AE, "876" }, - { 877, AE, "877" }, - { 878, AE, "878" }, - { 879, AE, "879" }, - { 880, AE, "Tried to read too much - too many getValue calls" }, - { 884, AE, "Stack overflow in interpreter" }, - { 885, AE, "Stack underflow in interpreter" }, - { 886, AE, "More than 65535 instructions executed in interpreter" }, - { 897, AE, "Update attempt of primary key via ndbcluster internal api (if this occurs via the MySQL server it is a bug, please report)" }, - { 4256, AE, "Must call Ndb::init() before this function" }, - { 4257, AE, "Tried to read too much - too many getValue calls" }, - - /** - * Scan application errors - */ - { 242, AE, "Zero concurrency in scan"}, - { 244, AE, "Too high concurrency in scan"}, - { 269, AE, "No condition and attributes to read in scan"}, - { 4600, AE, "Transaction is already started"}, - { 4601, AE, "Transaction is not started"}, - { 4602, AE, "You must call getNdbOperation before executeScan" }, - { 4603, AE, "There can only be ONE operation in a scan transaction" }, - { 4604, AE, "takeOverScanOp, opType must be UpdateRequest or DeleteRequest" }, - { 4605, AE, "You may only call openScanRead or openScanExclusive once for each operation"}, - { 4607, AE, "There may only be one operation in a scan transaction"}, - { 4608, AE, "You can not takeOverScan unless you have used openScanExclusive"}, - { 4609, AE, "You must call nextScanResult before trying to takeOverScan"}, - { 4232, AE, "Parallelism can only be between 1 and 240" }, - { 290, AE, "Scan not started or has been closed by kernel due to timeout" }, - - /** - * Event schema errors - */ - - { 4713, SE, "Column defined in event does not exist in table"}, - - /** - * Event application errors - */ - - { 4707, AE, "Too many event have been defined"}, - { 4708, AE, "Event name is too long"}, - { 4709, AE, "Can't accept more subscribers"}, - { 746, OE, "Event name already exists"}, - { 4710, AE, "Event not found"}, - { 4711, AE, "Creation of event failed"}, - { 4712, AE, "Stopped event operation does not exist. Already stopped?"}, - - /** - * Event internal errors - */ - - { 4731, IE, "Event not found"}, - - /** - * SchemaError - */ - { 701, SE, "System busy with other schema operation" }, - { 703, SE, "Invalid table format" }, - { 704, SE, "Attribute name too long" }, - { 705, SE, "Table name too long" }, - { 707, SE, "No more table metadata records" }, - { 708, SE, "No more attribute metadata records" }, - { 709, SE, "No such table existed" }, - { 721, OE, "Table or index with given name already exists" }, - { 723, SE, "No such table existed" }, - { 736, SE, "Unsupported array size" }, - { 737, SE, "Attribute array size too big" }, - { 738, SE, "Record too big" }, - { 739, SE, "Unsupported primary key length" }, - { 740, SE, "Nullable primary key not supported" }, - { 741, SE, "Unsupported alter table" }, - { 743, SE, "Unsupported character set in table or index" }, - { 744, SE, "Character string is invalid for given character set" }, - { 745, SE, "Distribution key not supported for char attribute (use binary attribute)" }, - { 241, SE, "Invalid schema object version" }, - { 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 (increase DataMemory) " }, - { 906, SE, "Unsupported attribute type in index" }, - { 907, SE, "Unsupported character set in table or index" }, - { 908, IS, "Invalid ordered index tree node size" }, - { 1225, SE, "Table not defined in local query handler" }, - { 1226, SE, "Table is being dropped" }, - { 1228, SE, "Cannot use drop table for drop index" }, - { 1229, SE, "Too long frm data supplied" }, - - /** - * FunctionNotImplemented - */ - { 4003, NI, "Function not implemented yet" }, - - /** - * Backup error codes - */ - - { 1300, IE, "Undefined error" }, - { 1301, IE, "Backup issued to not master (reissue command to master)" }, - { 1302, IE, "Out of backup record" }, - { 1303, IS, "Out of resources" }, - { 1304, IE, "Sequence failure" }, - { 1305, IE, "Backup definition not implemented" }, - { 1306, AE, "Backup not supported in diskless mode (change Diskless)" }, - - { 1321, IE, "Backup aborted by application" }, - { 1322, IE, "Backup already completed" }, - { 1323, IE, "1323" }, - { 1324, IE, "Backup log buffer full" }, - { 1325, IE, "File or scan error" }, - { 1326, IE, "Backup abortet due to node failure" }, - { 1327, IE, "1327" }, - - { 1340, IE, "Backup undefined error" }, - { 1342, AE, "Backup failed to allocate buffers (check configuration)" }, - { 1343, AE, "Backup failed to setup fs buffers (check configuration)" }, - { 1344, AE, "Backup failed to allocate tables (check configuration)" }, - { 1345, AE, "Backup failed to insert file header (check configuration)" }, - { 1346, AE, "Backup failed to insert table list (check configuration)" }, - { 1347, AE, "Backup failed to allocate table memory (check configuration)" }, - { 1348, AE, "Backup failed to allocate file record (check configuration)" }, - { 1349, AE, "Backup failed to allocate attribute record (check configuration)" }, - - /** - * Still uncategorized - */ - { 720, AE, "Attribute name reused in table definition" }, - { 4004, AE, "Attribute name not found in the Table" }, - - { 4100, AE, "Status Error in NDB" }, - { 4101, AE, "No connections to NDB available and connect failed" }, - { 4102, AE, "Type in NdbTamper not correct" }, - { 4103, AE, "No schema connections to NDB available and connect failed" }, - { 4104, AE, "Ndb Init in wrong state, destroy Ndb object and create a new" }, - { 4105, AE, "Too many Ndb objects" }, - { 4106, AE, "All Not NULL attribute have not been defined" }, - { 4114, AE, "Transaction is already completed" }, - { 4116, AE, "Operation was not defined correctly, probably missing a key" }, - { 4117, AE, "Could not start transporter, configuration error"}, - { 4118, AE, "Parameter error in API call" }, - { 4300, AE, "Tuple Key Type not correct" }, - { 4301, AE, "Fragment Type not correct" }, - { 4302, AE, "Minimum Load Factor not correct" }, - { 4303, AE, "Maximum Load Factor not correct" }, - { 4304, AE, "Maximum Load Factor smaller than Minimum" }, - { 4305, AE, "K value must currently be set to 6" }, - { 4306, AE, "Memory Type not correct" }, - { 4307, AE, "Invalid table name" }, - { 4308, AE, "Attribute Size not correct" }, - { 4309, AE, "Fixed array too large, maximum 64000 bytes" }, - { 4310, AE, "Attribute Type not correct" }, - { 4311, AE, "Storage Mode not correct" }, - { 4312, AE, "Null Attribute Type not correct" }, - { 4313, AE, "Index only storage for non-key attribute" }, - { 4314, AE, "Storage Type of attribute not correct" }, - { 4315, AE, "No more key attributes allowed after defining variable length key attribute" }, - { 4316, AE, "Key attributes are not allowed to be NULL attributes" }, - { 4317, AE, "Too many primary keys defined in table" }, - { 4318, AE, "Invalid attribute name" }, - { 4319, AE, "createAttribute called at erroneus place" }, - { 4322, AE, "Attempt to define distribution key when not prepared to" }, - { 4323, AE, "Distribution Key set on table but not defined on first attribute" }, - { 4324, AE, "Attempt to define distribution group when not prepared to" }, - { 4325, AE, "Distribution Group set on table but not defined on first attribute" }, - { 4326, AE, "Distribution Group with erroneus number of bits" }, - { 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" }, - - { 4400, AE, "Status Error in NdbSchemaCon" }, - { 4401, AE, "Only one schema operation per schema transaction" }, - { 4402, AE, "No schema operation defined before calling execute" }, - - { 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" }, - { 4504, AE, "SetValue not allowed in Read operation" }, - { 4505, AE, "NULL value not allowed in primary key search" }, - { 4506, AE, "Missing getValue/setValue when calling execute" }, - { 4507, AE, "Missing operation request when calling execute" }, - - { 4200, AE, "Status Error when defining an operation" }, - { 4201, AE, "Variable Arrays not yet supported" }, - { 4202, AE, "Set value on tuple key attribute is not allowed" }, - { 4203, AE, "Trying to set a NOT NULL attribute to NULL" }, - { 4204, AE, "Set value and Read/Delete Tuple is incompatible" }, - { 4205, AE, "No Key attribute used to define tuple" }, - { 4206, AE, "Not allowed to equal key attribute twice" }, - { 4207, AE, "Key size is limited to 4092 bytes" }, - { 4208, AE, "Trying to read a non-stored attribute" }, - { 4209, AE, "Length parameter in equal/setValue is incorrect" }, - { 4210, AE, "Ndb sent more info than the length he specified" }, - { 4211, AE, "Inconsistency in list of NdbRecAttr-objects" }, - { 4212, AE, "Ndb reports NULL value on Not NULL attribute" }, - { 4213, AE, "Not all data of an attribute has been received" }, - { 4214, AE, "Not all attributes have been received" }, - { 4215, AE, "More data received than reported in TCKEYCONF message" }, - { 4216, AE, "More than 8052 bytes in setValue cannot be handled" }, - { 4217, AE, "It is not allowed to increment any other than unsigned ints" }, - { 4218, AE, "Currently not allowed to increment NULL-able attributes" }, - { 4219, AE, "Maximum size of interpretative attributes are 64 bits" }, - { 4220, AE, "Maximum size of interpretative attributes are 64 bits" }, - { 4221, AE, "Trying to jump to a non-defined label" }, - { 4222, AE, "Label was not found, internal error" }, - { 4223, AE, "Not allowed to create jumps to yourself" }, - { 4224, AE, "Not allowed to jump to a label in a different subroutine" }, - { 4225, AE, "All primary keys defined, call setValue/getValue"}, - { 4226, AE, "Bad number when defining a label" }, - { 4227, AE, "Bad number when defining a subroutine" }, - { 4228, AE, "Illegal interpreter function in scan definition" }, - { 4229, AE, "Illegal register in interpreter function definition" }, - { 4230, AE, "Illegal state when calling getValue, probably not a read" }, - { 4231, AE, "Illegal state when calling interpreter routine" }, - { 4233, AE, "Calling execute (synchronous) when already prepared asynchronous transaction exists" }, - { 4234, AE, "Illegal to call setValue in this state" }, - { 4235, AE, "No callback from execute" }, - { 4236, AE, "Trigger name too long" }, - { 4237, AE, "Too many triggers" }, - { 4238, AE, "Trigger not found" }, - { 4239, AE, "Trigger with given name already exists"}, - { 4240, AE, "Unsupported trigger type"}, - { 4241, AE, "Index name too long" }, - { 4242, AE, "Too many indexes" }, - { 4243, AE, "Index not found" }, - { 4244, OE, "Index or table with given name already exists" }, - { 4247, AE, "Illegal index/trigger create/drop/alter request" }, - { 4248, AE, "Trigger/index name invalid" }, - { 4249, AE, "Invalid table" }, - { 4250, AE, "Invalid index type or index logging option" }, - { 4251, AE, "Cannot create unique index, duplicate keys found" }, - { 4252, AE, "Failed to allocate space for index" }, - { 4253, AE, "Failed to create index table" }, - { 4254, AE, "Table not an index table" }, - { 4255, AE, "Hash index attributes must be specified in same order as table attributes" }, - { 4258, AE, "Cannot create unique index, duplicate attributes found in definition" }, - { 4259, AE, "Invalid set of range scan bounds" }, - { 4260, UD, "NdbScanFilter: Operator is not defined in NdbScanFilter::Group"}, - { 4261, UD, "NdbScanFilter: Column is NULL"}, - { 4262, UD, "NdbScanFilter: Condition is out of bounds"}, - { 4263, IE, "Invalid blob attributes or invalid blob parts table" }, - { 4264, AE, "Invalid usage of blob attribute" }, - { 4265, AE, "Method is not valid in current blob state" }, - { 4266, AE, "Invalid blob seek position" }, - { 4267, IE, "Corrupted blob value" }, - { 4268, IE, "Error in blob head update forced rollback of transaction" }, - { 4269, IE, "No connection to ndb management server" }, - { 4270, IE, "Unknown blob error" }, - { 4335, AE, "Only one autoincrement column allowed per table. Having a table without primary key uses an autoincremented hidden key, i.e. a table without a primary key can not have an autoincremented column" }, - { 4271, AE, "Invalid index object, not retrieved via getIndex()" } -}; - -static -const -int NbErrorCodes = sizeof(ErrorCodes)/sizeof(ErrorBundle); - -typedef struct ErrorStatusMessage { - ndberror_status status; - const char * message; -} ErrorStatusMessage; - -typedef struct ErrorStatusClassification { - ndberror_status status; - ndberror_classification classification; - const char * message; -} ErrorStatusClassification; - -/** - * Mapping between classification and status - */ -static -const -ErrorStatusMessage StatusMessageMapping[] = { - { ST_S, "Success"}, - { ST_P, "Permanent error"}, - { ST_T, "Temporary error"}, - { ST_U ,"Unknown result"} -}; - -static -const -int NbStatus = sizeof(StatusMessageMapping)/sizeof(ErrorStatusMessage); - -static -const -ErrorStatusClassification StatusClassificationMapping[] = { - { ST_S, NE, "No error"}, - { ST_P, AE, "Application error"}, - { ST_P, CE, "Configuration or application error"}, - { ST_P, ND, "No data found"}, - { ST_P, CV, "Constraint violation"}, - { ST_P, SE, "Schema error"}, - { ST_P, UD, "User defined error"}, - { ST_P, IS, "Insufficient space"}, - - { ST_T, TR, "Temporary Resource error"}, - { ST_T, NR, "Node Recovery error"}, - { ST_T, OL, "Overload error"}, - { ST_T, TO, "Timeout expired"}, - { ST_T, NS, "Node shutdown"}, - - { ST_U , UR, "Unknown result error"}, - { ST_U , UE, "Unknown error code"}, - - { ST_P, IE, "Internal error"}, - { ST_P, NI, "Function not implemented"} -}; - -static -const -int NbClassification = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification); - -#ifdef NOT_USED -/** - * Complete all fields of an NdbError given the error code - * and details - */ -static -void -set(ndberror_struct * error, int code, const char * details, ...){ - error->code = code; - { - va_list ap; - va_start(ap, details); - vsnprintf(error->details, sizeof(error->details), details, ap); - va_end(ap); - } -} -#endif - -void -ndberror_update(ndberror_struct * error){ - - int found = 0; - int i; - - for(i = 0; i<NbErrorCodes; i++){ - if(ErrorCodes[i].code == error->code){ - error->classification = ErrorCodes[i].classification; - error->message = ErrorCodes[i].message; - found = 1; - break; - } - } - - if(!found){ - error->classification = UE; - error->message = "Unknown error code"; - } - - found = 0; - for(i = 0; i<NbClassification; i++){ - if(StatusClassificationMapping[i].classification == error->classification){ - error->status = StatusClassificationMapping[i].status; - found = 1; - break; - } - } - if(!found){ - error->status = ST_U; - } - - error->details = 0; -} - -int -checkErrorCodes(){ - int i, j; - for(i = 0; i<NbErrorCodes; i++) - for(j = i+1; j<NbErrorCodes; j++) - if(ErrorCodes[i].code == ErrorCodes[j].code){ - printf("ErrorCode %d is defined multiple times!!\n", - ErrorCodes[i].code); - assert(0); - } - - return 1; -} - -/*static const int a = checkErrorCodes();*/ - -#if CHECK_ERRORCODES -int main(void){ - checkErrorCodes(); - return 0; -} -#endif - -const char *ndberror_status_message(ndberror_status status) -{ - int i; - for (i= 0; i < NbStatus; i++) - if (StatusMessageMapping[i].status == status) - return StatusMessageMapping[i].message; - return empty_string; -} - -const char *ndberror_classification_message(ndberror_classification classification) -{ - int i; - for (i= 0; i < NbClassification; i++) - if (StatusClassificationMapping[i].classification == classification) - return StatusClassificationMapping[i].message; - return empty_string; -} - -int ndb_error_string(int err_no, char *str, unsigned int size) -{ - ndberror_struct error; - unsigned int len; - - error.code = err_no; - ndberror_update(&error); - - len = - my_snprintf(str, size-1, "%s: %s: %s", error.message, - ndberror_status_message(error.status), - ndberror_classification_message(error.classification)); - str[size-1]= '\0'; - - return len; -} diff --git a/ndb/src/ndbapi/signal-sender/Makefile b/ndb/src/ndbapi/signal-sender/Makefile deleted file mode 100644 index 56e6ce1eac0..00000000000 --- a/ndb/src/ndbapi/signal-sender/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include .defs.mk - -TYPE := ndbapi - -NONPIC_ARCHIVE := Y -ARCHIVE_TARGET := signal-sender - -BIN_TARGET_LIBS := # -lkalle -BIN_TARGET_ARCHIVES := portlib # $(NDB_TOP)/lib/libkalle.a - -# Source files of non-templated classes (.cpp files) -SOURCES = SignalSender.cpp - -CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/src/ndbapi) - -include $(NDB_TOP)/Epilogue.mk - -### -# Backward compatible diff --git a/ndb/src/ndbapi/signal-sender/SignalSender.cpp b/ndb/src/ndbapi/signal-sender/SignalSender.cpp deleted file mode 100644 index 680d0c23b4a..00000000000 --- a/ndb/src/ndbapi/signal-sender/SignalSender.cpp +++ /dev/null @@ -1,237 +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 */ - -#include "SignalSender.hpp" -#include "ConfigRetriever.hpp" -#include <NdbSleep.h> -#include <SignalLoggerManager.hpp> - -SimpleSignal::SimpleSignal(bool dealloc){ - memset(this, 0, sizeof(* this)); - deallocSections = dealloc; -} - -SimpleSignal::~SimpleSignal(){ - if(!deallocSections) - return; - if(ptr[0].p != 0) delete []ptr[0].p; - if(ptr[1].p != 0) delete []ptr[1].p; - if(ptr[2].p != 0) delete []ptr[2].p; -} - -void -SimpleSignal::set(class SignalSender& ss, - Uint8 trace, Uint16 recBlock, Uint16 gsn, Uint32 len){ - - header.theTrace = trace; - header.theReceiversBlockNumber = recBlock; - header.theVerId_signalNumber = gsn; - header.theLength = len; - header.theSendersBlockRef = refToBlock(ss.getOwnRef()); -} - -void -SimpleSignal::print(FILE * out){ - fprintf(out, "---- Signal ----------------\n"); - SignalLoggerManager::printSignalHeader(out, header, 0, 0, false); - SignalLoggerManager::printSignalData(out, header, theData); - for(Uint32 i = 0; i<header.m_noOfSections; i++){ - Uint32 len = ptr[i].sz; - fprintf(out, " --- Section %d size=%d ---\n", i, len); - Uint32 * signalData = ptr[i].p; - while(len >= 7){ - fprintf(out, - " H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x H\'%.8x\n", - signalData[0], signalData[1], signalData[2], signalData[3], - signalData[4], signalData[5], signalData[6]); - len -= 7; - signalData += 7; - } - if(len > 0){ - fprintf(out, " H\'%.8x", signalData[0]); - for(Uint32 i = 1; i<len; i++) - fprintf(out, " H\'%.8x", signalData[i]); - fprintf(out, "\n"); - } - } -} - -SignalSender::SignalSender(const char * connectString){ - m_cond = NdbCondition_Create(); - theFacade = TransporterFacade::start_instance(connectString); - m_blockNo = theFacade->open(this, execSignal, execNodeStatus); - assert(m_blockNo > 0); -} - -SignalSender::~SignalSender(){ - theFacade->close(m_blockNo); - theFacade->stop_instance(); - NdbCondition_Destroy(m_cond); -} - -Uint32 -SignalSender::getOwnRef() const { - return numberToRef(m_blockNo, theFacade->ownId()); -} - -bool -SignalSender::connectOne(Uint32 timeOutMillis){ - NDB_TICKS start = NdbTick_CurrentMillisecond(); - NDB_TICKS now = start; - while(theFacade->theClusterMgr->getNoOfConnectedNodes() == 0 && - (timeOutMillis == 0 || (now - start) < timeOutMillis)){ - NdbSleep_MilliSleep(100); - } - return theFacade->theClusterMgr->getNoOfConnectedNodes() > 0; -} - -bool -SignalSender::connectAll(Uint32 timeOutMillis){ - NDB_TICKS start = NdbTick_CurrentMillisecond(); - NDB_TICKS now = start; - while(theFacade->theClusterMgr->getNoOfConnectedNodes() < 1 && - (timeOutMillis == 0 || (now - start) < timeOutMillis)){ - NdbSleep_MilliSleep(100); - } - return theFacade->theClusterMgr->getNoOfConnectedNodes() >= 1; -} - - -Uint32 -SignalSender::getAliveNode(){ - return theFacade->get_an_alive_node(); -} - -const ClusterMgr::Node & -SignalSender::getNodeInfo(Uint16 nodeId) const { - return theFacade->theClusterMgr->getNodeInfo(nodeId); -} - -Uint32 -SignalSender::getNoOfConnectedNodes() const { - return theFacade->theClusterMgr->getNoOfConnectedNodes(); -} - -SendStatus -SignalSender::sendSignal(Uint16 nodeId, const SimpleSignal * s){ - return theFacade->theTransporterRegistry->prepareSend(&s->header, - 1, // JBB - &s->theData[0], - nodeId, - &s->ptr[0]); -} - -template<class T> -SimpleSignal * -SignalSender::waitFor(Uint32 timeOutMillis, T & t){ - - Guard g(theFacade->theMutexPtr); - - SimpleSignal * s = t.check(m_jobBuffer); - if(s != 0){ - return s; - } - - NDB_TICKS now = NdbTick_CurrentMillisecond(); - NDB_TICKS stop = now + timeOutMillis; - Uint32 wait = (timeOutMillis == 0 ? 10 : timeOutMillis); - do { - NdbCondition_WaitTimeout(m_cond, - theFacade->theMutexPtr, - wait); - - - SimpleSignal * s = t.check(m_jobBuffer); - if(s != 0){ - return s; - } - - now = NdbTick_CurrentMillisecond(); - wait = (timeOutMillis == 0 ? 10 : stop - now); - } while(stop > now || timeOutMillis == 0); - - return 0; -} - -class WaitForAny { -public: - SimpleSignal * check(Vector<SimpleSignal*> & m_jobBuffer){ - if(m_jobBuffer.size() > 0){ - SimpleSignal * s = m_jobBuffer[0]; - m_jobBuffer.erase(0); - return s; - } - return 0; - } -}; - -SimpleSignal * -SignalSender::waitFor(Uint32 timeOutMillis){ - - WaitForAny w; - return waitFor(timeOutMillis, w); -} - -class WaitForNode { -public: - Uint32 m_nodeId; - SimpleSignal * check(Vector<SimpleSignal*> & m_jobBuffer){ - Uint32 len = m_jobBuffer.size(); - for(Uint32 i = 0; i<len; i++){ - if(refToNode(m_jobBuffer[i]->header.theSendersBlockRef) == m_nodeId){ - SimpleSignal * s = m_jobBuffer[i]; - m_jobBuffer.erase(i); - return s; - } - } - return 0; - } -}; - -SimpleSignal * -SignalSender::waitFor(Uint16 nodeId, Uint32 timeOutMillis){ - - WaitForNode w; - w.m_nodeId = nodeId; - return waitFor(timeOutMillis, w); -} - -#include <NdbApiSignal.hpp> - -void -SignalSender::execSignal(void* signalSender, - NdbApiSignal* signal, - class LinearSectionPtr ptr[3]){ - SimpleSignal * s = new SimpleSignal(true); - s->header = * signal; - memcpy(&s->theData[0], signal->getDataPtr(), 4 * s->header.theLength); - for(Uint32 i = 0; i<s->header.m_noOfSections; i++){ - s->ptr[i].p = new Uint32[ptr[i].sz]; - s->ptr[i].sz = ptr[i].sz; - memcpy(s->ptr[i].p, ptr[i].p, 4 * ptr[i].sz); - } - SignalSender * ss = (SignalSender*)signalSender; - ss->m_jobBuffer.push_back(s); - NdbCondition_Signal(ss->m_cond); -} - -void -SignalSender::execNodeStatus(void* signalSender, - Uint16 NodeId, - bool alive, - bool nfCompleted){ -} - diff --git a/ndb/src/ndbapi/signal-sender/SignalSender.hpp b/ndb/src/ndbapi/signal-sender/SignalSender.hpp deleted file mode 100644 index e4e6c1931d2..00000000000 --- a/ndb/src/ndbapi/signal-sender/SignalSender.hpp +++ /dev/null @@ -1,82 +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 SIGNAL_SENDER_HPP -#define SIGNAL_SENDER_HPP - -#include <ndb_global.h> -#include <TransporterDefinitions.hpp> -#include <TransporterFacade.hpp> -#include <ClusterMgr.hpp> -#include <Vector.hpp> - -struct SimpleSignal { -public: - SimpleSignal(bool dealloc = false); - ~SimpleSignal(); - - void set(class SignalSender&, - Uint8 trace, Uint16 recBlock, Uint16 gsn, Uint32 len); - - struct SignalHeader header; - Uint32 theData[25]; - LinearSectionPtr ptr[3]; - - void print(FILE * out = stdout); -private: - bool deallocSections; -}; - -class SignalSender { -public: - SignalSender(const char * connectString = 0); - virtual ~SignalSender(); - - bool connectOne(Uint32 timeOutMillis = 0); - bool connectAll(Uint32 timeOutMillis = 0); - bool connect(Uint32 timeOutMillis = 0) { return connectAll(timeOutMillis);} - - Uint32 getOwnRef() const; - - Uint32 getAliveNode(); - Uint32 getNoOfConnectedNodes() const; - const ClusterMgr::Node & getNodeInfo(Uint16 nodeId) const; - - SendStatus sendSignal(Uint16 nodeId, const SimpleSignal *); - - SimpleSignal * waitFor(Uint32 timeOutMillis = 0); - SimpleSignal * waitFor(Uint16 nodeId, Uint32 timeOutMillis = 0); - SimpleSignal * waitFor(Uint16 nodeId, Uint16 gsn, Uint32 timeOutMillis = 0); - -private: - int m_blockNo; - TransporterFacade * theFacade; - - static void execSignal(void* signalSender, - NdbApiSignal* signal, - class LinearSectionPtr ptr[3]); - - static void execNodeStatus(void* signalSender, NodeId, - bool alive, bool nfCompleted); - - struct NdbCondition * m_cond; - Vector<SimpleSignal *> m_jobBuffer; - - template<class T> - SimpleSignal * waitFor(Uint32 timeOutMillis, T & t); -}; - -#endif |