Fix issue that tasks failed because of no sink for identifier

This commit is contained in:
qiumingming.2018 2018-12-11 23:11:21 +08:00
parent 3443f9a008
commit c9a6de7fc5
1 changed files with 7 additions and 2 deletions

View File

@ -90,6 +90,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -485,8 +486,12 @@ public class AppenderatorImpl implements Appenderator
final List<Pair<FireHydrant, SegmentIdentifier>> indexesToPersist = new ArrayList<>(); final List<Pair<FireHydrant, SegmentIdentifier>> indexesToPersist = new ArrayList<>();
int numPersistedRows = 0; int numPersistedRows = 0;
long bytesPersisted = 0L; long bytesPersisted = 0L;
for (SegmentIdentifier identifier : sinks.keySet()) { Iterator<Map.Entry<SegmentIdentifier, Sink>> iterator = sinks.entrySet().iterator();
final Sink sink = sinks.get(identifier);
while (iterator.hasNext()) {
final Map.Entry<SegmentIdentifier, Sink> entry = iterator.next();
final SegmentIdentifier identifier = entry.getKey();
final Sink sink = entry.getValue();
if (sink == null) { if (sink == null) {
throw new ISE("No sink for identifier: %s", identifier); throw new ISE("No sink for identifier: %s", identifier);
} }