You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/06/10 09:27:39 UTC
ignite git commit: IGNITE-3294: Moved secondary FS retry logic to a
separate method.
Repository: ignite
Updated Branches:
refs/heads/ignite-3294 fd0e5bf63 -> 3cee4ca74
IGNITE-3294: Moved secondary FS retry logic to a separate method.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3cee4ca7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3cee4ca7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3cee4ca7
Branch: refs/heads/ignite-3294
Commit: 3cee4ca74e0d8b799ae12774b412726698090fbf
Parents: fd0e5bf
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Jun 10 12:27:05 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Jun 10 12:27:05 2016 +0300
----------------------------------------------------------------------
.../processors/igfs/IgfsMetaManager.java | 71 ++++++++++++--------
1 file changed, 42 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3cee4ca7/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 bff274f..67a3bb9 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
@@ -1146,6 +1146,46 @@ public class IgfsMetaManager extends IgfsManager {
}
/**
+ * Wheter operation must be re-tries because we have suspicious links which may broke secondary file system
+ * consistency.
+ *
+ * @param pathIds Path IDs.
+ * @param lockInfos Lock infos.
+ * @return
+ */
+ private boolean isRetryForSecondary(IgfsPathIds pathIds, Map<IgniteUuid, IgfsEntryInfo> lockInfos) {
+ // We need to ensure that the last locked info is not linked with expected child.
+ // Otherwise there was some concurrent file system update and we have to re-try.
+ if (!pathIds.allExists()) {
+ // Find the last locked index
+ IgfsEntryInfo lastLockedInfo = null;
+ int lastLockedIdx = -1;
+
+ while (lastLockedIdx < pathIds.lastExistingIndex()) {
+ IgfsEntryInfo nextInfo = lockInfos.get(pathIds.id(lastLockedIdx + 1));
+
+ if (nextInfo != null) {
+ lastLockedInfo = nextInfo;
+ lastLockedIdx++;
+ }
+ else
+ break;
+ }
+
+ assert lastLockedIdx < pathIds.count();
+
+ if (lastLockedInfo != null) {
+ String part = pathIds.part(lastLockedIdx + 1);
+
+ if (lastLockedInfo.listing().containsKey(part))
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
* Move path to the trash directory.
*
* @param path Path.
@@ -1185,35 +1225,8 @@ public class IgfsMetaManager extends IgfsManager {
// Lock participants.
Map<IgniteUuid, IgfsEntryInfo> lockInfos = lockIds(allIds);
- if (!pathIds.allExists()) {
- // We need to ensure that the last locked info is not linked with expected child.
- // Otherwise there was some ocncurrent file system update and we have to re-try.
- assert secondaryFs != null;
-
- // Find the last locked index
- IgfsEntryInfo lastLockedInfo = null;
- int lastLockedIdx = -1;
-
- while (lastLockedIdx < pathIds.lastExistingIndex()) {
- IgfsEntryInfo nextInfo = lockInfos.get(pathIds.id(lastLockedIdx + 1));
-
- if (nextInfo != null) {
- lastLockedInfo = nextInfo;
- lastLockedIdx++;
- }
- else
- break;
- }
-
- assert lastLockedIdx < pathIds.count();
-
- if (lastLockedInfo != null) {
- String part = pathIds.part(lastLockedIdx + 1);
-
- if (lastLockedInfo.listing().containsKey(part))
- continue;
- }
- }
+ if (secondaryFs != null && isRetryForSecondary(pathIds, lockInfos))
+ continue;
// Ensure that all participants are still in place.
if (!pathIds.allExists() || !pathIds.verifyIntegrity(lockInfos, relaxed)) {