@SafeVarargs
  private final void remapInFlightEventsSnapshot(
      final RemappingFunction<SubscriptionEvent>... functions) {
    // Iterate on the snapshot of the key set, NOTE:
    // 1. Ignore entries added during iteration.
    // 2. For entries deleted by other threads during iteration, just check if the value is null.
    // 3. Since the compute call for the same key is atomic and will be executed serially, the
    // remapping operations are safe.
    for (final Pair<String, SubscriptionCommitContext> pair :
        ImmutableSet.copyOf(inFlightEvents.keySet())) {
      inFlightEvents.compute(pair, (key, ev) -> COMBINER(functions).remap(ev));
    }
  }
A ReentrantReadWriteLock to ensure thread-safe operations. This lock is used to guarantee
mutual exclusion between the {@link SubscriptionPrefetchingQueue#cleanUp} operation and other
operations such as {@link SubscriptionPrefetchingQueue#poll}, {@link
SubscriptionPrefetchingQueue#ack}, etc. However, it does not enforce mutual exclusion among the
other operations themselves.

<p>Under the premise of obtaining this lock, to avoid inconsistencies, updates to the {@link
SubscriptionEvent} in both {@link SubscriptionPrefetchingQueue#prefetchingQueue} and {@link
SubscriptionPrefetchingQueue#inFlightEvents} MUST be performed within the {@link
ConcurrentHashMap#compute} method of inFlightEvents in the {@link
SubscriptionPrefetchingQueue}.

<p>This lock is created with fairness set to true, which means threads acquire the lock in the
order they requested it, to avoid thread starvation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/subscription/broker/SubscriptionPrefetchingQueue.java