Concurrency bug in DruidSchema.refreshSegmentsForDataSource()
segmentMap is created outside of lock, so by the time of SegmentMetadataHolder holder = dataSourceSegments.get(segment); segment could be already removed. It could cause NPE below.
FYI @surekhasaharan @gianm
Thanks @leventov , I want to clarify that even if segment is removed, the reference to segment is still there. So where do you think, it can cause a NPE ? Though a null check for dataSourceSegments can be added before SegmentMetadataHolder holder = dataSourceSegments.get(segment);. Does that address your concern ?
I think the issue is that the segment might have been removed from segmentMetadataInfo, so there would no longer be any holder.
thanks @gianm , created a PR
@surekhasaharan would you please link the PR you raise to this issue? It would work if you mention this issue in your PR.
@leventov I guess it's resolved?