vincentchu-handlersocket 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/HandlerSocket-Plugin-for-MySQL/AUTHORS +22 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/COPYING +30 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/ChangeLog +12 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/Makefile.am +87 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/README +78 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/autogen.sh +117 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/client/Makefile.am +24 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/client/hsclient.cpp +88 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/client/hslongrun.cpp +1041 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/client/hspool_test.pl +224 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/client/hstest.cpp +1532 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/client/hstest.pl +228 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/client/hstest_hs.sh +4 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/client/hstest_hs_more50.sh +4 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/client/hstest_md.sh +7 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/client/hstest_my.sh +3 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/client/hstest_my_more50.sh +3 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/configure.ac +144 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/docs-en/about-handlersocket.en.txt +72 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/docs-en/configuration-options.en.txt +99 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/docs-en/installation.en.txt +92 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/docs-en/perl-client.en.txt +135 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/docs-en/protocol.en.txt +205 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/docs-ja/about-handlersocket.ja.txt +51 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/docs-ja/installation.ja.txt +88 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/docs-ja/perl-client.ja.txt +127 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/docs-ja/protocol.ja.txt +180 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/COPYRIGHT.txt +27 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/Makefile.am +10 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/Makefile.plain.template +31 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/database.cpp +1190 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/database.hpp +142 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/handlersocket.cpp +222 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/handlersocket.spec.template +29 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr.cpp +149 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr.hpp +58 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr_worker.cpp +951 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr_worker.hpp +35 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/handlersocket/mysql_incl.hpp +50 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/COPYRIGHT.txt +27 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/Makefile.am +12 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/Makefile.plain +27 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/allocator.hpp +64 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/auto_addrinfo.hpp +49 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/auto_file.hpp +64 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/auto_ptrcontainer.hpp +67 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/config.cpp +67 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/config.hpp +32 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/escape.cpp +127 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/escape.hpp +66 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/fatal.cpp +36 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/fatal.hpp +22 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/hstcpcli.cpp +441 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/hstcpcli.hpp +62 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/libhsclient.spec.template +39 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/mutex.hpp +51 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/socket.cpp +186 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/socket.hpp +51 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/string_buffer.hpp +118 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/string_ref.hpp +63 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/string_util.cpp +182 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/string_util.hpp +53 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/thread.hpp +84 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/libhsclient/util.hpp +25 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/misc/microbench-hs.log +130 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/misc/microbench-my.log +125 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/COPYRIGHT.txt +27 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/Changes +6 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/HandlerSocket.xs +632 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/MANIFEST +8 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/Makefile.PL +18 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/Makefile.PL.installed +20 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/README +30 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/lib/Net/HandlerSocket.pm +68 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/lib/Net/HandlerSocket/Pool.pm +362 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/perl-Net-HandlerSocket.spec.template +127 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/ppport.h +6375 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/perl-Net-HandlerSocket/t/Net-HandlerSocket.t +15 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/Makefile +79 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/common/binary_my.cnf +4 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/common/compat.sh +29 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/common/hstest.pm +66 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/Makefile +4 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/run.sh +27 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test01.expected +100 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test01.pl +38 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test02.expected +100 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test02.pl +49 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test03.expected +771 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test03.pl +61 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test04.expected +0 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test04.pl +63 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test05.expected +771 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test05.pl +59 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test06.expected +644 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test06.pl +90 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test07.expected +304 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test07.pl +98 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test08.expected +2 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test08.pl +48 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test09.expected +12 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test09.pl +67 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test10.expected +771 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test10.pl +93 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test11.expected +37 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test11.pl +112 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test12.expected +273 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test12.pl +134 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test13.expected +92 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test13.pl +92 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test14.expected +144 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test14.pl +80 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test15.expected +764 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test15.pl +114 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test16.expected +66 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test16.pl +88 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test17.expected +0 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test17.pl +125 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test18.expected +22 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test18.pl +63 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test19.expected +14894 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test19.pl +190 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test20.expected +2 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test20.pl +33 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test21.expected +11 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test21.pl +58 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test22.expected +9 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test22.pl +61 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test23.expected +101 -0
- data/ext/HandlerSocket-Plugin-for-MySQL/regtest/test_01_lib/test23.pl +53 -0
- data/ext/winebarrel-ruby-handlersocket-c19841e47ea2/README +33 -0
- data/ext/winebarrel-ruby-handlersocket-c19841e47ea2/extconf.rb +27 -0
- data/ext/winebarrel-ruby-handlersocket-c19841e47ea2/handlersocket.cpp +437 -0
- data/ext/winebarrel-ruby-handlersocket-c19841e47ea2/handlersocket.h +32 -0
- metadata +200 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
|
|
2
|
+
[a@c54hdd libhsclient]$ ./hstest_my.sh host=192.168.100.104 key_mask=1000000 num_threads=100 num=10000000 timelimit=10 dbname=hstest
|
|
3
|
+
now: 1274128046 cntdiff: 63061 tdiff: 1.000999 rps: 62998.066579
|
|
4
|
+
now: 1274128047 cntdiff: 61227 tdiff: 1.001013 rps: 61165.037337
|
|
5
|
+
now: 1274128048 cntdiff: 61367 tdiff: 1.001029 rps: 61303.917375
|
|
6
|
+
now: 1274128049 cntdiff: 61959 tdiff: 1.000962 rps: 61899.451554
|
|
7
|
+
now: 1274128050 cntdiff: 62176 tdiff: 1.001006 rps: 62113.520756
|
|
8
|
+
now: 1274128051 cntdiff: 61367 tdiff: 1.000998 rps: 61305.815559
|
|
9
|
+
now: 1274128052 cntdiff: 61644 tdiff: 1.001015 rps: 61581.497988
|
|
10
|
+
now: 1274128053 cntdiff: 60659 tdiff: 1.000984 rps: 60599.373036
|
|
11
|
+
now: 1274128054 cntdiff: 59459 tdiff: 1.000996 rps: 59399.831067
|
|
12
|
+
now: 1274128055 cntdiff: 62310 tdiff: 1.001011 rps: 62247.074757
|
|
13
|
+
now: 1274128056 cntdiff: 61947 tdiff: 1.000991 rps: 61885.664744
|
|
14
|
+
now: 1274128057 cntdiff: 60675 tdiff: 1.001006 rps: 60614.029076
|
|
15
|
+
now: 1274128058 cntdiff: 60312 tdiff: 1.001001 rps: 60251.680861
|
|
16
|
+
now: 1274128059 cntdiff: 60290 tdiff: 1.001004 rps: 60229.530717
|
|
17
|
+
(1274128049.309634: 309654, 1274128059.319648: 920493), 61022.79143 qps
|
|
18
|
+
|
|
19
|
+
*************************** 1. row ***************************
|
|
20
|
+
Type: InnoDB
|
|
21
|
+
Name:
|
|
22
|
+
Status:
|
|
23
|
+
=====================================
|
|
24
|
+
100518 5:24:51 INNODB MONITOR OUTPUT
|
|
25
|
+
=====================================
|
|
26
|
+
Per second averages calculated from the last 5 seconds
|
|
27
|
+
----------
|
|
28
|
+
BACKGROUND THREAD
|
|
29
|
+
----------
|
|
30
|
+
srv_master_thread loops: 220 1_second, 219 sleeps, 21 10_second, 6 background, 6 flush
|
|
31
|
+
srv_master_thread log flush and writes: 219
|
|
32
|
+
----------
|
|
33
|
+
SEMAPHORES
|
|
34
|
+
----------
|
|
35
|
+
OS WAIT ARRAY INFO: reservation count 56193, signal count 30826
|
|
36
|
+
Mutex spin waits 3415153, rounds 5618661, OS waits 53251
|
|
37
|
+
RW-shared spins 24, OS waits 17; RW-excl spins 1, OS waits 5
|
|
38
|
+
Spin rounds per wait: 1.65 mutex, 30.00 RW-shared, 181.00 RW-excl
|
|
39
|
+
------------
|
|
40
|
+
TRANSACTIONS
|
|
41
|
+
------------
|
|
42
|
+
Trx id counter EDB514D6
|
|
43
|
+
Purge done for trx's n:o < EC1F94A7 undo n:o < 0
|
|
44
|
+
History list length 20
|
|
45
|
+
LIST OF TRANSACTIONS FOR EACH SESSION:
|
|
46
|
+
---TRANSACTION 0, not started, process no 4533, OS thread id 1306585408
|
|
47
|
+
MySQL thread id 113, query id 920620 localhost root
|
|
48
|
+
show engine innodb status
|
|
49
|
+
---TRANSACTION EDA708BB, not started, process no 4533, OS thread id 1272367424
|
|
50
|
+
MySQL thread id 5, query id 0 handlersocket: mode=rd, 0 conns, 0 active
|
|
51
|
+
---TRANSACTION ED9D5959, not started, process no 4533, OS thread id 1089849664
|
|
52
|
+
MySQL thread id 7, query id 0 handlersocket: mode=rd, 0 conns, 0 active
|
|
53
|
+
---TRANSACTION ED9D5956, not started, process no 4533, OS thread id 1238796608
|
|
54
|
+
MySQL thread id 1, query id 0 handlersocket: mode=rd, 0 conns, 0 active
|
|
55
|
+
---TRANSACTION EDA708BD, not started, process no 4533, OS thread id 1255582016
|
|
56
|
+
MySQL thread id 3, query id 0 handlersocket: mode=rd, 0 conns, 0 active
|
|
57
|
+
---TRANSACTION EDA708BF, not started, process no 4533, OS thread id 1247189312
|
|
58
|
+
MySQL thread id 2, query id 0 handlersocket: mode=rd, 0 conns, 0 active
|
|
59
|
+
---TRANSACTION EDA708BE, not started, process no 4533, OS thread id 1263974720
|
|
60
|
+
MySQL thread id 4, query id 0 handlersocket: mode=rd, 0 conns, 0 active
|
|
61
|
+
--------
|
|
62
|
+
FILE I/O
|
|
63
|
+
--------
|
|
64
|
+
I/O thread 0 state: waiting for i/o request (insert buffer thread)
|
|
65
|
+
I/O thread 1 state: waiting for i/o request (log thread)
|
|
66
|
+
I/O thread 2 state: waiting for i/o request (read thread)
|
|
67
|
+
I/O thread 3 state: waiting for i/o request (read thread)
|
|
68
|
+
I/O thread 4 state: waiting for i/o request (read thread)
|
|
69
|
+
I/O thread 5 state: waiting for i/o request (read thread)
|
|
70
|
+
I/O thread 6 state: waiting for i/o request (write thread)
|
|
71
|
+
I/O thread 7 state: waiting for i/o request (write thread)
|
|
72
|
+
I/O thread 8 state: waiting for i/o request (write thread)
|
|
73
|
+
I/O thread 9 state: waiting for i/o request (write thread)
|
|
74
|
+
Pending normal aio reads: 0, aio writes: 0,
|
|
75
|
+
ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0
|
|
76
|
+
Pending flushes (fsync) log: 0; buffer pool: 0
|
|
77
|
+
71 OS file reads, 269 OS file writes, 269 OS fsyncs
|
|
78
|
+
0.00 reads/s, 0 avg bytes/read, 2.40 writes/s, 2.40 fsyncs/s
|
|
79
|
+
-------------------------------------
|
|
80
|
+
INSERT BUFFER AND ADAPTIVE HASH INDEX
|
|
81
|
+
-------------------------------------
|
|
82
|
+
Ibuf: size 1, free list len 0, seg size 2,
|
|
83
|
+
0 inserts, 0 merged recs, 0 merges
|
|
84
|
+
Hash table size 12750011, node heap has 2 buffer(s)
|
|
85
|
+
65739.45 hash searches/s, 0.00 non-hash searches/s
|
|
86
|
+
---
|
|
87
|
+
LOG
|
|
88
|
+
---
|
|
89
|
+
Log sequence number 147179774153
|
|
90
|
+
Log flushed up to 147179771813
|
|
91
|
+
Last checkpoint at 147179761899
|
|
92
|
+
0 pending log writes, 0 pending chkp writes
|
|
93
|
+
220 log i/o's done, 1.60 log i/o's/second
|
|
94
|
+
----------------------
|
|
95
|
+
BUFFER POOL AND MEMORY
|
|
96
|
+
----------------------
|
|
97
|
+
Total memory allocated 6587154432; in additional pool allocated 0
|
|
98
|
+
Dictionary memory allocated 33640
|
|
99
|
+
Buffer pool size 393216
|
|
100
|
+
Free buffers 393154
|
|
101
|
+
Database pages 60
|
|
102
|
+
Old database pages 0
|
|
103
|
+
Modified db pages 1
|
|
104
|
+
Pending reads 0
|
|
105
|
+
Pending writes: LRU 0, flush list 0, single page 0
|
|
106
|
+
Pages made young 0, not young 0
|
|
107
|
+
0.00 youngs/s, 0.00 non-youngs/s
|
|
108
|
+
Pages read 60, created 0, written 27
|
|
109
|
+
0.00 reads/s, 0.00 creates/s, 0.40 writes/s
|
|
110
|
+
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
|
|
111
|
+
Pages read ahead 0.00/s, evicted without access 0.00/s
|
|
112
|
+
LRU len: 60, unzip_LRU len: 0
|
|
113
|
+
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
|
|
114
|
+
--------------
|
|
115
|
+
ROW OPERATIONS
|
|
116
|
+
--------------
|
|
117
|
+
0 queries inside InnoDB, 0 queries in queue
|
|
118
|
+
1 read views open inside InnoDB
|
|
119
|
+
Main thread process no. 4533, id 1230403904, state: sleeping
|
|
120
|
+
Number of rows inserted 0, updated 0, deleted 0, read 40071920
|
|
121
|
+
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 66321.54 reads/s
|
|
122
|
+
----------------------------
|
|
123
|
+
END OF INNODB MONITOR OUTPUT
|
|
124
|
+
============================
|
|
125
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
Copyright (c) 2010 DeNA Co.,Ltd.
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
documentation and/or other materials provided with the distribution.
|
|
13
|
+
* Neither the name of DeNA Co.,Ltd. nor the names of its contributors
|
|
14
|
+
may be used to endorse or promote products derived from this software
|
|
15
|
+
without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY DeNA Co.,Ltd. "AS IS" AND ANY EXPRESS OR
|
|
18
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
19
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
20
|
+
EVENT SHALL DeNA Co.,Ltd. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
21
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
22
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
23
|
+
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
24
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
25
|
+
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
26
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
|
|
@@ -0,0 +1,632 @@
|
|
|
1
|
+
|
|
2
|
+
// vim:ai:sw=2:ts=8
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (C) 2010 DeNA Co.,Ltd.. All rights reserved.
|
|
6
|
+
* See COPYRIGHT.txt for details.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#include "EXTERN.h"
|
|
10
|
+
#include "perl.h"
|
|
11
|
+
#include "XSUB.h"
|
|
12
|
+
|
|
13
|
+
#include "ppport.h"
|
|
14
|
+
|
|
15
|
+
#include "hstcpcli.hpp"
|
|
16
|
+
|
|
17
|
+
#define DBG(x)
|
|
18
|
+
|
|
19
|
+
static SV *
|
|
20
|
+
arr_get_entry(AV *av, I32 avmax, I32 idx)
|
|
21
|
+
{
|
|
22
|
+
if (idx > avmax) {
|
|
23
|
+
DBG(fprintf(stderr, "arr_get_entry1 %d %d\n", avmax, idx));
|
|
24
|
+
return 0;
|
|
25
|
+
}
|
|
26
|
+
SV **const ev = av_fetch(av, idx, 0);
|
|
27
|
+
if (ev == 0) {
|
|
28
|
+
DBG(fprintf(stderr, "arr_get_entry2 %d %d\n", avmax, idx));
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
return *ev;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static int
|
|
35
|
+
arr_get_intval(AV *av, I32 avmax, I32 idx, int default_val = 0)
|
|
36
|
+
{
|
|
37
|
+
SV *const e = arr_get_entry(av, avmax, idx);
|
|
38
|
+
if (e == 0) {
|
|
39
|
+
return default_val;
|
|
40
|
+
}
|
|
41
|
+
return SvIV(e);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static const char *
|
|
45
|
+
sv_get_strval(SV *sv)
|
|
46
|
+
{
|
|
47
|
+
if (sv == 0 || !SvPOK(sv)) {
|
|
48
|
+
DBG(fprintf(stderr, "sv_get_strval\n"));
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
return SvPV_nolen(sv);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static const char *
|
|
55
|
+
arr_get_strval(AV *av, I32 avmax, I32 idx)
|
|
56
|
+
{
|
|
57
|
+
SV *const e = arr_get_entry(av, avmax, idx);
|
|
58
|
+
return sv_get_strval(e);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static AV *
|
|
62
|
+
sv_get_arrval(SV *sv)
|
|
63
|
+
{
|
|
64
|
+
if (sv == 0 || !SvROK(sv)) {
|
|
65
|
+
DBG(fprintf(stderr, "sv_get_arrval1\n"));
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
SV *const svtarget = SvRV(sv);
|
|
69
|
+
if (svtarget == 0 || SvTYPE(svtarget) != SVt_PVAV) {
|
|
70
|
+
DBG(fprintf(stderr, "sv_get_arrval2\n"));
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
return (AV *)svtarget;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static AV *
|
|
77
|
+
arr_get_arrval(AV *av, I32 avmax, I32 idx)
|
|
78
|
+
{
|
|
79
|
+
SV *const e = arr_get_entry(av, avmax, idx);
|
|
80
|
+
if (e == 0) {
|
|
81
|
+
DBG(fprintf(stderr, "arr_get_arrval1\n"));
|
|
82
|
+
return 0;
|
|
83
|
+
}
|
|
84
|
+
return sv_get_arrval(e);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static void
|
|
88
|
+
hv_to_strmap(HV *hv, std::map<std::string, std::string>& m_r)
|
|
89
|
+
{
|
|
90
|
+
if (hv == 0) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
hv_iterinit(hv);
|
|
94
|
+
HE *hent = 0;
|
|
95
|
+
while ((hent = hv_iternext(hv)) != 0) {
|
|
96
|
+
I32 klen = 0;
|
|
97
|
+
char *const k = hv_iterkey(hent, &klen);
|
|
98
|
+
DBG(fprintf(stderr, "k=%s\n", k));
|
|
99
|
+
const std::string key(k, klen);
|
|
100
|
+
SV *const vsv = hv_iterval(hv, hent);
|
|
101
|
+
STRLEN vlen = 0;
|
|
102
|
+
char *const v = SvPV(vsv, vlen);
|
|
103
|
+
DBG(fprintf(stderr, "v=%s\n", v));
|
|
104
|
+
const std::string val(v, vlen);
|
|
105
|
+
m_r[key] = val;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static void
|
|
110
|
+
strrefarr_push_back(std::vector<dena::string_ref>& a_r, SV *sv)
|
|
111
|
+
{
|
|
112
|
+
if (sv == 0 || SvTYPE(sv) == SVt_NULL) { /* !SvPOK()? */
|
|
113
|
+
DBG(fprintf(stderr, "strrefarr_push_back: null\n"));
|
|
114
|
+
return a_r.push_back(dena::string_ref());
|
|
115
|
+
}
|
|
116
|
+
STRLEN vlen = 0;
|
|
117
|
+
char *const v = SvPV(sv, vlen);
|
|
118
|
+
DBG(fprintf(stderr, "strrefarr_push_back: %s\n", v));
|
|
119
|
+
a_r.push_back(dena::string_ref(v, vlen));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static void
|
|
123
|
+
av_to_strrefarr(AV *av, std::vector<dena::string_ref>& a_r)
|
|
124
|
+
{
|
|
125
|
+
if (av == 0) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const I32 len = av_len(av) + 1;
|
|
129
|
+
for (I32 i = 0; i < len; ++i) {
|
|
130
|
+
SV **const ev = av_fetch(av, i, 0);
|
|
131
|
+
strrefarr_push_back(a_r, ev ? *ev : 0);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
static dena::string_ref
|
|
136
|
+
sv_get_string_ref(SV *sv)
|
|
137
|
+
{
|
|
138
|
+
if (sv == 0 || SvTYPE(sv) == SVt_NULL) { /* !SvPOK()? */
|
|
139
|
+
return dena::string_ref();
|
|
140
|
+
}
|
|
141
|
+
STRLEN vlen = 0;
|
|
142
|
+
char *const v = SvPV(sv, vlen);
|
|
143
|
+
return dena::string_ref(v, vlen);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
static IV
|
|
147
|
+
sv_get_iv(SV *sv)
|
|
148
|
+
{
|
|
149
|
+
if (sv == 0 || ( !SvIOK(sv) && !SvPOK(sv) ) ) {
|
|
150
|
+
return 0;
|
|
151
|
+
}
|
|
152
|
+
return SvIV(sv);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static void
|
|
156
|
+
av_to_filters(AV *av, std::vector<dena::hstcpcli_filter>& f_r)
|
|
157
|
+
{
|
|
158
|
+
DBG(fprintf(stderr, "av_to_filters: %p\n", av));
|
|
159
|
+
if (av == 0) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const I32 len = av_len(av) + 1;
|
|
163
|
+
DBG(fprintf(stderr, "av_to_filters: len=%d\n", (int)len));
|
|
164
|
+
for (I32 i = 0; i < len; ++i) {
|
|
165
|
+
AV *const earr = arr_get_arrval(av, len, i);
|
|
166
|
+
if (earr == 0) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
const I32 earrlen = av_len(earr) + 1;
|
|
170
|
+
dena::hstcpcli_filter fe;
|
|
171
|
+
fe.filter_type = sv_get_string_ref(arr_get_entry(earr, earrlen, 0));
|
|
172
|
+
fe.op = sv_get_string_ref(arr_get_entry(earr, earrlen, 1));
|
|
173
|
+
fe.ff_offset = sv_get_iv(arr_get_entry(earr, earrlen, 2));
|
|
174
|
+
fe.val = sv_get_string_ref(arr_get_entry(earr, earrlen, 3));
|
|
175
|
+
f_r.push_back(fe);
|
|
176
|
+
DBG(fprintf(stderr, "av_to_filters: %s %s %d %s\n",
|
|
177
|
+
fe.filter_action.begin(), fe.filter_op.begin(), (int)fe.ff_offset,
|
|
178
|
+
fe.value.begin()));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
static void
|
|
183
|
+
set_process_verbose_level(const std::map<std::string, std::string>& m)
|
|
184
|
+
{
|
|
185
|
+
std::map<std::string, std::string>::const_iterator iter = m.find("verbose");
|
|
186
|
+
if (iter != m.end()) {
|
|
187
|
+
dena::verbose_level = atoi(iter->second.c_str());
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
static AV *
|
|
192
|
+
execute_internal(SV *obj, int id, const char *op, AV *keys, int limit,
|
|
193
|
+
int skip, const char *modop, AV *modvals, AV *filters, int invalues_keypart,
|
|
194
|
+
AV *invalues)
|
|
195
|
+
{
|
|
196
|
+
AV *retval = (AV *)&PL_sv_undef;
|
|
197
|
+
dena::hstcpcli_i *const ptr =
|
|
198
|
+
reinterpret_cast<dena::hstcpcli_i *>(SvIV(SvRV(obj)));
|
|
199
|
+
do {
|
|
200
|
+
std::vector<dena::string_ref> keyarr, mvarr;
|
|
201
|
+
std::vector<dena::hstcpcli_filter> farr;
|
|
202
|
+
std::vector<dena::string_ref> ivs;
|
|
203
|
+
av_to_strrefarr(keys, keyarr);
|
|
204
|
+
dena::string_ref modop_ref;
|
|
205
|
+
if (modop != 0) {
|
|
206
|
+
modop_ref = dena::string_ref(modop, strlen(modop));
|
|
207
|
+
av_to_strrefarr(modvals, mvarr);
|
|
208
|
+
}
|
|
209
|
+
if (filters != 0) {
|
|
210
|
+
av_to_filters(filters, farr);
|
|
211
|
+
}
|
|
212
|
+
if (invalues_keypart >= 0 && invalues != 0) {
|
|
213
|
+
av_to_strrefarr(invalues, ivs);
|
|
214
|
+
}
|
|
215
|
+
ptr->request_buf_exec_generic(id, dena::string_ref(op, strlen(op)),
|
|
216
|
+
&keyarr[0], keyarr.size(), limit, skip, modop_ref, &mvarr[0],
|
|
217
|
+
mvarr.size(), &farr[0], farr.size(), invalues_keypart, &ivs[0],
|
|
218
|
+
ivs.size());
|
|
219
|
+
AV *const av = newAV();
|
|
220
|
+
retval = av;
|
|
221
|
+
if (ptr->request_send() != 0) {
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
size_t nflds = 0;
|
|
225
|
+
ptr->response_recv(nflds);
|
|
226
|
+
const int e = ptr->get_error_code();
|
|
227
|
+
DBG(fprintf(stderr, "e=%d nflds=%zu\n", e, nflds));
|
|
228
|
+
av_push(av, newSViv(e));
|
|
229
|
+
if (e != 0) {
|
|
230
|
+
const std::string s = ptr->get_error();
|
|
231
|
+
av_push(av, newSVpvn(s.data(), s.size()));
|
|
232
|
+
} else {
|
|
233
|
+
const dena::string_ref *row = 0;
|
|
234
|
+
while ((row = ptr->get_next_row()) != 0) {
|
|
235
|
+
DBG(fprintf(stderr, "row=%p\n", row));
|
|
236
|
+
for (size_t i = 0; i < nflds; ++i) {
|
|
237
|
+
const dena::string_ref& v = row[i];
|
|
238
|
+
DBG(fprintf(stderr, "FLD %zu v=%s vbegin=%p\n", i,
|
|
239
|
+
std::string(v.begin(), v.size())
|
|
240
|
+
.c_str(), v.begin()));
|
|
241
|
+
if (v.begin() != 0) {
|
|
242
|
+
SV *const e = newSVpvn(
|
|
243
|
+
v.begin(), v.size());
|
|
244
|
+
av_push(av, e);
|
|
245
|
+
} else {
|
|
246
|
+
av_push(av, &PL_sv_undef);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (e >= 0) {
|
|
252
|
+
ptr->response_buf_remove();
|
|
253
|
+
}
|
|
254
|
+
} while (0);
|
|
255
|
+
return retval;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
struct execute_arg {
|
|
259
|
+
int id;
|
|
260
|
+
const char *op;
|
|
261
|
+
AV *keys;
|
|
262
|
+
int limit;
|
|
263
|
+
int skip;
|
|
264
|
+
const char *modop;
|
|
265
|
+
AV *modvals;
|
|
266
|
+
AV *filters;
|
|
267
|
+
int invalues_keypart;
|
|
268
|
+
AV *invalues;
|
|
269
|
+
execute_arg() : id(0), op(0), keys(0), limit(0), skip(0), modop(0),
|
|
270
|
+
modvals(0), filters(0), invalues_keypart(-1), invalues(0) { }
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
static AV *
|
|
274
|
+
execute_multi_internal(SV *obj, const execute_arg *args, size_t num_args)
|
|
275
|
+
{
|
|
276
|
+
dena::hstcpcli_i *const ptr =
|
|
277
|
+
reinterpret_cast<dena::hstcpcli_i *>(SvIV(SvRV(obj)));
|
|
278
|
+
/* appends multiple requests to the send buffer */
|
|
279
|
+
for (size_t i = 0; i < num_args; ++i) {
|
|
280
|
+
std::vector<dena::string_ref> keyarr, mvarr;
|
|
281
|
+
std::vector<dena::hstcpcli_filter> farr;
|
|
282
|
+
std::vector<dena::string_ref> ivs;
|
|
283
|
+
const execute_arg& arg = args[i];
|
|
284
|
+
av_to_strrefarr(arg.keys, keyarr);
|
|
285
|
+
dena::string_ref modop_ref;
|
|
286
|
+
if (arg.modop != 0) {
|
|
287
|
+
modop_ref = dena::string_ref(arg.modop, strlen(arg.modop));
|
|
288
|
+
av_to_strrefarr(arg.modvals, mvarr);
|
|
289
|
+
}
|
|
290
|
+
if (arg.filters != 0) {
|
|
291
|
+
av_to_filters(arg.filters, farr);
|
|
292
|
+
}
|
|
293
|
+
if (arg.invalues_keypart >= 0 && arg.invalues != 0) {
|
|
294
|
+
av_to_strrefarr(arg.invalues, ivs);
|
|
295
|
+
}
|
|
296
|
+
ptr->request_buf_exec_generic(arg.id,
|
|
297
|
+
dena::string_ref(arg.op, strlen(arg.op)), &keyarr[0], keyarr.size(),
|
|
298
|
+
arg.limit, arg.skip, modop_ref, &mvarr[0], mvarr.size(), &farr[0],
|
|
299
|
+
farr.size(), arg.invalues_keypart, &ivs[0], ivs.size());
|
|
300
|
+
}
|
|
301
|
+
AV *const retval = newAV();
|
|
302
|
+
/* sends the requests */
|
|
303
|
+
if (ptr->request_send() < 0) {
|
|
304
|
+
/* IO error */
|
|
305
|
+
AV *const av_respent = newAV();
|
|
306
|
+
av_push(retval, newRV_noinc((SV *)av_respent));
|
|
307
|
+
av_push(av_respent, newSViv(ptr->get_error_code()));
|
|
308
|
+
const std::string& s = ptr->get_error();
|
|
309
|
+
av_push(av_respent, newSVpvn(s.data(), s.size()));
|
|
310
|
+
return retval; /* retval : [ [ err_code, err_message ] ] */
|
|
311
|
+
}
|
|
312
|
+
/* receives responses */
|
|
313
|
+
for (size_t i = 0; i < num_args; ++i) {
|
|
314
|
+
AV *const av_respent = newAV();
|
|
315
|
+
av_push(retval, newRV_noinc((SV *)av_respent));
|
|
316
|
+
size_t nflds = 0;
|
|
317
|
+
const int e = ptr->response_recv(nflds);
|
|
318
|
+
av_push(av_respent, newSViv(e));
|
|
319
|
+
if (e != 0) {
|
|
320
|
+
const std::string& s = ptr->get_error();
|
|
321
|
+
av_push(av_respent, newSVpvn(s.data(), s.size()));
|
|
322
|
+
} else {
|
|
323
|
+
const dena::string_ref *row = 0;
|
|
324
|
+
while ((row = ptr->get_next_row()) != 0) {
|
|
325
|
+
for (size_t i = 0; i < nflds; ++i) {
|
|
326
|
+
const dena::string_ref& v = row[i];
|
|
327
|
+
DBG(fprintf(stderr, "%zu %s\n", i,
|
|
328
|
+
std::string(v.begin(), v.size()).c_str()));
|
|
329
|
+
if (v.begin() != 0) {
|
|
330
|
+
av_push(av_respent, newSVpvn(v.begin(), v.size()));
|
|
331
|
+
} else {
|
|
332
|
+
/* null */
|
|
333
|
+
av_push(av_respent, &PL_sv_undef);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if (e >= 0) {
|
|
339
|
+
ptr->response_buf_remove();
|
|
340
|
+
}
|
|
341
|
+
if (e < 0) {
|
|
342
|
+
return retval;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return retval;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
MODULE = Net::HandlerSocket PACKAGE = Net::HandlerSocket
|
|
349
|
+
|
|
350
|
+
SV *
|
|
351
|
+
new(klass, args)
|
|
352
|
+
char *klass
|
|
353
|
+
HV *args
|
|
354
|
+
CODE:
|
|
355
|
+
RETVAL = &PL_sv_undef;
|
|
356
|
+
dena::config conf;
|
|
357
|
+
hv_to_strmap(args, conf);
|
|
358
|
+
set_process_verbose_level(conf);
|
|
359
|
+
dena::socket_args sargs;
|
|
360
|
+
sargs.set(conf);
|
|
361
|
+
dena::hstcpcli_ptr p = dena::hstcpcli_i::create(sargs);
|
|
362
|
+
SV *const objref = newSViv(0);
|
|
363
|
+
SV *const obj = newSVrv(objref, klass);
|
|
364
|
+
dena::hstcpcli_i *const ptr = p.get();
|
|
365
|
+
sv_setiv(obj, reinterpret_cast<IV>(ptr));
|
|
366
|
+
p.release();
|
|
367
|
+
SvREADONLY_on(obj);
|
|
368
|
+
RETVAL = objref;
|
|
369
|
+
OUTPUT:
|
|
370
|
+
RETVAL
|
|
371
|
+
|
|
372
|
+
void
|
|
373
|
+
DESTROY(obj)
|
|
374
|
+
SV *obj
|
|
375
|
+
CODE:
|
|
376
|
+
dena::hstcpcli_i *const ptr =
|
|
377
|
+
reinterpret_cast<dena::hstcpcli_i *>(SvIV(SvRV(obj)));
|
|
378
|
+
delete ptr;
|
|
379
|
+
|
|
380
|
+
void
|
|
381
|
+
close(obj)
|
|
382
|
+
SV *obj
|
|
383
|
+
CODE:
|
|
384
|
+
dena::hstcpcli_i *const ptr =
|
|
385
|
+
reinterpret_cast<dena::hstcpcli_i *>(SvIV(SvRV(obj)));
|
|
386
|
+
ptr->close();
|
|
387
|
+
|
|
388
|
+
int
|
|
389
|
+
reconnect(obj)
|
|
390
|
+
SV *obj
|
|
391
|
+
CODE:
|
|
392
|
+
RETVAL = 0;
|
|
393
|
+
dena::hstcpcli_i *const ptr =
|
|
394
|
+
reinterpret_cast<dena::hstcpcli_i *>(SvIV(SvRV(obj)));
|
|
395
|
+
RETVAL = ptr->reconnect();
|
|
396
|
+
OUTPUT:
|
|
397
|
+
RETVAL
|
|
398
|
+
|
|
399
|
+
int
|
|
400
|
+
stable_point(obj)
|
|
401
|
+
SV *obj
|
|
402
|
+
CODE:
|
|
403
|
+
RETVAL = 0;
|
|
404
|
+
dena::hstcpcli_i *const ptr =
|
|
405
|
+
reinterpret_cast<dena::hstcpcli_i *>(SvIV(SvRV(obj)));
|
|
406
|
+
const bool rv = ptr->stable_point();
|
|
407
|
+
RETVAL = static_cast<int>(rv);
|
|
408
|
+
OUTPUT:
|
|
409
|
+
RETVAL
|
|
410
|
+
|
|
411
|
+
int
|
|
412
|
+
get_error_code(obj)
|
|
413
|
+
SV *obj
|
|
414
|
+
CODE:
|
|
415
|
+
RETVAL = 0;
|
|
416
|
+
dena::hstcpcli_i *const ptr =
|
|
417
|
+
reinterpret_cast<dena::hstcpcli_i *>(SvIV(SvRV(obj)));
|
|
418
|
+
RETVAL = ptr->get_error_code();
|
|
419
|
+
OUTPUT:
|
|
420
|
+
RETVAL
|
|
421
|
+
|
|
422
|
+
SV *
|
|
423
|
+
get_error(obj)
|
|
424
|
+
SV *obj
|
|
425
|
+
CODE:
|
|
426
|
+
RETVAL = &PL_sv_undef;
|
|
427
|
+
dena::hstcpcli_i *const ptr =
|
|
428
|
+
reinterpret_cast<dena::hstcpcli_i *>(SvIV(SvRV(obj)));
|
|
429
|
+
const std::string s = ptr->get_error();
|
|
430
|
+
RETVAL = newSVpvn(s.data(), s.size());
|
|
431
|
+
OUTPUT:
|
|
432
|
+
RETVAL
|
|
433
|
+
|
|
434
|
+
int
|
|
435
|
+
auth(obj, key, typ = 0)
|
|
436
|
+
SV *obj
|
|
437
|
+
const char *key
|
|
438
|
+
const char *typ
|
|
439
|
+
CODE:
|
|
440
|
+
RETVAL = 0;
|
|
441
|
+
dena::hstcpcli_i *const ptr =
|
|
442
|
+
reinterpret_cast<dena::hstcpcli_i *>(SvIV(SvRV(obj)));
|
|
443
|
+
do {
|
|
444
|
+
ptr->request_buf_auth(key, typ);
|
|
445
|
+
if (ptr->request_send() != 0) {
|
|
446
|
+
break;
|
|
447
|
+
}
|
|
448
|
+
size_t nflds = 0;
|
|
449
|
+
ptr->response_recv(nflds);
|
|
450
|
+
const int e = ptr->get_error_code();
|
|
451
|
+
DBG(fprintf(stderr, "errcode=%d\n", ptr->get_error_code()));
|
|
452
|
+
if (e >= 0) {
|
|
453
|
+
ptr->response_buf_remove();
|
|
454
|
+
}
|
|
455
|
+
DBG(fprintf(stderr, "errcode=%d\n", ptr->get_error_code()));
|
|
456
|
+
} while (0);
|
|
457
|
+
RETVAL = ptr->get_error_code();
|
|
458
|
+
OUTPUT:
|
|
459
|
+
RETVAL
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
int
|
|
463
|
+
open_index(obj, id, db, table, index, fields, ffields = 0)
|
|
464
|
+
SV *obj
|
|
465
|
+
int id
|
|
466
|
+
const char *db
|
|
467
|
+
const char *table
|
|
468
|
+
const char *index
|
|
469
|
+
const char *fields
|
|
470
|
+
SV *ffields
|
|
471
|
+
CODE:
|
|
472
|
+
const char *const ffields_str = sv_get_strval(ffields);
|
|
473
|
+
RETVAL = 0;
|
|
474
|
+
dena::hstcpcli_i *const ptr =
|
|
475
|
+
reinterpret_cast<dena::hstcpcli_i *>(SvIV(SvRV(obj)));
|
|
476
|
+
do {
|
|
477
|
+
ptr->request_buf_open_index(id, db, table, index, fields, ffields_str);
|
|
478
|
+
if (ptr->request_send() != 0) {
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
size_t nflds = 0;
|
|
482
|
+
ptr->response_recv(nflds);
|
|
483
|
+
const int e = ptr->get_error_code();
|
|
484
|
+
DBG(fprintf(stderr, "errcode=%d\n", ptr->get_error_code()));
|
|
485
|
+
if (e >= 0) {
|
|
486
|
+
ptr->response_buf_remove();
|
|
487
|
+
}
|
|
488
|
+
DBG(fprintf(stderr, "errcode=%d\n", ptr->get_error_code()));
|
|
489
|
+
} while (0);
|
|
490
|
+
RETVAL = ptr->get_error_code();
|
|
491
|
+
OUTPUT:
|
|
492
|
+
RETVAL
|
|
493
|
+
|
|
494
|
+
AV *
|
|
495
|
+
execute_single(obj, id, op, keys, limit, skip, mop = 0, mvs = 0, fils = 0, ivkeypart = -1, ivs = 0)
|
|
496
|
+
SV *obj
|
|
497
|
+
int id
|
|
498
|
+
const char *op
|
|
499
|
+
AV *keys
|
|
500
|
+
int limit
|
|
501
|
+
int skip
|
|
502
|
+
SV *mop
|
|
503
|
+
SV *mvs
|
|
504
|
+
SV *fils
|
|
505
|
+
int ivkeypart
|
|
506
|
+
SV *ivs
|
|
507
|
+
CODE:
|
|
508
|
+
const char *const mop_str = sv_get_strval(mop);
|
|
509
|
+
AV *const mvs_av = sv_get_arrval(mvs);
|
|
510
|
+
AV *const fils_av = sv_get_arrval(fils);
|
|
511
|
+
AV *const ivs_av = sv_get_arrval(ivs);
|
|
512
|
+
RETVAL = execute_internal(obj, id, op, keys, limit, skip, mop_str, mvs_av,
|
|
513
|
+
fils_av, ivkeypart, ivs_av);
|
|
514
|
+
sv_2mortal((SV *)RETVAL);
|
|
515
|
+
OUTPUT:
|
|
516
|
+
RETVAL
|
|
517
|
+
|
|
518
|
+
AV *
|
|
519
|
+
execute_multi(obj, cmds)
|
|
520
|
+
SV *obj
|
|
521
|
+
AV *cmds
|
|
522
|
+
CODE:
|
|
523
|
+
DBG(fprintf(stderr, "execute_multi0\n"));
|
|
524
|
+
const I32 cmdsmax = av_len(cmds);
|
|
525
|
+
execute_arg args[cmdsmax + 1]; /* GNU */
|
|
526
|
+
for (I32 i = 0; i <= cmdsmax; ++i) {
|
|
527
|
+
AV *const avtarget = arr_get_arrval(cmds, cmdsmax, i);
|
|
528
|
+
if (avtarget == 0) {
|
|
529
|
+
DBG(fprintf(stderr, "execute_multi1 %d\n", i));
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
const I32 argmax = av_len(avtarget);
|
|
533
|
+
if (argmax < 2) {
|
|
534
|
+
DBG(fprintf(stderr, "execute_multi2 %d\n", i));
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
execute_arg& ag = args[i];
|
|
538
|
+
ag.id = arr_get_intval(avtarget, argmax, 0);
|
|
539
|
+
ag.op = arr_get_strval(avtarget, argmax, 1);
|
|
540
|
+
ag.keys = arr_get_arrval(avtarget, argmax, 2);
|
|
541
|
+
ag.limit = arr_get_intval(avtarget, argmax, 3);
|
|
542
|
+
ag.skip = arr_get_intval(avtarget, argmax, 4);
|
|
543
|
+
ag.modop = arr_get_strval(avtarget, argmax, 5);
|
|
544
|
+
ag.modvals = arr_get_arrval(avtarget, argmax, 6);
|
|
545
|
+
ag.filters = arr_get_arrval(avtarget, argmax, 7);
|
|
546
|
+
ag.invalues_keypart = arr_get_intval(avtarget, argmax, 8, -1);
|
|
547
|
+
ag.invalues = arr_get_arrval(avtarget, argmax, 9);
|
|
548
|
+
DBG(fprintf(stderr, "execute_multi3 %d: %d %s %p %d %d %s %p %p %d %p\n",
|
|
549
|
+
i, ag.id, ag.op, ag.keys, ag.limit, ag.skip, ag.modop, ag.modvals,
|
|
550
|
+
ag.filters, ag.invalues_keypart, ag.invalues));
|
|
551
|
+
}
|
|
552
|
+
RETVAL = execute_multi_internal(obj, args, cmdsmax + 1);
|
|
553
|
+
sv_2mortal((SV *)RETVAL);
|
|
554
|
+
OUTPUT:
|
|
555
|
+
RETVAL
|
|
556
|
+
|
|
557
|
+
AV *
|
|
558
|
+
execute_find(obj, id, op, keys, limit, skip, mop = 0, mvs = 0, fils = 0, ivkeypart = -1, ivs = 0)
|
|
559
|
+
SV *obj
|
|
560
|
+
int id
|
|
561
|
+
const char *op
|
|
562
|
+
AV *keys
|
|
563
|
+
int limit
|
|
564
|
+
int skip
|
|
565
|
+
SV *mop
|
|
566
|
+
SV *mvs
|
|
567
|
+
SV *fils
|
|
568
|
+
int ivkeypart
|
|
569
|
+
SV *ivs
|
|
570
|
+
CODE:
|
|
571
|
+
const char *const mop_str = sv_get_strval(mop);
|
|
572
|
+
AV *const mvs_av = sv_get_arrval(mvs);
|
|
573
|
+
AV *const fils_av = sv_get_arrval(fils);
|
|
574
|
+
AV *const ivs_av = sv_get_arrval(ivs);
|
|
575
|
+
RETVAL = execute_internal(obj, id, op, keys, limit, skip, mop_str, mvs_av,
|
|
576
|
+
fils_av, ivkeypart, ivs_av);
|
|
577
|
+
sv_2mortal((SV *)RETVAL);
|
|
578
|
+
OUTPUT:
|
|
579
|
+
RETVAL
|
|
580
|
+
|
|
581
|
+
AV *
|
|
582
|
+
execute_update(obj, id, op, keys, limit, skip, modvals, fils = 0, ivkeypart = -1, ivs = 0)
|
|
583
|
+
SV *obj
|
|
584
|
+
int id
|
|
585
|
+
const char *op
|
|
586
|
+
AV *keys
|
|
587
|
+
int limit
|
|
588
|
+
int skip
|
|
589
|
+
AV *modvals
|
|
590
|
+
SV *fils
|
|
591
|
+
int ivkeypart
|
|
592
|
+
SV *ivs
|
|
593
|
+
CODE:
|
|
594
|
+
AV *const fils_av = sv_get_arrval(fils);
|
|
595
|
+
AV *const ivs_av = sv_get_arrval(ivs);
|
|
596
|
+
RETVAL = execute_internal(obj, id, op, keys, limit, skip, "U",
|
|
597
|
+
modvals, fils_av, ivkeypart, ivs_av);
|
|
598
|
+
sv_2mortal((SV *)RETVAL);
|
|
599
|
+
OUTPUT:
|
|
600
|
+
RETVAL
|
|
601
|
+
|
|
602
|
+
AV *
|
|
603
|
+
execute_delete(obj, id, op, keys, limit, skip, fils = 0, ivkeypart = -1, ivs = 0)
|
|
604
|
+
SV *obj
|
|
605
|
+
int id
|
|
606
|
+
const char *op
|
|
607
|
+
AV *keys
|
|
608
|
+
int limit
|
|
609
|
+
int skip
|
|
610
|
+
SV *fils
|
|
611
|
+
int ivkeypart
|
|
612
|
+
SV *ivs
|
|
613
|
+
CODE:
|
|
614
|
+
AV *const fils_av = sv_get_arrval(fils);
|
|
615
|
+
AV *const ivs_av = sv_get_arrval(ivs);
|
|
616
|
+
RETVAL = execute_internal(obj, id, op, keys, limit, skip, "D", 0, fils_av,
|
|
617
|
+
ivkeypart, ivs_av);
|
|
618
|
+
sv_2mortal((SV *)RETVAL);
|
|
619
|
+
OUTPUT:
|
|
620
|
+
RETVAL
|
|
621
|
+
|
|
622
|
+
AV *
|
|
623
|
+
execute_insert(obj, id, fvals)
|
|
624
|
+
SV *obj
|
|
625
|
+
int id
|
|
626
|
+
AV *fvals
|
|
627
|
+
CODE:
|
|
628
|
+
RETVAL = execute_internal(obj, id, "+", fvals, 0, 0, 0, 0, 0, -1, 0);
|
|
629
|
+
sv_2mortal((SV *)RETVAL);
|
|
630
|
+
OUTPUT:
|
|
631
|
+
RETVAL
|
|
632
|
+
|