77
/**********************************************************************//**
81
xb_fil_node_close_file(
82
/*===================*/
83
fil_node_t* node) /*!< in: file node */
87
mutex_enter(&fil_system->mutex);
90
ut_a(node->n_pending == 0);
91
ut_a(node->n_pending_flushes == 0);
92
#if MYSQL_VERSION_ID >= 50600
93
ut_a(!node->being_extended);
98
mutex_exit(&fil_system->mutex);
103
ret = os_file_close(node->handle);
108
ut_a(fil_system->n_open > 0);
109
fil_system->n_open--;
110
#if MYSQL_VERSION_ID >= 50600
114
if (node->space->purpose == FIL_TABLESPACE &&
115
!trx_sys_sys_space(node->space->id)) {
117
ut_a(UT_LIST_GET_LEN(fil_system->LRU) > 0);
119
/* The node is in the LRU list, remove it */
120
UT_LIST_REMOVE(LRU, fil_system->LRU, node);
123
mutex_exit(&fil_system->mutex);
77
126
/************************************************************************
78
127
Open a source file cursor and initialize the associated read filter.
109
159
xb_get_relative_path(cursor->abs_path, cursor->is_system),
110
160
sizeof(cursor->rel_path));
114
if (my_stat(node->name, &cursor->statinfo, MYF(MY_WME)) == NULL) {
115
msg("[%02u] xtrabackup: Warning: cannot stat %s\n",
116
thread_n, node->name);
117
return(XB_FIL_CUR_SKIP);
123
xb_file_create_no_error_handling(node->name,
162
/* In the backup mode we should already have a tablespace handle created
163
by fil_load_single_table_tablespace() unless it is a system
164
tablespace. Otherwise we open the file here. */
165
if (cursor->is_system || !srv_backup_mode) {
167
xb_file_create_no_error_handling(node->name,
125
169
OS_FILE_READ_ONLY,
128
/* The following call prints an error message */
129
os_file_get_last_error(TRUE);
131
msg("[%02u] xtrabackup: Warning: cannot open %s\n"
132
"[%02u] xtrabackup: Warning: We assume the "
133
"table was dropped or renamed during "
134
"xtrabackup execution and ignore the file.\n",
135
thread_n, node->name, thread_n);
136
return(XB_FIL_CUR_SKIP);
172
/* The following call prints an error message */
173
os_file_get_last_error(TRUE);
175
msg("[%02u] xtrabackup: error: cannot open "
177
thread_n, cursor->abs_path);
179
return(XB_FIL_CUR_ERROR);
181
mutex_enter(&fil_system->mutex);
185
fil_system->n_open++;
186
#if MYSQL_VERSION_ID >= 50600
190
if (node->space->purpose == FIL_TABLESPACE &&
191
!trx_sys_sys_space(node->space->id)) {
193
/* Put the node to the LRU list */
194
UT_LIST_ADD_FIRST(LRU, fil_system->LRU, node);
197
mutex_exit(&fil_system->mutex);
203
cursor->file = node->handle;
205
if (my_fstat(cursor->file, &cursor->statinfo, MYF(MY_WME))) {
206
msg("[%02u] xtrabackup: error: cannot stat %s\n",
207
thread_n, cursor->abs_path);
209
xb_fil_cur_close(cursor);
211
return(XB_FIL_CUR_ERROR);
139
214
xb_file_set_nocache(cursor->file, node->name, "OPEN");
230
305
cursor->buf_offset = offset;
231
306
cursor->buf_page_no = (ulint) (offset >> cursor->page_size_shift);
233
success = xb_os_file_read(cursor->file, cursor->buf, offset, to_read);
308
success = xb_os_file_read(cursor->file, cursor->buf, offset,
235
311
return(XB_FIL_CUR_ERROR);
294
370
if (cursor->orig_buf != NULL) {
295
371
ut_free(cursor->orig_buf);
297
if (cursor->file != XB_FILE_UNDEFINED) {
298
os_file_close(cursor->file);
373
if (cursor->node != NULL) {
374
xb_fil_node_close_file(cursor->node);
375
cursor->file = XB_FILE_UNDEFINED;