MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / start_sweeper

Function start_sweeper

src/jrd/tra.cpp:2817–2869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2815
2816
2817static void start_sweeper(thread_db* tdbb)
2818{
2819/**************************************
2820 *
2821 * s t a r t _ s w e e p e r
2822 *
2823 **************************************
2824 *
2825 * Functional description
2826 * Start a thread to sweep the database.
2827 *
2828 **************************************/
2829 SET_TDBB(tdbb);
2830 Database* const dbb = tdbb->getDatabase();
2831 bool started = false;
2832
2833 if (!dbb->allowSweepThread(tdbb))
2834 return;
2835
2836 TRA_update_counters(tdbb, dbb);
2837
2838 try
2839 {
2840 MutexLockGuard g(swThrMutex, FB_FUNCTION);
2841 if (sweepDown)
2842 return;
2843
2844 // perform housekeeping
2845 auto& swThr(sweepThreads());
2846 for (unsigned n = 0; n < swThr.getCount(); )
2847 {
2848 if (swThr[n]->tryWait())
2849 {
2850 delete swThr[n];
2851 swThr.remove(n);
2852 }
2853 else
2854 ++n;
2855 }
2856
2857 AutoPtr<SweepSync> sweepSync(FB_NEW SweepSync(*getDefaultMemoryPool(), SweepParameter::runSweep));
2858 SweepParameter* swPar = FB_NEW SweepParameter(dbb);
2859 sweepSync->run(swPar);
2860 started = true;
2861 sweepThreads().add(sweepSync.release());
2862 }
2863 catch (const Exception&)
2864 {
2865 if (!started)
2866 dbb->clearSweepStarting();
2867 throw;
2868 }
2869}
2870
2871
2872static void transaction_flush(thread_db* tdbb, USHORT flush_flag, TraNumber tra_number)

Callers 1

transaction_startFunction · 0.85

Calls 12

SET_TDBBFunction · 0.85
TRA_update_countersFunction · 0.85
SweepParameterClass · 0.85
getDatabaseMethod · 0.80
allowSweepThreadMethod · 0.80
tryWaitMethod · 0.80
clearSweepStartingMethod · 0.80
getCountMethod · 0.45
removeMethod · 0.45
runMethod · 0.45
addMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected