From commits-return-4985-archive-asf-public=cust-asf.ponee.io@asterixdb.apache.org Thu Feb 8 06:44:02 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 4E6B218064F for ; Thu, 8 Feb 2018 06:44:02 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3E214160C5C; Thu, 8 Feb 2018 05:44:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 83861160C5B for ; Thu, 8 Feb 2018 06:44:01 +0100 (CET) Received: (qmail 41635 invoked by uid 500); 8 Feb 2018 05:44:00 -0000 Mailing-List: contact commits-help@asterixdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.apache.org Delivered-To: mailing list commits@asterixdb.apache.org Received: (qmail 41626 invoked by uid 99); 8 Feb 2018 05:44:00 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Feb 2018 05:44:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B0EAFDFF80; Thu, 8 Feb 2018 05:43:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tillw@apache.org To: commits@asterixdb.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: asterixdb git commit: [NO ISSUE] Factor out common error handling code Date: Thu, 8 Feb 2018 05:43:59 +0000 (UTC) Repository: asterixdb Updated Branches: refs/heads/master 51c145c44 -> 63c5e2f72 [NO ISSUE] Factor out common error handling code - user model changes: no - storage format changes: no - interface changes: no Change-Id: I896d4242d39b72e7c322077ac5c99b0e63f0926c Reviewed-on: https://asterix-gerrit.ics.uci.edu/2366 Sonar-Qube: Jenkins Tested-by: Jenkins Contrib: Jenkins Integration-Tests: Jenkins Reviewed-by: Murtadha Hubail Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/63c5e2f7 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/63c5e2f7 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/63c5e2f7 Branch: refs/heads/master Commit: 63c5e2f726ea9455649f245288fdd0bfcc59a59c Parents: 51c145c Author: Till Westmann Authored: Tue Feb 6 16:28:02 2018 -0800 Committer: Till Westmann Committed: Wed Feb 7 21:43:40 2018 -0800 ---------------------------------------------------------------------- .../am/lsm/common/impls/AbstractLSMIndex.java | 46 ++++---------------- 1 file changed, 9 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63c5e2f7/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java index 5a95af0..908a5c2 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java @@ -719,72 +719,44 @@ public abstract class AbstractLSMIndex implements ILSMIndex { FlushOperation flushOp = (FlushOperation) operation; LOGGER.log(Level.INFO, "Flushing component with id: " + flushOp.getFlushingComponent().getId()); } - ILSMDiskComponent component = null; try { - component = doFlush(operation); - return component; + return doFlush(operation); } catch (Exception e) { LOGGER.error("Fail to execute flush " + this, e); - // clean up component - try { - cleanUpFiles(operation); - } catch (HyracksDataException e1) { - e.addSuppressed(e1); - } + cleanUpFiles(operation, e); throw HyracksDataException.create(e); } - } @Override public final ILSMDiskComponent merge(ILSMIOOperation operation) throws HyracksDataException { ILSMIndexAccessor accessor = operation.getAccessor(); ILSMIndexOperationContext opCtx = accessor.getOpContext(); - ILSMDiskComponent component = null; try { - component = opCtx.getOperation() == IndexOperation.DELETE_DISK_COMPONENTS ? EmptyComponent.INSTANCE + return opCtx.getOperation() == IndexOperation.DELETE_DISK_COMPONENTS ? EmptyComponent.INSTANCE : doMerge(operation); - return component; } catch (Exception e) { LOGGER.error("Fail to execute merge " + this, e); - // clean up component - try { - cleanUpFiles(operation); - } catch (HyracksDataException e1) { - e.addSuppressed(e1); - } + cleanUpFiles(operation, e); throw HyracksDataException.create(e); } - } - protected void cleanUpFiles(ILSMIOOperation operation) throws HyracksDataException { + protected void cleanUpFiles(ILSMIOOperation operation, Exception e) { LSMComponentFileReferences componentFiles = operation.getComponentFiles(); if (componentFiles == null) { return; } FileReference[] files = componentFiles.getFileReferences(); - HyracksDataException exception = null; for (FileReference file : files) { try { - cleanUpFile(file); - } catch (HyracksDataException e) { - if (exception == null) { - exception = e; - } else { - exception.addSuppressed(e); + if (file != null) { + diskBufferCache.deleteFile(file); } + } catch (HyracksDataException hde) { + e.addSuppressed(hde); } } - if (exception != null) { - throw exception; - } - } - - protected void cleanUpFile(FileReference file) throws HyracksDataException { - if (file != null) { - diskBufferCache.deleteFile(file); - } } protected abstract LSMComponentFileReferences getMergeFileReferences(ILSMDiskComponent firstComponent,