You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Dave Brosius (JIRA)" <ji...@apache.org> on 2012/07/24 02:46:34 UTC

[jira] [Created] (CASSANDRA-4460) SystemTable.setBootstrapState always sets bootstrap state to true

Dave Brosius created CASSANDRA-4460:
---------------------------------------

             Summary: SystemTable.setBootstrapState always sets bootstrap state to true
                 Key: CASSANDRA-4460
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4460
             Project: Cassandra
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.2
            Reporter: Dave Brosius
            Priority: Trivial


    public static void setBootstrapState(BootstrapState state)
    {
        String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%b')";
        processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, getBootstrapState()));
        forceBlockingFlush(LOCAL_CF);
    }

Third parameter %b is set from getBootstrapState() which returns an enum, thus %b collapses to null/non null checks. This would seem then to always set it to true.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CASSANDRA-4460) SystemTable.setBootstrapState always sets bootstrap state to true

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

Brandon Williams commented on CASSANDRA-4460:
---------------------------------------------

While doing this would certainly prevent anyone from wanting to bikeshed the names in the future, it doesn't seem any less fragile, nor worth the complexity of migrating the system table schema.
                
> SystemTable.setBootstrapState always sets bootstrap state to true
> -----------------------------------------------------------------
>
>                 Key: CASSANDRA-4460
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4460
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2
>            Reporter: Dave Brosius
>            Assignee: Dave Brosius
>            Priority: Trivial
>         Attachments: use_bootstrap_enum_strings.txt
>
>
>     public static void setBootstrapState(BootstrapState state)
>     {
>         String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%b')";
>         processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, getBootstrapState()));
>         forceBlockingFlush(LOCAL_CF);
>     }
> Third parameter %b is set from getBootstrapState() which returns an enum, thus %b collapses to null/non null checks. This would seem then to always set it to true.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CASSANDRA-4460) SystemTable.setBootstrapState always sets bootstrap state to true

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

Brandon Williams updated CASSANDRA-4460:
----------------------------------------

    Attachment: 4460.txt

bq. it has to be migrated anyway. The table is defined to be boolean currently

Actually, it's only boolean in trunk and we don't need to keep trunk compatible with itself.  It turns out upgradeSystemData() is handling the 1.1 to trunk transition for us already.

bq.  I chose string as 0, 1, 2 mean nothing to me.

Fair enough.  Attaching a new version which takes all of this into account, and fixes a bug in setBootstrapState using getBootstrapState instead of the state passed to it.
                
> SystemTable.setBootstrapState always sets bootstrap state to true
> -----------------------------------------------------------------
>
>                 Key: CASSANDRA-4460
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4460
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2
>            Reporter: Dave Brosius
>            Assignee: Dave Brosius
>            Priority: Trivial
>         Attachments: 4460.txt, use_bootstrap_enum_strings.txt
>
>
>     public static void setBootstrapState(BootstrapState state)
>     {
>         String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%b')";
>         processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, getBootstrapState()));
>         forceBlockingFlush(LOCAL_CF);
>     }
> Third parameter %b is set from getBootstrapState() which returns an enum, thus %b collapses to null/non null checks. This would seem then to always set it to true.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CASSANDRA-4460) SystemTable.setBootstrapState always sets bootstrap state to true

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

Dave Brosius commented on CASSANDRA-4460:
-----------------------------------------

it has to be migrated anyway. The table is defined to be boolean currently. So either you migrate to integer or string. I chose string as 0, 1, 2 mean nothing to me.
                
> SystemTable.setBootstrapState always sets bootstrap state to true
> -----------------------------------------------------------------
>
>                 Key: CASSANDRA-4460
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4460
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2
>            Reporter: Dave Brosius
>            Assignee: Dave Brosius
>            Priority: Trivial
>         Attachments: use_bootstrap_enum_strings.txt
>
>
>     public static void setBootstrapState(BootstrapState state)
>     {
>         String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%b')";
>         processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, getBootstrapState()));
>         forceBlockingFlush(LOCAL_CF);
>     }
> Third parameter %b is set from getBootstrapState() which returns an enum, thus %b collapses to null/non null checks. This would seem then to always set it to true.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CASSANDRA-4460) SystemTable.setBootstrapState always sets bootstrap state to true

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

Dave Brosius updated CASSANDRA-4460:
------------------------------------

    Attachment: use_bootstrap_enum_strings.txt
    
> SystemTable.setBootstrapState always sets bootstrap state to true
> -----------------------------------------------------------------
>
>                 Key: CASSANDRA-4460
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4460
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2
>            Reporter: Dave Brosius
>            Priority: Trivial
>         Attachments: use_bootstrap_enum_strings.txt
>
>
>     public static void setBootstrapState(BootstrapState state)
>     {
>         String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%b')";
>         processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, getBootstrapState()));
>         forceBlockingFlush(LOCAL_CF);
>     }
> Third parameter %b is set from getBootstrapState() which returns an enum, thus %b collapses to null/non null checks. This would seem then to always set it to true.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CASSANDRA-4460) SystemTable.setBootstrapState always sets bootstrap state to true

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

Dave Brosius updated CASSANDRA-4460:
------------------------------------

    Attachment: use_bootstrap_enum_strings.txt

switch the systemtable.bootstrap field to be text and hold BootstrapState.name() so that the schema is more readable and easier to mutate in the future, if needed.

I'm not sure how upgrades from old schema generally is handled, that part still needs to be added to the patch.
                
> SystemTable.setBootstrapState always sets bootstrap state to true
> -----------------------------------------------------------------
>
>                 Key: CASSANDRA-4460
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4460
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2
>            Reporter: Dave Brosius
>            Priority: Trivial
>         Attachments: use_bootstrap_enum_strings.txt
>
>
>     public static void setBootstrapState(BootstrapState state)
>     {
>         String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%b')";
>         processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, getBootstrapState()));
>         forceBlockingFlush(LOCAL_CF);
>     }
> Third parameter %b is set from getBootstrapState() which returns an enum, thus %b collapses to null/non null checks. This would seem then to always set it to true.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CASSANDRA-4460) SystemTable.setBootstrapState always sets bootstrap state to true

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

Brandon Williams commented on CASSANDRA-4460:
---------------------------------------------

Actually, it breaks, and buildbot knows it:

{noformat}

ERROR [main] 2012-07-24 14:31:19,156 CassandraDaemon.java (line 335) Exception encountered during startup
java.lang.IndexOutOfBoundsException
        at java.nio.Buffer.checkIndex(Buffer.java:520)
        at java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:340)
        at org.apache.cassandra.utils.ByteBufferUtil.toInt(ByteBufferUtil.java:414)
        at org.apache.cassandra.cql.jdbc.JdbcInt32.compose(JdbcInt32.java:94)
        at org.apache.cassandra.db.marshal.Int32Type.compose(Int32Type.java:33)
        at org.apache.cassandra.cql3.UntypedResultSet$Row.getInt(UntypedResultSet.java:104)
        at org.apache.cassandra.db.SystemTable.getBootstrapState(SystemTable.java:375)
        at org.apache.cassandra.db.SystemTable.setBootstrapState(SystemTable.java:391)
        at org.apache.cassandra.service.StorageService.joinTokenRing(StorageService.java:691)
        at org.apache.cassandra.service.StorageService.initServer(StorageService.java:476)
        at org.apache.cassandra.service.StorageService.initServer(StorageService.java:367)
        at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:228)
        at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:318)
        at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:361)
{noformat}

Obviously we should be using %i instead.
                
> SystemTable.setBootstrapState always sets bootstrap state to true
> -----------------------------------------------------------------
>
>                 Key: CASSANDRA-4460
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4460
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2
>            Reporter: Dave Brosius
>            Priority: Trivial
>
>     public static void setBootstrapState(BootstrapState state)
>     {
>         String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%b')";
>         processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, getBootstrapState()));
>         forceBlockingFlush(LOCAL_CF);
>     }
> Third parameter %b is set from getBootstrapState() which returns an enum, thus %b collapses to null/non null checks. This would seem then to always set it to true.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CASSANDRA-4460) SystemTable.setBootstrapState always sets bootstrap state to true

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

Dave Brosius updated CASSANDRA-4460:
------------------------------------

    Attachment:     (was: use_bootstrap_enum_strings.txt)
    
> SystemTable.setBootstrapState always sets bootstrap state to true
> -----------------------------------------------------------------
>
>                 Key: CASSANDRA-4460
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4460
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2
>            Reporter: Dave Brosius
>            Priority: Trivial
>         Attachments: use_bootstrap_enum_strings.txt
>
>
>     public static void setBootstrapState(BootstrapState state)
>     {
>         String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%b')";
>         processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, getBootstrapState()));
>         forceBlockingFlush(LOCAL_CF);
>     }
> Third parameter %b is set from getBootstrapState() which returns an enum, thus %b collapses to null/non null checks. This would seem then to always set it to true.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CASSANDRA-4460) SystemTable.setBootstrapState always sets bootstrap state to true

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

Dave Brosius commented on CASSANDRA-4460:
-----------------------------------------

LGTM
                
> SystemTable.setBootstrapState always sets bootstrap state to true
> -----------------------------------------------------------------
>
>                 Key: CASSANDRA-4460
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4460
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2
>            Reporter: Dave Brosius
>            Assignee: Dave Brosius
>            Priority: Trivial
>         Attachments: 4460.txt, use_bootstrap_enum_strings.txt
>
>
>     public static void setBootstrapState(BootstrapState state)
>     {
>         String req = "INSERT INTO system.%s (key, bootstrapped) VALUES ('%s', '%b')";
>         processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, getBootstrapState()));
>         forceBlockingFlush(LOCAL_CF);
>     }
> Third parameter %b is set from getBootstrapState() which returns an enum, thus %b collapses to null/non null checks. This would seem then to always set it to true.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira