You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/06/10 12:50:24 UTC

ignite git commit: IGNITE-3294: Removed mocks.

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 <vo...@gridgain.com>
Authored: Fri Jun 10 15:50:05 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
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<String, String> 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<IgfsEvent> 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<IgfsCreateResult> {
-        /** Secondary file system. */
-        private IgfsSecondaryFileSystem fs;
-
-        /** Path. */
-        private IgfsPath path;
-
-        /** Simple create flag. */
-        private boolean simpleCreate;
-
-        /** Properties. */
-        private Map<String, String> 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<IgfsEvent> 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<String, String> props, boolean overwrite, int bufSize, short replication, long blockSize,
-            IgniteUuid affKey, Deque<IgfsEvent> 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<IgfsPath, IgfsEntryInfo> 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