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

failed update partition of topic #11683

Merged

Conversation

gaozhangmin
Copy link
Contributor

@gaozhangmin gaozhangmin commented Aug 17, 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

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
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
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
@BewareMyPower
Copy link
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
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
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