This is an automated email from the ASF dual-hosted git repository.

fjy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new ddda2a4  VersionedIntervalTimeline: Fix thread-unsafe call to 
"lookup". (#10130)
ddda2a4 is described below

commit ddda2a4f18597257633b55536d8a54e1a3f61eb3
Author: Gian Merlino <gianmerl...@gmail.com>
AuthorDate: Sun Jul 5 09:32:18 2020 -0700

    VersionedIntervalTimeline: Fix thread-unsafe call to "lookup". (#10130)
---
 .../apache/druid/timeline/VersionedIntervalTimeline.java  | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/core/src/main/java/org/apache/druid/timeline/VersionedIntervalTimeline.java 
b/core/src/main/java/org/apache/druid/timeline/VersionedIntervalTimeline.java
index 783bf8b..376a97f 100644
--- 
a/core/src/main/java/org/apache/druid/timeline/VersionedIntervalTimeline.java
+++ 
b/core/src/main/java/org/apache/druid/timeline/VersionedIntervalTimeline.java
@@ -164,8 +164,18 @@ public class VersionedIntervalTimeline<VersionType, 
ObjectType extends Overshado
    */
   public Set<ObjectType> findNonOvershadowedObjectsInInterval(Interval 
interval, Partitions completeness)
   {
+    final List<TimelineObjectHolder<VersionType, ObjectType>> holders;
+
+    lock.readLock().lock();
+    try {
+      holders = lookup(interval, completeness);
+    }
+    finally {
+      lock.readLock().unlock();
+    }
+
     return FluentIterable
-        .from(lookup(interval, completeness))
+        .from(holders)
         .transformAndConcat(TimelineObjectHolder::getObject)
         .transform(PartitionChunk::getObject)
         .toSet();
@@ -273,7 +283,8 @@ public class VersionedIntervalTimeline<VersionType, 
ObjectType extends Overshado
   }
 
   @Override
-  public @Nullable PartitionHolder<ObjectType> findEntry(Interval interval, 
VersionType version)
+  @Nullable
+  public PartitionHolder<ObjectType> findEntry(Interval interval, VersionType 
version)
   {
     lock.readLock().lock();
     try {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to