Merge lp:~vkolesnikov/pbxt/pbxt-07-diskfull into lp:pbxt/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
Reviewer Review Type Date Requested Status
PBXT Core Pending
Review via email: mp+8554@code.launchpad.net
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 PBXT Release Notes
6 ==================
7
8+------- 1.0.07p RC - 2009-07-10
9+
10+RN258: updated xt_p_join implementation for Windows to check if a thread has already exited or has not yet started
11+
12+RN257: Removed false assertion that could fail during restore if a transaction log page was zero-filled
13+
14+RN256: Update datalog eof pointer only if write opearions were sucessful
15+
16+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+
18 ------- 1.0.07o RC - 2009-07-07
19
20 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
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 }
27 break;
28 default:
29- ASSERT_NS(FALSE);
30+ /* assume 0 - eof */
31+ //ASSERT_NS(FALSE);
32 goto return_empty;
33 }
34
35@@ -1110,7 +1111,6 @@
36
37 *log_id = dlb_data_log->dlf_log_id;
38 *out_offset = dlb_data_log->dlf_log_eof;
39- dlb_data_log->dlf_log_eof += req_size;
40 return OK;
41 }
42
43@@ -1158,6 +1158,8 @@
44
45 if (!xt_pwrite_file(dlb_data_log->dlf_log_file, log_offset, size, data, &thread->st_statistics.st_data, thread))
46 return FAILED;
47+
48+ dlb_data_log->dlf_log_eof += size;
49 #ifdef DEBUG
50 if (log_offset + size > dlb_max_write_offset)
51 dlb_max_write_offset = log_offset + size;
52@@ -1179,10 +1181,12 @@
53 if (dlb_buffer_size >= dlb_buffer_len + size) {
54 memcpy(dlb_log_buffer + dlb_buffer_len, data, size);
55 dlb_buffer_len += size;
56+ dlb_data_log->dlf_log_eof += size;
57 return OK;
58 }
59 }
60- dlb_flush_log(FALSE, thread);
61+ if (dlb_flush_log(FALSE, thread) != OK)
62+ return FAILED;
63 }
64
65 ASSERT_NS(dlb_buffer_len == 0);
66@@ -1191,6 +1195,7 @@
67 dlb_buffer_offset = log_offset;
68 dlb_buffer_len = size;
69 memcpy(dlb_log_buffer, data, size);
70+ dlb_data_log->dlf_log_eof += size;
71 return OK;
72 }
73
74@@ -1202,6 +1207,7 @@
75 dlb_max_write_offset = log_offset + size;
76 #endif
77 dlb_flush_required = TRUE;
78+ dlb_data_log->dlf_log_eof += size;
79 return OK;
80 }
81
82
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 u_int dlf_open_count; /* Number of open log files. */
88 XTOpenLogFilePtr dlf_free_list; /* The open file free list. */
89 off_t dlf_log_eof;
90+ //off_t dlf_last_inc; /* The size of the last added record */
91 off_t dlf_start_offset; /* Start offset for garbage collection. */
92 off_t dlf_garbage_count; /* The amount of garbage in the log file. */
93 XTOpenFilePtr dlf_log_file; /* The open file handle (if the log is in exclusive use!!). */
94
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 }
100 mm->mm_start = NULL;
101 #ifdef XT_WIN
102- if (!CloseHandle(mm->mm_mapdes))
103+ /* It is possible that a previous remap attempt has failed: the map was closed
104+ * but the new map was not allocated (e.g. because of insufficient disk space).
105+ * In this case mm->mm_mapdes will be NULL.
106+ */
107+ if (mm->mm_mapdes && !CloseHandle(mm->mm_mapdes))
108 return xt_register_ferrno(XT_REG_CONTEXT, fs_get_win_error(), xt_file_path(map));
109 mm->mm_mapdes = NULL;
110 #endif
111+ off_t old_size = mm->mm_length;
112 mm->mm_length = new_size;
113
114- if (!fs_map_file(mm, map->fr_file, TRUE))
115+ if (!fs_map_file(mm, map->fr_file, TRUE)) {
116+ /* Try to restore old mapping */
117+ mm->mm_length = old_size;
118+ fs_map_file(mm, map->fr_file, FALSE);
119 return FAILED;
120+ }
121 }
122 return OK;
123
124
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 #ifndef DRIZZLED
130 myxt_mutex_lock(&LOCK_plugin);
131 #endif
132- xt_throw(self);
133+ xt_throw_error(self, XT_REG_CONTEXT, XT_SYSTEM_ERROR, 0, "Initialization failed");
134 }
135 cont_(b);
136
137
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
143 int xt_p_join(pthread_t thread, void **value)
144 {
145- switch (WaitForSingleObject(thread, INFINITE)) {
146- case WAIT_OBJECT_0:
147- case WAIT_TIMEOUT:
148- /* Don't do this! According to the Win docs:
149- * _endthread automatically closes the thread handle
150- * (whereas _endthreadex does not). Therefore, when using
151- * _beginthread and _endthread, do not explicitly close the
152- * thread handle by calling the Win32 CloseHandle API.
153- CloseHandle(thread);
154- */
155- break;
156- case WAIT_FAILED:
157- return GetLastError();
158+ DWORD exitcode;
159+
160+ while(1) {
161+ switch (WaitForSingleObject(thread, 10000)) {
162+ case WAIT_OBJECT_0:
163+ return 0;
164+ case WAIT_TIMEOUT:
165+ /* Don't do this! According to the Win docs:
166+ * _endthread automatically closes the thread handle
167+ * (whereas _endthreadex does not). Therefore, when using
168+ * _beginthread and _endthread, do not explicitly close the
169+ * thread handle by calling the Win32 CloseHandle API.
170+ CloseHandle(thread);
171+ */
172+ if (GetExitCodeThread(thread, &exitcode) && (exitcode == STILL_ACTIVE))
173+ break;
174+ return 0;
175+ case WAIT_FAILED:
176+ return GetLastError();
177+ }
178 }
179 return 0;
180 }
181
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 /* I could use tab_ind_rec_log_id, but this may be a problem, if
187 * recovery does not recover up to the last committed transaction.
188 */
189- 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;
190+ check_index = ws->ws_in_recover
191+ && xt_comp_log_pos(log_id, log_offset, ws->ws_ind_rec_log_id, ws->ws_ind_rec_log_offset) >= 0
192+ && tab->tab_dic.dic_key_count;
193 xres_apply_change(self, ws->ws_ot, record, TRUE, check_index, &ws->ws_rec_buf);
194 tab->tab_head_op_seq = op_seq;
195 if (tab->tab_wr_wake_freeer) {
196
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
202 xtPublic c_char *xt_get_version(void)
203 {
204- return "1.0.07o RC";
205+ return "1.0.07p RC";
206 }
207
208 /* Copy and URL decode! */
209
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 /* [(8)] Flush the compactor log. */
215 xt_lock_mutex_ns(&xl_db->db_co_dlog_lock);
216 if (!xl_db->db_co_thread->st_dlog_buf.dlb_flush_log(TRUE, thread)) {
217+ xl_log_bytes_written -= part_size;
218 xt_unlock_mutex_ns(&xl_db->db_co_dlog_lock);
219 goto write_failed;
220 }
221@@ -1053,8 +1054,10 @@
222 }
223
224 /* And flush if required: */
225- if (!xt_flush_file(xl_log_file, &thread->st_statistics.st_xlog, thread))
226+ if (!xt_flush_file(xl_log_file, &thread->st_statistics.st_xlog, thread)) {
227+ xl_log_bytes_written -= part_size;
228 goto write_failed;
229+ }
230
231 xl_log_bytes_flushed = xl_log_bytes_written;
232
233@@ -2398,9 +2401,6 @@
234 if (!record) {
235 break;
236 }
237- /* Count the number of bytes read from the log: */
238- db->db_xlog.xl_log_bytes_read += ws->ws_seqread.xseq_record_len;
239-
240 switch (record->xl.xl_status_1) {
241 case XT_LOG_ENT_HEADER:
242 break;
243@@ -2424,6 +2424,8 @@
244 xt_xres_apply_in_order(self, ws, ws->ws_seqread.xseq_rec_log_id, ws->ws_seqread.xseq_rec_log_offset, record);
245 break;
246 }
247+ /* Count the number of bytes read from the log: */
248+ db->db_xlog.xl_log_bytes_read += ws->ws_seqread.xseq_record_len;
249 }
250 }
251

Subscribers

People subscribed via source and target branches

to all changes: