Skip to content

Commit

Permalink
Rolled back the ODS level solution for CORE-2709 as it causes cross-v…
Browse files Browse the repository at this point in the history
…ersion compatibility issues (CORE-3853) as well as functional regressions (CORE-3675). Another solution is likely to be committed instead.
  • Loading branch information
dyemanov committed Jun 4, 2012
1 parent afca604 commit cf6e3d0
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 50 deletions.
63 changes: 18 additions & 45 deletions src/jrd/btr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1283,24 +1283,15 @@ idx_e BTR_key(thread_db* tdbb, jrd_rel* relation, Record* record, index_desc* id
(fuzzy ? INTL_KEY_PARTIAL :
((idx->idx_flags & idx_unique) ? INTL_KEY_UNIQUE : INTL_KEY_SORT)));

if (temp.key_length)
const UCHAR* q = temp.key_data;
for (USHORT l = temp.key_length; l; --l, --stuff_count)
{
const UCHAR* q = temp.key_data;
for (USHORT l = temp.key_length; l; --l, --stuff_count)
if (stuff_count == 0)
{
if (stuff_count == 0)
{
*p++ = idx->idx_count - n;
stuff_count = STUFF_COUNT;
}
*p++ = *q++;
*p++ = idx->idx_count - n;
stuff_count = STUFF_COUNT;
}
}
else if (idx->idx_flags & idx_complete_segs)
{
fb_assert(stuff_count == 0);
*p++ = idx->idx_count - n;
stuff_count = STUFF_COUNT;
*p++ = *q++;
}
}
key->key_length = (p - key->key_data);
Expand Down Expand Up @@ -1671,24 +1662,15 @@ idx_e BTR_make_key(thread_db* tdbb,
(idx->idx_flags & idx_descending),
((n == count - 1) ? (fuzzy ? INTL_KEY_PARTIAL : ((idx->idx_flags & idx_unique) ? INTL_KEY_UNIQUE : INTL_KEY_SORT)) : ((idx->idx_flags & idx_unique) ? INTL_KEY_UNIQUE : INTL_KEY_SORT)));

if (temp.key_length)
const UCHAR* q = temp.key_data;
for (USHORT l = temp.key_length; l; --l, --stuff_count)
{
const UCHAR* q = temp.key_data;
for (USHORT l = temp.key_length; l; --l, --stuff_count)
if (stuff_count == 0)
{
if (stuff_count == 0)
{
*p++ = idx->idx_count - n;
stuff_count = STUFF_COUNT;
}
*p++ = *q++;
*p++ = idx->idx_count - n;
stuff_count = STUFF_COUNT;
}
}
else if (idx->idx_flags & idx_complete_segs)
{
fb_assert(stuff_count == 0);
*p++ = idx->idx_count - n;
stuff_count = STUFF_COUNT;
*p++ = *q++;
}
}

Expand Down Expand Up @@ -1781,24 +1763,15 @@ void BTR_make_null_key(thread_db* tdbb, index_desc* idx, temporary_key* key)
compress(tdbb, &null_desc, &temp, tail->idx_itype, true,
(idx->idx_flags & idx_descending), false);

if (temp.key_length)
const UCHAR* q = temp.key_data;
for (USHORT l = temp.key_length; l; --l, --stuff_count)
{
const UCHAR* q = temp.key_data;
for (USHORT l = temp.key_length; l; --l, --stuff_count)
if (stuff_count == 0)
{
if (stuff_count == 0)
{
*p++ = idx->idx_count - n;
stuff_count = STUFF_COUNT;
}
*p++ = *q++;
*p++ = idx->idx_count - n;
stuff_count = STUFF_COUNT;
}
}
else if (idx->idx_flags & idx_complete_segs)
{
fb_assert(stuff_count == 0);
*p++ = idx->idx_count - n;
stuff_count = STUFF_COUNT;
*p++ = *q++;
}
}
key->key_length = (p - key->key_data);
Expand Down
1 change: 0 additions & 1 deletion src/jrd/btr.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ const int idx_in_progress = 4;
const int idx_foreign = 8;
const int idx_primary = 16;
const int idx_expressn = 32;
const int idx_complete_segs = 64;

// these flags are for idx_runtime_flags

Expand Down
2 changes: 1 addition & 1 deletion src/jrd/dfw.epp
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,7 @@ static bool create_index(thread_db* tdbb,
case 3:
key_count = 0;
relation = NULL;
idx.idx_flags = idx_complete_segs;
idx.idx_flags = 0;

// Here we need dirty reads from database (first of all from
// RDB$RELATION_FIELDS and RDB$FIELDS - tables not directly related
Expand Down
2 changes: 1 addition & 1 deletion src/jrd/ini.epp
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ static void add_index_set(Database* dbb,
END_STORE;
}
idx.idx_count = index->ini_idx_segment_count;
idx.idx_flags = index->ini_idx_flags | idx_complete_segs;
idx.idx_flags = index->ini_idx_flags;
SelectivityList selectivity(*tdbb->getDefaultPool());
IDX_create_index(tdbb, relation, &idx, string.c_str(), NULL, dbb->dbb_sys_trans, selectivity);
X.RDB$INDEX_ID = idx.idx_id + 1;
Expand Down
1 change: 0 additions & 1 deletion src/jrd/ods.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ const USHORT irt_in_progress = 4;
const USHORT irt_foreign = 8;
const USHORT irt_primary = 16;
const USHORT irt_expression = 32;
const USHORT irt_complete_segs = 64;

const int STUFF_COUNT = 4;
const SLONG END_LEVEL = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/jrd/pcmet.epp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void PCMET_expression_index(thread_db* tdbb, const string& name, USHORT id, jrd_
/* fake a description of the index */

idx.idx_count = 1;
idx.idx_flags |= idx_expressn | idx_complete_segs;
idx.idx_flags |= idx_expressn;
CMP_get_desc(tdbb, csb, idx.idx_expression, &idx.idx_expression_desc);
idx.idx_rpt[0].idx_itype =
DFW_assign_index_type(tdbb, name,
Expand Down

0 comments on commit cf6e3d0

Please sign in to comment.