Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/main/java/com/alipay/oceanbase/hbase/OHTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -2094,6 +2094,20 @@ private ObTableQuery buildObTableQuery(ObHTableFilter filter, final Scan scan) {
obTableQuery.setScanRangeColumns("K", "Q", "T");
byte[] hotOnly = scan.getAttribute(HBASE_HTABLE_QUERY_HOT_ONLY);
obTableQuery.setHotOnly(hotOnly != null && Arrays.equals(hotOnly, "true".getBytes()));
// HBASE_HTABLE_HOTKEY_GET_OPTIMIZE_ENABLE is a statement-level setting, while HBASE_HTABLE_HOTKEY_GET_OPTIMIZE_ENABLE_GLOBAL is a global setting.
// The statement-level setting takes precedence over the global setting.
// If the statement-level setting is not configured, use the global setting.
// If the statement-level setting is configured, use the statement-level setting.
boolean hotKeyGetOptimizeEnableBool = false;
byte[] hotKeyGetOptimizeEnable = scan.getAttribute(HBASE_HTABLE_HOTKEY_GET_OPTIMIZE_ENABLE);
if (hotKeyGetOptimizeEnable == null) {
boolean hotKeyGetOptimizeEnableGlobal = configuration.getBoolean(HBASE_HTABLE_HOTKEY_GET_OPTIMIZE_ENABLE_GLOBAL, false);
hotKeyGetOptimizeEnableBool = hotKeyGetOptimizeEnableGlobal;
} else {
hotKeyGetOptimizeEnableBool = Boolean.parseBoolean(Bytes.toString(hotKeyGetOptimizeEnable));
}

obTableQuery.setGetOptimized(hotKeyGetOptimizeEnableBool);
return obTableQuery;
}

Expand Down Expand Up @@ -2122,6 +2136,16 @@ private ObTableQuery buildObTableQuery(final Get get, Collection<byte[]> columnQ
obTableQuery.setScanRangeColumns("K", "Q", "T");
byte[] hotOnly = get.getAttribute(HBASE_HTABLE_QUERY_HOT_ONLY);
obTableQuery.setHotOnly(hotOnly != null && Arrays.equals(hotOnly, "true".getBytes()));
boolean hotKeyGetOptimizeEnableBool = false;
byte[] hotKeyGetOptimizeEnable = get.getAttribute(HBASE_HTABLE_HOTKEY_GET_OPTIMIZE_ENABLE);
if (hotKeyGetOptimizeEnable == null) {
boolean hotKeyGetOptimizeEnableGlobal = configuration.getBoolean(HBASE_HTABLE_HOTKEY_GET_OPTIMIZE_ENABLE_GLOBAL, false);
hotKeyGetOptimizeEnableBool = hotKeyGetOptimizeEnableGlobal;
} else {
hotKeyGetOptimizeEnableBool = Boolean.parseBoolean(Bytes.toString(hotKeyGetOptimizeEnable));
}

obTableQuery.setGetOptimized(hotKeyGetOptimizeEnableBool);
return obTableQuery;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ public final class OHConstants {
*/
public static final String HBASE_HTABLE_READ_CONSISTENCY = "hbase.htable.read.consistency";


/**
* use to specify whether to enable the hotkey get optimize when performing a query.
*/
public static final String HBASE_HTABLE_HOTKEY_GET_OPTIMIZE_ENABLE = "hbase.htable.hotkey.get.optimize.enable";

/**
* use to specify whether to enable the hotkey get optimize globally.
*/
public static final String HBASE_HTABLE_HOTKEY_GET_OPTIMIZE_ENABLE_GLOBAL = "hbase.htable.hotkey.get.optimize.enable.global";

/**
* use to specify the idc when performing a query.
*/
Expand Down
Loading