Commit 5b540f05 authored by unknown's avatar unknown

WL#1648 - Start/Stop Inserting Duplicates Into a Table

parent bffc3339
......@@ -21,6 +21,10 @@
#include "heapdef.h"
static void heap_extra_keyflag(register HP_INFO *info,
enum ha_extra_function function);
/* set extra flags for database */
int heap_extra(register HP_INFO *info, enum ha_extra_function function)
......@@ -41,8 +45,37 @@ int heap_extra(register HP_INFO *info, enum ha_extra_function function)
case HA_EXTRA_READCHECK:
info->opt_flag|= READ_CHECK_USED;
break;
case HA_EXTRA_CHANGE_KEY_TO_UNIQUE:
case HA_EXTRA_CHANGE_KEY_TO_DUP:
heap_extra_keyflag(info, function);
break;
default:
break;
}
DBUG_RETURN(0);
} /* heap_extra */
/*
Start/Stop Inserting Duplicates Into a Table, WL#1648.
*/
static void heap_extra_keyflag(register HP_INFO *info,
enum ha_extra_function function)
{
uint idx;
for (idx= 0; idx< info->s->keys; idx++)
{
switch (function) {
case HA_EXTRA_CHANGE_KEY_TO_UNIQUE:
info->s->keydef[idx].flag|= HA_NOSAME;
break;
case HA_EXTRA_CHANGE_KEY_TO_DUP:
info->s->keydef[idx].flag&= ~(HA_NOSAME);
break;
default:
break;
}
}
}
......@@ -141,7 +141,12 @@ enum ha_extra_function {
HA_EXTRA_RETRIEVE_PRIMARY_KEY,
HA_EXTRA_PREPARE_FOR_DELETE,
HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */
HA_EXTRA_PRELOAD_BUFFER_SIZE /* Set buffer size for preloading */
HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */
/*
On-the-fly switching between unique and non-unique key inserting.
*/
HA_EXTRA_CHANGE_KEY_TO_UNIQUE,
HA_EXTRA_CHANGE_KEY_TO_DUP
};
/* The following is parameter to ha_panic() */
......
......@@ -19,6 +19,9 @@
#include <sys/mman.h>
#endif
static void mi_extra_keyflag(MI_INFO *info, enum ha_extra_function function);
/*
Set options and buffers to optimize table handling
......@@ -355,6 +358,10 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
case HA_EXTRA_PRELOAD_BUFFER_SIZE:
info->preload_buff_size= *((ulong *) extra_arg);
break;
case HA_EXTRA_CHANGE_KEY_TO_UNIQUE:
case HA_EXTRA_CHANGE_KEY_TO_DUP:
mi_extra_keyflag(info, function);
break;
case HA_EXTRA_KEY_CACHE:
case HA_EXTRA_NO_KEY_CACHE:
default:
......@@ -367,3 +374,27 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
}
DBUG_RETURN(error);
} /* mi_extra */
/*
Start/Stop Inserting Duplicates Into a Table, WL#1648.
*/
static void mi_extra_keyflag(MI_INFO *info, enum ha_extra_function function)
{
uint idx;
for (idx= 0; idx< info->s->base.keys; idx++)
{
switch (function) {
case HA_EXTRA_CHANGE_KEY_TO_UNIQUE:
info->s->keyinfo[idx].flag|= HA_NOSAME;
break;
case HA_EXTRA_CHANGE_KEY_TO_DUP:
info->s->keyinfo[idx].flag&= ~(HA_NOSAME);
break;
default:
break;
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment