Apache9 commented on code in PR #5353:
URL: https://github.com/apache/hbase/pull/5353#discussion_r1296612372
##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java:
##########
@@ -1243,19 +1249,72 @@ public List<HRegionInfo> getOnlineRegions(final
ServerName sn) throws IOExceptio
@Override
public void flush(final TableName tableName) throws IOException {
- flush(tableName, null);
+ flush(tableName, Collections.emptyList());
}
@Override
public void flush(final TableName tableName, byte[] columnFamily) throws
IOException {
- checkTableExists(tableName);
- if (isTableDisabled(tableName)) {
- LOG.info("Table is disabled: " + tableName.getNameAsString());
- return;
+ flush(tableName, Collections.singletonList(columnFamily));
+ }
+
+ @Override
+ public void flush(TableName tableName, List<byte[]> columnFamilyList) throws
IOException {
+ // check if the table exists and enabled
+ if (!isTableEnabled(tableName)) {
+ throw new TableNotEnabledException(tableName.getNameAsString());
}
+
+ List<byte[]> columnFamilies = columnFamilyList.stream()
+ .filter(cf -> cf != null && cf.length >
0).distinct().collect(Collectors.toList());
+
+ try {
+ get(flushAsync(tableName, columnFamilies), getSyncWaitTimeout(),
TimeUnit.MILLISECONDS);
+ } catch (DoNotRetryIOException e) {
+ // This is for keeping compatibility with old implementation.
+ // usually the exception caused by the method is not present on the
server or
+ // the hbase hadoop version does not match the running hadoop version or
+ // the FlushTableProcedure is disabled, if that happens, we need fall
back
+ // to the old flush implementation.
+ legacyFlush(tableName, columnFamilies);
Review Comment:
So when users call flushAsync directly, we can not fallback to legacyFlush
automatically?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]