Hi, All.

We investigate a problem with server hanging on backup on of our damaged 
database with -g option when it try to chase a dead record version.

In VIO_chase_record_version:

if (!(rpb->rpb_flags & rpb_chained) && rpb->rpb_flags & rpb_gc_active)
{
        if (!rpb->rpb_transaction_nr) {
                state = tra_active;
        }
        if (state == tra_committed) {
                state = tra_dead;
        }
        if (state == tra_dead) {
                rpb->rpb_flags &= ~rpb_gc_active;
        }
}

If state is dead and record has rpb_gc_active flag turned on, this flag 
is reset and starts new iteration of chasing.
On new iteration if ATT_NO_CLEANUP flag turned on, version is read from 
disk again and compared with saved version:

record_param temp = *rpb;
...
        VIO_data(tdbb, rpb, pool);
        rpb->rpb_page = temp.rpb_page;
        rpb->rpb_line = temp.rpb_line;
        if (!(DPM_fetch(tdbb, rpb, LCK_read)))
        {
                if (!DPM_get(tdbb, rpb, LCK_read)) {
                        return false;
                }
                break;
        }

        if (rpb->rpb_b_page != temp.rpb_b_page || rpb->rpb_b_line != 
temp.rpb_b_line ||
            rpb->rpb_f_page != temp.rpb_f_page || rpb->rpb_f_line != 
temp.rpb_f_line ||
            rpb->rpb_flags != temp.rpb_flags)
        {
                CCH_RELEASE(tdbb, &rpb->getWindow(tdbb));
                if (!DPM_get(tdbb, rpb, LCK_read)) {
                        return false;
                }
                break;
        }
In our case "rpb" and "temp" versions are differ only by rpb_gc_active 
flag which was reset from saved version on previous iteration. Because 
of this current version considered as changed and it processed again. 
And so on. Loop inside VIO_chase_record_version becomes infinite.
If I compare rpb_flags like this it solves the problem:
rpb->rpb_flags != temp.rpb_flags &&
     !(state == tra_dead &&
       rpb->rpb_flags == (temp.rpb_flags | rpb_gc_active))
Could you review this solution and its possible problems?
We can provide access the damaged database, but it size is around 115 
Gbytes.

Best regards,
Dmitry Starodubov

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to