ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: IGNITE-3294: Calculate path IDs remotely.
Date Fri, 10 Jun 2016 13:07:54 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-3294 2a2f28bc9 -> c7553d14e


IGNITE-3294: Calculate path IDs remotely.


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

Branch: refs/heads/ignite-3294
Commit: c7553d14e8c08640d40a6120fcad73e950030dd6
Parents: 2a2f28b
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Fri Jun 10 16:07:45 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Fri Jun 10 16:07:45 2016 +0300

----------------------------------------------------------------------
 .../processors/igfs/IgfsMetaManager.java        | 55 +++++++++++---------
 1 file changed, 31 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c7553d14/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 fd9a507..8d7aed8 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
@@ -393,40 +393,47 @@ public class IgfsMetaManager extends IgfsManager {
      * @throws IgniteCheckedException If failed.
      */
     public IgfsPathIds pathIds(IgfsPath path) throws IgniteCheckedException {
-        if (busyLock.enterBusy()) {
-            try {
-                validTxState(false);
+        // Prepare parts.
+        String[] components = path.componentsArray();
 
-                // Prepare parts.
-                String[] components = path.componentsArray();
+        String[] parts = new String[components.length + 1];
 
-                String[] parts = new String[components.length + 1];
+        System.arraycopy(components, 0, parts, 1, components.length);
 
-                System.arraycopy(components, 0, parts, 1, components.length);
+        // Get IDs.
+        if (client) {
+            List<IgniteUuid> ids = runClientTask(new IgfsClientMetaIdsForPathCallable(cfg.getName(),
path));
 
-                // Prepare IDs.
-                IgniteUuid[] ids = new IgniteUuid[parts.length];
+            return new IgfsPathIds(path, parts, ids.toArray(new IgniteUuid[ids.size()]));
+        }
+        else {
+            if (busyLock.enterBusy()) {
+                try {
+                    validTxState(false);
 
-                ids[0] = IgfsUtils.ROOT_ID;
+                    IgniteUuid[] ids = new IgniteUuid[parts.length];
 
-                for (int i = 1; i < ids.length; i++) {
-                    IgniteUuid id = fileId(ids[i - 1], parts[i], false);
+                    ids[0] = IgfsUtils.ROOT_ID;
 
-                    if (id != null)
-                        ids[i] = id;
-                    else
-                        break;
-                }
+                    for (int i = 1; i < ids.length; i++) {
+                        IgniteUuid id = fileId(ids[i - 1], parts[i], false);
 
-                // Return.
-                return new IgfsPathIds(path, parts, ids);
-            }
-            finally {
-                busyLock.leaveBusy();
+                        if (id != null)
+                            ids[i] = id;
+                        else
+                            break;
+                    }
+
+                    // Return.
+                    return new IgfsPathIds(path, parts, ids);
+                }
+                finally {
+                    busyLock.leaveBusy();
+                }
             }
+            else
+                throw new IllegalStateException("Failed to get file IDS because Grid is stopping:
" + path);
         }
-        else
-            throw new IllegalStateException("Failed to get file IDS because Grid is stopping:
" + path);
     }
 
     /**


Mime
View raw message