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 A7AE4200B21 for ; Fri, 10 Jun 2016 14:50:26 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A64B1160A38; Fri, 10 Jun 2016 12:50:26 +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 C8E38160A04 for ; Fri, 10 Jun 2016 14:50:25 +0200 (CEST) Received: (qmail 86840 invoked by uid 500); 10 Jun 2016 12:50:25 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 86831 invoked by uid 99); 10 Jun 2016 12:50:25 -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; Fri, 10 Jun 2016 12:50:25 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E0C9CDFC6C; Fri, 10 Jun 2016 12:50:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Message-Id: <8c899987d43848aa8f1c4f116cdcc2c3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ignite git commit: IGNITE-3294: Removed mocks. Date: Fri, 10 Jun 2016 12:50:24 +0000 (UTC) archived-at: Fri, 10 Jun 2016 12:50:26 -0000 Repository: ignite Updated Branches: refs/heads/ignite-3294 65ecd9d31 -> 2a2f28bc9 IGNITE-3294: Removed mocks. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2a2f28bc Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2a2f28bc Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2a2f28bc Branch: refs/heads/ignite-3294 Commit: 2a2f28bc94a515b8473d9ceda086ce612bab504e Parents: 65ecd9d Author: vozerov-gridgain Authored: Fri Jun 10 15:50:05 2016 +0300 Committer: vozerov-gridgain Committed: Fri Jun 10 15:50:05 2016 +0300 ---------------------------------------------------------------------- .../processors/igfs/IgfsMetaManager.java | 235 ------------------- 1 file changed, 235 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/2a2f28bc/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java index 37c3830..fd9a507 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java @@ -1791,59 +1791,6 @@ public class IgfsMetaManager extends IgfsManager { } /** - * Create the file in DUAL mode. - * - * @param fs File system. - * @param path Path. - * @param simpleCreate "Simple create" flag. - * @param props Properties.. - * @param overwrite Overwrite flag. - * @param bufSize Buffer size. - * @param replication Replication factor. - * @param blockSize Block size. - * @param affKey Affinity key. - * @return Output stream descriptor. - * @throws IgniteCheckedException If file creation failed. - */ - public IgfsCreateResult createDual(final IgfsSecondaryFileSystem fs, - final IgfsPath path, - final boolean simpleCreate, - @Nullable final Map props, - final boolean overwrite, - final int bufSize, - final short replication, - final long blockSize, - final IgniteUuid affKey) - throws IgniteCheckedException - { - if (busyLock.enterBusy()) { - try { - assert fs != null; - assert path != null; - - // Events to fire (can be done outside of a transaction). - final Deque pendingEvts = new LinkedList<>(); - - CreateFileSynchronizationTask task = new CreateFileSynchronizationTask(fs, path, simpleCreate, props, - overwrite, bufSize, replication, blockSize, affKey, pendingEvts); - - try { - return synchronizeAndExecute(task, fs, false, path.parent()); - } - finally { - for (IgfsEvent evt : pendingEvts) - evts.record(evt); - } - } - finally { - busyLock.leaveBusy(); - } - } - else - throw new IllegalStateException("Failed to create file in DUAL mode because Grid is stopping: " + path); - } - - /** * Append to a file in DUAL mode. * * @param fs File system. @@ -2839,10 +2786,6 @@ public class IgfsMetaManager extends IgfsManager { @Nullable IgfsSecondaryFileSystemCreateContext secondaryCtx) throws IgniteCheckedException { validTxState(false); - if (secondaryCtx != null) - return createDual(secondaryCtx.fileSystem(), path, secondaryCtx.simpleCreate(), fileProps, overwrite, - secondaryCtx.bufferSize(), secondaryCtx.replication(), secondaryCtx.blockSize(), affKey); - while (true) { if (busyLock.enterBusy()) { try { @@ -3252,182 +3195,4 @@ public class IgfsMetaManager extends IgfsManager { */ public T onFailure(Exception err) throws IgniteCheckedException; } - - /** - * Synchronization task to create a file. - */ - private class CreateFileSynchronizationTask implements SynchronizationTask { - /** Secondary file system. */ - private IgfsSecondaryFileSystem fs; - - /** Path. */ - private IgfsPath path; - - /** Simple create flag. */ - private boolean simpleCreate; - - /** Properties. */ - private Map props; - - /** Overwrite flag. */ - private boolean overwrite; - - /** Buffer size. */ - private int bufSize; - - /** Replication factor. */ - private short replication; - - /** Block size. */ - private long blockSize; - - /** Affinity key. */ - private IgniteUuid affKey; - - /** Pending events. */ - private Deque pendingEvts; - - /** Output stream to the secondary file system. */ - private OutputStream out; - - /** - * Constructor. - * - * @param fs Secondary file system. - * @param path Path. - * @param simpleCreate Simple create flag. - * @param props Properties. - * @param overwrite Overwrite flag. - * @param bufSize Buffer size. - * @param replication Replication factor. - * @param blockSize Block size. - * @param affKey Affinity key. - * @param pendingEvts Pending events. - */ - public CreateFileSynchronizationTask(IgfsSecondaryFileSystem fs, IgfsPath path, boolean simpleCreate, - @Nullable Map props, boolean overwrite, int bufSize, short replication, long blockSize, - IgniteUuid affKey, Deque pendingEvts) { - this.fs = fs; - this.path = path; - this.simpleCreate = simpleCreate; - this.props = props; - this.overwrite = overwrite; - this.bufSize = bufSize; - this.replication = replication; - this.blockSize = blockSize; - this.affKey = affKey; - this.pendingEvts = pendingEvts; - } - - /** {@inheritDoc} */ - @Override public IgfsCreateResult onSuccess(Map infos) - throws Exception { - validTxState(true); - - assert !infos.isEmpty(); - - // Determine the first existing parent. - IgfsPath parentPath = null; - - for (IgfsPath curPath : infos.keySet()) { - if (parentPath == null || curPath.isSubDirectoryOf(parentPath)) - parentPath = curPath; - } - - assert parentPath != null; - - IgfsEntryInfo parentInfo = infos.get(parentPath); - - // Delegate to the secondary file system. - out = simpleCreate ? fs.create(path, overwrite) : - fs.create(path, bufSize, overwrite, replication, blockSize, props); - - IgfsPath parent0 = path.parent(); - - assert parent0 != null : "path.parent() is null (are we creating ROOT?): " + path; - - // If some of the parent directories were missing, synchronize again. - if (!parentPath.equals(parent0)) { - parentInfo = synchronize(fs, parentPath, parentInfo, parent0, true, null); - - // Fire notification about missing directories creation. - if (evts.isRecordable(EventType.EVT_IGFS_DIR_CREATED)) { - IgfsPath evtPath = parent0; - - while (!parentPath.equals(evtPath)) { - pendingEvts.addFirst(new IgfsEvent(evtPath, locNode, - EventType.EVT_IGFS_DIR_CREATED)); - - evtPath = evtPath.parent(); - - assert evtPath != null; // If this fails, then ROOT does not exist. - } - } - } - - // Get created file info. - IgfsFile status = fs.info(path); - - if (status == null) - throw fsException("Failed to open output stream to the file created in " + - "the secondary file system because it no longer exists: " + path); - else if (status.isDirectory()) - throw fsException("Failed to open output stream to the file created in " + - "the secondary file system because the path points to a directory: " + path); - - IgfsEntryInfo newInfo = IgfsUtils.createFile( - IgniteUuid.randomUuid(), - status.blockSize(), - status.length(), - affKey, - createFileLockId(false), - igfsCtx.igfs().evictExclude(path, false), - status.properties(), - status.accessTime(), - status.modificationTime() - ); - - // Add new file info to the listing optionally removing the previous one. - assert parentInfo != null; - - IgniteUuid oldId = putIfAbsentNonTx(parentInfo.id(), path.name(), newInfo); - - if (oldId != null) { - IgfsEntryInfo oldInfo = info(oldId); - - assert oldInfo != null; // Otherwise cache is in inconsistent state. - - // The contact is that we cannot overwrite a file locked for writing: - if (oldInfo.lockId() != null) - throw fsException("Failed to overwrite file (file is opened for writing) [path=" + - path + ", fileId=" + oldId + ", lockId=" + oldInfo.lockId() + ']'); - - id2InfoPrj.remove(oldId); // Remove the old one. - id2InfoPrj.invoke(parentInfo.id(), new IgfsMetaDirectoryListingRemoveProcessor( - path.name(), parentInfo.listing().get(path.name()).fileId())); - - createNewEntry(newInfo, parentInfo.id(), path.name()); // Put new one. - - igfsCtx.data().delete(oldInfo); - } - - // Record CREATE event if needed. - if (oldId == null && evts.isRecordable(EventType.EVT_IGFS_FILE_CREATED)) - pendingEvts.add(new IgfsEvent(path, locNode, EventType.EVT_IGFS_FILE_CREATED)); - - return new IgfsCreateResult(newInfo, out); - } - - /** {@inheritDoc} */ - @Override public IgfsCreateResult onFailure(Exception err) throws IgniteCheckedException { - U.closeQuiet(out); - - U.error(log, "File create in DUAL mode failed [path=" + path + ", simpleCreate=" + - simpleCreate + ", props=" + props + ", overwrite=" + overwrite + ", bufferSize=" + - bufSize + ", replication=" + replication + ", blockSize=" + blockSize + ']', err); - - throw new IgniteCheckedException("Failed to create the file due to secondary file system " + - "exception: " + path, err); - } - } } \ No newline at end of file