Skip to content

Commit

Permalink
[fix][tiered-storage] Don't cleanup data when offload met Metastore e…
Browse files Browse the repository at this point in the history
…xception (#17512)

* [fix][tiered-storage] Don't cleanup data when offload met BadVersion
---

*Motivation*

There have two ways that will cause the offload data cleanup. One is met
offload conflict exception, and another is completeLedgerInfoForOffloaded
reaches max retry time and throws zookeeper exceptions.

We retry the zookeeper operation on connection loss exception. We should
be careful about this exception, because we may loss data if the metadata
update successfully.

When a MetaStore exception happens, we can not make sure the metadata update is
failed or not. Because we have a retry on the connection loss, it is
possible to get a BadVersion or other exception after retrying.

So we don't clean up the data if this happens.

*Modification*

- don't delete data if has meta store exception

* log error when skip deleting

* improve logs

(cherry picked from commit c2588ba)
  • Loading branch information
zymap committed Sep 15, 2022
1 parent b95c67c commit fdd0471
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2891,8 +2891,21 @@ private void offloadLoop(CompletableFuture<PositionImpl> promise, Queue<LedgerIn
scheduledExecutor, name)
.whenComplete((ignore2, exception) -> {
if (exception != null) {
log.error("[{}] Failed to offload data for the ledgerId {}",
Throwable e = FutureUtil.unwrapCompletionException(exception);
if (e instanceof MetaStoreException) {
// When a MetaStore exception happens, we can not make sure the metadata
// update is failed or not. Because we have a retry on the connection loss,
// it is possible to get a BadVersion or other exception after retrying.
// So we don't clean up the data if it has metadata operation exception.
log.error("[{}] Failed to update offloaded metadata for the ledgerId {}, "
+ "the offloaded data will not be cleaned up",
name, ledgerId, exception);
return;
} else {
log.error("[{}] Failed to offload data for the ledgerId {}, "
+ "clean up the offloaded data",
name, ledgerId, exception);
}
cleanupOffloaded(
ledgerId, uuid,
driverName, driverMetadata,
Expand Down

0 comments on commit fdd0471

Please sign in to comment.