Skip to content

Conversation

@massakam
Copy link
Contributor

@massakam massakam commented Jun 24, 2022

Motivation

With BP-41, the BookKeeper client now needs a request to ZooKeeper to resolve the address from each bookie ID.

In the following document, there is a description of the flag enableBookieAddressResolver bookieAddressResolverEnabled for disabling this feature by regarding the bookie ID as an address or hostname, but it seems that this has not been implemented yet.
https://github.com/apache/bookkeeper/blob/master/site3/website/src/pages/bps/BP-41-bookieid.md

I implemented this because I want this flag to reduce the number of requests to ZK.

Changes

Added a flag named enableBookieAddressResolver bookieAddressResolverEnabled to the client configuration. If this flag is false, use BookieAddressResolverDisabled instead of DefaultBookieAddressResolver as the address resolver for bookies. BookieAddressResolverDisabled regards a bookie ID to be in legacy format, i.e. "address:port" or "hostname:port", and returns the address of that bookie without access to ZK.

Master Issue: #2396

@massakam massakam force-pushed the disable-bookie-address-resolver branch 3 times, most recently from d8a0184 to 1af2c49 Compare June 24, 2022 12:16
Copy link
Contributor

@dlg99 dlg99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@StevenLuMT StevenLuMT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change ServerConfiguration to ClientConfiguration in
tools/ledger/src/test/java/org/apache/bookkeeper/tools/cli/helpers/DiscoveryCommandTest.java ?

*
* @return flag to enable/disable BookieAddressResolver.
*/
public boolean getEnableBookieAddressResolver() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old code style is getBookieAddressResolverEnable
I think it's better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StevenLuMT Renamed to "getBookieAddressResolverEnabled". What do you think?

* flag to enable/disable BookieAddressResolver.
* @return client configuration.
*/
public ClientConfiguration setEnableBookieAddressResolver(boolean enabled) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setBookieAddressResolverEnable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to "setBookieAddressResolverEnabled".


this.serverConf = new ServerConfiguration();
this.serverConf.setMetadataServiceUri("zk://127.0.0.1/path/to/ledgers");
this.clientConf = new ClientConfiguration();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change ServerConfiguration to ClientConfiguration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StevenLuMT The bookieAddressResolverEnabled added this time is a client-side setting, so it cannot be set for ServerConfiguration. I replaced ServerConfiguration with ClientConfiguration because I want to test the behavior of bookieAddressResolverEnabled when it is true and when it is false.

Also, I think that ClientConfiguration is more appropriate than ServerConfiguration to pass as the first argument of DiscoveryCommand#apply().

protected boolean apply(ClientConfiguration clientConf, DiscoveryFlagsT cmdFlags) {

Even if ServerConfiguration is passed, it will be converted to ClientConfiguration internally.

public boolean apply(ServerConfiguration conf,
ClientFlagsT cmdFlags) {
ClientConfiguration clientConf = new ClientConfiguration(conf);
return apply(clientConf, cmdFlags);
}

@massakam massakam force-pushed the disable-bookie-address-resolver branch from 1af2c49 to c1f48bf Compare July 27, 2022 03:39
@massakam
Copy link
Contributor Author

rerun failure checks

@massakam
Copy link
Contributor Author

PTAL

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I have left a little comment, please take a look

* Resolve legacy style BookieIDs to Network addresses.
*/
@Slf4j
public class BookieAddressResolverDisabled implements BookieAddressResolver {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eolivelli Added final modifier. Thanks.

Copy link
Member

@StevenLuMT StevenLuMT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@hangc0276 hangc0276 merged commit c31dff9 into apache:master Jul 31, 2022
@massakam massakam deleted the disable-bookie-address-resolver branch August 1, 2022 02:44
zymap pushed a commit that referenced this pull request Aug 2, 2022
### Motivation

With BP-41, the BookKeeper client now needs a request to ZooKeeper to resolve the address from each bookie ID.

In the following document, there is a description of the flag ~`enableBookieAddressResolver`~ `bookieAddressResolverEnabled` for disabling this feature by regarding the bookie ID as an address or hostname, but it seems that this has not been implemented yet.
https://github.com/apache/bookkeeper/blob/master/site3/website/src/pages/bps/BP-41-bookieid.md

I implemented this because I want this flag to reduce the number of requests to ZK.

### Changes

Added a flag named ~`enableBookieAddressResolver`~ `bookieAddressResolverEnabled` to the client configuration. If this flag is false, use `BookieAddressResolverDisabled` instead of `DefaultBookieAddressResolver` as the address resolver for bookies. `BookieAddressResolverDisabled` regards a bookie ID to be in legacy format, i.e. "address:port" or "hostname:port", and returns the address of that bookie without access to ZK.

Master Issue: #2396

(cherry picked from commit c31dff9)
Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024
### Motivation

With BP-41, the BookKeeper client now needs a request to ZooKeeper to resolve the address from each bookie ID.

In the following document, there is a description of the flag ~`enableBookieAddressResolver`~ `bookieAddressResolverEnabled` for disabling this feature by regarding the bookie ID as an address or hostname, but it seems that this has not been implemented yet.
https://github.com/apache/bookkeeper/blob/master/site3/website/src/pages/bps/BP-41-bookieid.md

I implemented this because I want this flag to reduce the number of requests to ZK.

### Changes

Added a flag named ~`enableBookieAddressResolver`~ `bookieAddressResolverEnabled` to the client configuration. If this flag is false, use `BookieAddressResolverDisabled` instead of `DefaultBookieAddressResolver` as the address resolver for bookies. `BookieAddressResolverDisabled` regards a bookie ID to be in legacy format, i.e. "address:port" or "hostname:port", and returns the address of that bookie without access to ZK.

Master Issue: apache#2396
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants