poorbarcode commented on code in PR #21246:
URL: https://github.com/apache/pulsar/pull/21246#discussion_r1374212539
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractSubscription.java:
##########
@@ -18,14 +18,37 @@
*/
package org.apache.pulsar.broker.service;
+import org.apache.pulsar.common.api.proto.CommandSubscribe.IsolationLevel;
+
+import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.LongAdder;
import java.util.function.ToLongFunction;
public abstract class AbstractSubscription implements Subscription {
+ protected static final String SUBSCRIPTION_ISOLATION_LEVEL_PROPERTY =
"pulsar.subscription.isolation.level";
protected final LongAdder bytesOutFromRemovedConsumers = new LongAdder();
protected final LongAdder msgOutFromRemovedConsumer = new LongAdder();
+ public static void wrapIsolationLevelToProperties(Map<String, String>
properties, IsolationLevel isolationLevel) {
+ if (properties != null) {
+ properties.put(SUBSCRIPTION_ISOLATION_LEVEL_PROPERTY,
String.valueOf(isolationLevel.getValue()));
Review Comment:
@codelipenghui
> Sorry, why do we need to persist the isolation level to properties?
> It should follow the subscription type. The subscription will use the
isolation type that the first consumer provided.
> After all consumer disconnected, a new consumer will get a chance to
change the isolation level.
For example:
- there are 10 messages
- `3:0~3:4`(committed)
- `3:5~3:9`(transaction on-going)]
- create a subscription with reading un-committed isolation level
- the consumer committed `3:0~3~6`
- close all consumers
- create a new consumer on the old subscription with read committed
isolation level, <strong>(Highlight)</strong> the read position and marked
deleted position will go to a strange value
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]