mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 23:23:02 +01:00
DIRECT_IO now works for restore too.
Also, fixed bug in backup introduced by recent change.
This commit is contained in:
parent
659705f3c5
commit
8450cc65a1
@ -128,7 +128,7 @@ BackupRelationTask::BackupRelationTask(BurpGlobals* tdgbl) : Task(),
|
||||
// two IO buffers per item is enough
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
IOBuffer* buf = FB_NEW_POOL(*pool) IOBuffer(item, 1024*256);
|
||||
IOBuffer* buf = FB_NEW_POOL(*pool) IOBuffer(item, tdgbl->mvol_io_buffer_size);
|
||||
m_buffers.add(buf);
|
||||
|
||||
item->m_cleanBuffers.add(buf);
|
||||
@ -254,6 +254,8 @@ bool BackupRelationTask::getWorkItem(BackupRelationTask::WorkItem** pItem)
|
||||
|
||||
bool BackupRelationTask::getResult(IStatus* /*status*/)
|
||||
{
|
||||
fb_assert(!m_error || m_dirtyBuffers.isEmpty());
|
||||
|
||||
return !m_error;
|
||||
}
|
||||
|
||||
@ -419,11 +421,9 @@ IOBuffer* BackupRelationTask::getDirtyBuffer()
|
||||
while (!m_stop && !m_readDone && !m_dirtyBuffers.hasData())
|
||||
m_dirtyCond.wait(m_mutex);
|
||||
|
||||
if (m_stop || m_readDone)
|
||||
if (m_stop)
|
||||
return NULL;
|
||||
|
||||
fb_assert(m_dirtyBuffers.hasData());
|
||||
|
||||
if (m_dirtyBuffers.hasData())
|
||||
{
|
||||
const FB_SIZE_T idx = 0;
|
||||
@ -655,7 +655,7 @@ RestoreRelationTask::RestoreRelationTask(BurpGlobals* tdgbl) : Task(),
|
||||
// two IO buffers per item is enough
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
IOBuffer* buf = FB_NEW_POOL(*pool) IOBuffer(item, 1024 * 256);
|
||||
IOBuffer* buf = FB_NEW_POOL(*pool) IOBuffer(item, tdgbl->mvol_io_buffer_size);
|
||||
m_buffers.add(buf);
|
||||
|
||||
putCleanBuffer(buf);
|
||||
@ -780,6 +780,8 @@ bool RestoreRelationTask::getWorkItem(WorkItem** pItem)
|
||||
|
||||
bool RestoreRelationTask::getResult(IStatus* status)
|
||||
{
|
||||
fb_assert(!m_error || m_dirtyBuffers.isEmpty());
|
||||
|
||||
return !m_error;
|
||||
}
|
||||
|
||||
|
@ -1398,12 +1398,6 @@ int gbak(Firebird::UtilSvc* uSvc)
|
||||
|
||||
action = open_files(file1, &file2, sw_replace, dpb);
|
||||
|
||||
if (tdgbl->stdIoMode && tdgbl->uSvc->isService())
|
||||
tdgbl->gbl_sw_direct_io = false;
|
||||
|
||||
if (tdgbl->gbl_sw_direct_io && tdgbl->gbl_sw_blk_factor <= 1)
|
||||
tdgbl->io_buffer_size = GBAK_DIRECT_IO_BUFFER_SIZE;
|
||||
|
||||
MVOL_init(tdgbl->io_buffer_size);
|
||||
|
||||
int result;
|
||||
@ -2149,6 +2143,7 @@ static gbak_action open_files(const TEXT* file1,
|
||||
tdgbl->uSvc->setDataMode(true);
|
||||
fil->fil_fd = GBAK_STDOUT_DESC();
|
||||
tdgbl->stdIoMode = true;
|
||||
tdgbl->gbl_sw_direct_io = false;
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -2255,6 +2250,7 @@ static gbak_action open_files(const TEXT* file1,
|
||||
fil->fil_fd = GBAK_STDIN_DESC();
|
||||
tdgbl->file_desc = fil->fil_fd;
|
||||
tdgbl->stdIoMode = true;
|
||||
tdgbl->gbl_sw_direct_io = false;
|
||||
tdgbl->gbl_sw_files = fil->fil_next;
|
||||
}
|
||||
else
|
||||
@ -2266,7 +2262,8 @@ static gbak_action open_files(const TEXT* file1,
|
||||
#ifdef WIN_NT
|
||||
if ((fil->fil_fd = NT_tape_open(nm.c_str(), MODE_READ, OPEN_EXISTING)) == INVALID_HANDLE_VALUE)
|
||||
#else
|
||||
if ((fil->fil_fd = os_utils::open(nm.c_str(), MODE_READ)) == INVALID_HANDLE_VALUE)
|
||||
const int rmode = MODE_READ | (tdgbl->gbl_sw_direct_io ? O_DIRECT : 0);
|
||||
if ((fil->fil_fd = os_utils::open(nm.c_str(), rmode)) == INVALID_HANDLE_VALUE)
|
||||
#endif
|
||||
{
|
||||
BURP_error(65, true, fil->fil_name.c_str());
|
||||
@ -2311,7 +2308,7 @@ static gbak_action open_files(const TEXT* file1,
|
||||
#ifdef WIN_NT
|
||||
if ((fil->fil_fd = NT_tape_open(nm.c_str(), MODE_READ, OPEN_EXISTING)) == INVALID_HANDLE_VALUE)
|
||||
#else
|
||||
if ((fil->fil_fd = os_utils::open(nm.c_str(), MODE_READ)) == INVALID_HANDLE_VALUE)
|
||||
if ((fil->fil_fd = os_utils::open(nm.c_str(), rmode)) == INVALID_HANDLE_VALUE)
|
||||
#endif
|
||||
{
|
||||
BURP_error(65, false, fil->fil_name.c_str());
|
||||
|
@ -122,10 +122,10 @@ static const Switches::in_sw_tab_t reference_burp_in_sw_table[] =
|
||||
// msg 73: @1CREATE_DATABASE create database from backup file
|
||||
{IN_SW_BURP_CO, isc_spb_bkp_convert, "CONVERT", 0, 0, 0, false, true, 254, 2, NULL, boBackup},
|
||||
// msg 254: @1CO(NVERT) backup external files as tables
|
||||
{IN_SW_BURP_DIRECT_IO, isc_spb_bkp_direct_io,"DIRECT_IO", 0, 0, 0, false, true, 409, 1, NULL, boBackup},
|
||||
// msg 409: @1D(IRECT_IO) direct IO for backup file(s)
|
||||
{IN_SW_BURP_CRYPT, isc_spb_bkp_crypt, "CRYPT", 0, 0, 0, false, false, 373, 3, NULL, boGeneral},
|
||||
// msg 373:@1CRY(PT) plugin name
|
||||
{IN_SW_BURP_DIRECT_IO, isc_spb_bkp_direct_io,"DIRECT_IO", 0, 0, 0, false, true, 409, 1, NULL, boGeneral},
|
||||
// msg 409: @1D(IRECT_IO) direct IO for backup file(s)
|
||||
{IN_SW_BURP_E, isc_spb_bkp_expand, "EXPAND", 0, 0, 0, false, true, 97, 1, NULL, boBackup},
|
||||
// msg 97: @1EXPAND no data compression
|
||||
{IN_SW_BURP_FA, isc_spb_bkp_factor, "FACTOR", 0, 0, 0, false, false, 181, 2, NULL, boBackup},
|
||||
|
@ -1041,7 +1041,7 @@ DESC NT_tape_open(const char* name, ULONG mode, ULONG create)
|
||||
|
||||
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
||||
|
||||
const DWORD flags = (mode == MODE_WRITE && tdgbl->gbl_sw_direct_io) ? FILE_FLAG_NO_BUFFERING : 0;
|
||||
const DWORD flags = tdgbl->gbl_sw_direct_io ? FILE_FLAG_NO_BUFFERING : 0;
|
||||
|
||||
if (strnicmp(name, "\\\\.\\tape", 8))
|
||||
{
|
||||
|
@ -34,7 +34,6 @@ const int K_BYTES = 1024;
|
||||
const int IO_BUFFER_SIZE = (16 * K_BYTES);
|
||||
const int SVC_IO_BUFFER_SIZE = (16 * (IO_BUFFER_SIZE));
|
||||
const int GBAK_IO_BUFFER_SIZE = SVC_IO_BUFFER_SIZE;
|
||||
const int GBAK_DIRECT_IO_BUFFER_SIZE = 64 * K_BYTES;
|
||||
|
||||
const int M_BYTES = (K_BYTES * K_BYTES);
|
||||
const int G_BYTES = (K_BYTES * M_BYTES);
|
||||
|
@ -562,6 +562,7 @@
|
||||
#define isc_spb_res_replace 0x1000
|
||||
#define isc_spb_res_create 0x2000
|
||||
#define isc_spb_res_use_all_space 0x4000
|
||||
#define isc_spb_res_direct_io isc_spb_bkp_direct_io
|
||||
#define isc_spb_res_replica_mode 20
|
||||
|
||||
/*****************************************
|
||||
|
@ -456,6 +456,7 @@ const SvcSwitches restoreOptions[] =
|
||||
{"res_crypt", putStringArgument, 0, isc_spb_res_crypt, 0 },
|
||||
{"res_replica_mode", putReplicaMode, 0, isc_spb_res_replica_mode, 0},
|
||||
{"res_parallel_workers", putIntArgument, 0, isc_spb_res_parallel_workers, 0},
|
||||
{"res_direct_io", putOption, 0, isc_spb_res_direct_io, 0},
|
||||
{0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user