Issue Details (XML | Word | Printable)

Key: CORE-1746
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vlad Khorsun
Reporter: Thomas Steinmaurer
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Expression index can be created while doing inserts into table

Created: 16/Feb/08 03:09 PM   Updated: 18/Nov/08 01:08 PM
Component/s: Engine
Affects Version/s: 2.0.3, 2.1 RC1
Fix Version/s: 2.1 RC2, 2.0.4

Time Tracking:
Issue & Sub-Tasks
Issue Only
Not Specified

Environment: Windows XP Prof. SP 2, Firebird Classic Server

Target: 2.1 RC2 and 2.0.4
Planning Status: Unspecified

Sub-Tasks  All   Open   

 Description  « Hide
when I'm trying to activate an index while inserting records into the
same table, I get an object in use error message.This does not happen
when activating an expression index though. Why is there a difference
and am I asking for troubles (e.g. corrupted index) when activating an
expression index while doing bulk inserts?

Test case:

1) Create metadata

CREATE GENERATOR T1_GEN;

SET TERM ^^ ;
CREATE PROCEDURE P_FILL_T1 (
  NR_OF_RECORDS BigInt) AS
BEGIN
  SUSPEND;
END
 ^^
SET TERM ; ^^

CREATE TABLE T1
(
  T1_ID BIGINT NOT NULL,
  VC1 CHAR( 1) COLLATE NONE,
 CONSTRAINT PK_T1 PRIMARY KEY (T1_ID)
);

SET TERM ^^ ;
ALTER PROCEDURE P_FILL_T1 (
  NR_OF_RECORDS BigInt) AS
declare variable i integer;
begin
  i = 1;
  while (i <= nr_of_records) do
  begin
    insert into t1 (t1_id, vc1) values (gen_id(t1_gen, 1), 'a');
    i = i + 1;
  end
end ^^
SET TERM ; ^^

commit;

2) Execute SP

execute procedure p_fill_t1 (500000);


3) Create index in another database session

While the procedure is still running, the following index creation will fail at commit time, which is, according to Vlad and Dmitry OK.

create index i_t1_vc1 on t1 (vc1);
commit;

While the procedure is still running, the following expression index creation will succeed, which is, according to Vlad and Dmitry a BUG.

create index i_t1_vc1_expression on t1 computed by (upper(vc1));
commit;



 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Vlad Khorsun added a comment - 08/Mar/08 10:04 AM
For v2.5 i prepare more complex fix to avoid code dublication