Skip to content

failed update partition of topic - #11683

Merged
codelipenghui merged 6 commits into
apache:masterfrom
gaozhangmin:fix-updatePartitionedTopic-bug
Aug 30, 2021
Merged

failed update partition of topic#11683
codelipenghui merged 6 commits into
apache:masterfrom
gaozhangmin:fix-updatePartitionedTopic-bug

Conversation

@gaozhangmin

@gaozhangmin gaozhangmin commented Aug 17, 2021

Copy link
Copy Markdown
Contributor

Fixes #11682

Motivation

1、tryCreatePartitionsAsync would create znode under managed-ledgers/public/default/persistent/ after success invoke

2、there are chance, updatePartitionedTopic would failed, and managed-ledgers znode would stay unclean. If We tried update partition once again , We would fail, because of managed-ledgers znode exists

if (numPartitions <= 0) {
throw new RestException(Status.NOT_ACCEPTABLE, "Number of partitions should be more than 0");
}
try {
tryCreatePartitionsAsync(numPartitions).get(DEFAULT_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS);
updatePartitionedTopic(topicName, numPartitions).get(DEFAULT_OPERATION_TIMEOUT_SEC, TimeUnit.SECONDS);
} catch (Exception e) {
if (e.getCause() instanceof RestException) {
throw (RestException) e.getCause();
}
log.error("[{}] Failed to update partitioned topic {}", clientAppId(), topicName, e);
throw new RestException(e);
}

Modifications

clean up managed-ledger znode after we failed update partition.

@Anonymitaet

Copy link
Copy Markdown
Member

Thanks for your contribution. For this PR, do we need to update docs?

(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@gaozhangmin

Copy link
Copy Markdown
Contributor Author

Thanks for your contribution. For this PR, do we need to update docs?

(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

no need doc.

@gaozhangmin
gaozhangmin force-pushed the fix-updatePartitionedTopic-bug branch from 58e6675 to 49c6cdd Compare August 18, 2021 05:35
@gaozhangmin
gaozhangmin force-pushed the fix-updatePartitionedTopic-bug branch from 49c6cdd to bc771fe Compare August 18, 2021 05:36
@BewareMyPower

Copy link
Copy Markdown
Contributor

Please fix the code style.

Error:  src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:[3641,21] (whitespace) WhitespaceAround: 'for' is not followed by whitespace.
Error:  src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:[3642] (sizes) LineLength: Line is longer than 120 characters (found 147).

@gaozhangmin
gaozhangmin force-pushed the fix-updatePartitionedTopic-bug branch from 0fa1c93 to 8dc16b7 Compare August 18, 2021 07:47
@gaozhangmin

Copy link
Copy Markdown
Contributor Author

@eolivelli @lhotari PTAL

@Anonymitaet Anonymitaet added the doc-not-needed Your PR changes do not impact docs label Aug 19, 2021
@codelipenghui codelipenghui added this to the 2.9.0 milestone Aug 19, 2021
@gaozhangmin

Copy link
Copy Markdown
Contributor Author

@codelipenghui PTAL

@codelipenghui
codelipenghui merged commit 90c7db4 into apache:master Aug 30, 2021
codelipenghui pushed a commit that referenced this pull request Sep 9, 2021
Fixes #11682 
### Motivation
1、`tryCreatePartitionsAsync` would create  znode under  `managed-ledgers/public/default/persistent/` after success invoke

2、there are chance, `updatePartitionedTopic` would failed, and managed-ledgers znode would  stay unclean. If We tried update partition once again , We would fail, because of managed-ledgers znode exists
https://github.com/apache/pulsar/blob/80171a733ab4799f912a8935f03c19554b9ca3b1/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L473-L485

### Modifications 
 clean up managed-ledger znode after we failed update partition.

(cherry picked from commit 90c7db4)
@codelipenghui codelipenghui added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Sep 9, 2021
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Oct 27, 2021
Fixes apache#11682
### Motivation
1、`tryCreatePartitionsAsync` would create  znode under  `managed-ledgers/public/default/persistent/` after success invoke

2、there are chance, `updatePartitionedTopic` would failed, and managed-ledgers znode would  stay unclean. If We tried update partition once again , We would fail, because of managed-ledgers znode exists
https://github.com/apache/pulsar/blob/80171a733ab4799f912a8935f03c19554b9ca3b1/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L473-L485

### Modifications
 clean up managed-ledger znode after we failed update partition.

(cherry picked from commit 90c7db4)
(cherry picked from commit f96f967)
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
Fixes apache#11682 
### Motivation
1、`tryCreatePartitionsAsync` would create  znode under  `managed-ledgers/public/default/persistent/` after success invoke

2、there are chance, `updatePartitionedTopic` would failed, and managed-ledgers znode would  stay unclean. If We tried update partition once again , We would fail, because of managed-ledgers znode exists
https://github.com/apache/pulsar/blob/80171a733ab4799f912a8935f03c19554b9ca3b1/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L473-L485

### Modifications 
 clean up managed-ledger znode after we failed update partition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/admin area/broker cherry-picked/branch-2.8 Archived: 2.8 is end of life doc-not-needed Your PR changes do not impact docs release/2.8.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

failed update partition of topic。

4 participants