Merge lp:~vkolesnikov/pbxt/pbxt-07-diskfull into lp:pbxt/1.0.07-rc
- pbxt-07-diskfull
- Merge into 1.0.07-rc
Proposed by
Vladimir Kolesnikov
Status: | Merged |
---|---|
Merge reported by: | Paul McCullagh |
Merged at revision: | not available |
Proposed branch: | lp:~vkolesnikov/pbxt/pbxt-07-diskfull |
Merge into: | lp:pbxt/1.0.07-rc |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~vkolesnikov/pbxt/pbxt-07-diskfull |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PBXT Core | Pending | ||
Review via email: mp+8554@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 548. By Vladimir Kolesnikov
-
added more code comments, small cleanups
- 549. By Vladimir Kolesnikov
-
small cleanups
- 550. By Vladimir Kolesnikov
-
added a condition to exception throwing code in pbxt_init
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 14:27:29 +0000 | |||
3 | +++ ChangeLog 2009-07-10 14:01:07 +0000 | |||
4 | @@ -1,6 +1,16 @@ | |||
5 | 1 | PBXT Release Notes | 1 | PBXT Release Notes |
6 | 2 | ================== | 2 | ================== |
7 | 3 | 3 | ||
8 | 4 | ------- 1.0.07p RC - 2009-07-10 | ||
9 | 5 | |||
10 | 6 | RN258: updated xt_p_join implementation for Windows to check if a thread has already exited or has not yet started | ||
11 | 7 | |||
12 | 8 | RN257: Removed false assertion that could fail during restore if a transaction log page was zero-filled | ||
13 | 9 | |||
14 | 10 | RN256: Update datalog eof pointer only if write opearions were sucessful | ||
15 | 11 | |||
16 | 12 | 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. | ||
17 | 13 | |||
18 | 4 | ------- 1.0.07o RC - 2009-07-07 | 14 | ------- 1.0.07o RC - 2009-07-07 |
19 | 5 | 15 | ||
20 | 6 | RN254: When a table with a corrupted index is detected, PBXT creates a file called 'repair-pending' in the pbxt directory, with the name of the table in it. Each table in the file is listed on a line by itself (the last line has no trailing \n). When the table is repaired (using the REPAIR TABLE command), this entry is removed from the file. | 16 | RN254: When a table with a corrupted index is detected, PBXT creates a file called 'repair-pending' in the pbxt directory, with the name of the table in it. Each table in the file is listed on a line by itself (the last line has no trailing \n). When the table is repaired (using the REPAIR TABLE command), this entry is removed from the file. |
21 | 7 | 17 | ||
22 | === modified file 'src/datalog_xt.cc' | |||
23 | --- src/datalog_xt.cc 2008-12-11 09:55:44 +0000 | |||
24 | +++ src/datalog_xt.cc 2009-07-10 14:01:07 +0000 | |||
25 | @@ -208,7 +208,8 @@ | |||
26 | 208 | } | 208 | } |
27 | 209 | break; | 209 | break; |
28 | 210 | default: | 210 | default: |
30 | 211 | ASSERT_NS(FALSE); | 211 | /* assume 0 - eof */ |
31 | 212 | //ASSERT_NS(FALSE); | ||
32 | 212 | goto return_empty; | 213 | goto return_empty; |
33 | 213 | } | 214 | } |
34 | 214 | 215 | ||
35 | @@ -1110,7 +1111,6 @@ | |||
36 | 1110 | 1111 | ||
37 | 1111 | *log_id = dlb_data_log->dlf_log_id; | 1112 | *log_id = dlb_data_log->dlf_log_id; |
38 | 1112 | *out_offset = dlb_data_log->dlf_log_eof; | 1113 | *out_offset = dlb_data_log->dlf_log_eof; |
39 | 1113 | dlb_data_log->dlf_log_eof += req_size; | ||
40 | 1114 | return OK; | 1114 | return OK; |
41 | 1115 | } | 1115 | } |
42 | 1116 | 1116 | ||
43 | @@ -1158,6 +1158,8 @@ | |||
44 | 1158 | 1158 | ||
45 | 1159 | if (!xt_pwrite_file(dlb_data_log->dlf_log_file, log_offset, size, data, &thread->st_statistics.st_data, thread)) | 1159 | if (!xt_pwrite_file(dlb_data_log->dlf_log_file, log_offset, size, data, &thread->st_statistics.st_data, thread)) |
46 | 1160 | return FAILED; | 1160 | return FAILED; |
47 | 1161 | |||
48 | 1162 | dlb_data_log->dlf_log_eof += size; | ||
49 | 1161 | #ifdef DEBUG | 1163 | #ifdef DEBUG |
50 | 1162 | if (log_offset + size > dlb_max_write_offset) | 1164 | if (log_offset + size > dlb_max_write_offset) |
51 | 1163 | dlb_max_write_offset = log_offset + size; | 1165 | dlb_max_write_offset = log_offset + size; |
52 | @@ -1179,10 +1181,12 @@ | |||
53 | 1179 | if (dlb_buffer_size >= dlb_buffer_len + size) { | 1181 | if (dlb_buffer_size >= dlb_buffer_len + size) { |
54 | 1180 | memcpy(dlb_log_buffer + dlb_buffer_len, data, size); | 1182 | memcpy(dlb_log_buffer + dlb_buffer_len, data, size); |
55 | 1181 | dlb_buffer_len += size; | 1183 | dlb_buffer_len += size; |
56 | 1184 | dlb_data_log->dlf_log_eof += size; | ||
57 | 1182 | return OK; | 1185 | return OK; |
58 | 1183 | } | 1186 | } |
59 | 1184 | } | 1187 | } |
61 | 1185 | dlb_flush_log(FALSE, thread); | 1188 | if (dlb_flush_log(FALSE, thread) != OK) |
62 | 1189 | return FAILED; | ||
63 | 1186 | } | 1190 | } |
64 | 1187 | 1191 | ||
65 | 1188 | ASSERT_NS(dlb_buffer_len == 0); | 1192 | ASSERT_NS(dlb_buffer_len == 0); |
66 | @@ -1191,6 +1195,7 @@ | |||
67 | 1191 | dlb_buffer_offset = log_offset; | 1195 | dlb_buffer_offset = log_offset; |
68 | 1192 | dlb_buffer_len = size; | 1196 | dlb_buffer_len = size; |
69 | 1193 | memcpy(dlb_log_buffer, data, size); | 1197 | memcpy(dlb_log_buffer, data, size); |
70 | 1198 | dlb_data_log->dlf_log_eof += size; | ||
71 | 1194 | return OK; | 1199 | return OK; |
72 | 1195 | } | 1200 | } |
73 | 1196 | 1201 | ||
74 | @@ -1202,6 +1207,7 @@ | |||
75 | 1202 | dlb_max_write_offset = log_offset + size; | 1207 | dlb_max_write_offset = log_offset + size; |
76 | 1203 | #endif | 1208 | #endif |
77 | 1204 | dlb_flush_required = TRUE; | 1209 | dlb_flush_required = TRUE; |
78 | 1210 | dlb_data_log->dlf_log_eof += size; | ||
79 | 1205 | return OK; | 1211 | return OK; |
80 | 1206 | } | 1212 | } |
81 | 1207 | 1213 | ||
82 | 1208 | 1214 | ||
83 | === modified file 'src/datalog_xt.h' | |||
84 | --- src/datalog_xt.h 2008-12-05 13:50:58 +0000 | |||
85 | +++ src/datalog_xt.h 2009-07-10 14:01:07 +0000 | |||
86 | @@ -93,6 +93,7 @@ | |||
87 | 93 | u_int dlf_open_count; /* Number of open log files. */ | 93 | u_int dlf_open_count; /* Number of open log files. */ |
88 | 94 | XTOpenLogFilePtr dlf_free_list; /* The open file free list. */ | 94 | XTOpenLogFilePtr dlf_free_list; /* The open file free list. */ |
89 | 95 | off_t dlf_log_eof; | 95 | off_t dlf_log_eof; |
90 | 96 | //off_t dlf_last_inc; /* The size of the last added record */ | ||
91 | 96 | off_t dlf_start_offset; /* Start offset for garbage collection. */ | 97 | off_t dlf_start_offset; /* Start offset for garbage collection. */ |
92 | 97 | off_t dlf_garbage_count; /* The amount of garbage in the log file. */ | 98 | off_t dlf_garbage_count; /* The amount of garbage in the log file. */ |
93 | 98 | XTOpenFilePtr dlf_log_file; /* The open file handle (if the log is in exclusive use!!). */ | 99 | XTOpenFilePtr dlf_log_file; /* The open file handle (if the log is in exclusive use!!). */ |
94 | 99 | 100 | ||
95 | === modified file 'src/filesys_xt.cc' | |||
96 | --- src/filesys_xt.cc 2009-07-07 14:27:29 +0000 | |||
97 | +++ src/filesys_xt.cc 2009-07-10 14:01:07 +0000 | |||
98 | @@ -1356,14 +1356,23 @@ | |||
99 | 1356 | } | 1356 | } |
100 | 1357 | mm->mm_start = NULL; | 1357 | mm->mm_start = NULL; |
101 | 1358 | #ifdef XT_WIN | 1358 | #ifdef XT_WIN |
103 | 1359 | if (!CloseHandle(mm->mm_mapdes)) | 1359 | /* It is possible that a previous remap attempt has failed: the map was closed |
104 | 1360 | * but the new map was not allocated (e.g. because of insufficient disk space). | ||
105 | 1361 | * In this case mm->mm_mapdes will be NULL. | ||
106 | 1362 | */ | ||
107 | 1363 | if (mm->mm_mapdes && !CloseHandle(mm->mm_mapdes)) | ||
108 | 1360 | return xt_register_ferrno(XT_REG_CONTEXT, fs_get_win_error(), xt_file_path(map)); | 1364 | return xt_register_ferrno(XT_REG_CONTEXT, fs_get_win_error(), xt_file_path(map)); |
109 | 1361 | mm->mm_mapdes = NULL; | 1365 | mm->mm_mapdes = NULL; |
110 | 1362 | #endif | 1366 | #endif |
111 | 1367 | off_t old_size = mm->mm_length; | ||
112 | 1363 | mm->mm_length = new_size; | 1368 | mm->mm_length = new_size; |
113 | 1364 | 1369 | ||
115 | 1365 | if (!fs_map_file(mm, map->fr_file, TRUE)) | 1370 | if (!fs_map_file(mm, map->fr_file, TRUE)) { |
116 | 1371 | /* Try to restore old mapping */ | ||
117 | 1372 | mm->mm_length = old_size; | ||
118 | 1373 | fs_map_file(mm, map->fr_file, FALSE); | ||
119 | 1366 | return FAILED; | 1374 | return FAILED; |
120 | 1375 | } | ||
121 | 1367 | } | 1376 | } |
122 | 1368 | return OK; | 1377 | return OK; |
123 | 1369 | 1378 | ||
124 | 1370 | 1379 | ||
125 | === modified file 'src/ha_pbxt.cc' | |||
126 | --- src/ha_pbxt.cc 2009-02-23 22:43:55 +0000 | |||
127 | +++ src/ha_pbxt.cc 2009-07-10 14:01:07 +0000 | |||
128 | @@ -1144,7 +1144,7 @@ | |||
129 | 1144 | #ifndef DRIZZLED | 1144 | #ifndef DRIZZLED |
130 | 1145 | myxt_mutex_lock(&LOCK_plugin); | 1145 | myxt_mutex_lock(&LOCK_plugin); |
131 | 1146 | #endif | 1146 | #endif |
133 | 1147 | xt_throw(self); | 1147 | xt_throw_error(self, XT_REG_CONTEXT, XT_SYSTEM_ERROR, 0, "Initialization failed"); |
134 | 1148 | } | 1148 | } |
135 | 1149 | cont_(b); | 1149 | cont_(b); |
136 | 1150 | 1150 | ||
137 | 1151 | 1151 | ||
138 | === modified file 'src/pthread_xt.cc' | |||
139 | --- src/pthread_xt.cc 2008-12-18 10:25:11 +0000 | |||
140 | +++ src/pthread_xt.cc 2009-07-10 14:01:07 +0000 | |||
141 | @@ -348,19 +348,26 @@ | |||
142 | 348 | 348 | ||
143 | 349 | int xt_p_join(pthread_t thread, void **value) | 349 | int xt_p_join(pthread_t thread, void **value) |
144 | 350 | { | 350 | { |
158 | 351 | switch (WaitForSingleObject(thread, INFINITE)) { | 351 | DWORD exitcode; |
159 | 352 | case WAIT_OBJECT_0: | 352 | |
160 | 353 | case WAIT_TIMEOUT: | 353 | while(1) { |
161 | 354 | /* Don't do this! According to the Win docs: | 354 | switch (WaitForSingleObject(thread, 10000)) { |
162 | 355 | * _endthread automatically closes the thread handle | 355 | case WAIT_OBJECT_0: |
163 | 356 | * (whereas _endthreadex does not). Therefore, when using | 356 | return 0; |
164 | 357 | * _beginthread and _endthread, do not explicitly close the | 357 | case WAIT_TIMEOUT: |
165 | 358 | * thread handle by calling the Win32 CloseHandle API. | 358 | /* Don't do this! According to the Win docs: |
166 | 359 | CloseHandle(thread); | 359 | * _endthread automatically closes the thread handle |
167 | 360 | */ | 360 | * (whereas _endthreadex does not). Therefore, when using |
168 | 361 | break; | 361 | * _beginthread and _endthread, do not explicitly close the |
169 | 362 | case WAIT_FAILED: | 362 | * thread handle by calling the Win32 CloseHandle API. |
170 | 363 | return GetLastError(); | 363 | CloseHandle(thread); |
171 | 364 | */ | ||
172 | 365 | if (GetExitCodeThread(thread, &exitcode) && (exitcode == STILL_ACTIVE)) | ||
173 | 366 | break; | ||
174 | 367 | return 0; | ||
175 | 368 | case WAIT_FAILED: | ||
176 | 369 | return GetLastError(); | ||
177 | 370 | } | ||
178 | 364 | } | 371 | } |
179 | 365 | return 0; | 372 | return 0; |
180 | 366 | } | 373 | } |
181 | 367 | 374 | ||
182 | === modified file 'src/restart_xt.cc' | |||
183 | --- src/restart_xt.cc 2009-07-07 14:21:07 +0000 | |||
184 | +++ src/restart_xt.cc 2009-07-10 14:01:07 +0000 | |||
185 | @@ -1498,7 +1498,9 @@ | |||
186 | 1498 | /* I could use tab_ind_rec_log_id, but this may be a problem, if | 1498 | /* I could use tab_ind_rec_log_id, but this may be a problem, if |
187 | 1499 | * recovery does not recover up to the last committed transaction. | 1499 | * recovery does not recover up to the last committed transaction. |
188 | 1500 | */ | 1500 | */ |
190 | 1501 | check_index = ws->ws_in_recover && xt_comp_log_pos(log_id, log_offset, ws->ws_ind_rec_log_id, ws->ws_ind_rec_log_offset) >= 0; | 1501 | check_index = ws->ws_in_recover |
191 | 1502 | && xt_comp_log_pos(log_id, log_offset, ws->ws_ind_rec_log_id, ws->ws_ind_rec_log_offset) >= 0 | ||
192 | 1503 | && tab->tab_dic.dic_key_count; | ||
193 | 1502 | xres_apply_change(self, ws->ws_ot, record, TRUE, check_index, &ws->ws_rec_buf); | 1504 | xres_apply_change(self, ws->ws_ot, record, TRUE, check_index, &ws->ws_rec_buf); |
194 | 1503 | tab->tab_head_op_seq = op_seq; | 1505 | tab->tab_head_op_seq = op_seq; |
195 | 1504 | if (tab->tab_wr_wake_freeer) { | 1506 | if (tab->tab_wr_wake_freeer) { |
196 | 1505 | 1507 | ||
197 | === modified file 'src/strutil_xt.cc' | |||
198 | --- src/strutil_xt.cc 2009-07-07 14:29:30 +0000 | |||
199 | +++ src/strutil_xt.cc 2009-07-10 14:01:07 +0000 | |||
200 | @@ -367,7 +367,7 @@ | |||
201 | 367 | 367 | ||
202 | 368 | xtPublic c_char *xt_get_version(void) | 368 | xtPublic c_char *xt_get_version(void) |
203 | 369 | { | 369 | { |
205 | 370 | return "1.0.07o RC"; | 370 | return "1.0.07p RC"; |
206 | 371 | } | 371 | } |
207 | 372 | 372 | ||
208 | 373 | /* Copy and URL decode! */ | 373 | /* Copy and URL decode! */ |
209 | 374 | 374 | ||
210 | === modified file 'src/xactlog_xt.cc' | |||
211 | --- src/xactlog_xt.cc 2009-06-30 11:36:08 +0000 | |||
212 | +++ src/xactlog_xt.cc 2009-07-10 14:01:07 +0000 | |||
213 | @@ -1046,6 +1046,7 @@ | |||
214 | 1046 | /* [(8)] Flush the compactor log. */ | 1046 | /* [(8)] Flush the compactor log. */ |
215 | 1047 | xt_lock_mutex_ns(&xl_db->db_co_dlog_lock); | 1047 | xt_lock_mutex_ns(&xl_db->db_co_dlog_lock); |
216 | 1048 | if (!xl_db->db_co_thread->st_dlog_buf.dlb_flush_log(TRUE, thread)) { | 1048 | if (!xl_db->db_co_thread->st_dlog_buf.dlb_flush_log(TRUE, thread)) { |
217 | 1049 | xl_log_bytes_written -= part_size; | ||
218 | 1049 | xt_unlock_mutex_ns(&xl_db->db_co_dlog_lock); | 1050 | xt_unlock_mutex_ns(&xl_db->db_co_dlog_lock); |
219 | 1050 | goto write_failed; | 1051 | goto write_failed; |
220 | 1051 | } | 1052 | } |
221 | @@ -1053,8 +1054,10 @@ | |||
222 | 1053 | } | 1054 | } |
223 | 1054 | 1055 | ||
224 | 1055 | /* And flush if required: */ | 1056 | /* And flush if required: */ |
226 | 1056 | if (!xt_flush_file(xl_log_file, &thread->st_statistics.st_xlog, thread)) | 1057 | if (!xt_flush_file(xl_log_file, &thread->st_statistics.st_xlog, thread)) { |
227 | 1058 | xl_log_bytes_written -= part_size; | ||
228 | 1057 | goto write_failed; | 1059 | goto write_failed; |
229 | 1060 | } | ||
230 | 1058 | 1061 | ||
231 | 1059 | xl_log_bytes_flushed = xl_log_bytes_written; | 1062 | xl_log_bytes_flushed = xl_log_bytes_written; |
232 | 1060 | 1063 | ||
233 | @@ -2398,9 +2401,6 @@ | |||
234 | 2398 | if (!record) { | 2401 | if (!record) { |
235 | 2399 | break; | 2402 | break; |
236 | 2400 | } | 2403 | } |
237 | 2401 | /* Count the number of bytes read from the log: */ | ||
238 | 2402 | db->db_xlog.xl_log_bytes_read += ws->ws_seqread.xseq_record_len; | ||
239 | 2403 | |||
240 | 2404 | switch (record->xl.xl_status_1) { | 2404 | switch (record->xl.xl_status_1) { |
241 | 2405 | case XT_LOG_ENT_HEADER: | 2405 | case XT_LOG_ENT_HEADER: |
242 | 2406 | break; | 2406 | break; |
243 | @@ -2424,6 +2424,8 @@ | |||
244 | 2424 | xt_xres_apply_in_order(self, ws, ws->ws_seqread.xseq_rec_log_id, ws->ws_seqread.xseq_rec_log_offset, record); | 2424 | xt_xres_apply_in_order(self, ws, ws->ws_seqread.xseq_rec_log_id, ws->ws_seqread.xseq_rec_log_offset, record); |
245 | 2425 | break; | 2425 | break; |
246 | 2426 | } | 2426 | } |
247 | 2427 | /* Count the number of bytes read from the log: */ | ||
248 | 2428 | db->db_xlog.xl_log_bytes_read += ws->ws_seqread.xseq_record_len; | ||
249 | 2427 | } | 2429 | } |
250 | 2428 | } | 2430 | } |
251 | 2429 | 2431 |