db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3947) Cannot insert 994 character long string into indexed column
Date Tue, 24 Nov 2009 04:38:41 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781770#action_12781770

Bryan Pendleton commented on DERBY-3947:

I fiddled with this problem for a little while, and I think that the
problem is that the index which is created behind-the-scenes to
implement the PRIMARY KEY constraint goes through a different
code path than the normal index which is created by CREATE INDEX.

In the case of

  create table t (x varchar(1000));
  create index t_ix on t(x);

we go through CreateIndexNode.makeConstantAction, where there
is code that looks at the size of the columns in the index and notices
that we need a larger page size for this index, and chooses the
larger page size automatically.

But in the case from the issue description

   create table t (x varchar(1000) primary key)

we *instead* go through TableElementNode.genIndexAction,
which doesn't have any logic to notice that a larger page size is needed.

I think that we could fix this problem by arranging for the colInfos data
from the CreateTableNode to be passed through to TableElementNode.genIndexAction
so that it can check the size of the columns and see if it needs to create the
PRIMARY KEY index with a larger page size.

Ideally, it would be great if we could somehow share this code between
CreateIndexNode and TableElementNode, but I think that the data
structures are unfortunately not very similar so we may end up
with two bits of code instead.

At least, I can *start* by writing a second bit of code and demonstrating
that it fixes the problem, and then we can try to figure out how to share
the code and only compute the index's needed page size once.

> Cannot insert 994 character long string into indexed column
> -----------------------------------------------------------
>                 Key: DERBY-3947
>                 URL: https://issues.apache.org/jira/browse/DERBY-3947
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: VarcharIndex.java
> Inserting a 994 character string into a varchar(1000) column with an index fails.
> These steps
> 1. "create table t (x varchar(1000) primary key)"
> 2. "insert into t values (?)" where ? holds a 994 character string
> produce the following error:
> ERROR XSCB6: Limitation: Record of a btree secondary index cannot be updated or inserted
due to lack of space on the page.  Use the parameters derby.storage.pageSize and/or derby.storage.pageReservedSpace
to work around this limitation.
>         at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:276)
>         at org.apache.derby.impl.store.access.btree.BTreeController.doIns(BTreeController.java:845)
>         at org.apache.derby.impl.store.access.btree.BTreeController.insert(BTreeController.java:1264)
>         at org.apache.derby.impl.store.access.btree.index.B2IController.insert(B2IController.java:210)
>         at org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups(IndexChanger.java:439)
>         at org.apache.derby.impl.sql.execute.IndexChanger.doInsert(IndexChanger.java:383)
>         at org.apache.derby.impl.sql.execute.IndexChanger.insert(IndexChanger.java:589)
>         at org.apache.derby.impl.sql.execute.IndexSetChanger.insert(IndexSetChanger.java:268)
>         at org.apache.derby.impl.sql.execute.RowChangerImpl.insertRow(RowChangerImpl.java:453)
>         at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(InsertResultSet.java:1011)
>         at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:487)
>         at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:372)
>         at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)
> The page size should be set sufficiently high at index creation time to hold columns
with the specified maximum size.

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

View raw message