Merge lp:~vkolesnikov/pbxt/pbxt-mmap-direct-read-deadlock into lp:pbxt
Proposed by
Vladimir Kolesnikov
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~vkolesnikov/pbxt/pbxt-mmap-direct-read-deadlock |
Merge into: | lp:pbxt |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~vkolesnikov/pbxt/pbxt-mmap-direct-read-deadlock |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PBXT Core | Pending | ||
Review via email: mp+4112@code.launchpad.net |
To post a comment you must log in.
Hi Vlad,
This implementation can be optimized a bit.
In particular, we should not always lock and copy the record header
again after every call to tab_visible().
This is only required in the case that we continue to load the record
after the switch (tab_vis) statement.
This saves time in all cases where the tab_visible() call does not
return a valid record.
On Mar 3, 2009, at 8:10 PM, Vladimir Kolesnikov wrote:
> Vladimir Kolesnikov has proposed merging lp:~vkolesnikov/pbxt/pbxt- read-deadlock into lp:pbxt. /code.launchpad .net/~vkolesnik ov/pbxt/ pbxt-mmap- direct- read- +merge/ 4112 MEMORY_ PTR(buff_ ptr, ot->ot_rec_file, id_to_rec_ offset( tab, ot->ot_seq_rec_id), tab- tci_page_ size, &ot->ot_ thread- >st_statistics. st_rec, ot- XTTabRecHeadDRe c)); MEMORY_ PTR(ot- >ot_rec_ file, ot->ot_thread); MEMORY_ PTR(buff_ ptr, ot->ot_rec_file, id_to_rec_ offset( tab, ot->ot_seq_rec_id - 1), rows.tci_ page_size, &ot->ot_thread- st_rec, ot->ot_thread); XTTabRecHeadDRe c))) { XTTabRecHeadDRe c)); MEMORY_ PTR(ot- >ot_rec_ file, ot->ot_thread); MEMORY_ PTR(ot- >ot_rec_ file, ot->ot_thread); MEMORY_ PTR(ot- >ot_rec_ file, ot->ot_thread); MEMORY_ PTR(ot- >ot_rec_ file, ot->ot_thread); get_rec_ data(ot, new_rec_id, rec_size, ot- MEMORY_ PTR(ot- >ot_rec_ file, ot->ot_thread); seq_rec_ id--;
> mmap-direct-
>
> Requested reviews:
> PBXT Core (pbxt-core)
> --
> https:/
> deadlock/
> Your team PBXT Core is subscribed to branch lp:pbxt.
> === modified file 'src/table_xt.cc'
> --- src/table_xt.cc 2009-02-27 09:22:44 +0000
> +++ src/table_xt.cc 2009-03-03 19:02:32 +0000
> @@ -4868,6 +4868,8 @@
> xtRecordID new_rec_id;
> xtBool ptr_locked;
> xtRecordID invalid_rec = 0;
> + XTTabRecHeadDRec rec_head;
> + int tab_vis;
>
> next_page:
> if (!ot->ot_on_page) {
> @@ -4900,6 +4902,9 @@
> XT_LOCK_
> xt_rec_
> >tab_rows.
> >ot_thread);
> if (!buff_ptr)
> return FAILED;
> + memcpy(&rec_head, buff_ptr, sizeof(
> + XT_UNLOCK_
> + buff_ptr = (xtWord1 *)&rec_head;
> }
>
> /* This is the current record: */
> @@ -4911,20 +4916,29 @@
> ot->ot_seq_offset += rec_size;
>
> retry:
> - switch (tab_visible(ot, (XTTabRecHeadDPtr) buff_ptr, &new_rec_id)) {
> + tab_vis = tab_visible(ot, (XTTabRecHeadDPtr) buff_ptr, &new_rec_id);
> + if (ptr_locked) {
> + XT_LOCK_
> xt_rec_
> + tab->tab_
> >st_statistics.
> +
> + if (!buff_ptr)
> + return FAILED;
> +
> + if (memcmp(&rec_head, buff_ptr, sizeof(
> + memcpy(&rec_head, buff_ptr, sizeof(
> + XT_UNLOCK_
> + goto retry;
> + }
> +
> + XT_UNLOCK_
> + }
> +
> + switch (tab_vis) {
> case FALSE:
> - if (ptr_locked) {
> - XT_UNLOCK_
> - ptr_locked = FALSE;
> - }
> goto next_record;
> case XT_ERR:
> goto failed;
> case XT_NEW:
> - if (ptr_locked) {
> - XT_UNLOCK_
> - ptr_locked = FALSE;
> - }
> buff_ptr = ot->ot_row_rbuffer;
> if (!xt_tab_
> >ot_row_rbuffer))
> return XT_ERR;
> @@ -4937,12 +4951,6 @@
> /* Don't re-read for the same record twice: */
> invalid_rec = ot->ot_curr_rec_id;
>
> - /* Unlock the memory map: */
> - if (ptr_locked) {
> - XT_UNLOCK_
> - ptr_locked = FALSE;
> - }
> -
> /* Undo move to next: */
> ot->ot_
> ot->ot_seq_offset -= rec_size;
> @@ -49...