Return-Path: Delivered-To: apmail-hadoop-zookeeper-commits-archive@minotaur.apache.org Received: (qmail 22496 invoked from network); 5 Feb 2009 21:16:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Feb 2009 21:16:24 -0000 Received: (qmail 85241 invoked by uid 500); 5 Feb 2009 21:16:24 -0000 Delivered-To: apmail-hadoop-zookeeper-commits-archive@hadoop.apache.org Received: (qmail 85226 invoked by uid 500); 5 Feb 2009 21:16:24 -0000 Mailing-List: contact zookeeper-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: zookeeper-dev@ Delivered-To: mailing list zookeeper-commits@hadoop.apache.org Received: (qmail 85215 invoked by uid 99); 5 Feb 2009 21:16:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Feb 2009 13:16:24 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Feb 2009 21:16:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EA3BB23888AF; Thu, 5 Feb 2009 21:16:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r741294 - in /hadoop/zookeeper/trunk: CHANGES.txt src/c/Makefile.am src/c/include/zookeeper.h src/c/include/zookeeper_version.h src/c/src/cli.c src/c/src/zookeeper.c src/c/tests/TestClient.cc src/contrib/zkfuse/src/zkadapter.cc Date: Thu, 05 Feb 2009 21:16:02 -0000 To: zookeeper-commits@hadoop.apache.org From: mahadev@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090205211602.EA3BB23888AF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mahadev Date: Thu Feb 5 21:16:02 2009 New Revision: 741294 URL: http://svn.apache.org/viewvc?rev=741294&view=rev Log: ZOOKEEPER-293. zoo_set needs to be abi compatible (3.1 changed the signature), fix this by adding zoo_set2 (pat via mahadev) Added: hadoop/zookeeper/trunk/src/c/include/zookeeper_version.h Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/src/c/Makefile.am hadoop/zookeeper/trunk/src/c/include/zookeeper.h hadoop/zookeeper/trunk/src/c/src/cli.c hadoop/zookeeper/trunk/src/c/src/zookeeper.c hadoop/zookeeper/trunk/src/c/tests/TestClient.cc hadoop/zookeeper/trunk/src/contrib/zkfuse/src/zkadapter.cc Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=741294&r1=741293&r2=741294&view=diff ============================================================================== --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Thu Feb 5 21:16:02 2009 @@ -106,6 +106,12 @@ ZOOKEEPER-291. regression for legacy code using KeeperException.Code constants (due to 246). (pat via mahadev) + ZOOKEEPER-255. zoo_set() api does not return stat datastructure. + (avery ching via mahadev) + + ZOOKEEPER-293. zoo_set needs to be abi compatible (3.1 changed the +signature), fix this by adding zoo_set2 (pat via mahadev) + IMPROVEMENTS: ZOOKEEPER-64. Log system env information when initializing server and Modified: hadoop/zookeeper/trunk/src/c/Makefile.am URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/Makefile.am?rev=741294&r1=741293&r2=741294&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/c/Makefile.am (original) +++ hadoop/zookeeper/trunk/src/c/Makefile.am Thu Feb 5 21:16:02 2009 @@ -7,7 +7,7 @@ LIB_LDFLAGS = -no-undefined -version-info 2 -pkginclude_HEADERS = include/zookeeper.h include/recordio.h generated/zookeeper.jute.h +pkginclude_HEADERS = include/zookeeper.h include/zookeeper_version.h include/recordio.h generated/zookeeper.jute.h EXTRA_DIST=LICENSE HASHTABLE_SRC = src/hashtable/hashtable_itr.h src/hashtable/hashtable_itr.c \ @@ -16,7 +16,7 @@ noinst_LTLIBRARIES = libhashtable.la libhashtable_la_SOURCES = $(HASHTABLE_SRC) -COMMON_SRC = src/zookeeper.c include/zookeeper.h \ +COMMON_SRC = src/zookeeper.c include/zookeeper.h include/zookeeper_version.h \ src/recordio.c include/recordio.h include/proto.h \ src/zk_adaptor.h generated/zookeeper.jute.c \ src/zk_log.h src/zk_log.c src/zk_hashtable.h src/zk_hashtable.c Modified: hadoop/zookeeper/trunk/src/c/include/zookeeper.h URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/include/zookeeper.h?rev=741294&r1=741293&r2=741294&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/c/include/zookeeper.h (original) +++ hadoop/zookeeper/trunk/src/c/include/zookeeper.h Thu Feb 5 21:16:02 2009 @@ -21,6 +21,8 @@ #include #include + +#include "zookeeper_version.h" #include "recordio.h" #include "zookeeper.jute.h" @@ -1089,7 +1091,8 @@ char *buffer, int* buffer_len, struct Stat *stat); /** - * \brief sets the data associated with a node. + * \brief sets the data associated with a node. See zoo_set2 function if + * you require access to the stat information associated with the znode. * * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init * \param path the name of the node. Expressed as a file name with slashes @@ -1099,7 +1102,6 @@ * \param version the expected version of the node. The function will fail if * the actual version of the node does not match the expected version. If -1 is * used the version check will not take place. - * \param stat if not NULL, will hold the value of stat for the path on return. * \return the return code for the function call. * ZOK operation completed succesfully * ZNONODE the node does not exist. @@ -1110,6 +1112,32 @@ * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory */ ZOOAPI int zoo_set(zhandle_t *zh, const char *path, const char *buffer, + int buflen, int version); + +/** + * \brief sets the data associated with a node. This function is the same + * as zoo_set except that it also provides access to stat information + * associated with the znode. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param buffer the buffer holding data to be written to the node. + * \param buflen the number of bytes from buffer to write. + * \param version the expected version of the node. The function will fail if + * the actual version of the node does not match the expected version. If -1 is + * used the version check will not take place. + * \param stat if not NULL, will hold the value of stat for the path on return. + * \return the return code for the function call. + * ZOK operation completed succesfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADVERSION expected version does not match actual version. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_set2(zhandle_t *zh, const char *path, const char *buffer, int buflen, int version, struct Stat *stat); /** Added: hadoop/zookeeper/trunk/src/c/include/zookeeper_version.h URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/include/zookeeper_version.h?rev=741294&view=auto ============================================================================== --- hadoop/zookeeper/trunk/src/c/include/zookeeper_version.h (added) +++ hadoop/zookeeper/trunk/src/c/include/zookeeper_version.h Thu Feb 5 21:16:02 2009 @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef ZOOKEEPER_VERSION_H_ +#define ZOOKEEPER_VERSION_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZOO_MAJOR_VERSION 3 +#define ZOO_MINOR_VERSION 2 +#define ZOO_PATCH_VERSION 0 + +#ifdef __cplusplus +} +#endif + +#endif /* ZOOKEEPER_VERSION_H_ */ Modified: hadoop/zookeeper/trunk/src/c/src/cli.c URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/cli.c?rev=741294&r1=741293&r2=741294&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/c/src/cli.c (original) +++ hadoop/zookeeper/trunk/src/c/src/cli.c Thu Feb 5 21:16:02 2009 @@ -277,7 +277,7 @@ strdup(line)); } else { struct Stat stat; - rc = zoo_set(zh, line, ptr, strlen(ptr), -1, &stat); + rc = zoo_set2(zh, line, ptr, strlen(ptr), -1, &stat); } if (rc) { fprintf(stderr, "Error %d for %s\n", rc, line); @@ -400,6 +400,11 @@ fprintf(stderr, "USAGE %s zookeeper_host_list [clientid_file|cmd:(ls|create|od|...)]\n", argv[0]); + fprintf(stderr, + "Version: ZooKeeper cli (c client) version %d.%d.%d\n", + ZOO_MAJOR_VERSION, + ZOO_MINOR_VERSION, + ZOO_PATCH_VERSION); return 2; } if (argc > 2) { Modified: hadoop/zookeeper/trunk/src/c/src/zookeeper.c URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/src/zookeeper.c?rev=741294&r1=741293&r2=741294&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/c/src/zookeeper.c (original) +++ hadoop/zookeeper/trunk/src/c/src/zookeeper.c Thu Feb 5 21:16:02 2009 @@ -2491,6 +2491,12 @@ } int zoo_set(zhandle_t *zh, const char *path, const char *buffer, int buflen, + int version) +{ + return zoo_set2(zh, path, buffer, buflen, version, 0); +} + +int zoo_set2(zhandle_t *zh, const char *path, const char *buffer, int buflen, int version, struct Stat *stat) { struct sync_completion *sc = alloc_sync_completion(); Modified: hadoop/zookeeper/trunk/src/c/tests/TestClient.cc URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/c/tests/TestClient.cc?rev=741294&r1=741293&r2=741294&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/c/tests/TestClient.cc (original) +++ hadoop/zookeeper/trunk/src/c/tests/TestClient.cc Thu Feb 5 21:16:02 2009 @@ -443,15 +443,15 @@ CPPUNIT_ASSERT(ctxLocal->countEvents() == 0); - rc = zoo_set(zk, "/watchtest/child", "1", 1, -1, 0); + rc = zoo_set(zk, "/watchtest/child", "1", 1, -1); CPPUNIT_ASSERT_EQUAL((int)ZOK, rc); struct Stat stat1, stat2; - rc = zoo_set(zk, "/watchtest/child", "1", 1, -1, &stat1); + rc = zoo_set2(zk, "/watchtest/child", "1", 1, -1, &stat1); CPPUNIT_ASSERT_EQUAL((int)ZOK, rc); CPPUNIT_ASSERT(stat1.version >= 0); - rc = zoo_set(zk, "/watchtest/child", "1", 1, stat1.version, &stat2); + rc = zoo_set2(zk, "/watchtest/child", "1", 1, stat1.version, &stat2); CPPUNIT_ASSERT_EQUAL((int)ZOK, rc); - rc = zoo_set(zk, "/watchtest/child", "1", 1, stat2.version, 0); + rc = zoo_set(zk, "/watchtest/child", "1", 1, stat2.version); CPPUNIT_ASSERT_EQUAL((int)ZOK, rc); rc = zoo_create(zk, "/watchtest/child2", "", 0, &ZOO_OPEN_ACL_UNSAFE, 0, 0, 0); Modified: hadoop/zookeeper/trunk/src/contrib/zkfuse/src/zkadapter.cc URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkfuse/src/zkadapter.cc?rev=741294&r1=741293&r2=741294&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/contrib/zkfuse/src/zkadapter.cc (original) +++ hadoop/zookeeper/trunk/src/contrib/zkfuse/src/zkadapter.cc Thu Feb 5 21:16:02 2009 @@ -867,8 +867,7 @@ path.c_str(), value.c_str(), value.length(), - version, - 0); + version); } while (rc != ZOK && rh.handleRC(rc)); if (rc != ZOK) { LOG_ERROR( LOG, "Error %d for %s", rc, path.c_str() );