accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keith-turner <>
Subject [GitHub] accumulo pull request #270: ACCUMULO-4657 Reduce excessive logging / logging...
Date Tue, 20 Jun 2017 16:18:02 GMT
Github user keith-turner commented on a diff in the pull request:
    --- Diff: server/base/src/main/java/org/apache/accumulo/server/util/
    @@ -894,12 +895,19 @@ public static void removeBulkLoadEntries(Connector conn, String
tableId, long ti
             BatchWriter bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig()))
           mscanner.setRange(new KeyExtent(tableId, null, null).toMetadataRange());
    +      boolean shouldTrace = log.isTraceEnabled();
    +      byte[] tidAsBytes = Long.toString(tid).getBytes(UTF_8);
           for (Entry<Key,Value> entry : mscanner) {
    -        log.debug("Looking at entry " + entry + " with tid " + tid);
    -        if (Long.parseLong(entry.getValue().toString()) == tid) {
    -          log.debug("deleting entry " + entry);
    -          Mutation m = new Mutation(entry.getKey().getRow());
    -          m.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier());
    +        if (shouldTrace) {
    +          log.trace("Looking at entry " + entry + " with tid " + tid);
    --- End diff --
    This is not related to this PR, but its something I learned about slf4j vs log4j.  This
conversation reminded me of it and I thought it was worth sharing.
    Varargs methods can be expensive in a tight loop, because it allocates an array and copies
to it.  Slf4j avoids this for one and two arguments by providing specialized methods.  However
3 or more args will use varargs.  
    I learned from @EdColeman that log4j V2  provides specialized methods for up to 10 arguments
to avoid varargs. For example this is the [debug method that takes 10 args](
    Wish slf4j had this.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message