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

Function internal_downgrade

src/jrd/lck.cpp:1309–1352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1307
1308
1309static USHORT internal_downgrade(thread_db* tdbb, CheckStatusWrapper* statusVector, Lock* first)
1310{
1311/**************************************
1312 *
1313 * i n t e r n a l _ d o w n g r a d e
1314 *
1315 **************************************
1316 *
1317 * Functional description
1318 * Set the physical lock value of all locks identical
1319 * to the passed lock. It should be the same as the
1320 * highest logical level.
1321 *
1322 **************************************/
1323 SET_TDBB(tdbb);
1324 Database* const dbb = tdbb->getDatabase();
1325
1326 fb_assert(LCK_CHECK_LOCK(first));
1327 fb_assert(first->lck_compatible);
1328
1329 // find the highest required lock level
1330
1331 USHORT level = LCK_none;
1332 for (const Lock* lock = first; lock; lock = lock->lck_identical)
1333 level = MAX(level, lock->lck_logical);
1334
1335 // if we can convert to that level, set all identical locks as having that level
1336
1337 if (level < first->lck_physical)
1338 {
1339 if (dbb->lockManager()->convert(tdbb, statusVector, first->lck_id, level, LCK_NO_WAIT,
1340 external_ast, first))
1341 {
1342 for (Lock* lock = first; lock; lock = lock->lck_identical)
1343 {
1344 lock->lck_physical = level;
1345 }
1346
1347 return level;
1348 }
1349 }
1350
1351 return first->lck_physical;
1352}
1353
1354
1355static bool internal_enqueue(thread_db* tdbb, CheckStatusWrapper* statusVector, Lock* lock,

Callers 2

DOWNGRADEFunction · 0.85
internal_dequeueFunction · 0.85

Calls 4

SET_TDBBFunction · 0.85
getDatabaseMethod · 0.80
lockManagerMethod · 0.80
convertMethod · 0.45

Tested by

no test coverage detected