diff options
author | Poornima G <pgurusid@redhat.com> | 2014-01-21 23:50:23 +0000 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2014-02-03 17:24:13 -0800 |
commit | 120235d6f5c85af2a0be17ad2705159e9d0b3adf (patch) | |
tree | ce25096b47120a21e16a2f2c6c25f4daae9a8b83 /gf-error-codes.h.template | |
parent | d2b0a016e713aea8920abe23f6113517d78e260a (diff) |
cluster/dht: Fix layout sorting
The layout was not being sorted in the ascending order leading
to the wrong detection of holes/overlaps.
From looking at the previous git commits it appears that the initial version itself had the err comparison code.
Deductions from the current dht_layout_sort():
1. The zero'ed out layouts should be in the from of list, if needed
2. The layout should be sorted in the ascending order of layout error value.
3. The layout should be sorted in the ascending order of the layout 'start'.
But In some cases, with the err comparison code its not sorted in the ascending order. Example: If the input is as below for dht_layout_sort(), the sorting doesn't happen in ascending order.
Input:
0-1 err:0 2-3 err:0 6-7 err:0 0-0 err:20 4-5 err:0
With the current sort, Output:
4-5 err:0 0-0 err:0 0-1 err:0 2-3 err:0 6-7 err:0
Expected: 0-0 err:20 0-1 err:0 2-3 err:0 4-5 err:0 6-7 err:0
Looking at dht_layout_anomalies() it appears that, it doesn't require the layout to be sorted based on error value.
The other solution was to replace line 468 with:
if ((layout->list[i].err || layout->list[j].err) && (layout->list[i].start > layout->list[j].start))
Since dht_layout_anomalies() didn't expect the layout to be sorted based on the error, removed the err comparison.
Change-Id: I1215f6cd53efc7dba01c0958ba6cc7609dab6ff5
BUG: 1056406
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/6757
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'gf-error-codes.h.template')
0 files changed, 0 insertions, 0 deletions