!18 Only handle exception when there has

From: @sundapeng001 
Reviewed-by: @wang-jialing218 
Signed-off-by: @wang-jialing218
This commit is contained in:
openeuler-ci-bot 2023-12-08 08:54:47 +00:00 committed by Gitee
commit 75e1752c32
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,35 @@
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java
index fe1e60d201..b98a111455 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java
@@ -470,18 +470,20 @@ public class BookkeeperSchemaStorage implements SchemaStorage {
concat(locator.getIndexList(), newArrayList(info))
).build(), locatorEntry.version
).thenApply(ignore -> nextVersion).whenComplete((__, ex) -> {
- Throwable cause = FutureUtil.unwrapCompletionException(ex);
- log.warn("[{}] Failed to update schema locator with position {}", schemaId, position, cause);
- if (cause instanceof AlreadyExistsException || cause instanceof BadVersionException) {
- bookKeeper.asyncDeleteLedger(position.getLedgerId(), new AsyncCallback.DeleteCallback() {
- @Override
- public void deleteComplete(int rc, Object ctx) {
- if (rc != BKException.Code.OK) {
- log.warn("[{}] Failed to delete ledger {} after updating schema locator failed, rc: {}",
+ if (ex != null) {
+ Throwable cause = FutureUtil.unwrapCompletionException(ex);
+ log.warn("[{}] Failed to update schema locator with position {}", schemaId, position, cause);
+ if (cause instanceof AlreadyExistsException || cause instanceof BadVersionException) {
+ bookKeeper.asyncDeleteLedger(position.getLedgerId(), new AsyncCallback.DeleteCallback() {
+ @Override
+ public void deleteComplete(int rc, Object ctx) {
+ if (rc != BKException.Code.OK) {
+ log.warn("[{}] Failed to delete ledger {} after updating schema locator failed, rc: {}",
schemaId, position.getLedgerId(), rc);
+ }
}
- }
- }, null);
+ }, null);
+ }
}
});
}

View File

@ -1,6 +1,6 @@
%define debug_package %{nil}
%define pulsar_ver 2.10.4
%define pkg_ver 15
%define pkg_ver 16
%define _prefix /opt/pulsar
Summary: Cloud-Native, Distributed Messaging and Streaming
Name: pulsar
@ -25,6 +25,7 @@ Patch0012: 0012-CVE-2023-2976.patch
Patch0013: 0013-fix-deadlock.patch
Patch0014: 0014-CVE-2023-32732.patch
Patch0015: 0015-fix-no-messages.patch
Patch0016: 0016-handle-exception.patch
BuildRoot: /root/rpmbuild/BUILDROOT/
BuildRequires: java-1.8.0-openjdk-devel,maven,systemd
Requires: java-1.8.0-openjdk,systemd
@ -52,6 +53,7 @@ Pulsar is a distributed pub-sub messaging platform with a very flexible messagin
%patch0013 -p1
%patch0014 -p1
%patch0015 -p1
%patch0016 -p1
%build
mvn clean install -Pcore-modules,-main -DskipTests
@ -77,6 +79,8 @@ getent passwd pulsar >/dev/null || useradd -r -g pulsar -d / -s /sbin/nologin pu
exit 0
%changelog
* Fri Dec 8 2023 Dapeng Sun <sundapeng@cmss.chinamobile.com> - 2.10.4-16
- Only handle exception when there has
* Thu Dec 7 2023 Dapeng Sun <sundapeng@cmss.chinamobile.com> - 2.10.4-15
- fix Can not receive any messages after switch to standby cluster
* Thu Dec 7 2023 Dapeng Sun <sundapeng@cmss.chinamobile.com> - 2.10.4-14