You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Radim Kolar (JIRA)" <ji...@apache.org> on 2012/09/21 12:37:07 UTC

[jira] [Created] (CASSANDRA-4697) incorrect debug message in LeveledManifest.java

Radim Kolar created CASSANDRA-4697:
--------------------------------------

             Summary: incorrect debug message in LeveledManifest.java
                 Key: CASSANDRA-4697
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4697
             Project: Cassandra
          Issue Type: Improvement
          Components: Core
    Affects Versions: 1.1.5, 1.0.11
            Reporter: Radim Kolar
            Priority: Trivial


https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java line 622.

logger.debug("Estimating {} compactions to do for {}.{}",
new Object[] {Arrays.asList(estimated), cfs.table.name, cfs.columnFamily});

It does not print list as intended. Arrays.asList(estimated).toString() results in object reference number, not list itself making debug message useless.

list should be printed by code like this:

   String delim = "";
    for (Item i : list) {
        sb.append(delim).append(i);
        delim = ",";
    }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CASSANDRA-4697) incorrect debug message in LeveledManifest.java

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4697?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis resolved CASSANDRA-4697.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.1.6
         Reviewer: jbellis
         Assignee: Yuki Morishita

Ah, that makes sense.  Committed Arrays.toString fix.
                
> incorrect debug message in LeveledManifest.java
> -----------------------------------------------
>
>                 Key: CASSANDRA-4697
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4697
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.0.11, 1.1.5
>            Reporter: Radim Kolar
>            Assignee: Yuki Morishita
>            Priority: Trivial
>             Fix For: 1.1.6
>
>
> https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java line 622.
> logger.debug("Estimating {} compactions to do for {}.{}",
> new Object[] {Arrays.asList(estimated), cfs.table.name, cfs.columnFamily});
> It does not print list as intended. Arrays.asList(estimated).toString() results in object reference number, not list itself making debug message useless.
> list should be printed by code like this:
>    String delim = "";
>     for (Item i : list) {
>         sb.append(delim).append(i);
>         delim = ",";
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4697) incorrect debug message in LeveledManifest.java

Posted by "Yuki Morishita (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460597#comment-13460597 ] 

Yuki Morishita commented on CASSANDRA-4697:
-------------------------------------------

bq, But why is ArrayList.toString not being invoked?

It is called. But because it is passing primitive long array as varargs of Arrays.asList, ArrayList generated is actually list of long[], length of 1 with first item containing long[].
So when ArrayList.toString is called, it prints out list of "long[].toString".
                
> incorrect debug message in LeveledManifest.java
> -----------------------------------------------
>
>                 Key: CASSANDRA-4697
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4697
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.0.11, 1.1.5
>            Reporter: Radim Kolar
>            Priority: Trivial
>
> https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java line 622.
> logger.debug("Estimating {} compactions to do for {}.{}",
> new Object[] {Arrays.asList(estimated), cfs.table.name, cfs.columnFamily});
> It does not print list as intended. Arrays.asList(estimated).toString() results in object reference number, not list itself making debug message useless.
> list should be printed by code like this:
>    String delim = "";
>     for (Item i : list) {
>         sb.append(delim).append(i);
>         delim = ",";
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4697) incorrect debug message in LeveledManifest.java

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460550#comment-13460550 ] 

Jonathan Ellis commented on CASSANDRA-4697:
-------------------------------------------

Arrays.asList returns ArrayList extends AbstractList extends AbstractCollection, and AbstractCollection.toString is

{code}
    public String toString() {
        Iterator<E> i = iterator();
	if (! i.hasNext())
	    return "[]";

	StringBuilder sb = new StringBuilder();
	sb.append('[');
	for (;;) {
	    E e = i.next();
	    sb.append(e == this ? "(this Collection)" : e);
	    if (! i.hasNext())
		return sb.append(']').toString();
	    sb.append(", ");
	}
    }
{code}

                
> incorrect debug message in LeveledManifest.java
> -----------------------------------------------
>
>                 Key: CASSANDRA-4697
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4697
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.0.11, 1.1.5
>            Reporter: Radim Kolar
>            Priority: Trivial
>
> https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java line 622.
> logger.debug("Estimating {} compactions to do for {}.{}",
> new Object[] {Arrays.asList(estimated), cfs.table.name, cfs.columnFamily});
> It does not print list as intended. Arrays.asList(estimated).toString() results in object reference number, not list itself making debug message useless.
> list should be printed by code like this:
>    String delim = "";
>     for (Item i : list) {
>         sb.append(delim).append(i);
>         delim = ",";
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Comment Edited] (CASSANDRA-4697) incorrect debug message in LeveledManifest.java

Posted by "Yuki Morishita (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460566#comment-13460566 ] 

Yuki Morishita edited comment on CASSANDRA-4697 at 9/22/12 2:40 AM:
--------------------------------------------------------------------

Currently, it outputs like (on trunk):

DEBUG [main] 2012-09-21 10:33:20,493 LeveledManifest.java (line 621) Estimating [[J@3834a1c8] compactions to do for Keyspace1.Standard1

Changing to http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#toString(long[]) generates:

DEBUG [main] 2012-09-21 10:37:29,181 LeveledManifest.java (line 621) Estimating [0, 0, 0, 0, 0, 0, 0, 0] compactions to do for Keyspace1.Standard1

So, just use Arrays.toString :)

(edited: it is actually long[])
                
      was (Author: yukim):
    Currently, it outputs like (on trunk):

DEBUG [main] 2012-09-21 10:33:20,493 LeveledManifest.java (line 621) Estimating [[J@3834a1c8] compactions to do for Keyspace1.Standard1

Changing to http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#toString(java.lang.Object[]) generates:

DEBUG [main] 2012-09-21 10:37:29,181 LeveledManifest.java (line 621) Estimating [0, 0, 0, 0, 0, 0, 0, 0] compactions to do for Keyspace1.Standard1

So, just use Arrays.toString :)
                  
> incorrect debug message in LeveledManifest.java
> -----------------------------------------------
>
>                 Key: CASSANDRA-4697
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4697
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.0.11, 1.1.5
>            Reporter: Radim Kolar
>            Priority: Trivial
>
> https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java line 622.
> logger.debug("Estimating {} compactions to do for {}.{}",
> new Object[] {Arrays.asList(estimated), cfs.table.name, cfs.columnFamily});
> It does not print list as intended. Arrays.asList(estimated).toString() results in object reference number, not list itself making debug message useless.
> list should be printed by code like this:
>    String delim = "";
>     for (Item i : list) {
>         sb.append(delim).append(i);
>         delim = ",";
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4697) incorrect debug message in LeveledManifest.java

Posted by "Yuki Morishita (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460566#comment-13460566 ] 

Yuki Morishita commented on CASSANDRA-4697:
-------------------------------------------

Currently, it outputs like (on trunk):

DEBUG [main] 2012-09-21 10:33:20,493 LeveledManifest.java (line 621) Estimating [[J@3834a1c8] compactions to do for Keyspace1.Standard1

Changing to http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#toString(java.lang.Object[]) generates:

DEBUG [main] 2012-09-21 10:37:29,181 LeveledManifest.java (line 621) Estimating [0, 0, 0, 0, 0, 0, 0, 0] compactions to do for Keyspace1.Standard1

So, just use Arrays.toString :)
                
> incorrect debug message in LeveledManifest.java
> -----------------------------------------------
>
>                 Key: CASSANDRA-4697
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4697
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.0.11, 1.1.5
>            Reporter: Radim Kolar
>            Priority: Trivial
>
> https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java line 622.
> logger.debug("Estimating {} compactions to do for {}.{}",
> new Object[] {Arrays.asList(estimated), cfs.table.name, cfs.columnFamily});
> It does not print list as intended. Arrays.asList(estimated).toString() results in object reference number, not list itself making debug message useless.
> list should be printed by code like this:
>    String delim = "";
>     for (Item i : list) {
>         sb.append(delim).append(i);
>         delim = ",";
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-4697) incorrect debug message in LeveledManifest.java

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460584#comment-13460584 ] 

Jonathan Ellis commented on CASSANDRA-4697:
-------------------------------------------

If we switch to explicitly calling a method, we need to add a "if logger.isDebugEnabled" wrapper, otherwise the method call gets evaluated unnecessarily.

But why is ArrayList.toString not being invoked?
                
> incorrect debug message in LeveledManifest.java
> -----------------------------------------------
>
>                 Key: CASSANDRA-4697
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4697
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.0.11, 1.1.5
>            Reporter: Radim Kolar
>            Priority: Trivial
>
> https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java line 622.
> logger.debug("Estimating {} compactions to do for {}.{}",
> new Object[] {Arrays.asList(estimated), cfs.table.name, cfs.columnFamily});
> It does not print list as intended. Arrays.asList(estimated).toString() results in object reference number, not list itself making debug message useless.
> list should be printed by code like this:
>    String delim = "";
>     for (Item i : list) {
>         sb.append(delim).append(i);
>         delim = ",";
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira