heroku-tokyotyrant 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +504 -0
- data/README.rdoc +231 -0
- data/Rakefile +72 -0
- data/benchmarks/balancer.rb +101 -0
- data/benchmarks/bulk_db.rb +74 -0
- data/benchmarks/bulk_table.rb +87 -0
- data/benchmarks/db.rb +114 -0
- data/benchmarks/table.rb +161 -0
- data/ext/extconf.rb +43 -0
- data/ext/tokyo/bin/tcamgr +0 -0
- data/ext/tokyo/bin/tcamttest +0 -0
- data/ext/tokyo/bin/tcatest +0 -0
- data/ext/tokyo/bin/tcbmgr +0 -0
- data/ext/tokyo/bin/tcbmttest +0 -0
- data/ext/tokyo/bin/tcbtest +0 -0
- data/ext/tokyo/bin/tcfmgr +0 -0
- data/ext/tokyo/bin/tcfmttest +0 -0
- data/ext/tokyo/bin/tcftest +0 -0
- data/ext/tokyo/bin/tchmgr +0 -0
- data/ext/tokyo/bin/tchmttest +0 -0
- data/ext/tokyo/bin/tchtest +0 -0
- data/ext/tokyo/bin/tcrmgr +0 -0
- data/ext/tokyo/bin/tcrmttest +0 -0
- data/ext/tokyo/bin/tcrtest +0 -0
- data/ext/tokyo/bin/tctmgr +0 -0
- data/ext/tokyo/bin/tctmttest +0 -0
- data/ext/tokyo/bin/tcttest +0 -0
- data/ext/tokyo/bin/tcucodec +0 -0
- data/ext/tokyo/bin/tcumttest +0 -0
- data/ext/tokyo/bin/tcutest +0 -0
- data/ext/tokyo/bin/ttserver +0 -0
- data/ext/tokyo/bin/ttulmgr +0 -0
- data/ext/tokyo/bin/ttultest +0 -0
- data/ext/tokyo/include/tcadb.h +548 -0
- data/ext/tokyo/include/tcbdb.h +1101 -0
- data/ext/tokyo/include/tcfdb.h +858 -0
- data/ext/tokyo/include/tchdb.h +871 -0
- data/ext/tokyo/include/tcrdb.h +801 -0
- data/ext/tokyo/include/tctdb.h +1086 -0
- data/ext/tokyo/include/tculog.h +392 -0
- data/ext/tokyo/include/tcutil.h +4184 -0
- data/ext/tokyo/include/ttutil.h +494 -0
- data/ext/tokyo/lib/libtokyocabinet.9.4.0.dylib +0 -0
- data/ext/tokyo/lib/libtokyocabinet.9.dylib +0 -0
- data/ext/tokyo/lib/libtokyocabinet.a +0 -0
- data/ext/tokyo/lib/libtokyocabinet.dylib +0 -0
- data/ext/tokyo/lib/libtokyotyrant.3.22.0.dylib +0 -0
- data/ext/tokyo/lib/libtokyotyrant.3.dylib +0 -0
- data/ext/tokyo/lib/libtokyotyrant.a +0 -0
- data/ext/tokyo/lib/libtokyotyrant.dylib +0 -0
- data/ext/tokyo/lib/pkgconfig/tokyocabinet.pc +14 -0
- data/ext/tokyo/lib/pkgconfig/tokyotyrant.pc +14 -0
- data/ext/tokyo/lib/ttskeldir.bundle +0 -0
- data/ext/tokyo/lib/ttskelmock.bundle +0 -0
- data/ext/tokyo/lib/ttskelnull.bundle +0 -0
- data/ext/tokyo/lib/ttskelproxy.bundle +0 -0
- data/ext/tokyo/libexec/tcawmgr.cgi +0 -0
- data/ext/tokyo/sbin/ttservctl +163 -0
- data/ext/tokyo/share/man/man1/tcamgr.1 +97 -0
- data/ext/tokyo/share/man/man1/tcamttest.1 +35 -0
- data/ext/tokyo/share/man/man1/tcatest.1 +55 -0
- data/ext/tokyo/share/man/man1/tcbmgr.1 +125 -0
- data/ext/tokyo/share/man/man1/tcbmttest.1 +81 -0
- data/ext/tokyo/share/man/man1/tcbtest.1 +107 -0
- data/ext/tokyo/share/man/man1/tcfmgr.1 +98 -0
- data/ext/tokyo/share/man/man1/tcfmttest.1 +62 -0
- data/ext/tokyo/share/man/man1/tcftest.1 +73 -0
- data/ext/tokyo/share/man/man1/tchmgr.1 +110 -0
- data/ext/tokyo/share/man/man1/tchmttest.1 +85 -0
- data/ext/tokyo/share/man/man1/tchtest.1 +95 -0
- data/ext/tokyo/share/man/man1/tcrmgr.1 +164 -0
- data/ext/tokyo/share/man/man1/tcrmttest.1 +55 -0
- data/ext/tokyo/share/man/man1/tcrtest.1 +89 -0
- data/ext/tokyo/share/man/man1/tctmgr.1 +140 -0
- data/ext/tokyo/share/man/man1/tctmttest.1 +92 -0
- data/ext/tokyo/share/man/man1/tcttest.1 +105 -0
- data/ext/tokyo/share/man/man1/tcucodec.1 +162 -0
- data/ext/tokyo/share/man/man1/tcumttest.1 +41 -0
- data/ext/tokyo/share/man/man1/tcutest.1 +81 -0
- data/ext/tokyo/share/man/man1/ttserver.1 +84 -0
- data/ext/tokyo/share/man/man1/ttulmgr.1 +40 -0
- data/ext/tokyo/share/man/man1/ttultest.1 +16 -0
- data/ext/tokyo/share/man/man3/tcadb.3 +676 -0
- data/ext/tokyo/share/man/man3/tcbdb.3 +1355 -0
- data/ext/tokyo/share/man/man3/tcfdb.3 +975 -0
- data/ext/tokyo/share/man/man3/tchdb.3 +898 -0
- data/ext/tokyo/share/man/man3/tclist.3 +1 -0
- data/ext/tokyo/share/man/man3/tcmap.3 +1 -0
- data/ext/tokyo/share/man/man3/tcmdb.3 +1 -0
- data/ext/tokyo/share/man/man3/tcmpool.3 +1 -0
- data/ext/tokyo/share/man/man3/tcrdb.3 +1309 -0
- data/ext/tokyo/share/man/man3/tctdb.3 +1110 -0
- data/ext/tokyo/share/man/man3/tctree.3 +1 -0
- data/ext/tokyo/share/man/man3/tculog.3 +15 -0
- data/ext/tokyo/share/man/man3/tcutil.3 +4518 -0
- data/ext/tokyo/share/man/man3/tcxstr.3 +1 -0
- data/ext/tokyo/share/man/man3/tokyocabinet.3 +132 -0
- data/ext/tokyo/share/man/man3/ttutil.3 +14 -0
- data/ext/tokyo/share/man/man8/ttservctl.8 +37 -0
- data/ext/tokyo/share/tokyocabinet/COPYING +504 -0
- data/ext/tokyo/share/tokyocabinet/ChangeLog +1252 -0
- data/ext/tokyo/share/tokyocabinet/THANKS +12 -0
- data/ext/tokyo/share/tokyocabinet/doc/benchmark.pdf +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/common.css +211 -0
- data/ext/tokyo/share/tokyocabinet/doc/icon16.png +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/index.html +156 -0
- data/ext/tokyo/share/tokyocabinet/doc/index.ja.html +197 -0
- data/ext/tokyo/share/tokyocabinet/doc/logo-ja.png +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/logo.png +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/spex-en.html +7145 -0
- data/ext/tokyo/share/tokyocabinet/doc/spex-ja.html +7476 -0
- data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.pdf +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.ppt +0 -0
- data/ext/tokyo/share/tokyotyrant/COPYING +504 -0
- data/ext/tokyo/share/tokyotyrant/ChangeLog +578 -0
- data/ext/tokyo/share/tokyotyrant/THANKS +15 -0
- data/ext/tokyo/share/tokyotyrant/doc/common.css +211 -0
- data/ext/tokyo/share/tokyotyrant/doc/index.html +79 -0
- data/ext/tokyo/share/tokyotyrant/doc/spex.html +2264 -0
- data/ext/tokyo/share/tokyotyrant/ext/mapreduce.lua +57 -0
- data/ext/tokyo/share/tokyotyrant/ext/queue.lua +55 -0
- data/ext/tokyo/share/tokyotyrant/ext/senatus.lua +532 -0
- data/ext/tokyo/share/tokyotyrant/ext/usherette.lua +438 -0
- data/ext/tokyo_tyrant.c +147 -0
- data/ext/tokyo_tyrant.h +48 -0
- data/ext/tokyo_tyrant_db.c +227 -0
- data/ext/tokyo_tyrant_db.h +8 -0
- data/ext/tokyo_tyrant_module.c +453 -0
- data/ext/tokyo_tyrant_module.h +10 -0
- data/ext/tokyo_tyrant_query.c +226 -0
- data/ext/tokyo_tyrant_query.h +9 -0
- data/ext/tokyo_tyrant_table.c +319 -0
- data/ext/tokyo_tyrant_table.h +8 -0
- data/ext/tokyocabinet-1.4.41/COPYING +504 -0
- data/ext/tokyocabinet-1.4.41/ChangeLog +1252 -0
- data/ext/tokyocabinet-1.4.41/Makefile.in +825 -0
- data/ext/tokyocabinet-1.4.41/README +38 -0
- data/ext/tokyocabinet-1.4.41/THANKS +12 -0
- data/ext/tokyocabinet-1.4.41/bros/Makefile +133 -0
- data/ext/tokyocabinet-1.4.41/bros/bdbtest.c +438 -0
- data/ext/tokyocabinet-1.4.41/bros/cdbtest.c +219 -0
- data/ext/tokyocabinet-1.4.41/bros/cmpsqltctest.c +186 -0
- data/ext/tokyocabinet-1.4.41/bros/gdbmtest.c +216 -0
- data/ext/tokyocabinet-1.4.41/bros/mapreporter +72 -0
- data/ext/tokyocabinet-1.4.41/bros/maptest.cc +677 -0
- data/ext/tokyocabinet-1.4.41/bros/ndbmtest.c +204 -0
- data/ext/tokyocabinet-1.4.41/bros/qdbmtest.c +375 -0
- data/ext/tokyocabinet-1.4.41/bros/reporter +141 -0
- data/ext/tokyocabinet-1.4.41/bros/result.xls +0 -0
- data/ext/tokyocabinet-1.4.41/bros/sdbmtest.c +204 -0
- data/ext/tokyocabinet-1.4.41/bros/sqltest.c +404 -0
- data/ext/tokyocabinet-1.4.41/bros/tctest.c +748 -0
- data/ext/tokyocabinet-1.4.41/bros/tdbtest.c +205 -0
- data/ext/tokyocabinet-1.4.41/configure +7402 -0
- data/ext/tokyocabinet-1.4.41/configure.in +362 -0
- data/ext/tokyocabinet-1.4.41/doc/benchmark.pdf +0 -0
- data/ext/tokyocabinet-1.4.41/doc/common.css +211 -0
- data/ext/tokyocabinet-1.4.41/doc/icon16.png +0 -0
- data/ext/tokyocabinet-1.4.41/doc/index.html +156 -0
- data/ext/tokyocabinet-1.4.41/doc/index.ja.html +197 -0
- data/ext/tokyocabinet-1.4.41/doc/logo-ja.png +0 -0
- data/ext/tokyocabinet-1.4.41/doc/logo.png +0 -0
- data/ext/tokyocabinet-1.4.41/doc/spex-en.html +7145 -0
- data/ext/tokyocabinet-1.4.41/doc/spex-ja.html +7476 -0
- data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.pdf +0 -0
- data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.ppt +0 -0
- data/ext/tokyocabinet-1.4.41/example/Makefile +113 -0
- data/ext/tokyocabinet-1.4.41/example/tcadbex.c +55 -0
- data/ext/tokyocabinet-1.4.41/example/tcbdbex.c +64 -0
- data/ext/tokyocabinet-1.4.41/example/tcfdbex.c +60 -0
- data/ext/tokyocabinet-1.4.41/example/tchdbex.c +60 -0
- data/ext/tokyocabinet-1.4.41/example/tctchat.c +97 -0
- data/ext/tokyocabinet-1.4.41/example/tctchat.tmpl +141 -0
- data/ext/tokyocabinet-1.4.41/example/tctdbex.c +85 -0
- data/ext/tokyocabinet-1.4.41/example/tctsearch.c +95 -0
- data/ext/tokyocabinet-1.4.41/example/tctsearch.tmpl +122 -0
- data/ext/tokyocabinet-1.4.41/example/tcutilex.c +77 -0
- data/ext/tokyocabinet-1.4.41/f.tsv +2 -0
- data/ext/tokyocabinet-1.4.41/lab/calccomp +118 -0
- data/ext/tokyocabinet-1.4.41/lab/datechange +56 -0
- data/ext/tokyocabinet-1.4.41/lab/diffcheck +45 -0
- data/ext/tokyocabinet-1.4.41/lab/htmltotsv +102 -0
- data/ext/tokyocabinet-1.4.41/lab/magic +19 -0
- data/ext/tokyocabinet-1.4.41/lab/printenv.cgi +27 -0
- data/ext/tokyocabinet-1.4.41/lab/stepcount +26 -0
- data/ext/tokyocabinet-1.4.41/lab/stopwatch +61 -0
- data/ext/tokyocabinet-1.4.41/lab/tabcheck +43 -0
- data/ext/tokyocabinet-1.4.41/lab/wgettsv +239 -0
- data/ext/tokyocabinet-1.4.41/lab/widthcheck +57 -0
- data/ext/tokyocabinet-1.4.41/man/htmltoman +104 -0
- data/ext/tokyocabinet-1.4.41/man/tcadb.3 +676 -0
- data/ext/tokyocabinet-1.4.41/man/tcamgr.1 +97 -0
- data/ext/tokyocabinet-1.4.41/man/tcamttest.1 +35 -0
- data/ext/tokyocabinet-1.4.41/man/tcatest.1 +55 -0
- data/ext/tokyocabinet-1.4.41/man/tcbdb.3 +1355 -0
- data/ext/tokyocabinet-1.4.41/man/tcbmgr.1 +125 -0
- data/ext/tokyocabinet-1.4.41/man/tcbmttest.1 +81 -0
- data/ext/tokyocabinet-1.4.41/man/tcbtest.1 +107 -0
- data/ext/tokyocabinet-1.4.41/man/tcfdb.3 +975 -0
- data/ext/tokyocabinet-1.4.41/man/tcfmgr.1 +98 -0
- data/ext/tokyocabinet-1.4.41/man/tcfmttest.1 +62 -0
- data/ext/tokyocabinet-1.4.41/man/tcftest.1 +73 -0
- data/ext/tokyocabinet-1.4.41/man/tchdb.3 +898 -0
- data/ext/tokyocabinet-1.4.41/man/tchmgr.1 +110 -0
- data/ext/tokyocabinet-1.4.41/man/tchmttest.1 +85 -0
- data/ext/tokyocabinet-1.4.41/man/tchtest.1 +95 -0
- data/ext/tokyocabinet-1.4.41/man/tclist.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcmap.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcmdb.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcmpool.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tctdb.3 +1110 -0
- data/ext/tokyocabinet-1.4.41/man/tctmgr.1 +140 -0
- data/ext/tokyocabinet-1.4.41/man/tctmttest.1 +92 -0
- data/ext/tokyocabinet-1.4.41/man/tctree.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcttest.1 +105 -0
- data/ext/tokyocabinet-1.4.41/man/tcucodec.1 +162 -0
- data/ext/tokyocabinet-1.4.41/man/tcumttest.1 +41 -0
- data/ext/tokyocabinet-1.4.41/man/tcutest.1 +81 -0
- data/ext/tokyocabinet-1.4.41/man/tcutil.3 +4518 -0
- data/ext/tokyocabinet-1.4.41/man/tcxstr.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tokyocabinet.3 +132 -0
- data/ext/tokyocabinet-1.4.41/md5.c +381 -0
- data/ext/tokyocabinet-1.4.41/md5.h +101 -0
- data/ext/tokyocabinet-1.4.41/myconf.c +493 -0
- data/ext/tokyocabinet-1.4.41/myconf.h +549 -0
- data/ext/tokyocabinet-1.4.41/tcadb.c +4339 -0
- data/ext/tokyocabinet-1.4.41/tcadb.h +548 -0
- data/ext/tokyocabinet-1.4.41/tcamgr.c +1019 -0
- data/ext/tokyocabinet-1.4.41/tcamttest.c +542 -0
- data/ext/tokyocabinet-1.4.41/tcatest.c +1845 -0
- data/ext/tokyocabinet-1.4.41/tcawmgr.c +482 -0
- data/ext/tokyocabinet-1.4.41/tcbdb.c +4180 -0
- data/ext/tokyocabinet-1.4.41/tcbdb.h +1101 -0
- data/ext/tokyocabinet-1.4.41/tcbmgr.c +1012 -0
- data/ext/tokyocabinet-1.4.41/tcbmttest.c +1810 -0
- data/ext/tokyocabinet-1.4.41/tcbtest.c +2586 -0
- data/ext/tokyocabinet-1.4.41/tcfdb.c +2746 -0
- data/ext/tokyocabinet-1.4.41/tcfdb.h +858 -0
- data/ext/tokyocabinet-1.4.41/tcfmgr.c +786 -0
- data/ext/tokyocabinet-1.4.41/tcfmttest.c +1220 -0
- data/ext/tokyocabinet-1.4.41/tcftest.c +1695 -0
- data/ext/tokyocabinet-1.4.41/tchdb.c +5153 -0
- data/ext/tokyocabinet-1.4.41/tchdb.h +871 -0
- data/ext/tokyocabinet-1.4.41/tchmgr.c +842 -0
- data/ext/tokyocabinet-1.4.41/tchmttest.c +1757 -0
- data/ext/tokyocabinet-1.4.41/tchtest.c +2129 -0
- data/ext/tokyocabinet-1.4.41/tctdb.c +6199 -0
- data/ext/tokyocabinet-1.4.41/tctdb.h +1086 -0
- data/ext/tokyocabinet-1.4.41/tctmgr.c +1241 -0
- data/ext/tokyocabinet-1.4.41/tctmttest.c +1563 -0
- data/ext/tokyocabinet-1.4.41/tcttest.c +2062 -0
- data/ext/tokyocabinet-1.4.41/tcucodec.c +1357 -0
- data/ext/tokyocabinet-1.4.41/tcumttest.c +578 -0
- data/ext/tokyocabinet-1.4.41/tcutest.c +1875 -0
- data/ext/tokyocabinet-1.4.41/tcutil.c +10528 -0
- data/ext/tokyocabinet-1.4.41/tcutil.h +4184 -0
- data/ext/tokyocabinet-1.4.41/tokyocabinet.idl +336 -0
- data/ext/tokyocabinet-1.4.41/tokyocabinet.pc.in +14 -0
- data/ext/tokyotyrant-1.1.39/COPYING +504 -0
- data/ext/tokyotyrant-1.1.39/ChangeLog +578 -0
- data/ext/tokyotyrant-1.1.39/Makefile.in +365 -0
- data/ext/tokyotyrant-1.1.39/README +38 -0
- data/ext/tokyotyrant-1.1.39/THANKS +15 -0
- data/ext/tokyotyrant-1.1.39/configure +6979 -0
- data/ext/tokyotyrant-1.1.39/configure.in +300 -0
- data/ext/tokyotyrant-1.1.39/doc/common.css +211 -0
- data/ext/tokyotyrant-1.1.39/doc/index.html +79 -0
- data/ext/tokyotyrant-1.1.39/doc/spex.html +2264 -0
- data/ext/tokyotyrant-1.1.39/example/Makefile +68 -0
- data/ext/tokyotyrant-1.1.39/example/httptest.pl +88 -0
- data/ext/tokyotyrant-1.1.39/example/mcftest.pl +39 -0
- data/ext/tokyotyrant-1.1.39/example/mctest.pl +43 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbex +0 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbex.c +49 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbex.o +0 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbtblex +0 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.c +79 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.o +0 -0
- data/ext/tokyotyrant-1.1.39/ext/mapreduce.lua +57 -0
- data/ext/tokyotyrant-1.1.39/ext/queue.lua +55 -0
- data/ext/tokyotyrant-1.1.39/ext/senatus.lua +532 -0
- data/ext/tokyotyrant-1.1.39/ext/usherette.lua +438 -0
- data/ext/tokyotyrant-1.1.39/lab/datechange +56 -0
- data/ext/tokyotyrant-1.1.39/lab/diffcheck +45 -0
- data/ext/tokyotyrant-1.1.39/lab/fibonacci.lua +20 -0
- data/ext/tokyotyrant-1.1.39/lab/footprint.lua +67 -0
- data/ext/tokyotyrant-1.1.39/lab/highlow.lua +88 -0
- data/ext/tokyotyrant-1.1.39/lab/killdualmaster +12 -0
- data/ext/tokyotyrant-1.1.39/lab/rundualmaster +38 -0
- data/ext/tokyotyrant-1.1.39/lab/stepcount +26 -0
- data/ext/tokyotyrant-1.1.39/lab/tabcheck +43 -0
- data/ext/tokyotyrant-1.1.39/lab/ushrtregister.pl +55 -0
- data/ext/tokyotyrant-1.1.39/lab/widthcheck +57 -0
- data/ext/tokyotyrant-1.1.39/man/htmltoman +100 -0
- data/ext/tokyotyrant-1.1.39/man/tcrdb.3 +1309 -0
- data/ext/tokyotyrant-1.1.39/man/tcrmgr.1 +164 -0
- data/ext/tokyotyrant-1.1.39/man/tcrmttest.1 +55 -0
- data/ext/tokyotyrant-1.1.39/man/tcrtest.1 +89 -0
- data/ext/tokyotyrant-1.1.39/man/tculog.3 +15 -0
- data/ext/tokyotyrant-1.1.39/man/ttservctl.8 +37 -0
- data/ext/tokyotyrant-1.1.39/man/ttserver.1 +84 -0
- data/ext/tokyotyrant-1.1.39/man/ttulmgr.1 +40 -0
- data/ext/tokyotyrant-1.1.39/man/ttultest.1 +16 -0
- data/ext/tokyotyrant-1.1.39/man/ttutil.3 +14 -0
- data/ext/tokyotyrant-1.1.39/myconf.c +169 -0
- data/ext/tokyotyrant-1.1.39/myconf.h +408 -0
- data/ext/tokyotyrant-1.1.39/scrext.c +2394 -0
- data/ext/tokyotyrant-1.1.39/scrext.h +96 -0
- data/ext/tokyotyrant-1.1.39/tcrdb.c +2637 -0
- data/ext/tokyotyrant-1.1.39/tcrdb.h +801 -0
- data/ext/tokyotyrant-1.1.39/tcrmgr.c +1559 -0
- data/ext/tokyotyrant-1.1.39/tcrmttest.c +915 -0
- data/ext/tokyotyrant-1.1.39/tcrtest.c +1542 -0
- data/ext/tokyotyrant-1.1.39/tculog.c +1211 -0
- data/ext/tokyotyrant-1.1.39/tculog.h +392 -0
- data/ext/tokyotyrant-1.1.39/tokyotyrant.idl +143 -0
- data/ext/tokyotyrant-1.1.39/tokyotyrant.pc.in +14 -0
- data/ext/tokyotyrant-1.1.39/ttservctl +163 -0
- data/ext/tokyotyrant-1.1.39/ttserver.c +3583 -0
- data/ext/tokyotyrant-1.1.39/ttskeldir.c +141 -0
- data/ext/tokyotyrant-1.1.39/ttskelmock.c +64 -0
- data/ext/tokyotyrant-1.1.39/ttskelnull.c +79 -0
- data/ext/tokyotyrant-1.1.39/ttskelproxy.c +74 -0
- data/ext/tokyotyrant-1.1.39/ttulmgr.c +266 -0
- data/ext/tokyotyrant-1.1.39/ttultest.c +371 -0
- data/ext/tokyotyrant-1.1.39/ttutil.c +1510 -0
- data/ext/tokyotyrant-1.1.39/ttutil.h +494 -0
- data/lib/tokyo_tyrant/balancer.rb +189 -0
- data/spec/ext.lua +4 -0
- data/spec/plu_db.rb +538 -0
- data/spec/spec.rb +1 -0
- data/spec/spec_base.rb +17 -0
- data/spec/start_tyrants.sh +36 -0
- data/spec/stop_tyrants.sh +9 -0
- data/spec/tokyo_tyrant_balancer_db_spec.rb +160 -0
- data/spec/tokyo_tyrant_balancer_table_spec.rb +177 -0
- data/spec/tokyo_tyrant_query_spec.rb +159 -0
- data/spec/tokyo_tyrant_spec.rb +254 -0
- data/spec/tokyo_tyrant_table_spec.rb +301 -0
- metadata +402 -0
@@ -0,0 +1,915 @@
|
|
1
|
+
/*************************************************************************************************
|
2
|
+
* The test cases of the remote database API
|
3
|
+
* Copyright (C) 2006-2009 Mikio Hirabayashi
|
4
|
+
* This file is part of Tokyo Tyrant.
|
5
|
+
* Tokyo Tyrant is free software; you can redistribute it and/or modify it under the terms of
|
6
|
+
* the GNU Lesser General Public License as published by the Free Software Foundation; either
|
7
|
+
* version 2.1 of the License or any later version. Tokyo Tyrant is distributed in the hope
|
8
|
+
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
10
|
+
* License for more details.
|
11
|
+
* You should have received a copy of the GNU Lesser General Public License along with Tokyo
|
12
|
+
* Tyrant; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
13
|
+
* Boston, MA 02111-1307 USA.
|
14
|
+
*************************************************************************************************/
|
15
|
+
|
16
|
+
|
17
|
+
#include <tcrdb.h>
|
18
|
+
#include "myconf.h"
|
19
|
+
|
20
|
+
#define RECBUFSIZ 32 // buffer for records
|
21
|
+
|
22
|
+
typedef struct { // type of structure for write thread
|
23
|
+
TCRDB *rdb;
|
24
|
+
int rnum;
|
25
|
+
bool nr;
|
26
|
+
const char *ext;
|
27
|
+
bool rnd;
|
28
|
+
int id;
|
29
|
+
} TARGWRITE;
|
30
|
+
|
31
|
+
typedef struct { // type of structure for read thread
|
32
|
+
TCRDB *rdb;
|
33
|
+
int rnum;
|
34
|
+
int mul;
|
35
|
+
bool rnd;
|
36
|
+
int id;
|
37
|
+
} TARGREAD;
|
38
|
+
|
39
|
+
typedef struct { // type of structure for remove thread
|
40
|
+
TCRDB *rdb;
|
41
|
+
int rnum;
|
42
|
+
bool rnd;
|
43
|
+
int id;
|
44
|
+
} TARGREMOVE;
|
45
|
+
|
46
|
+
typedef struct { // type of structure for typical thread
|
47
|
+
TCRDB *rdb;
|
48
|
+
int rnum;
|
49
|
+
int id;
|
50
|
+
} TARGTYPICAL;
|
51
|
+
|
52
|
+
typedef struct { // type of structure for table thread
|
53
|
+
TCRDB *rdb;
|
54
|
+
int rnum;
|
55
|
+
bool rnd;
|
56
|
+
int id;
|
57
|
+
} TARGTABLE;
|
58
|
+
|
59
|
+
|
60
|
+
/* global variables */
|
61
|
+
const char *g_progname; // program name
|
62
|
+
|
63
|
+
|
64
|
+
/* function prototypes */
|
65
|
+
int main(int argc, char **argv);
|
66
|
+
static void usage(void);
|
67
|
+
static void iprintf(const char *format, ...);
|
68
|
+
static void eprint(TCRDB *rdb, int line, const char *func);
|
69
|
+
static int myrand(int range);
|
70
|
+
static int myrandnd(int range);
|
71
|
+
static bool myopen(TCRDB *rdb, const char *host, int port);
|
72
|
+
static int runwrite(int argc, char **argv);
|
73
|
+
static int runread(int argc, char **argv);
|
74
|
+
static int runremove(int argc, char **argv);
|
75
|
+
static int runtypical(int argc, char **argv);
|
76
|
+
static int runtable(int argc, char **argv);
|
77
|
+
static int procwrite(const char *host, int port, int tnum, int rnum,
|
78
|
+
bool nr, const char *ext, bool rnd);
|
79
|
+
static int procread(const char *host, int port, int tnum, int mul, bool rnd);
|
80
|
+
static int procremove(const char *host, int port, int tnum, bool rnd);
|
81
|
+
static int proctypical(const char *host, int port, int tnum, int rnum);
|
82
|
+
static int proctable(const char *host, int port, int tnum, int rnum, bool rnd);
|
83
|
+
static void *threadwrite(void *targ);
|
84
|
+
static void *threadread(void *targ);
|
85
|
+
static void *threadremove(void *targ);
|
86
|
+
static void *threadtypical(void *targ);
|
87
|
+
static void *threadtable(void *targ);
|
88
|
+
|
89
|
+
|
90
|
+
/* main routine */
|
91
|
+
int main(int argc, char **argv){
|
92
|
+
g_progname = argv[0];
|
93
|
+
srand((unsigned int)(tctime() * 1000) % UINT_MAX);
|
94
|
+
if(argc < 2) usage();
|
95
|
+
int rv = 0;
|
96
|
+
if(!strcmp(argv[1], "write")){
|
97
|
+
rv = runwrite(argc, argv);
|
98
|
+
} else if(!strcmp(argv[1], "read")){
|
99
|
+
rv = runread(argc, argv);
|
100
|
+
} else if(!strcmp(argv[1], "remove")){
|
101
|
+
rv = runremove(argc, argv);
|
102
|
+
} else if(!strcmp(argv[1], "typical")){
|
103
|
+
rv = runtypical(argc, argv);
|
104
|
+
} else if(!strcmp(argv[1], "table")){
|
105
|
+
rv = runtable(argc, argv);
|
106
|
+
} else {
|
107
|
+
usage();
|
108
|
+
}
|
109
|
+
return rv;
|
110
|
+
}
|
111
|
+
|
112
|
+
|
113
|
+
/* print the usage and exit */
|
114
|
+
static void usage(void){
|
115
|
+
fprintf(stderr, "%s: test cases of the remote database API of Tokyo Tyrant\n", g_progname);
|
116
|
+
fprintf(stderr, "\n");
|
117
|
+
fprintf(stderr, "usage:\n");
|
118
|
+
fprintf(stderr, " %s write [-port num] [-tnum num] [-nr] [-ext name] [-rnd] host rnum\n",
|
119
|
+
g_progname);
|
120
|
+
fprintf(stderr, " %s read [-port num] [-tnum num] [-mul num] host\n", g_progname);
|
121
|
+
fprintf(stderr, " %s remove [-port num] [-tnum num] host\n", g_progname);
|
122
|
+
fprintf(stderr, " %s typical [-port num] [-tnum num] host rnum\n", g_progname);
|
123
|
+
fprintf(stderr, " %s table [-port num] [-tnum num] host rnum\n", g_progname);
|
124
|
+
fprintf(stderr, "\n");
|
125
|
+
exit(1);
|
126
|
+
}
|
127
|
+
|
128
|
+
|
129
|
+
/* print formatted information string and flush the buffer */
|
130
|
+
static void iprintf(const char *format, ...){
|
131
|
+
va_list ap;
|
132
|
+
va_start(ap, format);
|
133
|
+
vprintf(format, ap);
|
134
|
+
fflush(stdout);
|
135
|
+
va_end(ap);
|
136
|
+
}
|
137
|
+
|
138
|
+
|
139
|
+
/* print error message of abstract database */
|
140
|
+
static void eprint(TCRDB *rdb, int line, const char *func){
|
141
|
+
int ecode = tcrdbecode(rdb);
|
142
|
+
fprintf(stderr, "%s: %d: %s: error: %d: %s\n",
|
143
|
+
g_progname, line, func, ecode, tcrdberrmsg(ecode));
|
144
|
+
}
|
145
|
+
|
146
|
+
|
147
|
+
/* get a random number */
|
148
|
+
static int myrand(int range){
|
149
|
+
if(range < 2) return 0;
|
150
|
+
int high = (unsigned int)rand() >> 4;
|
151
|
+
int low = range * (rand() / (RAND_MAX + 1.0));
|
152
|
+
low &= (unsigned int)INT_MAX >> 4;
|
153
|
+
return (high + low) % range;
|
154
|
+
}
|
155
|
+
|
156
|
+
|
157
|
+
/* get a random number based on normal distribution */
|
158
|
+
static int myrandnd(int range){
|
159
|
+
int num = (int)tcdrandnd(range >> 1, range / 10);
|
160
|
+
return (num < 0 || num >= range) ? 0 : num;
|
161
|
+
}
|
162
|
+
|
163
|
+
|
164
|
+
/* open the remote database */
|
165
|
+
static bool myopen(TCRDB *rdb, const char *host, int port){
|
166
|
+
bool err = false;
|
167
|
+
if(strchr(host, ':') || strchr(host, '#')){
|
168
|
+
if(!tcrdbopen2(rdb, host)) err = true;
|
169
|
+
} else {
|
170
|
+
if(!tcrdbopen(rdb, host, port)) err = true;
|
171
|
+
}
|
172
|
+
return !err;
|
173
|
+
}
|
174
|
+
|
175
|
+
|
176
|
+
/* parse arguments of write command */
|
177
|
+
static int runwrite(int argc, char **argv){
|
178
|
+
char *host = NULL;
|
179
|
+
char *rstr = NULL;
|
180
|
+
int port = TTDEFPORT;
|
181
|
+
int tnum = 1;
|
182
|
+
bool nr = false;
|
183
|
+
char *ext = NULL;
|
184
|
+
bool rnd = false;
|
185
|
+
for(int i = 2; i < argc; i++){
|
186
|
+
if(!host && argv[i][0] == '-'){
|
187
|
+
if(!strcmp(argv[i], "-port")){
|
188
|
+
if(++i >= argc) usage();
|
189
|
+
port = tcatoi(argv[i]);
|
190
|
+
} else if(!strcmp(argv[i], "-tnum")){
|
191
|
+
if(++i >= argc) usage();
|
192
|
+
tnum = tcatoi(argv[i]);
|
193
|
+
} else if(!strcmp(argv[i], "-nr")){
|
194
|
+
nr = true;
|
195
|
+
} else if(!strcmp(argv[i], "-ext")){
|
196
|
+
if(++i >= argc) usage();
|
197
|
+
ext = argv[i];
|
198
|
+
} else if(!strcmp(argv[i], "-rnd")){
|
199
|
+
rnd = true;
|
200
|
+
} else {
|
201
|
+
usage();
|
202
|
+
}
|
203
|
+
} else if(!host){
|
204
|
+
host = argv[i];
|
205
|
+
} else if(!rstr){
|
206
|
+
rstr = argv[i];
|
207
|
+
} else {
|
208
|
+
usage();
|
209
|
+
}
|
210
|
+
}
|
211
|
+
if(!host || !rstr || tnum < 1) usage();
|
212
|
+
int rnum = tcatoi(rstr);
|
213
|
+
if(rnum < 1) usage();
|
214
|
+
int rv = procwrite(host, port, tnum, rnum, nr, ext, rnd);
|
215
|
+
return rv;
|
216
|
+
}
|
217
|
+
|
218
|
+
|
219
|
+
/* parse arguments of read command */
|
220
|
+
static int runread(int argc, char **argv){
|
221
|
+
char *host = NULL;
|
222
|
+
int port = TTDEFPORT;
|
223
|
+
int tnum = 1;
|
224
|
+
int mul = 0;
|
225
|
+
bool rnd = false;
|
226
|
+
for(int i = 2; i < argc; i++){
|
227
|
+
if(!host && argv[i][0] == '-'){
|
228
|
+
if(!strcmp(argv[i], "-port")){
|
229
|
+
if(++i >= argc) usage();
|
230
|
+
port = tcatoi(argv[i]);
|
231
|
+
} else if(!strcmp(argv[i], "-tnum")){
|
232
|
+
if(++i >= argc) usage();
|
233
|
+
tnum = tcatoi(argv[i]);
|
234
|
+
} else if(!strcmp(argv[i], "-mul")){
|
235
|
+
if(++i >= argc) usage();
|
236
|
+
mul = tcatoi(argv[i]);
|
237
|
+
} else if(!strcmp(argv[i], "-rnd")){
|
238
|
+
rnd = true;
|
239
|
+
} else {
|
240
|
+
usage();
|
241
|
+
}
|
242
|
+
} else if(!host){
|
243
|
+
host = argv[i];
|
244
|
+
} else {
|
245
|
+
usage();
|
246
|
+
}
|
247
|
+
}
|
248
|
+
if(!host || tnum < 1) usage();
|
249
|
+
int rv = procread(host, port, tnum, mul, rnd);
|
250
|
+
return rv;
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
/* parse arguments of remove command */
|
255
|
+
static int runremove(int argc, char **argv){
|
256
|
+
char *host = NULL;
|
257
|
+
int port = TTDEFPORT;
|
258
|
+
int tnum = 1;
|
259
|
+
bool rnd = false;
|
260
|
+
for(int i = 2; i < argc; i++){
|
261
|
+
if(!host && argv[i][0] == '-'){
|
262
|
+
if(!strcmp(argv[i], "-port")){
|
263
|
+
if(++i >= argc) usage();
|
264
|
+
port = tcatoi(argv[i]);
|
265
|
+
} else if(!strcmp(argv[i], "-tnum")){
|
266
|
+
if(++i >= argc) usage();
|
267
|
+
tnum = tcatoi(argv[i]);
|
268
|
+
} else if(!strcmp(argv[i], "-rnd")){
|
269
|
+
rnd = true;
|
270
|
+
} else {
|
271
|
+
usage();
|
272
|
+
}
|
273
|
+
} else if(!host){
|
274
|
+
host = argv[i];
|
275
|
+
} else {
|
276
|
+
usage();
|
277
|
+
}
|
278
|
+
}
|
279
|
+
if(!host || tnum < 1) usage();
|
280
|
+
int rv = procremove(host, port, tnum, rnd);
|
281
|
+
return rv;
|
282
|
+
}
|
283
|
+
|
284
|
+
|
285
|
+
/* parse arguments of typical command */
|
286
|
+
static int runtypical(int argc, char **argv){
|
287
|
+
char *host = NULL;
|
288
|
+
char *rstr = NULL;
|
289
|
+
int port = TTDEFPORT;
|
290
|
+
int tnum = 1;
|
291
|
+
for(int i = 2; i < argc; i++){
|
292
|
+
if(!host && argv[i][0] == '-'){
|
293
|
+
if(!strcmp(argv[i], "-port")){
|
294
|
+
if(++i >= argc) usage();
|
295
|
+
port = tcatoi(argv[i]);
|
296
|
+
} else if(!strcmp(argv[i], "-tnum")){
|
297
|
+
if(++i >= argc) usage();
|
298
|
+
tnum = tcatoi(argv[i]);
|
299
|
+
} else {
|
300
|
+
usage();
|
301
|
+
}
|
302
|
+
} else if(!host){
|
303
|
+
host = argv[i];
|
304
|
+
} else if(!rstr){
|
305
|
+
rstr = argv[i];
|
306
|
+
} else {
|
307
|
+
usage();
|
308
|
+
}
|
309
|
+
}
|
310
|
+
if(!host || !rstr || tnum < 1) usage();
|
311
|
+
int rnum = tcatoi(rstr);
|
312
|
+
if(rnum < 1) usage();
|
313
|
+
int rv = proctypical(host, port, tnum, rnum);
|
314
|
+
return rv;
|
315
|
+
}
|
316
|
+
|
317
|
+
|
318
|
+
/* parse arguments of table command */
|
319
|
+
static int runtable(int argc, char **argv){
|
320
|
+
char *host = NULL;
|
321
|
+
char *rstr = NULL;
|
322
|
+
int port = TTDEFPORT;
|
323
|
+
int tnum = 1;
|
324
|
+
bool rnd = false;
|
325
|
+
for(int i = 2; i < argc; i++){
|
326
|
+
if(!host && argv[i][0] == '-'){
|
327
|
+
if(!strcmp(argv[i], "-port")){
|
328
|
+
if(++i >= argc) usage();
|
329
|
+
port = tcatoi(argv[i]);
|
330
|
+
} else if(!strcmp(argv[i], "-tnum")){
|
331
|
+
if(++i >= argc) usage();
|
332
|
+
tnum = tcatoi(argv[i]);
|
333
|
+
} else if(!strcmp(argv[i], "-rnd")){
|
334
|
+
rnd = true;
|
335
|
+
} else {
|
336
|
+
usage();
|
337
|
+
}
|
338
|
+
} else if(!host){
|
339
|
+
host = argv[i];
|
340
|
+
} else if(!rstr){
|
341
|
+
rstr = argv[i];
|
342
|
+
} else {
|
343
|
+
usage();
|
344
|
+
}
|
345
|
+
}
|
346
|
+
if(!host || !rstr || tnum < 1) usage();
|
347
|
+
int rnum = tcatoi(rstr);
|
348
|
+
if(rnum < 1) usage();
|
349
|
+
int rv = proctable(host, port, tnum, rnum, rnd);
|
350
|
+
return rv;
|
351
|
+
}
|
352
|
+
|
353
|
+
|
354
|
+
/* perform write command */
|
355
|
+
static int procwrite(const char *host, int port, int tnum, int rnum,
|
356
|
+
bool nr, const char *ext, bool rnd){
|
357
|
+
iprintf("<Writing Test>\n host=%s port=%d tnum=%d rnum=%d nr=%d ext=%s rnd=%d\n\n",
|
358
|
+
host, port, tnum, rnum, nr, ext ? ext : "", rnd);
|
359
|
+
bool err = false;
|
360
|
+
double stime = tctime();
|
361
|
+
TCRDB *rdbs[tnum];
|
362
|
+
for(int i = 0; i < tnum; i++){
|
363
|
+
rdbs[i] = tcrdbnew();
|
364
|
+
if(!myopen(rdbs[i], host, port)){
|
365
|
+
eprint(rdbs[i], __LINE__, "tcrdbopen");
|
366
|
+
err = true;
|
367
|
+
}
|
368
|
+
}
|
369
|
+
TCRDB *rdb = rdbs[0];
|
370
|
+
TARGWRITE targs[tnum];
|
371
|
+
pthread_t threads[tnum];
|
372
|
+
if(tnum == 1){
|
373
|
+
targs[0].rdb = rdbs[0];
|
374
|
+
targs[0].rnum = rnum;
|
375
|
+
targs[0].nr = nr;
|
376
|
+
targs[0].ext = ext;
|
377
|
+
targs[0].rnd = rnd;
|
378
|
+
targs[0].id = 0;
|
379
|
+
if(threadwrite(targs) != NULL) err = true;
|
380
|
+
} else {
|
381
|
+
for(int i = 0; i < tnum; i++){
|
382
|
+
targs[i].rdb = rdbs[i];
|
383
|
+
targs[i].rnum = rnum;
|
384
|
+
targs[i].nr = nr;
|
385
|
+
targs[i].ext = ext;
|
386
|
+
targs[i].rnd = rnd;
|
387
|
+
targs[i].id = i;
|
388
|
+
if(pthread_create(threads + i, NULL, threadwrite, targs + i) != 0){
|
389
|
+
eprint(rdb, __LINE__, "pthread_create");
|
390
|
+
targs[i].id = -1;
|
391
|
+
err = true;
|
392
|
+
}
|
393
|
+
}
|
394
|
+
for(int i = 0; i < tnum; i++){
|
395
|
+
if(targs[i].id == -1) continue;
|
396
|
+
void *rv;
|
397
|
+
if(pthread_join(threads[i], &rv) != 0){
|
398
|
+
eprint(rdb, __LINE__, "pthread_join");
|
399
|
+
err = true;
|
400
|
+
} else if(rv){
|
401
|
+
err = true;
|
402
|
+
}
|
403
|
+
}
|
404
|
+
}
|
405
|
+
iprintf("record number: %llu\n", (unsigned long long)tcrdbrnum(rdb));
|
406
|
+
iprintf("size: %llu\n", (unsigned long long)tcrdbsize(rdb));
|
407
|
+
for(int i = 0; i < tnum; i++){
|
408
|
+
if(!tcrdbclose(rdbs[i])){
|
409
|
+
eprint(rdbs[i], __LINE__, "tcrdbclose");
|
410
|
+
err = true;
|
411
|
+
}
|
412
|
+
tcrdbdel(rdbs[i]);
|
413
|
+
}
|
414
|
+
iprintf("time: %.3f\n", tctime() - stime);
|
415
|
+
iprintf("%s\n\n", err ? "error" : "ok");
|
416
|
+
return err ? 1 : 0;
|
417
|
+
}
|
418
|
+
|
419
|
+
|
420
|
+
/* perform read command */
|
421
|
+
static int procread(const char *host, int port, int tnum, int mul, bool rnd){
|
422
|
+
iprintf("<Reading Test>\n host=%s port=%d tnum=%d mul=%d rnd=%d\n\n",
|
423
|
+
host, port, tnum, mul, rnd);
|
424
|
+
bool err = false;
|
425
|
+
double stime = tctime();
|
426
|
+
TCRDB *rdbs[tnum];
|
427
|
+
for(int i = 0; i < tnum; i++){
|
428
|
+
rdbs[i] = tcrdbnew();
|
429
|
+
if(!myopen(rdbs[i], host, port)){
|
430
|
+
eprint(rdbs[i], __LINE__, "tcrdbopen");
|
431
|
+
err = true;
|
432
|
+
}
|
433
|
+
}
|
434
|
+
TCRDB *rdb = rdbs[0];
|
435
|
+
int rnum = tcrdbrnum(rdb) / tnum;
|
436
|
+
TARGREAD targs[tnum];
|
437
|
+
pthread_t threads[tnum];
|
438
|
+
if(tnum == 1){
|
439
|
+
targs[0].rdb = rdbs[0];
|
440
|
+
targs[0].rnum = rnum;
|
441
|
+
targs[0].mul = mul;
|
442
|
+
targs[0].rnd = rnd;
|
443
|
+
targs[0].id = 0;
|
444
|
+
if(threadread(targs) != NULL) err = true;
|
445
|
+
} else {
|
446
|
+
for(int i = 0; i < tnum; i++){
|
447
|
+
targs[i].rdb = rdbs[i];
|
448
|
+
targs[i].rnum = rnum;
|
449
|
+
targs[i].mul = mul;
|
450
|
+
targs[i].rnd = rnd;
|
451
|
+
targs[i].id = i;
|
452
|
+
if(pthread_create(threads + i, NULL, threadread, targs + i) != 0){
|
453
|
+
eprint(rdb, __LINE__, "pthread_create");
|
454
|
+
targs[i].id = -1;
|
455
|
+
err = true;
|
456
|
+
}
|
457
|
+
}
|
458
|
+
for(int i = 0; i < tnum; i++){
|
459
|
+
if(targs[i].id == -1) continue;
|
460
|
+
void *rv;
|
461
|
+
if(pthread_join(threads[i], &rv) != 0){
|
462
|
+
eprint(rdb, __LINE__, "pthread_join");
|
463
|
+
err = true;
|
464
|
+
} else if(rv){
|
465
|
+
err = true;
|
466
|
+
}
|
467
|
+
}
|
468
|
+
}
|
469
|
+
iprintf("record number: %llu\n", (unsigned long long)tcrdbrnum(rdb));
|
470
|
+
iprintf("size: %llu\n", (unsigned long long)tcrdbsize(rdb));
|
471
|
+
for(int i = 0; i < tnum; i++){
|
472
|
+
if(!tcrdbclose(rdbs[i])){
|
473
|
+
eprint(rdbs[i], __LINE__, "tcrdbclose");
|
474
|
+
err = true;
|
475
|
+
}
|
476
|
+
tcrdbdel(rdbs[i]);
|
477
|
+
}
|
478
|
+
iprintf("time: %.3f\n", tctime() - stime);
|
479
|
+
iprintf("%s\n\n", err ? "error" : "ok");
|
480
|
+
return err ? 1 : 0;
|
481
|
+
}
|
482
|
+
|
483
|
+
|
484
|
+
/* perform remove command */
|
485
|
+
static int procremove(const char *host, int port, int tnum, bool rnd){
|
486
|
+
iprintf("<Removing Test>\n host=%s port=%d tnum=%d rnd=%d\n\n", host, port, tnum, rnd);
|
487
|
+
bool err = false;
|
488
|
+
double stime = tctime();
|
489
|
+
TCRDB *rdbs[tnum];
|
490
|
+
for(int i = 0; i < tnum; i++){
|
491
|
+
rdbs[i] = tcrdbnew();
|
492
|
+
if(!myopen(rdbs[i], host, port)){
|
493
|
+
eprint(rdbs[i], __LINE__, "tcrdbopen");
|
494
|
+
err = true;
|
495
|
+
}
|
496
|
+
}
|
497
|
+
TCRDB *rdb = rdbs[0];
|
498
|
+
int rnum = tcrdbrnum(rdb) / tnum;
|
499
|
+
TARGREMOVE targs[tnum];
|
500
|
+
pthread_t threads[tnum];
|
501
|
+
if(tnum == 1){
|
502
|
+
targs[0].rdb = rdbs[0];
|
503
|
+
targs[0].rnum = rnum;
|
504
|
+
targs[0].rnd = rnd;
|
505
|
+
targs[0].id = 0;
|
506
|
+
if(threadremove(targs) != NULL) err = true;
|
507
|
+
} else {
|
508
|
+
for(int i = 0; i < tnum; i++){
|
509
|
+
targs[i].rdb = rdbs[i];
|
510
|
+
targs[i].rnum = rnum;
|
511
|
+
targs[i].rnd = rnd;
|
512
|
+
targs[i].id = i;
|
513
|
+
if(pthread_create(threads + i, NULL, threadremove, targs + i) != 0){
|
514
|
+
eprint(rdb, __LINE__, "pthread_create");
|
515
|
+
targs[i].id = -1;
|
516
|
+
err = true;
|
517
|
+
}
|
518
|
+
}
|
519
|
+
for(int i = 0; i < tnum; i++){
|
520
|
+
if(targs[i].id == -1) continue;
|
521
|
+
void *rv;
|
522
|
+
if(pthread_join(threads[i], &rv) != 0){
|
523
|
+
eprint(rdb, __LINE__, "pthread_join");
|
524
|
+
err = true;
|
525
|
+
} else if(rv){
|
526
|
+
err = true;
|
527
|
+
}
|
528
|
+
}
|
529
|
+
}
|
530
|
+
iprintf("record number: %llu\n", (unsigned long long)tcrdbrnum(rdb));
|
531
|
+
iprintf("size: %llu\n", (unsigned long long)tcrdbsize(rdb));
|
532
|
+
for(int i = 0; i < tnum; i++){
|
533
|
+
if(!tcrdbclose(rdbs[i])){
|
534
|
+
eprint(rdbs[i], __LINE__, "tcrdbclose");
|
535
|
+
err = true;
|
536
|
+
}
|
537
|
+
tcrdbdel(rdbs[i]);
|
538
|
+
}
|
539
|
+
iprintf("time: %.3f\n", tctime() - stime);
|
540
|
+
iprintf("%s\n\n", err ? "error" : "ok");
|
541
|
+
return err ? 1 : 0;
|
542
|
+
}
|
543
|
+
|
544
|
+
|
545
|
+
/* perform typical command */
|
546
|
+
static int proctypical(const char *host, int port, int tnum, int rnum){
|
547
|
+
iprintf("<Typical Access Test>\n host=%s port=%d tnum=%d rnum=%d\n\n",
|
548
|
+
host, port, tnum, rnum);
|
549
|
+
bool err = false;
|
550
|
+
double stime = tctime();
|
551
|
+
TCRDB *rdbs[tnum];
|
552
|
+
for(int i = 0; i < tnum; i++){
|
553
|
+
rdbs[i] = tcrdbnew();
|
554
|
+
if(!myopen(rdbs[i], host, port)){
|
555
|
+
eprint(rdbs[i], __LINE__, "tcrdbopen");
|
556
|
+
err = true;
|
557
|
+
}
|
558
|
+
}
|
559
|
+
TCRDB *rdb = rdbs[0];
|
560
|
+
TARGTYPICAL targs[tnum];
|
561
|
+
pthread_t threads[tnum];
|
562
|
+
if(tnum == 1){
|
563
|
+
targs[0].rdb = rdbs[0];
|
564
|
+
targs[0].rnum = rnum;
|
565
|
+
targs[0].id = 0;
|
566
|
+
if(threadtypical(targs) != NULL) err = true;
|
567
|
+
} else {
|
568
|
+
for(int i = 0; i < tnum; i++){
|
569
|
+
targs[i].rdb = rdbs[i];
|
570
|
+
targs[i].rnum = rnum;
|
571
|
+
targs[i].id = i;
|
572
|
+
if(pthread_create(threads + i, NULL, threadtypical, targs + i) != 0){
|
573
|
+
eprint(rdb, __LINE__, "pthread_create");
|
574
|
+
targs[i].id = -1;
|
575
|
+
err = true;
|
576
|
+
}
|
577
|
+
}
|
578
|
+
for(int i = 0; i < tnum; i++){
|
579
|
+
if(targs[i].id == -1) continue;
|
580
|
+
void *rv;
|
581
|
+
if(pthread_join(threads[i], &rv) != 0){
|
582
|
+
eprint(rdb, __LINE__, "pthread_join");
|
583
|
+
err = true;
|
584
|
+
} else if(rv){
|
585
|
+
err = true;
|
586
|
+
}
|
587
|
+
}
|
588
|
+
}
|
589
|
+
iprintf("record number: %llu\n", (unsigned long long)tcrdbrnum(rdb));
|
590
|
+
iprintf("size: %llu\n", (unsigned long long)tcrdbsize(rdb));
|
591
|
+
for(int i = 0; i < tnum; i++){
|
592
|
+
if(!tcrdbclose(rdbs[i])){
|
593
|
+
eprint(rdbs[i], __LINE__, "tcrdbclose");
|
594
|
+
err = true;
|
595
|
+
}
|
596
|
+
tcrdbdel(rdbs[i]);
|
597
|
+
}
|
598
|
+
iprintf("time: %.3f\n", tctime() - stime);
|
599
|
+
iprintf("%s\n\n", err ? "error" : "ok");
|
600
|
+
return err ? 1 : 0;
|
601
|
+
}
|
602
|
+
|
603
|
+
|
604
|
+
/* perform table command */
|
605
|
+
static int proctable(const char *host, int port, int tnum, int rnum, bool rnd){
|
606
|
+
iprintf("<Table Extension Test>\n host=%s port=%d tnum=%d rnum=%d rnd=%d\n\n",
|
607
|
+
host, port, tnum, rnum, rnd);
|
608
|
+
bool err = false;
|
609
|
+
double stime = tctime();
|
610
|
+
TCRDB *rdbs[tnum];
|
611
|
+
for(int i = 0; i < tnum; i++){
|
612
|
+
rdbs[i] = tcrdbnew();
|
613
|
+
if(!myopen(rdbs[i], host, port)){
|
614
|
+
eprint(rdbs[i], __LINE__, "tcrdbopen");
|
615
|
+
err = true;
|
616
|
+
}
|
617
|
+
}
|
618
|
+
TCRDB *rdb = rdbs[0];
|
619
|
+
if(!tcrdbvanish(rdb)){
|
620
|
+
eprint(rdb, __LINE__, "tcrdbvanish");
|
621
|
+
err = true;
|
622
|
+
}
|
623
|
+
if(!tcrdbtblsetindex(rdb, "c", RDBITLEXICAL)){
|
624
|
+
eprint(rdb, __LINE__, "tcrdbtblsetindex");
|
625
|
+
err = true;
|
626
|
+
}
|
627
|
+
if(!tcrdbtblsetindex(rdb, "x", RDBITDECIMAL)){
|
628
|
+
eprint(rdb, __LINE__, "tcrdbtblsetindex");
|
629
|
+
err = true;
|
630
|
+
}
|
631
|
+
TARGTABLE targs[tnum];
|
632
|
+
pthread_t threads[tnum];
|
633
|
+
if(tnum == 1){
|
634
|
+
targs[0].rdb = rdbs[0];
|
635
|
+
targs[0].rnum = rnum;
|
636
|
+
targs[0].rnd = rnd;
|
637
|
+
targs[0].id = 0;
|
638
|
+
if(threadtable(targs) != NULL) err = true;
|
639
|
+
} else {
|
640
|
+
for(int i = 0; i < tnum; i++){
|
641
|
+
targs[i].rdb = rdbs[i];
|
642
|
+
targs[i].rnum = rnum;
|
643
|
+
targs[i].rnd = rnd;
|
644
|
+
targs[i].id = i;
|
645
|
+
if(pthread_create(threads + i, NULL, threadtable, targs + i) != 0){
|
646
|
+
eprint(rdb, __LINE__, "pthread_create");
|
647
|
+
targs[i].id = -1;
|
648
|
+
err = true;
|
649
|
+
}
|
650
|
+
}
|
651
|
+
for(int i = 0; i < tnum; i++){
|
652
|
+
if(targs[i].id == -1) continue;
|
653
|
+
void *rv;
|
654
|
+
if(pthread_join(threads[i], &rv) != 0){
|
655
|
+
eprint(rdb, __LINE__, "pthread_join");
|
656
|
+
err = true;
|
657
|
+
} else if(rv){
|
658
|
+
err = true;
|
659
|
+
}
|
660
|
+
}
|
661
|
+
}
|
662
|
+
iprintf("record number: %llu\n", (unsigned long long)tcrdbrnum(rdb));
|
663
|
+
iprintf("size: %llu\n", (unsigned long long)tcrdbsize(rdb));
|
664
|
+
for(int i = 0; i < tnum; i++){
|
665
|
+
if(!tcrdbclose(rdbs[i])){
|
666
|
+
eprint(rdbs[i], __LINE__, "tcrdbclose");
|
667
|
+
err = true;
|
668
|
+
}
|
669
|
+
tcrdbdel(rdbs[i]);
|
670
|
+
}
|
671
|
+
iprintf("time: %.3f\n", tctime() - stime);
|
672
|
+
iprintf("%s\n\n", err ? "error" : "ok");
|
673
|
+
return err ? 1 : 0;
|
674
|
+
}
|
675
|
+
|
676
|
+
|
677
|
+
/* thread the write function */
|
678
|
+
static void *threadwrite(void *targ){
|
679
|
+
TCRDB *rdb = ((TARGWRITE *)targ)->rdb;
|
680
|
+
int rnum = ((TARGWRITE *)targ)->rnum;
|
681
|
+
bool nr = ((TARGWRITE *)targ)->nr;
|
682
|
+
const char *ext = ((TARGWRITE *)targ)->ext;
|
683
|
+
bool rnd = ((TARGWRITE *)targ)->rnd;
|
684
|
+
int id = ((TARGWRITE *)targ)->id;
|
685
|
+
bool err = false;
|
686
|
+
int base = id * rnum;
|
687
|
+
for(int i = 1; i <= rnum; i++){
|
688
|
+
char buf[RECBUFSIZ];
|
689
|
+
int len = sprintf(buf, "%08d", base + (rnd ? myrand(i) + 1 : i));
|
690
|
+
if(nr){
|
691
|
+
if(!tcrdbputnr(rdb, buf, len, buf, len)){
|
692
|
+
eprint(rdb, __LINE__, "tcrdbputnr");
|
693
|
+
err = true;
|
694
|
+
break;
|
695
|
+
}
|
696
|
+
} else if(ext){
|
697
|
+
int rsiz;
|
698
|
+
char *rbuf = tcrdbext(rdb, ext, 0, buf, len, buf, len, &rsiz);
|
699
|
+
if(!rbuf && tcrdbecode(rdb) != TCEMISC){
|
700
|
+
eprint(rdb, __LINE__, "tcrdbext");
|
701
|
+
err = true;
|
702
|
+
break;
|
703
|
+
}
|
704
|
+
tcfree(rbuf);
|
705
|
+
} else {
|
706
|
+
if(!tcrdbput(rdb, buf, len, buf, len)){
|
707
|
+
eprint(rdb, __LINE__, "tcrdbput");
|
708
|
+
err = true;
|
709
|
+
break;
|
710
|
+
}
|
711
|
+
}
|
712
|
+
if(id == 0 && rnum > 250 && i % (rnum / 250) == 0){
|
713
|
+
putchar('.');
|
714
|
+
fflush(stdout);
|
715
|
+
if(i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i);
|
716
|
+
}
|
717
|
+
}
|
718
|
+
return err ? "error" : NULL;
|
719
|
+
}
|
720
|
+
|
721
|
+
|
722
|
+
/* thread the read function */
|
723
|
+
static void *threadread(void *targ){
|
724
|
+
TCRDB *rdb = ((TARGREAD *)targ)->rdb;
|
725
|
+
int rnum = ((TARGREAD *)targ)->rnum;
|
726
|
+
int mul = ((TARGREAD *)targ)->mul;
|
727
|
+
bool rnd = ((TARGREAD *)targ)->rnd;
|
728
|
+
int id = ((TARGREAD *)targ)->id;
|
729
|
+
bool err = false;
|
730
|
+
int base = id * rnum;
|
731
|
+
TCMAP *recs = mul > 1 ? tcmapnew() : NULL;
|
732
|
+
for(int i = 1; i <= rnum && !err; i++){
|
733
|
+
char kbuf[RECBUFSIZ];
|
734
|
+
int ksiz = sprintf(kbuf, "%08d", base + (rnd ? myrandnd(i) + 1 : i));
|
735
|
+
if(mul > 1){
|
736
|
+
tcmapput(recs, kbuf, ksiz, kbuf, ksiz);
|
737
|
+
if(i % mul == 0){
|
738
|
+
if(!tcrdbget3(rdb, recs)){
|
739
|
+
eprint(rdb, __LINE__, "tcrdbget3");
|
740
|
+
err = true;
|
741
|
+
break;
|
742
|
+
}
|
743
|
+
tcmapclear(recs);
|
744
|
+
}
|
745
|
+
} else {
|
746
|
+
int vsiz;
|
747
|
+
char *vbuf = tcrdbget(rdb, kbuf, ksiz, &vsiz);
|
748
|
+
if(!vbuf && !rnd){
|
749
|
+
eprint(rdb, __LINE__, "tcrdbget");
|
750
|
+
err = true;
|
751
|
+
break;
|
752
|
+
}
|
753
|
+
tcfree(vbuf);
|
754
|
+
}
|
755
|
+
if(id == 0 && rnum > 250 && i % (rnum / 250) == 0){
|
756
|
+
putchar('.');
|
757
|
+
fflush(stdout);
|
758
|
+
if(i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i);
|
759
|
+
}
|
760
|
+
}
|
761
|
+
if(recs) tcmapdel(recs);
|
762
|
+
return err ? "error" : NULL;
|
763
|
+
}
|
764
|
+
|
765
|
+
|
766
|
+
/* thread the remove function */
|
767
|
+
static void *threadremove(void *targ){
|
768
|
+
TCRDB *rdb = ((TARGREMOVE *)targ)->rdb;
|
769
|
+
int rnum = ((TARGREMOVE *)targ)->rnum;
|
770
|
+
bool rnd = ((TARGREMOVE *)targ)->rnd;
|
771
|
+
int id = ((TARGREMOVE *)targ)->id;
|
772
|
+
bool err = false;
|
773
|
+
int base = id * rnum;
|
774
|
+
for(int i = 1; i <= rnum && !err; i++){
|
775
|
+
char kbuf[RECBUFSIZ];
|
776
|
+
int ksiz = sprintf(kbuf, "%08d", base + (rnd ? myrandnd(i) + 1 : i));
|
777
|
+
if(!tcrdbout(rdb, kbuf, ksiz) && !rnd){
|
778
|
+
eprint(rdb, __LINE__, "tcrdbout");
|
779
|
+
err = true;
|
780
|
+
break;
|
781
|
+
}
|
782
|
+
if(id == 0 && rnum > 250 && i % (rnum / 250) == 0){
|
783
|
+
putchar('.');
|
784
|
+
fflush(stdout);
|
785
|
+
if(i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i);
|
786
|
+
}
|
787
|
+
}
|
788
|
+
return err ? "error" : NULL;
|
789
|
+
}
|
790
|
+
|
791
|
+
|
792
|
+
/* thread the typical function */
|
793
|
+
static void *threadtypical(void *targ){
|
794
|
+
TCRDB *rdb = ((TARGTYPICAL *)targ)->rdb;
|
795
|
+
int rnum = ((TARGTYPICAL *)targ)->rnum;
|
796
|
+
int id = ((TARGTYPICAL *)targ)->id;
|
797
|
+
bool err = false;
|
798
|
+
int range = (id + 1) * rnum;
|
799
|
+
for(int i = 1; i <= rnum && !err; i++){
|
800
|
+
char kbuf[RECBUFSIZ];
|
801
|
+
int ksiz = sprintf(kbuf, "%d", myrand(range) + 1);
|
802
|
+
char *vbuf;
|
803
|
+
int vsiz;
|
804
|
+
switch(myrand(6)){
|
805
|
+
case 0:
|
806
|
+
if(!tcrdbput(rdb, kbuf, ksiz, kbuf, ksiz)){
|
807
|
+
eprint(rdb, __LINE__, "tcrdbput");
|
808
|
+
err = true;
|
809
|
+
}
|
810
|
+
break;
|
811
|
+
case 1:
|
812
|
+
if(!tcrdbputkeep(rdb, kbuf, ksiz, kbuf, ksiz) && tcrdbecode(rdb) != TTEKEEP){
|
813
|
+
eprint(rdb, __LINE__, "tcrdbputkeep");
|
814
|
+
err = true;
|
815
|
+
}
|
816
|
+
break;
|
817
|
+
case 2:
|
818
|
+
if(!tcrdbputcat(rdb, kbuf, ksiz, kbuf, ksiz)){
|
819
|
+
eprint(rdb, __LINE__, "tcrdbputcat");
|
820
|
+
err = true;
|
821
|
+
}
|
822
|
+
break;
|
823
|
+
case 3:
|
824
|
+
if(!tcrdbputnr(rdb, kbuf, ksiz, kbuf, ksiz)){
|
825
|
+
eprint(rdb, __LINE__, "tcrdbputnr");
|
826
|
+
err = true;
|
827
|
+
}
|
828
|
+
break;
|
829
|
+
case 4:
|
830
|
+
if(!tcrdbout(rdb, kbuf, ksiz) && tcrdbecode(rdb) != TTENOREC){
|
831
|
+
eprint(rdb, __LINE__, "tcrdbout");
|
832
|
+
err = true;
|
833
|
+
}
|
834
|
+
break;
|
835
|
+
default:
|
836
|
+
vbuf = tcrdbget(rdb, kbuf, ksiz, &vsiz);
|
837
|
+
if(vbuf){
|
838
|
+
tcfree(vbuf);
|
839
|
+
} else if(tcrdbecode(rdb) != TTENOREC){
|
840
|
+
eprint(rdb, __LINE__, "tcrdbget");
|
841
|
+
err = true;
|
842
|
+
}
|
843
|
+
}
|
844
|
+
if(id == 0 && rnum > 250 && i % (rnum / 250) == 0){
|
845
|
+
putchar('.');
|
846
|
+
fflush(stdout);
|
847
|
+
if(i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i);
|
848
|
+
}
|
849
|
+
}
|
850
|
+
return err ? "error" : NULL;
|
851
|
+
}
|
852
|
+
|
853
|
+
|
854
|
+
/* thread the table function */
|
855
|
+
static void *threadtable(void *targ){
|
856
|
+
TCRDB *rdb = ((TARGTABLE *)targ)->rdb;
|
857
|
+
int rnum = ((TARGTABLE *)targ)->rnum;
|
858
|
+
bool rnd = ((TARGREMOVE *)targ)->rnd;
|
859
|
+
int id = ((TARGTABLE *)targ)->id;
|
860
|
+
bool err = false;
|
861
|
+
int base = id * rnum;
|
862
|
+
for(int i = 1; i <= rnum && !err; i++){
|
863
|
+
char pkbuf[RECBUFSIZ];
|
864
|
+
int pksiz = sprintf(pkbuf, "%08d", base + (rnd ? myrand(rnum / 2 + i) : i));
|
865
|
+
TCMAP *cols = tcmapnew2(7);
|
866
|
+
char vbuf[RECBUFSIZ*5];
|
867
|
+
int vsiz = sprintf(vbuf, "%d", myrand(i) + 1);
|
868
|
+
tcmapput(cols, "c", 1, vbuf, vsiz);
|
869
|
+
vsiz = sprintf(vbuf, "%lld", (long long)tctime() + (rnd ? myrand(3600) + 1 : 60));
|
870
|
+
tcmapput(cols, "x", 1, vbuf, vsiz);
|
871
|
+
if(rnd){
|
872
|
+
int act = myrand(100);
|
873
|
+
if(act < 5){
|
874
|
+
RDBQRY *qry = tcrdbqrynew(rdb);
|
875
|
+
if(myrand(5) == 0){
|
876
|
+
sprintf(vbuf, "%d", myrand(i));
|
877
|
+
tcrdbqryaddcond(qry, "c", RDBQCSTREQ, vbuf);
|
878
|
+
} else {
|
879
|
+
sprintf(vbuf, "%d,%d", myrand(rnum), myrand(rnum));
|
880
|
+
tcrdbqryaddcond(qry, "x", RDBQCNUMBT, vbuf);
|
881
|
+
}
|
882
|
+
tcrdbqrysetlimit(qry, 10, 0);
|
883
|
+
TCLIST *res = tcrdbqrysearch(qry);
|
884
|
+
tclistdel(res);
|
885
|
+
tcrdbqrydel(qry);
|
886
|
+
} else if(act < 10){
|
887
|
+
if(!tcrdbtblout(rdb, pkbuf, pksiz) && tcrdbecode(rdb) != TTENOREC){
|
888
|
+
eprint(rdb, __LINE__, "tcrdbtblout");
|
889
|
+
err = true;
|
890
|
+
}
|
891
|
+
} else {
|
892
|
+
if(!tcrdbtblput(rdb, pkbuf, pksiz, cols)){
|
893
|
+
eprint(rdb, __LINE__, "tcrdbtblput");
|
894
|
+
err = true;
|
895
|
+
}
|
896
|
+
}
|
897
|
+
} else {
|
898
|
+
if(!tcrdbtblput(rdb, pkbuf, pksiz, cols)){
|
899
|
+
eprint(rdb, __LINE__, "tcrdbtblput");
|
900
|
+
err = true;
|
901
|
+
}
|
902
|
+
}
|
903
|
+
tcmapdel(cols);
|
904
|
+
if(id == 0 && rnum > 250 && i % (rnum / 250) == 0){
|
905
|
+
putchar('.');
|
906
|
+
fflush(stdout);
|
907
|
+
if(i == rnum || i % (rnum / 10) == 0) iprintf(" (%08d)\n", i);
|
908
|
+
}
|
909
|
+
}
|
910
|
+
return err ? "error" : NULL;
|
911
|
+
}
|
912
|
+
|
913
|
+
|
914
|
+
|
915
|
+
// END OF FILE
|