5454import org .apache .hadoop .hbase .backup .BackupType ;
5555import org .apache .hadoop .hbase .backup .util .BackupUtils ;
5656import org .apache .hadoop .hbase .client .Admin ;
57+ import org .apache .hadoop .hbase .client .BufferedMutator ;
5758import org .apache .hadoop .hbase .client .ColumnFamilyDescriptor ;
5859import org .apache .hadoop .hbase .client .ColumnFamilyDescriptorBuilder ;
5960import org .apache .hadoop .hbase .client .Connection ;
@@ -412,9 +413,9 @@ public void writePathsPostBulkLoad(TableName tabName, byte[] region,
412413 LOG .debug ("write bulk load descriptor to backup " + tabName + " with " + finalPaths .size ()
413414 + " entries" );
414415 }
415- try (Table table = connection .getTable (bulkLoadTableName )) {
416+ try (BufferedMutator bufferedMutator = connection .getBufferedMutator (bulkLoadTableName )) {
416417 List <Put > puts = BackupSystemTable .createPutForCommittedBulkload (tabName , region , finalPaths );
417- table . put (puts );
418+ bufferedMutator . mutate (puts );
418419 LOG .debug ("written " + puts .size () + " rows for bulk load of " + tabName );
419420 }
420421 }
@@ -446,14 +447,14 @@ public void writeFilesForBulkLoadPreCommit(TableName tabName, byte[] region, fin
446447 * @param rows the rows to be deleted
447448 */
448449 public void deleteBulkLoadedRows (List <byte []> rows ) throws IOException {
449- try (Table table = connection .getTable (bulkLoadTableName )) {
450+ try (BufferedMutator bufferedMutator = connection .getBufferedMutator (bulkLoadTableName )) {
450451 List <Delete > lstDels = new ArrayList <>();
451452 for (byte [] row : rows ) {
452453 Delete del = new Delete (row );
453454 lstDels .add (del );
454455 LOG .debug ("orig deleting the row: " + Bytes .toString (row ));
455456 }
456- table . delete (lstDels );
457+ bufferedMutator . mutate (lstDels );
457458 LOG .debug ("deleted " + rows .size () + " original bulkload rows" );
458459 }
459460 }
@@ -535,7 +536,7 @@ public void deleteBulkLoadedRows(List<byte[]> rows) throws IOException {
535536 */
536537 public void writeBulkLoadedFiles (List <TableName > sTableList , Map <byte [], List <Path >>[] maps ,
537538 String backupId ) throws IOException {
538- try (Table table = connection .getTable (bulkLoadTableName )) {
539+ try (BufferedMutator bufferedMutator = connection .getBufferedMutator (bulkLoadTableName )) {
539540 long ts = EnvironmentEdgeManager .currentTime ();
540541 int cnt = 0 ;
541542 List <Put > puts = new ArrayList <>();
@@ -558,7 +559,7 @@ public void writeBulkLoadedFiles(List<TableName> sTableList, Map<byte[], List<Pa
558559 }
559560 }
560561 if (!puts .isEmpty ()) {
561- table . put (puts );
562+ bufferedMutator . mutate (puts );
562563 }
563564 }
564565 }
@@ -917,8 +918,8 @@ public void writeRegionServerLogTimestamp(Set<TableName> tables, Map<String, Lon
917918 Put put = createPutForWriteRegionServerLogTimestamp (table , smapData , backupRoot );
918919 puts .add (put );
919920 }
920- try (Table table = connection .getTable (tableName )) {
921- table . put (puts );
921+ try (BufferedMutator bufferedMutator = connection .getBufferedMutator (tableName )) {
922+ bufferedMutator . mutate (puts );
922923 }
923924 }
924925
0 commit comments