This is an automated email from the ASF dual-hosted git repository.
gian 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 4d892483ca Fix thread-unsafe emitter usage in
SeekableStreamSupervisorStateTest. (#12658)
4d892483ca is described below
commit 4d892483ca0b45c105cb645768f03ef93cb517da
Author: Gian Merlino <[email protected]>
AuthorDate: Wed Jun 22 22:29:16 2022 -0700
Fix thread-unsafe emitter usage in SeekableStreamSupervisorStateTest.
(#12658)
The TestEmitter is used from different threads without concurrency
control. This patch makes the emitter thread-safe.
---
.../supervisor/SeekableStreamSupervisorStateTest.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git
a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisorStateTest.java
b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisorStateTest.java
index 15bce156b4..c67444a4de 100644
---
a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisorStateTest.java
+++
b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisorStateTest.java
@@ -24,6 +24,7 @@ import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
+import com.google.errorprone.annotations.concurrent.GuardedBy;
import org.apache.druid.data.input.impl.ByteEntity;
import org.apache.druid.data.input.impl.DimensionSchema;
import org.apache.druid.data.input.impl.DimensionsSpec;
@@ -1371,17 +1372,22 @@ public class SeekableStreamSupervisorStateTest extends
EasyMockSupport
private static class TestEmitter extends NoopServiceEmitter
{
+ @GuardedBy("events")
private final List<Event> events = new ArrayList<>();
@Override
public void emit(Event event)
{
- events.add(event);
+ synchronized (events) {
+ events.add(event);
+ }
}
public List<Event> getEvents()
{
- return events;
+ synchronized (events) {
+ return ImmutableList.copyOf(events);
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]