With a very simple test, I get the ‘mkey.bulk_rotate_xor_hash’ exception. After this error, the only way I have found to recover is to drop the table, re-create and repopulate it.
 
create table fluid (
fluid bigint not null,
userID int not null default 0,
relativeUser bigint not null,
typeID tinyint default 127,
updateTime timestamp(0) default now(),
constraint fluid_pk primary key( fluid, userID ),
constraint user_fk1 foreign key ( userID ) references fuser ( userID )
);
create index rel_user_idx1 on fluid ( relativeUser );
create index userID_idx2 on fluid ( userID );
create index rel_user_user_idx1 on fluid ( relativeUser, userID );
create index update_idx1 on fluid ( updateTime );
 
Here is a snapshot including a trace of a successful ‘alter table drop constraint …’ command after NO records have been deleted. When I delete 1 ( or more records ), I get the exception with no trace output.
 
sql>alter table fluid drop constraint fluid_pk;
operation successful
sql>set optimizer='nov2009_pipe';
sql>trace alter table fluid add constraint fluid_pk primary key( fluid, userID );
operation successful
+------+--------------------------------------------------------------------------------------------------------------+
| tick | stmt                                                                                                         |
: s    :                                                                                                              :
+======+==============================================================================================================+
|    7 | _2 := sql.mvc();                                                                                             |
|  451 | sql.catalog(29,"FLDB",42302696,0);                                                                           |
|   32 | _16:bat[:oid,:lng] <tmp_4741501>[52] := sql.bind(_2=48362568,"FLDB","fluid","fluid",0);                        |
|   22 | _13:bat[:oid,:int] <tmp_4741500>[52] := sql.bind(_2=48362568,"FLDB","fluid","userID",0);                    |
|   15 | _10:bat[:oid,:oid] <tmp_4741364>[0] := sql.bind_dbat(_2=48362568,"FLDB","fluid",1);                           |
|   10 | _12<tmpr_4741364>[0] := bat.reverse(_10=nil:bat[:oid,:oid]);                                                 |
|   20 | _15<tmp_4741350>[52] := algebra.kdifference(_13=nil:bat[:oid,:int],_12=<tmpr_4741364>[0]);                   |
|   22 | _17<tmp_4741012>[52] := algebra.kdifference(_16=nil:bat[:oid,:lng],_12=nil);                                 |
|   11 | _19:bat[:oid,:wrd] <tmp_4741265>[52] := batcalc.hash(_17=<tmp_4741012>[52]);                                 |
|   29 | _22<tmp_4741636>[52] := bat.mirror(_17=<tmp_4741012>[52]);                                                   |
|   16 | _21:bat[:oid,:wrd] <tmp_4741417>[52] := mkey.bulk_rotate_xor_hash(_19=nil:bat[:oid,:wrd],22,_15=<tmp_4741350 |
:      : >[52]);                                                                                                      :
|    8 | _23<tmpr_4741636>[52] := bat.reverse(_22=nil);                                                               |
|   52 | _24<tmp_4741265>[52] := algebra.join(_23=nil,_21=nil:bat[:oid,:wrd]);                                        |
|   15 | (ext60<tmp_4741417>[52],grp58<tmp_4741636>[52]) := group.new(_24=<tmp_4741265>[52]);                         |
|   19 | (ext63<tmp_4741417>[52],grp61<tmp_4741636>[52]) := group.derive(ext60=nil,grp58=nil,_17=nil);                |
|   10 | (ext66<tmp_4741417>[52],grp64<tmp_4741636>[52]) := group.done(ext63=nil,grp61=nil,_15=nil);                  |
|    9 | _31<tmp_4740027>[52] := bat.mirror(ext66=nil);                                                               |
|   10 | _32:bat[:oid,:wrd] <tmp_4741417>[52] := aggr.count(grp64=nil,grp64=nil,_31=nil);                             |
|   17 | return sum := aggr.sum(b=<tmp_4741417>[52],true);                                                            |
|   44 | _33:wrd  := aggr.sum(_32=<tmp_4741417>:bat[:oid,:wrd][52]);                                                  |
|    5 | _34 := calc.isnil(_33=52:wrd);                                                                               |
|    7 | _37 := aggr.count(_32=nil:bat[:oid,:wrd]);                                                                   |
|    6 | _36 := calc.ifthenelse(_34=false,0:wrd,_33=52:wrd);                                                          |
|    5 | _38 := calc.!=(_37=52:wrd,_36=52:wrd);                                                                       |
| 2827 | barrier _53 := language.dataflow();                                                                          |
|    6 | sql.assert(_38=false,"UPDATE: PRIMARY KEY constraint 'fluid.fluid_pk' violated");                              |
|   27 | sql.update(_2=48362568,"FLDB","fluid","fluid_pk",_24=nil);                                                     |
|    5 | sql.exportOperation("");                                                                                     |
| 3724 | user.s1_1();                                                                                                 |
+------+--------------------------------------------------------------------------------------------------------------+
29 tuples (50.262ms)
sql>set optimizer='default_pipe';
sql>alter table fluid drop constraint fluid_pk;
operation successful
sql>delete from fluid where relativeUser = 11111;
1 affected row (1.557ms)
sql>trace alter table fluid add constraint fluid_pk primary key( fluid, userID );
MALException:mkey.bulk_rotate_xor_hash:operation failed Operands not synced on head
 
I need to periodically do bulk loads ( ‘copy into’ ), but also need to be able to periodically delete records from the same table.
 
Is there a resolution to this problem?
 
Thanks
Steve