@@ -116,6 +116,7 @@ where
116
116
preserve_region_results : bool ,
117
117
) -> Result < <Self as Plan >:: Result > {
118
118
let shards = current_plan. shards ( & pd_client) . collect :: < Vec < _ > > ( ) . await ;
119
+ debug ! ( "single_plan_handler, shards: {}" , shards. len( ) ) ;
119
120
let mut handles = Vec :: new ( ) ;
120
121
for shard in shards {
121
122
let handle = tokio:: spawn ( Self :: single_shard_handler (
@@ -158,11 +159,16 @@ where
158
159
permits : Arc < Semaphore > ,
159
160
preserve_region_results : bool ,
160
161
) -> Result < <Self as Plan >:: Result > {
162
+ debug ! ( "single_shard_handler" ) ;
161
163
let region_store = match shard. and_then ( |( shard, region_store) | {
162
164
plan. apply_shard ( shard, & region_store) . map ( |_| region_store)
163
165
} ) {
164
166
Ok ( region_store) => region_store,
165
167
Err ( Error :: LeaderNotFound { region } ) => {
168
+ debug ! (
169
+ "single_shard_handler::sharding: leader not found: {:?}" ,
170
+ region
171
+ ) ;
166
172
return Self :: handle_other_error (
167
173
pd_client,
168
174
plan,
@@ -173,9 +179,12 @@ where
173
179
preserve_region_results,
174
180
Error :: LeaderNotFound { region } ,
175
181
)
176
- . await
182
+ . await ;
183
+ }
184
+ Err ( err) => {
185
+ debug ! ( "single_shard_handler::sharding, error: {:?}" , err) ;
186
+ return Err ( err) ;
177
187
}
178
- Err ( err) => return Err ( err) ,
179
188
} ;
180
189
181
190
// limit concurrent requests
@@ -186,6 +195,7 @@ where
186
195
let mut resp = match res {
187
196
Ok ( resp) => resp,
188
197
Err ( e) if is_grpc_error ( & e) => {
198
+ debug ! ( "single_shard_handler:execute: grpc error: {:?}" , e) ;
189
199
return Self :: handle_other_error (
190
200
pd_client,
191
201
plan,
@@ -198,12 +208,17 @@ where
198
208
)
199
209
. await ;
200
210
}
201
- Err ( e) => return Err ( e) ,
211
+ Err ( e) => {
212
+ debug ! ( "single_shard_handler:execute: error: {:?}" , e) ;
213
+ return Err ( e) ;
214
+ }
202
215
} ;
203
216
204
217
if let Some ( e) = resp. key_errors ( ) {
218
+ debug ! ( "single_shard_handler:execute: key errors: {:?}" , e) ;
205
219
Ok ( vec ! [ Err ( Error :: MultipleKeyErrors ( e) ) ] )
206
220
} else if let Some ( e) = resp. region_error ( ) {
221
+ debug ! ( "single_shard_handler:execute: region error: {:?}" , e) ;
207
222
match backoff. next_delay_duration ( ) {
208
223
Some ( duration) => {
209
224
let region_error_resolved =
@@ -239,7 +254,7 @@ where
239
254
preserve_region_results : bool ,
240
255
e : Error ,
241
256
) -> Result < <Self as Plan >:: Result > {
242
- debug ! ( "handle grpc error : {:?}" , e) ;
257
+ debug ! ( "handle_other_error : {:?}" , e) ;
243
258
pd_client. invalidate_region_cache ( region) . await ;
244
259
if is_grpc_error ( & e) {
245
260
if let Some ( store_id) = store {
@@ -272,6 +287,7 @@ pub(crate) async fn handle_region_error<PdC: PdClient>(
272
287
e : errorpb:: Error ,
273
288
region_store : RegionStore ,
274
289
) -> Result < bool > {
290
+ debug ! ( "handle_region_error: {:?}" , e) ;
275
291
let ver_id = region_store. region_with_leader . ver_id ( ) ;
276
292
let store_id = region_store. region_with_leader . get_store_id ( ) ;
277
293
if let Some ( not_leader) = e. not_leader {
0 commit comments