XMLWordPrintableJSON

Details

    • Improvement
    • Status: Patch Available
    • Minor
    • Resolution: Unresolved
    • 3.0.0
    • None
    • mrv2
    • None

    Description

      Source:
      MergeThread.java

      Update this class to use Java 1.8 concurrent package. There also some corner-cases not being addressed with the current implementation:

      MergeThread.java
      // There is a scenario here where N threads have submitted inputs and are all waiting for the 'pendingToBeMerged' object.  At this point, imagine the 'close' method is called.  The close method will run, see nothing in the queue, interrupt the processing thread, and cause it to exit.  Afterwards, the 'startMerge' threads will all be triggered and add the inputs to a queue for which there is no consumer.  At this point, the T items have been removed from the inputs with no way to recover them.  In practice, this may not ever be the case, but it can be tightened up.
      
        public void startMerge(Set<T> inputs) {
          if (!closed) {
            numPending.incrementAndGet();
            List<T> toMergeInputs = new ArrayList<T>();
            Iterator<T> iter=inputs.iterator();
            for (int ctr = 0; iter.hasNext() && ctr < mergeFactor; ++ctr) {
              toMergeInputs.add(iter.next());
              iter.remove();
            }
            LOG.info(getName() + ": Starting merge with " + toMergeInputs.size() + 
                     " segments, while ignoring " + inputs.size() + " segments");
            synchronized(pendingToBeMerged) {
              pendingToBeMerged.addLast(toMergeInputs);
              pendingToBeMerged.notifyAll();
            }
          }
        }
      
        public synchronized void close() throws InterruptedException {
          closed = true;
          waitForMerge();
          interrupt();
        }
      

      Attachments

        1. MAPREDUCE-7057.1.patch
          10 kB
          David Mollitor
        2. MAPREDUCE-7057.2.patch
          10 kB
          David Mollitor
        3. MAPREDUCE-7057.2.2.patch
          10 kB
          David Mollitor
        4. MAPREDUCE-7057.4.patch
          11 kB
          David Mollitor

        Activity

          People

            Unassigned Unassigned
            belugabehr David Mollitor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: