mirror of https://github.com/tikv/client-java.git
				
				
				
			add parameter to control BoRegionMiss backoff base time (#299)
Signed-off-by: marsishandsome <marsishandsome@gmail.com>
This commit is contained in:
		
							parent
							
								
									b697cef74c
								
							
						
					
					
						commit
						9052bd1519
					
				|  | @ -66,6 +66,7 @@ public class ConfigUtils { | |||
|       "tikv.rawkv.batch_write_timeout_in_ms"; | ||||
|   public static final String TIKV_RAWKV_SCAN_TIMEOUT_IN_MS = "tikv.rawkv.scan_timeout_in_ms"; | ||||
|   public static final String TIKV_RAWKV_CLEAN_TIMEOUT_IN_MS = "tikv.rawkv.clean_timeout_in_ms"; | ||||
|   public static final String TIKV_BO_REGION_MISS_BASE_IN_MS = "tikv.bo_region_miss_base_in_ms"; | ||||
| 
 | ||||
|   public static final String DEF_PD_ADDRESSES = "127.0.0.1:2379"; | ||||
|   public static final String DEF_TIMEOUT = "200ms"; | ||||
|  | @ -108,6 +109,8 @@ public class ConfigUtils { | |||
|   public static final int DEF_TIKV_RAWKV_SCAN_TIMEOUT_IN_MS = 10000; | ||||
|   public static final int DEF_TIKV_RAWKV_CLEAN_TIMEOUT_IN_MS = 600000; | ||||
| 
 | ||||
|   public static final int DEF_TIKV_BO_REGION_MISS_BASE_IN_MS = 100; | ||||
| 
 | ||||
|   public static final String NORMAL_COMMAND_PRIORITY = "NORMAL"; | ||||
|   public static final String LOW_COMMAND_PRIORITY = "LOW"; | ||||
|   public static final String HIGH_COMMAND_PRIORITY = "HIGH"; | ||||
|  |  | |||
|  | @ -118,6 +118,7 @@ public class TiConfiguration implements Serializable { | |||
|     setIfMissing(TIKV_RAWKV_BATCH_WRITE_TIMEOUT_IN_MS, DEF_TIKV_RAWKV_BATCH_WRITE_TIMEOUT_IN_MS); | ||||
|     setIfMissing(TIKV_RAWKV_SCAN_TIMEOUT_IN_MS, DEF_TIKV_RAWKV_SCAN_TIMEOUT_IN_MS); | ||||
|     setIfMissing(TIKV_RAWKV_CLEAN_TIMEOUT_IN_MS, DEF_TIKV_RAWKV_CLEAN_TIMEOUT_IN_MS); | ||||
|     setIfMissing(TIKV_BO_REGION_MISS_BASE_IN_MS, DEF_TIKV_BO_REGION_MISS_BASE_IN_MS); | ||||
|   } | ||||
| 
 | ||||
|   public static void listAll() { | ||||
|  | @ -164,7 +165,7 @@ public class TiConfiguration implements Serializable { | |||
|     return option.get(); | ||||
|   } | ||||
| 
 | ||||
|   private static int getInt(String key) { | ||||
|   public static int getInt(String key) { | ||||
|     return Integer.parseInt(get(key)); | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
|  | @ -17,6 +17,8 @@ | |||
| 
 | ||||
| package org.tikv.common.util; | ||||
| 
 | ||||
| import static org.tikv.common.ConfigUtils.TIKV_BO_REGION_MISS_BASE_IN_MS; | ||||
| 
 | ||||
| import com.google.common.base.Preconditions; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
|  | @ -24,6 +26,7 @@ import java.util.List; | |||
| import java.util.Map; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import org.tikv.common.TiConfiguration; | ||||
| import org.tikv.common.exception.GrpcException; | ||||
| 
 | ||||
| public class ConcreteBackOffer implements BackOffer { | ||||
|  | @ -107,7 +110,11 @@ public class ConcreteBackOffer implements BackOffer { | |||
|         backOffFunction = BackOffFunction.create(2000, 10000, BackOffStrategy.EqualJitter); | ||||
|         break; | ||||
|       case BoRegionMiss: | ||||
|         backOffFunction = BackOffFunction.create(100, 500, BackOffStrategy.NoJitter); | ||||
|         backOffFunction = | ||||
|             BackOffFunction.create( | ||||
|                 TiConfiguration.getInt(TIKV_BO_REGION_MISS_BASE_IN_MS), | ||||
|                 500, | ||||
|                 BackOffStrategy.NoJitter); | ||||
|         break; | ||||
|       case BoTxnLock: | ||||
|         backOffFunction = BackOffFunction.create(200, 3000, BackOffStrategy.EqualJitter); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue