You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2022/06/11 11:13:03 UTC

[GitHub] [zookeeper] gjcarrette opened a new pull request, #1893: zookeeper 4556 function zoo_version_str

gjcarrette opened a new pull request, #1893:
URL: https://github.com/apache/zookeeper/pull/1893

   This implements https://issues.apache.org/jira/browse/ZOOKEEPER-4556
   
   The strongest use case for a function zoo_version_str is when an application is making use of https://sourceware.org/libffi/ or similar solution for their application language and wants to be sure that the preprocessed/cached C declarations it might use are consistent with the version of libzookeeper_mt.so that is available at runtime for dynamic loading with dlopen. The zookeeper_version.h may not be available at runtime depending on the deployment scenario for the application, and would require additional parsing toil if it were.
   
   The unit test is coded to work with any version of zookeeper, but the implementation
   would need to be adjusted to use the code shown in the referenced issue if this patch
   were to be back-ported to a 3.5 or earlier branch.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zookeeper] gjcarrette commented on a diff in pull request #1893: ZOOKEEPER-4556: function zoo_version_str

Posted by GitBox <gi...@apache.org>.
gjcarrette commented on code in PR #1893:
URL: https://github.com/apache/zookeeper/pull/1893#discussion_r917508301


##########
zookeeper-client/zookeeper-client-c/include/zookeeper.h:
##########
@@ -669,6 +669,20 @@ ZOOAPI sasl_callback_t *zoo_sasl_make_basic_callbacks(const char *user,
 
 #endif /* HAVE_CYRUS_SASL_H */
 
+
+/**
+ * \brief return the zookeeper MAJOR.MINOR.PATCH version as a string
+ *
+ * This method allows a calling program to determine at runtime if the
+ * version of the dynamically loaded zookeeper library is the same as
+ * the version of the library when the calling program was compiled.

Review Comment:
   Will do.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zookeeper] kezhuw commented on a diff in pull request #1893: ZOOKEEPER-4556: function zoo_version_str

Posted by GitBox <gi...@apache.org>.
kezhuw commented on code in PR #1893:
URL: https://github.com/apache/zookeeper/pull/1893#discussion_r903470163


##########
zookeeper-client/zookeeper-client-c/src/zookeeper.c:
##########
@@ -1295,6 +1295,14 @@ static void log_env(zhandle_t *zh) {
 #endif
 }
 
+/**
+ * Return string of "MAJOR.MINOR.PATCH"
+ */
+const char *zoo_version_str()
+{
+    return ZOO_VERSION;

Review Comment:
   Will this compile if backported to 3.5 ? I saw `ifdef` in test code. I think it might be better to backport `ZOO_VERSION` also if `zoo_version_str` is backported. Is it ok to introduce a new macro in patch version ? @eolivelli @ztzg 



##########
zookeeper-client/zookeeper-client-c/include/zookeeper.h:
##########
@@ -669,6 +669,20 @@ ZOOAPI sasl_callback_t *zoo_sasl_make_basic_callbacks(const char *user,
 
 #endif /* HAVE_CYRUS_SASL_H */
 
+
+/**
+ * \brief return the zookeeper MAJOR.MINOR.PATCH version as a string
+ *
+ * This method allows a calling program to determine at runtime if the
+ * version of the dynamically loaded zookeeper library is the same as
+ * the version of the library when the calling program was compiled.

Review Comment:
   It might be nice to mention `ZOO_VERSION` here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ZOOKEEPER-4556: Add zoo_version_str to return ZOO_VERSION for runtime library [zookeeper]

Posted by "kezhuw (via GitHub)" <gi...@apache.org>.
kezhuw commented on PR #1893:
URL: https://github.com/apache/zookeeper/pull/1893#issuecomment-2995245363

   @gjcarrette Thank you for your contribution!
   
   Merged since it has been approved years ago. The only thing I have done is rebasing and documentation refinement.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zookeeper] tisonkun commented on a diff in pull request #1893: ZOOKEEPER-4556: function zoo_version_str

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun commented on code in PR #1893:
URL: https://github.com/apache/zookeeper/pull/1893#discussion_r1134920480


##########
zookeeper-client/zookeeper-client-c/tests/TestZookeeperInit.cc:
##########
@@ -90,6 +91,20 @@ class Zookeeper_init : public CPPUNIT_NS::TestFixture
 #endif
     }
 
+    void testVersion()
+    {
+        char EXPECTED_VERSION_STR[256];
+        EXPECTED_VERSION_STR[0] = 0;
+#ifdef ZOO_VERSION
+	snprintf(EXPECTED_VERSION_STR, sizeof(EXPECTED_VERSION_STR), "%s", ZOO_VERSION);
+#endif
+#ifdef ZOO_VERSION_MAJOR

Review Comment:
   Since the version macro change is introduced https://github.com/apache/zookeeper/commit/253673f30431344030509b974bd2f65d23c1cd6e in 3.6.0, I don't think we will do backport that needs this branch. That is, we can retain only:
   
   ```c
   snprintf(EXPECTED_VERSION_STR, sizeof(EXPECTED_VERSION_STR), "%s", ZOO_VERSION);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zookeeper] eolivelli commented on a diff in pull request #1893: ZOOKEEPER-4556: function zoo_version_str

Posted by GitBox <gi...@apache.org>.
eolivelli commented on code in PR #1893:
URL: https://github.com/apache/zookeeper/pull/1893#discussion_r903552648


##########
zookeeper-client/zookeeper-client-c/src/zookeeper.c:
##########
@@ -1295,6 +1295,14 @@ static void log_env(zhandle_t *zh) {
 #endif
 }
 
+/**
+ * Return string of "MAJOR.MINOR.PATCH"
+ */
+const char *zoo_version_str()
+{
+    return ZOO_VERSION;

Review Comment:
   3.5 is EOL, we don't expect any other commits on 3.5



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [zookeeper] iiipolei commented on pull request #1893: ZOOKEEPER-4556: function zoo_version_str

Posted by GitBox <gi...@apache.org>.
iiipolei commented on PR #1893:
URL: https://github.com/apache/zookeeper/pull/1893#issuecomment-1241763464

   > nks
   
   .


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ZOOKEEPER-4556: Add zoo_version_str to return ZOO_VERSION for runtime library [zookeeper]

Posted by "kezhuw (via GitHub)" <gi...@apache.org>.
kezhuw merged PR #1893:
URL: https://github.com/apache/zookeeper/pull/1893


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org