You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/03/19 13:19:49 UTC
[GitHub] [pulsar] tuteng opened a new pull request #9975: Add get version command for pulsar rest api, pulsar-admin, pulsar-client
tuteng opened a new pull request #9975:
URL: https://github.com/apache/pulsar/pull/9975
*(If this PR fixes a github issue, please add `Fixes #<xyz>`.)*
Fixes https://github.com/apache/pulsar/issues/9969
### Motivation
Add the version command:
Get broker version by rest API:
```
curl http://localhost:8080/admin/v2/brokers/version
```
Get broker version by `pulsar-admin`:
```
./bin/pulsar-admin brokers version
```
Get broker version by the command `pulsar`:
```
./bin/pulsar version
```
Get version of pulsar admin client:
```
./bin/pulsar-admin -v
./bin/pulsra-admin --version
```
Get version of pulsar client:
```
./bin/pulsar-client -v
./bin/pulsra-client --version
```
### Modifications
* Add rest API for get version of broker
* Add getVersion for the command `pulsar`
* Add getVersion for the command `pulsar-admin`
* Add getVersion for the command `pulsar-client`
### Verifying this change
- [ ] Add unit test
- [ ] Add integration test
### Does this pull request potentially affect one of the following parts:
*If `yes` was chosen, please highlight the changes*
- Dependencies (does it add or upgrade a dependency): (yes / no)
- The public API: (yes / no)
- The schema: (yes / no / don't know)
- The default values of configurations: (yes / no)
- The wire protocol: (yes / no)
- The rest endpoints: (yes / no)
- The admin cli options: (yes / no)
- Anything that affects deployment: (yes / no / don't know)
### Documentation
- Does this pull request introduce a new feature? (yes / no)
- If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
- If a feature is not applicable for documentation, explain why?
- If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui commented on a change in pull request #9975: [api][pulsar-client]Add get version command for pulsar rest api, pulsar-admin, pulsar-client
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #9975:
URL: https://github.com/apache/pulsar/pull/9975#discussion_r598421546
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/PulsarVersionStarter.java
##########
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+package org.apache.pulsar;
+
+/**
+ * Pulsar version entry point.
+ */
+public class PulsarVersionStarter {
Review comment:
Do we need this change?
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] eolivelli commented on a change in pull request #9975: [api][pulsar-client]Add get version command for pulsar rest api, pulsar-admin, pulsar-client
Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #9975:
URL: https://github.com/apache/pulsar/pull/9975#discussion_r598764623
##########
File path: pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdBrokers.java
##########
@@ -146,6 +146,15 @@ void run() throws Exception {
}
+ @Parameters(commandDescription = "Get the version of the currently connected broker")
+ private class PulsarVersion extends CliCommand {
+
+ @Override
+ void run() throws Exception {
+ System.out.println( getAdmin().brokers().getVersion());
Review comment:
I believe that we have a little usability problem here.
The user does not know which broker reported the version.
Proposals:
- return the address of the broker that reported the version (a BrokerInfo structure ?)
- add a (optional) parameter to specify the id of the broker that we want to query
In a Pulsar cluster usually you have the same version of the software, but this may not be the case during upgrades or in case you have special versions of Pulsar on some nodes.
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] tuteng commented on a change in pull request #9975: [api][pulsar-client]Add get version command for pulsar rest api, pulsar-admin, pulsar-client
Posted by GitBox <gi...@apache.org>.
tuteng commented on a change in pull request #9975:
URL: https://github.com/apache/pulsar/pull/9975#discussion_r599153778
##########
File path: pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdBrokers.java
##########
@@ -146,6 +146,15 @@ void run() throws Exception {
}
+ @Parameters(commandDescription = "Get the version of the currently connected broker")
+ private class PulsarVersion extends CliCommand {
+
+ @Override
+ void run() throws Exception {
+ System.out.println( getAdmin().brokers().getVersion());
Review comment:
Thanks, I agree with you, but I think the current version of the broker can be queried explicitly using the `pulsar-admin brokers version` command, for example, the `pulsar-admin brokers version` command will use the `webServiceUrl` configuration in the `client.conf` configuration file, and of course, the `webServiceUrl` parameter can be used to specify the address of the broker to be queried by the command `pulsar-admin --admin-url`, In a pulsar cluster upgrade, multiple versions of the broker will exist at the same time, and with the `--admin-url` parameter, we can explicitly get the version of the specified broker
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Anonymitaet edited a comment on pull request #9975: [api][pulsar-client]Add get version command for pulsar rest api, pulsar-admin, pulsar-client
Posted by GitBox <gi...@apache.org>.
Anonymitaet edited a comment on pull request #9975:
URL: https://github.com/apache/pulsar/pull/9975#issuecomment-804504246
@tuteng thanks for your contribution.
For docs side:
- REST API & pulsar-admin
You've added descriptions, they will be shown on websites.
- pulsar-client
Think descriptions should be added to the [pulsar-client page](https://pulsar.apache.org/docs/en/next/reference-cli-tools/#pulsar-client).
Our community has submitted a request that it is better to generate the [pulsar-client page](https://pulsar.apache.org/docs/en/next/reference-cli-tools/#pulsar-client) (https://pulsar.apache.org/docs/en/next/pulsar-admin/) from code automatically for a long time. In this case, we do not need to add descriptions manually, which eats up much time. May I know the process of the automatic work? Many thanks
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] tuteng commented on pull request #9975: [api][pulsar-client]Add get version command for pulsar rest api, pulsar-admin, pulsar-client
Posted by GitBox <gi...@apache.org>.
tuteng commented on pull request #9975:
URL: https://github.com/apache/pulsar/pull/9975#issuecomment-804529830
@codelipenghui PTAL
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Anonymitaet commented on pull request #9975: [api][pulsar-client]Add get version command for pulsar rest api, pulsar-admin, pulsar-client
Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #9975:
URL: https://github.com/apache/pulsar/pull/9975#issuecomment-807787372
Add docs w/ other changes [here](https://github.com/apache/pulsar/pull/10037).
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui merged pull request #9975: [api][pulsar-client]Add get version command for pulsar rest api, pulsar-admin, pulsar-client
Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #9975:
URL: https://github.com/apache/pulsar/pull/9975
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] tuteng commented on a change in pull request #9975: [api][pulsar-client]Add get version command for pulsar rest api, pulsar-admin, pulsar-client
Posted by GitBox <gi...@apache.org>.
tuteng commented on a change in pull request #9975:
URL: https://github.com/apache/pulsar/pull/9975#discussion_r598444801
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/PulsarVersionStarter.java
##########
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+package org.apache.pulsar;
+
+/**
+ * Pulsar version entry point.
+ */
+public class PulsarVersionStarter {
Review comment:
Yes, I found that other commands such as `pulsar broker`, `pulsar proxy` are a public class with a `main` function, `pulsar version`, as a separate command, also needs to be a class with a `main` function, otherwise, it needs to be a subcommand of other commands
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Anonymitaet commented on pull request #9975: [api][pulsar-client]Add get version command for pulsar rest api, pulsar-admin, pulsar-client
Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #9975:
URL: https://github.com/apache/pulsar/pull/9975#issuecomment-804504246
@tuteng thanks for your contribution.
For docs side:
- REST API & pulsar-admin
You've added descriptions, they will be shown on websites.
- pulsar-client
Think descriptions should be added to the [pulsar-client page](https://pulsar.apache.org/docs/en/next/reference-cli-tools/#pulsar-client).
Our community has submitted a request that it is better to generate the [pulsar-client page](https://pulsar.apache.org/docs/en/next/reference-cli-tools/#pulsar-client) and the [pulsar-admin page](https://pulsar.apache.org/docs/en/next/pulsar-admin/) from code automatically for a long time. In this case, we do not need to add descriptions manually, which eats up much time. May I know the process of the automatic work? Many thanks
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] tuteng commented on a change in pull request #9975: [api][pulsar-client]Add get version command for pulsar rest api, pulsar-admin, pulsar-client
Posted by GitBox <gi...@apache.org>.
tuteng commented on a change in pull request #9975:
URL: https://github.com/apache/pulsar/pull/9975#discussion_r598444801
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/PulsarVersionStarter.java
##########
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+package org.apache.pulsar;
+
+/**
+ * Pulsar version entry point.
+ */
+public class PulsarVersionStarter {
Review comment:
Yes, I found that other commands such as `pulsar broker`, `pulsar proxy` are a public class with a `main` function, `pulsar version` as a separate command, also needs to be a class with a `main` function, otherwise, it needs to be a subcommand of other commands
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org