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 10:02:07 UTC
[2/2] ignite git commit: IGNITE-3294: Prepared file processor.
IGNITE-3294: Prepared file processor.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dfaefc4b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dfaefc4b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dfaefc4b
Branch: refs/heads/ignite-3294
Commit: dfaefc4b7f87ebde04a51c19ef13aadca821d1db
Parents: 670bad6
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Jun 10 13:01:38 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Jun 10 13:01:38 2016 +0300
----------------------------------------------------------------------
.../processors/igfs/IgfsMetaManager.java | 25 +++++-----------
.../igfs/meta/IgfsMetaFileCreateProcessor.java | 30 +++++++++++++++++---
2 files changed, 33 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dfaefc4b/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 20500e8..5bc314d 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
@@ -2931,35 +2931,23 @@ public class IgfsMetaManager extends IgfsManager {
throw fsException("Failed to open output stream to the file created in " +
"the secondary file system because the path points to a directory: " + path);
- IgfsEntryInfo newInfo2 = IgfsUtils.createFile(
- overwriteId,
- secondaryFile.blockSize(),
- secondaryFile.length(),
- affKey,
- newLockId,
- evictExclude,
- secondaryFile.properties(),
- secondaryFile.accessTime(),
- secondaryFile.modificationTime()
- );
-
newAccessTime = secondaryFile.accessTime();
newModificationTime = secondaryFile.modificationTime();
newProps = secondaryFile.properties();
newLen = secondaryFile.length();
- newBlockSize = (int)secondaryFile.length();
+ newBlockSize = secondaryFile.blockSize();
}
else {
newAccessTime = System.currentTimeMillis();
newModificationTime = newAccessTime;
newProps = fileProps;
- newLen = 0;
+ newLen = 0L;
newBlockSize = blockSize;
}
IgfsEntryInfo newInfo = invokeAndGet(overwriteId,
- new IgfsMetaFileCreateProcessor(newAccessTime, newProps, newBlockSize, affKey,
- newLockId, evictExclude));
+ new IgfsMetaFileCreateProcessor(newAccessTime, newModificationTime, newProps,
+ newBlockSize, affKey, newLockId, evictExclude, newLen));
// Prepare result and commit.
tx.commit();
@@ -2969,6 +2957,7 @@ public class IgfsMetaManager extends IgfsManager {
return new IgfsCreateResult(newInfo, secondaryOut);
}
else {
+ // TODO: Handle this part.
// Create file and parent folders.
IgfsPathsCreateResult res =
createFile(pathIds, lockInfos, dirProps, fileProps, blockSize, affKey, evictExclude);
@@ -3110,8 +3099,8 @@ public class IgfsMetaManager extends IgfsManager {
if (dir)
info = invokeAndGet(curId, new IgfsMetaDirectoryCreateProcessor(createTime, dirProps));
else
- info = invokeAndGet(curId, new IgfsMetaFileCreateProcessor(createTime, fileProps,
- blockSize, affKey, createFileLockId(false), evictExclude));
+ info = invokeAndGet(curId, new IgfsMetaFileCreateProcessor(createTime, createTime, fileProps,
+ blockSize, affKey, createFileLockId(false), evictExclude, 0L));
createdPaths.add(pathIds.path());
http://git-wip-us.apache.org/repos/asf/ignite/blob/dfaefc4b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
index 8c4c296..6c2bfa5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
@@ -51,6 +51,9 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
/** Create time. */
private long createTime;
+ /** Modification time. */
+ private long modificationTime;
+
/** Properties. */
private Map<String, String> props;
@@ -66,6 +69,9 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
/** Evict exclude flag. */
private boolean evictExclude;
+ /** File length. */
+ private long len;
+
/**
* Constructor.
*/
@@ -77,20 +83,24 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
* Constructor.
*
* @param createTime Create time.
+ * @param modificationTime Modification time.
* @param props Properties.
* @param blockSize Block size.
* @param affKey Affinity key.
* @param lockId Lock ID.
* @param evictExclude Evict exclude flag.
+ * @param len File length.
*/
- public IgfsMetaFileCreateProcessor(long createTime, Map<String, String> props, int blockSize,
- @Nullable IgniteUuid affKey, IgniteUuid lockId, boolean evictExclude) {
+ public IgfsMetaFileCreateProcessor(long createTime, long modificationTime, Map<String, String> props,
+ int blockSize, @Nullable IgniteUuid affKey, IgniteUuid lockId, boolean evictExclude, long len) {
this.createTime = createTime;
+ this.modificationTime = modificationTime;
this.props = props;
this.blockSize = blockSize;
this.affKey = affKey;
this.lockId = lockId;
this.evictExclude = evictExclude;
+ this.len = len;
}
/** {@inheritDoc} */
@@ -99,13 +109,13 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
IgfsEntryInfo info = IgfsUtils.createFile(
entry.getKey(),
blockSize,
- 0L,
+ len,
affKey,
lockId,
evictExclude,
props,
createTime,
- createTime
+ modificationTime
);
entry.setValue(info);
@@ -116,6 +126,7 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeLong(createTime);
+ out.writeLong(modificationTime);
IgfsUtils.writeProperties(out, props);
@@ -123,11 +134,14 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
U.writeGridUuid(out, affKey);
U.writeGridUuid(out, lockId);
out.writeBoolean(evictExclude);
+
+ out.writeLong(len);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
createTime = in.readLong();
+ modificationTime = in.readLong();
props = IgfsUtils.readProperties(in);
@@ -135,6 +149,8 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
affKey = U.readGridUuid(in);
lockId = U.readGridUuid(in);
evictExclude = in.readBoolean();
+
+ len = in.readLong();
}
/** {@inheritDoc} */
@@ -142,6 +158,7 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
BinaryRawWriter out = writer.rawWriter();
out.writeLong(createTime);
+ out.writeLong(modificationTime);
IgfsUtils.writeProperties(out, props);
@@ -149,6 +166,8 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
BinaryUtils.writeIgniteUuid(out, affKey);
BinaryUtils.writeIgniteUuid(out, lockId);
out.writeBoolean(evictExclude);
+
+ out.writeLong(len);
}
/** {@inheritDoc} */
@@ -156,6 +175,7 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
BinaryRawReader in = reader.rawReader();
createTime = in.readLong();
+ modificationTime = in.readLong();
props = IgfsUtils.readProperties(in);
@@ -163,6 +183,8 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
affKey = BinaryUtils.readIgniteUuid(in);
lockId = BinaryUtils.readIgniteUuid(in);
evictExclude = in.readBoolean();
+
+ len = in.readLong();
}
/** {@inheritDoc} */