@@ -25,26 +25,49 @@ void TStrategyBase::EvaluateCurrentLayout(TLogContext &logCtx, TBlobState &state
25
25
ui32 lostDisks = 0 ;
26
26
ui32 unknownDisks = 0 ;
27
27
28
+ TString parts;
29
+ TStringOutput s (parts);
30
+
28
31
const ui32 totalPartCount = info.Type .TotalPartCount ();
29
32
for (ui32 diskIdx = 0 ; diskIdx < state.Disks .size (); ++diskIdx) {
33
+ if (diskIdx) {
34
+ s << ' ' ;
35
+ }
36
+
30
37
TBlobState::TDisk &disk = state.Disks [diskIdx];
31
- bool isHandoff = ( diskIdx >= totalPartCount) ;
32
- ui32 beginPartIdx = ( isHandoff ? 0 : diskIdx) ;
33
- ui32 endPartIdx = ( isHandoff ? totalPartCount : (diskIdx + 1 ) );
38
+ const bool isHandoff = diskIdx >= totalPartCount;
39
+ const ui32 beginPartIdx = isHandoff ? 0 : diskIdx;
40
+ const ui32 endPartIdx = isHandoff ? totalPartCount : (diskIdx + 1 );
34
41
EDiskEvaluation diskEvaluation = ((considerSlowAsError && disk.IsSlow ) ? EDE_ERROR : EDE_UNKNOWN);
35
42
for (ui32 partIdx = beginPartIdx; partIdx < endPartIdx; ++partIdx) {
36
- TBlobState::ESituation partSituation = disk.DiskParts [partIdx].Situation ;
37
- if (partSituation == TBlobState::ESituation::Error) {
38
- DSP_LOG_DEBUG_SX (logCtx, " BPG41" , " Id# " << state.Id .ToString ()
39
- << " Restore Disk# " << diskIdx << " Part# " << partIdx << " Error" );
40
- diskEvaluation = EDE_ERROR;
41
- }
42
- if (partSituation == TBlobState::ESituation::Lost) {
43
- DSP_LOG_DEBUG_SX (logCtx, " BPG65" , " Id# " << state.Id .ToString ()
44
- << " Restore Disk# " << diskIdx << " Part# " << partIdx << " Lost" );
45
- if (diskEvaluation != EDE_ERROR) {
46
- diskEvaluation = EDE_LOST;
47
- }
43
+ switch (disk.DiskParts [partIdx].Situation ) {
44
+ case TBlobState::ESituation::Unknown:
45
+ s << ' ?' ;
46
+ break ;
47
+
48
+ case TBlobState::ESituation::Error:
49
+ s << ' E' ;
50
+ diskEvaluation = EDE_ERROR;
51
+ break ;
52
+
53
+ case TBlobState::ESituation::Absent:
54
+ s << ' -' ;
55
+ break ;
56
+
57
+ case TBlobState::ESituation::Lost:
58
+ s << ' L' ;
59
+ if (diskEvaluation != EDE_ERROR) {
60
+ diskEvaluation = EDE_LOST;
61
+ }
62
+ break ;
63
+
64
+ case TBlobState::ESituation::Present:
65
+ s << ' +' ;
66
+ break ;
67
+
68
+ case TBlobState::ESituation::Sent:
69
+ s << ' S' ;
70
+ break ;
48
71
}
49
72
}
50
73
if (diskEvaluation == EDE_ERROR) {
@@ -57,23 +80,25 @@ void TStrategyBase::EvaluateCurrentLayout(TLogContext &logCtx, TBlobState &state
57
80
// If there are some error disks at the same moment, the group should be actually disintegrated.
58
81
} else {
59
82
for (ui32 partIdx = beginPartIdx; partIdx < endPartIdx; ++partIdx) {
60
- TBlobState::ESituation partSituation = disk.DiskParts [partIdx].Situation ;
61
- if (partSituation == TBlobState::ESituation::Present) {
62
- DSP_LOG_DEBUG_SX (logCtx, " BPG42" , " Request# "
63
- << " Id# " << state.Id .ToString ()
64
- << " Disk# " << diskIdx << " Part# " << partIdx << " Present" );
65
- presentLayout.AddItem (diskIdx, partIdx, info.Type );
66
- optimisticLayout.AddItem (diskIdx, partIdx, info.Type );
67
- altruisticLayout.AddItem (diskIdx, partIdx, info.Type );
68
- diskEvaluation = EDE_NORMAL;
69
- } else if (partSituation == TBlobState::ESituation::Unknown
70
- || partSituation == TBlobState::ESituation::Sent) {
71
- DSP_LOG_DEBUG_SX (logCtx, " BPG43" , " Id# " << state.Id .ToString ()
72
- << " Disk# " << diskIdx << " Part# " << partIdx << " Unknown" );
73
- optimisticLayout.AddItem (diskIdx, partIdx, info.Type );
74
- altruisticLayout.AddItem (diskIdx, partIdx, info.Type );
75
- } else if (partSituation == TBlobState::ESituation::Absent) {
76
- diskEvaluation = EDE_NORMAL;
83
+ switch (disk.DiskParts [partIdx].Situation ) {
84
+ case TBlobState::ESituation::Present:
85
+ presentLayout.AddItem (diskIdx, partIdx, info.Type );
86
+ optimisticLayout.AddItem (diskIdx, partIdx, info.Type );
87
+ altruisticLayout.AddItem (diskIdx, partIdx, info.Type );
88
+ [[fallthrough]];
89
+ case TBlobState::ESituation::Absent:
90
+ diskEvaluation = EDE_NORMAL;
91
+ break ;
92
+
93
+ case TBlobState::ESituation::Unknown:
94
+ case TBlobState::ESituation::Sent:
95
+ optimisticLayout.AddItem (diskIdx, partIdx, info.Type );
96
+ altruisticLayout.AddItem (diskIdx, partIdx, info.Type );
97
+ break ;
98
+
99
+ case TBlobState::ESituation::Error:
100
+ case TBlobState::ESituation::Lost:
101
+ Y_ABORT (" impossible case" );
77
102
}
78
103
}
79
104
}
@@ -100,12 +125,14 @@ void TStrategyBase::EvaluateCurrentLayout(TLogContext &logCtx, TBlobState &state
100
125
*altruisticState = info.BlobState (altruisticReplicas, lostDisks);
101
126
102
127
DSP_LOG_DEBUG_SX (logCtx, " BPG44" , " Id# " << state.Id .ToString ()
128
+ << " considerSlowAsError# " << considerSlowAsError
129
+ << " Parts# {" << parts << ' }'
103
130
<< " pessimisticReplicas# " << pessimisticReplicas
104
- << " altruisticState # " << TBlobStorageGroupInfo::BlobStateToString (*altruisticState )
131
+ << " p.State # " << TBlobStorageGroupInfo::BlobStateToString (*pessimisticState )
105
132
<< " optimisticReplicas# " << optimisticReplicas
106
- << " optimisticState # " << TBlobStorageGroupInfo::BlobStateToString (*optimisticState)
133
+ << " o.State # " << TBlobStorageGroupInfo::BlobStateToString (*optimisticState)
107
134
<< " altruisticReplicas# " << altruisticReplicas
108
- << " pessimisticState # " << TBlobStorageGroupInfo::BlobStateToString (*pessimisticState ));
135
+ << " a.State # " << TBlobStorageGroupInfo::BlobStateToString (*altruisticState ));
109
136
}
110
137
111
138
0 commit comments