This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 5c9b72a9880 [improve][pip] PIP-301: Introduce LoadBalanceResources to
unify the load-date CRUD (#21129)
5c9b72a9880 is described below
commit 5c9b72a9880cfe6f09c28de910a1be2f7f139085
Author: houxiaoyu <[email protected]>
AuthorDate: Mon Sep 25 10:11:28 2023 +0800
[improve][pip] PIP-301: Introduce LoadBalanceResources to unify the
load-date CRUD (#21129)
---
pip/pip-301.md | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/pip/pip-301.md b/pip/pip-301.md
new file mode 100644
index 00000000000..3450446b209
--- /dev/null
+++ b/pip/pip-301.md
@@ -0,0 +1,86 @@
+# Background knowledge
+
+The following z-nodes store the load and quota data about loadbalance. And the
CRUD about them are handled by `localMetadataStore`, not
`configurationMetadataStore`.
+* `/loadbalance/bundle-data`
+* `/loadbalance/broker-time-average`
+* `/loadbalance/resource-quota`
+
+Currently, the access about the above z-nodes are distributed everywhere. It's
very easy to call the the wrong `configurationMetadataStore` to handle them,
e.g.:
+* [[fix] [broker] remove bundle-data in local metadata
store.](https://github.com/apache/pulsar/pull/21078)
+
+# Motivation
+
+Refactor the access code about balance/load data
+
+# Goals
+
+## In Scope
+
+Introduce `LoadBalanceResources` to unify the CRUD about balance/load data.
+
+## Out of Scope
+
+None
+
+# High Level Design
+
+Introduce `LoadBalanceResources` which has three inner class:
+* `BundleDataResources`
+* `BrokerTimeAverageResources`
+* `QuotaResources`
+
+# Detailed Design
+
+## Design & Implementation Details
+
+```java
+public class LoadBalanceResources {
+ public static final String BUNDLE_DATA_BASE_PATH =
"/loadbalance/bundle-data";
+ public static final String BROKER_TIME_AVERAGE_BASE_PATH =
"/loadbalance/broker-time-average";
+ public static final String RESOURCE_QUOTA_BASE_PATH =
"/loadbalance/resource-quota";
+
+ private final BundleDataResources bundleDataResources;
+
+ public LoadBalanceResources(MetadataStore store, int operationTimeoutSec) {
+ bundleDataResources = new BundleDataResources(store,
operationTimeoutSec);
+ }
+
+ public static class BundleDataResources extends BaseResources<BundleData> {
+ public BundleDataResources(MetadataStore store, int
operationTimeoutSec) {
+ super(store, BundleData.class, operationTimeoutSec);
+ }
+ // ...
+ }
+
+ public static class BrokerTimeAverageResources extends
BaseResources<TimeAverageBrokerData> {
+ public BrokerTimeAverageResources(MetadataStore store, int
operationTimeoutSec) {
+ super(store, TimeAverageBrokerData.class, operationTimeoutSec);
+ }
+ // ...
+ }
+
+ public static class QuotaResources extends BaseResources<ResourceQuota> {
+ public QuotaResources(MetadataStore store, int operationTimeoutSec) {
+ super(store, ResourceQuota.class, operationTimeoutSec);
+ }
+ // ...
+ }
+}
+```
+
+## Public-facing Changes
+
+None
+
+### Public API
+
+None
+
+# Backward & Forward Compatibility
+
+None
+
+# Links
+
+* Mailing List discussion thread:
https://lists.apache.org/thread/7ngw9dc62tj2c4c5484dgsnlwgtstpbj
+* Mailing List voting thread:
https://lists.apache.org/thread/26dc8r6hnp7owdsq1hpzb48g8vlfrtxt