Uploaded image for project: 'Pentaho Analysis - Mondrian'
  1. Pentaho Analysis - Mondrian
  2. MONDRIAN-994

Mapped Diagnostic Context (MDC) lost in RolapResultShepherd


    • Type: Bug
    • Status: Closed
    • Severity: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.


      What is MDC?

      A Mapped Diagnostic Context (MDC) is an instrument for distinguishing interleaved log output from different sources.
      Log output is typically interleaved when a server handles multiple clients near-simultaneously.
      The MDC is managed on a per thread basis. A child thread automatically inherits a copy of the mapped diagnostic context of its parent
      In short, it allows log consumers to have meta data about threads in a multi-threaded environment.
      It is a Hashtable with key value pairs providing the meta data about the thread.
      Without it, for example, we cannot be sure which logs statements belong to which MDX query being run if multiple MDX queries are run simultaneously

      Whats the issue?

      When the RolapResultShepherd is created, it automatically gains the MDC of its parent thread.
      The Executions that are run by the RolapResultShepherd end up with the MDC of the RolapResultShepherd, which is never updated after it is first created.
      As a result, the logging statements for these executions will contain the MDC of the RolapResultShepherd, instead of the original thread that created the Execution.
      All log statements end up with the same MDC


      How to resolve this?

      The MDC is updated from the MDC of the original thread whenever logging is going to be done

      Before the Execution is passed to the RolapResultShepherd, the MDC is saved as a Map in the Execution.
      Later when the Execution is actually processed, the Map is placed back into the MDC.




            • Assignee:
              wgorman Will Gorman (Inactive)
              ddosch Dan Dosch
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: