drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-4134) Incorporate remaining patches from DRILL-1942 Allocator refactor
Date Thu, 03 Dec 2015 17:49:11 GMT

    [ https://issues.apache.org/jira/browse/DRILL-4134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15038193#comment-15038193
] 

ASF GitHub Bot commented on DRILL-4134:
---------------------------------------

Github user adeneche commented on a diff in the pull request:

    https://github.com/apache/drill/pull/283#discussion_r46585304
  
    --- Diff: common/src/main/java/org/apache/drill/common/HistoricalLog.java ---
    @@ -0,0 +1,179 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.common;
    +
    +import java.util.Arrays;
    +import java.util.LinkedList;
    +
    +import org.slf4j.Logger;
    +
    +/**
    + * Utility class that can be used to log activity within a class
    + * for later logging and debugging. Supports recording events and
    + * recording the stack at the time they occur.
    + */
    +public class HistoricalLog {
    +  private static class Event {
    +    private final String note; // the event text
    +    private final StackTrace stackTrace; // where the event occurred
    +
    +    public Event(final String note) {
    +      this.note = note;
    +      stackTrace = new StackTrace();
    +    }
    +  }
    +
    +  private final LinkedList<Event> history = new LinkedList<>();
    +  private final String idString; // the formatted id string
    +  private Event firstEvent; // the first stack trace recorded
    +  private final int limit; // the limit on the number of events kept
    +
    +  /**
    +   * Constructor. The format string will be formatted and have its arguments
    +   * substituted at the time this is called.
    +   *
    +   * @param idStringFormat {@link String#format} format string that can be used
    +   *     to identify this object in a log. Including some kind of unique identifier
    +   *     that can be associated with the object instance is best.
    +   * @param args for the format string, or nothing if none are required
    +   */
    +  public HistoricalLog(final String idStringFormat, Object... args) {
    +    this(Integer.MAX_VALUE, idStringFormat, args);
    +  }
    +
    +  /**
    +   * Constructor. The format string will be formatted and have its arguments
    +   * substituted at the time this is called.
    +   *
    +   * <p>This form supports the specification of a limit that will limit the
    +   * number of historical entries kept (which keeps down the amount of memory
    +   * used). With the limit, the first entry made is always kept (under the
    +   * assumption that this is the creation site of the object, which is usually
    +   * interesting), and then up to the limit number of entries are kept after that.
    +   * Each time a new entry is made, the oldest that is not the first is dropped.
    +   * </p>
    +   *
    +   * @param limit the maximum number of historical entries that will be kept,
    +   *   not including the first entry made
    +   * @param idStringFormat {@link String#format} format string that can be used
    +   *     to identify this object in a log. Including some kind of unique identifier
    +   *     that can be associated with the object instance is best.
    +   * @param args for the format string, or nothing if none are required
    +   */
    +  public HistoricalLog(final int limit, final String idStringFormat, Object... args)
{
    +    this.limit = limit;
    +    this.idString = String.format(idStringFormat, args);
    +  }
    +
    +  /**
    +   * Record an event. Automatically captures the stack trace at the time this is
    +   * called. The format string will be formatted and have its arguments substituted
    +   * at the time this is called.
    +   *
    +   * @param noteFormat {@link String#format} format string that describes the event
    +   * @param args for the format string, or nothing if none are required
    +   */
    +  public synchronized void recordEvent(final String noteFormat, Object... args) {
    --- End diff --
    
    would it make sense to also store a timestamp for each event ? This would help debugging
sliced buffers


> Incorporate remaining patches from DRILL-1942 Allocator refactor
> ----------------------------------------------------------------
>
>                 Key: DRILL-4134
>                 URL: https://issues.apache.org/jira/browse/DRILL-4134
>             Project: Apache Drill
>          Issue Type: Sub-task
>          Components: Execution - Flow
>            Reporter: Jacques Nadeau
>            Assignee: Jacques Nadeau
>             Fix For: 1.4.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message