Merge lp:~vkolesnikov/pbxt/pbxt-diskfull into lp:pbxt

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
Reviewer Review Type Date Requested Status
PBXT Core Pending
Review via email: mp+8682@code.launchpad.net
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 PBXT Release Notes
6 ==================
7
8+RN258: updated xt_p_join implementation for Windows to check if a thread has already exited or has not yet started
9+
10+RN257: Removed false assertion that could fail during restore if a transaction log page was zero-filled
11+
12+RN256: Update datalog eof pointer only if write opearions were sucessful
13+
14+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+
16 ------- 1.0.08 RC2 - 2009-06-30
17
18 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
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
25 *log_id = dlb_data_log->dlf_log_id;
26 *out_offset = dlb_data_log->dlf_log_eof;
27- dlb_data_log->dlf_log_eof += req_size;
28 return OK;
29 }
30
31@@ -1158,6 +1157,12 @@
32
33 if (!xt_pwrite_file(dlb_data_log->dlf_log_file, log_offset, size, data, &thread->st_statistics.st_data, thread))
34 return FAILED;
35+
36+ /* Increment of dlb_data_log->dlf_log_eof was moved here from dlb_get_log_offset()
37+ * to ensure it is done after a successful update of the log, otherwise otherwise a
38+ * gap occurs in the log which cause eof to be detected in middle of the log
39+ */
40+ dlb_data_log->dlf_log_eof += size;
41 #ifdef DEBUG
42 if (log_offset + size > dlb_max_write_offset)
43 dlb_max_write_offset = log_offset + size;
44@@ -1179,10 +1184,12 @@
45 if (dlb_buffer_size >= dlb_buffer_len + size) {
46 memcpy(dlb_log_buffer + dlb_buffer_len, data, size);
47 dlb_buffer_len += size;
48+ dlb_data_log->dlf_log_eof += size;
49 return OK;
50 }
51 }
52- dlb_flush_log(FALSE, thread);
53+ if (dlb_flush_log(FALSE, thread) != OK)
54+ return FAILED;
55 }
56
57 ASSERT_NS(dlb_buffer_len == 0);
58@@ -1191,6 +1198,7 @@
59 dlb_buffer_offset = log_offset;
60 dlb_buffer_len = size;
61 memcpy(dlb_log_buffer, data, size);
62+ dlb_data_log->dlf_log_eof += size;
63 return OK;
64 }
65
66@@ -1202,6 +1210,7 @@
67 dlb_max_write_offset = log_offset + size;
68 #endif
69 dlb_flush_required = TRUE;
70+ dlb_data_log->dlf_log_eof += size;
71 return OK;
72 }
73
74
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 }
80 mm->mm_start = NULL;
81 #ifdef XT_WIN
82- if (!CloseHandle(mm->mm_mapdes))
83+ /* It is possible that a previous remap attempt has failed: the map was closed
84+ * but the new map was not allocated (e.g. because of insufficient disk space).
85+ * In this case mm->mm_mapdes will be NULL.
86+ */
87+ if (mm->mm_mapdes && !CloseHandle(mm->mm_mapdes))
88 return xt_register_ferrno(XT_REG_CONTEXT, fs_get_win_error(), xt_file_path(map));
89 mm->mm_mapdes = NULL;
90 #endif
91+ off_t old_size = mm->mm_length;
92 mm->mm_length = new_size;
93
94- if (!fs_map_file(mm, map->fr_file, TRUE))
95+ if (!fs_map_file(mm, map->fr_file, TRUE)) {
96+ /* Try to restore old mapping */
97+ mm->mm_length = old_size;
98+ fs_map_file(mm, map->fr_file, FALSE);
99 return FAILED;
100+ }
101 }
102 return OK;
103
104
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 #ifndef DRIZZLED
110 myxt_mutex_lock(&LOCK_plugin);
111 #endif
112- xt_throw(self);
113+ /* It is possible that the error was reset by cleanup code.
114+ * Set a generic error code in that case.
115+ */
116+ if (!self->t_exception.e_xt_err)
117+ xt_throw_error(self, XT_REG_CONTEXT, XT_SYSTEM_ERROR, 0, "Initialization failed");
118 }
119 cont_(b);
120
121
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
127 int xt_p_join(pthread_t thread, void **value)
128 {
129- switch (WaitForSingleObject(thread, INFINITE)) {
130- case WAIT_OBJECT_0:
131- case WAIT_TIMEOUT:
132- /* Don't do this! According to the Win docs:
133- * _endthread automatically closes the thread handle
134- * (whereas _endthreadex does not). Therefore, when using
135- * _beginthread and _endthread, do not explicitly close the
136- * thread handle by calling the Win32 CloseHandle API.
137- CloseHandle(thread);
138- */
139- break;
140- case WAIT_FAILED:
141- return GetLastError();
142+ DWORD exitcode;
143+
144+ while(1) {
145+ switch (WaitForSingleObject(thread, 10000)) {
146+ case WAIT_OBJECT_0:
147+ return 0;
148+ case WAIT_TIMEOUT:
149+ /* Don't do this! According to the Win docs:
150+ * _endthread automatically closes the thread handle
151+ * (whereas _endthreadex does not). Therefore, when using
152+ * _beginthread and _endthread, do not explicitly close the
153+ * thread handle by calling the Win32 CloseHandle API.
154+ CloseHandle(thread);
155+ */
156+ /* This is done so that if the thread was not [yet] in the running
157+ * state when this function was called we won't deadlock here.
158+ */
159+ if (GetExitCodeThread(thread, &exitcode) && (exitcode == STILL_ACTIVE))
160+ break;
161+ return 0;
162+ case WAIT_FAILED:
163+ return GetLastError();
164+ }
165 }
166+
167 return 0;
168 }
169
170
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 xtWord1 *rec_data = NULL;
176 XTTabRecFreeDPtr free_data;
177
178+ if (tab->tab_dic.dic_key_count == 0)
179+ check_index = FALSE;
180+
181 switch (record->xl.xl_status_1) {
182 case XT_LOG_ENT_REC_MODIFIED:
183 case XT_LOG_ENT_UPDATE:
184@@ -642,7 +645,7 @@
185 /* This should be done before we apply change to table, as otherwise we lose
186 * the key value that we need to remove from index
187 */
188- if (check_index && ot->ot_table->tab_dic.dic_key_count && record->xl.xl_status_1 == XT_LOG_ENT_REC_MODIFIED) {
189+ if (check_index && record->xl.xl_status_1 == XT_LOG_ENT_REC_MODIFIED) {
190 if ((rec_data = xres_load_record(self, ot, rec_id, NULL, 0, rec_buf, tab->tab_dic.dic_ind_cols_req)))
191 xres_remove_index_entries(ot, rec_id, rec_data);
192 }
193@@ -652,7 +655,7 @@
194 xt_throw(self);
195 tab->tab_bytes_to_flush += len;
196
197- if (check_index && ot->ot_table->tab_dic.dic_key_count) {
198+ if (check_index) {
199 switch (record->xl.xl_status_1) {
200 case XT_LOG_ENT_DELETE:
201 case XT_LOG_ENT_DELETE_BG:
202
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 /* [(8)] Flush the compactor log. */
208 xt_lock_mutex_ns(&xl_db->db_co_dlog_lock);
209 if (!xl_db->db_co_thread->st_dlog_buf.dlb_flush_log(TRUE, thread)) {
210+ xl_log_bytes_written -= part_size;
211 xt_unlock_mutex_ns(&xl_db->db_co_dlog_lock);
212 goto write_failed;
213 }
214@@ -1140,8 +1141,10 @@
215
216 /* And flush if required: */
217 flush_time = thread->st_statistics.st_xlog.ts_flush_time;
218- if (!xt_flush_file(xl_log_file, &thread->st_statistics.st_xlog, thread))
219+ if (!xt_flush_file(xl_log_file, &thread->st_statistics.st_xlog, thread)) {
220+ xl_log_bytes_written -= part_size;
221 goto write_failed;
222+ }
223 xl_last_flush_time = (u_int) (thread->st_statistics.st_xlog.ts_flush_time - flush_time);
224
225 xl_log_bytes_flushed = xl_log_bytes_written;
226@@ -2514,9 +2517,6 @@
227 if (!record) {
228 break;
229 }
230- /* Count the number of bytes read from the log: */
231- db->db_xlog.xl_log_bytes_read += ws->ws_seqread.xseq_record_len;
232-
233 switch (record->xl.xl_status_1) {
234 case XT_LOG_ENT_HEADER:
235 break;
236@@ -2540,6 +2540,8 @@
237 xt_xres_apply_in_order(self, ws, ws->ws_seqread.xseq_rec_log_id, ws->ws_seqread.xseq_rec_log_offset, record);
238 break;
239 }
240+ /* Count the number of bytes read from the log: */
241+ db->db_xlog.xl_log_bytes_read += ws->ws_seqread.xseq_record_len;
242 }
243 }
244

Subscribers

People subscribed via source and target branches