@@ -1302,17 +1302,6 @@ void Certifier::garbage_collect() {
13021302 ulonglong starttime = my_micro_time ();
13031303
13041304 Certification_info::iterator it = certification_info.begin ();
1305- <<<<<<< HEAD
1306-
1307- /*
1308- The goal of the following loop is to avoid locking for too long transactions
1309- on servers that have a high rate of trx. Processing 1M GTIDs in the original
1310- code blocked the transaction processing for about 1s.
1311- */
1312- ||||||| 89e1c722476d
1313- stable_gtid_set_lock->wrlock ();
1314- =======
1315- stable_gtid_set_lock->wrlock ();
13161305
13171306 uint64 garbage_collector_counter = garbage_collect_runs;
13181307
@@ -1321,10 +1310,14 @@ void Certifier::garbage_collect() {
13211310 garbage_collector_counter = 0 ;
13221311 });
13231312
1324- >>>>>>> mysql-8.0.41
1313+ /*
1314+ The goal of the following loop is to avoid locking for too long transactions
1315+ on servers that have a high rate of trx. Processing 1M GTIDs in the original
1316+ code blocked the transaction processing for about 1s.
1317+ */
13251318 while (it != certification_info.end ()) {
1326- <<<<<<< HEAD
13271319 stable_gtid_set_lock->wrlock ();
1320+ uint64 write_set_counter = it->second ->get_garbage_collect_counter ();
13281321
13291322 /* Needs to increase the rate if it takes too long, add a chunk every 5s */
13301323 ulonglong rate_multiplier = (my_micro_time () - starttime) / 5000000 + 1 ;
@@ -1337,39 +1330,16 @@ void Certifier::garbage_collect() {
13371330 for (ulong i = 0 ; i < chunk_size; ++i) {
13381331 if (it == certification_info.end ()) {
13391332 break ;
1340- ||||||| 89e1c722476d
1341- if (it->second ->is_subset_not_equals (stable_gtid_set)) {
1342- if (it->second ->unlink () == 0 ) {
1343- /*
1344- Claim Gtid_set_ref used memory to
1345- `thread/group_rpl/THD_certifier_broadcast` thread, since this is
1346- thread that does release the memory.
1347- */
1348- it->second ->claim_memory_ownership (true );
1349- delete it->second ;
1350- =======
1351- uint64 write_set_counter = it->second ->get_garbage_collect_counter ();
1352-
1353- /*
1354- we need to clear gtid_set_ref if marked with UINT64_MAX or
1355- subset_not_equals of stable_gtid_set
1356- */
1357- if (write_set_counter == UINT64_MAX ||
1358- (write_set_counter < garbage_collector_counter &&
1359- it->second ->is_subset_not_equals (stable_gtid_set))) {
1360- it->second ->set_garbage_collect_counter (UINT64_MAX);
1361- if (it->second ->unlink () == 0 ) {
1362- /*
1363- Claim Gtid_set_ref used memory to
1364- `thread/group_rpl/THD_certifier_broadcast` thread, since this is
1365- thread that does release the memory.
1366- */
1367- it->second ->claim_memory_ownership (true );
1368- delete it->second ;
1369- >>>>>>> mysql-8.0.41
13701333 }
1371- <<<<<<< HEAD
1372- if (it->second ->is_subset_not_equals (stable_gtid_set)) {
1334+
1335+ /*
1336+ we need to clear gtid_set_ref if marked with UINT64_MAX or
1337+ subset_not_equals of stable_gtid_set
1338+ */
1339+ if (write_set_counter == UINT64_MAX ||
1340+ (write_set_counter < garbage_collector_counter &&
1341+ it->second ->is_subset_not_equals (stable_gtid_set))) {
1342+ it->second ->set_garbage_collect_counter (UINT64_MAX);
13731343 if (it->second ->unlink () == 0 ) {
13741344 /*
13751345 Claim Gtid_set_ref used memory to
@@ -1381,6 +1351,9 @@ void Certifier::garbage_collect() {
13811351 }
13821352 certification_info.erase (it++);
13831353 } else {
1354+ DBUG_EXECUTE_IF (" group_replication_ci_rows_counter_high" ,
1355+ { assert (write_set_counter > 0 ); });
1356+ it->second ->set_garbage_collect_counter (garbage_collector_counter);
13841357 ++it;
13851358 }
13861359 } /* for loop */
@@ -1408,23 +1381,6 @@ void Certifier::garbage_collect() {
14081381 }
14091382 }
14101383 } /* while loop */
1411- ||||||| 89e1c722476d
1412- certification_info.erase (it++);
1413- } else
1414- ++it;
1415- }
1416- stable_gtid_set_lock->unlock ();
1417- =======
1418- certification_info.erase (it++);
1419- } else {
1420- DBUG_EXECUTE_IF (" group_replication_ci_rows_counter_high" ,
1421- { assert (write_set_counter > 0 ); });
1422- it->second ->set_garbage_collect_counter (garbage_collector_counter);
1423- ++it;
1424- }
1425- }
1426- stable_gtid_set_lock->unlock ();
1427- >>>>>>> mysql-8.0.41
14281384
14291385 /* Incrememnt number of garbage collect runs*/
14301386 garbage_collect_runs++;
0 commit comments