Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-5355 YARN Timeline Service v.2: alpha 2
  3. YARN-6455

Enhance the timelinewriter.flush() race condition fix

    XMLWordPrintableJSON

Details

    Description

      YARN-6376 fixes timelinewriter.flush() race condition among concurrent putEntities() calls and periodical flush by TimelineCollectorManager by synchronizing on the writer object.

      Synchronizing on the writer is still a little brittle there, because there is a getWriter method which lets callers access the writer without synchronizing on it. AppLevelTimelineCollector#AppLevelAggregator#agregate() does this in line 152: getWriter().write(...) In this case it doesn't flush, but if that were to be added, that would re-introduce the race fixed in YARN-6376.

      Instead of exposing the writer, perhaps it would be better to have the sub-classes call #putEntities instead. It defers to the private writeTimelineEntities which does the same work to get the context:
      TimelineCollectorContext context = getTimelineEntityContext();

      Attachments

        1. YARN-6455.00.patch
          3 kB
          Haibo Chen

        Issue Links

          Activity

            People

              haibochen Haibo Chen
              haibochen Haibo Chen
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: