consul: Reverting some index compute logic
This commit is contained in:
parent
7a4b532564
commit
bf40a2ac1f
|
@ -143,28 +143,26 @@ func (k *KVS) List(args *structs.KeyRequest, reply *structs.IndexedDirEntries) e
|
||||||
ent = FilterDirEnt(acl, ent)
|
ent = FilterDirEnt(acl, ent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the maximum affected index
|
if len(ent) == 0 {
|
||||||
var maxIndex uint64
|
// Must provide non-zero index to prevent blocking
|
||||||
for _, e := range ent {
|
// Index 1 is impossible anyways (due to Raft internals)
|
||||||
if e.ModifyIndex > maxIndex {
|
if index == 0 {
|
||||||
maxIndex = e.ModifyIndex
|
reply.Index = 1
|
||||||
}
|
|
||||||
}
|
|
||||||
if tombIndex > maxIndex {
|
|
||||||
maxIndex = tombIndex
|
|
||||||
}
|
|
||||||
// Must provide non-zero index to prevent blocking
|
|
||||||
// Index 1 is impossible anyways (due to Raft internals)
|
|
||||||
if maxIndex == 0 {
|
|
||||||
if index > 0 {
|
|
||||||
maxIndex = index
|
|
||||||
} else {
|
} else {
|
||||||
maxIndex = 1
|
reply.Index = index
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
reply.Index = maxIndex
|
// Determine the maximum affected index
|
||||||
|
var maxIndex uint64
|
||||||
if len(ent) != 0 {
|
for _, e := range ent {
|
||||||
|
if e.ModifyIndex > maxIndex {
|
||||||
|
maxIndex = e.ModifyIndex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if tombIndex > maxIndex {
|
||||||
|
maxIndex = tombIndex
|
||||||
|
}
|
||||||
|
reply.Index = maxIndex
|
||||||
reply.Entries = ent
|
reply.Entries = ent
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue