我知道我們可以使用HBase API在BigTable上執行checkAndDelete。我想知道是否有一種方法可以提交checkAndDelete列表,這樣我就不需要一個接一個地執行了。我主要擔心非批處理的性能...如何使用HBase API批量檢查BigTable中的checkAndDelete?
謝謝!
我知道我們可以使用HBase API在BigTable上執行checkAndDelete。我想知道是否有一種方法可以提交checkAndDelete列表,這樣我就不需要一個接一個地執行了。我主要擔心非批處理的性能...如何使用HBase API批量檢查BigTable中的checkAndDelete?
謝謝!
HBase API不提供checkAnd*
方法的批量選項。 HBase API由本地異步的gRPC protobuf API支持。您可以使用基礎API構建高吞吐量應用程序。
警告的一句話:這在我們面向公衆的文檔中基本沒有記載,但源代碼應該提供足夠的指導來說明如何構建應用程序。此API的活躍用戶包括Apache Beam的BigtableIO
。 TODO:document this feature,隨時對該功能發表評論或投票。
在高級別,這裏是你必須做的:
AbstractBigtableConnection btConn = (AbstractBigtableConnection) connection;
// BigtableSession can also be constructed by passing in a BigtableOptions.
BigtableSession session = btConn.getSession();
// AsyncExecutor encapsulates the notion of a "batch" of RPCs
// that need to be completed as a unit.
AsyncExecutor executor = session.createAsyncExecutor();
// This listenable future will inform you when the request is done,
// and if there were any exceptions.
// You can attach a FutureCallback
ListenableFuture<CheckAndMutateRowResponse> response =
executor.checkAndMutateRowAsync(checkAndMutateRowRequest);
// do more async work
// Make sure all of the RPCs are complete.
asyncExecutor.flush();
僅供參考,這裏是關於ListenableFuture
and FutureCallback
的更多信息。您也可以深入探討BigtableBufferedMutator
以獲得有關如何處理異常的建議。您可以通過執行BigtableTable.checkAndDelete
來創建CheckAndMutateRowRequest
。
非常感謝!對我有意義 –
嗨,我也嘗試在'BigtableTable.checkAndDelete(..)'中創建'CheckAndMutateRowRequest'。但我一直無法弄清楚如何獲得'HBaseRequestAdapter'。我可否知道最簡單的方法是什麼?我有一個'AbstractBigtableConnection'和'BigtableTable'。謝謝! –