ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [15/50] [abbrv] ignite git commit: IGNITE-2871: IGFS: Removed "path" from IgfsEntryInfo. Purge event is never fired now, it will be fixed as a part of IGNITE-1679.
Date Tue, 26 Apr 2016 01:07:22 GMT
IGNITE-2871: IGFS: Removed "path" from IgfsEntryInfo. Purge event is never fired now, it will
be fixed as a part of IGNITE-1679.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8d95ebac
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8d95ebac
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8d95ebac

Branch: refs/heads/ignite-testing-discovery
Commit: 8d95ebacaa01f3f9271a1ce0d1b991dfead1d0c1
Parents: e886ad0
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Tue Mar 22 12:06:51 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Tue Mar 29 15:14:11 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/binary/BinaryContext.java   |   2 -
 .../processors/igfs/IgfsDeleteWorker.java       |   8 +-
 .../internal/processors/igfs/IgfsEntryInfo.java |  29 ------
 .../internal/processors/igfs/IgfsImpl.java      |  45 ++++----
 .../processors/igfs/IgfsInputStreamImpl.java    |   2 +-
 .../processors/igfs/IgfsMetaManager.java        |  73 ++++---------
 .../processors/igfs/IgfsOutputStreamImpl.java   |  19 +---
 .../processors/igfs/IgfsPathsCreateResult.java  |  15 +--
 .../IgfsSecondaryOutputStreamDescriptor.java    |  17 +---
 .../internal/processors/igfs/IgfsUtils.java     |  20 +++-
 .../igfs/meta/IgfsMetaUpdatePathProcessor.java  | 102 -------------------
 .../ignite/igfs/IgfsEventsAbstractSelfTest.java |  32 +-----
 .../igfs/IgfsMetaManagerSelfTest.java           |   8 +-
 13 files changed, 78 insertions(+), 294 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index c9ad1e9..b357345 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -80,7 +80,6 @@ import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileRangeDeletePr
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileRangeUpdateProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileReserveSpaceProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileUnlockProcessor;
-import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdatePathProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdatePropertiesProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor;
 import org.apache.ignite.internal.util.IgniteUtils;
@@ -135,7 +134,6 @@ public class BinaryContext {
         sysClss.add(IgfsMetaFileRangeUpdateProcessor.class.getName());
         sysClss.add(IgfsMetaFileReserveSpaceProcessor.class.getName());
         sysClss.add(IgfsMetaFileUnlockProcessor.class.getName());
-        sysClss.add(IgfsMetaUpdatePathProcessor.class.getName());
         sysClss.add(IgfsMetaUpdatePropertiesProcessor.class.getName());
         sysClss.add(IgfsMetaUpdateTimesProcessor.class.getName());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
index f6b26ab..7e4dac8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
@@ -38,7 +38,6 @@ import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
-import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_PURGED;
 import static org.apache.ignite.internal.GridTopic.TOPIC_IGFS;
 
 /**
@@ -246,12 +245,7 @@ public class IgfsDeleteWorker extends IgfsThread {
                     // In case this node crashes, other node will re-delete the file.
                     data.delete(lockedInfo).get();
 
-                    boolean ret = meta.delete(trashId, name, id);
-
-                    if (info.path() != null)
-                        IgfsUtils.sendEvents(igfsCtx.kernalContext(), info.path(), EVT_IGFS_FILE_PURGED);
-
-                    return ret;
+                    return meta.delete(trashId, name, id);
                 }
             }
             else

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
index 45cf828..9ff65da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.igfs;
 
 import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.binary.BinaryUtils;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -52,9 +51,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
     /** Last modification time. */
     protected long modificationTime;
 
-    /** Original file path. This is a helper field used only during real file delete. */
-    protected IgfsPath path;
-
     /**
      * Default constructor.
      */
@@ -113,13 +109,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
     }
 
     /**
-     * @return Original file path. This is a helper field used only in some operations like
delete.
-     */
-    public IgfsPath path() {
-        return path;
-    }
-
-    /**
      * @return {@code True} if this is a file.
      */
     public abstract boolean isFile();
@@ -155,20 +144,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
     }
 
     /**
-     * Update path.
-     *
-     * @param path Path.
-     * @return Updated file info.
-     */
-    public IgfsEntryInfo path(IgfsPath path) {
-        IgfsEntryInfo res = copy();
-
-        res.path = path;
-
-        return res;
-    }
-
-    /**
      * Update access and modification time.
      *
      * @param accessTime Access time.
@@ -295,7 +270,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
         U.writeStringMap(out, props);
         out.writeLong(accessTime);
         out.writeLong(modificationTime);
-        out.writeObject(path);
     }
 
     /** {@inheritDoc} */
@@ -304,7 +278,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
         props = U.readStringMap(in);
         accessTime = in.readLong();
         modificationTime = in.readLong();
-        path = (IgfsPath)in.readObject();
     }
 
     /**
@@ -319,7 +292,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
 
         out.writeLong(accessTime);
         out.writeLong(modificationTime);
-        out.writeObject(path);
     }
 
     /**
@@ -334,7 +306,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
 
         accessTime = in.readLong();
         modificationTime = in.readLong();
-        path = in.readObject();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index e3a82a5..358aaf0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -691,12 +691,7 @@ public final class IgfsImpl implements IgfsEx {
                     return null;
                 }
 
-                IgfsEntryInfo info = meta.move(src, dest);
-
-                int evtTyp = info.isFile() ? EVT_IGFS_FILE_RENAMED : EVT_IGFS_DIR_RENAMED;
-
-                if (evts.isRecordable(evtTyp))
-                    evts.record(new IgfsEvent(src, info.path(), localNode(), evtTyp));
+                meta.move(src, dest);
 
                 return null;
             }
@@ -1016,8 +1011,8 @@ public final class IgfsImpl implements IgfsEx {
 
                     batch = newBatch(path, desc.out());
 
-                    IgfsEventAwareOutputStream os = new IgfsEventAwareOutputStream(path,
desc.info(), desc.parentId(),
-                        bufSize == 0 ? cfg.getStreamBufferSize() : bufSize, mode, batch);
+                    IgfsEventAwareOutputStream os = new IgfsEventAwareOutputStream(path,
desc.info(),
+                        bufferSize(bufSize), mode, batch);
 
                     IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, EVT_IGFS_FILE_OPENED_WRITE);
 
@@ -1034,7 +1029,7 @@ public final class IgfsImpl implements IgfsEx {
                 else
                     dirProps = fileProps = new HashMap<>(props);
 
-                IgniteBiTuple<IgfsEntryInfo, IgniteUuid> t2 = meta.create(
+                IgfsEntryInfo res = meta.create(
                     path,
                     dirProps,
                     overwrite,
@@ -1044,10 +1039,9 @@ public final class IgfsImpl implements IgfsEx {
                     fileProps
                 );
 
-                assert t2 != null;
+                assert res != null;
 
-                return new IgfsEventAwareOutputStream(path, t2.get1(), t2.get2(),
-                    bufSize == 0 ? cfg.getStreamBufferSize() : bufSize, mode, null);
+                return new IgfsEventAwareOutputStream(path, res, bufferSize(bufSize), mode,
null);
             }
         });
     }
@@ -1082,8 +1076,7 @@ public final class IgfsImpl implements IgfsEx {
 
                     batch = newBatch(path, desc.out());
 
-                    return new IgfsEventAwareOutputStream(path, desc.info(), desc.parentId(),
-                        bufSize == 0 ? cfg.getStreamBufferSize() : bufSize, mode, batch);
+                    return new IgfsEventAwareOutputStream(path, desc.info(), bufferSize(bufSize),
mode, batch);
                 }
 
                 final List<IgniteUuid> ids = meta.fileIds(path);
@@ -1112,7 +1105,7 @@ public final class IgfsImpl implements IgfsEx {
                 else
                     dirProps = fileProps = new HashMap<>(props);
 
-                IgniteBiTuple<IgfsEntryInfo, IgniteUuid> t2 = meta.append(
+                IgfsEntryInfo res = meta.append(
                     path,
                     dirProps,
                     create,
@@ -1122,10 +1115,9 @@ public final class IgfsImpl implements IgfsEx {
                     fileProps
                 );
 
-                assert t2 != null;
+                assert res != null;
 
-                return new IgfsEventAwareOutputStream(path, t2.get1(), t2.get2(),
-                        bufSize == 0 ? cfg.getStreamBufferSize() : bufSize, mode, null);
+                return new IgfsEventAwareOutputStream(path, res, bufferSize(bufSize), mode,
null);
             }
         });
     }
@@ -1693,14 +1685,13 @@ public final class IgfsImpl implements IgfsEx {
          *
          * @param path Path to stored file.
          * @param fileInfo File info.
-         * @param parentId Parent ID.
          * @param bufSize The size of the buffer to be used.
          * @param mode IGFS mode.
          * @param batch Optional secondary file system batch.
          */
-        IgfsEventAwareOutputStream(IgfsPath path, IgfsEntryInfo fileInfo,
-            IgniteUuid parentId, int bufSize, IgfsMode mode, @Nullable IgfsFileWorkerBatch
batch) {
-            super(igfsCtx, path, fileInfo, parentId, bufSize, mode, batch, metrics);
+        IgfsEventAwareOutputStream(IgfsPath path, IgfsEntryInfo fileInfo, int bufSize, IgfsMode
mode,
+            @Nullable IgfsFileWorkerBatch batch) {
+            super(igfsCtx, path, fileInfo, bufSize, mode, batch, metrics);
 
             metrics.incrementFilesOpenedForWrite();
         }
@@ -1964,6 +1955,16 @@ public final class IgfsImpl implements IgfsEx {
     }
 
     /**
+     * Get buffer size.
+     *
+     * @param bufSize Original buffer size.
+     * @return Real buffer size.
+     */
+    private int bufferSize(int bufSize) {
+        return bufSize == 0 ? cfg.getStreamBufferSize() : bufSize;
+    }
+
+    /**
      * IGFS thread factory.
      */
     @SuppressWarnings("NullableProblems")

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInputStreamImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInputStreamImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInputStreamImpl.java
index 5d41543..447be93 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInputStreamImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInputStreamImpl.java
@@ -324,7 +324,7 @@ public class IgfsInputStreamImpl extends IgfsInputStreamAdapter {
             }
         }
         catch (IgniteCheckedException e) {
-            throw new IOException("File to close the file: " + fileInfo.path(), e);
+            throw new IOException("File to close the file: " + path, e);
         }
         finally {
             closed = true;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/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 1aa49ed..d6c5995 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
@@ -52,7 +52,6 @@ import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileUnlockProcess
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingAddProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingRemoveProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingReplaceProcessor;
-import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdatePathProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdatePropertiesProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor;
 import org.apache.ignite.internal.util.GridLeanMap;
@@ -61,9 +60,7 @@ import org.apache.ignite.internal.util.lang.GridClosureException;
 import org.apache.ignite.internal.util.lang.IgniteOutClosureX;
 import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
@@ -89,13 +86,15 @@ import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.concurrent.CountDownLatch;
 
+import static org.apache.ignite.events.EventType.EVT_IGFS_DIR_RENAMED;
+import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_RENAMED;
+
 /**
  * Cache based structure (meta data) manager.
  */
 public class IgfsMetaManager extends IgfsManager {
     /** Comparator for Id sorting. */
-    private static final Comparator<IgniteUuid> PATH_ID_SORTING_COMPARATOR
-            = new Comparator<IgniteUuid>() {
+    private static final Comparator<IgniteUuid> PATH_ID_SORTING_COMPARATOR = new Comparator<IgniteUuid>()
{
         @Override public int compare(IgniteUuid u1, IgniteUuid u2) {
             if (u1 == u2)
                 return 0;
@@ -850,11 +849,10 @@ public class IgfsMetaManager extends IgfsManager {
      * Move routine.
      *
      * @param srcPath Source path.
-     * @param dstPath Destinatoin path.
-     * @return File info of renamed entry.
+     * @param dstPath Destination path.
      * @throws IgniteCheckedException In case of exception.
      */
-    public IgfsEntryInfo move(IgfsPath srcPath, IgfsPath dstPath) throws IgniteCheckedException
{
+    public void move(IgfsPath srcPath, IgfsPath dstPath) throws IgniteCheckedException {
         if (busyLock.enterBusy()) {
             try {
                 validTxState(false);
@@ -931,10 +929,11 @@ public class IgfsMetaManager extends IgfsManager {
 
                     tx.commit();
 
+                    // Fire events.
                     IgfsPath newPath = new IgfsPath(dstPathIds.path(), dstName);
 
-                    // Set the new path to the info to simplify event creation:
-                    return srcInfo.path(newPath);
+                    IgfsUtils.sendEvents(igfsCtx.kernalContext(), srcPath, newPath,
+                        srcInfo.isFile() ? EVT_IGFS_FILE_RENAMED : EVT_IGFS_DIR_RENAMED);
                 }
             }
             finally {
@@ -1137,9 +1136,6 @@ public class IgfsMetaManager extends IgfsManager {
 
                     transferEntry(parentInfo.listing().get(victimName), parentId, victimName,
trashId, trashName);
 
-                    if (victimInfo.isFile())
-                        invokeUpdatePath(victimId, path);
-
                     tx.commit();
 
                     delWorker.signal();
@@ -1739,19 +1735,6 @@ public class IgfsMetaManager extends IgfsManager {
     }
 
     /**
-     * Invoke path update processor.
-     *
-     * @param id File ID.
-     * @param path Path to be updated.
-     * @throws IgniteCheckedException If failed.
-     */
-    private void invokeUpdatePath(IgniteUuid id, IgfsPath path) throws IgniteCheckedException
{
-        validTxState(true);
-
-        id2InfoPrj.invoke(id, new IgfsMetaUpdatePathProcessor(path));
-    }
-
-    /**
      * Invoke some processor and return new value.
      *
      * @param id ID.
@@ -1923,10 +1906,10 @@ public class IgfsMetaManager extends IgfsManager {
                             }
 
                             // Record CREATE event if needed.
-                            if (evts.isRecordable(EventType.EVT_IGFS_FILE_CREATED))
+                            if (oldId == null && evts.isRecordable(EventType.EVT_IGFS_FILE_CREATED))
                                 pendingEvts.add(new IgfsEvent(path, locNode, EventType.EVT_IGFS_FILE_CREATED));
 
-                            return new IgfsSecondaryOutputStreamDescriptor(parentInfo.id(),
newInfo, out);
+                            return new IgfsSecondaryOutputStreamDescriptor(newInfo, out);
                         }
 
                         @Override public IgfsSecondaryOutputStreamDescriptor onFailure(Exception
err)
@@ -2018,8 +2001,7 @@ public class IgfsMetaManager extends IgfsManager {
                             // Set lock and return.
                             IgfsEntryInfo lockedInfo = invokeLock(info.id(), false);
 
-                            return new IgfsSecondaryOutputStreamDescriptor(infos.get(path.parent()).id(),
-                                lockedInfo, out);
+                            return new IgfsSecondaryOutputStreamDescriptor(lockedInfo, out);
                         }
 
                         @Override public IgfsSecondaryOutputStreamDescriptor onFailure(@Nullable
Exception err)
@@ -2373,9 +2355,6 @@ public class IgfsMetaManager extends IgfsManager {
                             softDeleteNonTx(null, path.name(), info.id(), trashId);
                         }
 
-                        // Update the deleted file info with path information for delete
worker.
-                        invokeUpdatePath(info.id(), path);
-
                         return true; // No additional handling is required.
                     }
 
@@ -2902,10 +2881,10 @@ public class IgfsMetaManager extends IgfsManager {
      * @param affKey Affinity key.
      * @param evictExclude Evict exclude flag.
      * @param fileProps File properties.
-     * @return Tuple containing the file info and its parent id.
+     * @return Resulting info.
      * @throws IgniteCheckedException If failed.
      */
-    IgniteBiTuple<IgfsEntryInfo, IgniteUuid> append(
+    IgfsEntryInfo append(
         final IgfsPath path,
         Map<String, String> dirProps,
         final boolean create,
@@ -2954,13 +2933,11 @@ public class IgfsMetaManager extends IgfsManager {
                             // At this point we can open the stream safely.
                             info = invokeLock(info.id(), false);
 
-                            IgniteBiTuple<IgfsEntryInfo, IgniteUuid> t2 = new T2<>(info,
pathIds.lastParentId());
-
                             tx.commit();
 
                             IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, EventType.EVT_IGFS_FILE_OPENED_WRITE);
 
-                            return t2;
+                            return info;
                         }
                         else {
                             // Create file and parent folders.
@@ -2976,7 +2953,7 @@ public class IgfsMetaManager extends IgfsManager {
                             // Generate events.
                             generateCreateEvents(res.createdPaths(), true);
 
-                            return new T2<>(res.info(), res.parentId());
+                            return res.info();
                         }
                     }
                 }
@@ -2999,10 +2976,10 @@ public class IgfsMetaManager extends IgfsManager {
      * @param affKey Affinity key.
      * @param evictExclude Evict exclude flag.
      * @param fileProps File properties.
-     * @return @return Tuple containing the created file info and its parent id.
+     * @return @return Resulting info.
      * @throws IgniteCheckedException If failed.
      */
-    IgniteBiTuple<IgfsEntryInfo, IgniteUuid> create(
+    IgfsEntryInfo create(
         final IgfsPath path,
         Map<String, String> dirProps,
         final boolean overwrite,
@@ -3080,17 +3057,12 @@ public class IgfsMetaManager extends IgfsManager {
                             IgfsEntryInfo newInfo = invokeAndGet(overwriteId, new IgfsMetaFileCreateProcessor(createTime,
                                 fileProps, blockSize, affKey, createFileLockId(false), evictExclude));
 
-                            // Fourth step: update path of remove file.
-                            invokeUpdatePath(oldId, path);
-
                             // Prepare result and commit.
-                            IgniteBiTuple<IgfsEntryInfo, IgniteUuid> t2 = new T2<>(newInfo,
parentId);
-
                             tx.commit();
 
                             IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, EventType.EVT_IGFS_FILE_OPENED_WRITE);
 
-                            return t2;
+                            return newInfo;
                         }
                         else {
                             // Create file and parent folders.
@@ -3106,7 +3078,7 @@ public class IgfsMetaManager extends IgfsManager {
                             // Generate events.
                             generateCreateEvents(res.createdPaths(), true);
 
-                            return new T2<>(res.info(), res.parentId());
+                            return res.info();
                         }
                     }
                 }
@@ -3190,7 +3162,6 @@ public class IgfsMetaManager extends IgfsManager {
 
         String curPart = pathIds.part(curIdx);
         IgniteUuid curId = pathIds.surrogateId(curIdx);
-        IgniteUuid curParentId = lastExistingInfo.id();
 
         if (lastExistingInfo.hasChild(curPart))
             return null;
@@ -3224,8 +3195,6 @@ public class IgfsMetaManager extends IgfsManager {
             // Advance things further.
             curIdx++;
 
-            curParentId = curId;
-
             curPart = nextPart;
             curId = nextId;
         }
@@ -3241,7 +3210,7 @@ public class IgfsMetaManager extends IgfsManager {
 
         createdPaths.add(pathIds.path());
 
-        return new IgfsPathsCreateResult(createdPaths, info, curParentId);
+        return new IgfsPathsCreateResult(createdPaths, info);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
index f7c85e8..21e5fb6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
@@ -58,12 +58,6 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
     @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
     private IgfsEntryInfo fileInfo;
 
-    /** Parent ID. */
-    private final IgniteUuid parentId;
-
-    /** File name. */
-    private final String fileName;
-
     /** Space in file to write data. */
     @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
     private long space;
@@ -103,8 +97,8 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
      * @param batch Optional secondary file system batch.
      * @param metrics Local IGFS metrics.
      */
-    IgfsOutputStreamImpl(IgfsContext igfsCtx, IgfsPath path, IgfsEntryInfo fileInfo, IgniteUuid
parentId,
-        int bufSize, IgfsMode mode, @Nullable IgfsFileWorkerBatch batch, IgfsLocalMetrics
metrics) {
+    IgfsOutputStreamImpl(IgfsContext igfsCtx, IgfsPath path, IgfsEntryInfo fileInfo, int
bufSize, IgfsMode mode,
+        @Nullable IgfsFileWorkerBatch batch, IgfsLocalMetrics metrics) {
         super(path, optimizeBufferSize(bufSize, fileInfo));
 
         assert fileInfo != null;
@@ -126,13 +120,10 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
         this.fileInfo = fileInfo;
         this.mode = mode;
         this.batch = batch;
-        this.parentId = parentId;
         this.metrics = metrics;
 
         streamRange = initialStreamRange(fileInfo);
 
-        fileName = path.name();
-
         writeCompletionFut = data.writeStart(fileInfo);
     }
 
@@ -270,7 +261,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
             exists = meta.exists(fileInfo.id());
         }
         catch (IgniteCheckedException e) {
-            throw new IOException("File to read file metadata: " + fileInfo.path(), e);
+            throw new IOException("File to read file metadata: " + path, e);
         }
 
         if (!exists) {
@@ -339,7 +330,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
                 exists = !deleted && meta.exists(fileInfo.id());
             }
             catch (IgniteCheckedException e) {
-                throw new IOException("File to read file metadata: " + fileInfo.path(), e);
+                throw new IOException("File to read file metadata: " + path, e);
             }
 
             if (exists) {
@@ -379,7 +370,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
                     throw new IOException("File was concurrently deleted: " + path);
                 }
                 catch (IgniteCheckedException e) {
-                    throw new IOException("File to read file metadata: " + fileInfo.path(),
e);
+                    throw new IOException("File to read file metadata: " + path, e);
                 }
 
                 if (err != null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
index 9462aa4..bd13555 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.igfs;
 
 import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteUuid;
 
 import java.util.List;
 
@@ -33,20 +32,15 @@ public class IgfsPathsCreateResult {
     /** Info of the last created file. */
     private final IgfsEntryInfo info;
 
-    /** Parent ID. */
-    private final IgniteUuid parentId;
-
     /**
      * Constructor.
      *
      * @param paths Created paths.
      * @param info Info of the last created file.
-     * @param parentId Parent ID.
      */
-    public IgfsPathsCreateResult(List<IgfsPath> paths, IgfsEntryInfo info, IgniteUuid
parentId) {
+    public IgfsPathsCreateResult(List<IgfsPath> paths, IgfsEntryInfo info) {
         this.paths = paths;
         this.info = info;
-        this.parentId = parentId;
     }
 
     /**
@@ -63,13 +57,6 @@ public class IgfsPathsCreateResult {
         return info;
     }
 
-    /**
-     * @return Parent ID.
-     */
-    public IgniteUuid parentId() {
-        return parentId;
-    }
-
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgfsPathsCreateResult.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryOutputStreamDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryOutputStreamDescriptor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryOutputStreamDescriptor.java
index 507ccfc..6bbc2c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryOutputStreamDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryOutputStreamDescriptor.java
@@ -17,17 +17,12 @@
 
 package org.apache.ignite.internal.processors.igfs;
 
-import org.apache.ignite.lang.IgniteUuid;
-
 import java.io.OutputStream;
 
 /**
  * Descriptor of an output stream opened to the secondary file system.
  */
 public class IgfsSecondaryOutputStreamDescriptor {
-    /** Parent ID in the primary file system. */
-    private final IgniteUuid parentId;
-
     /** File info in the primary file system. */
     private final IgfsEntryInfo info;
 
@@ -37,28 +32,18 @@ public class IgfsSecondaryOutputStreamDescriptor {
     /**
      * Constructor.
      *
-     * @param parentId Parent ID in the primary file system.
      * @param info File info in the primary file system.
      * @param out Output stream to the secondary file system.
      */
-    IgfsSecondaryOutputStreamDescriptor(IgniteUuid parentId, IgfsEntryInfo info, OutputStream
out) {
-        assert parentId != null;
+    IgfsSecondaryOutputStreamDescriptor(IgfsEntryInfo info, OutputStream out) {
         assert info != null;
         assert out != null;
 
-        this.parentId = parentId;
         this.info = info;
         this.out = out;
     }
 
     /**
-     * @return Parent ID in the primary file system.
-     */
-    IgniteUuid parentId() {
-        return parentId;
-    }
-
-    /**
      * @return File info in the primary file system.
      */
     IgfsEntryInfo info() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index 9b813b8..c6b7ad3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -282,7 +282,6 @@ public class IgfsUtils {
             "exceeded. [maxAttempts=" + MAX_CACHE_TX_RETRIES + ']');
     }
 
-
     /**
      * Sends a series of event.
      *
@@ -290,14 +289,29 @@ public class IgfsUtils {
      * @param type The type of event to send.
      */
     public static void sendEvents(GridKernalContext kernalCtx, IgfsPath path, int type) {
+        sendEvents(kernalCtx, path, null, type);
+    }
+
+    /**
+     * Sends a series of event.
+     *
+     * @param path The path of the created file.
+     * @param newPath New path.
+     * @param type The type of event to send.
+     */
+    public static void sendEvents(GridKernalContext kernalCtx, IgfsPath path, IgfsPath newPath,
int type) {
         assert kernalCtx != null;
         assert path != null;
 
         GridEventStorageManager evts = kernalCtx.event();
         ClusterNode locNode = kernalCtx.discovery().localNode();
 
-        if (evts.isRecordable(type))
-            evts.record(new IgfsEvent(path, locNode, type));
+        if (evts.isRecordable(type)) {
+            if (newPath == null)
+                evts.record(new IgfsEvent(path, locNode, type));
+            else
+                evts.record(new IgfsEvent(path, newPath, locNode, type));
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePathProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePathProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePathProcessor.java
deleted file mode 100644
index 782b25b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePathProcessor.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.igfs.meta;
-
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.igfs.IgfsPath;
-import org.apache.ignite.internal.processors.igfs.IgfsEntryInfo;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteUuid;
-
-import javax.cache.processor.EntryProcessor;
-import javax.cache.processor.MutableEntry;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-/**
- * Update path closure.
- */
-public final class IgfsMetaUpdatePathProcessor implements EntryProcessor<IgniteUuid, IgfsEntryInfo,
Void>,
-    Externalizable, Binarylizable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** New path. */
-    private IgfsPath path;
-
-    /**
-     * @param path Path.
-     */
-    public IgfsMetaUpdatePathProcessor(IgfsPath path) {
-        this.path = path;
-    }
-
-    /**
-     * Default constructor (required by Externalizable).
-     */
-    public IgfsMetaUpdatePathProcessor() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public Void process(MutableEntry<IgniteUuid, IgfsEntryInfo> e, Object...
args) {
-        IgfsEntryInfo info = e.getValue();
-
-        IgfsEntryInfo newInfo = info.path(path);
-
-        e.setValue(newInfo);
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(path);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-        path = (IgfsPath)in.readObject();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
-        BinaryRawWriter out = writer.rawWriter();
-
-        out.writeObject(path);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
-        BinaryRawReader in = reader.rawReader();
-
-        path = in.readObject();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(IgfsMetaUpdatePathProcessor.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
index 6ca75a1..de20a4f 100644
--- a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
@@ -53,7 +53,6 @@ import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_CREATED;
 import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_DELETED;
 import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_OPENED_READ;
 import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_OPENED_WRITE;
-import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_PURGED;
 import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_RENAMED;
 import static org.apache.ignite.events.EventType.EVT_JOB_MAPPED;
 import static org.apache.ignite.events.EventType.EVT_TASK_FAILED;
@@ -425,7 +424,7 @@ public abstract class IgfsEventsAbstractSelfTest extends GridCommonAbstractTest
     public void testTwoFiles() throws Exception {
         final List<Event> evtList = new ArrayList<>();
 
-        final int evtsCnt = 4 + 3 + 2 + 2;
+        final int evtsCnt = 4 + 3 + 1 + 1;
 
         final CountDownLatch latch = new CountDownLatch(evtsCnt);
 
@@ -495,11 +494,9 @@ public abstract class IgfsEventsAbstractSelfTest extends GridCommonAbstractTest
         assertEquals(0, evt.dataSize());
 
         assertOneToOne(
-            evtList.subList(7, 11),
+            evtList.subList(7, 9),
             new EventPredicate(EVT_IGFS_FILE_DELETED, new IgfsPath("/dir1/file1")),
-            new EventPredicate(EVT_IGFS_FILE_PURGED, new IgfsPath("/dir1/file1")),
-            new EventPredicate(EVT_IGFS_FILE_DELETED, new IgfsPath("/dir1/file2")),
-            new EventPredicate(EVT_IGFS_FILE_PURGED, new IgfsPath("/dir1/file2"))
+            new EventPredicate(EVT_IGFS_FILE_DELETED, new IgfsPath("/dir1/file2"))
         );
     }
 
@@ -683,7 +680,7 @@ public abstract class IgfsEventsAbstractSelfTest extends GridCommonAbstractTest
     public void testSingleFileOverwrite() throws Exception {
         final List<Event> evtList = new ArrayList<>();
 
-        final int evtsCnt = 1 + 4 + 1;
+        final int evtsCnt = 1 + 3 + 1;
 
         final CountDownLatch latch = new CountDownLatch(evtsCnt);
 
@@ -737,27 +734,6 @@ public abstract class IgfsEventsAbstractSelfTest extends GridCommonAbstractTest
                 @Override public boolean apply(Event e) {
                     IgfsEvent e0 = (IgfsEvent)e;
 
-                    return e0.type() == EVT_IGFS_FILE_DELETED && e0.path().equals(file1);
-                }
-            },
-            new P1<Event>() {
-                @Override public boolean apply(Event e) {
-                    IgfsEvent e0 = (IgfsEvent)e;
-
-                    return e0.type() == EVT_IGFS_FILE_PURGED && e0.path().equals(file1);
-                }
-            },
-            new P1<Event>() {
-                @Override public boolean apply(Event e) {
-                    IgfsEvent e0 = (IgfsEvent)e;
-
-                    return e0.type() == EVT_IGFS_FILE_CREATED && e0.path().equals(file1);
-                }
-            },
-            new P1<Event>() {
-                @Override public boolean apply(Event e) {
-                    IgfsEvent e0 = (IgfsEvent)e;
-
                     return e0.type() == EVT_IGFS_FILE_OPENED_WRITE && e0.path().equals(file1);
                 }
             },

http://git-wip-us.apache.org/repos/asf/ignite/blob/8d95ebac/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
index 3dc2791..039bf8d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
@@ -214,12 +214,12 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest
{
     private IgfsEntryInfo createFileAndGetInfo(String path) throws IgniteCheckedException
{
         IgfsPath p = path(path);
 
-        IgniteBiTuple<IgfsEntryInfo, IgniteUuid> t2 = mgr.create(p, null, false, 400,
null, false, null);
+        IgfsEntryInfo res = mgr.create(p, null, false, 400, null, false, null);
 
-        assert t2 != null;
-        assert !t2.get1().isDirectory();
+        assert res != null;
+        assert !res.isDirectory();
 
-        return t2.get1();
+        return res;
     }
 
     /**


Mime
View raw message