mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 07:23:04 +01:00
Get rid of the free block lists. Our memory manager handles it better.
This commit is contained in:
parent
47ac66439c
commit
9a24b23947
@ -3297,10 +3297,8 @@ static JRD_NOD release_bookmark(TDBB tdbb, JRD_NOD node)
|
||||
* Deallocate the passed bookmark.
|
||||
*
|
||||
**************************************/
|
||||
JRD_REQ request;
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
request = tdbb->tdbb_request;
|
||||
JRD_REQ request = tdbb->tdbb_request;
|
||||
BLKCHK(node, type_nod);
|
||||
|
||||
if (request->req_operation == jrd_req::req_evaluate) {
|
||||
@ -3325,17 +3323,14 @@ static void release_proc_save_points(JRD_REQ request)
|
||||
* Release temporary blobs assigned by this request.
|
||||
*
|
||||
**************************************/
|
||||
JRD_TRA transaction;
|
||||
SAV sav_point, temp_sav_point;
|
||||
SAV sav_point = request->req_proc_sav_point;
|
||||
|
||||
/* Release savepoints assigned by this request */
|
||||
|
||||
if ((transaction = request->req_transaction) &&
|
||||
(sav_point = request->req_proc_sav_point)) {
|
||||
for (temp_sav_point = sav_point; temp_sav_point->sav_next;
|
||||
temp_sav_point = temp_sav_point->sav_next);
|
||||
temp_sav_point->sav_next = transaction->tra_save_free;
|
||||
transaction->tra_save_free = sav_point;
|
||||
if (request->req_transaction) {
|
||||
while (sav_point) {
|
||||
SAV temp_sav_point = sav_point->sav_next;
|
||||
delete sav_point;
|
||||
sav_point = temp_sav_point;
|
||||
}
|
||||
}
|
||||
request->req_proc_sav_point = NULL;
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ class jrd_tra : public pool_alloc_rpt<SCHAR, type_tra>
|
||||
struct vec *tra_relation_locks; /* locks for relations */
|
||||
struct sbm *tra_commit_sub_trans; /* commited sub-transactions */
|
||||
struct sav *tra_save_point; /* list of savepoints */
|
||||
struct sav *tra_save_free; /* free savepoints */
|
||||
SLONG tra_save_point_number; /* next save point number to use */
|
||||
ULONG tra_flags;
|
||||
#ifdef PC_ENGINE
|
||||
@ -130,7 +129,6 @@ class sav : public pool_alloc<type_sav>
|
||||
{
|
||||
public:
|
||||
struct vct *sav_verb_actions; /* verb action list */
|
||||
struct vct *sav_verb_free; /* free verb action block */
|
||||
USHORT sav_verb_count; /* Active verb count */
|
||||
SLONG sav_number; /* save point number */
|
||||
struct sav *sav_next;
|
||||
|
@ -103,7 +103,6 @@ static void garbage_collect_idx(TDBB, RPB *, RPB *, REC);
|
||||
#ifdef GARBAGE_THREAD
|
||||
static void THREAD_ROUTINE garbage_collector(DBB);
|
||||
#endif
|
||||
static SAV get_free_save_point_block(JRD_TRA);
|
||||
static void list_staying(TDBB, RPB *, LLS *);
|
||||
#ifdef GARBAGE_THREAD
|
||||
static void notify_garbage_collector(TDBB, RPB *);
|
||||
@ -163,20 +162,16 @@ SLONG VIO_savepoint_large(struct sav *savepoint, SLONG size)
|
||||
* value gets negative
|
||||
*
|
||||
**************************************/
|
||||
VCT verb_actions;
|
||||
SLONG count;
|
||||
|
||||
count = size;
|
||||
verb_actions = savepoint->sav_verb_actions;
|
||||
VCT verb_actions = savepoint->sav_verb_actions;
|
||||
|
||||
while (verb_actions) {
|
||||
count -= SBM_size(&verb_actions->vct_records);
|
||||
if (count < 0)
|
||||
size -= SBM_size(&verb_actions->vct_records);
|
||||
if (size < 0)
|
||||
break;
|
||||
verb_actions = verb_actions->vct_next;
|
||||
}
|
||||
|
||||
return count;
|
||||
return size;
|
||||
}
|
||||
|
||||
void VIO_backout(TDBB tdbb, RPB * rpb, JRD_TRA transaction)
|
||||
@ -2471,12 +2466,7 @@ void VIO_start_save_point(TDBB tdbb, JRD_TRA transaction)
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
if ( (sav_point = transaction->tra_save_free) ) {
|
||||
transaction->tra_save_free = sav_point->sav_next;
|
||||
sav_point->sav_flags = 0;
|
||||
} else
|
||||
sav_point = FB_NEW(*transaction->tra_pool) sav();
|
||||
|
||||
sav_point->sav_number = ++transaction->tra_save_point_number;
|
||||
sav_point->sav_next = transaction->tra_save_point;
|
||||
transaction->tra_save_point = sav_point;
|
||||
@ -2940,19 +2930,16 @@ void VIO_verb_cleanup(TDBB tdbb, JRD_TRA transaction)
|
||||
}
|
||||
SBM_reset(&action->vct_records);
|
||||
if (action->vct_undo) {
|
||||
if (action->vct_undo->getFirst()) do {
|
||||
if (action->vct_undo->getFirst())
|
||||
do {
|
||||
delete action->vct_undo->current().rec_data;
|
||||
} while (action->vct_undo->getNext());
|
||||
delete action->vct_undo;
|
||||
action->vct_undo = NULL;
|
||||
}
|
||||
action->vct_next = sav_point->sav_verb_free;
|
||||
sav_point->sav_verb_free = action;
|
||||
delete action;
|
||||
}
|
||||
|
||||
sav_point->sav_verb_count = 0;
|
||||
sav_point->sav_next = transaction->tra_save_free;
|
||||
transaction->tra_save_free = sav_point;
|
||||
delete sav_point;
|
||||
|
||||
/* If the only remaining savepoint is the 'transaction-level' savepoint
|
||||
that was started by TRA_start, then check if it hasn't grown out of
|
||||
@ -2962,7 +2949,9 @@ void VIO_verb_cleanup(TDBB tdbb, JRD_TRA transaction)
|
||||
if (transaction->tra_save_point &&
|
||||
(transaction->tra_save_point->sav_flags & SAV_trans_level) &&
|
||||
VIO_savepoint_large(transaction->tra_save_point, SAV_LARGE) < 0)
|
||||
VIO_verb_cleanup(tdbb, transaction); /* get rid of savepoint */
|
||||
{
|
||||
VIO_verb_cleanup(tdbb, transaction); // get rid of savepoint
|
||||
}
|
||||
|
||||
tdbb->tdbb_default = old_pool;
|
||||
}
|
||||
@ -2997,27 +2986,29 @@ void VIO_merge_proc_sav_points(
|
||||
if (!transaction->tra_save_point)
|
||||
return;
|
||||
|
||||
/* One by one go on putting all savepoints in the sav_point_list on
|
||||
top of transaction save points and call VIO_verb_cleanup () */
|
||||
// one by one go on putting all savepoints in the sav_point_list on
|
||||
// top of transaction save points and call VIO_verb_cleanup()
|
||||
|
||||
for (sav_point = *sav_point_list; sav_point;
|
||||
sav_point = sav_point->sav_next) {
|
||||
sav_point = sav_point->sav_next)
|
||||
{
|
||||
sav_next = sav_point->sav_next;
|
||||
sav_number = sav_point->sav_number;
|
||||
|
||||
/* Add it to the front */
|
||||
// add it to the front
|
||||
|
||||
sav_point->sav_next = transaction->tra_save_point;
|
||||
transaction->tra_save_point = sav_point;
|
||||
|
||||
VIO_verb_cleanup(tdbb, transaction);
|
||||
sav_point = get_free_save_point_block(transaction);
|
||||
|
||||
sav_point = FB_NEW(*transaction->tra_pool) sav();
|
||||
sav_point->sav_verb_count = 0;
|
||||
sav_point->sav_next = sav_next;
|
||||
sav_point->sav_number = sav_number;
|
||||
*sav_point_list = sav_point;
|
||||
sav_point_list = &sav_point->sav_next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -3039,7 +3030,6 @@ static void check_class(
|
||||
*
|
||||
**************************************/
|
||||
DSC desc1, desc2;
|
||||
ATT attachment;
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
@ -3048,7 +3038,7 @@ static void check_class(
|
||||
if (!MOV_compare(&desc1, &desc2))
|
||||
return;
|
||||
|
||||
attachment = tdbb->tdbb_attachment;
|
||||
ATT attachment = tdbb->tdbb_attachment;
|
||||
|
||||
SCL_check_access(attachment->att_security_class, 0, 0, 0, SCL_protect,
|
||||
"DATABASE", "");
|
||||
@ -3069,11 +3059,9 @@ static void check_control(TDBB tdbb)
|
||||
* privilege on the current database.
|
||||
*
|
||||
**************************************/
|
||||
ATT attachment;
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
attachment = tdbb->tdbb_attachment;
|
||||
ATT attachment = tdbb->tdbb_attachment;
|
||||
|
||||
SCL_check_access(attachment->att_security_class,
|
||||
0, 0, 0, SCL_control, "DATABASE", "");
|
||||
@ -3092,13 +3080,11 @@ static BOOLEAN check_user(TDBB tdbb, DSC * desc)
|
||||
* Validate string against current user name.
|
||||
*
|
||||
**************************************/
|
||||
TEXT *p, *end, *q;
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
p = (TEXT *) desc->dsc_address;
|
||||
end = p + desc->dsc_length;
|
||||
q = tdbb->tdbb_attachment->att_user->usr_user_name;
|
||||
TEXT* p = (TEXT *) desc->dsc_address;
|
||||
TEXT* end = p + desc->dsc_length;
|
||||
TEXT* q = tdbb->tdbb_attachment->att_user->usr_user_name;
|
||||
|
||||
/* It is OK to not internationalize this function for v4.00 as
|
||||
* User names are limited to 7-bit ASCII for v4.00
|
||||
@ -3721,30 +3707,6 @@ gc_exit:
|
||||
#endif
|
||||
|
||||
|
||||
static SAV get_free_save_point_block(JRD_TRA transaction)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ f r e e _ s a v e _ p o i n t _ b l o c k
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get a free save point block from free list.
|
||||
* If not available make one.
|
||||
*
|
||||
**************************************/
|
||||
SAV sav_point;
|
||||
|
||||
if ( (sav_point = transaction->tra_save_free) )
|
||||
transaction->tra_save_free = sav_point->sav_next;
|
||||
else
|
||||
sav_point = FB_NEW(*transaction->tra_pool) sav();
|
||||
|
||||
return sav_point;
|
||||
}
|
||||
|
||||
|
||||
static void list_staying(TDBB tdbb, RPB * rpb, LLS * staying)
|
||||
{
|
||||
/**************************************
|
||||
@ -4669,9 +4631,6 @@ static void verb_post(
|
||||
break;
|
||||
|
||||
if (!action) {
|
||||
if ( (action = transaction->tra_save_point->sav_verb_free) )
|
||||
transaction->tra_save_point->sav_verb_free = action->vct_next;
|
||||
else
|
||||
action = FB_NEW(*tdbb->tdbb_default) vct();
|
||||
action->vct_next = transaction->tra_save_point->sav_verb_actions;
|
||||
transaction->tra_save_point->sav_verb_actions = action;
|
||||
|
Loading…
Reference in New Issue
Block a user