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

[improve][misc] Sync commits from apache into 3.1_ds (19 Feb) #367

Open
wants to merge 44 commits into
base: 3.1_ds
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
78b843d
[fix][broker] Closed topics won't be removed from the cache (#23884)
shibd Feb 6, 2025
00768ba
Cherry-pick #23935
shibd Feb 6, 2025
ce1af10
[improve][broker] Don't print error logs for ProducerBusyException (#…
RobertIndie Feb 6, 2025
6a2d72a
[cleanup][admin] Do not print full stacktrace when get partitioned me…
Demogorgon314 Aug 14, 2023
4dd7b3a
[improve][broker] Do not print error logs for NotFound or Conflict er…
RobertIndie Feb 6, 2025
98e5085
[improve][broker] Avoid logging errors when there is a connection iss…
RobertIndie Feb 6, 2025
110ab7e
[improve][broker] Avoid printing log for IncompatibleSchemaException …
RobertIndie Feb 7, 2025
5211328
[improve][io] Allow skipping connector deployment (#23932)
nodece Feb 8, 2025
3a07bb3
[feat][client] Support forward proxy for the ZTS server in pulsar-cli…
equanz Feb 8, 2025
5067801
[fix][ci][branch-3.0] Modify existing /etc/docker/daemon.json file if…
lhotari Feb 10, 2025
8dec18f
[fix][ml] Fix memory leak due to duplicated RangeCache value retain o…
BewareMyPower Feb 10, 2025
386337f
[fix] [client] call redeliver 1 msg but did 2 msgs (#23943)
poorbarcode Feb 10, 2025
948f31d
[fix] [ml] incorrect non-durable cursor's backlog due to concurrently…
poorbarcode Feb 11, 2025
f379b6e
[fix][client][branch-3.0] Fix cherry-pick issue in f6166c7
lhotari Feb 11, 2025
76486e8
[fix][ml] Fix deadlock in PendingReadsManager (#23958)
lhotari Feb 11, 2025
a5cfb36
[fix][sec] Upgrade to Netty 4.1.118 (#23965)
merlimat Feb 11, 2025
fc215d7
[fix][ml] Fix memory leaks in ManagedCursorInfo and ManagedLedgerInfo…
lhotari Feb 11, 2025
12d28c0
[improve][broker] Avoid PersistentReplicator.expireMessages logic com…
hanmz Feb 11, 2025
06a08aa
[fix][build] Upgrade json-smart to 2.5.2 (#23966)
nodece Feb 12, 2025
1464acc
[improve][ci] Skip "OWASP dependency check" when data wasn't found in…
lhotari Feb 12, 2025
5e47843
[fix] Bump org.apache.solr:solr-core from 8.11.3 to 9.8.0 in /pulsar-…
dependabot[bot] Feb 12, 2025
64b2eb1
[fix][client] Fix memory leak in ClientCnx.newLookup when there's Too…
lhotari Feb 12, 2025
1cd1f1a
[fix][client] Fix memory leak when message size exceeds max message s…
lhotari Feb 12, 2025
78e76dd
[fix][io] Fix pulsar-io:pom not found (#23979)
nodece Feb 13, 2025
61c09c9
[improve][proxy] Make keep-alive interval configurable in Pulsar Prox…
lhotari Feb 14, 2025
495d9d6
[fix][broker] Fix incorrect blockedConsumerOnUnackedMsgs value when m…
summeriiii Feb 14, 2025
945c130
[fix][meta] Fix ephemeral Zookeeper put which creates a persistent zn…
heesung-sn Feb 14, 2025
aa5643a
[fix][broker] fix broker may lost rack information (#23331)
TakaHiR07 Feb 14, 2025
d9553ae
[improve] Validate user paths in Functions utils (#22833)
merlimat Jun 4, 2024
d1b73c1
[fix][test] fix flaky testNegativeAcksWithBackoff when batch enabled.…
thetumbled Feb 14, 2025
5a23178
[fix] fix for code scanning alert no. 48: Uncontrolled data used in p…
merlimat Feb 14, 2025
c546825
[fix][build] Add develops for buildtools (#23992)
nodece Feb 17, 2025
1320353
[fix][broker] Fix the retry mechanism in `MetadataCache#readModifyUpd…
RobertIndie Dec 14, 2024
c4ad461
[fix][meta] Fix ephemeral handling of ZK nodes and fix MockZooKeeper …
lhotari Feb 17, 2025
368f430
[improve][meta] Simplify getting parent path in ZKMetadataStore witho…
lhotari Feb 18, 2025
89fea5b
[fix][client] fix retry topic with exclusive mode. (#23859)
thetumbled Feb 18, 2025
6d640ea
Removed update-datastax-license-version.sh & skip license check for d…
nikhil-ctds Feb 19, 2025
273bba5
Fix cherry-pick issue
nikhil-ctds Feb 20, 2025
1614f7f
Fix cherry-pick issue
nikhil-ctds Feb 20, 2025
ea01af2
Fix cherry-pick issue
nikhil-ctds Feb 20, 2025
7055503
Fix cherry-pick issue
nikhil-ctds Feb 20, 2025
6f0ae50
Fix presto-distribution LICENSE
lhotari Feb 19, 2025
e85cb05
Fix cherry-pick issue
dave2wave Jul 6, 2023
6f60118
Fix licence issue
nikhil-ctds Feb 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/actions/clean-disk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ runs:
time df -BM / /mnt
echo "::endgroup::"
done
if [[ "${{ inputs.mode }}" == "full" ]]; then
echo "::group::Moving /var/lib/docker to /mnt/docker"
sudo systemctl stop docker
if sudo test ! -f /etc/docker/daemon.json; then
# create daemon.json file
echo '{"data-root": "/mnt/docker"}' | sudo tee /etc/docker/daemon.json
else
# modify existing daemon.json file
sudo jq '.["data-root"]="/mnt/docker"' /etc/docker/daemon.json | sudo tee /tmp/daemon_temp.json$$
sudo mv /tmp/daemon_temp.json$$ /etc/docker/daemon.json
fi
sudo mv /var/lib/docker /mnt/docker
sudo systemctl start docker
time df -BM / /mnt
echo "::endgroup::"
fi
echo "::group::Cleaning apt state"
time sudo bash -c "apt-get clean; apt-get autoclean; apt-get -y --purge autoremove"
time df -BM / /mnt
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/pulsar-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1312,15 +1312,21 @@ jobs:
restore-keys: |
owasp-dependency-check-data-

- name: Log warning when skipped
if: ${{ !steps.restore-owasp-dependency-check-data.outputs.cache-matched-key }}
run: |
echo "::warning::OWASP Dependency Check was skipped since the OWASP Dependency check data wasn't found in the cache. Run ci-owasp-dependency-check.yaml workflow to update the cache."

# Projects dependent on flume, hdfs, hbase, and presto currently excluded from the scan.
- name: trigger dependency check
if: ${{ steps.restore-owasp-dependency-check-data.outputs.cache-matched-key }}
run: |
mvn -B -ntp verify -PskipDocker,skip-all,owasp-dependency-check -Dcheckstyle.skip=true -DskipTests \
-pl '!pulsar-sql,!distribution/server,!distribution/io,!distribution/offloaders,!pulsar-sql/presto-distribution,!tiered-storage/file-system,!pulsar-io/flume,!pulsar-io/hbase,!pulsar-io/hdfs2,!pulsar-io/hdfs3,!pulsar-io/docs,!pulsar-io/jdbc/openmldb'

- name: Upload report
uses: actions/upload-artifact@v4
if: ${{ cancelled() || failure() }}
if: ${{ steps.restore-owasp-dependency-check-data.outputs.cache-matched-key && (cancelled() || failure()) }}
continue-on-error: true
with:
name: dependency report
Expand Down
9 changes: 8 additions & 1 deletion buildtools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
<packaging>jar</packaging>
<name>Pulsar Build Tools</name>

<developers>
<developer>
<organization>Apache Pulsar developers</organization>
<organizationUrl>http://pulsar.apache.org/</organizationUrl>
</developer>
</developers>

<properties>
<project.build.outputTimestamp>2025-01-20T05:51:16Z</project.build.outputTimestamp>
<maven.compiler.source>1.8</maven.compiler.source>
Expand All @@ -47,7 +54,7 @@
<license-maven-plugin.version>4.1</license-maven-plugin.version>
<puppycrawl.checkstyle.version>10.14.2</puppycrawl.checkstyle.version>
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
<netty.version>4.1.117.Final</netty.version>
<netty.version>4.1.118.Final</netty.version>
<guice.version>4.2.3</guice.version>
<guava.version>32.1.1-jre</guava.version>
<ant.version>1.10.12</ant.version>
Expand Down
7 changes: 7 additions & 0 deletions conf/proxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ bindAddress=0.0.0.0
# If not set, the value of `InetAddress.getLocalHost().getCanonicalHostName()` is used.
advertisedAddress=

# Specifies the interval (in seconds) for sending ping messages to the client. Set to 0 to disable
# ping messages. This setting applies to client connections used for topic lookups and
# partition metadata requests. When a client establishes a broker connection via the proxy,
# the client and broker will communicate directly without the proxy intercepting the messages.
# In that case, the broker's keepAliveIntervalSeconds configuration becomes relevant.
keepAliveIntervalSeconds=30

# Enable or disable the HAProxy protocol.
# If true, the real IP addresses of consumers and producers can be obtained when getting topic statistics data.
haProxyProtocolEnabled=false
Expand Down
79 changes: 27 additions & 52 deletions distribution/server/src/assemble/LICENSE.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -289,33 +289,33 @@ The Apache Software License, Version 2.0
- org.apache.commons-commons-lang3-3.11.jar
- org.apache.commons-commons-text-1.10.0.jar
* Netty
- io.netty-netty-buffer-4.1.117.Final.jar
- io.netty-netty-codec-4.1.117.Final.jar
- io.netty-netty-codec-dns-4.1.117.Final.jar
- io.netty-netty-codec-http-4.1.117.Final.jar
- io.netty-netty-codec-http2-4.1.117.Final.jar
- io.netty-netty-codec-socks-4.1.117.Final.jar
- io.netty-netty-codec-haproxy-4.1.117.Final.jar
- io.netty-netty-common-4.1.117.Final.jar
- io.netty-netty-handler-4.1.117.Final.jar
- io.netty-netty-handler-proxy-4.1.117.Final.jar
- io.netty-netty-resolver-4.1.117.Final.jar
- io.netty-netty-resolver-dns-4.1.117.Final.jar
- io.netty-netty-resolver-dns-classes-macos-4.1.117.Final.jar
- io.netty-netty-resolver-dns-native-macos-4.1.117.Final-osx-aarch_64.jar
- io.netty-netty-resolver-dns-native-macos-4.1.117.Final-osx-x86_64.jar
- io.netty-netty-transport-4.1.117.Final.jar
- io.netty-netty-transport-classes-epoll-4.1.117.Final.jar
- io.netty-netty-transport-native-epoll-4.1.117.Final-linux-aarch_64.jar
- io.netty-netty-transport-native-epoll-4.1.117.Final-linux-x86_64.jar
- io.netty-netty-transport-native-unix-common-4.1.117.Final.jar
- io.netty-netty-tcnative-boringssl-static-2.0.69.Final.jar
- io.netty-netty-tcnative-boringssl-static-2.0.69.Final-linux-aarch_64.jar
- io.netty-netty-tcnative-boringssl-static-2.0.69.Final-linux-x86_64.jar
- io.netty-netty-tcnative-boringssl-static-2.0.69.Final-osx-aarch_64.jar
- io.netty-netty-tcnative-boringssl-static-2.0.69.Final-osx-x86_64.jar
- io.netty-netty-tcnative-boringssl-static-2.0.69.Final-windows-x86_64.jar
- io.netty-netty-tcnative-classes-2.0.69.Final.jar
- io.netty-netty-buffer-4.1.118.Final.jar
- io.netty-netty-codec-4.1.118.Final.jar
- io.netty-netty-codec-dns-4.1.118.Final.jar
- io.netty-netty-codec-http-4.1.118.Final.jar
- io.netty-netty-codec-http2-4.1.118.Final.jar
- io.netty-netty-codec-socks-4.1.118.Final.jar
- io.netty-netty-codec-haproxy-4.1.118.Final.jar
- io.netty-netty-common-4.1.118.Final.jar
- io.netty-netty-handler-4.1.118.Final.jar
- io.netty-netty-handler-proxy-4.1.118.Final.jar
- io.netty-netty-resolver-4.1.118.Final.jar
- io.netty-netty-resolver-dns-4.1.118.Final.jar
- io.netty-netty-resolver-dns-classes-macos-4.1.118.Final.jar
- io.netty-netty-resolver-dns-native-macos-4.1.118.Final-osx-aarch_64.jar
- io.netty-netty-resolver-dns-native-macos-4.1.118.Final-osx-x86_64.jar
- io.netty-netty-transport-4.1.118.Final.jar
- io.netty-netty-transport-classes-epoll-4.1.118.Final.jar
- io.netty-netty-transport-native-epoll-4.1.118.Final-linux-aarch_64.jar
- io.netty-netty-transport-native-epoll-4.1.118.Final-linux-x86_64.jar
- io.netty-netty-transport-native-unix-common-4.1.118.Final.jar
- io.netty-netty-tcnative-boringssl-static-2.0.70.Final.jar
- io.netty-netty-tcnative-boringssl-static-2.0.70.Final-linux-aarch_64.jar
- io.netty-netty-tcnative-boringssl-static-2.0.70.Final-linux-x86_64.jar
- io.netty-netty-tcnative-boringssl-static-2.0.70.Final-osx-aarch_64.jar
- io.netty-netty-tcnative-boringssl-static-2.0.70.Final-osx-x86_64.jar
- io.netty-netty-tcnative-boringssl-static-2.0.70.Final-windows-x86_64.jar
- io.netty-netty-tcnative-classes-2.0.70.Final.jar
- io.netty.incubator-netty-incubator-transport-classes-io_uring-0.0.26.Final.jar
- io.netty.incubator-netty-incubator-transport-native-io_uring-0.0.26.Final-linux-x86_64.jar
- io.netty.incubator-netty-incubator-transport-native-io_uring-0.0.26.Final-linux-aarch_64.jar
Expand Down Expand Up @@ -577,31 +577,6 @@ Bouncy Castle License
- org.bouncycastle-bcprov-jdk18on-1.78.1.jar
- org.bouncycastle-bcutil-jdk18on-1.78.1.jar

Datastax
- com.datastax.oss-managed-ledger-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-broker-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-broker-auth-oidc-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-broker-auth-sasl-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-broker-common-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-config-validation-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-docs-tools-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-functions-api-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-functions-instance-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-functions-local-runner-original-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-functions-proto-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-functions-runtime-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-functions-secrets-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-functions-utils-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-functions-worker-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-io-core-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-metadata-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-proxy-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-testclient-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-transaction-common-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-pulsar-transaction-coordinator-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-testmocks-3.1.4.13-SNAPSHOT.jar
- com.datastax.oss-jetcd-core-shaded-3.1.4.13-SNAPSHOT.jar

------------------------

Additionaly, Netty includes code with the following licenses:
Expand Down
52 changes: 26 additions & 26 deletions distribution/shell/src/assemble/LICENSE.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -344,35 +344,35 @@ The Apache Software License, Version 2.0
- commons-text-1.10.0.jar
- commons-compress-1.26.0.jar
* Netty
- netty-buffer-4.1.117.Final.jar
- netty-codec-4.1.117.Final.jar
- netty-codec-dns-4.1.117.Final.jar
- netty-codec-http-4.1.117.Final.jar
- netty-codec-socks-4.1.117.Final.jar
- netty-codec-haproxy-4.1.117.Final.jar
- netty-common-4.1.117.Final.jar
- netty-handler-4.1.117.Final.jar
- netty-handler-proxy-4.1.117.Final.jar
- netty-resolver-4.1.117.Final.jar
- netty-resolver-dns-4.1.117.Final.jar
- netty-transport-4.1.117.Final.jar
- netty-transport-classes-epoll-4.1.117.Final.jar
- netty-transport-native-epoll-4.1.117.Final-linux-aarch_64.jar
- netty-transport-native-epoll-4.1.117.Final-linux-x86_64.jar
- netty-transport-native-unix-common-4.1.117.Final.jar
- netty-tcnative-boringssl-static-2.0.69.Final.jar
- netty-tcnative-boringssl-static-2.0.69.Final-linux-aarch_64.jar
- netty-tcnative-boringssl-static-2.0.69.Final-linux-x86_64.jar
- netty-tcnative-boringssl-static-2.0.69.Final-osx-aarch_64.jar
- netty-tcnative-boringssl-static-2.0.69.Final-osx-x86_64.jar
- netty-tcnative-boringssl-static-2.0.69.Final-windows-x86_64.jar
- netty-tcnative-classes-2.0.69.Final.jar
- netty-buffer-4.1.118.Final.jar
- netty-codec-4.1.118.Final.jar
- netty-codec-dns-4.1.118.Final.jar
- netty-codec-http-4.1.118.Final.jar
- netty-codec-socks-4.1.118.Final.jar
- netty-codec-haproxy-4.1.118.Final.jar
- netty-common-4.1.118.Final.jar
- netty-handler-4.1.118.Final.jar
- netty-handler-proxy-4.1.118.Final.jar
- netty-resolver-4.1.118.Final.jar
- netty-resolver-dns-4.1.118.Final.jar
- netty-transport-4.1.118.Final.jar
- netty-transport-classes-epoll-4.1.118.Final.jar
- netty-transport-native-epoll-4.1.118.Final-linux-aarch_64.jar
- netty-transport-native-epoll-4.1.118.Final-linux-x86_64.jar
- netty-transport-native-unix-common-4.1.118.Final.jar
- netty-tcnative-boringssl-static-2.0.70.Final.jar
- netty-tcnative-boringssl-static-2.0.70.Final-linux-aarch_64.jar
- netty-tcnative-boringssl-static-2.0.70.Final-linux-x86_64.jar
- netty-tcnative-boringssl-static-2.0.70.Final-osx-aarch_64.jar
- netty-tcnative-boringssl-static-2.0.70.Final-osx-x86_64.jar
- netty-tcnative-boringssl-static-2.0.70.Final-windows-x86_64.jar
- netty-tcnative-classes-2.0.70.Final.jar
- netty-incubator-transport-classes-io_uring-0.0.26.Final.jar
- netty-incubator-transport-native-io_uring-0.0.26.Final-linux-aarch_64.jar
- netty-incubator-transport-native-io_uring-0.0.26.Final-linux-x86_64.jar
- netty-resolver-dns-classes-macos-4.1.117.Final.jar
- netty-resolver-dns-native-macos-4.1.117.Final-osx-aarch_64.jar
- netty-resolver-dns-native-macos-4.1.117.Final-osx-x86_64.jar
- netty-resolver-dns-classes-macos-4.1.118.Final.jar
- netty-resolver-dns-native-macos-4.1.118.Final-osx-aarch_64.jar
- netty-resolver-dns-native-macos-4.1.118.Final-osx-x86_64.jar
* Prometheus client
- simpleclient-0.16.0.jar
- simpleclient_log4j2-0.16.0.jar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1137,16 +1137,17 @@ public ManagedCursor newNonDurableCursor(Position startCursorPosition, String cu
return cachedCursor;
}

NonDurableCursorImpl cursor = new NonDurableCursorImpl(bookKeeper, this, cursorName,
(PositionImpl) startCursorPosition, initialPosition, isReadCompacted);
cursor.setActive();

log.info("[{}] Opened new cursor: {}", name, cursor);
// The backlog of a non-durable cursor could be incorrect if the cursor is created before `internalTrimLedgers`
// and added to the managed ledger after `internalTrimLedgers`.
// For more details, see https://github.com/apache/pulsar/pull/23951.
synchronized (this) {
NonDurableCursorImpl cursor = new NonDurableCursorImpl(bookKeeper, this, cursorName,
(PositionImpl) startCursorPosition, initialPosition, isReadCompacted);
cursor.setActive();
log.info("[{}] Opened new cursor: {}", name, cursor);
addCursor(cursor);
return cursor;
}

return cursor;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,13 @@ public ManagedLedgerInfo parseManagedLedgerInfo(byte[] data) throws InvalidProto
try {
MLDataFormats.ManagedLedgerInfoMetadata metadata =
MLDataFormats.ManagedLedgerInfoMetadata.parseFrom(metadataBytes);
return ManagedLedgerInfo.parseFrom(getCompressionCodec(metadata.getCompressionType())
.decode(byteBuf, metadata.getUncompressedSize()).nioBuffer());
ByteBuf uncompressed = getCompressionCodec(metadata.getCompressionType())
.decode(byteBuf, metadata.getUncompressedSize());
try {
return ManagedLedgerInfo.parseFrom(uncompressed.nioBuffer());
} finally {
uncompressed.release();
}
} catch (Exception e) {
log.error("Failed to parse managedLedgerInfo metadata, "
+ "fall back to parse managedLedgerInfo directly.", e);
Expand All @@ -478,8 +483,13 @@ public ManagedCursorInfo parseManagedCursorInfo(byte[] data) throws InvalidProto
try {
MLDataFormats.ManagedCursorInfoMetadata metadata =
MLDataFormats.ManagedCursorInfoMetadata.parseFrom(metadataBytes);
return ManagedCursorInfo.parseFrom(getCompressionCodec(metadata.getCompressionType())
.decode(byteBuf, metadata.getUncompressedSize()).nioBuffer());
ByteBuf uncompressed = getCompressionCodec(metadata.getCompressionType())
.decode(byteBuf, metadata.getUncompressedSize());
try {
return ManagedCursorInfo.parseFrom(uncompressed.nioBuffer());
} finally {
uncompressed.release();
}
} catch (Exception e) {
log.error("Failed to parse ManagedCursorInfo metadata, "
+ "fall back to parse ManagedCursorInfo directly", e);
Expand All @@ -503,29 +513,23 @@ private byte[] compressManagedInfo(byte[] info, byte[] metadata, int metadataSer
if (compressionType == null || compressionType.equals(CompressionType.NONE)) {
return info;
}
ByteBuf metadataByteBuf = null;
ByteBuf encodeByteBuf = null;

CompositeByteBuf compositeByteBuf = PulsarByteBufAllocator.DEFAULT.compositeBuffer();
try {
metadataByteBuf = PulsarByteBufAllocator.DEFAULT.buffer(metadataSerializedSize + 6,
ByteBuf metadataByteBuf = PulsarByteBufAllocator.DEFAULT.buffer(metadataSerializedSize + 6,
metadataSerializedSize + 6);
metadataByteBuf.writeShort(MAGIC_MANAGED_INFO_METADATA);
metadataByteBuf.writeInt(metadataSerializedSize);
metadataByteBuf.writeBytes(metadata);
encodeByteBuf = getCompressionCodec(compressionType)
ByteBuf encodeByteBuf = getCompressionCodec(compressionType)
.encode(Unpooled.wrappedBuffer(info));
CompositeByteBuf compositeByteBuf = PulsarByteBufAllocator.DEFAULT.compositeBuffer();
compositeByteBuf.addComponent(true, metadataByteBuf);
compositeByteBuf.addComponent(true, encodeByteBuf);
byte[] dataBytes = new byte[compositeByteBuf.readableBytes()];
compositeByteBuf.readBytes(dataBytes);
return dataBytes;
} finally {
if (metadataByteBuf != null) {
metadataByteBuf.release();
}
if (encodeByteBuf != null) {
encodeByteBuf.release();
}
compositeByteBuf.release();
}
}

Expand Down
Loading
Loading