@@ -124,6 +124,9 @@ public class BulkLoadHFilesTool extends Configured implements BulkLoadHFiles, To
124
124
*/
125
125
public static final String BULK_LOAD_HFILES_BY_FAMILY = "hbase.mapreduce.bulkload.by.family" ;
126
126
127
+ public static final String FAIL_IF_NEED_SPLIT_HFILE =
128
+ "hbase.loadincremental.fail.if.need.split.hfile" ;
129
+
127
130
// We use a '.' prefix which is ignored when walking directory trees
128
131
// above. It is invalid family name.
129
132
static final String TMP_DIR = ".tmp" ;
@@ -141,6 +144,7 @@ public class BulkLoadHFilesTool extends Configured implements BulkLoadHFiles, To
141
144
142
145
private List <String > clusterIds = new ArrayList <>();
143
146
private boolean replicate = true ;
147
+ private boolean failIfNeedSplitHFile = false ;
144
148
145
149
public BulkLoadHFilesTool (Configuration conf ) {
146
150
// make a copy, just to be sure we're not overriding someone else's config
@@ -159,6 +163,7 @@ public void initialize() {
159
163
nrThreads =
160
164
conf .getInt ("hbase.loadincremental.threads.max" , Runtime .getRuntime ().availableProcessors ());
161
165
bulkLoadByFamily = conf .getBoolean (BULK_LOAD_HFILES_BY_FAMILY , false );
166
+ failIfNeedSplitHFile = conf .getBoolean (FAIL_IF_NEED_SPLIT_HFILE , false );
162
167
}
163
168
164
169
// Initialize a thread pool
@@ -699,6 +704,11 @@ CacheConfig.DISABLED, true, getConf())) {
699
704
Bytes .compareTo (last .get (), startEndKeys .get (firstKeyRegionIdx ).getSecond ()) < 0 || Bytes
700
705
.equals (startEndKeys .get (firstKeyRegionIdx ).getSecond (), HConstants .EMPTY_BYTE_ARRAY );
701
706
if (!lastKeyInRange ) {
707
+ if (failIfNeedSplitHFile ) {
708
+ throw new IOException (
709
+ "The key range of hfile=" + hfilePath + " fits into no region. " + "And because "
710
+ + FAIL_IF_NEED_SPLIT_HFILE + " was set to true, we just skip the next steps." );
711
+ }
702
712
int lastKeyRegionIdx = getRegionIndex (startEndKeys , last .get ());
703
713
int splitIdx = (firstKeyRegionIdx + lastKeyRegionIdx ) / 2 ;
704
714
// make sure the splitPoint is valid in case region overlap occur, maybe the splitPoint bigger
0 commit comments