public static class SyncTable.SyncMapper extends TableMapper<ImmutableBytesWritable,Mutation>
Modifier and Type | Class and Description |
---|---|
private static class |
SyncTable.SyncMapper.CellScanner |
static class |
SyncTable.SyncMapper.Counter |
Modifier and Type | Field and Description |
---|---|
private static CellComparator |
cellComparator |
(package private) ImmutableBytesWritable |
currentSourceHash |
(package private) boolean |
dryRun |
private static SyncTable.SyncMapper.CellScanner |
EMPTY_CELL_SCANNER |
(package private) Throwable |
mapperException |
(package private) ImmutableBytesWritable |
nextSourceKey |
(package private) Connection |
sourceConnection |
(package private) org.apache.hadoop.fs.Path |
sourceHashDir |
(package private) HashTable.TableHash.Reader |
sourceHashReader |
(package private) Table |
sourceTable |
(package private) HashTable.TableHash |
sourceTableHash |
(package private) Connection |
targetConnection |
(package private) HashTable.ResultHasher |
targetHasher |
(package private) Table |
targetTable |
Constructor and Description |
---|
SyncTable.SyncMapper() |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanup(org.apache.hadoop.mapreduce.Mapper.Context context) |
private static int |
compareCellKeysWithinRow(Cell c1,
Cell c2)
Compare families, qualifiers, and timestamps of the given Cells.
|
private static int |
compareRowKeys(byte[] r1,
byte[] r2)
Compare row keys of the given Result objects.
|
private void |
findNextKeyHashPair()
Attempt to read the next source key/hash pair.
|
private void |
finishBatchAndCompareHashes(org.apache.hadoop.mapreduce.Mapper.Context context)
Finish the currently open hash batch.
|
private void |
finishRemainingHashRanges(org.apache.hadoop.mapreduce.Mapper.Context context) |
protected void |
map(ImmutableBytesWritable key,
Result value,
org.apache.hadoop.mapreduce.Mapper.Context context) |
private void |
moveToNextBatch(org.apache.hadoop.mapreduce.Mapper.Context context)
If there is an open hash batch, complete it and sync if there are diffs.
|
private static Connection |
openConnection(org.apache.hadoop.conf.Configuration conf,
String zkClusterConfKey,
String configPrefix) |
private static Table |
openTable(Connection connection,
org.apache.hadoop.conf.Configuration conf,
String tableNameConfKey) |
protected void |
setup(org.apache.hadoop.mapreduce.Mapper.Context context) |
private void |
syncRange(org.apache.hadoop.mapreduce.Mapper.Context context,
ImmutableBytesWritable startRow,
ImmutableBytesWritable stopRow)
Rescan the given range directly from the source and target tables.
|
private boolean |
syncRowCells(org.apache.hadoop.mapreduce.Mapper.Context context,
byte[] rowKey,
SyncTable.SyncMapper.CellScanner sourceCells,
SyncTable.SyncMapper.CellScanner targetCells)
Compare the cells for the given row from the source and target tables.
|
private static String |
toHex(ImmutableBytesWritable bytes) |
org.apache.hadoop.fs.Path sourceHashDir
Connection sourceConnection
Connection targetConnection
Table sourceTable
Table targetTable
boolean dryRun
HashTable.TableHash sourceTableHash
HashTable.TableHash.Reader sourceHashReader
ImmutableBytesWritable currentSourceHash
ImmutableBytesWritable nextSourceKey
HashTable.ResultHasher targetHasher
Throwable mapperException
private static final SyncTable.SyncMapper.CellScanner EMPTY_CELL_SCANNER
private static final CellComparator cellComparator
protected void setup(org.apache.hadoop.mapreduce.Mapper.Context context) throws IOException
setup
in class org.apache.hadoop.mapreduce.Mapper<ImmutableBytesWritable,Result,ImmutableBytesWritable,Mutation>
IOException
private static Connection openConnection(org.apache.hadoop.conf.Configuration conf, String zkClusterConfKey, String configPrefix) throws IOException
IOException
private static Table openTable(Connection connection, org.apache.hadoop.conf.Configuration conf, String tableNameConfKey) throws IOException
IOException
private void findNextKeyHashPair() throws IOException
IOException
protected void map(ImmutableBytesWritable key, Result value, org.apache.hadoop.mapreduce.Mapper.Context context) throws IOException, InterruptedException
map
in class org.apache.hadoop.mapreduce.Mapper<ImmutableBytesWritable,Result,ImmutableBytesWritable,Mutation>
IOException
InterruptedException
private void moveToNextBatch(org.apache.hadoop.mapreduce.Mapper.Context context) throws IOException, InterruptedException
IOException
InterruptedException
private void finishBatchAndCompareHashes(org.apache.hadoop.mapreduce.Mapper.Context context) throws IOException, InterruptedException
IOException
InterruptedException
private static String toHex(ImmutableBytesWritable bytes)
private void syncRange(org.apache.hadoop.mapreduce.Mapper.Context context, ImmutableBytesWritable startRow, ImmutableBytesWritable stopRow) throws IOException, InterruptedException
IOException
InterruptedException
private boolean syncRowCells(org.apache.hadoop.mapreduce.Mapper.Context context, byte[] rowKey, SyncTable.SyncMapper.CellScanner sourceCells, SyncTable.SyncMapper.CellScanner targetCells) throws IOException, InterruptedException
IOException
InterruptedException
private static int compareRowKeys(byte[] r1, byte[] r2)
private static int compareCellKeysWithinRow(Cell c1, Cell c2)
protected void cleanup(org.apache.hadoop.mapreduce.Mapper.Context context) throws IOException, InterruptedException
cleanup
in class org.apache.hadoop.mapreduce.Mapper<ImmutableBytesWritable,Result,ImmutableBytesWritable,Mutation>
IOException
InterruptedException
private void finishRemainingHashRanges(org.apache.hadoop.mapreduce.Mapper.Context context) throws IOException, InterruptedException
IOException
InterruptedException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.