ignite git commit: Docker image for Ignite 1.6.0
Repository: ignite Updated Branches: refs/heads/master 18d4ecc44 -> 77793f5e2 Docker image for Ignite 1.6.0 Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/77793f5e Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/77793f5e Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/77793f5e Branch: refs/heads/master Commit: 77793f5e23d2301bb2d623de5bae1e48dbee772b Parents: 18d4ecc Author: Aliaksandr KazlouAuthored: Tue Jun 7 19:14:02 2016 +0300 Committer: nikolay_tikhonov Committed: Tue Jun 7 19:14:02 2016 +0300 -- modules/docker/1.6.0/Dockerfile | 44 +++ modules/docker/1.6.0/run.sh | 51 modules/docker/Dockerfile | 24 ++--- 3 files changed, 109 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/77793f5e/modules/docker/1.6.0/Dockerfile -- diff --git a/modules/docker/1.6.0/Dockerfile b/modules/docker/1.6.0/Dockerfile new file mode 100644 index 000..959771b --- /dev/null +++ b/modules/docker/1.6.0/Dockerfile @@ -0,0 +1,44 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Start from a Java image. +FROM java:8 + +# Ignite version +ENV IGNITE_VERSION 1.6.0 + +# Ignite home +ENV IGNITE_HOME /opt/ignite/apache-ignite-fabric-${IGNITE_VERSION}-bin + +# Do not rely on anything provided by base image(s), but be explicit, if they are installed already it is noop then +RUN apt-get update && apt-get install -y --no-install-recommends \ +unzip \ +curl \ +&& rm -rf /var/lib/apt/lists/* + +WORKDIR /opt/ignite + +RUN curl http://www.us.apache.org/dist/ignite/${IGNITE_VERSION}/apache-ignite-fabric-${IGNITE_VERSION}-bin.zip -o ignite.zip \ +&& unzip ignite.zip \ +&& rm ignite.zip + +# Copy sh files and set permission +COPY ./run.sh $IGNITE_HOME/ + +RUN chmod +x $IGNITE_HOME/run.sh + +CMD $IGNITE_HOME/run.sh \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/77793f5e/modules/docker/1.6.0/run.sh -- diff --git a/modules/docker/1.6.0/run.sh b/modules/docker/1.6.0/run.sh new file mode 100644 index 000..3aafc30 --- /dev/null +++ b/modules/docker/1.6.0/run.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +if [ ! -z "$OPTION_LIBS" ]; then + IFS=, LIBS_LIST=("$OPTION_LIBS") + + for lib in ${LIBS_LIST[@]}; do +cp -r $IGNITE_HOME/libs/optional/"$lib"/* \ +$IGNITE_HOME/libs/ + done +fi + +if [ ! -z "$EXTERNAL_LIBS" ]; then + IFS=, LIBS_LIST=("$EXTERNAL_LIBS") + + for lib in ${LIBS_LIST[@]}; do +echo $lib >> temp + done + + wget -i temp -P $IGNITE_HOME/libs + + rm temp +fi + +QUIET="" + +if [ "$IGNITE_QUIET" = "false" ]; then + QUIET="-v" +fi + +if [ -z $CONFIG_URI ]; then + $IGNITE_HOME/bin/ignite.sh $QUIET +else + $IGNITE_HOME/bin/ignite.sh $QUIET $CONFIG_URI +fi + http://git-wip-us.apache.org/repos/asf/ignite/blob/77793f5e/modules/docker/Dockerfile -- diff --git a/modules/docker/Dockerfile b/modules/docker/Dockerfile index
ignite git commit: ignite-114
Repository: ignite Updated Branches: refs/heads/ignite-114 860acd896 -> e584a3a0c ignite-114 Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e584a3a0 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e584a3a0 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e584a3a0 Branch: refs/heads/ignite-114 Commit: e584a3a0c517bc428e74292b9f33320462afb580 Parents: 860acd8 Author: sboikovAuthored: Tue Jun 7 18:45:05 2016 +0300 Committer: sboikov Committed: Tue Jun 7 18:45:05 2016 +0300 -- .../cache/distributed/dht/GridDhtTxPrepareFuture.java | 3 +-- .../cache/IgniteCacheInvokeReadThroughAbstractTest.java | 7 +++ 2 files changed, 8 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/e584a3a0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java index 1eb767c..6b9ab6a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java @@ -334,8 +334,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuturehttp://git-wip-us.apache.org/repos/asf/ignite/blob/e584a3a0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java -- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java index 75ce70e..fb6c5c3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java @@ -90,6 +90,13 @@ public abstract class IgniteCacheInvokeReadThroughAbstractTest extends GridCommo IgniteCacheAbstractTest.storeMap.clear(); } +/** {@inheritDoc} */ +@Override protected void afterTestsStopped() throws Exception { +stopAllGrids(); + +super.afterTestsStopped(); +} + /** * @return Store factory. */
[1/4] ignite git commit: Preparing to improve flush logic.
Repository: ignite Updated Branches: refs/heads/ignite-3264 1e528b4dd -> fa2c585f8 Preparing to improve flush logic. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ff5b4749 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ff5b4749 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ff5b4749 Branch: refs/heads/ignite-3264 Commit: ff5b4749f56b7e7ff0bee653e056c3c365d43631 Parents: 1e528b4 Author: vozerov-gridgainAuthored: Tue Jun 7 17:10:30 2016 +0300 Committer: vozerov-gridgain Committed: Tue Jun 7 17:10:30 2016 +0300 -- .../processors/igfs/IgfsOutputStreamImpl.java | 25 1 file changed, 15 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/ff5b4749/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 fb2ed3b..0379848 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 @@ -224,9 +224,9 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { sendBufferIfNotEmpty(); -try { -flushRemainder(); +flushRemainder(); +try { if (space > 0) { igfsCtx.data().awaitAllAcksReceived(fileInfo.id()); @@ -243,7 +243,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { } } catch (IgniteCheckedException e) { -throw new IOException("Failed to flush data [path=" + path + ", space=" + space + ']', e); +throw new IOException("Failed to update file length data [path=" + path + ", space=" + space + ']', e); } } } @@ -251,15 +251,20 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { /** * Flush remainder. * - * @throws IgniteCheckedException If failed. + * @throws IOException If failed. */ -private void flushRemainder() throws IgniteCheckedException { -if (remainder != null) { -igfsCtx.data().storeDataBlocks(fileInfo, fileInfo.length() + space, null, 0, -ByteBuffer.wrap(remainder, 0, remainderDataLen), true, streamRange, batch); +private void flushRemainder() throws IOException { +try { +if (remainder != null) { +igfsCtx.data().storeDataBlocks(fileInfo, fileInfo.length() + space, null, 0, +ByteBuffer.wrap(remainder, 0, remainderDataLen), true, streamRange, batch); -remainder = null; -remainderDataLen = 0; +remainder = null; +remainderDataLen = 0; +} +} +catch (IgniteCheckedException e) { +throw new IOException("Failed to flush data (remainder) [path=" + path + ", space=" + space + ']', e); } }
[2/4] ignite git commit: WIP on close opto.
WIP on close opto. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dd4b471b Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dd4b471b Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dd4b471b Branch: refs/heads/ignite-3264 Commit: dd4b471bf6ae4026eb038500790781569fc1b933 Parents: ff5b474 Author: vozerov-gridgainAuthored: Tue Jun 7 17:28:45 2016 +0300 Committer: vozerov-gridgain Committed: Tue Jun 7 17:28:45 2016 +0300 -- .../configuration/FileSystemConfiguration.java | 34 +++ .../processors/igfs/IgfsOutputStreamImpl.java | 46 +++- 2 files changed, 69 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/dd4b471b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java index 625ba95..074636a 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java @@ -20,6 +20,7 @@ package org.apache.ignite.configuration; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.igfs.IgfsIpcEndpointConfiguration; import org.apache.ignite.igfs.IgfsMode; +import org.apache.ignite.igfs.IgfsOutputStream; import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; @@ -91,6 +92,9 @@ public class FileSystemConfiguration { /** Default value of relaxed consistency flag. */ public static final boolean DFLT_RELAXED_CONSISTENCY = true; +/** Default value of update file length on flush flag. */ +public static final boolean DFLT_UPDATE_FILE_LEN_ON_FLUSH = false; + /** IGFS instance name. */ private String name; @@ -178,6 +182,9 @@ public class FileSystemConfiguration { /** Relaxed consistency flag. */ private boolean relaxedConsistency = DFLT_RELAXED_CONSISTENCY; +/** Update file length on flush flag. */ +private boolean updateFileLenOnFlush = DFLT_UPDATE_FILE_LEN_ON_FLUSH; + /** * Constructs default configuration. */ @@ -225,6 +232,7 @@ public class FileSystemConfiguration { relaxedConsistency = cfg.isRelaxedConsistency(); seqReadsBeforePrefetch = cfg.getSequentialReadsBeforePrefetch(); trashPurgeTimeout = cfg.getTrashPurgeTimeout(); +updateFileLenOnFlush = cfg.isUpdateFileLengthOnFlush(); } /** @@ -922,6 +930,32 @@ public class FileSystemConfiguration { this.relaxedConsistency = relaxedConsistency; } +/** + * Get whether to update file length on flush. + * + * Controls whether to update file length or not when {@link IgfsOutputStream#flush()} method is invoked. You + * may want to set this property to true in case you want to read from a file which is being written at the + * same time. + * + * Defaults to {@link #DFLT_UPDATE_FILE_LEN_ON_FLUSH}. + * + * @return Whether to update file length on flush. + */ +public boolean isUpdateFileLengthOnFlush() { +return updateFileLenOnFlush; +} + +/** + * Set whether to update file length on flush. + * + * Set {@link #isUpdateFileLengthOnFlush()} for more information. + * + * @param updateFileLenOnFlush Whether to update file length on flush. + */ +public void setUpdateFileLengthOnFlush(boolean updateFileLenOnFlush) { +this.updateFileLenOnFlush = updateFileLenOnFlush; +} + /** {@inheritDoc} */ @Override public String toString() { return S.toString(FileSystemConfiguration.class, this); http://git-wip-us.apache.org/repos/asf/ignite/blob/dd4b471b/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 0379848..9436cc0 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 @@ -222,14 +222,11 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { synchronized
[3/4] ignite git commit: Reworked close logic.
Reworked close logic. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c066a24f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c066a24f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c066a24f Branch: refs/heads/ignite-3264 Commit: c066a24f1a30299eeef9fb773f692a10eb799288 Parents: dd4b471 Author: vozerov-gridgainAuthored: Tue Jun 7 17:53:38 2016 +0300 Committer: vozerov-gridgain Committed: Tue Jun 7 17:53:38 2016 +0300 -- .../processors/igfs/IgfsOutputStreamImpl.java | 143 --- 1 file changed, 62 insertions(+), 81 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/c066a24f/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 9436cc0..a7a53b3 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 @@ -23,7 +23,6 @@ import org.apache.ignite.igfs.IgfsException; import org.apache.ignite.igfs.IgfsMode; import org.apache.ignite.igfs.IgfsOutputStream; import org.apache.ignite.igfs.IgfsPath; -import org.apache.ignite.igfs.IgfsPathNotFoundException; import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; @@ -72,18 +71,15 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { private ByteBuffer buf; /** Bytes written. */ -@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized") private long bytes; /** Time consumed by write operations. */ private long time; /** File descriptor. */ -@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized") private IgfsEntryInfo fileInfo; /** Space in file to write data. */ -@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized") private long space; /** Intermediate remainder to keep data. */ @@ -222,7 +218,11 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { synchronized (mux) { checkClosed(null, 0); -flush0(); +sendBufferIfNotEmpty(); + +flushRemainder(); + +awaitAcks(); // Update file length if needed. if (igfsCtx.configuration().isUpdateFileLengthOnFlush() && space > 0) { @@ -247,15 +247,11 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { } /** - * Internal flush routine. + * Await acknowledgments. * * @throws IOException If failed. */ -private void flush0() throws IOException { -sendBufferIfNotEmpty(); - -flushRemainder(); - +private void awaitAcks() throws IOException { try { igfsCtx.data().awaitAllAcksReceived(fileInfo.id()); } @@ -285,98 +281,83 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { } /** {@inheritDoc} */ -@SuppressWarnings("ThrowFromFinallyBlock") @Override public final void close() throws IOException { synchronized (mux) { // Do nothing if stream is already closed. if (closed) return; -try { -// Send all IPC data from the local buffer. -try { -flush0(); +// Set closed flag immediately. +closed = true; -try { -if (space > 0) -igfsCtx.meta().reserveSpace(path, fileInfo.id(), space, streamRange); -} -catch (Exception e) { -// TODO. -} -} -finally { -if (batch != null) -batch.finish(); +// Flush data. +IOException err = null; -// Ensure file existence. -IOException err = null; +boolean flushSuccess = false; -try { -igfsCtx.data().writeClose(fileInfo.id(), true); -} -catch (IgniteCheckedException e) { -err = new IOException("Failed to close stream [path=" + path + -", fileInfo=" + fileInfo + ']', e); -} +
[4/4] ignite git commit: Preparing grounds for improved close routine.
Preparing grounds for improved close routine. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fa2c585f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fa2c585f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fa2c585f Branch: refs/heads/ignite-3264 Commit: fa2c585f830e725ce2bd5c1585a13ebe86793f40 Parents: c066a24 Author: vozerov-gridgainAuthored: Tue Jun 7 17:58:29 2016 +0300 Committer: vozerov-gridgain Committed: Tue Jun 7 17:58:29 2016 +0300 -- .../processors/igfs/IgfsMetaManager.java| 69 ++-- .../processors/igfs/IgfsOutputStreamImpl.java | 4 +- 2 files changed, 9 insertions(+), 64 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/fa2c585f/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 404d837..28aa2ca 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 @@ -44,7 +44,6 @@ import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager; -import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.GridCacheInternal; import org.apache.ignite.internal.processors.cache.IgniteInternalCache; import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; @@ -280,24 +279,6 @@ public class IgfsMetaManager extends IgfsManager { } /** - * Return nodes where meta cache is defined. - * - * @return Nodes where meta cache is defined. - */ -Collection metaCacheNodes() { -if (busyLock.enterBusy()) { -try { -return igfsCtx.kernalContext().discovery().cacheNodes(metaCache.name(), AffinityTopologyVersion.NONE); -} -finally { -busyLock.leaveBusy(); -} -} -else -throw new IllegalStateException("Failed to get meta cache nodes because Grid is stopping."); -} - -/** * Gets file ID for specified path. * * @param path Path. @@ -632,19 +613,17 @@ public class IgfsMetaManager extends IgfsManager { /** * Remove explicit lock on file held by the current thread. * - * @param info File info to unlock. + * @param fileId File ID. + * @param lockId Lock ID. * @param modificationTime Modification time to write to file info. * @throws IgniteCheckedException If failed. */ -public void unlock(final IgfsEntryInfo info, final long modificationTime) throws IgniteCheckedException { +public void unlock(final IgniteUuid fileId, final IgniteUuid lockId, final long modificationTime) +throws IgniteCheckedException { validTxState(false); -assert info != null; - if (busyLock.enterBusy()) { try { -final IgniteUuid lockId = info.lockId(); - if (lockId == null) return; @@ -656,8 +635,6 @@ public class IgfsMetaManager extends IgfsManager { @Override public Void applyx() throws IgniteCheckedException { validTxState(true); -IgniteUuid fileId = info.id(); - // Lock file ID for this transaction. IgfsEntryInfo oldInfo = info(fileId); @@ -665,9 +642,9 @@ public class IgfsMetaManager extends IgfsManager { throw fsException(new IgfsPathNotFoundException("Failed to unlock file (file not " + "found): " + fileId)); -if (!F.eq(info.lockId(), oldInfo.lockId())) +if (!F.eq(lockId, oldInfo.lockId())) throw new IgniteCheckedException("Failed to unlock file (inconsistent file lock ID) " + -"[fileId=" + fileId + ", lockId=" + info.lockId() + ", actualLockId=" + +"[fileId=" + fileId + ", lockId=" + lockId + ", actualLockId=" + oldInfo.lockId() + ']');
ignite git commit: IGNITE-3152
Repository: ignite Updated Branches: refs/heads/ignite-3152 [created] 79557259d IGNITE-3152 Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/79557259 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/79557259 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/79557259 Branch: refs/heads/ignite-3152 Commit: 79557259daa39a90d39de3e589e0591f1b77d881 Parents: 065d2e7 Author: Anton VinogradovAuthored: Tue Jun 7 17:56:34 2016 +0300 Committer: Anton Vinogradov Committed: Tue Jun 7 17:56:34 2016 +0300 -- .../ignite/spi/discovery/tcp/ServerImpl.java| 2 +- .../vm/TcpDiscoveryVmIpFinderSelfTest.java | 52 2 files changed, 53 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/79557259/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java index b7814e5..2af113d 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java @@ -4016,7 +4016,7 @@ class ServerImpl extends TcpDiscoveryImpl { notifyDiscovery(EVT_NODE_JOINED, topVer, node); try { -if (spi.ipFinder.isShared() && locNodeCoord) +if (spi.ipFinder.isShared() && locNodeCoord && !node.isClient()) spi.ipFinder.registerAddresses(node.socketAddresses()); } catch (IgniteSpiException e) { http://git-wip-us.apache.org/repos/asf/ignite/blob/79557259/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinderSelfTest.java -- diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinderSelfTest.java index 86587ba..4312e0b 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinderSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinderSelfTest.java @@ -19,9 +19,15 @@ package org.apache.ignite.spi.discovery.tcp.ipfinder.vm; import java.util.Arrays; import java.util.Collections; +import org.apache.ignite.Ignition; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.IgniteSpiException; +import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAbstractSelfTest; +import static org.apache.ignite.internal.processors.cache.binary.GridCacheBinaryObjectsAbstractSelfTest.IP_FINDER; + /** * GridTcpDiscoveryVmIpFinder test. */ @@ -190,4 +196,50 @@ public class TcpDiscoveryVmIpFinderSelfTest assertEquals("Registered addresses: " + finder.getRegisteredAddresses().toString(), 10, finder.getRegisteredAddresses().size()); } + +/** + * + */ +public void testUnregistration() throws Exception { +Ignition.start(config("server1", false)); + +int srvSize = IP_FINDER.getRegisteredAddresses().size(); + +Ignition.start(config("server2", false)); +Ignition.start(config("client1", true)); +Ignition.start(config("client2", true)); +Ignition.start(config("client3", true)); + +assertEquals(2 * srvSize, IP_FINDER.getRegisteredAddresses().size()); + +Ignition.stop("client1", true); +Ignition.stop("client2", true); + +assertEquals(2 * srvSize, IP_FINDER.getRegisteredAddresses().size()); + +Ignition.stop("server1", true); + +Ignition.stop("server2", true); + +assertTrue(2 * srvSize >= IP_FINDER.getRegisteredAddresses().size()); +} + +/** + * @param name Name. + * @param client Client. + */ +private static IgniteConfiguration config(String name, boolean client) { +IgniteConfiguration cfg = new IgniteConfiguration(); + +cfg.setGridName(name); +cfg.setClientMode(client); + +TcpDiscoverySpi disco = new TcpDiscoverySpi(); + +disco.setIpFinder(IP_FINDER); + +cfg.setDiscoverySpi(disco); + +return cfg; +} } \ No newline at end of file
ignite git commit: ignite-114
Repository: ignite Updated Branches: refs/heads/ignite-114 54dc05a3a -> 860acd896 ignite-114 Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/860acd89 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/860acd89 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/860acd89 Branch: refs/heads/ignite-114 Commit: 860acd89671b0699444ab95010650660c23f1ebf Parents: 54dc05a Author: sboikovAuthored: Tue Jun 7 15:49:17 2016 +0300 Committer: sboikov Committed: Tue Jun 7 16:55:19 2016 +0300 -- .../processors/cache/GridCacheAdapter.java | 10 +- .../processors/cache/GridCacheEntryEx.java | 4 +- .../processors/cache/GridCacheMapEntry.java | 5 +- .../distributed/dht/GridDhtCacheAdapter.java| 10 +- .../distributed/dht/GridDhtLockFuture.java | 27 +++- .../distributed/dht/GridDhtTxPrepareFuture.java | 10 +- .../dht/preloader/GridDhtForceKeysFuture.java | 3 +- .../dht/preloader/GridDhtPartitionDemander.java | 3 +- .../transactions/IgniteTxLocalAdapter.java | 4 +- .../datastreamer/DataStreamerImpl.java | 3 +- .../processors/cache/GridCacheTestEntryEx.java | 3 +- ...gniteCacheInvokeReadThroughAbstractTest.java | 151 ++- ...iteCacheInvokeReadThroughSingleNodeTest.java | 26 +++- .../cache/IgniteCacheInvokeReadThroughTest.java | 30 +++- 14 files changed, 252 insertions(+), 37 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/860acd89/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index f931c50..6e647c5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -3655,8 +3655,14 @@ public abstract class GridCacheAdapter implements IgniteInternalCache
ignite git commit: Removed "writeComplextoinFuture" field.
Repository: ignite Updated Branches: refs/heads/ignite-3264 153a63b79 -> 1e528b4dd Removed "writeComplextoinFuture" field. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1e528b4d Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1e528b4d Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1e528b4d Branch: refs/heads/ignite-3264 Commit: 1e528b4ddd7df720cb09c13136c294520293564d Parents: 153a63b Author: vozerov-gridgainAuthored: Tue Jun 7 17:07:00 2016 +0300 Committer: vozerov-gridgain Committed: Tue Jun 7 17:07:00 2016 +0300 -- .../processors/igfs/IgfsDataManager.java | 10 -- .../processors/igfs/IgfsOutputStreamImpl.java| 19 +++ .../processors/igfs/IgfsDataManagerSelfTest.java | 6 +++--- 3 files changed, 14 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/1e528b4d/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java index f470521..34d77f9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java @@ -494,12 +494,18 @@ public class IgfsDataManager extends IgfsManager { * Notifies data manager that no further writes will be performed on stream. * * @param fileId File ID. + * @param await Await completion. + * @throws IgniteCheckedException If failed. */ -public void writeClose(IgniteUuid fileId) { +public void writeClose(IgniteUuid fileId, boolean await) throws IgniteCheckedException { WriteCompletionFuture fut = pendingWrites.get(fileId); -if (fut != null) +if (fut != null) { fut.markWaitingLastAck(); + +if (await) +fut.get(); +} else { if (log.isDebugEnabled()) log.debug("Failed to find write completion future for file in pending write map (most likely it was " + http://git-wip-us.apache.org/repos/asf/ignite/blob/1e528b4d/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 a642d63..fb2ed3b 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 @@ -24,7 +24,6 @@ import org.apache.ignite.igfs.IgfsMode; import org.apache.ignite.igfs.IgfsOutputStream; import org.apache.ignite.igfs.IgfsPath; import org.apache.ignite.igfs.IgfsPathNotFoundException; -import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; @@ -63,9 +62,6 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { /** File worker batch. */ private final IgfsFileWorkerBatch batch; -/** Write completion future. */ -private final IgniteInternalFuture writeCompletionFut; - /** Mutex for synchronization. */ private final Object mux = new Object(); @@ -127,7 +123,8 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { this.batch = batch; streamRange = initialStreamRange(fileInfo); -writeCompletionFut = igfsCtx.data().writeStart(fileInfo.id()); + +igfsCtx.data().writeStart(fileInfo.id()); } igfsCtx.igfs().localMetrics().incrementFilesOpenedForWrite(); @@ -287,9 +284,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { IOException err = null; try { -igfsCtx.data().writeClose(fileInfo.id()); - -writeCompletionFut.get(); +igfsCtx.data().writeClose(fileInfo.id(), true); } catch (IgniteCheckedException e) { err = new IOException("Failed to close stream [path=" + path + @@ -418,14 +413,6 @@ class IgfsOutputStreamImpl extends IgfsOutputStream {
[2/2] ignite git commit: Minors.
Minors. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/153a63b7 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/153a63b7 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/153a63b7 Branch: refs/heads/ignite-3264 Commit: 153a63b7914435304320e8294d871965dbdda90f Parents: 7ba56f0 Author: vozerov-gridgainAuthored: Tue Jun 7 17:01:03 2016 +0300 Committer: vozerov-gridgain Committed: Tue Jun 7 17:01:03 2016 +0300 -- .../processors/igfs/IgfsDataManager.java| 20 ++-- .../processors/igfs/IgfsOutputStreamImpl.java | 8 +--- .../igfs/IgfsDataManagerSelfTest.java | 12 ++-- 3 files changed, 21 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/153a63b7/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java index 57a8c6c..f470521 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java @@ -473,18 +473,18 @@ public class IgfsDataManager extends IgfsManager { /** * Registers write future in igfs data manager. * - * @param fileInfo File info of file opened to write. + * @param fileId File ID. * @return Future that will be completed when all ack messages are received or when write failed. */ -public IgniteInternalFuture writeStart(IgfsEntryInfo fileInfo) { -WriteCompletionFuture fut = new WriteCompletionFuture(fileInfo.id()); +public IgniteInternalFuture writeStart(IgniteUuid fileId) { +WriteCompletionFuture fut = new WriteCompletionFuture(fileId); -WriteCompletionFuture oldFut = pendingWrites.putIfAbsent(fileInfo.id(), fut); +WriteCompletionFuture oldFut = pendingWrites.putIfAbsent(fileId, fut); -assert oldFut == null : "Opened write that is being concurrently written: " + fileInfo; +assert oldFut == null : "Opened write that is being concurrently written: " + fileId; if (log.isDebugEnabled()) -log.debug("Registered write completion future for file output stream [fileInfo=" + fileInfo + +log.debug("Registered write completion future for file output stream [fileId=" + fileId + ", fut=" + fut + ']'); return fut; @@ -493,17 +493,17 @@ public class IgfsDataManager extends IgfsManager { /** * Notifies data manager that no further writes will be performed on stream. * - * @param fileInfo File info being written. + * @param fileId File ID. */ -public void writeClose(IgfsEntryInfo fileInfo) { -WriteCompletionFuture fut = pendingWrites.get(fileInfo.id()); +public void writeClose(IgniteUuid fileId) { +WriteCompletionFuture fut = pendingWrites.get(fileId); if (fut != null) fut.markWaitingLastAck(); else { if (log.isDebugEnabled()) log.debug("Failed to find write completion future for file in pending write map (most likely it was " + -"failed): " + fileInfo); +"failed): " + fileId); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/153a63b7/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 9233715..a642d63 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 @@ -127,7 +127,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { this.batch = batch; streamRange = initialStreamRange(fileInfo); -writeCompletionFut = igfsCtx.data().writeStart(fileInfo); +writeCompletionFut = igfsCtx.data().writeStart(fileInfo.id()); } igfsCtx.igfs().localMetrics().incrementFilesOpenedForWrite(); @@ -267,6 +267,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { } /** {@inheritDoc} */ +@SuppressWarnings("ThrowFromFinallyBlock")
[1/2] ignite git commit: Simplification.
Repository: ignite Updated Branches: refs/heads/ignite-3264 99d244a30 -> 153a63b79 Simplification. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7ba56f04 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7ba56f04 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7ba56f04 Branch: refs/heads/ignite-3264 Commit: 7ba56f0421051a058a5f52983093a08c64b88ef2 Parents: 99d244a Author: vozerov-gridgainAuthored: Tue Jun 7 16:25:01 2016 +0300 Committer: vozerov-gridgain Committed: Tue Jun 7 16:25:01 2016 +0300 -- .../processors/igfs/IgfsOutputStreamImpl.java | 410 +-- 1 file changed, 190 insertions(+), 220 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/7ba56f04/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 b90e34d..9233715 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 @@ -26,7 +26,6 @@ import org.apache.ignite.igfs.IgfsPath; import org.apache.ignite.igfs.IgfsPathNotFoundException; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager; -import org.apache.ignite.internal.util.future.GridFutureAdapter; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; @@ -36,7 +35,6 @@ import org.jetbrains.annotations.Nullable; import java.io.DataInput; import java.io.IOException; import java.nio.ByteBuffer; -import java.util.concurrent.atomic.AtomicBoolean; import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_CLOSED_WRITE; import static org.apache.ignite.igfs.IgfsMode.DUAL_SYNC; @@ -68,12 +66,6 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { /** Write completion future. */ private final IgniteInternalFuture writeCompletionFut; -/** Ensures that onClose)_ routine is called no more than once. */ -private final AtomicBoolean onCloseGuard = new AtomicBoolean(); - -/** Close guard. */ -private final AtomicBoolean closeGuard = new AtomicBoolean(false); - /** Mutex for synchronization. */ private final Object mux = new Object(); @@ -146,17 +138,16 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { synchronized (mux) { checkClosed(null, 0); -long startTime = System.nanoTime(); - b &= 0xFF; +long startTime = System.nanoTime(); + if (buf == null) -buf = ByteBuffer.allocate(bufSize); +buf = allocateNewBuffer(); buf.put((byte)b); -if (buf.position() >= bufSize) -sendData(true); // Send data to server. +sendBufferIfFull(); time += System.nanoTime() - startTime; } @@ -175,35 +166,34 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { synchronized (mux) { checkClosed(null, 0); +// Check if there is anything to write. if (len == 0) -return; // Done. +return; long startTime = System.nanoTime(); if (buf == null) { -// Do not allocate and copy byte buffer if will send data immediately. if (len >= bufSize) { -buf = ByteBuffer.wrap(b, off, len); - -sendData(false); +// Send data right away. +ByteBuffer tmpBuf = ByteBuffer.wrap(b, off, len); -return; +send(tmpBuf, tmpBuf.remaining()); } +else { +buf = allocateNewBuffer(); -buf = ByteBuffer.allocate(Math.max(bufSize, len)); +buf.put(b, off, len); +} } +else { +// Re-allocate buffer if needed. +if (buf.remaining() < len) +buf = ByteBuffer.allocate(buf.position() + len).put((ByteBuffer)buf.flip()); -if (buf.remaining() < len) -// Expand buffer capacity, if remaining size is less then data size. -buf = ByteBuffer.allocate(buf.position() +
ignite git commit: ignite-114
Repository: ignite Updated Branches: refs/heads/ignite-114 [created] 54dc05a3a ignite-114 Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/54dc05a3 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/54dc05a3 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/54dc05a3 Branch: refs/heads/ignite-114 Commit: 54dc05a3aeb5080c441aa14ccd577f417baa8d8d Parents: 065d2e7 Author: sboikovAuthored: Tue Jun 7 11:46:32 2016 +0300 Committer: sboikov Committed: Tue Jun 7 15:01:09 2016 +0300 -- .../processors/cache/GridCacheAdapter.java | 24 +- .../processors/cache/GridCacheEntryEx.java | 5 - .../processors/cache/GridCacheMapEntry.java | 104 .../processors/cache/GridCacheUtils.java| 3 + .../dht/GridDhtTransactionalCacheAdapter.java | 2 - .../distributed/dht/GridDhtTxPrepareFuture.java | 20 +- .../dht/GridPartitionedGetFuture.java | 2 - .../dht/GridPartitionedSingleGetFuture.java | 2 - .../dht/atomic/GridDhtAtomicCache.java | 8 - .../dht/colocated/GridDhtColocatedCache.java| 2 - .../distributed/near/GridNearGetFuture.java | 4 - .../local/atomic/GridLocalAtomicCache.java | 8 - .../cache/transactions/IgniteTxAdapter.java | 2 - .../cache/transactions/IgniteTxEntry.java | 24 +- .../transactions/IgniteTxLocalAdapter.java | 24 +- .../processors/cache/GridCacheTestEntryEx.java | 2 - .../cache/IgniteCacheAbstractTest.java | 2 +- ...gniteCacheInvokeReadThroughAbstractTest.java | 236 +++ ...iteCacheInvokeReadThroughSingleNodeTest.java | 76 ++ .../cache/IgniteCacheInvokeReadThroughTest.java | 120 -- .../IgniteCacheLoaderWriterAbstractTest.java| 10 + .../testsuites/IgniteCacheTestSuite4.java | 2 + 22 files changed, 477 insertions(+), 205 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/54dc05a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index 6ccb506..f931c50 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -5102,19 +5102,17 @@ public abstract class GridCacheAdapter implements IgniteInternalCache
ignite git commit: Fixed compilation
Repository: ignite Updated Branches: refs/heads/master 83f9fd08b -> 18d4ecc44 Fixed compilation Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/18d4ecc4 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/18d4ecc4 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/18d4ecc4 Branch: refs/heads/master Commit: 18d4ecc44a895ca0add46e15d01bd547fda96d85 Parents: 83f9fd0 Author: Valentin KulichenkoAuthored: Tue Jun 7 14:09:19 2016 +0300 Committer: Valentin Kulichenko Committed: Tue Jun 7 14:09:19 2016 +0300 -- .../src/main/scala/org/apache/ignite/spark/JavaIgniteRDD.scala | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/18d4ecc4/modules/spark/src/main/scala/org/apache/ignite/spark/JavaIgniteRDD.scala -- diff --git a/modules/spark/src/main/scala/org/apache/ignite/spark/JavaIgniteRDD.scala b/modules/spark/src/main/scala/org/apache/ignite/spark/JavaIgniteRDD.scala index cac0e15..acc163a 100644 --- a/modules/spark/src/main/scala/org/apache/ignite/spark/JavaIgniteRDD.scala +++ b/modules/spark/src/main/scala/org/apache/ignite/spark/JavaIgniteRDD.scala @@ -82,12 +82,14 @@ class JavaIgniteRDD[K, V](override val rdd: IgniteRDD[K, V]) def saveValues[T](jrdd: JavaRDD[T], f: (T, IgniteContext[K, V]) â V) = rdd.saveValues(JavaRDD.toRDD(jrdd), f) -def savePairs(jrdd: JavaPairRDD[K, V]) = { +def savePairs(jrdd: JavaPairRDD[K, V], overwrite: Boolean) = { val rrdd: RDD[(K, V)] = JavaPairRDD.toRDD(jrdd) -rdd.savePairs(rrdd) +rdd.savePairs(rrdd, overwrite) } +def savePairs(jrdd: JavaPairRDD[K, V]) : Unit = savePairs(jrdd, overwrite = false) + def savePairs[T](jrdd: JavaRDD[T], f: (T, IgniteContext[K, V]) â (K, V), overwrite: Boolean = false) = { rdd.savePairs(JavaRDD.toRDD(jrdd), f, overwrite) }
[07/14] ignite git commit: Simplified ctor.
Simplified ctor. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/04e311b8 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/04e311b8 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/04e311b8 Branch: refs/heads/ignite-3264 Commit: 04e311b8cef3dd8e3dd1c27f8f4d5816bcc916db Parents: a76b349 Author: vozerov-gridgainAuthored: Mon Jun 6 12:07:05 2016 +0300 Committer: vozerov-gridgain Committed: Mon Jun 6 12:07:05 2016 +0300 -- .../processors/igfs/IgfsOutputStreamImpl.java | 25 +++- 1 file changed, 9 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/04e311b8/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 8c93aad..13808ea 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 @@ -119,33 +119,26 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { */ IgfsOutputStreamImpl(IgfsContext igfsCtx, IgfsPath path, IgfsEntryInfo fileInfo, int bufSize, IgfsMode mode, @Nullable IgfsFileWorkerBatch batch) { +assert fileInfo != null && fileInfo.isFile() : "Unexpected file info: " + fileInfo; +assert mode != null && mode != PROXY && (mode == PRIMARY && batch == null || batch != null); + +// File hasn't been locked. +if (fileInfo.lockId() == null) +throw new IgfsException("Failed to acquire file lock (concurrently modified?): " + path); + synchronized (mux) { this.path = path; this.bufSize = optimizeBufferSize(bufSize, fileInfo); - -assert fileInfo != null; -assert fileInfo.isFile() : "Unexpected file info: " + fileInfo; -assert mode != null && mode != PROXY; -assert mode == PRIMARY && batch == null || batch != null; - -// File hasn't been locked. -if (fileInfo.lockId() == null) -throw new IgfsException("Failed to acquire file lock (concurrently modified?): " + path); - -assert !IgfsUtils.DELETE_LOCK_ID.equals(fileInfo.lockId()); - this.igfsCtx = igfsCtx; - this.fileInfo = fileInfo; this.mode = mode; this.batch = batch; streamRange = initialStreamRange(fileInfo); - writeCompletionFut = igfsCtx.data().writeStart(fileInfo); - -igfsCtx.igfs().localMetrics().incrementFilesOpenedForWrite(); } + +igfsCtx.igfs().localMetrics().incrementFilesOpenedForWrite(); } /** {@inheritDoc} */
[03/14] ignite git commit: Got rid of warns.
Got rid of warns. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/75b60800 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/75b60800 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/75b60800 Branch: refs/heads/ignite-3264 Commit: 75b608003baa74f76a5c2537b5f1cf01bab0ed38 Parents: d3a432c Author: vozerov-gridgainAuthored: Mon Jun 6 11:57:31 2016 +0300 Committer: vozerov-gridgain Committed: Mon Jun 6 11:57:31 2016 +0300 -- .../ignite/internal/processors/igfs/IgfsOutputStreamImpl.java | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/75b60800/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 7363ffe..c50c431 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 @@ -485,6 +485,8 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { // Await secondary file system processing to finish. if (mode == DUAL_SYNC) { try { +assert batch != null; + batch.await(); } catch (IgniteCheckedException e) { @@ -513,8 +515,11 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { } else { try { -if (mode == DUAL_SYNC) +if (mode == DUAL_SYNC) { +assert batch != null; + batch.await(); +} } catch (IgniteCheckedException e) { throw new IOException("Failed to close secondary file system stream [path=" + path +
[10/14] ignite git commit: IGNITE-3260: IGFS: Delete messages are no longer passed.
IGNITE-3260: IGFS: Delete messages are no longer passed. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/065d2e70 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/065d2e70 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/065d2e70 Branch: refs/heads/ignite-3264 Commit: 065d2e70c21418437eba5e725eaa8b1ebc3af6da Parents: 0176af1 Author: vozerov-gridgainAuthored: Mon Jun 6 18:12:42 2016 +0300 Committer: vozerov-gridgain Committed: Mon Jun 6 18:12:42 2016 +0300 -- .../internal/processors/igfs/IgfsAsyncImpl.java | 6 - .../processors/igfs/IgfsDataManager.java| 61 ++--- .../processors/igfs/IgfsDeleteWorker.java | 42 .../ignite/internal/processors/igfs/IgfsEx.java | 9 - .../internal/processors/igfs/IgfsImpl.java | 249 +-- .../internal/processors/igfs/IgfsUtils.java | 2 +- .../ignite/igfs/IgfsFragmentizerSelfTest.java | 2 - .../processors/igfs/IgfsSizeSelfTest.java | 133 -- .../HadoopDefaultMapReducePlannerSelfTest.java | 6 - 9 files changed, 83 insertions(+), 427 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/065d2e70/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java index 8653f90..7530557 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java @@ -33,7 +33,6 @@ import org.apache.ignite.igfs.mapreduce.IgfsRecordResolver; import org.apache.ignite.igfs.mapreduce.IgfsTask; import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem; import org.apache.ignite.internal.AsyncSupportAdapter; -import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteUuid; import org.jetbrains.annotations.Nullable; @@ -166,11 +165,6 @@ public class IgfsAsyncImpl extends AsyncSupportAdapter impleme } /** {@inheritDoc} */ -@Override public IgniteInternalFuture awaitDeletesAsync() throws IgniteCheckedException { -return igfs.awaitDeletesAsync(); -} - -/** {@inheritDoc} */ @Nullable @Override public String clientLogDirectory() { return igfs.clientLogDirectory(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/065d2e70/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java index 16fbeb8..57a8c6c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java @@ -33,7 +33,6 @@ import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper; import org.apache.ignite.igfs.IgfsOutOfSpaceException; import org.apache.ignite.igfs.IgfsPath; import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystemPositionedReadable; -import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException; @@ -1056,34 +1055,24 @@ public class IgfsDataManager extends IgfsManager { private void processPartialBlockWrite(IgniteUuid fileId, IgfsBlockKey colocatedKey, int startOff, byte[] data) throws IgniteCheckedException { if (dataCachePrj.igfsDataSpaceUsed() >= dataCachePrj.igfsDataSpaceMax()) { -try { -igfs.awaitDeletesAsync().get(trashPurgeTimeout); -} -catch (IgniteFutureTimeoutCheckedException ignore) { -// Ignore. -} +final WriteCompletionFuture completionFut = pendingWrites.get(fileId); -// Additional size check. -if (dataCachePrj.igfsDataSpaceUsed() >= dataCachePrj.igfsDataSpaceMax()) { -final WriteCompletionFuture completionFut = pendingWrites.get(fileId); - -if (completionFut == null) { -if (log.isDebugEnabled()) -log.debug("Missing
[14/14] ignite git commit: WIP.
WIP. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/99d244a3 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/99d244a3 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/99d244a3 Branch: refs/heads/ignite-3264 Commit: 99d244a3009a5bcf347ce09da145a8f6cc3dc19f Parents: cd92c9e Author: vozerov-gridgainAuthored: Tue Jun 7 10:55:21 2016 +0300 Committer: vozerov-gridgain Committed: Tue Jun 7 10:55:21 2016 +0300 -- .../processors/igfs/IgfsMetaManager.java| 341 +++ 1 file changed, 203 insertions(+), 138 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/99d244a3/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 465116b..404d837 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 @@ -1882,121 +1882,8 @@ public class IgfsMetaManager extends IgfsManager { // Events to fire (can be done outside of a transaction). final Deque pendingEvts = new LinkedList<>(); -SynchronizationTask task = -new SynchronizationTask() { -/** Output stream to the secondary file system. */ -private OutputStream out; - -@Override public IgfsSecondaryOutputStreamDescriptor onSuccess(Map infos) throws Exception { -validTxState(true); - -assert !infos.isEmpty(); - -// Determine the first existing parent. -IgfsPath parentPath = null; - -for (IgfsPath curPath : infos.keySet()) { -if (parentPath == null || curPath.isSubDirectoryOf(parentPath)) -parentPath = curPath; -} - -assert parentPath != null; - -IgfsEntryInfo parentInfo = infos.get(parentPath); - -// Delegate to the secondary file system. -out = simpleCreate ? fs.create(path, overwrite) : -fs.create(path, bufSize, overwrite, replication, blockSize, props); - -IgfsPath parent0 = path.parent(); - -assert parent0 != null : "path.parent() is null (are we creating ROOT?): " + path; - -// If some of the parent directories were missing, synchronize again. -if (!parentPath.equals(parent0)) { -parentInfo = synchronize(fs, parentPath, parentInfo, parent0, true, null); - -// Fire notification about missing directories creation. -if (evts.isRecordable(EventType.EVT_IGFS_DIR_CREATED)) { -IgfsPath evtPath = parent0; - -while (!parentPath.equals(evtPath)) { -pendingEvts.addFirst(new IgfsEvent(evtPath, locNode, -EventType.EVT_IGFS_DIR_CREATED)); - -evtPath = evtPath.parent(); - -assert evtPath != null; // If this fails, then ROOT does not exist. -} -} -} - -// Get created file info. -IgfsFile status = fs.info(path); - -if (status == null) -throw fsException("Failed to open output stream to the file created in " + -"the secondary file system because it no longer exists: " + path); -else if (status.isDirectory()) -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 newInfo = IgfsUtils.createFile( -
[12/14] ignite git commit: Minors.
Minors. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/93f8eca5 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/93f8eca5 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/93f8eca5 Branch: refs/heads/ignite-3264 Commit: 93f8eca53008849ccfe609b5c7e5c20425f530e7 Parents: da1ff65 Author: vozerov-gridgainAuthored: Tue Jun 7 09:57:07 2016 +0300 Committer: vozerov-gridgain Committed: Tue Jun 7 09:57:07 2016 +0300 -- .../main/java/org/apache/ignite/internal/IgniteKernal.java| 6 +++--- .../ignite/internal/processors/igfs/IgfsOutputStreamImpl.java | 7 --- 2 files changed, 7 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/93f8eca5/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java index d257807..d1f3ef5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java @@ -862,9 +862,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { startProcessor(new DataStreamProcessor(ctx)); startProcessor((GridProcessor)IGFS.create(ctx, F.isEmpty(cfg.getFileSystemConfiguration(; startProcessor(new GridContinuousProcessor(ctx)); -//startProcessor((GridProcessor)(cfg.isPeerClassLoadingEnabled() ? -//IgniteComponentType.HADOOP.create(ctx, true): // No-op when peer class loading is enabled. -//IgniteComponentType.HADOOP.createIfInClassPath(ctx, cfg.getHadoopConfiguration() != null))); +startProcessor((GridProcessor)(cfg.isPeerClassLoadingEnabled() ? +IgniteComponentType.HADOOP.create(ctx, true): // No-op when peer class loading is enabled. +IgniteComponentType.HADOOP.createIfInClassPath(ctx, cfg.getHadoopConfiguration() != null))); startProcessor(new DataStructuresProcessor(ctx)); startProcessor(createComponent(PlatformProcessor.class, ctx)); http://git-wip-us.apache.org/repos/asf/ignite/blob/93f8eca5/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 16a20a2..f51e9b5 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 @@ -271,12 +271,12 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { */ @Override public void flush() throws IOException { synchronized (mux) { - boolean exists; try { exists = igfsCtx.meta().exists(fileInfo.id()); -} catch (IgniteCheckedException e) { +} +catch (IgniteCheckedException e) { throw new IOException("File to read file metadata: " + path, e); } @@ -315,7 +315,8 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { space = 0; } -} catch (IgniteCheckedException e) { +} +catch (IgniteCheckedException e) { throw new IOException("Failed to flush data [path=" + path + ", space=" + space + ']', e); } }
[01/14] ignite git commit: WIP on output stream optos.
Repository: ignite Updated Branches: refs/heads/ignite-3264 [created] 99d244a30 WIP on output stream optos. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3cd33732 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3cd33732 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3cd33732 Branch: refs/heads/ignite-3264 Commit: 3cd337329a3e3df1c7deb97742833f55ea1c6821 Parents: e409b67 Author: vozerov-gridgainAuthored: Mon Jun 6 11:52:07 2016 +0300 Committer: vozerov-gridgain Committed: Mon Jun 6 11:52:07 2016 +0300 -- .../apache/ignite/internal/IgniteKernal.java| 6 +- .../internal/processors/igfs/IgfsImpl.java | 48 +-- .../igfs/IgfsOutputStreamAdapter.java | 265 - .../processors/igfs/IgfsOutputStreamImpl.java | 385 ++- 4 files changed, 298 insertions(+), 406 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/3cd33732/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java index d1f3ef5..d257807 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java @@ -862,9 +862,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { startProcessor(new DataStreamProcessor(ctx)); startProcessor((GridProcessor)IGFS.create(ctx, F.isEmpty(cfg.getFileSystemConfiguration(; startProcessor(new GridContinuousProcessor(ctx)); -startProcessor((GridProcessor)(cfg.isPeerClassLoadingEnabled() ? -IgniteComponentType.HADOOP.create(ctx, true): // No-op when peer class loading is enabled. -IgniteComponentType.HADOOP.createIfInClassPath(ctx, cfg.getHadoopConfiguration() != null))); +//startProcessor((GridProcessor)(cfg.isPeerClassLoadingEnabled() ? +//IgniteComponentType.HADOOP.create(ctx, true): // No-op when peer class loading is enabled. +//IgniteComponentType.HADOOP.createIfInClassPath(ctx, cfg.getHadoopConfiguration() != null))); startProcessor(new DataStructuresProcessor(ctx)); startProcessor(createComponent(PlatformProcessor.class, ctx)); http://git-wip-us.apache.org/repos/asf/ignite/blob/3cd33732/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 9087ff0..bc2e087 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 @@ -1077,8 +1077,8 @@ public final class IgfsImpl implements IgfsEx { batch = newBatch(path, desc.out()); -IgfsEventAwareOutputStream os = new IgfsEventAwareOutputStream(path, desc.info(), -bufferSize(bufSize), mode, batch); +IgfsOutputStreamImpl os = new IgfsOutputStreamImpl(igfsCtx, path, desc.info(), +bufferSize(bufSize), mode, batch, metrics); IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, EVT_IGFS_FILE_OPENED_WRITE); @@ -1107,7 +1107,7 @@ public final class IgfsImpl implements IgfsEx { assert res != null; -return new IgfsEventAwareOutputStream(path, res, bufferSize(bufSize), mode, null); +return new IgfsOutputStreamImpl(igfsCtx, path, res, bufferSize(bufSize), mode, null, metrics); } }); } @@ -1142,7 +1142,8 @@ public final class IgfsImpl implements IgfsEx { batch = newBatch(path, desc.out()); -return new IgfsEventAwareOutputStream(path, desc.info(), bufferSize(bufSize), mode, batch); +return new IgfsOutputStreamImpl(igfsCtx, path, desc.info(), bufferSize(bufSize), mode, batch, +metrics); } final List ids = meta.idsForPath(path); @@ -1183,7 +1184,7 @@ public final class IgfsImpl implements IgfsEx { assert res != null; -return new IgfsEventAwareOutputStream(path, res, bufferSize(bufSize), mode, null); +return new
[04/14] ignite git commit: Protected -> private.
Protected -> private. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b6c6b488 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b6c6b488 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b6c6b488 Branch: refs/heads/ignite-3264 Commit: b6c6b488608acbe0dc4009134b49cf0187f8a250 Parents: 75b6080 Author: vozerov-gridgainAuthored: Mon Jun 6 12:01:26 2016 +0300 Committer: vozerov-gridgain Committed: Mon Jun 6 12:01:26 2016 +0300 -- .../processors/igfs/IgfsOutputStreamImpl.java | 64 ++-- 1 file changed, 32 insertions(+), 32 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/b6c6b488/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 c50c431..98ccb81 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 @@ -51,23 +51,23 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { private static final int MAX_BLOCKS_CNT = 16; /** Path to file. */ -protected final IgfsPath path; +private final IgfsPath path; /** Buffer size. */ -protected final int bufSize; +private final int bufSize; /** Flag for this stream open/closed state. */ -protected boolean closed; +private boolean closed; /** Local buffer to store stream data as consistent block. */ -protected ByteBuffer buf; +private ByteBuffer buf; /** Bytes written. */ @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized") -protected long bytes; +private long bytes; /** Time consumed by write operations. */ -protected long time; +private long time; /** IGFS context. */ private IgfsContext igfsCtx; @@ -342,33 +342,13 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { } /** - * Initializes data loader if it was not initialized yet and updates written space. - * - * @param len Data length to be written. - */ -private void preStoreDataBlocks(@Nullable DataInput in, int len) throws IgniteCheckedException, IOException { -// Check if any exception happened while writing data. -if (writeCompletionFut.isDone()) { -assert ((GridFutureAdapter)writeCompletionFut).isFailed(); - -if (in != null) -in.skipBytes(len); - -writeCompletionFut.get(); -} - -bytes += len; -space += len; -} - -/** * Store data block. * * @param block Block. * @throws IgniteCheckedException If failed. * @throws IOException If failed. */ -protected void storeDataBlock(ByteBuffer block) throws IgniteCheckedException, IOException { +private void storeDataBlock(ByteBuffer block) throws IgniteCheckedException, IOException { assert Thread.holdsLock(mux); int writeLen = block.remaining(); @@ -411,7 +391,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { * @throws IgniteCheckedException If failed. * @throws IOException If failed. */ -protected void storeDataBlocks(DataInput in, int len) throws IgniteCheckedException, IOException { +private void storeDataBlocks(DataInput in, int len) throws IgniteCheckedException, IOException { assert Thread.holdsLock(mux); preStoreDataBlocks(in, len); @@ -445,6 +425,26 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { } /** + * Initializes data loader if it was not initialized yet and updates written space. + * + * @param len Data length to be written. + */ +private void preStoreDataBlocks(@Nullable DataInput in, int len) throws IgniteCheckedException, IOException { +// Check if any exception happened while writing data. +if (writeCompletionFut.isDone()) { +assert ((GridFutureAdapter)writeCompletionFut).isFailed(); + +if (in != null) +in.skipBytes(len); + +writeCompletionFut.get(); +} + +bytes += len; +space += len; +} + +/** * Close callback. It will be called only once in synchronized section. * * @param deleted Whether we already know that the file was deleted. @@ -537,7 +537,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { * * @throws
[06/14] ignite git commit: Removed more unnecessary fields.
Removed more unnecessary fields. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a76b3492 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a76b3492 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a76b3492 Branch: refs/heads/ignite-3264 Commit: a76b3492b6c1312c7c3b7bac0b302dba788e4fba Parents: 5949abe Author: vozerov-gridgainAuthored: Mon Jun 6 12:05:28 2016 +0300 Committer: vozerov-gridgain Committed: Mon Jun 6 12:05:28 2016 +0300 -- .../ignite/internal/processors/igfs/IgfsImpl.java | 9 - .../processors/igfs/IgfsOutputStreamImpl.java | 14 -- 2 files changed, 8 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/a76b3492/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 bc2e087..5e2bca0 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 @@ -1078,7 +1078,7 @@ public final class IgfsImpl implements IgfsEx { batch = newBatch(path, desc.out()); IgfsOutputStreamImpl os = new IgfsOutputStreamImpl(igfsCtx, path, desc.info(), -bufferSize(bufSize), mode, batch, metrics); +bufferSize(bufSize), mode, batch); IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, EVT_IGFS_FILE_OPENED_WRITE); @@ -1107,7 +1107,7 @@ public final class IgfsImpl implements IgfsEx { assert res != null; -return new IgfsOutputStreamImpl(igfsCtx, path, res, bufferSize(bufSize), mode, null, metrics); +return new IgfsOutputStreamImpl(igfsCtx, path, res, bufferSize(bufSize), mode, null); } }); } @@ -1142,8 +1142,7 @@ public final class IgfsImpl implements IgfsEx { batch = newBatch(path, desc.out()); -return new IgfsOutputStreamImpl(igfsCtx, path, desc.info(), bufferSize(bufSize), mode, batch, -metrics); +return new IgfsOutputStreamImpl(igfsCtx, path, desc.info(), bufferSize(bufSize), mode, batch); } final List ids = meta.idsForPath(path); @@ -1184,7 +1183,7 @@ public final class IgfsImpl implements IgfsEx { assert res != null; -return new IgfsOutputStreamImpl(igfsCtx, path, res, bufferSize(bufSize), mode, null, metrics); +return new IgfsOutputStreamImpl(igfsCtx, path, res, bufferSize(bufSize), mode, null); } }); } http://git-wip-us.apache.org/repos/asf/ignite/blob/a76b3492/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 bc32e81..8c93aad 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 @@ -98,9 +98,6 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { /** Ensures that onClose)_ routine is called no more than once. */ private final AtomicBoolean onCloseGuard = new AtomicBoolean(); -/** Local IGFS metrics. */ -private final IgfsLocalMetrics metrics; - /** Affinity written by this output stream. */ private IgfsFileAffinityRange streamRange; @@ -119,10 +116,9 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { * @param bufSize The size of the buffer to be used. * @param mode Grid IGFS mode. * @param batch Optional secondary file system batch. - * @param metrics Local IGFS metrics. */ IgfsOutputStreamImpl(IgfsContext igfsCtx, IgfsPath path, IgfsEntryInfo fileInfo, int bufSize, IgfsMode mode, -@Nullable IgfsFileWorkerBatch batch, IgfsLocalMetrics metrics) { +@Nullable IgfsFileWorkerBatch batch) { synchronized (mux) { this.path = path; this.bufSize = optimizeBufferSize(bufSize, fileInfo); @@ -131,7 +127,6 @@ class IgfsOutputStreamImpl extends IgfsOutputStream {
[09/14] ignite git commit: IGNITE-3259: Delete worker is not started on client nodes any more.
IGNITE-3259: Delete worker is not started on client nodes any more. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0176af13 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0176af13 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0176af13 Branch: refs/heads/ignite-3264 Commit: 0176af13646a09541d65a10cf7ec0641c71e2ca7 Parents: 5254957 Author: vozerov-gridgainAuthored: Mon Jun 6 18:10:36 2016 +0300 Committer: vozerov-gridgain Committed: Mon Jun 6 18:10:36 2016 +0300 -- .../processors/igfs/IgfsMetaManager.java| 25 ++-- 1 file changed, 18 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/0176af13/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 1dd4c53..465116b 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 @@ -207,19 +207,20 @@ public class IgfsMetaManager extends IgfsManager { locNode = igfsCtx.kernalContext().discovery().localNode(); // Start background delete worker. -delWorker = new IgfsDeleteWorker(igfsCtx); +if (!client) { +delWorker = new IgfsDeleteWorker(igfsCtx); -delWorker.start(); +delWorker.start(); +} } /** {@inheritDoc} */ @Override protected void onKernalStop0(boolean cancel) { IgfsDeleteWorker delWorker0 = delWorker; -if (delWorker0 != null) +if (delWorker0 != null) { delWorker0.cancel(); -if (delWorker0 != null) { try { U.join(delWorker0); } @@ -1136,7 +1137,7 @@ public class IgfsMetaManager extends IgfsManager { tx.commit(); -delWorker.signal(); +signalDeleteWorker(); return newInfo.id(); } @@ -1212,7 +1213,7 @@ public class IgfsMetaManager extends IgfsManager { tx.commit(); -delWorker.signal(); +signalDeleteWorker(); return victimId; } @@ -2476,7 +2477,7 @@ public class IgfsMetaManager extends IgfsManager { Boolean res = synchronizeAndExecute(task, fs, false, Collections.singleton(trashId), path); -delWorker.signal(); +signalDeleteWorker(); return res; } @@ -3341,4 +3342,14 @@ public class IgfsMetaManager extends IgfsManager { else IgfsUtils.sendEvents(igfsCtx.kernalContext(), leafPath, EventType.EVT_IGFS_DIR_CREATED); } + +/** + * Signal delete worker thread. + */ +private void signalDeleteWorker() { +IgfsDeleteWorker delWorker0 = delWorker; + +if (delWorker0 != null) +delWorker0.signal(); +} } \ No newline at end of file
[11/14] ignite git commit: Merge branch 'gridgain-7.5.25' into gridgain-7.5.25-out-refactor
Merge branch 'gridgain-7.5.25' into gridgain-7.5.25-out-refactor Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/da1ff65a Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/da1ff65a Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/da1ff65a Branch: refs/heads/ignite-3264 Commit: da1ff65afc39c7b2dab4246551d2db25c21d7baa Parents: f6fd3b8 065d2e7 Author: vozerov-gridgainAuthored: Tue Jun 7 09:55:11 2016 +0300 Committer: vozerov-gridgain Committed: Tue Jun 7 09:55:11 2016 +0300 -- .../configuration/FileSystemConfiguration.java | 2 +- .../ignite/internal/binary/BinaryUtils.java | 16 ++ .../processors/cache/CacheObjectContext.java| 3 + .../internal/processors/igfs/IgfsAsyncImpl.java | 6 - .../processors/igfs/IgfsDataManager.java| 61 ++--- .../processors/igfs/IgfsDeleteWorker.java | 42 .../ignite/internal/processors/igfs/IgfsEx.java | 9 - .../internal/processors/igfs/IgfsImpl.java | 249 +-- .../processors/igfs/IgfsInputStreamImpl.java| 6 +- ...zySecondaryFileSystemPositionedReadable.java | 77 ++ .../processors/igfs/IgfsMetaManager.java| 43 +++- .../internal/processors/igfs/IgfsUtils.java | 2 +- .../ignite/igfs/IgfsFragmentizerSelfTest.java | 2 - .../GridCacheBinaryObjectsAbstractSelfTest.java | 78 +- .../processors/igfs/IgfsAbstractSelfTest.java | 3 + .../processors/igfs/IgfsModesSelfTest.java | 1 + .../processors/igfs/IgfsSizeSelfTest.java | 133 -- .../unsafe/GridOffheapSnapTreeSelfTest.java | 2 +- .../igfs/HadoopFIleSystemFactorySelfTest.java | 1 + .../HadoopDefaultMapReducePlannerSelfTest.java | 6 - .../query/h2/opt/GridH2AbstractKeyValueRow.java | 23 +- .../query/h2/opt/GridH2KeyValueRowOffheap.java | 17 +- .../cache/IgniteCacheOffheapIndexScanTest.java | 195 +++ .../IgniteCacheQuerySelfTestSuite.java | 2 + 24 files changed, 522 insertions(+), 457 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/da1ff65a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java --
[08/14] ignite git commit: WIP.
WIP. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f6fd3b84 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f6fd3b84 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f6fd3b84 Branch: refs/heads/ignite-3264 Commit: f6fd3b84f17cff6dd4d335ad18e2a8a322a1942f Parents: 04e311b Author: vozerov-gridgainAuthored: Mon Jun 6 12:59:43 2016 +0300 Committer: vozerov-gridgain Committed: Mon Jun 6 12:59:43 2016 +0300 -- .../processors/igfs/IgfsOutputStreamImpl.java | 96 ++-- 1 file changed, 26 insertions(+), 70 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/f6fd3b84/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 13808ea..16a20a2 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 @@ -221,8 +221,9 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { sendData(true); try { -storeDataBlocks(in, len); -} catch (IgniteCheckedException e) { +storeData(in, len); +} +catch (IgniteCheckedException e) { throw new IOException(e.getMessage(), e); } @@ -323,16 +324,23 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { /** * Store data block. * - * @param block Block. + * @param data Block. + * @param writeLen Write length. * @throws IgniteCheckedException If failed. * @throws IOException If failed. */ -private void storeDataBlock(ByteBuffer block) throws IgniteCheckedException, IOException { +private void storeData(Object data, int writeLen) throws IgniteCheckedException, IOException { assert Thread.holdsLock(mux); +assert data instanceof ByteBuffer || data instanceof DataInput; -int writeLen = block.remaining(); +if (writeCompletionFut.isDone()) { +assert ((GridFutureAdapter)writeCompletionFut).isFailed(); + +writeCompletionFut.get(); +} -preStoreDataBlocks(null, writeLen); +bytes += writeLen; +space += writeLen; int blockSize = fileInfo.blockSize(); @@ -350,80 +358,28 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { remainder = allocated; } -block.get(remainder, remainderDataLen, writeLen); +if (data instanceof ByteBuffer) +((ByteBuffer)data).get(remainder, remainderDataLen, writeLen); +else +((DataInput)data).readFully(remainder, remainderDataLen, writeLen); remainderDataLen += writeLen; } else { -remainder = igfsCtx.data().storeDataBlocks(fileInfo, fileInfo.length() + space, remainder, -remainderDataLen, block, false, streamRange, batch); - -remainderDataLen = remainder == null ? 0 : remainder.length; -} -} - -/** - * Store data blocks. - * - * @param in Input. - * @param len Length. - * @throws IgniteCheckedException If failed. - * @throws IOException If failed. - */ -private void storeDataBlocks(DataInput in, int len) throws IgniteCheckedException, IOException { -assert Thread.holdsLock(mux); - -preStoreDataBlocks(in, len); - -int blockSize = fileInfo.blockSize(); - -// If data length is not enough to fill full block, fill the remainder and return. -if (remainderDataLen + len < blockSize) { -if (remainder == null) -remainder = new byte[blockSize]; -else if (remainder.length != blockSize) { -assert remainderDataLen == remainder.length; - -byte[] allocated = new byte[blockSize]; - -U.arrayCopy(remainder, 0, allocated, 0, remainder.length); - -remainder = allocated; +if (data instanceof ByteBuffer) { +remainder = igfsCtx.data().storeDataBlocks(fileInfo, fileInfo.length() + space, remainder, +remainderDataLen, (ByteBuffer)data, false, streamRange, batch); +} +else { +remainder = igfsCtx.data().storeDataBlocks(fileInfo, fileInfo.length() + space, remainder, +
[05/14] ignite git commit: Removed "meta" and "data" fields.
Removed "meta" and "data" fields. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5949abe4 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5949abe4 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5949abe4 Branch: refs/heads/ignite-3264 Commit: 5949abe4943bc07de26c4ecce62148e7f399cb41 Parents: b6c6b48 Author: vozerov-gridgainAuthored: Mon Jun 6 12:02:59 2016 +0300 Committer: vozerov-gridgain Committed: Mon Jun 6 12:02:59 2016 +0300 -- .../processors/igfs/IgfsOutputStreamImpl.java | 38 1 file changed, 15 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/5949abe4/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 98ccb81..bc32e81 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 @@ -72,12 +72,6 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { /** IGFS context. */ private IgfsContext igfsCtx; -/** Meta info manager. */ -private final IgfsMetaManager meta; - -/** Data manager. */ -private final IgfsDataManager data; - /** File descriptor. */ @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized") private IgfsEntryInfo fileInfo; @@ -146,8 +140,6 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { assert !IgfsUtils.DELETE_LOCK_ID.equals(fileInfo.lockId()); this.igfsCtx = igfsCtx; -meta = igfsCtx.meta(); -data = igfsCtx.data(); this.fileInfo = fileInfo; this.mode = mode; @@ -156,7 +148,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { streamRange = initialStreamRange(fileInfo); -writeCompletionFut = data.writeStart(fileInfo); +writeCompletionFut = igfsCtx.data().writeStart(fileInfo); metrics.incrementFilesOpenedForWrite(); } @@ -295,7 +287,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { boolean exists; try { -exists = meta.exists(fileInfo.id()); +exists = igfsCtx.meta().exists(fileInfo.id()); } catch (IgniteCheckedException e) { throw new IOException("File to read file metadata: " + path, e); } @@ -314,7 +306,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { try { if (remainder != null) { -data.storeDataBlocks(fileInfo, fileInfo.length() + space, null, 0, +igfsCtx.data().storeDataBlocks(fileInfo, fileInfo.length() + space, null, 0, ByteBuffer.wrap(remainder, 0, remainderDataLen), true, streamRange, batch); remainder = null; @@ -322,9 +314,9 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { } if (space > 0) { -data.awaitAllAcksReceived(fileInfo.id()); +igfsCtx.data().awaitAllAcksReceived(fileInfo.id()); -IgfsEntryInfo fileInfo0 = meta.reserveSpace(path, fileInfo.id(), space, streamRange); +IgfsEntryInfo fileInfo0 = igfsCtx.meta().reserveSpace(path, fileInfo.id(), space, streamRange); if (fileInfo0 == null) throw new IOException("File was concurrently deleted: " + path); @@ -376,8 +368,8 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { remainderDataLen += writeLen; } else { -remainder = data.storeDataBlocks(fileInfo, fileInfo.length() + space, remainder, remainderDataLen, block, -false, streamRange, batch); +remainder = igfsCtx.data().storeDataBlocks(fileInfo, fileInfo.length() + space, remainder, +remainderDataLen, block, false, streamRange, batch); remainderDataLen = remainder == null ? 0 : remainder.length; } @@ -417,8 +409,8 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { remainderDataLen += len; } else { -remainder = data.storeDataBlocks(fileInfo, fileInfo.length() + space, remainder, remainderDataLen, in, len, -false, streamRange, batch); +remainder =
[13/14] ignite git commit: Re-arranged fields.
Re-arranged fields. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cd92c9ec Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cd92c9ec Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cd92c9ec Branch: refs/heads/ignite-3264 Commit: cd92c9ecaf2b2c9e1e7b9e2e7ed7c5aadf9be3d5 Parents: 93f8eca Author: vozerov-gridgainAuthored: Tue Jun 7 10:01:21 2016 +0300 Committer: vozerov-gridgain Committed: Tue Jun 7 10:01:21 2016 +0300 -- .../processors/igfs/IgfsOutputStreamImpl.java | 42 ++-- 1 file changed, 21 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/cd92c9ec/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 f51e9b5..b90e34d 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 @@ -50,12 +50,33 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { /** Maximum number of blocks in buffer. */ private static final int MAX_BLOCKS_CNT = 16; +/** IGFS context. */ +private final IgfsContext igfsCtx; + /** Path to file. */ private final IgfsPath path; /** Buffer size. */ private final int bufSize; +/** IGFS mode. */ +private final IgfsMode mode; + +/** File worker batch. */ +private final IgfsFileWorkerBatch batch; + +/** Write completion future. */ +private final IgniteInternalFuture writeCompletionFut; + +/** Ensures that onClose)_ routine is called no more than once. */ +private final AtomicBoolean onCloseGuard = new AtomicBoolean(); + +/** Close guard. */ +private final AtomicBoolean closeGuard = new AtomicBoolean(false); + +/** Mutex for synchronization. */ +private final Object mux = new Object(); + /** Flag for this stream open/closed state. */ private boolean closed; @@ -69,9 +90,6 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { /** Time consumed by write operations. */ private long time; -/** IGFS context. */ -private IgfsContext igfsCtx; - /** File descriptor. */ @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized") private IgfsEntryInfo fileInfo; @@ -86,27 +104,9 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { /** Data length in remainder. */ private int remainderDataLen; -/** Write completion future. */ -private final IgniteInternalFuture writeCompletionFut; - -/** IGFS mode. */ -private final IgfsMode mode; - -/** File worker batch. */ -private final IgfsFileWorkerBatch batch; - -/** Ensures that onClose)_ routine is called no more than once. */ -private final AtomicBoolean onCloseGuard = new AtomicBoolean(); - /** Affinity written by this output stream. */ private IgfsFileAffinityRange streamRange; -/** Close guard. */ -private final AtomicBoolean closeGuard = new AtomicBoolean(false); - -/** Mutex for synchronization. */ -private final Object mux = new Object(); - /** * Constructs file output stream. *
[02/14] ignite git commit: Better encapsulated monitor.
Better encapsulated monitor. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d3a432c0 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d3a432c0 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d3a432c0 Branch: refs/heads/ignite-3264 Commit: d3a432c02e300988e39516641fb17d5b5a9af698 Parents: 3cd3373 Author: vozerov-gridgainAuthored: Mon Jun 6 11:57:10 2016 +0300 Committer: vozerov-gridgain Committed: Mon Jun 6 11:57:10 2016 +0300 -- .../processors/igfs/IgfsOutputStreamImpl.java | 271 ++- 1 file changed, 144 insertions(+), 127 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/d3a432c0/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 7a40ba3..7363ffe 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 @@ -113,6 +113,9 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { /** Close guard. */ private final AtomicBoolean closeGuard = new AtomicBoolean(false); +/** Mutex for synchronization. */ +private final Object mux = new Object(); + /** * Constructs file output stream. * @@ -126,59 +129,63 @@ class IgfsOutputStreamImpl extends IgfsOutputStream { */ IgfsOutputStreamImpl(IgfsContext igfsCtx, IgfsPath path, IgfsEntryInfo fileInfo, int bufSize, IgfsMode mode, @Nullable IgfsFileWorkerBatch batch, IgfsLocalMetrics metrics) { -this.path = path; -this.bufSize = optimizeBufferSize(bufSize, fileInfo); +synchronized (mux) { +this.path = path; +this.bufSize = optimizeBufferSize(bufSize, fileInfo); -assert fileInfo != null; -assert fileInfo.isFile() : "Unexpected file info: " + fileInfo; -assert mode != null && mode != PROXY; -assert mode == PRIMARY && batch == null || batch != null; -assert metrics != null; +assert fileInfo != null; +assert fileInfo.isFile() : "Unexpected file info: " + fileInfo; +assert mode != null && mode != PROXY; +assert mode == PRIMARY && batch == null || batch != null; +assert metrics != null; -// File hasn't been locked. -if (fileInfo.lockId() == null) -throw new IgfsException("Failed to acquire file lock (concurrently modified?): " + path); +// File hasn't been locked. +if (fileInfo.lockId() == null) +throw new IgfsException("Failed to acquire file lock (concurrently modified?): " + path); -assert !IgfsUtils.DELETE_LOCK_ID.equals(fileInfo.lockId()); +assert !IgfsUtils.DELETE_LOCK_ID.equals(fileInfo.lockId()); -this.igfsCtx = igfsCtx; -meta = igfsCtx.meta(); -data = igfsCtx.data(); +this.igfsCtx = igfsCtx; +meta = igfsCtx.meta(); +data = igfsCtx.data(); -this.fileInfo = fileInfo; -this.mode = mode; -this.batch = batch; -this.metrics = metrics; +this.fileInfo = fileInfo; +this.mode = mode; +this.batch = batch; +this.metrics = metrics; -streamRange = initialStreamRange(fileInfo); +streamRange = initialStreamRange(fileInfo); -writeCompletionFut = data.writeStart(fileInfo); +writeCompletionFut = data.writeStart(fileInfo); -metrics.incrementFilesOpenedForWrite(); +metrics.incrementFilesOpenedForWrite(); +} } /** {@inheritDoc} */ -@Override public synchronized void write(int b) throws IOException { -checkClosed(null, 0); +@Override public void write(int b) throws IOException { +synchronized (mux) { +checkClosed(null, 0); -long startTime = System.nanoTime(); +long startTime = System.nanoTime(); -b &= 0xFF; +b &= 0xFF; -if (buf == null) -buf = ByteBuffer.allocate(bufSize); +if (buf == null) +buf = ByteBuffer.allocate(bufSize); -buf.put((byte)b); +buf.put((byte)b); -if (buf.position() >= bufSize) -sendData(true); // Send data to server. +if (buf.position() >= bufSize) +sendData(true); //
ignite git commit: IGNITE-3216
Repository: ignite Updated Branches: refs/heads/ignite-3216 efdd7b346 -> 9bf004690 IGNITE-3216 Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9bf00469 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9bf00469 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9bf00469 Branch: refs/heads/ignite-3216 Commit: 9bf004690d008d08337f461c8b86c20ceba98d60 Parents: efdd7b3 Author: Anton VinogradovAuthored: Tue Jun 7 10:21:48 2016 +0300 Committer: Anton Vinogradov Committed: Tue Jun 7 10:21:48 2016 +0300 -- .../ignite/internal/util/IgniteUtilsSelfTest.java| 15 +++ 1 file changed, 15 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ignite/blob/9bf00469/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java -- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java index 520fa76..d774065 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java @@ -742,6 +742,21 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest { } /** + * + */ +public void testToSocketAddressesNoDuplicates() { +Collection addrs = new ArrayList<>(); + +addrs.add("127.0.0.1"); +addrs.add("localhost"); + +Collection hostNames = new ArrayList<>(); +int port = 1234; + +assertEquals(1, U.toSocketAddresses(addrs, hostNames, port).size()); +} + +/** * Test enum. */ private enum TestEnum {