Skip to content

Subscription: preserve topic updates during owner transfer - #18353

Open
Caideyipi wants to merge 1 commit into
apache:masterfrom
Caideyipi:fix/subscription-owner-transfer-stale-meta
Open

Subscription: preserve topic updates during owner transfer#18353
Caideyipi wants to merge 1 commit into
apache:masterfrom
Caideyipi:fix/subscription-owner-transfer-stale-meta

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

Description

Problem

An owner-transfer request built its full updated TopicMeta before waiting for the previous owner's lease to expire. While that request was waiting, another ALTER TOPIC could update attributes such as column-filter. A delayed or retried owner-transfer request would then submit its pre-wait snapshot and restore the old attributes.

Fix

  • Keep the pre-wait snapshots only for deciding whether an owner lease drain is required.
  • After the lease wait completes, rebuild the altered metadata from the latest TopicMeta and merge only the attributes from the owner-transfer request.
  • Extract the lease wait into a package-private method so the race can be reproduced deterministically without a real 60-second wait.

Validation

  • mvn spotless:apply -pl iotdb-core/confignode
  • mvn -pl iotdb-core/confignode -am -Dtest=SubscriptionCoordinatorTest -Dsurefire.failIfNoSpecifiedTests=false test
    • Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    • Reactor build, Checkstyle, and Spotless succeeded.
  • A local run of IoTDBConsensusSubscriptionColumnFilterClusterIT was skipped during cluster setup because the local template contained mixed DataNode classes (NoSuchMethodError: IoTDBConfig.isEnableWhiteList()), before the test body ran.

This PR has:

  • been self-reviewed.
    • concurrent write
  • added comments explaining the why and intent of the code.
  • added unit tests covering the new code path.

Key changed/added classes
  • SubscriptionCoordinator
  • SubscriptionCoordinatorTest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant