fix RelocateShard invalid initialized bug (remove RelocationReason::INVALID
This commit is contained in:
parent
2b2bc12cc1
commit
769b503d17
|
@ -949,13 +949,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
RelocateShard rs;
|
||||
rs.keys = shards[i];
|
||||
rs.priority = maxPriority;
|
||||
RelocateShard rs(
|
||||
shards[i], maxPriority, RelocateReason::OTHER, deterministicRandom()->randomUniqueID());
|
||||
|
||||
self->output.send(rs);
|
||||
TraceEvent("SendRelocateToDDQueue", self->distributorId)
|
||||
.suppressFor(1.0)
|
||||
.detail("TraceId", rs.traceId)
|
||||
.detail("ServerPrimary", self->primary)
|
||||
.detail("ServerTeam", team->getDesc())
|
||||
.detail("KeyBegin", rs.keys.begin)
|
||||
|
|
|
@ -149,7 +149,7 @@ struct RelocateData {
|
|||
std::shared_ptr<DataMove> dataMove;
|
||||
|
||||
RelocateData()
|
||||
: priority(-1), boundaryPriority(-1), healthPriority(-1), reason(RelocateReason::INVALID), startTime(-1),
|
||||
: priority(-1), boundaryPriority(-1), healthPriority(-1), reason(RelocateReason::OTHER), startTime(-1),
|
||||
dataMoveId(anonymousShardId), workFactor(0), wantsNewServers(false), cancellable(false),
|
||||
interval("QueuedRelocation") {}
|
||||
explicit RelocateData(RelocateShard const& rs)
|
||||
|
@ -560,7 +560,10 @@ struct DDQueue {
|
|||
|
||||
void increase(const UID& id, RelocateReason reason, CountType type) {
|
||||
int idx = (int)(reason);
|
||||
ASSERT(idx >= 0 && idx < 3);
|
||||
if (idx < 0 || idx >= RelocateReason::typeCount()) {
|
||||
TraceEvent(SevWarnAlways, "Debug").detail("Reason", reason.toString());
|
||||
}
|
||||
ASSERT(idx >= 0 && idx < RelocateReason::typeCount());
|
||||
counter[id][idx][(int)type] += 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
|
||||
class RelocateReason {
|
||||
public:
|
||||
enum Value : int8_t { INVALID = -1, OTHER, REBALANCE_DISK, REBALANCE_READ };
|
||||
RelocateReason(Value v = INVALID) : value(v) {}
|
||||
enum Value : int8_t { OTHER = 0, REBALANCE_DISK, REBALANCE_READ };
|
||||
RelocateReason(Value v) : value(v) {}
|
||||
explicit RelocateReason(int v) : value((Value)v) {}
|
||||
std::string toString() const {
|
||||
switch (value) {
|
||||
|
@ -49,9 +49,6 @@ public:
|
|||
return "RebalanceDisk";
|
||||
case REBALANCE_READ:
|
||||
return "RebalanceRead";
|
||||
case INVALID:
|
||||
default:
|
||||
return "Invalid";
|
||||
}
|
||||
}
|
||||
operator int() const { return (int)value; }
|
||||
|
@ -120,8 +117,13 @@ struct RelocateShard {
|
|||
|
||||
UID traceId; // track the lifetime of this relocate shard
|
||||
RelocateShard()
|
||||
: priority(0), cancelled(false), dataMoveId(anonymousShardId), reason(RelocateReason::INVALID),
|
||||
: priority(0), cancelled(false), dataMoveId(anonymousShardId), reason(RelocateReason::OTHER),
|
||||
moveReason(DataMovementReason::INVALID) {}
|
||||
|
||||
RelocateShard(KeyRange const& keys, int priority, RelocateReason reason, UID traceId = UID())
|
||||
: keys(keys), priority(priority), cancelled(false), dataMoveId(anonymousShardId), reason(reason),
|
||||
moveReason(DataMovementReason::INVALID), traceId(traceId) {}
|
||||
|
||||
RelocateShard(KeyRange const& keys, DataMovementReason moveReason, RelocateReason reason, UID traceId = UID())
|
||||
: keys(keys), cancelled(false), dataMoveId(anonymousShardId), reason(reason), moveReason(moveReason),
|
||||
traceId(traceId) {
|
||||
|
|
Loading…
Reference in New Issue