Skip to content

Commit 05eae83

Browse files
author
Mate Szalay-Beko
committed
Merge remote-tracking branch 'apache/master' into ZOOKEEPER-3188
2 parents e823af4 + 874aaf1 commit 05eae83

105 files changed

Lines changed: 4775 additions & 2061 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Apache ZooKeeper
1+
# Apache ZooKeeper [![Build Status](https://travis-ci.org/apache/zookeeper.svg?branch=master)](https://travis-ci.org/apache/zookeeper) [![Maven Central](https://img.shields.io/maven-central/v/org.apache.zookeeper/zookeeper)](https://zookeeper.apache.org/releases.html) [![License](https://img.shields.io/github/license/apache/zookeeper)](https://github.com/apache/zookeeper/blob/master/LICENSE.txt)
22
![alt text](https://zookeeper.apache.org/images/zookeeper_small.gif "ZooKeeper")
33

44
For the latest information about Apache ZooKeeper, please visit our website at:

build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
3737

3838
<property name="audience-annotations.version" value="0.5.0" />
3939

40-
<property name="netty.version" value="4.1.36.Final"/>
40+
<property name="netty.version" value="4.1.42.Final"/>
4141

4242
<property name="junit.version" value="4.12"/>
4343
<property name="mockito.version" value="2.27.0"/>
@@ -55,7 +55,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
5555
<property name="javacc.version" value="5.0"/>
5656

5757
<property name="jetty.version" value="9.4.18.v20190429"/>
58-
<property name="jackson.version" value="2.9.9.3"/>
58+
<property name="jackson.version" value="2.9.10"/>
5959
<property name="dependency-check-ant.version" value="4.0.2"/>
6060

6161
<property name="commons-io.version" value="2.6"/>
File renamed without changes.

dev/docker/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
FROM maven:3.6.1-jdk-11
21+
22+
RUN apt-get update
23+
RUN apt-get install -y g++ cmake autoconf libcppunit-dev libtool

dev/docker/run.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
set -e -x -u
19+
20+
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
21+
22+
export IMAGE_NAME="zookeeper/dev"
23+
24+
pushd ${SCRIPT_DIR}
25+
26+
docker build --rm=true -t ${IMAGE_NAME} .
27+
28+
popd
29+
30+
if [ "$(uname -s)" == "Linux" ]; then
31+
USER_NAME=${SUDO_USER:=$USER}
32+
USER_ID=$(id -u "${USER_NAME}")
33+
GROUP_ID=$(id -g "${USER_NAME}")
34+
LOCAL_HOME=$(realpath ~)
35+
else # boot2docker uid and gid
36+
USER_NAME=$USER
37+
USER_ID=1000
38+
GROUP_ID=50
39+
LOCAL_HOME="/Users/${USER_NAME}"
40+
fi
41+
42+
docker build -t "${IMAGE_NAME}-${USER_NAME}" - <<UserSpecificDocker
43+
FROM ${IMAGE_NAME}
44+
RUN groupadd --non-unique -g ${GROUP_ID} ${USER_NAME} && \
45+
useradd -g ${GROUP_ID} -u ${USER_ID} -k /root -m ${USER_NAME}
46+
ENV HOME /home/${USER_NAME}
47+
UserSpecificDocker
48+
49+
ZOOKEEPER_ROOT=${SCRIPT_DIR}/../..
50+
51+
CMD="
52+
echo
53+
echo 'Welcome to Apache ZooKeeper Development Env'
54+
echo 'To build, execute'
55+
echo ' mvn clean install'
56+
echo
57+
bash
58+
"
59+
60+
pushd ${ZOOKEEPER_ROOT}
61+
62+
docker run -i -t \
63+
--rm=true \
64+
-w ${ZOOKEEPER_ROOT} \
65+
-u "${USER}" \
66+
-v "$(realpath $ZOOKEEPER_ROOT):${ZOOKEEPER_ROOT}" \
67+
-v "${LOCAL_HOME}:/home/${USER_NAME}" \
68+
${IMAGE_NAME}-${USER_NAME} \
69+
bash -c "${CMD}"
70+
71+
popd
72+

pom.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@
278278
<mockito.version>2.27.0</mockito.version>
279279
<hamcrest.version>1.3</hamcrest.version>
280280
<commons-cli.version>1.2</commons-cli.version>
281-
<netty.version>4.1.36.Final</netty.version>
281+
<netty.version>4.1.42.Final</netty.version>
282282
<jetty.version>9.4.18.v20190429</jetty.version>
283-
<jackson.version>2.9.9.3</jackson.version>
283+
<jackson.version>2.9.10</jackson.version>
284284
<json.version>1.1.1</json.version>
285285
<jline.version>2.11</jline.version>
286286
<snappy.version>1.1.7</snappy.version>
@@ -574,7 +574,7 @@
574574
<plugin>
575575
<groupId>org.owasp</groupId>
576576
<artifactId>dependency-check-maven</artifactId>
577-
<version>5.1.0</version>
577+
<version>5.2.1</version>
578578
</plugin>
579579
<plugin>
580580
<groupId>org.apache.maven.plugins</groupId>
@@ -588,12 +588,13 @@
588588
</dependency>
589589
</dependencies>
590590
<configuration>
591-
<configLocation>checkstyle.xml</configLocation>
591+
<configLocation>checkstyle-strict.xml</configLocation>
592592
<suppressionsLocation>checkstyleSuppressions.xml</suppressionsLocation>
593593
<encoding>UTF-8</encoding>
594594
<consoleOutput>true</consoleOutput>
595595
<failOnViolation>true</failOnViolation>
596596
<includeResources>false</includeResources>
597+
<includeTestResources>false</includeTestResources>
597598
<includeTestSourceDirectory>true</includeTestSourceDirectory>
598599
</configuration>
599600
<executions>

zookeeper-client/zookeeper-client-c/src/zookeeper.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2716,9 +2716,12 @@ static void deserialize_response(zhandle_t *zh, int type, int xid, int failed, i
27162716
cptr->c.string_result(rc, 0, cptr->data);
27172717
} else {
27182718
struct CreateResponse res;
2719+
const char *client_path;
27192720
memset(&res, 0, sizeof(res));
27202721
deserialize_CreateResponse(ia, "reply", &res);
2721-
cptr->c.string_result(rc, res.path, cptr->data);
2722+
client_path = sub_string(zh, res.path);
2723+
cptr->c.string_result(rc, client_path, cptr->data);
2724+
free_duplicate_path(client_path, res.path);
27222725
deallocate_CreateResponse(&res);
27232726
}
27242727
break;
@@ -2729,8 +2732,11 @@ static void deserialize_response(zhandle_t *zh, int type, int xid, int failed, i
27292732
cptr->c.string_stat_result(rc, 0, 0, cptr->data);
27302733
} else {
27312734
struct Create2Response res;
2735+
const char *client_path;
27322736
deserialize_Create2Response(ia, "reply", &res);
2733-
cptr->c.string_stat_result(rc, res.path, &res.stat, cptr->data);
2737+
client_path = sub_string(zh, res.path);
2738+
cptr->c.string_stat_result(rc, client_path, &res.stat, cptr->data);
2739+
free_duplicate_path(client_path, res.path);
27342740
deallocate_Create2Response(&res);
27352741
}
27362742
break;

zookeeper-client/zookeeper-client-c/tests/TestClient.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,10 @@ class Zookeeper_simpleSystem : public CPPUNIT_NS::TestFixture
450450

451451
static void create_completion_fn(int rc, const char* value, const void *data) {
452452
CPPUNIT_ASSERT_EQUAL((int) ZOK, rc);
453+
if (data) {
454+
const char *expected_value = (const char *)data;
455+
CPPUNIT_ASSERT_EQUAL(string(expected_value), string(value));
456+
}
453457
count++;
454458
}
455459

@@ -991,6 +995,12 @@ class Zookeeper_simpleSystem : public CPPUNIT_NS::TestFixture
991995
rc = zoo_create(zk_ch, path, "", 0, &ZOO_OPEN_ACL_UNSAFE, 0, path_buffer, path_buffer_len);
992996
CPPUNIT_ASSERT_EQUAL((int) ZOK, rc);
993997
CPPUNIT_ASSERT_EQUAL(string(path), string(path_buffer));
998+
999+
const char* path2282 = "/zookeeper2282";
1000+
rc = zoo_acreate(zk_ch, path2282, "", 0, &ZOO_OPEN_ACL_UNSAFE, 0,
1001+
create_completion_fn, path2282);
1002+
waitForCreateCompletion(3);
1003+
CPPUNIT_ASSERT(count == 0);
9941004
}
9951005

9961006
// Test creating normal handle via zookeeper_init then explicitly setting callback

zookeeper-contrib/pom.xml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,40 @@
6363
</compilerArgs>
6464
</configuration>
6565
</plugin>
66+
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-checkstyle-plugin</artifactId>
70+
<version>3.1.0</version>
71+
<dependencies>
72+
<dependency>
73+
<groupId>com.puppycrawl.tools</groupId>
74+
<artifactId>checkstyle</artifactId>
75+
<version>${checkstyle.version}</version>
76+
</dependency>
77+
</dependencies>
78+
<configuration>
79+
<configLocation>checkstyle-simple.xml</configLocation>
80+
<suppressionsLocation>checkstyleSuppressions.xml</suppressionsLocation>
81+
<encoding>UTF-8</encoding>
82+
<consoleOutput>true</consoleOutput>
83+
<failOnViolation>true</failOnViolation>
84+
<includeResources>false</includeResources>
85+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
86+
<includeTestResources>false</includeTestResources>
87+
</configuration>
88+
<executions>
89+
<execution>
90+
<id>checkstyle</id>
91+
<phase>validate</phase>
92+
<goals>
93+
<goal>check</goal>
94+
</goals>
95+
</execution>
96+
</executions>
97+
</plugin>
6698
</plugins>
6799
</pluginManagement>
68100
</build>
69101

70-
</project>
102+
</project>

zookeeper-docs/src/main/resources/markdown/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ archives.
3838
Documents for Developers using the ZooKeeper Client API
3939
+ [API Docs](api/index.html) - the technical reference to ZooKeeper Client APIs
4040
+ [Programmer's Guide](zookeeperProgrammers.html) - a client application developer's guide to ZooKeeper
41+
+ [ZooKeeper Use Cases](zookeeperUseCases.html) - a series of use cases using the ZooKeeper.
4142
+ [ZooKeeper Java Example](javaExample.html) - a simple Zookeeper client application, written in Java
4243
+ [Barrier and Queue Tutorial](zookeeperTutorial.html) - sample implementations of barriers and queues
4344
+ [ZooKeeper Recipes](recipes.html) - higher level solutions to common problems in distributed applications

0 commit comments

Comments
 (0)