FirebirdSQL / firebird

Firebird server, client and tools
https://firebirdsql.org
1.26k stars 217 forks source link

Reserve backup file size when backup starts [CORE5372] #5645

Open firebird-automations opened 8 years ago

firebird-automations commented 8 years ago

Submitted by: Lukas Masak (lmasak)

I have faced problem with backup slow down 10 times after NAS firmware update. It was caused by some monitoring tool handling file size change heavily. Unfortunately was not allowed to manage target system. Solution is to make nbackup work the same way as file copy - reserve final file size at start. I solve it just for level 0 backups where it harms most and solution is easy.

function void nbackup::backup_database

after open_database_scan(); line added

if (level == 0) { LARGE_INTEGER liSize; GetFileSizeEx(dbase, &liSize); LARGE_INTEGER iRet; if (SetFilePointerEx(backup, liSize, &iRet, FILE_BEGIN) != 0) { SetEndOfFile(backup); liSize.LowPart = 0; liSize.HighPart = 0; SetFilePointerEx(backup, liSize, &iRet, FILE_BEGIN); } }

after after close_database(); line added if (level == 0) SetEndOfFile(backup);

firebird-automations commented 8 years ago
Modified by: @hvlad assignee: Vlad Khorsun \[ hvlad \]