You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Mingjui Ray Liao (JIRA)" <ji...@apache.org> on 2009/10/16 12:09:32 UTC

[jira] Created: (HBASE-1912) When adding a secondary index to an existing table, it will cause NPE during re-indexing.

When adding a secondary index to an existing table, it will cause NPE during re-indexing. 
------------------------------------------------------------------------------------------

                 Key: HBASE-1912
                 URL: https://issues.apache.org/jira/browse/HBASE-1912
             Project: Hadoop HBase
          Issue Type: Bug
          Components: contrib
    Affects Versions: 0.20.1, 0.20.0
            Reporter: Mingjui Ray Liao
            Priority: Minor


When adding a secondary index to an existing table, an IndexSpecification must be constructed.
If we construct a simple index using the following constructor: IndexSpecification(String indexId, byte[] indexedColumn), then the program will cause NPE during re-indexing. 
    
Exception in thread "main" java.lang.NullPointerException
        at org.apache.hadoop.hbase.regionserver.tableindexed.IndexMaintenanceUtils.createIndexUpdate(IndexMaintenanceUtils.java:57)
        at org.apache.hadoop.hbase.client.tableindexed.IndexedTableAdmin.reIndexTable(IndexedTableAdmin.java:144)
        at org.apache.hadoop.hbase.client.tableindexed.IndexedTableAdmin.addIndex(IndexedTableAdmin.java:132)
        at MyIndexedTable.addSecondaryIndexToExistingTable(MyIndexedTable.java:256)
        at MyIndexedTable.main(MyIndexedTable.java:276)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HBASE-1912) When adding a secondary index to an existing table, it will cause NPE during re-indexing.

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

Andrew Purtell updated HBASE-1912:
----------------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

Committed to trunk and 0.20 branch. All local tests pass.

> When adding a secondary index to an existing table, it will cause NPE during re-indexing. 
> ------------------------------------------------------------------------------------------
>
>                 Key: HBASE-1912
>                 URL: https://issues.apache.org/jira/browse/HBASE-1912
>             Project: Hadoop HBase
>          Issue Type: Bug
>          Components: contrib
>    Affects Versions: 0.20.0, 0.20.1
>            Reporter: Mingjui Ray Liao
>            Priority: Minor
>             Fix For: 0.20.2, 0.21.0
>
>         Attachments: hbase-site.xml, IndexedTableTest.java, IndexSpecification.patch
>
>
> When adding a secondary index to an existing table, an IndexSpecification must be constructed.
> If we construct a simple index using the following constructor: IndexSpecification(String indexId, byte[] indexedColumn), then the program will cause NPE during re-indexing. 
>     
> Exception in thread "main" java.lang.NullPointerException
>         at org.apache.hadoop.hbase.regionserver.tableindexed.IndexMaintenanceUtils.createIndexUpdate(IndexMaintenanceUtils.java:57)
>         at org.apache.hadoop.hbase.client.tableindexed.IndexedTableAdmin.reIndexTable(IndexedTableAdmin.java:144)
>         at org.apache.hadoop.hbase.client.tableindexed.IndexedTableAdmin.addIndex(IndexedTableAdmin.java:132)
>         at MyIndexedTable.addSecondaryIndexToExistingTable(MyIndexedTable.java:256)
>         at MyIndexedTable.main(MyIndexedTable.java:276)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HBASE-1912) When adding a secondary index to an existing table, it will cause NPE during re-indexing.

Posted by "Mingjui Ray Liao (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-1912?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mingjui Ray Liao updated HBASE-1912:
------------------------------------

    Attachment: IndexSpecification.patch
                hbase-site.xml
                IndexedTableTest.java

IndexedTableTest.java is the application for triggering the problem.
hbase-site.xml is the configuration used.


The cause of the NPE is that inside IndexMaintenanceUtils.createIndexUpdate function, 
it attempts to iterate through IndexSpecification's additionalColumns without first
    checking for null assignment. 
    i.e. 
    for (byte[] col : indexSpec.getAdditionalColumns()) 
    { /* will NPE if additionalColumns = null }
    
Solution:
    There are many places that will attempts to get additionalColumns from the IndexSpecification.
    It is best to assign a zero length byte[][] inside the constructor, if the additionalColumns is null.

> When adding a secondary index to an existing table, it will cause NPE during re-indexing. 
> ------------------------------------------------------------------------------------------
>
>                 Key: HBASE-1912
>                 URL: https://issues.apache.org/jira/browse/HBASE-1912
>             Project: Hadoop HBase
>          Issue Type: Bug
>          Components: contrib
>    Affects Versions: 0.20.0, 0.20.1
>            Reporter: Mingjui Ray Liao
>            Priority: Minor
>         Attachments: hbase-site.xml, IndexedTableTest.java, IndexSpecification.patch
>
>
> When adding a secondary index to an existing table, an IndexSpecification must be constructed.
> If we construct a simple index using the following constructor: IndexSpecification(String indexId, byte[] indexedColumn), then the program will cause NPE during re-indexing. 
>     
> Exception in thread "main" java.lang.NullPointerException
>         at org.apache.hadoop.hbase.regionserver.tableindexed.IndexMaintenanceUtils.createIndexUpdate(IndexMaintenanceUtils.java:57)
>         at org.apache.hadoop.hbase.client.tableindexed.IndexedTableAdmin.reIndexTable(IndexedTableAdmin.java:144)
>         at org.apache.hadoop.hbase.client.tableindexed.IndexedTableAdmin.addIndex(IndexedTableAdmin.java:132)
>         at MyIndexedTable.addSecondaryIndexToExistingTable(MyIndexedTable.java:256)
>         at MyIndexedTable.main(MyIndexedTable.java:276)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HBASE-1912) When adding a secondary index to an existing table, it will cause NPE during re-indexing.

Posted by "Andrew Purtell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-1912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12766576#action_12766576 ] 

Andrew Purtell commented on HBASE-1912:
---------------------------------------

+1

Thanks for the bug report and patch Ray. Much appreciated. 

> When adding a secondary index to an existing table, it will cause NPE during re-indexing. 
> ------------------------------------------------------------------------------------------
>
>                 Key: HBASE-1912
>                 URL: https://issues.apache.org/jira/browse/HBASE-1912
>             Project: Hadoop HBase
>          Issue Type: Bug
>          Components: contrib
>    Affects Versions: 0.20.0, 0.20.1
>            Reporter: Mingjui Ray Liao
>            Priority: Minor
>         Attachments: hbase-site.xml, IndexedTableTest.java, IndexSpecification.patch
>
>
> When adding a secondary index to an existing table, an IndexSpecification must be constructed.
> If we construct a simple index using the following constructor: IndexSpecification(String indexId, byte[] indexedColumn), then the program will cause NPE during re-indexing. 
>     
> Exception in thread "main" java.lang.NullPointerException
>         at org.apache.hadoop.hbase.regionserver.tableindexed.IndexMaintenanceUtils.createIndexUpdate(IndexMaintenanceUtils.java:57)
>         at org.apache.hadoop.hbase.client.tableindexed.IndexedTableAdmin.reIndexTable(IndexedTableAdmin.java:144)
>         at org.apache.hadoop.hbase.client.tableindexed.IndexedTableAdmin.addIndex(IndexedTableAdmin.java:132)
>         at MyIndexedTable.addSecondaryIndexToExistingTable(MyIndexedTable.java:256)
>         at MyIndexedTable.main(MyIndexedTable.java:276)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HBASE-1912) When adding a secondary index to an existing table, it will cause NPE during re-indexing.

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

Andrew Purtell updated HBASE-1912:
----------------------------------

    Fix Version/s: 0.21.0
                   0.20.2
           Status: Patch Available  (was: Open)

> When adding a secondary index to an existing table, it will cause NPE during re-indexing. 
> ------------------------------------------------------------------------------------------
>
>                 Key: HBASE-1912
>                 URL: https://issues.apache.org/jira/browse/HBASE-1912
>             Project: Hadoop HBase
>          Issue Type: Bug
>          Components: contrib
>    Affects Versions: 0.20.1, 0.20.0
>            Reporter: Mingjui Ray Liao
>            Priority: Minor
>             Fix For: 0.20.2, 0.21.0
>
>         Attachments: hbase-site.xml, IndexedTableTest.java, IndexSpecification.patch
>
>
> When adding a secondary index to an existing table, an IndexSpecification must be constructed.
> If we construct a simple index using the following constructor: IndexSpecification(String indexId, byte[] indexedColumn), then the program will cause NPE during re-indexing. 
>     
> Exception in thread "main" java.lang.NullPointerException
>         at org.apache.hadoop.hbase.regionserver.tableindexed.IndexMaintenanceUtils.createIndexUpdate(IndexMaintenanceUtils.java:57)
>         at org.apache.hadoop.hbase.client.tableindexed.IndexedTableAdmin.reIndexTable(IndexedTableAdmin.java:144)
>         at org.apache.hadoop.hbase.client.tableindexed.IndexedTableAdmin.addIndex(IndexedTableAdmin.java:132)
>         at MyIndexedTable.addSecondaryIndexToExistingTable(MyIndexedTable.java:256)
>         at MyIndexedTable.main(MyIndexedTable.java:276)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.