You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/02/10 15:16:57 UTC

[14/14] ignite git commit: Merge branch 'master' into ignite-1786

Merge branch 'master' into ignite-1786


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9d296c98
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9d296c98
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9d296c98

Branch: refs/heads/ignite-1786
Commit: 9d296c989ab36a3f604391ee5f5967f82d54d20d
Parents: 4c6e7fa a9937a6
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Feb 10 17:16:37 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Feb 10 17:16:37 2016 +0300

----------------------------------------------------------------------
 DEVNOTES.txt                                    |   4 +-
 .../processors/cache/CacheLazyEntry.java        |   3 +
 .../processors/cache/GridCacheContext.java      |   4 +-
 .../processors/cache/GridCacheMapEntry.java     | 118 +++-
 .../binary/CacheObjectBinaryProcessorImpl.java  |   6 +-
 .../dht/atomic/GridDhtAtomicCache.java          |  79 ++-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |  85 ++-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |  38 +-
 .../cache/query/GridCacheQueryManager.java      |  30 +-
 .../continuous/CacheContinuousQueryHandler.java |   3 +-
 .../CacheContinuousQueryListener.java           |   2 +-
 .../continuous/CacheContinuousQueryManager.java | 120 +++-
 .../continuous/GridContinuousProcessor.java     |  16 +-
 .../IgniteCacheEntryListenerAbstractTest.java   | 454 ++++++++----
 ...cheEntryListenerAtomicOffheapTieredTest.java |  32 +
 ...cheEntryListenerAtomicOffheapValuesTest.java |  32 +
 ...niteCacheEntryListenerExpiredEventsTest.java | 202 ++++++
 ...teCacheEntryListenerTxOffheapTieredTest.java |  32 +
 ...teCacheEntryListenerTxOffheapValuesTest.java |  32 +
 .../cache/IgniteCacheEntryListenerTxTest.java   |   1 +
 ...ContinuousQueryFailoverAbstractSelfTest.java |  10 +
 ...tomicPrimaryWriteOrderOffheapTieredTest.java |  33 +
 ...tinuousQueryFailoverTxOffheapTieredTest.java |  32 +
 ...acheContinuousQueryRandomOperationsTest.java | 684 +++++++++++++++++++
 ...ridCacheContinuousQueryAbstractSelfTest.java |  19 +-
 ...eContinuousQueryAtomicOffheapTieredTest.java |  32 +
 ...eContinuousQueryAtomicOffheapValuesTest.java |  32 +
 ...CacheContinuousQueryTxOffheapTieredTest.java |  32 +
 ...CacheContinuousQueryTxOffheapValuesTest.java |  32 +
 .../junits/common/GridCommonAbstractTest.java   |   2 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |   8 +
 .../hadoop/fs/BasicHadoopFileSystemFactory.java |  22 +-
 .../fs/CachingHadoopFileSystemFactory.java      |   2 +-
 .../fs/KerberosHadoopFileSystemFactory.java     | 217 ++++++
 ...KerberosHadoopFileSystemFactorySelfTest.java | 104 +++
 .../testsuites/IgniteHadoopTestSuite.java       |   3 +
 .../cache/CacheQueryBuildValueTest.java         | 144 ++++
 .../IgniteCacheQuerySelfTestSuite.java          |  14 +
 .../include/ignite/impl/ignite_environment.h    |  19 +-
 .../cpp/binary/src/impl/ignite_environment.cpp  |  30 +-
 modules/platforms/cpp/core-test/Makefile.am     |   1 +
 .../cpp/core-test/project/vs/core-test.vcxproj  |   1 +
 .../project/vs/core-test.vcxproj.filters        |   3 +
 .../platforms/cpp/core-test/src/cache_test.cpp  |  12 +
 .../cpp/core-test/src/interop_memory_test.cpp   |  95 +++
 .../cpp/core/src/impl/cache/cache_impl.cpp      |   2 +-
 .../commands/tasks/VisorTasksCommand.scala      |   4 +-
 .../scala/org/apache/ignite/visor/visor.scala   |   4 +
 48 files changed, 2588 insertions(+), 298 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9d296c98/modules/platforms/cpp/binary/include/ignite/impl/ignite_environment.h
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/binary/include/ignite/impl/ignite_environment.h
index 2fbdb44,0000000..02facfc
mode 100644,000000..100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/ignite_environment.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/ignite_environment.h
@@@ -1,130 -1,0 +1,135 @@@
 +/*
 + * 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.
 + */
 +
 +#ifndef _IGNITE_ENVIRONMENT
 +#define _IGNITE_ENVIRONMENT
 +
 +#include <ignite/common/concurrent.h>
 +#include <ignite/common/java.h>
 +
 +#include "ignite/impl/interop/interop_memory.h"
 +#include "binary/binary_type_manager.h"
 +
 +namespace ignite 
- {    
++{
 +    namespace impl 
 +    {
 +        /**
 +         * Defines environment in which Ignite operates.
 +         */
 +        class IGNITE_IMPORT_EXPORT IgniteEnvironment
-         {                
++        {
 +        public:
 +            /**
++             * Default memory block allocation size.
++             */
++            enum { DEFAULT_ALLOCATION_SIZE = 1024 };
++
++            /**
 +             * Default constructor.
 +             */
 +            IgniteEnvironment();
 +
 +            /**
 +             * Destructor.
 +             */
 +            ~IgniteEnvironment();
 +
 +            /**
 +             * Populate callback handlers.
 +             *
 +             * @param Target (current env wrapped into a shared pointer).
 +             * @return JNI handlers.
 +             */
 +            ignite::common::java::JniHandlers GetJniHandlers(ignite::common::concurrent::SharedPointer<IgniteEnvironment>* target);
-                 
++
 +            /**
 +             * Perform initialization on successful start.
 +             *
 +             * @param ctx Context.
 +             */
 +            void Initialize(ignite::common::concurrent::SharedPointer<ignite::common::java::JniContext> ctx);
 +
 +            /**
 +             * Start callback.
 +             *
 +             * @param memPtr Memory pointer.
 +             */
-             void OnStartCallback(long long memPtr);        
-             
++            void OnStartCallback(long long memPtr);
++
 +            /**
 +             * Get name of Ignite instance.
 +             *
 +             * @return Name.
 +             */
 +            const char* InstanceName() const;
 +
 +            /**
 +             * Get JNI context.
 +             *
 +             * @return Context.
 +             */
 +            ignite::common::java::JniContext* Context();
 +
 +            /**
 +             * Get memory for interop operations.
 +             *
 +             * @return Memory.
 +             */
 +            ignite::common::concurrent::SharedPointer<interop::InteropMemory> AllocateMemory();
 +
 +            /**
 +             * Get memory chunk for interop operations with desired capacity.
 +             *
 +             * @param cap Capacity.
 +             * @return Memory.
 +             */
 +            ignite::common::concurrent::SharedPointer<interop::InteropMemory> AllocateMemory(int32_t cap);
 +
 +            /**
 +             * Get memory chunk located at the given pointer.
 +             *
 +             * @param memPtr Memory pointer.
 +             * @retrun Memory.
 +             */
 +            ignite::common::concurrent::SharedPointer<interop::InteropMemory> GetMemory(int64_t memPtr);
 +
 +            /**
 +             * Get type manager.
 +             *
 +             * @param Type manager.
 +             */
 +            binary::BinaryTypeManager* GetTypeManager();
 +        private:
 +            /** Context to access Java. */
 +            ignite::common::concurrent::SharedPointer<ignite::common::java::JniContext> ctx;
 +
 +            /** Startup latch. */
 +            ignite::common::concurrent::SingleLatch* latch;
 +
 +            /** Ignite name. */
 +            char* name;
 +
 +            /** Type manager. */
-             binary::BinaryTypeManager* metaMgr;       
++            binary::BinaryTypeManager* metaMgr;
 +
 +            IGNITE_NO_COPY_ASSIGNMENT(IgniteEnvironment);
 +        };
-     }    
++    }
 +}
 +
 +#endif

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d296c98/modules/platforms/cpp/binary/src/impl/ignite_environment.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/binary/src/impl/ignite_environment.cpp
index 013a139,0000000..c9c57a0
mode 100644,000000..100644
--- a/modules/platforms/cpp/binary/src/impl/ignite_environment.cpp
+++ b/modules/platforms/cpp/binary/src/impl/ignite_environment.cpp
@@@ -1,167 -1,0 +1,185 @@@
 +/*
 + * 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.
 + */
 +
 +#include "ignite/impl/binary/binary_reader_impl.h"
 +#include "ignite/impl/ignite_environment.h"
 +#include "ignite/binary/binary.h"
 +
 +using namespace ignite::common::concurrent;
 +using namespace ignite::common::java;
 +using namespace ignite::impl::interop;
 +using namespace ignite::impl::binary;
 +using namespace ignite::binary;
 +
 +namespace ignite 
 +{
 +    namespace impl 
 +    {
 +        /**
 +         * OnStart callback.
 +         *
 +         * @param target Target environment.
 +         * @param proc Processor instance (not used for now).
 +         * @param memPtr Memory pointer.
 +         */
 +        void IGNITE_CALL OnStart(void* target, void* proc, long long memPtr)
 +        {
 +            SharedPointer<IgniteEnvironment>* ptr = static_cast<SharedPointer<IgniteEnvironment>*>(target);
 +
 +            ptr->Get()->OnStartCallback(memPtr);
 +        }
 +
 +        /**
 +         * OnStop callback.
 +         *
 +         * @param target Target environment.
 +         */
 +        void IGNITE_CALL OnStop(void* target)
 +        {
 +            SharedPointer<IgniteEnvironment>* ptr = static_cast<SharedPointer<IgniteEnvironment>*>(target);
 +
 +            delete ptr;
-         } 
++        }
++
++        /**
++         * Memory reallocate callback.
++         *
++         * @param target Target environment.
++         * @param memPtr Memory pointer.
++         * @param cap Required capasity.
++         */
++        void IGNITE_CALL MemoryReallocate(void* target, long long memPtr, int cap)
++        {
++            SharedPointer<IgniteEnvironment>* env = static_cast<SharedPointer<IgniteEnvironment>*>(target);
++
++            SharedPointer<InteropMemory> mem = env->Get()->GetMemory(memPtr);
++
++            mem.Get()->Reallocate(cap);
++        }
 +
 +        IgniteEnvironment::IgniteEnvironment() : ctx(SharedPointer<JniContext>()), latch(new SingleLatch), name(NULL),
 +            metaMgr(new BinaryTypeManager())
 +        {
 +            // No-op.
 +        }
 +
 +        IgniteEnvironment::~IgniteEnvironment()
 +        {
 +            delete latch;
 +
 +            if (name)
 +                delete name;
 +
 +            delete metaMgr;
 +        }
 +
 +        JniHandlers IgniteEnvironment::GetJniHandlers(SharedPointer<IgniteEnvironment>* target)
 +        {
 +            JniHandlers hnds = JniHandlers();
 +
 +            hnds.target = target;
 +
 +            hnds.onStart = OnStart;
 +            hnds.onStop = OnStop;
 +
++            hnds.memRealloc = MemoryReallocate;
++
 +            hnds.error = NULL;
 +
 +            return hnds;
 +        }
-             
++
 +        void IgniteEnvironment::Initialize(SharedPointer<JniContext> ctx)
 +        {
 +            this->ctx = ctx;
-                 
++
 +            latch->CountDown();
 +        }
-         
++
 +        const char* IgniteEnvironment::InstanceName() const
 +        {
 +            return name;
 +        }
 +
 +        JniContext* IgniteEnvironment::Context()
 +        {
 +            return ctx.Get();
 +        }
 +
 +        SharedPointer<InteropMemory> IgniteEnvironment::AllocateMemory()
 +        {
-             SharedPointer<InteropMemory> ptr(new InteropUnpooledMemory(1024));
++            SharedPointer<InteropMemory> ptr(new InteropUnpooledMemory(DEFAULT_ALLOCATION_SIZE));
 +
 +            return ptr;
 +        }
 +
 +        SharedPointer<InteropMemory> IgniteEnvironment::AllocateMemory(int32_t cap)
 +        {
 +            SharedPointer<InteropMemory> ptr(new InteropUnpooledMemory(cap));
 +
 +            return ptr;
 +        }
 +
 +        SharedPointer<InteropMemory> IgniteEnvironment::GetMemory(int64_t memPtr)
 +        {
 +            int8_t* memPtr0 = reinterpret_cast<int8_t*>(memPtr);
 +
 +            int32_t flags = InteropMemory::Flags(memPtr0);
 +
 +            if (InteropMemory::IsExternal(flags))
 +            {
 +                SharedPointer<InteropMemory> ptr(new InteropExternalMemory(memPtr0));
 +
 +                return ptr;
 +            }
 +            else
 +            {
 +                SharedPointer<InteropMemory> ptr(new InteropUnpooledMemory(memPtr0));
 +
 +                return ptr;
 +            }
 +        }
 +
 +        BinaryTypeManager* IgniteEnvironment::GetTypeManager()
 +        {
 +            return metaMgr;
 +        }
 +
 +        void IgniteEnvironment::OnStartCallback(long long memPtr)
 +        {
 +            InteropExternalMemory mem(reinterpret_cast<int8_t*>(memPtr));
 +            InteropInputStream stream(&mem);
 +
 +            BinaryReaderImpl reader(&stream);
-             
++
 +            int32_t nameLen = reader.ReadString(NULL, 0);
 +
 +            if (nameLen >= 0)
 +            {
 +                name = new char[nameLen + 1];
 +                reader.ReadString(name, nameLen + 1);
 +            }
 +            else
 +                name = NULL;
 +        }
 +    }
 +}
 +
 +
 +
 +
 +

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d296c98/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d296c98/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
----------------------------------------------------------------------