Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C7C1B200CEF for ; Mon, 4 Sep 2017 17:44:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C678D163E71; Mon, 4 Sep 2017 15:44:07 +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 217CC163E4B for ; Mon, 4 Sep 2017 17:44:06 +0200 (CEST) Received: (qmail 16029 invoked by uid 500); 4 Sep 2017 15:44:06 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 16020 invoked by uid 99); 4 Sep 2017 15:44:05 -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; Mon, 04 Sep 2017 15:44:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BBDADE1084; Mon, 4 Sep 2017 15:44:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gtully@apache.org To: commits@activemq.apache.org Message-Id: <08a1a65ad73c4e47b8de0fae010acef3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: activemq git commit: [AMQ-4947] ensure index page file does not skip forcing metadata - size is important to the page file Date: Mon, 4 Sep 2017 15:44:05 +0000 (UTC) archived-at: Mon, 04 Sep 2017 15:44:08 -0000 Repository: activemq Updated Branches: refs/heads/master 2e492569d -> 42bf6e906 [AMQ-4947] ensure index page file does not skip forcing metadata - size is important to the page file Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/42bf6e90 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/42bf6e90 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/42bf6e90 Branch: refs/heads/master Commit: 42bf6e9061c4bb5723e380da3b1c2c6a5a162ffd Parents: 2e49256 Author: gtully Authored: Mon Sep 4 16:43:48 2017 +0100 Committer: gtully Committed: Mon Sep 4 16:43:48 2017 +0100 ---------------------------------------------------------------------- .../activemq/store/kahadb/disk/page/PageFile.java | 2 +- .../activemq/util/RecoverableRandomAccessFile.java | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/42bf6e90/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java ---------------------------------------------------------------------- diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java index 052a586..5699c45 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java @@ -378,7 +378,7 @@ public class PageFile { File file = getMainPageFile(); IOHelper.mkdirs(file.getParentFile()); - writeFile = new RecoverableRandomAccessFile(file, "rw"); + writeFile = new RecoverableRandomAccessFile(file, "rw", false); readFile = new RecoverableRandomAccessFile(file, "r"); if (readFile.length() > 0) { http://git-wip-us.apache.org/repos/asf/activemq/blob/42bf6e90/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java ---------------------------------------------------------------------- diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java index 171f0c9..309272a 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java @@ -31,17 +31,21 @@ public class RecoverableRandomAccessFile implements java.io.DataOutput, java.io. RandomAccessFile raf; File file; String mode; + final boolean isSkipMetadataUpdate; - public RecoverableRandomAccessFile(File file, String mode) throws FileNotFoundException { + public RecoverableRandomAccessFile(File file, String mode, boolean skipMetadataUpdate) throws FileNotFoundException { this.file = file; this.mode = mode; raf = new RandomAccessFile(file, mode); + isSkipMetadataUpdate = skipMetadataUpdate; + } + + public RecoverableRandomAccessFile(File file, String mode) throws FileNotFoundException { + this(file, mode, SKIP_METADATA_UPDATE); } public RecoverableRandomAccessFile(String name, String mode) throws FileNotFoundException { - this.file = new File(name); - this.mode = mode; - raf = new RandomAccessFile(file, mode); + this(new File(name), mode); } public RandomAccessFile getRaf() throws IOException { @@ -394,7 +398,7 @@ public class RecoverableRandomAccessFile implements java.io.DataOutput, java.io. public void sync() throws IOException { try { - getRaf().getChannel().force(!SKIP_METADATA_UPDATE);; + getRaf().getChannel().force(!isSkipMetadataUpdate);; } catch (IOException ioe) { handleException(); throw ioe;