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/08 07:08:19 UTC
[1/3] ignite git commit: Fixed unrelated test.
Repository: ignite
Updated Branches:
refs/heads/ignite-3264 fa2c585f8 -> ec0c52dba
Fixed unrelated test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a56a1148
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a56a1148
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a56a1148
Branch: refs/heads/ignite-3264
Commit: a56a1148abad29338f82760ebdb73f9fcf09730f
Parents: fa2c585
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Jun 8 09:20:48 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Jun 8 09:20:48 2016 +0300
----------------------------------------------------------------------
.../igfs/IgfsProcessorValidationSelfTest.java | 38 +++++++++++++-------
1 file changed, 26 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a56a1148/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
index 0ce1036..29bb2cd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
@@ -445,27 +445,41 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest {
/**
* @throws Exception If failed.
*/
- public void testInvalidEndpointTcpPort() throws Exception {
+ public void testZeroEndpointTcpPort() throws Exception {
+ checkIvalidPort(0);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNegativeEndpointTcpPort() throws Exception {
+ checkIvalidPort(-1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTooBigEndpointTcpPort() throws Exception {
+ checkIvalidPort(65536);
+ }
+
+ /**
+ * Check invalid port handling.
+ *
+ * @param port Port.
+ * @throws Exception If failed.
+ */
+ private void checkIvalidPort(int port) throws Exception {
final String failMsg = "IGFS endpoint TCP port is out of range";
g1Cfg.setCacheConfiguration(concat(dataCaches(1024), metaCaches(), CacheConfiguration.class));
final String igfsCfgName = "igfs-cfg";
final IgfsIpcEndpointConfiguration igfsEndpointCfg = new IgfsIpcEndpointConfiguration();
- igfsEndpointCfg.setPort(0);
+ igfsEndpointCfg.setPort(port);
g1IgfsCfg1.setName(igfsCfgName);
g1IgfsCfg1.setIpcEndpointConfiguration(igfsEndpointCfg);
checkGridStartFails(g1Cfg, failMsg, true);
-
- igfsEndpointCfg.setPort(-1);
- g1IgfsCfg1.setIpcEndpointConfiguration(igfsEndpointCfg);
-
- checkGridStartFails(g1Cfg, failMsg, true);
-
- igfsEndpointCfg.setPort(65536);
- g1IgfsCfg1.setIpcEndpointConfiguration(igfsEndpointCfg);
-
- checkGridStartFails(g1Cfg, failMsg, true);
}
/**
[3/3] ignite git commit: Merged "reserve" and "unlock" operations
into one when stream is closed.
Posted by vo...@apache.org.
Merged "reserve" and "unlock" operations into one when stream is closed.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ec0c52db
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ec0c52db
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ec0c52db
Branch: refs/heads/ignite-3264
Commit: ec0c52dba921260a3d1fe1273503ba682caa7fae
Parents: d0ca774
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Jun 8 10:08:00 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Jun 8 10:08:00 2016 +0300
----------------------------------------------------------------------
.../processors/igfs/IgfsMetaManager.java | 32 ++++++---
.../processors/igfs/IgfsOutputStreamImpl.java | 14 ++--
.../igfs/meta/IgfsMetaFileUnlockProcessor.java | 69 +++++++++++++++++++-
3 files changed, 95 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec0c52db/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 bfa6185..91bb334 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
@@ -611,7 +611,7 @@ public class IgfsMetaManager extends IgfsManager {
}
/**
- * Remove explicit lock on file held by the current thread.
+ * Remove explicit lock on file held by the current stream.
*
* @param fileId File ID.
* @param lockId Lock ID.
@@ -620,6 +620,23 @@ public class IgfsMetaManager extends IgfsManager {
*/
public void unlock(final IgniteUuid fileId, final IgniteUuid lockId, final long modificationTime)
throws IgniteCheckedException {
+ unlock(fileId, lockId, modificationTime, false, 0, null);
+ }
+
+ /**
+ * Remove explicit lock on file held by the current stream.
+ *
+ * @param fileId File ID.
+ * @param lockId Lock ID.
+ * @param modificationTime Modification time to write to file info.
+ * @param updateSpace Whether to update space.
+ * @param space Space.
+ * @param affRange Affinity range.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void unlock(final IgniteUuid fileId, final IgniteUuid lockId, final long modificationTime,
+ final boolean updateSpace, final long space, @Nullable final IgfsFileAffinityRange affRange)
+ throws IgniteCheckedException {
validTxState(false);
if (busyLock.enterBusy()) {
@@ -647,7 +664,8 @@ public class IgfsMetaManager extends IgfsManager {
"[fileId=" + fileId + ", lockId=" + lockId + ", actualLockId=" +
oldInfo.lockId() + ']');
- id2InfoPrj.invoke(fileId, new IgfsMetaFileUnlockProcessor(modificationTime));
+ id2InfoPrj.invoke(fileId,
+ new IgfsMetaFileUnlockProcessor(modificationTime, updateSpace, space, affRange));
return null;
}
@@ -1490,27 +1508,26 @@ public class IgfsMetaManager extends IgfsManager {
/**
* Reserve space for file.
*
- * @param path File path.
* @param fileId File ID.
* @param space Space.
* @param affRange Affinity range.
* @return New file info.
*/
- public IgfsEntryInfo reserveSpace(IgfsPath path, IgniteUuid fileId, long space, IgfsFileAffinityRange affRange)
+ public IgfsEntryInfo reserveSpace(IgniteUuid fileId, long space, IgfsFileAffinityRange affRange)
throws IgniteCheckedException {
validTxState(false);
if (busyLock.enterBusy()) {
try {
if (log.isDebugEnabled())
- log.debug("Reserve file space [path=" + path + ", id=" + fileId + ']');
+ log.debug("Reserve file space: " + fileId);
try (IgniteInternalTx tx = startTx()) {
// Lock file ID for this transaction.
IgfsEntryInfo oldInfo = info(fileId);
if (oldInfo == null)
- throw fsException("File has been deleted concurrently [path=" + path + ", id=" + fileId + ']');
+ throw fsException("File has been deleted concurrently: " + fileId);
IgfsEntryInfo newInfo =
invokeAndGet(fileId, new IgfsMetaFileReserveSpaceProcessor(space, affRange));
@@ -1528,8 +1545,7 @@ public class IgfsMetaManager extends IgfsManager {
}
}
else
- throw new IllegalStateException("Failed to reserve file space because Grid is stopping [path=" + path +
- ", id=" + fileId + ']');
+ throw new IllegalStateException("Failed to reserve file space because Grid is stopping:" + fileId);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec0c52db/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 5e0ca29..7741a25 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
@@ -227,7 +227,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStream {
// Update file length if needed.
if (igfsCtx.configuration().isUpdateFileLengthOnFlush() && space > 0) {
try {
- IgfsEntryInfo fileInfo0 = igfsCtx.meta().reserveSpace(path, fileInfo.id(), space, streamRange);
+ IgfsEntryInfo fileInfo0 = igfsCtx.meta().reserveSpace(fileInfo.id(), space, streamRange);
if (fileInfo0 == null)
throw new IOException("File was concurrently deleted: " + path);
@@ -311,15 +311,11 @@ class IgfsOutputStreamImpl extends IgfsOutputStream {
// Unlock the file after data is flushed.
try {
- if (flushSuccess) {
- if (space > 0)
- igfsCtx.meta().reserveSpace(path, fileInfo.id(), space, streamRange);
-
- igfsCtx.meta().unlock(fileInfo.id(), fileInfo.lockId(), System.currentTimeMillis());
- }
- else {
+ if (flushSuccess && space > 0)
+ igfsCtx.meta().unlock(fileInfo.id(), fileInfo.lockId(), System.currentTimeMillis(), true,
+ space, streamRange);
+ else
igfsCtx.meta().unlock(fileInfo.id(), fileInfo.lockId(), System.currentTimeMillis());
- }
}
catch (Exception e) {
if (err == null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec0c52db/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileUnlockProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileUnlockProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileUnlockProcessor.java
index 6827e4a..8d23490 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileUnlockProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileUnlockProcessor.java
@@ -24,8 +24,11 @@ import org.apache.ignite.binary.BinaryReader;
import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.internal.processors.igfs.IgfsEntryInfo;
+import org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange;
+import org.apache.ignite.internal.processors.igfs.IgfsFileMap;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
import javax.cache.processor.EntryProcessor;
import javax.cache.processor.EntryProcessorException;
@@ -46,6 +49,15 @@ public class IgfsMetaFileUnlockProcessor implements EntryProcessor<IgniteUuid, I
/** Modification time. */
private long modificationTime;
+ /** Whether to update space. */
+ private boolean updateSpace;
+
+ /** Space. */
+ private long space;
+
+ /** Affinity range. */
+ private IgfsFileAffinityRange affRange;
+
/**
* Default constructor.
*/
@@ -57,17 +69,36 @@ public class IgfsMetaFileUnlockProcessor implements EntryProcessor<IgniteUuid, I
* Constructor.
*
* @param modificationTime Modification time.
+ * @param updateSpace Whether to update space.
+ * @param space Space.
+ * @param affRange Affinity range.
*/
- public IgfsMetaFileUnlockProcessor(long modificationTime) {
+ public IgfsMetaFileUnlockProcessor(long modificationTime, boolean updateSpace, long space,
+ @Nullable IgfsFileAffinityRange affRange) {
this.modificationTime = modificationTime;
+ this.updateSpace = updateSpace;
+ this.space = space;
+ this.affRange = affRange;
}
/** {@inheritDoc} */
@Override public Void process(MutableEntry<IgniteUuid, IgfsEntryInfo> entry, Object... args)
throws EntryProcessorException {
- IgfsEntryInfo old = entry.getValue();
+ IgfsEntryInfo oldInfo = entry.getValue();
+
+ assert oldInfo != null;
+
+ IgfsEntryInfo newInfo = oldInfo.unlock(modificationTime);
+
+ if (updateSpace) {
+ IgfsFileMap newMap = new IgfsFileMap(newInfo.fileMap());
- entry.setValue(old.unlock(modificationTime));
+ newMap.addRange(affRange);
+
+ newInfo = newInfo.length(newInfo.length() + space).fileMap(newMap);
+ }
+
+ entry.setValue(newInfo);
return null;
}
@@ -75,11 +106,27 @@ public class IgfsMetaFileUnlockProcessor implements EntryProcessor<IgniteUuid, I
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeLong(modificationTime);
+
+ if (updateSpace) {
+ out.writeBoolean(true);
+ out.writeLong(space);
+ out.writeObject(affRange);
+ }
+ else
+ out.writeBoolean(false);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
modificationTime = in.readLong();
+
+ if (in.readBoolean()) {
+ updateSpace = true;
+ space = in.readLong();
+ affRange = (IgfsFileAffinityRange)in.readObject();
+ }
+ else
+ updateSpace = false;
}
/** {@inheritDoc} */
@@ -87,6 +134,14 @@ public class IgfsMetaFileUnlockProcessor implements EntryProcessor<IgniteUuid, I
BinaryRawWriter out = writer.rawWriter();
out.writeLong(modificationTime);
+
+ if (updateSpace) {
+ out.writeBoolean(true);
+ out.writeLong(space);
+ out.writeObject(affRange);
+ }
+ else
+ out.writeBoolean(false);
}
/** {@inheritDoc} */
@@ -94,6 +149,14 @@ public class IgfsMetaFileUnlockProcessor implements EntryProcessor<IgniteUuid, I
BinaryRawReader in = reader.rawReader();
modificationTime = in.readLong();
+
+ if (in.readBoolean()) {
+ updateSpace = true;
+ space = in.readLong();
+ affRange = in.readObject();
+ }
+ else
+ updateSpace = false;
}
/** {@inheritDoc} */
[2/3] ignite git commit: Typo.
Posted by vo...@apache.org.
Typo.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d0ca774b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d0ca774b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d0ca774b
Branch: refs/heads/ignite-3264
Commit: d0ca774b9b33e298d85cd9466cbb1f1808d5e7ed
Parents: a56a114
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Jun 8 09:24:22 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Jun 8 09:24:22 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/processors/igfs/IgfsMetaManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d0ca774b/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 28aa2ca..bfa6185 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
@@ -1528,7 +1528,7 @@ public class IgfsMetaManager extends IgfsManager {
}
}
else
- throw new IllegalStateException("Failed to reseve file space because Grid is stopping [path=" + path +
+ throw new IllegalStateException("Failed to reserve file space because Grid is stopping [path=" + path +
", id=" + fileId + ']');
}