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/14 07:17:01 UTC
[1/4] ignite git commit: IGNITE-3294: Now only single invoke call is
performed for creates.
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 <vo...@gridgain.com>
Authored: Fri Jun 10 18:51:41 2016 +0300
Committer: vozerov-gridgain <vo...@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);
}
[2/4] ignite git commit: IGNITE-3294: Deletes are also use only
single invoke.
Posted by vo...@apache.org.
IGNITE-3294: Deletes are also use only single invoke.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/14cbd122
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/14cbd122
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/14cbd122
Branch: refs/heads/ignite-3294
Commit: 14cbd12298e1b40e6e369e60a24f17355a4bf010
Parents: 4cff170
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Jun 10 18:53:49 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Jun 10 18:53:49 2016 +0300
----------------------------------------------------------------------
.../internal/processors/igfs/IgfsMetaManager.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/14cbd122/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 7439c28..61713c3 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
@@ -1201,8 +1201,8 @@ public class IgfsMetaManager extends IgfsManager {
* @return ID of an entry located directly under the trash directory.
* @throws IgniteCheckedException If failed.
*/
- IgfsDeleteResult softDelete(final IgfsPath path, final boolean recursive, @Nullable IgfsSecondaryFileSystem secondaryFs)
- throws IgniteCheckedException {
+ IgfsDeleteResult softDelete(final IgfsPath path, final boolean recursive,
+ @Nullable IgfsSecondaryFileSystem secondaryFs) throws IgniteCheckedException {
while (true) {
if (busyLock.enterBusy()) {
try {
@@ -1740,8 +1740,12 @@ public class IgfsMetaManager extends IgfsManager {
IgniteUuid destId, String destName) throws IgniteCheckedException {
validTxState(true);
- id2InfoPrj.invoke(srcId, new IgfsMetaDirectoryListingRemoveProcessor(srcName, entry.fileId()));
- id2InfoPrj.invoke(destId, new IgfsMetaDirectoryListingAddProcessor(destName, entry));
+ Map<IgniteUuid, EntryProcessor<IgniteUuid, IgfsEntryInfo, Void>> procMap = new HashMap<>();
+
+ procMap.put(srcId, new IgfsMetaDirectoryListingRemoveProcessor(srcName, entry.fileId()));
+ procMap.put(destId, new IgfsMetaDirectoryListingAddProcessor(destName, entry));
+
+ id2InfoPrj.invokeAll(procMap);
}
/**
[4/4] ignite git commit: IGNITE-3294: More reliable stream close.
Posted by vo...@apache.org.
IGNITE-3294: More reliable stream close.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/87237cee
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/87237cee
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/87237cee
Branch: refs/heads/ignite-3294
Commit: 87237ceef82e62d471bb90fd9553e36f19b74909
Parents: fbc5d96
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Jun 14 09:43:59 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Jun 14 09:43:59 2016 +0300
----------------------------------------------------------------------
.../processors/igfs/IgfsMetaManager.java | 30 ++++++++++++--------
.../processors/igfs/IgfsPathsCreateResult.java | 16 +----------
2 files changed, 19 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/87237cee/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 a7f8336..c08d6a0 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
@@ -1729,7 +1729,7 @@ public class IgfsMetaManager extends IgfsManager {
/**
* Transfer entry from one directory to another.
*
- * @param entry Entry to be transfered.
+ * @param entry Entry to be transferred.
* @param srcId Source ID.
* @param srcName Source name.
* @param destId Destination ID.
@@ -2806,6 +2806,8 @@ public class IgfsMetaManager extends IgfsManager {
while (true) {
if (busyLock.enterBusy()) {
+ OutputStream secondaryOut = null;
+
try {
// Prepare path IDs.
IgfsPathIds pathIds = pathIds(path);
@@ -2878,8 +2880,6 @@ public class IgfsMetaManager extends IgfsManager {
long newLen;
int newBlockSize;
- OutputStream secondaryOut = null;
-
if (secondaryCtx != null) {
secondaryOut = secondaryCtx.create();
@@ -2919,6 +2919,9 @@ public class IgfsMetaManager extends IgfsManager {
}
else {
// Create file and parent folders.
+ if (secondaryCtx != null)
+ secondaryOut = secondaryCtx.create();
+
IgfsPathsCreateResult res = createFile(pathIds, lockInfos, dirProps, fileProps, blockSize,
affKey, evictExclude, secondaryCtx);
@@ -2931,11 +2934,20 @@ public class IgfsMetaManager extends IgfsManager {
// Generate events.
generateCreateEvents(res.createdPaths(), true);
- // TODO: Set correct output stream.
- return new IgfsCreateResult(res.info(), res.secondaryOutputStream());
+ return new IgfsCreateResult(res.info(), secondaryOut);
}
}
}
+ catch (IgniteException | IgniteCheckedException e) {
+ U.closeQuiet(secondaryOut);
+
+ throw e;
+ }
+ catch (Exception e) {
+ U.closeQuiet(secondaryOut);
+
+ throw new IgniteCheckedException("Create failed due to unexpected exception: " + path, e);
+ }
finally {
busyLock.leaveBusy();
}
@@ -3026,12 +3038,6 @@ public class IgfsMetaManager extends IgfsManager {
if (lastExistingInfo.hasChild(curPart))
return null;
- // Invoke secondary file system if needed.
- OutputStream secondaryOut = null;
-
- if (secondaryCtx != null)
- secondaryOut = secondaryCtx.create();
-
Map<IgniteUuid, EntryProcessor> procMap = new HashMap<>();
// First step: add new entry to the last existing element.
@@ -3161,7 +3167,7 @@ public class IgfsMetaManager extends IgfsManager {
IgfsEntryInfo info = (IgfsEntryInfo)invokeRes.get(curId).get();
- return new IgfsPathsCreateResult(createdPaths, info, secondaryOut);
+ return new IgfsPathsCreateResult(createdPaths, info);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/87237cee/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
index 5f53f37..bd13555 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
@@ -19,9 +19,7 @@ package org.apache.ignite.internal.processors.igfs;
import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.jetbrains.annotations.Nullable;
-import java.io.OutputStream;
import java.util.List;
/**
@@ -34,20 +32,15 @@ public class IgfsPathsCreateResult {
/** Info of the last created file. */
private final IgfsEntryInfo info;
- /** Secondary output stream. */
- private final OutputStream secondaryOut;
-
/**
* Constructor.
*
* @param paths Created paths.
* @param info Info of the last created file.
- * @param secondaryOut Secondary output stream.
*/
- public IgfsPathsCreateResult(List<IgfsPath> paths, IgfsEntryInfo info, @Nullable OutputStream secondaryOut) {
+ public IgfsPathsCreateResult(List<IgfsPath> paths, IgfsEntryInfo info) {
this.paths = paths;
this.info = info;
- this.secondaryOut = secondaryOut;
}
/**
@@ -64,13 +57,6 @@ public class IgfsPathsCreateResult {
return info;
}
- /**
- * @return Secondary output stream.
- */
- public OutputStream secondaryOutputStream() {
- return secondaryOut;
- }
-
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(IgfsPathsCreateResult.class, this);
[3/4] ignite git commit: IGNITE-3294: Fixed problem with similar IDs
put into invoke map during transfer operation.
Posted by vo...@apache.org.
IGNITE-3294: Fixed problem with similar IDs put into invoke map during transfer operation.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fbc5d967
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fbc5d967
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fbc5d967
Branch: refs/heads/ignite-3294
Commit: fbc5d96700cf5ef2df66ab357cbb2ae5b279d06e
Parents: 14cbd12
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Jun 14 09:40:56 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Jun 14 09:40:56 2016 +0300
----------------------------------------------------------------------
.../internal/processors/igfs/IgfsMetaManager.java | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbc5d967/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 61713c3..a7f8336 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
@@ -1740,12 +1740,19 @@ public class IgfsMetaManager extends IgfsManager {
IgniteUuid destId, String destName) throws IgniteCheckedException {
validTxState(true);
- Map<IgniteUuid, EntryProcessor<IgniteUuid, IgfsEntryInfo, Void>> procMap = new HashMap<>();
+ if (F.eq(srcId, destId)) {
+ id2InfoPrj.invoke(srcId, new IgfsMetaDirectoryListingRemoveProcessor(srcName, entry.fileId()));
+ id2InfoPrj.invoke(destId, new IgfsMetaDirectoryListingAddProcessor(destName, entry));
+ }
+ else {
- procMap.put(srcId, new IgfsMetaDirectoryListingRemoveProcessor(srcName, entry.fileId()));
- procMap.put(destId, new IgfsMetaDirectoryListingAddProcessor(destName, entry));
+ Map<IgniteUuid, EntryProcessor<IgniteUuid, IgfsEntryInfo, Void>> procMap = new HashMap<>();
- id2InfoPrj.invokeAll(procMap);
+ procMap.put(srcId, new IgfsMetaDirectoryListingRemoveProcessor(srcName, entry.fileId()));
+ procMap.put(destId, new IgfsMetaDirectoryListingAddProcessor(destName, entry));
+
+ id2InfoPrj.invokeAll(procMap);
+ }
}
/**