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

[ISSUE #2221]💫Optimize BrokerRuntimeInner#register_increment_broker_data🧑‍💻 #2222

Merged
merged 1 commit into from
Jan 12, 2025
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
13 changes: 6 additions & 7 deletions rocketmq-broker/src/broker_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@
}

pub async fn register_increment_broker_data(
&self,
this: ArcMut<BrokerRuntimeInner<MS>>,

Check warning on line 1201 in rocketmq-broker/src/broker_runtime.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-broker/src/broker_runtime.rs#L1201

Added line #L1201 was not covered by tests
topic_config_list: Vec<TopicConfig>,
data_version: DataVersion,
) {
Expand All @@ -1213,11 +1213,11 @@
let mut topic_config_table = HashMap::new();
for topic_config in topic_config_list.iter() {
let register_topic_config =
if !PermName::is_writeable(self.broker_config.broker_permission)
|| !PermName::is_readable(self.broker_config.broker_permission)
if !PermName::is_writeable(this.broker_config().broker_permission)
|| !PermName::is_readable(this.broker_config().broker_permission)

Check warning on line 1217 in rocketmq-broker/src/broker_runtime.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-broker/src/broker_runtime.rs#L1216-L1217

Added lines #L1216 - L1217 were not covered by tests
{
TopicConfig {
perm: topic_config.perm & self.broker_config.broker_permission,
perm: topic_config.perm & this.broker_config().broker_permission,

Check warning on line 1220 in rocketmq-broker/src/broker_runtime.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-broker/src/broker_runtime.rs#L1220

Added line #L1220 was not covered by tests
..topic_config.clone()
}
} else {
Expand All @@ -1233,7 +1233,7 @@
.topic_config_table = topic_config_table;
let mut topic_queue_mapping_info_map = HashMap::new();
for topic_config in topic_config_list {
if let Some(ref value) = self
if let Some(ref value) = this

Check warning on line 1236 in rocketmq-broker/src/broker_runtime.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-broker/src/broker_runtime.rs#L1236

Added line #L1236 was not covered by tests
.topic_queue_mapping_manager
.get_topic_queue_mapping(topic_config.topic_name.as_ref().unwrap().as_str())
{
Expand All @@ -1244,8 +1244,7 @@
}
}
serialize_wrapper.topic_queue_mapping_info_map = topic_queue_mapping_info_map;
/*self.do_register_broker_all(true, false, serialize_wrapper)
.await; TODO*/
Self::do_register_broker_all(this, true, false, serialize_wrapper).await;

Check warning on line 1247 in rocketmq-broker/src/broker_runtime.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-broker/src/broker_runtime.rs#L1247

Added line #L1247 was not covered by tests
}

async fn do_register_broker_all(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,19 @@
.register_single_topic_all(topic_config)
.await;
} else {
self.broker_runtime_inner
.topic_config_manager()
.broker_runtime_inner()
.register_increment_broker_data(
vec![topic_config],
self.broker_runtime_inner
.topic_config_manager()
.data_version()
.as_ref()
.clone(),
)
.await;
/* self.broker_runtime_inner
.topic_config_manager()
.broker_runtime_inner()*/
BrokerRuntimeInner::<MS>::register_increment_broker_data(
self.broker_runtime_inner.clone(),
vec![topic_config],
self.broker_runtime_inner
.topic_config_manager()
.data_version()
.as_ref()
.clone(),
)
.await;

Check warning on line 197 in rocketmq-broker/src/processor/admin_broker_processor/topic_request_handler.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-broker/src/processor/admin_broker_processor/topic_request_handler.rs#L188-L197

Added lines #L188 - L197 were not covered by tests
}

Some(response.set_code(ResponseCode::Success))
Expand Down Expand Up @@ -291,18 +292,16 @@
.await;
}
} else {
self.broker_runtime_inner
.topic_config_manager()
.broker_runtime_inner()
.register_increment_broker_data(
request_body.topic_config_list,
self.broker_runtime_inner
.topic_config_manager()
.data_version()
.as_ref()
.clone(),
)
.await;
BrokerRuntimeInner::<MS>::register_increment_broker_data(
self.broker_runtime_inner.clone(),
request_body.topic_config_list,
self.broker_runtime_inner
.topic_config_manager()
.data_version()
.as_ref()
.clone(),
)
.await;

Check warning on line 304 in rocketmq-broker/src/processor/admin_broker_processor/topic_request_handler.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-broker/src/processor/admin_broker_processor/topic_request_handler.rs#L295-L304

Added lines #L295 - L304 were not covered by tests
}
Some(response.set_code(ResponseCode::Success))
}
Expand Down
Loading