Merge lp:~vkolesnikov/pbxt/pbxt-diskfull into lp:pbxt
- pbxt-diskfull
- Merge into trunk
Proposed by
Vladimir Kolesnikov
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~vkolesnikov/pbxt/pbxt-diskfull |
Merge into: | lp:pbxt |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~vkolesnikov/pbxt/pbxt-diskfull |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PBXT Core | Pending | ||
Review via email: mp+8682@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ChangeLog' | |||
2 | --- ChangeLog 2009-07-07 10:54:25 +0000 | |||
3 | +++ ChangeLog 2009-07-13 10:48:25 +0000 | |||
4 | @@ -1,6 +1,14 @@ | |||
5 | 1 | PBXT Release Notes | 1 | PBXT Release Notes |
6 | 2 | ================== | 2 | ================== |
7 | 3 | 3 | ||
8 | 4 | RN258: updated xt_p_join implementation for Windows to check if a thread has already exited or has not yet started | ||
9 | 5 | |||
10 | 6 | RN257: Removed false assertion that could fail during restore if a transaction log page was zero-filled | ||
11 | 7 | |||
12 | 8 | RN256: Update datalog eof pointer only if write opearions were sucessful | ||
13 | 9 | |||
14 | 10 | RN255: Added re-allocation of of filemap if allocating the of the new map failed. This often happens if there's not enough space on disk. | ||
15 | 11 | |||
16 | 4 | ------- 1.0.08 RC2 - 2009-06-30 | 12 | ------- 1.0.08 RC2 - 2009-06-30 |
17 | 5 | 13 | ||
18 | 6 | RN253: Use fcntl(F_FULLFSYNC) instead of fsync on platforms that support it. Improper fsync operation was presumably the reason of index corruption on Mac OS X | 14 | RN253: Use fcntl(F_FULLFSYNC) instead of fsync on platforms that support it. Improper fsync operation was presumably the reason of index corruption on Mac OS X |
19 | 7 | 15 | ||
20 | === modified file 'src/datalog_xt.cc' | |||
21 | --- src/datalog_xt.cc 2009-05-19 14:13:25 +0000 | |||
22 | +++ src/datalog_xt.cc 2009-07-13 10:48:25 +0000 | |||
23 | @@ -1110,7 +1110,6 @@ | |||
24 | 1110 | 1110 | ||
25 | 1111 | *log_id = dlb_data_log->dlf_log_id; | 1111 | *log_id = dlb_data_log->dlf_log_id; |
26 | 1112 | *out_offset = dlb_data_log->dlf_log_eof; | 1112 | *out_offset = dlb_data_log->dlf_log_eof; |
27 | 1113 | dlb_data_log->dlf_log_eof += req_size; | ||
28 | 1114 | return OK; | 1113 | return OK; |
29 | 1115 | } | 1114 | } |
30 | 1116 | 1115 | ||
31 | @@ -1158,6 +1157,12 @@ | |||
32 | 1158 | 1157 | ||
33 | 1159 | if (!xt_pwrite_file(dlb_data_log->dlf_log_file, log_offset, size, data, &thread->st_statistics.st_data, thread)) | 1158 | if (!xt_pwrite_file(dlb_data_log->dlf_log_file, log_offset, size, data, &thread->st_statistics.st_data, thread)) |
34 | 1160 | return FAILED; | 1159 | return FAILED; |
35 | 1160 | |||
36 | 1161 | /* Increment of dlb_data_log->dlf_log_eof was moved here from dlb_get_log_offset() | ||
37 | 1162 | * to ensure it is done after a successful update of the log, otherwise otherwise a | ||
38 | 1163 | * gap occurs in the log which cause eof to be detected in middle of the log | ||
39 | 1164 | */ | ||
40 | 1165 | dlb_data_log->dlf_log_eof += size; | ||
41 | 1161 | #ifdef DEBUG | 1166 | #ifdef DEBUG |
42 | 1162 | if (log_offset + size > dlb_max_write_offset) | 1167 | if (log_offset + size > dlb_max_write_offset) |
43 | 1163 | dlb_max_write_offset = log_offset + size; | 1168 | dlb_max_write_offset = log_offset + size; |
44 | @@ -1179,10 +1184,12 @@ | |||
45 | 1179 | if (dlb_buffer_size >= dlb_buffer_len + size) { | 1184 | if (dlb_buffer_size >= dlb_buffer_len + size) { |
46 | 1180 | memcpy(dlb_log_buffer + dlb_buffer_len, data, size); | 1185 | memcpy(dlb_log_buffer + dlb_buffer_len, data, size); |
47 | 1181 | dlb_buffer_len += size; | 1186 | dlb_buffer_len += size; |
48 | 1187 | dlb_data_log->dlf_log_eof += size; | ||
49 | 1182 | return OK; | 1188 | return OK; |
50 | 1183 | } | 1189 | } |
51 | 1184 | } | 1190 | } |
53 | 1185 | dlb_flush_log(FALSE, thread); | 1191 | if (dlb_flush_log(FALSE, thread) != OK) |
54 | 1192 | return FAILED; | ||
55 | 1186 | } | 1193 | } |
56 | 1187 | 1194 | ||
57 | 1188 | ASSERT_NS(dlb_buffer_len == 0); | 1195 | ASSERT_NS(dlb_buffer_len == 0); |
58 | @@ -1191,6 +1198,7 @@ | |||
59 | 1191 | dlb_buffer_offset = log_offset; | 1198 | dlb_buffer_offset = log_offset; |
60 | 1192 | dlb_buffer_len = size; | 1199 | dlb_buffer_len = size; |
61 | 1193 | memcpy(dlb_log_buffer, data, size); | 1200 | memcpy(dlb_log_buffer, data, size); |
62 | 1201 | dlb_data_log->dlf_log_eof += size; | ||
63 | 1194 | return OK; | 1202 | return OK; |
64 | 1195 | } | 1203 | } |
65 | 1196 | 1204 | ||
66 | @@ -1202,6 +1210,7 @@ | |||
67 | 1202 | dlb_max_write_offset = log_offset + size; | 1210 | dlb_max_write_offset = log_offset + size; |
68 | 1203 | #endif | 1211 | #endif |
69 | 1204 | dlb_flush_required = TRUE; | 1212 | dlb_flush_required = TRUE; |
70 | 1213 | dlb_data_log->dlf_log_eof += size; | ||
71 | 1205 | return OK; | 1214 | return OK; |
72 | 1206 | } | 1215 | } |
73 | 1207 | 1216 | ||
74 | 1208 | 1217 | ||
75 | === modified file 'src/filesys_xt.cc' | |||
76 | --- src/filesys_xt.cc 2009-07-07 10:54:25 +0000 | |||
77 | +++ src/filesys_xt.cc 2009-07-13 10:48:25 +0000 | |||
78 | @@ -1384,14 +1384,23 @@ | |||
79 | 1384 | } | 1384 | } |
80 | 1385 | mm->mm_start = NULL; | 1385 | mm->mm_start = NULL; |
81 | 1386 | #ifdef XT_WIN | 1386 | #ifdef XT_WIN |
83 | 1387 | if (!CloseHandle(mm->mm_mapdes)) | 1387 | /* It is possible that a previous remap attempt has failed: the map was closed |
84 | 1388 | * but the new map was not allocated (e.g. because of insufficient disk space). | ||
85 | 1389 | * In this case mm->mm_mapdes will be NULL. | ||
86 | 1390 | */ | ||
87 | 1391 | if (mm->mm_mapdes && !CloseHandle(mm->mm_mapdes)) | ||
88 | 1388 | return xt_register_ferrno(XT_REG_CONTEXT, fs_get_win_error(), xt_file_path(map)); | 1392 | return xt_register_ferrno(XT_REG_CONTEXT, fs_get_win_error(), xt_file_path(map)); |
89 | 1389 | mm->mm_mapdes = NULL; | 1393 | mm->mm_mapdes = NULL; |
90 | 1390 | #endif | 1394 | #endif |
91 | 1395 | off_t old_size = mm->mm_length; | ||
92 | 1391 | mm->mm_length = new_size; | 1396 | mm->mm_length = new_size; |
93 | 1392 | 1397 | ||
95 | 1393 | if (!fs_map_file(mm, map->fr_file, TRUE)) | 1398 | if (!fs_map_file(mm, map->fr_file, TRUE)) { |
96 | 1399 | /* Try to restore old mapping */ | ||
97 | 1400 | mm->mm_length = old_size; | ||
98 | 1401 | fs_map_file(mm, map->fr_file, FALSE); | ||
99 | 1394 | return FAILED; | 1402 | return FAILED; |
100 | 1403 | } | ||
101 | 1395 | } | 1404 | } |
102 | 1396 | return OK; | 1405 | return OK; |
103 | 1397 | 1406 | ||
104 | 1398 | 1407 | ||
105 | === modified file 'src/ha_pbxt.cc' | |||
106 | --- src/ha_pbxt.cc 2009-07-02 12:13:58 +0000 | |||
107 | +++ src/ha_pbxt.cc 2009-07-13 10:48:25 +0000 | |||
108 | @@ -1174,7 +1174,11 @@ | |||
109 | 1174 | #ifndef DRIZZLED | 1174 | #ifndef DRIZZLED |
110 | 1175 | myxt_mutex_lock(&LOCK_plugin); | 1175 | myxt_mutex_lock(&LOCK_plugin); |
111 | 1176 | #endif | 1176 | #endif |
113 | 1177 | xt_throw(self); | 1177 | /* It is possible that the error was reset by cleanup code. |
114 | 1178 | * Set a generic error code in that case. | ||
115 | 1179 | */ | ||
116 | 1180 | if (!self->t_exception.e_xt_err) | ||
117 | 1181 | xt_throw_error(self, XT_REG_CONTEXT, XT_SYSTEM_ERROR, 0, "Initialization failed"); | ||
118 | 1178 | } | 1182 | } |
119 | 1179 | cont_(b); | 1183 | cont_(b); |
120 | 1180 | 1184 | ||
121 | 1181 | 1185 | ||
122 | === modified file 'src/pthread_xt.cc' | |||
123 | --- src/pthread_xt.cc 2009-01-19 19:03:45 +0000 | |||
124 | +++ src/pthread_xt.cc 2009-07-13 10:48:25 +0000 | |||
125 | @@ -395,20 +395,31 @@ | |||
126 | 395 | 395 | ||
127 | 396 | int xt_p_join(pthread_t thread, void **value) | 396 | int xt_p_join(pthread_t thread, void **value) |
128 | 397 | { | 397 | { |
142 | 398 | switch (WaitForSingleObject(thread, INFINITE)) { | 398 | DWORD exitcode; |
143 | 399 | case WAIT_OBJECT_0: | 399 | |
144 | 400 | case WAIT_TIMEOUT: | 400 | while(1) { |
145 | 401 | /* Don't do this! According to the Win docs: | 401 | switch (WaitForSingleObject(thread, 10000)) { |
146 | 402 | * _endthread automatically closes the thread handle | 402 | case WAIT_OBJECT_0: |
147 | 403 | * (whereas _endthreadex does not). Therefore, when using | 403 | return 0; |
148 | 404 | * _beginthread and _endthread, do not explicitly close the | 404 | case WAIT_TIMEOUT: |
149 | 405 | * thread handle by calling the Win32 CloseHandle API. | 405 | /* Don't do this! According to the Win docs: |
150 | 406 | CloseHandle(thread); | 406 | * _endthread automatically closes the thread handle |
151 | 407 | */ | 407 | * (whereas _endthreadex does not). Therefore, when using |
152 | 408 | break; | 408 | * _beginthread and _endthread, do not explicitly close the |
153 | 409 | case WAIT_FAILED: | 409 | * thread handle by calling the Win32 CloseHandle API. |
154 | 410 | return GetLastError(); | 410 | CloseHandle(thread); |
155 | 411 | */ | ||
156 | 412 | /* This is done so that if the thread was not [yet] in the running | ||
157 | 413 | * state when this function was called we won't deadlock here. | ||
158 | 414 | */ | ||
159 | 415 | if (GetExitCodeThread(thread, &exitcode) && (exitcode == STILL_ACTIVE)) | ||
160 | 416 | break; | ||
161 | 417 | return 0; | ||
162 | 418 | case WAIT_FAILED: | ||
163 | 419 | return GetLastError(); | ||
164 | 420 | } | ||
165 | 411 | } | 421 | } |
166 | 422 | |||
167 | 412 | return 0; | 423 | return 0; |
168 | 413 | } | 424 | } |
169 | 414 | 425 | ||
170 | 415 | 426 | ||
171 | === modified file 'src/restart_xt.cc' | |||
172 | --- src/restart_xt.cc 2009-06-11 08:02:28 +0000 | |||
173 | +++ src/restart_xt.cc 2009-07-13 10:48:25 +0000 | |||
174 | @@ -629,6 +629,9 @@ | |||
175 | 629 | xtWord1 *rec_data = NULL; | 629 | xtWord1 *rec_data = NULL; |
176 | 630 | XTTabRecFreeDPtr free_data; | 630 | XTTabRecFreeDPtr free_data; |
177 | 631 | 631 | ||
178 | 632 | if (tab->tab_dic.dic_key_count == 0) | ||
179 | 633 | check_index = FALSE; | ||
180 | 634 | |||
181 | 632 | switch (record->xl.xl_status_1) { | 635 | switch (record->xl.xl_status_1) { |
182 | 633 | case XT_LOG_ENT_REC_MODIFIED: | 636 | case XT_LOG_ENT_REC_MODIFIED: |
183 | 634 | case XT_LOG_ENT_UPDATE: | 637 | case XT_LOG_ENT_UPDATE: |
184 | @@ -642,7 +645,7 @@ | |||
185 | 642 | /* This should be done before we apply change to table, as otherwise we lose | 645 | /* This should be done before we apply change to table, as otherwise we lose |
186 | 643 | * the key value that we need to remove from index | 646 | * the key value that we need to remove from index |
187 | 644 | */ | 647 | */ |
189 | 645 | if (check_index && ot->ot_table->tab_dic.dic_key_count && record->xl.xl_status_1 == XT_LOG_ENT_REC_MODIFIED) { | 648 | if (check_index && record->xl.xl_status_1 == XT_LOG_ENT_REC_MODIFIED) { |
190 | 646 | if ((rec_data = xres_load_record(self, ot, rec_id, NULL, 0, rec_buf, tab->tab_dic.dic_ind_cols_req))) | 649 | if ((rec_data = xres_load_record(self, ot, rec_id, NULL, 0, rec_buf, tab->tab_dic.dic_ind_cols_req))) |
191 | 647 | xres_remove_index_entries(ot, rec_id, rec_data); | 650 | xres_remove_index_entries(ot, rec_id, rec_data); |
192 | 648 | } | 651 | } |
193 | @@ -652,7 +655,7 @@ | |||
194 | 652 | xt_throw(self); | 655 | xt_throw(self); |
195 | 653 | tab->tab_bytes_to_flush += len; | 656 | tab->tab_bytes_to_flush += len; |
196 | 654 | 657 | ||
198 | 655 | if (check_index && ot->ot_table->tab_dic.dic_key_count) { | 658 | if (check_index) { |
199 | 656 | switch (record->xl.xl_status_1) { | 659 | switch (record->xl.xl_status_1) { |
200 | 657 | case XT_LOG_ENT_DELETE: | 660 | case XT_LOG_ENT_DELETE: |
201 | 658 | case XT_LOG_ENT_DELETE_BG: | 661 | case XT_LOG_ENT_DELETE_BG: |
202 | 659 | 662 | ||
203 | === modified file 'src/xactlog_xt.cc' | |||
204 | --- src/xactlog_xt.cc 2009-06-30 15:58:15 +0000 | |||
205 | +++ src/xactlog_xt.cc 2009-07-13 10:48:25 +0000 | |||
206 | @@ -1132,6 +1132,7 @@ | |||
207 | 1132 | /* [(8)] Flush the compactor log. */ | 1132 | /* [(8)] Flush the compactor log. */ |
208 | 1133 | xt_lock_mutex_ns(&xl_db->db_co_dlog_lock); | 1133 | xt_lock_mutex_ns(&xl_db->db_co_dlog_lock); |
209 | 1134 | if (!xl_db->db_co_thread->st_dlog_buf.dlb_flush_log(TRUE, thread)) { | 1134 | if (!xl_db->db_co_thread->st_dlog_buf.dlb_flush_log(TRUE, thread)) { |
210 | 1135 | xl_log_bytes_written -= part_size; | ||
211 | 1135 | xt_unlock_mutex_ns(&xl_db->db_co_dlog_lock); | 1136 | xt_unlock_mutex_ns(&xl_db->db_co_dlog_lock); |
212 | 1136 | goto write_failed; | 1137 | goto write_failed; |
213 | 1137 | } | 1138 | } |
214 | @@ -1140,8 +1141,10 @@ | |||
215 | 1140 | 1141 | ||
216 | 1141 | /* And flush if required: */ | 1142 | /* And flush if required: */ |
217 | 1142 | flush_time = thread->st_statistics.st_xlog.ts_flush_time; | 1143 | flush_time = thread->st_statistics.st_xlog.ts_flush_time; |
219 | 1143 | if (!xt_flush_file(xl_log_file, &thread->st_statistics.st_xlog, thread)) | 1144 | if (!xt_flush_file(xl_log_file, &thread->st_statistics.st_xlog, thread)) { |
220 | 1145 | xl_log_bytes_written -= part_size; | ||
221 | 1144 | goto write_failed; | 1146 | goto write_failed; |
222 | 1147 | } | ||
223 | 1145 | xl_last_flush_time = (u_int) (thread->st_statistics.st_xlog.ts_flush_time - flush_time); | 1148 | xl_last_flush_time = (u_int) (thread->st_statistics.st_xlog.ts_flush_time - flush_time); |
224 | 1146 | 1149 | ||
225 | 1147 | xl_log_bytes_flushed = xl_log_bytes_written; | 1150 | xl_log_bytes_flushed = xl_log_bytes_written; |
226 | @@ -2514,9 +2517,6 @@ | |||
227 | 2514 | if (!record) { | 2517 | if (!record) { |
228 | 2515 | break; | 2518 | break; |
229 | 2516 | } | 2519 | } |
230 | 2517 | /* Count the number of bytes read from the log: */ | ||
231 | 2518 | db->db_xlog.xl_log_bytes_read += ws->ws_seqread.xseq_record_len; | ||
232 | 2519 | |||
233 | 2520 | switch (record->xl.xl_status_1) { | 2520 | switch (record->xl.xl_status_1) { |
234 | 2521 | case XT_LOG_ENT_HEADER: | 2521 | case XT_LOG_ENT_HEADER: |
235 | 2522 | break; | 2522 | break; |
236 | @@ -2540,6 +2540,8 @@ | |||
237 | 2540 | xt_xres_apply_in_order(self, ws, ws->ws_seqread.xseq_rec_log_id, ws->ws_seqread.xseq_rec_log_offset, record); | 2540 | xt_xres_apply_in_order(self, ws, ws->ws_seqread.xseq_rec_log_id, ws->ws_seqread.xseq_rec_log_offset, record); |
238 | 2541 | break; | 2541 | break; |
239 | 2542 | } | 2542 | } |
240 | 2543 | /* Count the number of bytes read from the log: */ | ||
241 | 2544 | db->db_xlog.xl_log_bytes_read += ws->ws_seqread.xseq_record_len; | ||
242 | 2543 | } | 2545 | } |
243 | 2544 | } | 2546 | } |
244 | 2545 | 2547 |