65
65
import org .apache .hadoop .hbase .util .VersionInfo ;
66
66
import org .slf4j .Logger ;
67
67
68
+ import javax .swing .plaf .synth .Region ;
68
69
import java .io .ByteArrayOutputStream ;
69
70
import java .io .IOException ;
70
71
import java .util .*;
@@ -193,7 +194,23 @@ public class OHTable implements Table {
193
194
*/
194
195
private final Configuration configuration ;
195
196
197
+ <<<<<<< HEAD
196
198
private int scannerTimeout ;
199
+ =======
200
+ private int scannerTimeout ;
201
+
202
+ /**
203
+ * the bufferedMutator to execute Puts
204
+ */
205
+ private OHBufferedMutatorImpl mutator ;
206
+
207
+ private RegionLocator regionLocator ;
208
+
209
+ /**
210
+ * flag for whether closed
211
+ */
212
+ private boolean isClosed = false ;
213
+ >>>>>>> 161 a7ce (fix delete family version result error )
197
214
198
215
/**
199
216
* Creates an object to access a HBase table.
@@ -2112,7 +2129,7 @@ private QueryAndMutate buildDeleteQueryAndMutate(KeyValue kv,
2112
2129
if (!isTableGroup ) {
2113
2130
filter = buildObHTableFilter (null , null , Integer .MAX_VALUE );
2114
2131
} else {
2115
- filter = buildObHTableFilter (null , null , Integer .MAX_VALUE );
2132
+ filter = buildObHTableFilter (null , null , Integer .MAX_VALUE , kv . getQualifier () );
2116
2133
}
2117
2134
} else {
2118
2135
range .setStartKey (ObRowKey .getInstance (CellUtil .cloneRow (kv ), ObObj .getMin (),
@@ -2134,18 +2151,34 @@ private QueryAndMutate buildDeleteQueryAndMutate(KeyValue kv,
2134
2151
ObObj .getMin ()));
2135
2152
range .setEndKey (ObRowKey .getInstance (CellUtil .cloneRow (kv ), ObObj .getMax (),
2136
2153
ObObj .getMax ()));
2137
- filter = buildObHTableFilter (null , null , Integer .MAX_VALUE );
2154
+ // [MAX_VALUE, MAX_VALUE), delete nothing
2155
+ filter = buildObHTableFilter (null , new TimeRange (Long .MAX_VALUE ), Integer .MAX_VALUE );
2138
2156
} else {
2157
+ <<<<<<< HEAD
2139
2158
range .setStartKey (ObRowKey .getInstance (CellUtil .cloneRow (kv ), ObObj .getMin (),
2159
+ =======
2160
+ TimeRange timeRange = new TimeRange (kv .getTimestamp (), kv .getTimestamp () + 1 );
2161
+ range .setStartKey (ObRowKey .getInstance (kv .getRow (), ObObj .getMin (),
2162
+ >>>>>>> 161 a7ce (fix delete family version result error )
2140
2163
ObObj .getMin ()));
2141
2164
range .setEndKey (ObRowKey .getInstance (CellUtil .cloneRow (kv ), ObObj .getMax (),
2142
2165
ObObj .getMax ()));
2143
2166
if (!isTableGroup ) {
2167
+ <<<<<<< HEAD
2144
2168
filter = buildObHTableFilter (null , new TimeRange (0 , kv .getTimestamp () + 1 ),
2145
2169
Integer .MAX_VALUE );
2146
2170
} else {
2147
2171
filter = buildObHTableFilter (null , new TimeRange (0 , kv .getTimestamp () + 1 ),
2148
2172
Integer .MAX_VALUE , CellUtil .cloneQualifier (kv ));
2173
+ =======
2174
+ filter = buildObHTableFilter (null ,
2175
+ timeRange ,
2176
+ Integer .MAX_VALUE );
2177
+ } else {
2178
+ filter = buildObHTableFilter (null ,
2179
+ timeRange ,
2180
+ Integer .MAX_VALUE , kv .getQualifier ());
2181
+ >>>>>>> 161 a7ce (fix delete family version result error )
2149
2182
}
2150
2183
}
2151
2184
break ;
@@ -2461,27 +2494,27 @@ public void refreshTableEntry(String familyString, boolean hasTestLoad) throws E
2461
2494
}
2462
2495
2463
2496
public byte [][] getStartKeys () throws IOException {
2464
- byte [][] startKeys = new byte [0 ][];
2465
- try {
2466
- startKeys = obTableClient .getHBaseTableStartKeys (tableNameString );
2467
- } catch (Exception e ) {
2468
- throw new IOException ("Fail to get start keys of HBase Table: " + tableNameString , e );
2497
+ if (regionLocator == null ) {
2498
+ OHRegionLocatorExecutor executor = new OHRegionLocatorExecutor (tableNameString , obTableClient );
2499
+ regionLocator = executor .getRegionLocator (tableNameString );
2469
2500
}
2470
- return startKeys ;
2501
+ return regionLocator . getStartKeys () ;
2471
2502
}
2472
2503
2473
2504
public byte [][] getEndKeys () throws IOException {
2474
- byte [][] endKeys = new byte [0 ][];
2475
- try {
2476
- endKeys = obTableClient .getHBaseTableEndKeys (tableNameString );
2477
- } catch (Exception e ) {
2478
- throw new IOException ("Fail to get start keys of HBase Table: " + tableNameString , e );
2505
+ if (regionLocator == null ) {
2506
+ OHRegionLocatorExecutor executor = new OHRegionLocatorExecutor (tableNameString , obTableClient );
2507
+ regionLocator = executor .getRegionLocator (tableNameString );
2479
2508
}
2480
- return endKeys ;
2509
+ return regionLocator . getEndKeys () ;
2481
2510
}
2482
2511
2483
2512
public Pair <byte [][], byte [][]> getStartEndKeys () throws IOException {
2484
- return new Pair <>(getStartKeys (), getEndKeys ());
2513
+ if (regionLocator == null ) {
2514
+ OHRegionLocatorExecutor executor = new OHRegionLocatorExecutor (tableNameString , obTableClient );
2515
+ regionLocator = executor .getRegionLocator (tableNameString );
2516
+ }
2517
+ return regionLocator .getStartEndKeys ();
2485
2518
}
2486
2519
2487
2520
public static CompareFilter .CompareOp getCompareOp (CompareOperator cmpOp ) {
0 commit comments