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

Enabled rescheduling points for classic. It allows to shutdown database or cancel operation timely for a heavy loaded attachment.

This commit is contained in:
dimitr 2006-10-31 15:59:23 +00:00
parent dff338a427
commit 543fc5e0d1
9 changed files with 10 additions and 47 deletions

View File

@ -518,13 +518,9 @@ USHORT BLB_get_segment(thread_db* tdbb,
SET_TDBB(tdbb);
Database* dbb = tdbb->tdbb_database;
#ifdef SUPERSERVER
if (--tdbb->tdbb_quantum < 0)
JRD_reschedule(tdbb, 0, true);
#endif
/* If we reached end of file, we're still there */
if (blob->blb_flags & BLB_eof)

View File

@ -3710,11 +3710,8 @@ static SLONG fast_load(thread_db* tdbb,
pointers[level] = levelPointer;
}
#ifdef SUPERSERVER
if (--tdbb->tdbb_quantum < 0) {
if (--tdbb->tdbb_quantum < 0)
error = JRD_reschedule(tdbb, 0, false);
}
#endif
}
// To finish up, put an end of level marker on the last bucket
@ -6310,7 +6307,6 @@ static CONTENTS remove_leaf_node(thread_db* tdbb, index_insertion* insertion, WI
} while (--l);
}
#ifdef SUPERSERVER
// Until deletion of duplicate nodes becomes efficient, limit
// leaf level traversal by rescheduling.
if (--tdbb->tdbb_quantum < 0) {
@ -6319,7 +6315,6 @@ static CONTENTS remove_leaf_node(thread_db* tdbb, index_insertion* insertion, WI
ERR_punt();
}
}
#endif
}
// If we've needed to search thru a significant number of pages, warn the

View File

@ -294,10 +294,8 @@ RecordBitmap** EVL_bitmap(thread_db* tdbb, jrd_nod* node)
DEV_BLKCHK(node, type_nod);
#ifdef SUPERSERVER
if (--tdbb->tdbb_quantum < 0)
JRD_reschedule(tdbb, 0, true);
#endif
switch (node->nod_type) {
case nod_bit_and:
@ -815,10 +813,8 @@ dsc* EVL_expr(thread_db* tdbb, jrd_nod* const node)
SET_TDBB(tdbb);
#ifdef SUPERSERVER
if (--tdbb->tdbb_quantum < 0)
JRD_reschedule(tdbb, 0, true);
#endif
jrd_req* const request = tdbb->tdbb_request;
impure_value* const impure = (impure_value*) ((SCHAR *) request + node->nod_impure);
@ -1325,10 +1321,8 @@ USHORT EVL_group(thread_db* tdbb, RecordSource* rsb, jrd_nod *const node, USHORT
DEV_BLKCHK(node, type_nod);
#ifdef SUPERSERVER
if (--tdbb->tdbb_quantum < 0)
JRD_reschedule(tdbb, 0, true);
#endif
/* if we found the last record last time, we're all done */

View File

@ -576,10 +576,8 @@ void EXE_receive(thread_db* tdbb,
DEV_BLKCHK(request, type_req);
#ifdef SUPERSERVER
if (--tdbb->tdbb_quantum < 0)
JRD_reschedule(tdbb, 0, true);
#endif
jrd_tra* transaction = request->req_transaction;
@ -720,10 +718,8 @@ void EXE_send(thread_db* tdbb,
SET_TDBB(tdbb);
DEV_BLKCHK(request, type_req);
#ifdef SUPERSERVER
if (--tdbb->tdbb_quantum < 0)
JRD_reschedule(tdbb, 0, true);
#endif
if (!(request->req_flags & req_active))
ERR_post(isc_req_sync, 0);
@ -1651,16 +1647,12 @@ static jrd_nod* looper(thread_db* tdbb, jrd_req* request, jrd_nod* in_node)
{
try {
#ifdef SUPERSERVER
if (request->req_operation == jrd_req::req_evaluate &&
(--tdbb->tdbb_quantum < 0))
{
JRD_reschedule(tdbb, 0, true);
}
#endif
#if defined(DEBUG_GDS_ALLOC) && FALSE
int node_type = node->nod_type;
#endif

View File

@ -472,10 +472,8 @@ void IDX_create_index(
delete record;
}
#ifdef SUPERSERVER
if (--tdbb->tdbb_quantum < 0)
JRD_reschedule(tdbb, 0, true);
#endif
}
gc_record->rec_flags &= ~REC_gc_active;

View File

@ -4472,7 +4472,6 @@ void JRD_print_procedure_info(thread_db* tdbb, const char* mesg)
#endif // DEBUG_PROCS
#ifdef MULTI_THREAD
bool JRD_reschedule(thread_db* tdbb, SLONG quantum, bool punt)
{
/**************************************
@ -4487,6 +4486,7 @@ bool JRD_reschedule(thread_db* tdbb, SLONG quantum, bool punt)
*
**************************************/
#ifdef MULTI_THREAD
// Force garbage collection activity to yield the
// processor in case client threads haven't had
// an opportunity to enter the scheduling queue.
@ -4498,6 +4498,7 @@ bool JRD_reschedule(thread_db* tdbb, SLONG quantum, bool punt)
THREAD_YIELD();
THREAD_ENTER();
}
#endif
Database* dbb = tdbb->tdbb_database;
@ -4583,13 +4584,16 @@ bool JRD_reschedule(thread_db* tdbb, SLONG quantum, bool punt)
}
tdbb->tdbb_quantum = (tdbb->tdbb_quantum <= 0) ?
#ifdef MULTI_THREAD
(quantum ? quantum : (ThreadPriorityScheduler::boosted() ?
Config::getPriorityBoost() : 1) * QUANTUM) :
Config::getPriorityBoost() : 1) * QUANTUM) :
#else
(quantum ? quantum : QUANTUM) :
#endif
tdbb->tdbb_quantum;
return false;
}
#endif
void JRD_restore_context(void)

View File

@ -1808,14 +1808,8 @@ static bool get_record(thread_db* tdbb,
**************************************/
SET_TDBB(tdbb);
#ifdef SUPERSERVER
if (--tdbb->tdbb_quantum < 0)
{
JRD_reschedule(tdbb, 0, true);
}
#endif
/* check request flags for special processing */

View File

@ -820,10 +820,8 @@ static FETCH_CODE fetch_page(thread_db* tdbb,
Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
#ifdef SUPERSERVER
if (--tdbb->tdbb_quantum < 0)
JRD_reschedule(tdbb, 0, true);
#endif
window->win_page = page_number;
window->win_flags = 0;

View File

@ -3637,14 +3637,10 @@ static void garbage_collect(thread_db* tdbb,
if (rpb->rpb_record) {
going.push(rpb->rpb_record);
}
#ifdef SUPERSERVER
/* Don't monopolize the server while chasing long
back version chains. */
if (--tdbb->tdbb_quantum < 0) {
if (--tdbb->tdbb_quantum < 0)
JRD_reschedule(tdbb, 0, true);
}
#endif
}
BLB_garbage_collect(tdbb, going, staying, prior_page, rpb->rpb_relation);
@ -4086,14 +4082,10 @@ static void list_staying(thread_db* tdbb, record_param* rpb, RecordStack& stayin
temp.rpb_prior = (temp.rpb_flags & rpb_delta) ? data : NULL;
DPM_fetch_back(tdbb, &temp, LCK_read, 1);
depth++;
#ifdef SUPERSERVER
/* Don't monopolize the server while chasing long
back version chains. */
if (--tdbb->tdbb_quantum < 0) {
if (--tdbb->tdbb_quantum < 0)
JRD_reschedule(tdbb, 0, true);
}
#endif
}
/* If there is a next older version, then process it: remember that