zookeeper 1.4.10-java → 1.4.11-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG +7 -0
- data/ext/extconf.rb +3 -1
- data/ext/patches/zkc-3.4.5-out-of-order-ping.patch +163 -0
- data/lib/zookeeper/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDViMzg5YTZiNzUzM2IwMTJlZDI2YTA4ZWUwODBiNDdkNTIxZDUxNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzJjNjQyNTZjZmNkMDgyZTdmOTJjMDhhOWQ2ZjY3ZWVlYWQ1NzgzYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzU5YzkzYzk1MDNlMTAyOTZjODc4ZTdkODA3MWNlZTU2MjZlYTRlOTUxZWMz
|
10
|
+
MjFjNjM2NTY0OGY1NjA1YzQ5MzY3NmZkZWQxMzM3MWFmZWFiNjRlNTZlYzFi
|
11
|
+
OTcwMDA1NjA2MzI3M2RmMDE5NDA3MGVkY2IzZjdhZDIwZjBhMGI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWIxMGQ0ZWU3NTk5NDE5Y2QyYmRlMTE4NmUzYmZiZThkM2ZmZmM3OWM3ZjQx
|
14
|
+
MTUwMjg0ODgyMWQyNjAzYzk0YmFiNWU0NGIyZGEwZjYyNGEwYTllZjVjMTk3
|
15
|
+
ZWFiMTRkZGVhMzQ5NDViNjNkYTM2YTY2ZjJkYjdmYzE0MjIxODE=
|
data/CHANGELOG
CHANGED
data/ext/extconf.rb
CHANGED
@@ -89,7 +89,9 @@ Dir.chdir("#{HERE}/lib") do
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
|
+
# -lm must come after lzookeeper_st_gem to ensure proper link
|
94
|
+
$LIBS << " -lzookeeper_st_gem -lm"
|
93
95
|
|
94
96
|
have_func('rb_thread_blocking_region')
|
95
97
|
have_func('rb_thread_fd_select')
|
@@ -0,0 +1,163 @@
|
|
1
|
+
diff --git zkc-3.4.5-orig/c/src/zookeeper.c zkc-3.4.5/c/src/zookeeper.c
|
2
|
+
index de58c62..2347ff4 100644
|
3
|
+
--- zkc-3.4.5-orig/c/src/zookeeper.c
|
4
|
+
+++ zkc-3.4.5/c/src/zookeeper.c
|
5
|
+
@@ -1167,25 +1167,20 @@ void free_completions(zhandle_t *zh,int callCompletion,int reason)
|
6
|
+
zh->outstanding_sync--;
|
7
|
+
destroy_completion_entry(cptr);
|
8
|
+
} else if (callCompletion) {
|
9
|
+
- if(cptr->xid == PING_XID){
|
10
|
+
- // Nothing to do with a ping response
|
11
|
+
- destroy_completion_entry(cptr);
|
12
|
+
- } else {
|
13
|
+
- // Fake the response
|
14
|
+
- buffer_list_t *bptr;
|
15
|
+
- h.xid = cptr->xid;
|
16
|
+
- h.zxid = -1;
|
17
|
+
- h.err = reason;
|
18
|
+
- oa = create_buffer_oarchive();
|
19
|
+
- serialize_ReplyHeader(oa, "header", &h);
|
20
|
+
- bptr = calloc(sizeof(*bptr), 1);
|
21
|
+
- assert(bptr);
|
22
|
+
- bptr->len = get_buffer_len(oa);
|
23
|
+
- bptr->buffer = get_buffer(oa);
|
24
|
+
- close_buffer_oarchive(&oa, 0);
|
25
|
+
- cptr->buffer = bptr;
|
26
|
+
- queue_completion(&zh->completions_to_process, cptr, 0);
|
27
|
+
- }
|
28
|
+
+ // Fake the response
|
29
|
+
+ buffer_list_t *bptr;
|
30
|
+
+ h.xid = cptr->xid;
|
31
|
+
+ h.zxid = -1;
|
32
|
+
+ h.err = reason;
|
33
|
+
+ oa = create_buffer_oarchive();
|
34
|
+
+ serialize_ReplyHeader(oa, "header", &h);
|
35
|
+
+ bptr = calloc(sizeof(*bptr), 1);
|
36
|
+
+ assert(bptr);
|
37
|
+
+ bptr->len = get_buffer_len(oa);
|
38
|
+
+ bptr->buffer = get_buffer(oa);
|
39
|
+
+ close_buffer_oarchive(&oa, 0);
|
40
|
+
+ cptr->buffer = bptr;
|
41
|
+
+ queue_completion(&zh->completions_to_process, cptr, 0);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
a_list.completion = NULL;
|
45
|
+
@@ -1526,7 +1521,6 @@ static struct timeval get_timeval(int interval)
|
46
|
+
rc = serialize_RequestHeader(oa, "header", &h);
|
47
|
+
enter_critical(zh);
|
48
|
+
gettimeofday(&zh->last_ping, 0);
|
49
|
+
- rc = rc < 0 ? rc : add_void_completion(zh, h.xid, 0, 0);
|
50
|
+
rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa),
|
51
|
+
get_buffer_len(oa));
|
52
|
+
leave_critical(zh);
|
53
|
+
@@ -2063,12 +2057,8 @@ static void deserialize_response(int type, int xid, int failed, int rc, completi
|
54
|
+
case COMPLETION_VOID:
|
55
|
+
LOG_DEBUG(("Calling COMPLETION_VOID for xid=%#x failed=%d rc=%d",
|
56
|
+
cptr->xid, failed, rc));
|
57
|
+
- if (xid == PING_XID) {
|
58
|
+
- // We want to skip the ping
|
59
|
+
- } else {
|
60
|
+
- assert(cptr->c.void_result);
|
61
|
+
- cptr->c.void_result(rc, cptr->data);
|
62
|
+
- }
|
63
|
+
+ assert(cptr->c.void_result);
|
64
|
+
+ cptr->c.void_result(rc, cptr->data);
|
65
|
+
break;
|
66
|
+
case COMPLETION_MULTI:
|
67
|
+
LOG_DEBUG(("Calling COMPLETION_MULTI for xid=%#x failed=%d rc=%d",
|
68
|
+
@@ -2184,7 +2174,15 @@ int zookeeper_process(zhandle_t *zh, int events)
|
69
|
+
// fprintf(stderr, "Got %#x for %#x\n", hdr.zxid, hdr.xid);
|
70
|
+
}
|
71
|
+
|
72
|
+
- if (hdr.xid == WATCHER_EVENT_XID) {
|
73
|
+
+ if (hdr.xid == PING_XID) {
|
74
|
+
+ // Ping replies can arrive out-of-order
|
75
|
+
+ int elapsed = 0;
|
76
|
+
+ struct timeval now;
|
77
|
+
+ gettimeofday(&now, 0);
|
78
|
+
+ elapsed = calculate_interval(&zh->last_ping, &now);
|
79
|
+
+ LOG_DEBUG(("Got ping response in %d ms", elapsed));
|
80
|
+
+ free_buffer(bptr);
|
81
|
+
+ } else if (hdr.xid == WATCHER_EVENT_XID) {
|
82
|
+
struct WatcherEvent evt;
|
83
|
+
int type = 0;
|
84
|
+
char *path = NULL;
|
85
|
+
@@ -2250,22 +2248,9 @@ int zookeeper_process(zhandle_t *zh, int events)
|
86
|
+
activateWatcher(zh, cptr->watcher, rc);
|
87
|
+
|
88
|
+
if (cptr->c.void_result != SYNCHRONOUS_MARKER) {
|
89
|
+
- if(hdr.xid == PING_XID){
|
90
|
+
- int elapsed = 0;
|
91
|
+
- struct timeval now;
|
92
|
+
- gettimeofday(&now, 0);
|
93
|
+
- elapsed = calculate_interval(&zh->last_ping, &now);
|
94
|
+
- LOG_DEBUG(("Got ping response in %d ms", elapsed));
|
95
|
+
-
|
96
|
+
- // Nothing to do with a ping response
|
97
|
+
- free_buffer(bptr);
|
98
|
+
- destroy_completion_entry(cptr);
|
99
|
+
- } else {
|
100
|
+
- LOG_DEBUG(("Queueing asynchronous response"));
|
101
|
+
-
|
102
|
+
- cptr->buffer = bptr;
|
103
|
+
- queue_completion(&zh->completions_to_process, cptr, 0);
|
104
|
+
- }
|
105
|
+
+ LOG_DEBUG(("Queueing asynchronous response"));
|
106
|
+
+ cptr->buffer = bptr;
|
107
|
+
+ queue_completion(&zh->completions_to_process, cptr, 0);
|
108
|
+
} else {
|
109
|
+
struct sync_completion
|
110
|
+
*sc = (struct sync_completion*)cptr->data;
|
111
|
+
diff --git zkc-3.4.5-orig/c/tests/TestOperations.cc zkc-3.4.5/c/tests/TestOperations.cc
|
112
|
+
index b0370e9..27d9270 100644
|
113
|
+
--- zkc-3.4.5-orig/c/tests/TestOperations.cc
|
114
|
+
+++ zkc-3.4.5/c/tests/TestOperations.cc
|
115
|
+
@@ -29,6 +29,7 @@ class Zookeeper_operations : public CPPUNIT_NS::TestFixture
|
116
|
+
CPPUNIT_TEST_SUITE(Zookeeper_operations);
|
117
|
+
#ifndef THREADED
|
118
|
+
CPPUNIT_TEST(testPing);
|
119
|
+
+ CPPUNIT_TEST(testUnsolicitedPing);
|
120
|
+
CPPUNIT_TEST(testTimeoutCausedByWatches1);
|
121
|
+
CPPUNIT_TEST(testTimeoutCausedByWatches2);
|
122
|
+
#else
|
123
|
+
@@ -305,6 +306,40 @@ public:
|
124
|
+
CPPUNIT_ASSERT_EQUAL(1,zkServer.pingCount_);
|
125
|
+
}
|
126
|
+
|
127
|
+
+ // ZOOKEEPER-2253: Permit unsolicited pings
|
128
|
+
+ void testUnsolicitedPing()
|
129
|
+
+ {
|
130
|
+
+ const int TIMEOUT=9; // timeout in secs
|
131
|
+
+ Mock_gettimeofday timeMock;
|
132
|
+
+ PingCountingServer zkServer;
|
133
|
+
+ // must call zookeeper_close() while all the mocks are in scope
|
134
|
+
+ CloseFinally guard(&zh);
|
135
|
+
+
|
136
|
+
+ // receive timeout is in milliseconds
|
137
|
+
+ zh=zookeeper_init("localhost:1234",watcher,TIMEOUT*1000,TEST_CLIENT_ID,0,0);
|
138
|
+
+ CPPUNIT_ASSERT(zh!=0);
|
139
|
+
+ // simulate connected state
|
140
|
+
+ forceConnected(zh);
|
141
|
+
+
|
142
|
+
+ int fd=0;
|
143
|
+
+ int interest=0;
|
144
|
+
+ timeval tv;
|
145
|
+
+
|
146
|
+
+ int rc=zookeeper_interest(zh,&fd,&interest,&tv);
|
147
|
+
+ CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
|
148
|
+
+
|
149
|
+
+ // verify no ping sent
|
150
|
+
+ CPPUNIT_ASSERT(zkServer.pingCount_==0);
|
151
|
+
+
|
152
|
+
+ // we're going to receive a unsolicited PING response; ensure
|
153
|
+
+ // that the client has updated its last_recv timestamp
|
154
|
+
+ timeMock.tick(tv);
|
155
|
+
+ zkServer.addRecvResponse(new PingResponse);
|
156
|
+
+ rc=zookeeper_process(zh,interest);
|
157
|
+
+ CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
|
158
|
+
+ CPPUNIT_ASSERT(timeMock==zh->last_recv);
|
159
|
+
+ }
|
160
|
+
+
|
161
|
+
// simulate a watch arriving right before a ping is due
|
162
|
+
// assert the ping is sent nevertheless
|
163
|
+
void testTimeoutCausedByWatches1()
|
data/lib/zookeeper/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zookeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.11
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Phillip Pearson
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2015-
|
16
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: slyphon-log4j
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- ext/generate_gvl_code.rb
|
89
89
|
- ext/patches/zkc-3.3.5-network.patch
|
90
90
|
- ext/patches/zkc-3.4.5-logging.patch
|
91
|
+
- ext/patches/zkc-3.4.5-out-of-order-ping.patch
|
91
92
|
- ext/patches/zkc-3.4.5-yosemite-htonl-fix.patch
|
92
93
|
- ext/zkc-3.4.5.tar.gz
|
93
94
|
- ext/zkrb.c
|
@@ -161,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
162
|
version: '0'
|
162
163
|
requirements: []
|
163
164
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.2.2
|
165
166
|
signing_key:
|
166
167
|
specification_version: 4
|
167
168
|
summary: Apache ZooKeeper driver for Rubies
|