Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sboikov committed Jan 21, 2015
1 parent f4da39a commit 1fa2a90
Show file tree
Hide file tree
Showing 22 changed files with 1,193 additions and 7 deletions.
Expand Up @@ -61,6 +61,9 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> {
/** */
private final boolean locStore;

/** */
private final boolean writeThrough;

/** */
private boolean convertPortable;

Expand All @@ -85,6 +88,8 @@ public GridCacheStoreManager(GridKernalContext ctx,

ThreadLocal<SessionData> sesHolder0 = null;

writeThrough = cfg.isWriteThrough();

if (cfgStore != null) {
try {
if (!sesHolders.containsKey(cfgStore)) {
Expand Down Expand Up @@ -113,6 +118,13 @@ public GridCacheStoreManager(GridKernalContext ctx,
assert sesHolder != null || cfgStore == null;
}

/**
* @return {@code True} is write-through is enabled.
*/
public boolean writeThrough() {
return writeThrough;
}

/**
* @return Unwrapped store provided in configuration.
*/
Expand Down
Expand Up @@ -999,7 +999,7 @@ private GridNearLockResponse<K, V> createLockReply(
if (ret)
val = e.innerGet(tx,
/*swap*/true,
/*read-through*/true,
/*read-through*/ctx.loadPreviousValue(),
/*fail-fast.*/false,
/*unmarshal*/false,
/*update-metrics*/true,
Expand Down
Expand Up @@ -98,8 +98,8 @@ public GridNearTxLocal() {
* @param concurrency Concurrency.
* @param isolation Isolation.
* @param timeout Timeout.
* @param invalidate
* @param storeEnabled
* @param invalidate Invalidate flag.
* @param storeEnabled Store enabled flag.
* @param txSize Transaction size.
* @param grpLockKey Group lock key if this is a group lock transaction.
* @param partLock {@code True} if this is a group-lock transaction and the whole partition should be locked.
Expand Down
Expand Up @@ -465,7 +465,8 @@ protected GridCacheEntryEx<K, V> entryEx(GridCacheContext<K, V> cacheCtx, Ignite
protected void batchStoreCommit(Iterable<IgniteTxEntry<K, V>> writeEntries) throws IgniteCheckedException {
GridCacheStoreManager<K, V> store = store();

if (store != null && storeEnabled() && (!internal() || groupLock()) && (near() || store.writeToStoreFromDht())) {
if (store != null && store.writeThrough() && storeEnabled() &&
(!internal() || groupLock()) && (near() || store.writeToStoreFromDht())) {
try {
if (writeEntries != null) {
Map<K, IgniteBiTuple<V, GridCacheVersion>> putMap = null;
Expand Down
@@ -0,0 +1,49 @@
/*
* 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.
*/

package org.apache.ignite.internal.processors.cache.integration;

import org.gridgain.grid.cache.*;

import static org.gridgain.grid.cache.GridCacheAtomicityMode.*;
import static org.gridgain.grid.cache.GridCacheDistributionMode.*;
import static org.gridgain.grid.cache.GridCacheMode.*;

/**
*
*/
public class IgniteCacheAtomicLocalNoLoadPreviousValueTest extends IgniteCacheNoLoadPreviousValueAbstractTest {
/** {@inheritDoc} */
@Override protected int gridCount() {
return 1;
}

/** {@inheritDoc} */
@Override protected GridCacheMode cacheMode() {
return LOCAL;
}

/** {@inheritDoc} */
@Override protected GridCacheAtomicityMode atomicityMode() {
return ATOMIC;
}

/** {@inheritDoc} */
@Override protected GridCacheDistributionMode distributionMode() {
return PARTITIONED_ONLY;
}
}
@@ -0,0 +1,49 @@
/*
* 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.
*/

package org.apache.ignite.internal.processors.cache.integration;

import org.gridgain.grid.cache.*;

import static org.gridgain.grid.cache.GridCacheAtomicityMode.*;
import static org.gridgain.grid.cache.GridCacheDistributionMode.*;
import static org.gridgain.grid.cache.GridCacheMode.*;

/**
*
*/
public class IgniteCacheAtomicLocalNoWriteThroughTest extends IgniteCacheNoWriteThroughAbstractTest {
/** {@inheritDoc} */
@Override protected int gridCount() {
return 1;
}

/** {@inheritDoc} */
@Override protected GridCacheMode cacheMode() {
return LOCAL;
}

/** {@inheritDoc} */
@Override protected GridCacheAtomicityMode atomicityMode() {
return ATOMIC;
}

/** {@inheritDoc} */
@Override protected GridCacheDistributionMode distributionMode() {
return PARTITIONED_ONLY;
}
}
@@ -0,0 +1,32 @@
/*
* 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.
*/

package org.apache.ignite.internal.processors.cache.integration;

import org.gridgain.grid.cache.*;

import static org.gridgain.grid.cache.GridCacheDistributionMode.*;

/**
*
*/
public class IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest extends IgniteCacheAtomicNoLoadPreviousValueTest {
/** {@inheritDoc} */
@Override protected GridCacheDistributionMode distributionMode() {
return NEAR_PARTITIONED;
}
}
@@ -0,0 +1,32 @@
/*
* 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.
*/

package org.apache.ignite.internal.processors.cache.integration;

import org.gridgain.grid.cache.*;

import static org.gridgain.grid.cache.GridCacheDistributionMode.*;

/**
*
*/
public class IgniteCacheAtomicNearEnabledNoWriteThroughTest extends IgniteCacheAtomicNoWriteThroughTest {
/** {@inheritDoc} */
@Override protected GridCacheDistributionMode distributionMode() {
return NEAR_PARTITIONED;
}
}
@@ -0,0 +1,55 @@
/*
* 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.
*/

package org.apache.ignite.internal.processors.cache.integration;

import org.gridgain.grid.cache.*;

import static org.gridgain.grid.cache.GridCacheAtomicWriteOrderMode.*;
import static org.gridgain.grid.cache.GridCacheAtomicityMode.*;
import static org.gridgain.grid.cache.GridCacheDistributionMode.*;
import static org.gridgain.grid.cache.GridCacheMode.*;

/**
*
*/
public class IgniteCacheAtomicNoLoadPreviousValueTest extends IgniteCacheNoLoadPreviousValueAbstractTest {
/** {@inheritDoc} */
@Override protected int gridCount() {
return 3;
}

/** {@inheritDoc} */
@Override protected GridCacheMode cacheMode() {
return PARTITIONED;
}

/** {@inheritDoc} */
@Override protected GridCacheAtomicityMode atomicityMode() {
return ATOMIC;
}

/** {@inheritDoc} */
@Override protected GridCacheDistributionMode distributionMode() {
return PARTITIONED_ONLY;
}

/** {@inheritDoc} */
@Override protected GridCacheAtomicWriteOrderMode atomicWriteOrderMode() {
return PRIMARY;
}
}
@@ -0,0 +1,55 @@
/*
* 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.
*/

package org.apache.ignite.internal.processors.cache.integration;

import org.gridgain.grid.cache.*;

import static org.gridgain.grid.cache.GridCacheAtomicWriteOrderMode.*;
import static org.gridgain.grid.cache.GridCacheAtomicityMode.*;
import static org.gridgain.grid.cache.GridCacheDistributionMode.*;
import static org.gridgain.grid.cache.GridCacheMode.*;

/**
*
*/
public class IgniteCacheAtomicNoWriteThroughTest extends IgniteCacheNoWriteThroughAbstractTest {
/** {@inheritDoc} */
@Override protected int gridCount() {
return 3;
}

/** {@inheritDoc} */
@Override protected GridCacheMode cacheMode() {
return PARTITIONED;
}

/** {@inheritDoc} */
@Override protected GridCacheAtomicityMode atomicityMode() {
return ATOMIC;
}

/** {@inheritDoc} */
@Override protected GridCacheDistributionMode distributionMode() {
return PARTITIONED_ONLY;
}

/** {@inheritDoc} */
@Override protected GridCacheAtomicWriteOrderMode atomicWriteOrderMode() {
return PRIMARY;
}
}

0 comments on commit 1fa2a90

Please sign in to comment.