You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Hong Ji <ho...@gmail.com> on 2012/07/04 12:03:22 UTC

Error when dropping a table

The error happens only when deleting a table created in previous Derby
build. I can create the same table now and delete it without any problem.

 It is with Derby 10.8.2.2. The SQL statement is just 'DROP Table
[TableName]'.

Following are the stack traces:

java.sql.SQLException: XJ001.U : [0]
org.apache.derby.shared.common.sanity.AssertFailure, [1] ASSERT FAILED
Index row (NULL,(38,13)) not found in conglomerateid 177Current scan =
    btree = BTREE: containerid = Container(0, 177);nKeyFields =
2;nUniqueColumns = 2;allowDuplicates = false
    scan direction       = forward
    (scan_state:SCAN_DONE
    rh:null
    key:null)
    init_rawtran = 19926
    init_hold = false
    init_forUpdate = true
    init_useUpdateLocks = false
    init_scanColumnList = null
    init_scanColumnList.size() = 0
    init_template = col[0]=NULLcol[1]=(38,21)
    init_startKeyValue = col[0]=NULLcol[1]=(38,13)
    init_startSearchOperator = GE
    init_qualifier[]         = null
    init_stopKeyValue = col[0]=NULLcol[1]=(38,13)
    init_stopSearchOperator = GT
    stat_numpages_visited         = 2
    stat_numrows_visited          = 1
    stat_numrows_qualified        = 0
    stat_numdeleted_rows_visited  = 0
    at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:98)
    at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
    at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
    at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:412)
    at
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:348)
    at
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2290)
    at
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:82)
    at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1334)
    at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:630)
    at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:559)
    at com.xxx.db.derby.DerbyDAOFactory.cleanup(DerbyDAOFactory.java:2985)
Caused by: java.sql.SQLException: XJ001.U : [0]
org.apache.derby.shared.common.sanity.AssertFailure, [1] ASSERT FAILED
Index row (NULL,(38,13)) not found in conglomerateid 177Current scan =
    btree = BTREE: containerid = Container(0, 177);nKeyFields =
2;nUniqueColumns = 2;allowDuplicates = false
    scan direction       = forward
    (scan_state:SCAN_DONE
    rh:null
    key:null)
    init_rawtran = 19926
    init_hold = false
    init_forUpdate = true
    init_useUpdateLocks = false
    init_scanColumnList = null
    init_scanColumnList.size() = 0
    init_template = col[0]=NULLcol[1]=(38,21)
    init_startKeyValue = col[0]=NULLcol[1]=(38,13)
    init_startSearchOperator = GE
    init_qualifier[]         = null
    init_stopKeyValue = col[0]=NULLcol[1]=(38,13)
    init_stopSearchOperator = GT
    stat_numpages_visited         = 2
    stat_numrows_visited          = 1
    stat_numrows_qualified        = 0
    stat_numdeleted_rows_visited  = 0
    at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
    at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:122)
    at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
    ... 13 more
Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT
FAILED Index row (NULL,(38,13)) not found in conglomerateid 177Current scan
=
    btree = BTREE: containerid = Container(0, 177);nKeyFields =
2;nUniqueColumns = 2;allowDuplicates = false
    scan direction       = forward
    (scan_state:SCAN_DONE
    rh:null
    key:null)
    init_rawtran = 19926
    init_hold = false
    init_forUpdate = true
    init_useUpdateLocks = false
    init_scanColumnList = null
    init_scanColumnList.size() = 0
    init_template = col[0]=NULLcol[1]=(38,21)
    init_startKeyValue = col[0]=NULLcol[1]=(38,13)
    init_startSearchOperator = GE
    init_qualifier[]         = null
    init_stopKeyValue = col[0]=NULLcol[1]=(38,13)
    init_stopSearchOperator = GT
    stat_numpages_visited         = 2
    stat_numrows_visited          = 1
    stat_numrows_qualified        = 0
    stat_numdeleted_rows_visited  = 0
    at
org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
    at
org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
    *at
org.apache.derby.impl.sql.execute.IndexChanger.doDelete(IndexChanger.java:351)
*
    at
org.apache.derby.impl.sql.execute.IndexChanger.delete(IndexChanger.java:545)
    at
org.apache.derby.impl.sql.execute.IndexSetChanger.delete(IndexSetChanger.java:250)
    at
org.apache.derby.impl.sql.execute.RowChangerImpl.deleteRow(RowChangerImpl.java:476)
    at
org.apache.derby.impl.sql.catalog.TabInfoImpl.deleteRows(TabInfoImpl.java:739)
    at
org.apache.derby.impl.sql.catalog.TabInfoImpl.deleteRow(TabInfoImpl.java:570)
    at
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.dropColumnDescriptorCore(DataDictionaryImpl.java:3552)
    at
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.dropAllColumnDescriptors(DataDictionaryImpl.java:2846)
    at
org.apache.derby.impl.sql.execute.DropTableConstantAction.executeConstantAction(DropTableConstantAction.java:216)
    at
org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:61)
    at
org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
    at
org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
    at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1242)
    ... 6 more

I looked at the source code in
org.apache.derby.impl.sql.execute.IndexChanger.doDelete(). There is the
comment block here:
               "// This means that the entry for the index does not exist,
this
                // is a serious problem with the index.  Past fixed problems
                // like track 3703 can leave db's in the field with this
problem
                // even though the bug in the code which caused it has long
                // since been fixed.  Then the problem can surface months
later
                // when the customer attempts to upgrade.  By "ignoring" the
                // missing row here the problem is automatically "fixed" and
                // since the code is trying to delete the row anyway it
doesn't
                // seem like such a bad idea.  It also then gives a tool to
                // support to be able to fix some system catalog problems
where
                // they can delete the base rows by dropping the system
objects
                // like stored statements."



Does anyone have explanation on the error? Is there anything we can do to
drop the table successfully?


Thanks,

Hong

Re: Error when dropping a table

Posted by Bryan Pendleton <bp...@gmail.com>.
> Does anyone have explanation on the error? Is there anything we can do to drop the table successfully?

There's some sort of a bug here. If you can file it in JIRA with whatever supporting
information you can provide (ideally, a reproduction case or perhaps a backup of the
database with this problem), that would help the developers tremendously.

If you can't drop the table, can you rename it? That at least would move it out
of the way so you can get on with your work.

thanks,

bryan