Repository: ignite
Updated Branches:
  refs/heads/ignite-3294 c7553d14e -> 87237ceef


IGNITE-3294: Now only single invoke call is performed for creates.


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

Branch: refs/heads/ignite-3294
Commit: 4cff170071822b9ebc77a7113599adb7ff248fc1
Parents: c7553d1
Author: vozerov-gridgain <voze...@gridgain.com>
Authored: Fri Jun 10 18:51:41 2016 +0300
Committer: vozerov-gridgain <voze...@gridgain.com>
Committed: Fri Jun 10 18:51:41 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/igfs/IgfsMetaManager.java | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4cff1700/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 8d7aed8..7439c28 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
@@ -2995,6 +2995,7 @@ public class IgfsMetaManager extends IgfsManager {
      * @return Result.
      * @throws IgniteCheckedException If failed.
      */
+    @SuppressWarnings("unchecked")
     private IgfsPathsCreateResult createFileOrDirectory(boolean dir, 
IgfsPathIds pathIds,
         Map<IgniteUuid, IgfsEntryInfo> lockInfos, Map<String, String> 
dirProps, Map<String, String> fileProps,
         int blockSize, @Nullable IgniteUuid affKey, boolean evictExclude,
@@ -3020,8 +3021,10 @@ public class IgfsMetaManager extends IgfsManager {
         if (secondaryCtx != null)
             secondaryOut = secondaryCtx.create();
 
+        Map<IgniteUuid, EntryProcessor> procMap = new HashMap<>();
+
         // First step: add new entry to the last existing element.
-        id2InfoPrj.invoke(lastExistingInfo.id(), new 
IgfsMetaDirectoryListingAddProcessor(curPart,
+        procMap.put(lastExistingInfo.id(), new 
IgfsMetaDirectoryListingAddProcessor(curPart,
             new IgfsListingEntry(curId, dir || !pathIds.isLastIndex(curIdx))));
 
         // Events support.
@@ -3064,7 +3067,7 @@ public class IgfsMetaManager extends IgfsManager {
                 props = dirProps;
             }
 
-            id2InfoPrj.invoke(curId, new 
IgfsMetaDirectoryCreateProcessor(accessTime, modificationTime, props,
+            procMap.put(curId, new 
IgfsMetaDirectoryCreateProcessor(accessTime, modificationTime, props,
                 nextPart, new IgfsListingEntry(nextId, dir || 
!pathIds.isLastIndex(nextIdx))));
 
             // Save event.
@@ -3078,8 +3081,6 @@ public class IgfsMetaManager extends IgfsManager {
         }
 
         // Third step: create leaf.
-        IgfsEntryInfo info;
-
         if (dir) {
             long accessTime;
             long modificationTime;
@@ -3105,7 +3106,7 @@ public class IgfsMetaManager extends IgfsManager {
                 props = dirProps;
             }
 
-            info = invokeAndGet(curId, new 
IgfsMetaDirectoryCreateProcessor(accessTime, modificationTime, props));
+            procMap.put(curId, new 
IgfsMetaDirectoryCreateProcessor(accessTime, modificationTime, props));
         }
         else {
             long newAccessTime;
@@ -3138,12 +3139,17 @@ public class IgfsMetaManager extends IgfsManager {
                 newBlockSize = blockSize;
             }
 
-            info = invokeAndGet(curId, new 
IgfsMetaFileCreateProcessor(newAccessTime, newModificationTime, newProps,
+            procMap.put(curId, new IgfsMetaFileCreateProcessor(newAccessTime, 
newModificationTime, newProps,
                 newBlockSize, affKey, createFileLockId(false), evictExclude, 
newLen));
         }
 
         createdPaths.add(pathIds.path());
 
+        // Execute cache operations.
+        Map<Object, EntryProcessorResult> invokeRes = 
((IgniteInternalCache)id2InfoPrj).invokeAll(procMap);
+
+        IgfsEntryInfo info = (IgfsEntryInfo)invokeRes.get(curId).get();
+
         return new IgfsPathsCreateResult(createdPaths, info, secondaryOut);
     }
 

Reply via email to