You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "89799969 (via GitHub)" <gi...@apache.org> on 2026/09/09 15:01:01 UTC
[PR] [studio][ISSUE #4201] Evict data-source cache after instance deletion [rocketmq-dashboard]
89799969 opened a new pull request, #4202:
URL: https://github.com/apache/rocketmq-dashboard/pull/4202
## What is the purpose of the change
Fixes #4201.
After #4049, both full and paged data-source inventories are cached. InstanceService.deleteInstance updates DataSourceVO.instanceIds through SettingsRepository directly, bypassing the cache-eviction annotations in SettingsService. A successful deletion can therefore leave both cached inventories exposing the old instance binding.
This change invalidates the shared data-source cache only after the instance-deletion transaction commits. A rollback keeps the existing cache intact, and callers without active transaction synchronization retain the previous immediate-cleanup behavior.
## Brief changelog
- centralize the shared data-source cache name
- clear that cache after a successful instance-deletion commit
- keep endpoint/client cleanup on the same post-commit boundary
- add regression coverage for binding removal, cache eviction, and commit timing
## Verifying this change
- Focused tests: InstanceServiceTest and SettingsServiceCachingTest
- 84 tests run, 0 failures, 0 errors, 0 skipped
- Checkstyle: 0 violations
- The full server suite was also attempted, but this Windows host reported unrelated Java loopback-socket failures in HTTP/client tests plus two AuthCors assertions; no full-suite pass is claimed, and CI can provide clean-host coverage.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [studio][ISSUE #4201] Evict data-source cache after instance deletion [rocketmq-dashboard]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on code in PR #4202:
URL: https://github.com/apache/rocketmq-dashboard/pull/4202#discussion_r3970263542
##########
server/src/main/java/org/apache/rocketmq/studio/instance/InstanceService.java:
##########
@@ -639,22 +643,31 @@ public void deleteInstance(Long id) {
removeDataSourceBindings(existing.getName());
recordAudit("DELETE_INSTANCE", "INSTANCE", String.valueOf(id), null,
instanceAuditDetail(existing));
- releaseApacheEndpointAfterCommit(existing);
+ completeInstanceDeletionAfterCommit(existing);
}
- private void releaseApacheEndpointAfterCommit(InstanceVO existing) {
+ private void completeInstanceDeletionAfterCommit(InstanceVO existing) {
if (!TransactionSynchronizationManager.isSynchronizationActive()) {
+ evictDataSourceCache();
releaseApacheEndpointIfUnused(existing, null);
return;
}
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
+ evictDataSourceCache();
releaseApacheEndpointIfUnused(existing, null);
Review Comment:
**[Info]** The cache eviction here is correctly placed in `afterCommit()`, ensuring the cache is only cleared after the deletion is durable. One consideration: if `releaseApacheEndpointIfUnused` throws, the cache has already been evicted but the endpoint release is incomplete. Since `evictDataSourceCache()` is idempotent (clearing an already-empty cache is a no-op), this ordering is safe — just worth noting for future maintainers.
##########
server/src/main/java/org/apache/rocketmq/studio/settings/SettingsService.java:
##########
@@ -56,6 +56,8 @@
@Service
public class SettingsService {
+ public static final String DATA_SOURCE_CACHE = "data-sources";
Review Comment:
**[Info]** Good extraction of the magic string into a constant. This prevents the cache-name drift that caused the original bug. Consider also adding a brief Javadoc on the constant explaining that it must match the `@Cacheable`/`@CacheEvict` values and that cross-service eviction depends on it.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [studio][ISSUE #4201] Evict data-source cache after instance deletion [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #4202:
URL: https://github.com/apache/rocketmq-dashboard/pull/4202
--
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.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org