Skip to content

DAOS-2790 evtree: Fix some issues with evtree distance sort - #736

Merged
gnailzenh merged 8 commits into
masterfrom
jvolivie/fix_evtree
Jul 12, 2019
Merged

gnailzenh merged 8 commits into
masterfrom
jvolivie/fix_evtree

Conversation

@jolivier23

Copy link
Copy Markdown
Contributor
  1. When middle node is equal distant from both sides, just
    split evenly
  2. Modify the minor field for the weight to be distance from
    new rectangle to start epoch of mbr. Use the distance
    between the original mbr and this value as the weight
  3. Fix some off by one issues with boundary calculations

1. When middle node is equal distant from both sides, just
   split evenly
2. Modify the minor field for the weight to be distance from
   new rectangle to start epoch of mbr.  Use the distance
   between the original mbr and this value as the weight
3. Fix some off by one issues with boundary calculations

Signed-off-by: Jeff Olivier <jeffrey.v.olivier@intel.com>
Comment thread src/vos/evtree.c

entry_src = evt_node_entry_at(tcx, nd_src, nr - 1);
dist = evt_mbr_dist(evt_node_mbr_get(tcx, nd_src), &entry_src->ne_rect);
entry_src = evt_node_entry_at(tcx, nd_src, nr);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that using nr is safe here because this is only called on split (full node) and the minimum order is 4. So tn_nr / 2 + 1 will always be < order. The + 1 only happens for odd numbers so worst case is order of 5 in which case nr would be 3.

@jolivier23

Copy link
Copy Markdown
Contributor Author

@gnailzenh I have been unable to reproduce the aggregation bug but this addresses a few issues with the algorithm. Item #2 in the description is unrelated but something I noticed while playing with overwrites in same epoch. In existing code, if you insert the same entry in [order] consecutive epochs and then insert another one, it would always insert the new entry with the lower half of epochs. By taking into account the distance from the mbr to the new epoch, we can ensure that for overwrite, we end up grouping the new entry with the higher epochs.

@daosbuild1

Copy link
Copy Markdown
Collaborator

Test stage Functional_Hardware completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-736/1/execution/node/598/log

@daosbuild1

Copy link
Copy Markdown
Collaborator

@daosbuild1

Copy link
Copy Markdown
Collaborator

Comment thread src/vos/evtree.c Outdated
evt_common_rect_weight(struct evt_context *tcx, const struct evt_rect *rect,
struct evt_weight *weight)
evt_common_rect_weight(struct evt_context *tcx, daos_epoch_t epoch,
const struct evt_rect *rect, struct evt_weight *weight)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand this change, this function is to calculate 'weight' of a specified MBR, why do we need to pass a 'eopch' in and comparing it with the MBR epoch?

Instead of changing all these weight calculating/diff functions, I think we'd just improve the evt_select_node() to further compare the epoch distance (new rect with two MBRs) when the two MBR weight diffs are same, that looks more straightforward to me, what do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I could do that as well. The "minor" field is kind of useless without a high epoch. It only shows a weight difference if the new rectangle underwrites the mbr. If we go that direction, perhaps we should just have one uint64 for "weight" and handle the epoch externally

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it doesn't work very well the way I have it. Don't review this yet

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, updated again. I favored "disabling" minor. Ideally, we'd add upper bound for mbr and get an actual weight difference. But in the absence of such, the only case that really matters is overwrite (non-overwrites get sorted by the extent). And in such cases, the distance to the start epoch of the MBR is a good heuristic for where to put the rectangle.

Comment thread src/vos/evtree.c

if (ent_array.ea_ent_nr == 0)
return -DER_ENOENT;
return -DER_NONEXIST;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big deal, but why it's changed from ENOENT to NONEXIST?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just because this is the only place in vos we return ENOENT

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should remove one of those error code...

@NiuYawei

Copy link
Copy Markdown
Contributor

@gnailzenh I have been unable to reproduce the aggregation bug but this addresses a few issues with the algorithm. Item #2 in the description is unrelated but something I noticed while playing with overwrites in same epoch. In existing code, if you insert the same entry in [order] consecutive epochs and then insert another one, it would always insert the new entry with the lower half of epochs. By taking into account the distance from the mbr to the new epoch, we can ensure that for overwrite, we end up grouping the new entry with the higher epochs.

FYI, I tried to reproduce the aggregation error on current master in following way: disable all other aggregation tests and leave VOS412 only, then run the "vos_test -a" in a loop, with EVT_FEAT_SORT_DIST, the evt_delete() -DER_NOENT error is reproduced on 9th iteration, with EVT_FEAT_SORT_SOFF, the error can't be reproduced (30 iterations in total).

If you can reproduce it in same way, it could be helpful for debugging.

Signed-off-by: Jeff Olivier <jeffrey.v.olivier@intel.com>
Signed-off-by: Jeff Olivier <jeffrey.v.olivier@intel.com>
@daosbuild1

Copy link
Copy Markdown
Collaborator

@jolivier23
jolivier23 requested review from NiuYawei and rpadma2 July 10, 2019 22:04
Comment thread src/vos/evtree.c Outdated
/* NB: they can be negative */
wt_diff->wt_major = wt1->wt_major - wt2->wt_major;
wt_diff->wt_minor = wt1->wt_minor - wt2->wt_minor;
/** wt2 is the difference to the original mbr */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: this function is just a common function comparing two weights, this comment should be put somewhere else.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread src/vos/evtree.c Outdated
wt_diff->wt_major = wt1->wt_major - wt2->wt_major;
wt_diff->wt_minor = wt1->wt_minor - wt2->wt_minor;
/** wt2 is the difference to the original mbr */
wt_diff->wt_minor = wt1->wt_major - wt2->wt_minor;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the 'wt_major' a typo?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch :-). Will fix that

Comment thread src/vos/evtree.c
return nd1;
else
return nd2;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are two full overwrite nodes, node1 have epoch 1, 2, 3, 4, node2 have epoch 6, 7, 8, 9 10, 11, then an epoch 5 overwrite comes, I suppose node1 should be the better choice but we'll chose node2 according to the epoch distance?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that is true. Without a high epoch in the mbr, there is no perfect heuristic

Signed-off-by: Jeff Olivier <jeffrey.v.olivier@intel.com>
@jolivier23
jolivier23 requested a review from NiuYawei July 11, 2019 07:17
@jolivier23

Copy link
Copy Markdown
Contributor Author

Thinking about it and looking at the structs, if we add an upper bound the to mbr, it takes the size of the evt_node without entries to 64 bytes from 56...this means better alignment for entries so may be worth doing to get a more accurate split and insertion heuristic.

@daosbuild1

Copy link
Copy Markdown
Collaborator

@jolivier23

Copy link
Copy Markdown
Contributor Author

Thinking about it and looking at the structs, if we add an upper bound the to mbr, it takes the size of the evt_node without entries to 64 bytes from 56...this means better alignment for entries so may be worth doing to get a more accurate split and insertion heuristic.

I'm gonna defer this change for now so I can fully concentrate on incarnation log...I'll file a ticket for it.

Comment thread src/vos/evtree.c

if (ent_array.ea_ent_nr == 0)
return -DER_ENOENT;
return -DER_NONEXIST;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should remove one of those error code...

@gnailzenh
gnailzenh merged commit a46c552 into master Jul 12, 2019
@gnailzenh
gnailzenh deleted the jvolivie/fix_evtree branch July 12, 2019 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants