Skip to content

Commit ec12cd3

Browse files
committed
Merge pull request #8457 from FirebirdSQL/work/burp_tasks
Remove old hack in BurpMaster.
1 parent d7ecba6 commit ec12cd3

File tree

3 files changed

+124
-66
lines changed

3 files changed

+124
-66
lines changed

src/burp/BurpTasks.cpp

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const FB_SIZE_T MIN_IO_BUFFER_SIZE = 128 * 1024;
4343

4444
/// class IOBuffer
4545

46-
IOBuffer::IOBuffer(void* item, FB_SIZE_T size) :
46+
IOBuffer::IOBuffer(BurpTaskItem* item, FB_SIZE_T size) :
4747
m_item(item),
4848
m_memory(*getDefaultMemoryPool()),
4949
m_aligned(NULL),
@@ -53,7 +53,6 @@ IOBuffer::IOBuffer(void* item, FB_SIZE_T size) :
5353
m_next(NULL),
5454
m_linked(false),
5555
m_locked(0)
56-
5756
{
5857
fb_assert(size >= MIN_IO_BUFFER_SIZE);
5958
m_aligned = m_memory.getBuffer(m_size);
@@ -63,7 +62,7 @@ IOBuffer::IOBuffer(void* item, FB_SIZE_T size) :
6362
class BurpGblHolder
6463
{
6564
public:
66-
BurpGblHolder(BurpGlobals* gbl, void* item)
65+
BurpGblHolder(BurpGlobals* gbl, BurpTaskItem* item)
6766
{
6867
m_prev = BurpGlobals::getSpecific();
6968

@@ -89,23 +88,20 @@ class BurpGblHolder
8988
}
9089
protected:
9190
BurpGlobals* m_prev;
92-
void* m_prev_item;
91+
BurpTaskItem* m_prev_item;
9392
};
9493

9594

9695
/// class BackupRelationTask
9796

98-
BackupRelationTask::BackupRelationTask(BurpGlobals* tdgbl) : Task(),
99-
m_masterGbl(tdgbl),
97+
BackupRelationTask::BackupRelationTask(BurpGlobals* tdgbl) : BurpTask(tdgbl),
10098
m_relation(NULL),
10199
m_readers(0),
102100
m_readDone(false),
103101
m_nextPP(0),
104102
m_stop(false),
105103
m_error(false)
106104
{
107-
fb_utils::init_status(m_status);
108-
109105
int workers = tdgbl->gbl_sw_par_workers;
110106
if (workers <= 0)
111107
workers = 1;
@@ -164,7 +160,7 @@ void BackupRelationTask::SetRelation(burp_rel* relation)
164160

165161
bool BackupRelationTask::handler(WorkItem& _item)
166162
{
167-
Item* item = reinterpret_cast<Item*>(&_item);
163+
Item* item = static_cast<Item*>(&_item);
168164

169165
try
170166
{
@@ -201,7 +197,7 @@ bool BackupRelationTask::handler(WorkItem& _item)
201197

202198
bool BackupRelationTask::getWorkItem(BackupRelationTask::WorkItem** pItem)
203199
{
204-
Item* item = reinterpret_cast<Item*> (*pItem);
200+
Item* item = static_cast<Item*>(*pItem);
205201

206202
MutexLockGuard guard(m_mutex, FB_FUNCTION);
207203

@@ -321,7 +317,7 @@ IOBuffer* BackupRelationTask::renewBuffer(BurpGlobals* tdgbl)
321317
{
322318
fb_assert(!tdgbl->master);
323319

324-
Item* item = reinterpret_cast<Item*> (tdgbl->taskItem);
320+
Item* item = static_cast<Item*>(tdgbl->taskItem);
325321
fb_assert(item);
326322
if (!item)
327323
return NULL;
@@ -398,7 +394,7 @@ void BackupRelationTask::releaseBuffer(Item& item)
398394

399395
void BackupRelationTask::recordAdded(BurpGlobals* tdgbl)
400396
{
401-
Item* item = reinterpret_cast<Item*> (tdgbl->taskItem);
397+
Item* item = static_cast<Item*>(tdgbl->taskItem);
402398
if (!item)
403399
return;
404400

@@ -407,15 +403,6 @@ void BackupRelationTask::recordAdded(BurpGlobals* tdgbl)
407403
tdgbl->mvol_io_data = tdgbl->gbl_io_ptr;
408404
}
409405

410-
BackupRelationTask* BackupRelationTask::getBackupTask(BurpGlobals* tdgbl)
411-
{
412-
Item* item = reinterpret_cast<Item*> (tdgbl->taskItem);
413-
if (item)
414-
return item->getBackupTask();
415-
416-
return NULL;
417-
}
418-
419406
IOBuffer* BackupRelationTask::getDirtyBuffer()
420407
{
421408
IOBuffer* buf = NULL;
@@ -444,7 +431,7 @@ IOBuffer* BackupRelationTask::getDirtyBuffer()
444431

445432
void BackupRelationTask::putCleanBuffer(IOBuffer* buf)
446433
{
447-
Item* item = reinterpret_cast<Item*>(buf->getItem());
434+
Item* item = static_cast<Item*>(buf->getItem());
448435
{
449436
MutexLockGuard guard(item->m_mutex, FB_FUNCTION);
450437

@@ -615,8 +602,7 @@ BackupRelationTask::Item::EnsureUnlockBuffer::~EnsureUnlockBuffer()
615602

616603
/// class RestoreRelationTask
617604

618-
RestoreRelationTask::RestoreRelationTask(BurpGlobals* tdgbl) : Task(),
619-
m_masterGbl(tdgbl),
605+
RestoreRelationTask::RestoreRelationTask(BurpGlobals* tdgbl) : BurpTask(tdgbl),
620606
m_relation(NULL),
621607
m_lastRecord(rec_relation_data),
622608
m_writers(0),
@@ -627,8 +613,6 @@ RestoreRelationTask::RestoreRelationTask(BurpGlobals* tdgbl) : Task(),
627613
m_verbRecs(0)
628614

629615
{
630-
fb_utils::init_status(m_status);
631-
632616
int workers = tdgbl->gbl_sw_par_workers;
633617
if (workers <= 0)
634618
workers = 1;
@@ -690,7 +674,7 @@ void RestoreRelationTask::SetRelation(BurpGlobals* tdgbl, burp_rel* relation)
690674

691675
bool RestoreRelationTask::handler(WorkItem& _item)
692676
{
693-
Item* item = reinterpret_cast<Item*>(&_item);
677+
Item* item = static_cast<Item*>(&_item);
694678

695679
try
696680
{
@@ -729,7 +713,7 @@ bool RestoreRelationTask::handler(WorkItem& _item)
729713

730714
bool RestoreRelationTask::getWorkItem(WorkItem** pItem)
731715
{
732-
Item* item = reinterpret_cast<Item*> (*pItem);
716+
Item* item = static_cast<Item*>(*pItem);
733717

734718
MutexLockGuard guard(m_mutex, FB_FUNCTION);
735719

@@ -778,7 +762,7 @@ bool RestoreRelationTask::getWorkItem(WorkItem** pItem)
778762
return (item && item->m_inuse);
779763
}
780764

781-
bool RestoreRelationTask::getResult(IStatus* status)
765+
bool RestoreRelationTask::getResult(IStatus* /*status*/)
782766
{
783767
fb_assert(!m_error || m_dirtyBuffers.isEmpty());
784768

@@ -790,15 +774,6 @@ int RestoreRelationTask::getMaxWorkers()
790774
return m_items.getCount();
791775
}
792776

793-
RestoreRelationTask* RestoreRelationTask::getRestoreTask(BurpGlobals* tdgbl)
794-
{
795-
Item* item = reinterpret_cast<Item*> (tdgbl->taskItem);
796-
if (item)
797-
return item->getRestoreTask();
798-
799-
return NULL;
800-
}
801-
802777
void RestoreRelationTask::verbRecs(FB_UINT64& records, bool total)
803778
{
804779
if (!total)
@@ -1004,7 +979,7 @@ IOBuffer* RestoreRelationTask::renewBuffer(BurpGlobals* tdgbl)
1004979

1005980
fb_assert(!tdgbl->master);
1006981

1007-
Item* item = reinterpret_cast<Item*> (tdgbl->taskItem);
982+
Item* item = static_cast<Item*>(tdgbl->taskItem);
1008983
fb_assert(item);
1009984
if (!item)
1010985
ExcReadDone::raise();

0 commit comments

Comments
 (0)