Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zk client config update and bugfix for ZKMetadataClientDriver #2958

Merged
merged 4 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public abstract class AbstractConfiguration<T extends AbstractConfiguration>
// Zookeeper Parameters
protected static final String ZK_TIMEOUT = "zkTimeout";
protected static final String ZK_SERVERS = "zkServers";
protected static final String ZK_RETRY_BACKOFF_MAX_RETRIES = "zkRetryBackoffMaxRetries";

// Ledger Manager
protected static final String LEDGER_MANAGER_TYPE = "ledgerManagerType";
Expand Down Expand Up @@ -345,6 +346,27 @@ public T setZkTimeout(int zkTimeout) {
return getThis();
}

/**
* Get zookeeper client backoff max retry times.
*
* @return zk backoff max retry times.
*/
public int getZkRetryBackoffMaxRetries() {
return getInt(ZK_RETRY_BACKOFF_MAX_RETRIES, Integer.MAX_VALUE);
}

/**
* Set zookeeper client backoff max retry times.
*
* @param maxRetries
* backoff max retry times
* @return server configuration.
*/
public T setZkRetryBackoffMaxRetries(int maxRetries) {
setProperty(ZK_RETRY_BACKOFF_MAX_RETRIES, Integer.toString(maxRetries));
return getThis();
}

/**
* Set Ledger Manager Type.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public synchronized MetadataBookieDriver initialize(ServerConfiguration conf,
conf,
statsLogger.scope(BOOKIE_SCOPE),
new BoundExponentialBackoffRetryPolicy(conf.getZkRetryBackoffStartMs(),
conf.getZkRetryBackoffMaxMs(), Integer.MAX_VALUE),
conf.getZkRetryBackoffMaxMs(), conf.getZkRetryBackoffMaxRetries()),
Optional.empty());
this.serverConf = conf;
this.statsLogger = statsLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public synchronized MetadataClientDriver initialize(ClientConfiguration conf,
new BoundExponentialBackoffRetryPolicy(
conf.getZkTimeout(),
conf.getZkTimeout(),
0),
conf.getZkRetryBackoffMaxRetries()),
optionalCtx);
this.statsLogger = statsLogger;
this.clientConf = conf;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public static ServerConfiguration newServerConfiguration() {
confReturn.setAllocatorPoolingPolicy(PoolingPolicy.UnpooledHeap);
confReturn.setProperty(DbLedgerStorage.WRITE_CACHE_MAX_SIZE_MB, 4);
confReturn.setProperty(DbLedgerStorage.READ_AHEAD_CACHE_MAX_SIZE_MB, 4);
/**
* if testcase has zk error,just try 0 time for fast running
*/
confReturn.setZkRetryBackoffMaxRetries(0);
setLoopbackInterfaceAndAllowLoopback(confReturn);
return confReturn;
}
Expand Down Expand Up @@ -89,6 +93,10 @@ public static ServerConfiguration setLoopbackInterfaceAndAllowLoopback(ServerCon
public static ClientConfiguration newClientConfiguration() {
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setTLSEnabledProtocols("TLSv1.2,TLSv1.1");
/**
* if testcase has zk error,just try 0 time for fast running
*/
clientConfiguration.setZkRetryBackoffMaxRetries(0);
return clientConfiguration;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public RegistrationServiceProvider(ServerConfiguration bkServerConf,
this.bkZkRetryPolicy = new BoundExponentialBackoffRetryPolicy(
bkServerConf.getZkRetryBackoffStartMs(),
bkServerConf.getZkRetryBackoffMaxMs(),
Integer.MAX_VALUE);
bkServerConf.getZkRetryBackoffMaxRetries());
this.regExecutor = Executors.newSingleThreadScheduledExecutor(
new ThreadFactoryBuilder().setNameFormat("registration-service-provider-scheduler").build());
ClientConfiguration clientConfiguration = new ClientConfiguration(bkServerConf);
Expand Down