ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [1/2] incubator-ignite git commit: # IGNITE-414: WIP.
Date Fri, 06 Mar 2015 14:54:32 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-414 [created] e71787234


# IGNITE-414: WIP.


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

Branch: refs/heads/ignite-414
Commit: c841b89db44b665a72fdb48394b5052c35b85715
Parents: 61828c1
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Thu Mar 5 16:05:25 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Thu Mar 5 16:05:25 2015 +0300

----------------------------------------------------------------------
 .../processors/igfs/IgfsDeleteWorker.java       |   3 +-
 .../igfs/IgfsFragmentizerManager.java           |   4 +-
 .../internal/processors/igfs/IgfsImpl.java      | 106 ++---
 .../processors/igfs/IgfsInputStreamImpl.java    |   2 +-
 .../igfs/IgfsInvalidRangeException.java         |   4 +-
 .../processors/igfs/IgfsMetaManager.java        | 432 ++++++++++---------
 .../processors/igfs/IgfsOutputStreamImpl.java   |   6 +-
 .../processors/igfs/IgfsAbstractSelfTest.java   |  25 +-
 .../ignite/testsuites/IgniteIgfsTestSuite.java  |   2 +
 9 files changed, 271 insertions(+), 313 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c841b89d/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 dbe63a5..c2dac04 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
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.igfs;
 import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.events.*;
+import org.apache.ignite.igfs.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.managers.eventstorage.*;
@@ -155,7 +156,7 @@ public class IgfsDeleteWorker extends IgfsThread {
         try {
             info = meta.info(TRASH_ID);
         }
-        catch (IgniteCheckedException e) {
+        catch (IgfsException e) {
             U.error(log, "Cannot obtain trash directory info.", e);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c841b89d/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
index 61949d7..9e37e29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
@@ -306,8 +306,8 @@ public class IgfsFragmentizerManager extends IgfsManager {
             }
             catch (IgfsInvalidRangeException e) {
                 if (log.isDebugEnabled())
-                    log.debug("Failed to update file range " +
-                        "[range=" + range + "fileId=" + fileId + ", err=" + e.getMessage() + ']');
+                    log.debug("Failed to update file range [range=" + range + "fileId=" + fileId +
+                        ", err=" + e.getMessage() + ']');
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c841b89d/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 614815f..d944b83 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
@@ -446,7 +446,7 @@ public final class IgfsImpl implements IgfsEx {
                 try {
                     return meta.sampling();
                 }
-                catch (IgniteCheckedException e) {
+                catch (IgfsException e) {
                     U.error(log, "Failed to get sampling state.", e);
 
                     return false;
@@ -472,43 +472,38 @@ public final class IgfsImpl implements IgfsEx {
 
     /** {@inheritDoc} */
     @Override public boolean exists(IgfsPath path) {
-        try {
-            A.notNull(path, "path");
-
-            if (log.isDebugEnabled())
-                log.debug("Check file exists: " + path);
+        A.notNull(path, "path");
 
-            IgfsMode mode = modeRslvr.resolveMode(path);
+        if (log.isDebugEnabled())
+            log.debug("Check file exists: " + path);
 
-            if (mode == PROXY)
-                throw new IgniteException("PROXY mode cannot be used in IGFS directly: " + path);
+        IgfsMode mode = modeRslvr.resolveMode(path);
 
-            boolean res = false;
+        if (mode == PROXY)
+            throw new IgniteException("PROXY mode cannot be used in IGFS directly: " + path);
 
-            switch (mode) {
-                case PRIMARY:
-                    res = meta.fileId(path) != null;
+        boolean res = false;
 
-                    break;
+        switch (mode) {
+            case PRIMARY:
+                res = meta.fileId(path) != null;
 
-                case DUAL_SYNC:
-                case DUAL_ASYNC:
-                    res = meta.fileId(path) != null;
+                break;
 
-                    if (!res)
-                        res = secondaryFs.exists(path);
+            case DUAL_SYNC:
+            case DUAL_ASYNC:
+                res = meta.fileId(path) != null;
 
-                    break;
+                if (!res)
+                    res = secondaryFs.exists(path);
 
-                default:
-                    assert false : "Unknown mode.";
-            }
+                break;
 
-            return res;
-        }
-        catch (IgniteCheckedException e) {
-            throw U.convertException(e);
+            default:
+                assert false : "Unknown mode.";
         }
+
+        return res;
     }
 
     /** {@inheritDoc} */
@@ -532,9 +527,6 @@ public final class IgfsImpl implements IgfsEx {
 
                 return new IgfsFileImpl(path, info, data.groupBlockSize());
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -622,9 +614,6 @@ public final class IgfsImpl implements IgfsEx {
                 else
                     return null;
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -734,9 +723,6 @@ public final class IgfsImpl implements IgfsEx {
                         evts.record(new IgfsEvent(src, dest, localNode(), EVT_IGFS_DIR_RENAMED));
                 }
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -791,9 +777,6 @@ public final class IgfsImpl implements IgfsEx {
 
                 return res;
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -811,10 +794,8 @@ public final class IgfsImpl implements IgfsEx {
      * @param recursive Recursive deletion flag.
      * @return {@code True} if file was successfully deleted. If directory is not empty and
      *      {@code recursive} flag is false, will return {@code false}.
-     * @throws IgniteCheckedException In case of error.
      */
-    private boolean delete0(FileDescriptor desc, @Nullable IgfsPath parentPath, boolean recursive)
-        throws IgniteCheckedException {
+    private boolean delete0(FileDescriptor desc, @Nullable IgfsPath parentPath, boolean recursive) {
         IgfsPath curPath = parentPath == null ? new IgfsPath() : new IgfsPath(parentPath, desc.fileName);
 
         if (desc.isFile) {
@@ -904,7 +885,7 @@ public final class IgfsImpl implements IgfsEx {
                             if (oldId == null && evts.isRecordable(EVT_IGFS_DIR_CREATED))
                                 evts.record(new IgfsEvent(curPath, localNode(), EVT_IGFS_DIR_CREATED));
                         }
-                        catch (IgniteCheckedException e) {
+                        catch (IgfsException e) {
                             if (log.isDebugEnabled())
                                 log.debug("Failed to create directory [path=" + path + ", parentId=" + parentId +
                                     ", fileName=" + fileName + ", step=" + step + ", e=" + e.getMessage() + ']');
@@ -913,7 +894,7 @@ public final class IgfsImpl implements IgfsEx {
                             IgfsFileInfo stored = meta.info(meta.fileId(parentId, fileName));
 
                             if (stored == null)
-                                throw new IgfsException(e);
+                                throw e;
 
                             if (!stored.isDirectory())
                                 throw new IgfsParentNotDirectoryException("Failed to create directory (parent " +
@@ -928,9 +909,6 @@ public final class IgfsImpl implements IgfsEx {
                     parentId = fileId;
                 }
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -983,9 +961,6 @@ public final class IgfsImpl implements IgfsEx {
                     }
                 });
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -1053,9 +1028,6 @@ public final class IgfsImpl implements IgfsEx {
 
                 return files;
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -1131,9 +1103,6 @@ public final class IgfsImpl implements IgfsEx {
 
                 return os;
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -1305,7 +1274,7 @@ public final class IgfsImpl implements IgfsEx {
 
                 IgfsMode mode = modeRslvr.resolveMode(path);
 
-                IgfsFileWorkerBatch batch = null;
+                IgfsFileWorkerBatch batch;
 
                 if (mode == PROXY)
                     throw new IgniteException("PROXY mode cannot be used in IGFS directly: " + path);
@@ -1361,7 +1330,7 @@ public final class IgfsImpl implements IgfsEx {
                     evts.record(new IgfsEvent(path, localNode(), EVT_IGFS_FILE_OPENED_WRITE));
 
                 return new IgfsEventAwareOutputStream(path, info, parentId, bufSize == 0 ?
-                    cfg.getStreamBufferSize() : bufSize, mode, batch);
+                    cfg.getStreamBufferSize() : bufSize, mode, null);
             }
             catch (IgniteCheckedException e) {
                 throw U.convertException(e);
@@ -1397,9 +1366,6 @@ public final class IgfsImpl implements IgfsEx {
 
                 meta.updateTimes(desc.parentId, desc.fileId, desc.fileName, accessTime, modificationTime);
             }
-            catch (IgniteCheckedException e) {
-                throw U.convertException(e);
-            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -1412,12 +1378,11 @@ public final class IgfsImpl implements IgfsEx {
      * Checks if given path exists in secondary file system and throws exception if so.
      *
      * @param path Path to check.
-     * @throws IgniteCheckedException If path exists.
      */
-    private void checkConflictWithPrimary(IgfsPath path) throws IgniteCheckedException {
+    private void checkConflictWithPrimary(IgfsPath path) {
         if (secondaryFs != null) {
             if (secondaryFs.info(path) != null) {
-                throw new IgniteCheckedException("Path mapped to a PRIMARY mode found in secondary file " +
+                throw new IgfsException("Path mapped to a PRIMARY mode found in secondary file " +
                      "system. Remove path from secondary file system or change path mapping: " + path);
             }
         }
@@ -1625,7 +1590,7 @@ public final class IgfsImpl implements IgfsEx {
                 }
             }
         }
-        catch (IgniteCheckedException e) {
+        catch (IgfsException e) {
             return new GridFinishedFuture<Object>(igfsCtx.kernalContext(), e);
         }
     }
@@ -1671,9 +1636,8 @@ public final class IgfsImpl implements IgfsEx {
      *
      * @param path Path to file.
      * @return Detailed file descriptor or {@code null}, if file does not exist.
-     * @throws IgniteCheckedException If failed.
      */
-    @Nullable private FileDescriptor getFileDescriptor(IgfsPath path) throws IgniteCheckedException {
+    @Nullable private FileDescriptor getFileDescriptor(IgfsPath path) {
         List<IgniteUuid> ids = meta.fileIds(path);
         IgfsFileInfo fileInfo = meta.info(ids.get(ids.size() - 1));
 
@@ -1692,9 +1656,8 @@ public final class IgfsImpl implements IgfsEx {
      * @param path Path of the deleted file.
      * @param desc Detailed file descriptor to remove.
      * @param rmvLocked Whether to remove this entry in case it is has explicit lock.
-     * @throws IgniteCheckedException If failed.
      */
-    private void deleteFile(IgfsPath path, FileDescriptor desc, boolean rmvLocked) throws IgniteCheckedException {
+    private void deleteFile(IgfsPath path, FileDescriptor desc, boolean rmvLocked) {
         IgniteUuid parentId = desc.parentId;
         IgniteUuid fileId = desc.fileId;
 
@@ -1863,9 +1826,8 @@ public final class IgfsImpl implements IgfsEx {
      * @param path Path.
      * @param mode Mode.
      * @return File info or {@code null} in case file is not found.
-     * @throws IgniteCheckedException If failed.
      */
-    private IgfsFileInfo resolveFileInfo(IgfsPath path, IgfsMode mode) throws IgniteCheckedException {
+    private IgfsFileInfo resolveFileInfo(IgfsPath path, IgfsMode mode) {
         assert path != null;
         assert mode != null;
 
@@ -2189,7 +2151,7 @@ public final class IgfsImpl implements IgfsEx {
                                 rmv.add(id);
                             }
                         }
-                        catch (IgniteCheckedException e) {
+                        catch (IgfsException e) {
                             U.error(log, "Failed to check file existence: " + id, e);
                         }
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c841b89d/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 5afa523..70bd827 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
@@ -311,7 +311,7 @@ public class IgfsInputStreamImpl extends IgfsInputStreamAdapter {
                     data.delete(fileInfo);
             }
         }
-        catch (IgniteCheckedException e) {
+        catch (IgfsException e) {
             throw new IOError(e); // Something unrecoverable.
         }
         finally {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c841b89d/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInvalidRangeException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInvalidRangeException.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInvalidRangeException.java
index 8126487..5d77243 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInvalidRangeException.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInvalidRangeException.java
@@ -17,13 +17,13 @@
 
 package org.apache.ignite.internal.processors.igfs;
 
-import org.apache.ignite.*;
+import org.apache.ignite.igfs.*;
 
 /**
  * Internal exception thrown when attempted to update range that is no longer present
  * in file affinity map.
  */
-public class IgfsInvalidRangeException extends IgniteCheckedException {
+public class IgfsInvalidRangeException extends IgfsException {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c841b89d/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 adc0254..4416307 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
@@ -170,9 +170,8 @@ public class IgfsMetaManager extends IgfsManager {
      *
      * @param path Path.
      * @return File ID for specified path or {@code null} if such file doesn't exist.
-     * @throws IgniteCheckedException If failed.
      */
-    @Nullable public IgniteUuid fileId(IgfsPath path) throws IgniteCheckedException {
+    @Nullable public IgniteUuid fileId(IgfsPath path) {
         if (busyLock.enterBusy()) {
             try {
                 assert validTxState(false);
@@ -193,9 +192,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param path Path.
      * @param skipTx Whether to skip existing transaction.
      * @return File ID for specified path or {@code null} if such file doesn't exist.
-     * @throws IgniteCheckedException If failed.
      */
-    @Nullable private IgniteUuid fileId(IgfsPath path, boolean skipTx) throws IgniteCheckedException {
+    @Nullable private IgniteUuid fileId(IgfsPath path, boolean skipTx) {
         List<IgniteUuid> ids = fileIds(path, skipTx);
 
         assert ids != null && !ids.isEmpty() : "Invalid file IDs [path=" + path + ", ids=" + ids + ']';
@@ -209,9 +207,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param parentId Parent directory ID to get child ID for.
      * @param fileName File name in parent listing to get file ID for.
      * @return File ID.
-     * @throws IgniteCheckedException If failed.
      */
-    @Nullable public IgniteUuid fileId(IgniteUuid parentId, String fileName) throws IgniteCheckedException {
+    @Nullable public IgniteUuid fileId(IgniteUuid parentId, String fileName) {
         if (busyLock.enterBusy()) {
             try {
                 return fileId(parentId, fileName, false);
@@ -232,9 +229,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param fileName File name in parent listing to get file ID for.
      * @param skipTx Whether to skip existing transaction.
      * @return File ID.
-     * @throws IgniteCheckedException If failed.
      */
-    @Nullable private IgniteUuid fileId(IgniteUuid parentId, String fileName, boolean skipTx) throws IgniteCheckedException {
+    @Nullable private IgniteUuid fileId(IgniteUuid parentId, String fileName, boolean skipTx) {
         IgfsListingEntry entry = directoryListing(parentId, skipTx).get(fileName);
 
         if (entry == null) {
@@ -253,9 +249,8 @@ public class IgfsMetaManager extends IgfsManager {
      *
      * @param path Path.
      * @return Collection of file IDs for components of specified path.
-     * @throws IgniteCheckedException If failed.
      */
-    public List<IgniteUuid> fileIds(IgfsPath path) throws IgniteCheckedException {
+    public List<IgniteUuid> fileIds(IgfsPath path) {
         if (busyLock.enterBusy()) {
             try {
                 assert validTxState(false);
@@ -278,9 +273,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param path Path.
      * @param skipTx Whether to skip existing transaction.
      * @return Collection of file IDs for components of specified path.
-     * @throws IgniteCheckedException If failed.
      */
-    private List<IgniteUuid> fileIds(IgfsPath path, boolean skipTx) throws IgniteCheckedException {
+    private List<IgniteUuid> fileIds(IgfsPath path, boolean skipTx) {
         assert path != null;
 
         // Path components.
@@ -310,9 +304,8 @@ public class IgfsMetaManager extends IgfsManager {
      *
      * @param fileId File id.
      * @return {@code True} in case such entry exists.
-     * @throws IgniteCheckedException IF failed.
      */
-    public boolean exists(IgniteUuid fileId) throws IgniteCheckedException{
+    public boolean exists(IgniteUuid fileId) {
         if (busyLock.enterBusy()) {
             try {
                 assert fileId != null;
@@ -334,21 +327,25 @@ public class IgfsMetaManager extends IgfsManager {
      *
      * @param fileId File ID to get details for.
      * @return File info.
-     * @throws IgniteCheckedException If failed.
      */
-    @Nullable public IgfsFileInfo info(@Nullable IgniteUuid fileId) throws IgniteCheckedException {
+    @Nullable public IgfsFileInfo info(@Nullable IgniteUuid fileId) {
         if (busyLock.enterBusy()) {
             try {
                 if (fileId == null)
                     return null;
 
-                IgfsFileInfo info = id2InfoPrj.get(fileId);
+                try {
+                    IgfsFileInfo info = id2InfoPrj.get(fileId);
 
-                // Force root ID always exist in cache.
-                if (info == null && ROOT_ID.equals(fileId))
-                    id2InfoPrj.putxIfAbsent(ROOT_ID, info = new IgfsFileInfo());
+                    // Force root ID always exist in cache.
+                    if (info == null && ROOT_ID.equals(fileId))
+                        id2InfoPrj.putxIfAbsent(ROOT_ID, info = new IgfsFileInfo());
 
-                return info;
+                    return info;
+                }
+                catch (IgniteException | IgniteCheckedException e) {
+                    throw new IgfsException("Failed to obtain info for file ID: " + fileId, e);
+                }
             }
             finally {
                 busyLock.leaveBusy();
@@ -363,9 +360,8 @@ public class IgfsMetaManager extends IgfsManager {
      *
      * @param fileIds file IDs to get details for.
      * @return Files details.
-     * @throws IgniteCheckedException If failed.
      */
-    public Map<IgniteUuid, IgfsFileInfo> infos(Collection<IgniteUuid> fileIds) throws IgniteCheckedException {
+    public Map<IgniteUuid, IgfsFileInfo> infos(Collection<IgniteUuid> fileIds) {
         if (busyLock.enterBusy()) {
             try {
                 assert validTxState(false);
@@ -374,20 +370,26 @@ public class IgfsMetaManager extends IgfsManager {
                 if (F.isEmpty(fileIds))
                     return Collections.emptyMap();
 
-                Map<IgniteUuid, IgfsFileInfo> map = id2InfoPrj.getAll(fileIds);
+                try {
 
-                // Force root ID always exist in cache.
-                if (fileIds.contains(ROOT_ID) && !map.containsKey(ROOT_ID)) {
-                    IgfsFileInfo info = new IgfsFileInfo();
+                    Map<IgniteUuid, IgfsFileInfo> map = id2InfoPrj.getAll(fileIds);
 
-                    id2InfoPrj.putxIfAbsent(ROOT_ID, info);
+                    // Force root ID always exist in cache.
+                    if (fileIds.contains(ROOT_ID) && !map.containsKey(ROOT_ID)) {
+                        IgfsFileInfo info = new IgfsFileInfo();
 
-                    map = new GridLeanMap<>(map);
+                        id2InfoPrj.putxIfAbsent(ROOT_ID, info);
 
-                    map.put(ROOT_ID, info);
-                }
+                        map = new GridLeanMap<>(map);
+
+                        map.put(ROOT_ID, info);
+                    }
 
-                return map;
+                    return map;
+                }
+                catch (IgniteException | IgniteCheckedException e) {
+                    throw new IgfsException("Failed to get info for file IDs: " + fileIds, e);
+                }
             }
             finally {
                 busyLock.leaveBusy();
@@ -402,9 +404,8 @@ public class IgfsMetaManager extends IgfsManager {
      *
      * @param fileId File ID to lock.
      * @return Locked file info or {@code null} if file cannot be locked or doesn't exist.
-     * @throws IgniteCheckedException If failed.
      */
-    public IgfsFileInfo lock(IgniteUuid fileId) throws IgniteCheckedException {
+    public IgfsFileInfo lock(IgniteUuid fileId) {
         if (busyLock.enterBusy()) {
             try {
                 assert validTxState(false);
@@ -417,7 +418,7 @@ public class IgfsMetaManager extends IgfsManager {
                     IgfsFileInfo oldInfo = info(fileId);
 
                     if (oldInfo == null)
-                        throw new IgniteCheckedException("Failed to lock file (file not found): " + fileId);
+                        throw new IgfsFileNotFoundException("Failed to lock file (file not found): " + fileId);
 
                     IgfsFileInfo newInfo = lockInfo(oldInfo);
 
@@ -436,6 +437,9 @@ public class IgfsMetaManager extends IgfsManager {
                     tx.close();
                 }
             }
+            catch (IgniteException | IgniteCheckedException e) {
+                throw new IgfsException("Failed to lock file: " + fileId, e);
+            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -449,16 +453,14 @@ public class IgfsMetaManager extends IgfsManager {
      *
      * @param info File info.
      * @return New file info with lock set.
-     * @throws IgniteCheckedException In case lock is already set on that file.
      */
-    public IgfsFileInfo lockInfo(IgfsFileInfo info) throws IgniteCheckedException {
+    public IgfsFileInfo lockInfo(IgfsFileInfo info) {
         if (busyLock.enterBusy()) {
             try {
                 assert info != null;
 
                 if (info.lockId() != null)
-                    throw new IgniteCheckedException("Failed to lock file (file is being concurrently written) [fileId=" +
-                        info.id() + ", lockId=" + info.lockId() + ']');
+                    throw new IgfsConcurrentModificationException(info.path());
 
                 return new IgfsFileInfo(info, IgniteUuid.randomUuid(), info.modificationTime());
             }
@@ -475,9 +477,8 @@ public class IgfsMetaManager extends IgfsManager {
      *
      * @param info File info to unlock.
      * @param modificationTime Modification time to write to file info.
-     * @throws IgniteCheckedException If failed.
      */
-    public void unlock(IgfsFileInfo info, long modificationTime) throws IgniteCheckedException {
+    public void unlock(IgfsFileInfo info, long modificationTime) {
         assert validTxState(false);
         assert info != null;
 
@@ -500,10 +501,10 @@ public class IgfsMetaManager extends IgfsManager {
                     IgfsFileInfo oldInfo = info(fileId);
 
                     if (oldInfo == null)
-                        throw fsException(new IgfsFileNotFoundException("Failed to unlock file (file not found): " + fileId));
+                        throw new IgfsFileNotFoundException("Failed to unlock file (file not found): " + fileId);
 
                     if (!info.lockId().equals(oldInfo.lockId()))
-                        throw new IgniteCheckedException("Failed to unlock file (inconsistent file lock ID) [fileId=" + fileId +
+                        throw new IgfsException("Failed to unlock file (inconsistent file lock ID) [fileId=" + fileId +
                             ", lockId=" + info.lockId() + ", actualLockId=" + oldInfo.lockId() + ']');
 
                     IgfsFileInfo newInfo = new IgfsFileInfo(oldInfo, null, modificationTime);
@@ -526,6 +527,9 @@ public class IgfsMetaManager extends IgfsManager {
                         Thread.currentThread().interrupt();
                 }
             }
+            catch (IgniteException | IgniteCheckedException e) {
+                throw new IgfsException("Failed to unlock the file: " + info.id());
+            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -580,9 +584,8 @@ public class IgfsMetaManager extends IgfsManager {
      *
      * @param fileId File to list child files for.
      * @return Directory listing for the specified file.
-     * @throws IgniteCheckedException If failed.
      */
-    public Map<String, IgfsListingEntry> directoryListing(IgniteUuid fileId) throws IgniteCheckedException {
+    public Map<String, IgfsListingEntry> directoryListing(IgniteUuid fileId) {
         if (busyLock.enterBusy()) {
             try {
                 return directoryListing(fileId, false);
@@ -663,15 +666,19 @@ public class IgfsMetaManager extends IgfsManager {
      * @param fileId File to list child files for.
      * @param skipTx Whether to skip existing transaction.
      * @return Directory listing for the specified file.*
-     * @throws IgniteCheckedException If failed.
      */
-    private Map<String, IgfsListingEntry> directoryListing(IgniteUuid fileId, boolean skipTx) throws IgniteCheckedException {
+    private Map<String, IgfsListingEntry> directoryListing(IgniteUuid fileId, boolean skipTx) {
         assert fileId != null;
 
-        IgfsFileInfo info = skipTx ? id2InfoPrj.getAllOutTx(Collections.singletonList(fileId)).get(fileId) :
-            id2InfoPrj.get(fileId);
+        try {
+            IgfsFileInfo info = skipTx ? id2InfoPrj.getAllOutTx(Collections.singletonList(fileId)).get(fileId) :
+                id2InfoPrj.get(fileId);
 
-        return info == null ? Collections.<String, IgfsListingEntry>emptyMap() : info.listing();
+            return info == null ? Collections.<String, IgfsListingEntry>emptyMap() : info.listing();
+        }
+        catch (IgniteException | IgniteCheckedException e) {
+            throw new IgfsException("Failed to list directory: " + fileId, e);
+        }
     }
 
     /**
@@ -681,10 +688,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param fileName File name in the parent's listing.
      * @param newFileInfo File info to store in the parent's listing.
      * @return File id already stored in meta cache or {@code null} if passed file info was stored.
-     * @throws IgniteCheckedException If failed.
      */
-    public IgniteUuid putIfAbsent(IgniteUuid parentId, String fileName, IgfsFileInfo newFileInfo)
-        throws IgniteCheckedException {
+    public IgniteUuid putIfAbsent(IgniteUuid parentId, String fileName, IgfsFileInfo newFileInfo) {
         if (busyLock.enterBusy()) {
             try {
                 assert validTxState(false);
@@ -707,6 +712,10 @@ public class IgfsMetaManager extends IgfsManager {
 
                 return res;
             }
+            catch (IgniteException | IgniteCheckedException e) {
+                throw new IgfsException("Failed to perform put-if-absent operation [parentId=" + parentId +
+                    ", fileName=" + fileName + ", newFile=" + newFileInfo + ']', e);
+            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -723,10 +732,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param fileName File name in the parent's listing.
      * @param newFileInfo File info to store in the parent's listing.
      * @return File id already stored in meta cache or {@code null} if passed file info was stored.
-     * @throws IgniteCheckedException If failed.
      */
-    private IgniteUuid putIfAbsentNonTx(IgniteUuid parentId, String fileName, IgfsFileInfo newFileInfo)
-        throws IgniteCheckedException {
+    private IgniteUuid putIfAbsentNonTx(IgniteUuid parentId, String fileName, IgfsFileInfo newFileInfo) {
         if (log.isDebugEnabled())
             log.debug("Locking parent id [parentId=" + parentId + ", fileName=" + fileName + ", newFileInfo=" +
                 newFileInfo + ']');
@@ -739,10 +746,10 @@ public class IgfsMetaManager extends IgfsManager {
         assert validTxState(true);
 
         if (parentInfo == null)
-            throw fsException(new IgfsFileNotFoundException("Failed to lock parent directory (not found): " + parentId));
+            throw new IgfsFileNotFoundException("Failed to lock parent directory (not found): " + parentId);
 
         if (!parentInfo.isDirectory())
-            throw fsException(new IgfsInvalidPathException("Parent file is not a directory: " + parentInfo));
+            throw new IgfsInvalidPathException("Parent file is not a directory: " + parentInfo);
 
         Map<String, IgfsListingEntry> parentListing = parentInfo.listing();
 
@@ -757,14 +764,20 @@ public class IgfsMetaManager extends IgfsManager {
 
         IgniteUuid fileId = newFileInfo.id();
 
-        if (!id2InfoPrj.putxIfAbsent(fileId, newFileInfo))
-            throw fsException("Failed to add file details into cache: " + newFileInfo);
+        try {
+            if (!id2InfoPrj.putxIfAbsent(fileId, newFileInfo))
+                throw fsException("Failed to add file details into cache: " + newFileInfo);
 
-        assert metaCache.get(parentId) != null;
+            assert metaCache.get(parentId) != null;
 
-        id2InfoPrj.invoke(parentId, new UpdateListing(fileName, new IgfsListingEntry(newFileInfo), false));
+            id2InfoPrj.invoke(parentId, new UpdateListing(fileName, new IgfsListingEntry(newFileInfo), false));
 
-        return null;
+            return null;
+        }
+        catch (IgniteException | IgniteCheckedException e) {
+            throw new IgfsException("Failed to perform put-if-absent operation [parentId=" + parentId +
+                ", fileName=" + fileName + ", newFile=" + newFileInfo + ']', e);
+        }
     }
 
     /**
@@ -775,10 +788,9 @@ public class IgfsMetaManager extends IgfsManager {
      * @param srcParentId Parent directory ID.
      * @param destFileName New file name in the parent's listing after moving.
      * @param destParentId New parent directory ID.
-     * @throws IgniteCheckedException If failed.
      */
     public void move(IgniteUuid fileId, String srcFileName, IgniteUuid srcParentId, String destFileName,
-        IgniteUuid destParentId) throws IgniteCheckedException {
+        IgniteUuid destParentId) {
         if (busyLock.enterBusy()) {
             try {
                 assert validTxState(false);
@@ -794,6 +806,11 @@ public class IgfsMetaManager extends IgfsManager {
                     tx.close();
                 }
             }
+            catch (IgniteException | IgniteCheckedException e) {
+                throw new IgfsException("Failed to perform file move [fileId=" + fileId +
+                    ", srcFileName=" + srcFileName + ", srcParentId=" + srcParentId +
+                    ", destFileName=" + destFileName + ", destParentId=" + destParentId + ']', e);
+            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -839,41 +856,40 @@ public class IgfsMetaManager extends IgfsManager {
         IgfsFileInfo srcInfo = infoMap.get(srcParentId);
 
         if (srcInfo == null)
-            throw fsException(new IgfsFileNotFoundException("Failed to lock source directory (not found?)" +
-                " [srcParentId=" + srcParentId + ']'));
+            throw new IgfsFileNotFoundException("Failed to lock source directory (not found?)" +
+                " [srcParentId=" + srcParentId + ']');
 
         if (!srcInfo.isDirectory())
-            throw fsException(new IgfsInvalidPathException("Source is not a directory: " + srcInfo));
+            throw new IgfsInvalidPathException("Source is not a directory: " + srcInfo);
 
         IgfsFileInfo destInfo = infoMap.get(destParentId);
 
         if (destInfo == null)
-            throw fsException(new IgfsFileNotFoundException("Failed to lock destination directory (not found?)" +
-                " [destParentId=" + destParentId + ']'));
+            throw new IgfsFileNotFoundException("Failed to lock destination directory (not found?)" +
+                " [destParentId=" + destParentId + ']');
 
         if (!destInfo.isDirectory())
-            throw fsException(new IgfsInvalidPathException("Destination is not a directory: " + destInfo));
+            throw new IgfsInvalidPathException("Destination is not a directory: " + destInfo);
 
         IgfsFileInfo fileInfo = infoMap.get(fileId);
 
         if (fileInfo == null)
-            throw fsException(new IgfsFileNotFoundException("Failed to lock target file (not found?) [fileId=" +
-                fileId + ']'));
+            throw new IgfsFileNotFoundException("Failed to lock target file (not found?) [fileId=" + fileId + ']');
 
         IgfsListingEntry srcEntry = srcInfo.listing().get(srcFileName);
         IgfsListingEntry destEntry = destInfo.listing().get(destFileName);
 
         // If source file does not exist or was re-created.
         if (srcEntry == null || !srcEntry.fileId().equals(fileId))
-            throw fsException(new IgfsFileNotFoundException("Failed to remove file name from the source directory" +
+            throw new IgfsFileNotFoundException("Failed to remove file name from the source directory" +
                 " (file not found) [fileId=" + fileId + ", srcFileName=" + srcFileName +
-                ", srcParentId=" + srcParentId + ", srcEntry=" + srcEntry + ']'));
+                ", srcParentId=" + srcParentId + ", srcEntry=" + srcEntry + ']');
 
         // If stored file already exist.
         if (destEntry != null)
-            throw fsException(new IgfsInvalidPathException("Failed to add file name into the destination directory " +
+            throw new IgfsInvalidPathException("Failed to add file name into the destination directory " +
                 "(file already exists) [fileId=" + fileId + ", destFileName=" + destFileName +
-                ", destParentId=" + destParentId + ", destEntry=" + destEntry + ']'));
+                ", destParentId=" + destParentId + ", destEntry=" + destEntry + ']');
 
         assert metaCache.get(srcParentId) != null;
         assert metaCache.get(destParentId) != null;
@@ -894,11 +910,9 @@ public class IgfsMetaManager extends IgfsManager {
      * @param path Path of the deleted file.
      * @param rmvLocked Whether to remove this entry in case it is has explicit lock.
      * @return The last actual file info or {@code null} if such file no more exist.
-     * @throws IgniteCheckedException If failed.
      */
     @Nullable public IgfsFileInfo removeIfEmpty(IgniteUuid parentId, String fileName, IgniteUuid fileId,
-        IgfsPath path, boolean rmvLocked)
-        throws IgniteCheckedException {
+        IgfsPath path, boolean rmvLocked) {
         if (busyLock.enterBusy()) {
             try {
                 assert validTxState(false);
@@ -923,6 +937,10 @@ public class IgfsMetaManager extends IgfsManager {
                     tx.close();
                 }
             }
+            catch (IgniteException | IgniteCheckedException e) {
+                throw new IgfsException("Failed to remove file [parentId=" + parentId + ", fileName=" + fileName +
+                    ", fileId=" + fileId + ", path=" + path);
+            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -965,7 +983,7 @@ public class IgfsMetaManager extends IgfsManager {
 
                 // If file info does not exists but listing entry exists, throw inconsistent exception.
                 if (entry != null && entry.fileId().equals(fileId))
-                    throw new IgniteCheckedException("Failed to remove file (file system is in inconsistent state) " +
+                    throw new IgfsException("Failed to remove file (file system is in inconsistent state) " +
                         "[fileInfo=" + fileInfo + ", fileName=" + fileName + ", fileId=" + fileId + ']');
             }
 
@@ -983,8 +1001,8 @@ public class IgfsMetaManager extends IgfsManager {
             Map<String, IgfsListingEntry> listing = fileInfo.listing();
 
             if (!F.isEmpty(listing))
-                throw fsException(new IgfsDirectoryNotEmptyException("Failed to remove file (directory is not empty)" +
-                    " [fileId=" + fileId + ", listing=" + listing + ']'));
+                throw new IgfsDirectoryNotEmptyException("Failed to remove file (directory is not empty)" +
+                    " [fileId=" + fileId + ", listing=" + listing + ']');
         }
 
         // Validate file in the parent listing.
@@ -1010,9 +1028,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param pathName Path name.
      * @param pathId Path ID.
      * @return ID of an entry located directly under the trash directory.
-     * @throws IgniteCheckedException If failed.
      */
-    IgniteUuid softDelete(@Nullable IgniteUuid parentId, @Nullable String pathName, IgniteUuid pathId) throws IgniteCheckedException {
+    IgniteUuid softDelete(@Nullable IgniteUuid parentId, @Nullable String pathName, IgniteUuid pathId) {
         if (busyLock.enterBusy()) {
             try {
                 assert validTxState(false);
@@ -1037,6 +1054,10 @@ public class IgfsMetaManager extends IgfsManager {
                     tx.close();
                 }
             }
+            catch (IgniteException | IgniteCheckedException e) {
+                throw new IgfsException("Failed to perform safe delete [parentId=" + parentId +
+                    ", pathName=" + pathName + ", pathId=" + pathId + ']');
+            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -1388,10 +1409,9 @@ public class IgfsMetaManager extends IgfsManager {
      * @param fileId File ID to update information for.
      * @param props Properties to set for the file.
      * @return Updated file info or {@code null} if such file ID not found.
-     * @throws IgniteCheckedException If operation failed.
      */
     @Nullable public IgfsFileInfo updateProperties(@Nullable IgniteUuid parentId, IgniteUuid fileId, String fileName,
-        Map<String, String> props) throws IgniteCheckedException {
+        Map<String, String> props) {
         if (busyLock.enterBusy()) {
             try {
                 assert validTxState(false);
@@ -1409,6 +1429,10 @@ public class IgfsMetaManager extends IgfsManager {
                     tx.close();
                 }
             }
+            catch (IgniteException | IgniteCheckedException e) {
+                throw new IgfsException("Failed to update properties [parentId=" + parentId + ", fileId=" + fileId +
+                    ", fileName=" + fileName + ", props=" + props + ']');
+            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -1453,10 +1477,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param fileId File ID to update information for.
      * @param c Closure to update file's info inside transaction.
      * @return Updated file info or {@code null} if such file ID not found.
-     * @throws IgniteCheckedException If failed.
      */
-    @Nullable public IgfsFileInfo updateInfo(IgniteUuid fileId, IgniteClosure<IgfsFileInfo, IgfsFileInfo> c)
-        throws IgniteCheckedException {
+    @Nullable public IgfsFileInfo updateInfo(IgniteUuid fileId, IgniteClosure<IgfsFileInfo, IgfsFileInfo> c) {
         assert validTxState(false);
         assert fileId != null;
         assert c != null;
@@ -1508,6 +1530,9 @@ public class IgfsMetaManager extends IgfsManager {
                         tx.close();
                 }
             }
+            catch (IgniteException | IgniteCheckedException e) {
+                throw new IgfsException("Failed to update file info: " + fileId, e);
+            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -1522,9 +1547,8 @@ public class IgfsMetaManager extends IgfsManager {
      *
      * @param val Sampling flag state or {@code null} to clear sampling state and mark it as "not set".
      * @return {@code True} if sampling mode was actually changed by this call.
-     * @throws IgniteCheckedException If failed.
      */
-    public boolean sampling(Boolean val) throws IgniteCheckedException {
+    public boolean sampling(Boolean val) {
         if (busyLock.enterBusy()) {
             try {
                 validTxState(false);
@@ -1542,6 +1566,9 @@ public class IgfsMetaManager extends IgfsManager {
                     tx.close();
                 }
             }
+            catch (IgniteException | IgniteCheckedException e) {
+                throw new IgfsException("Failed to set sampling flag." , e);
+            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -1555,9 +1582,8 @@ public class IgfsMetaManager extends IgfsManager {
      *
      * @return {@code True} in case sampling is enabled, {@code false} otherwise or {@code null} in case sampling
      * is not set.
-     * @throws IgniteCheckedException If failed.
      */
-    public Boolean sampling() throws IgniteCheckedException {
+    public Boolean sampling() {
         if (busyLock.enterBusy()) {
             try {
                 validTxState(false);
@@ -1566,6 +1592,9 @@ public class IgfsMetaManager extends IgfsManager {
 
                 return (val == null || !(val instanceof Boolean)) ? null : (Boolean)val;
             }
+            catch (IgniteException | IgniteCheckedException e) {
+                throw new IgfsException("Failed to get sampling flag." , e);
+            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -1587,7 +1616,6 @@ public class IgfsMetaManager extends IgfsManager {
      * @param blockSize Block size.
      * @param affKey Affinity key.
      * @return Output stream descriptor.
-     * @throws IgniteCheckedException If file creation failed.
      */
     public IgfsSecondaryOutputStreamDescriptor createDual(final IgfsSecondaryFileSystem fs,
         final IgfsPath path,
@@ -1597,9 +1625,7 @@ public class IgfsMetaManager extends IgfsManager {
         final int bufSize,
         final short replication,
         final long blockSize,
-        final IgniteUuid affKey)
-        throws IgniteCheckedException
-    {
+        final IgniteUuid affKey) {
         if (busyLock.enterBusy()) {
             try {
                 assert fs != null;
@@ -1715,15 +1741,17 @@ public class IgfsMetaManager extends IgfsManager {
                             return new IgfsSecondaryOutputStreamDescriptor(parentInfo.id(), newInfo, out);
                         }
 
-                        @Override public IgfsSecondaryOutputStreamDescriptor onFailure(Exception err)
-                            throws IgniteCheckedException {
+                        @Override public IgfsSecondaryOutputStreamDescriptor onFailure(Exception err) {
                             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 " +
+                            if (err instanceof IgfsException)
+                                throw (IgfsException)err;
+
+                            throw new IgfsException("Failed to create the file due to secondary file system " +
                                 "exception: " + path, err);
                         }
                     };
@@ -1751,10 +1779,9 @@ public class IgfsMetaManager extends IgfsManager {
      * @param path Path.
      * @param bufSize Buffer size.
      * @return Output stream descriptor.
-     * @throws IgniteCheckedException If output stream open for append has failed.
      */
     public IgfsSecondaryOutputStreamDescriptor appendDual(final IgfsSecondaryFileSystem fs, final IgfsPath path,
-        final int bufSize) throws IgniteCheckedException {
+        final int bufSize) {
         if (busyLock.enterBusy()) {
             try {
                 assert fs != null;
@@ -1802,14 +1829,16 @@ public class IgfsMetaManager extends IgfsManager {
                             return new IgfsSecondaryOutputStreamDescriptor(infos.get(path.parent()).id(), info, out);
                         }
 
-                        @Override public IgfsSecondaryOutputStreamDescriptor onFailure(@Nullable Exception err)
-                            throws IgniteCheckedException {
+                        @Override public IgfsSecondaryOutputStreamDescriptor onFailure(@Nullable Exception err) {
                             U.closeQuiet(out);
 
                             U.error(log, "File append in DUAL mode failed [path=" + path + ", bufferSize=" + bufSize +
                                 ']', err);
 
-                            throw new IgniteCheckedException("Failed to append to the file due to secondary file system " +
+                            if (err instanceof IgfsException)
+                                throw (IgfsException)err;
+
+                            throw new IgfsException("Failed to append to the file due to secondary file system " +
                                 "exception: " + path, err);
                         }
                     };
@@ -1831,11 +1860,9 @@ public class IgfsMetaManager extends IgfsManager {
      * @param path Path to open.
      * @param bufSize Buffer size.
      * @return Input stream descriptor.
-     * @throws IgniteCheckedException If input stream open has failed.
      */
     public IgfsSecondaryInputStreamDescriptor openDual(final IgfsSecondaryFileSystem fs, final IgfsPath path,
-        final int bufSize)
-        throws IgniteCheckedException {
+        final int bufSize) {
         if (busyLock.enterBusy()) {
             try {
                 assert fs != null;
@@ -1846,7 +1873,7 @@ public class IgfsMetaManager extends IgfsManager {
 
                 if (info != null) {
                     if (!info.isFile())
-                        throw fsException(new IgfsInvalidPathException("Failed to open file (not a file): " + path));
+                        throw new IgfsInvalidPathException("Failed to open file (not a file): " + path);
 
                     return new IgfsSecondaryInputStreamDescriptor(info, fs.open(path, bufSize));
                 }
@@ -1859,19 +1886,21 @@ public class IgfsMetaManager extends IgfsManager {
                             IgfsFileInfo info = infos.get(path);
 
                             if (info == null)
-                                throw fsException(new IgfsFileNotFoundException("File not found: " + path));
+                                throw new IgfsFileNotFoundException("File not found: " + path);
                             if (!info.isFile())
-                                throw fsException(new IgfsInvalidPathException("Failed to open file (not a file): " + path));
+                                throw new IgfsInvalidPathException("Failed to open file (not a file): " + path);
 
                             return new IgfsSecondaryInputStreamDescriptor(infos.get(path), fs.open(path, bufSize));
                         }
 
-                        @Override public IgfsSecondaryInputStreamDescriptor onFailure(@Nullable Exception err)
-                            throws IgniteCheckedException {
+                        @Override public IgfsSecondaryInputStreamDescriptor onFailure(@Nullable Exception err) {
                             U.error(log, "File open in DUAL mode failed [path=" + path + ", bufferSize=" + bufSize +
                                 ']', err);
 
-                            throw new IgniteCheckedException("Failed to open the path due to secondary file system " +
+                            if (err instanceof IgfsException)
+                                throw (IgfsException)err;
+
+                            throw new IgfsException("Failed to open the path due to secondary file system " +
                                 "exception: " + path, err);
                         }
                     };
@@ -1892,10 +1921,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param fs File system.
      * @param path Path.
      * @return File info or {@code null} if file not found.
-     * @throws IgniteCheckedException If sync task failed.
      */
-    @Nullable public IgfsFileInfo synchronizeFileDual(final IgfsSecondaryFileSystem fs, final IgfsPath path)
-        throws IgniteCheckedException {
+    @Nullable public IgfsFileInfo synchronizeFileDual(final IgfsSecondaryFileSystem fs, final IgfsPath path) {
         assert fs != null;
         assert path != null;
 
@@ -1915,8 +1942,11 @@ public class IgfsMetaManager extends IgfsManager {
                             return infos.get(path);
                         }
 
-                        @Override public IgfsFileInfo onFailure(@Nullable Exception err) throws IgniteCheckedException {
-                            throw new IgniteCheckedException("Failed to synchronize path due to secondary file system " +
+                        @Override public IgfsFileInfo onFailure(@Nullable Exception err) {
+                            if (err instanceof IgfsException)
+                                throw (IgfsException)err;
+
+                            throw new IgfsException("Failed to synchronize path due to secondary file system " +
                                 "exception: " + path, err);
                         }
                     };
@@ -1940,10 +1970,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param path Path to create.
      * @param props Properties to be applied.
      * @return {@code True} in case rename was successful.
-     * @throws IgniteCheckedException If directory creation failed.
      */
-    public boolean mkdirsDual(final IgfsSecondaryFileSystem fs, final IgfsPath path, final Map<String, String> props)
-        throws IgniteCheckedException {
+    public boolean mkdirsDual(final IgfsSecondaryFileSystem fs, final IgfsPath path, final Map<String, String> props) {
         if (busyLock.enterBusy()) {
             try {
                 assert fs != null;
@@ -1991,11 +2019,14 @@ public class IgfsMetaManager extends IgfsManager {
                         return true;
                     }
 
-                    @Override public Boolean onFailure(@Nullable Exception err) throws IgniteCheckedException {
+                    @Override public Boolean onFailure(@Nullable Exception err) {
                         U.error(log, "Directory creation in DUAL mode failed [path=" + path + ", properties=" + props +
                             ']', err);
 
-                        throw new IgniteCheckedException("Failed to create the path due to secondary file system exception: " +
+                        if (err instanceof IgfsException)
+                            throw (IgfsException)err;
+
+                        throw new IgfsException("Failed to create the path due to secondary file system exception: " +
                             path, err);
                     }
                 };
@@ -2024,10 +2055,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param src Source path.
      * @param dest Destination path.
      * @return Operation result.
-     * @throws IgniteCheckedException If failed.
      */
-    public boolean renameDual(final IgfsSecondaryFileSystem fs, final IgfsPath src, final IgfsPath dest) throws
-        IgniteCheckedException {
+    public boolean renameDual(final IgfsSecondaryFileSystem fs, final IgfsPath src, final IgfsPath dest) {
         if (busyLock.enterBusy()) {
             try {
                 assert fs != null;
@@ -2049,12 +2078,11 @@ public class IgfsMetaManager extends IgfsManager {
 
                         // Source path and destination (or destination parent) must exist.
                         if (srcInfo == null)
-                            throw fsException(new IgfsFileNotFoundException("Failed to rename " +
-                                    "(source path not found): " + src));
+                            throw new IgfsFileNotFoundException("Failed to rename (source path not found): " + src);
 
                         if (destInfo == null && destParentInfo == null)
-                            throw fsException(new IgfsFileNotFoundException("Failed to rename " +
-                                "(destination path not found): " + dest));
+                            throw new IgfsFileNotFoundException("Failed to rename (destination path not found): " +
+                                dest);
 
                         // Delegate to the secondary file system.
                         fs.rename(src, dest);
@@ -2090,11 +2118,14 @@ public class IgfsMetaManager extends IgfsManager {
                         return true;
                     }
 
-                    @Override public Boolean onFailure(@Nullable Exception err) throws IgniteCheckedException {
+                    @Override public Boolean onFailure(@Nullable Exception err) {
                         U.error(log, "Path rename in DUAL mode failed [source=" + src + ", destination=" + dest + ']',
                             err);
 
-                        throw new IgniteCheckedException("Failed to rename the path due to secondary file system " +
+                        if (err instanceof IgfsException)
+                            throw (IgfsException)err;
+
+                        throw new IgfsException("Failed to rename the path due to secondary file system " +
                             "exception: " + src, err);
                     }
                 };
@@ -2123,10 +2154,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param path Path to update.
      * @param recursive Recursive flag.
      * @return Operation result.
-     * @throws IgniteCheckedException If delete failed.
      */
-    public boolean deleteDual(final IgfsSecondaryFileSystem fs, final IgfsPath path, final boolean recursive)
-        throws IgniteCheckedException {
+    public boolean deleteDual(final IgfsSecondaryFileSystem fs, final IgfsPath path, final boolean recursive) {
         if (busyLock.enterBusy()) {
             try {
                 assert fs != null;
@@ -2159,11 +2188,14 @@ public class IgfsMetaManager extends IgfsManager {
                         return true; // No additional handling is required.
                     }
 
-                    @Override public Boolean onFailure(@Nullable Exception err) throws IgniteCheckedException {
+                    @Override public Boolean onFailure(@Nullable Exception err) {
                         U.error(log, "Path delete in DUAL mode failed [path=" + path + ", recursive=" + recursive + ']',
                             err);
 
-                        throw new IgniteCheckedException("Failed to delete the path due to secondary file system exception: ",
+                        if (err instanceof IgfsException)
+                            throw (IgfsException)err;
+
+                        throw new IgfsException("Failed to delete the path due to secondary file system exception: ",
                             err);
                     }
                 };
@@ -2189,10 +2221,9 @@ public class IgfsMetaManager extends IgfsManager {
      * @param path Path to update.
      * @param props Properties to be applied.
      * @return Update file info.
-     * @throws IgniteCheckedException If update failed.
      */
-    public IgfsFileInfo updateDual(final IgfsSecondaryFileSystem fs, final IgfsPath path, final Map<String, String> props)
-        throws IgniteCheckedException {
+    public IgfsFileInfo updateDual(final IgfsSecondaryFileSystem fs, final IgfsPath path,
+        final Map<String, String> props) {
         assert fs != null;
         assert path != null;
         assert props != null && !props.isEmpty();
@@ -2213,11 +2244,14 @@ public class IgfsMetaManager extends IgfsManager {
                             props);
                     }
 
-                    @Override public IgfsFileInfo onFailure(@Nullable Exception err) throws IgniteCheckedException {
+                    @Override public IgfsFileInfo onFailure(@Nullable Exception err) {
                         U.error(log, "Path update in DUAL mode failed [path=" + path + ", properties=" + props + ']',
                             err);
 
-                        throw new IgniteCheckedException("Failed to update the path due to secondary file system exception: " +
+                        if (err instanceof IgfsException)
+                            throw (IgfsException)err;
+
+                        throw new IgfsException("Failed to update the path due to secondary file system exception: " +
                             path, err);
                     }
                 };
@@ -2242,16 +2276,9 @@ public class IgfsMetaManager extends IgfsManager {
      * @param strict Whether all paths must exist in the secondary file system.
      * @param created Optional map where data about all created values is put.
      * @return File info of the end path.
-     * @throws IgniteCheckedException If failed.
      */
-    private IgfsFileInfo synchronize(IgfsSecondaryFileSystem fs,
-        IgfsPath startPath,
-        IgfsFileInfo startPathInfo,
-        IgfsPath endPath,
-        boolean strict,
-        @Nullable Map<IgfsPath, IgfsFileInfo> created)
-        throws IgniteCheckedException
-    {
+    private IgfsFileInfo synchronize(IgfsSecondaryFileSystem fs, IgfsPath startPath, IgfsFileInfo startPathInfo,
+        IgfsPath endPath, boolean strict, @Nullable Map<IgfsPath, IgfsFileInfo> created) {
         assert fs != null;
         assert startPath != null && startPathInfo != null && endPath != null;
 
@@ -2277,18 +2304,18 @@ public class IgfsMetaManager extends IgfsManager {
                     status = fs.info(curPath);
                 }
                 catch (IgniteException e) {
-                    throw new IgniteCheckedException("Failed to get path information: " + e, e);
+                    throw new IgfsException("Failed to get path information: " + e, e);
                 }
 
                 if (status != null) {
                     if (!status.isDirectory() && !curPath.equals(endPath))
-                        throw new IgniteCheckedException("Failed to create path the locally because secondary file system " +
+                        throw new IgfsException("Failed to create path the locally because secondary file system " +
                             "directory structure was modified concurrently and the path is not a directory as " +
                             "expected: " + curPath);
                 }
                 else {
                     if (strict) {
-                        throw new IgniteCheckedException("Failed to create path locally due to secondary file system " +
+                        throw new IgfsException("Failed to create path locally due to secondary file system " +
                             "exception: " + curPath);
                     }
                     else if (created != null)
@@ -2326,14 +2353,11 @@ public class IgfsMetaManager extends IgfsManager {
      * @param strict Whether paths must be re-created strictly.
      * @param paths Paths to synchronize.
      * @return Result of task execution.
-     * @throws IgniteCheckedException If failed.
      */
     private <T> T synchronizeAndExecute(SynchronizationTask<T> task,
         IgfsSecondaryFileSystem fs,
         boolean strict,
-        IgfsPath... paths)
-        throws IgniteCheckedException
-    {
+        IgfsPath... paths) {
         return synchronizeAndExecute(task, fs, strict, null, paths);
     }
 
@@ -2347,15 +2371,12 @@ public class IgfsMetaManager extends IgfsManager {
      * @param extraLockIds Additional IDs to lock (optional).
      * @param paths Paths to synchronize.
      * @return Result of task execution.
-     * @throws IgniteCheckedException If failed.
      */
     private <T> T synchronizeAndExecute(SynchronizationTask<T> task,
         IgfsSecondaryFileSystem fs,
         boolean strict,
         @Nullable Collection<IgniteUuid> extraLockIds,
-        IgfsPath... paths)
-        throws IgniteCheckedException
-    {
+        IgfsPath... paths) {
         assert task != null;
         assert fs != null;
         assert paths != null && paths.length > 0;
@@ -2369,16 +2390,18 @@ public class IgfsMetaManager extends IgfsManager {
         T res = null;
 
         while (!finished) {
-            // Obtain existing IDs outside the transaction.
-            List<List<IgniteUuid>> pathIds = new ArrayList<>(paths.length);
+            IgniteInternalTx tx = null;
 
-            for (IgfsPath path : paths)
-                pathIds.add(fileIds(path));
+            try {
+                // Obtain existing IDs outside the transaction.
+                List<List<IgniteUuid>> pathIds = new ArrayList<>(paths.length);
 
-            // Start pessimistic.
-            IgniteInternalTx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ);
+                for (IgfsPath path : paths)
+                    pathIds.add(fileIds(path));
+
+                // Start pessimistic.
+                tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ);
 
-            try {
                 // Lock the very first existing parents and possibly the leaf as well.
                 Map<IgfsPath, IgfsPath> pathToParent = new HashMap<>();
 
@@ -2452,7 +2475,7 @@ public class IgfsMetaManager extends IgfsManager {
                 if (changed != null) {
                     finished = true;
 
-                    throw fsException(new IgfsConcurrentModificationException(changed));
+                    throw new IgfsConcurrentModificationException(changed);
                 }
                 else {
                     boolean newParents = false;
@@ -2534,17 +2557,21 @@ public class IgfsMetaManager extends IgfsManager {
 
                 tx.commit();
             }
-            catch (IgniteCheckedException e) {
+            catch (Exception e) {
                 if (!finished) {
                     finished = true;
 
                     res = task.onFailure(e);
                 }
-                else
-                    throw e;
+                else {
+                    if (e instanceof IgfsException)
+                        throw (IgfsException)e;
+
+                    throw new IgfsException("Failed to perform operation in DUAL mode.", e);
+                }
             }
             finally {
-                tx.close();
+                U.closeQuiet(tx);
             }
         }
 
@@ -2552,24 +2579,6 @@ public class IgfsMetaManager extends IgfsManager {
     }
 
     /**
-     * Update cached value with closure.
-     *
-     * @param cache Cache projection to work with.
-     * @param key Key to retrieve/update the value for.
-     * @param c Closure to apply to cached value.
-     * @return {@code True} if value was stored in cache, {@code false} otherwise.
-     * @throws IgniteCheckedException If operation failed.
-     */
-    private <K, V> boolean putx(CacheProjection<K, V> cache, K key, IgniteClosure<V, V> c) throws IgniteCheckedException {
-        assert validTxState(true);
-
-        V oldVal = cache.get(key);
-        V newVal = c.apply(oldVal);
-
-        return newVal == null ? cache.removex(key) : cache.putx(key, newVal);
-    }
-
-    /**
      * Check transaction is (not) started.
      *
      * @param inTx Expected transaction state.
@@ -2593,10 +2602,9 @@ public class IgfsMetaManager extends IgfsManager {
      * @param fileName File name to update. Must match file ID.
      * @param accessTime Access time to set. If {@code -1}, will not be updated.
      * @param modificationTime Modification time to set. If {@code -1}, will not be updated.
-     * @throws IgniteCheckedException If update failed.
      */
     public void updateTimes(IgniteUuid parentId, IgniteUuid fileId, String fileName, long accessTime,
-        long modificationTime) throws IgniteCheckedException {
+        long modificationTime) {
         if (busyLock.enterBusy()) {
             try {
                 assert validTxState(false);
@@ -2610,21 +2618,21 @@ public class IgfsMetaManager extends IgfsManager {
                     IgfsFileInfo fileInfo = infoMap.get(fileId);
 
                     if (fileInfo == null)
-                        throw fsException(new IgfsFileNotFoundException("Failed to update times " +
-                                "(path was not found): " + fileName));
+                        throw new IgfsFileNotFoundException("Failed to update times " +
+                                "(path was not found): " + fileName);
 
                     IgfsFileInfo parentInfo = infoMap.get(parentId);
 
                     if (parentInfo == null)
-                        throw fsException(new IgfsInvalidPathException("Failed to update times " +
-                                "(parent was not found): " + fileName));
+                        throw new IgfsInvalidPathException("Failed to update times (parent was not found): " +
+                            fileName);
 
                     IgfsListingEntry entry = parentInfo.listing().get(fileName);
 
                     // Validate listing.
                     if (entry == null || !entry.fileId().equals(fileId))
-                        throw fsException(new IgfsInvalidPathException("Failed to update times " +
-                                "(file concurrently modified): " + fileName));
+                        throw new IgfsInvalidPathException("Failed to update times (file concurrently modified): " +
+                            fileName);
 
                     assert parentInfo.isDirectory();
 
@@ -2643,6 +2651,11 @@ public class IgfsMetaManager extends IgfsManager {
                     tx.close();
                 }
             }
+            catch (IgniteException | IgniteCheckedException e) {
+                throw new IgfsException("Failed to update times [parentId=" + parentId +", fileId=" + fileId +
+                    ", fileName=" + fileName + ", accessTime=" + accessTime +
+                    "modificationTime=" + modificationTime + ']');
+            }
             finally {
                 busyLock.leaveBusy();
             }
@@ -2656,16 +2669,8 @@ public class IgfsMetaManager extends IgfsManager {
      * @param msg Error message.
      * @return Checked exception.
      */
-    private static IgniteCheckedException fsException(String msg) {
-        return new IgniteCheckedException(new IgfsException(msg));
-    }
-
-    /**
-     * @param msg Error message.
-     * @return Checked exception.
-     */
-    private static IgniteCheckedException fsException(IgfsException err) {
-        return new IgniteCheckedException(err);
+    private static IgfsException fsException(String msg) {
+        return new IgfsException(msg);
     }
 
     /**
@@ -2686,9 +2691,8 @@ public class IgfsMetaManager extends IgfsManager {
          *
          * @param err Optional exception.
          * @return Task result.
-         * @throws IgniteCheckedException In case exception is to be thrown in that case.
          */
-        public T onFailure(Exception err) throws IgniteCheckedException;
+        public T onFailure(Exception err);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c841b89d/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 6c6dd9d..bef8768 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
@@ -261,7 +261,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
         try {
             exists = meta.exists(fileInfo.id());
         }
-        catch (IgniteCheckedException e) {
+        catch (IgfsException e) {
             throw new IOError(e); // Something unrecoverable.
         }
 
@@ -329,7 +329,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
             try {
                 exists = !deleted && meta.exists(fileInfo.id());
             }
-            catch (IgniteCheckedException e) {
+            catch (IgfsException e) {
                 throw new IOError(e); // Something unrecoverable.
             }
 
@@ -369,7 +369,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
 
                     throw new IOException("File was concurrently deleted: " + path);
                 }
-                catch (IgniteCheckedException e) {
+                catch (IgfsException e) {
                     throw new IOError(e); // Something unrecoverable.
                 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c841b89d/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index 9a99611..854cfb4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -692,25 +692,14 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
     public void testDeleteDirectoryNotEmpty() throws Exception {
         create(igfs, paths(DIR, SUBDIR, SUBSUBDIR), paths(FILE));
 
-        // We have different results for dual and non-dual modes.
-        if (dual)
-            GridTestUtils.assertThrows(log, new Callable<Object>() {
-                @Override public Object call() throws Exception {
-                    igfs.delete(SUBDIR, false);
-
-                    return null;
-                }
-            }, IgniteCheckedException.class, "Failed to delete the path due to secondary file system exception:");
-        else {
-            GridTestUtils.assertThrows(log, new Callable<Object>() {
-                @Override public Object call() throws Exception {
-                    igfs.delete(SUBDIR, false);
+        GridTestUtils.assertThrows(log, new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                igfs.delete(SUBDIR, false);
 
-                    return null;
-                }
-            }, IgfsDirectoryNotEmptyException.class, "Failed to remove directory (directory is not empty and " +
-                   "recursive flag is not set)");
-        }
+                return null;
+            }
+        }, IgfsDirectoryNotEmptyException.class, "Failed to remove directory (directory is not empty and " +
+            "recursive flag is not set)");
 
         checkExist(igfs, igfsSecondary, SUBDIR, SUBSUBDIR, FILE);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c841b89d/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
index cea510a..e67e661 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
@@ -58,6 +58,8 @@ public class IgniteIgfsTestSuite extends TestSuite {
         suite.addTest(new TestSuite(IgfsPrimarySelfTest.class));
         suite.addTest(new TestSuite(IgfsPrimaryOffheapTieredSelfTest.class));
         suite.addTest(new TestSuite(IgfsPrimaryOffheapValuesSelfTest.class));
+        suite.addTest(new TestSuite(IgfsDualSyncSelfTest.class));
+        suite.addTest(new TestSuite(IgfsDualAsyncSelfTest.class));
 
         suite.addTest(new TestSuite(IgfsModeResolverSelfTest.class));
 


Mime
View raw message