8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 04:03:04 +01:00

Putting, deleting or changing the comment on an index shouldn't cause the index to be rebuilt. The logic was applied previously to user generators only. To be reviewed by Dmitry.

This commit is contained in:
robocop 2005-09-27 07:46:44 +00:00
parent a1d8aeedbb
commit 8fe83cfaae

View File

@ -100,6 +100,8 @@ static bool check_user(thread_db*, const dsc*);
static void delete_record(thread_db*, record_param*, SLONG, JrdMemoryPool*);
static UCHAR* delete_tail(thread_db*, record_param*, SLONG, UCHAR*, const UCHAR*);
static void expunge(thread_db*, record_param*, const jrd_tra*, SLONG);
static bool dfw_should_know(record_param* org_rpb, record_param* new_rpb,
USHORT irrelevant_field);
static void garbage_collect(thread_db*, record_param*, SLONG, RecordStack&);
static void garbage_collect_idx(thread_db*, record_param*, record_param*, Record*);
#ifdef GARBAGE_THREAD
@ -2297,20 +2299,8 @@ void VIO_modify(thread_db* tdbb, record_param* org_rpb, record_param* new_rpb,
// We won't accept modifying sys generators and for user gens,
// only the description.
// This is poor man's version of a trigger discovering changed fields.
dsc desc3;
bool found_change = false;
for (USHORT iter = 0; iter < org_rpb->rpb_record->rec_format->fmt_count;
++iter)
{
if (iter != f_gen_desc)
{
const bool a = EVL_field(0, org_rpb->rpb_record, iter, &desc2);
const bool b = EVL_field(0, new_rpb->rpb_record, iter, &desc3);
if (a != b || MOV_compare(&desc2, &desc3))
found_change = true;
}
}
DFW_post_work(transaction, dfw_modify_generator, &desc1, (USHORT) found_change);
bool important_change = dfw_should_know(org_rpb, new_rpb, f_gen_desc);
DFW_post_work(transaction, dfw_modify_generator, &desc1, (USHORT) important_change);
}
break;
@ -2343,13 +2333,16 @@ void VIO_modify(thread_db* tdbb, record_param* org_rpb, record_param* new_rpb,
EVL_field(0, new_rpb->rpb_record, f_idx_relation, &desc1);
SCL_check_relation(&desc1, SCL_control);
EVL_field(0, new_rpb->rpb_record, f_idx_name, &desc1);
if (EVL_field(0, new_rpb->rpb_record, f_idx_exp_blr, &desc2)) {
DFW_post_work(transaction, dfw_create_expression_index,
&desc1, tdbb->tdbb_database->dbb_max_idx);
}
else {
DFW_post_work(transaction, dfw_create_index, &desc1,
tdbb->tdbb_database->dbb_max_idx);
if (dfw_should_know(org_rpb, new_rpb, f_idx_desc))
{
if (EVL_field(0, new_rpb->rpb_record, f_idx_exp_blr, &desc2)) {
DFW_post_work(transaction, dfw_create_expression_index,
&desc1, tdbb->tdbb_database->dbb_max_idx);
}
else {
DFW_post_work(transaction, dfw_create_index, &desc1,
tdbb->tdbb_database->dbb_max_idx);
}
}
break;
@ -3517,6 +3510,30 @@ static UCHAR* delete_tail(
}
// ******************************
// d f w _ s h o u l d _ k n o w
// ******************************
// Not all operations on system tables are relevant to inform DFW.
// In particular, changing comments on objects is irrelevant.
static bool dfw_should_know(record_param* org_rpb, record_param* new_rpb,
USHORT irrelevant_field)
{
dsc desc2, desc3;
for (USHORT iter = 0; iter < org_rpb->rpb_record->rec_format->fmt_count;
++iter)
{
if (iter != irrelevant_field)
{
const bool a = EVL_field(0, org_rpb->rpb_record, iter, &desc2);
const bool b = EVL_field(0, new_rpb->rpb_record, iter, &desc3);
if (a != b || MOV_compare(&desc2, &desc3))
return true;
}
}
return false;
}
static void expunge(thread_db* tdbb, record_param* rpb,
const jrd_tra* transaction, SLONG prior_page)
{