-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IGNITE-20861 P2P prevent to load already deployed class from different node on SHARED mode #11041
Changes from all commits
b8e8af8
b2a2117
5626ff8
64d4439
a5f1664
cd6723d
b36e0be
0111c04
341ef07
bad33a2
08436d0
1e55483
7fdad06
c16aa9b
a0619dc
34dada4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -329,6 +329,26 @@ else if (log.isDebugEnabled()) | |
if (isDeadClassLoader(meta)) | ||
return null; | ||
|
||
boolean skipSearchDeployment = false; | ||
|
||
// Check already exist deployment. | ||
if (meta.deploymentMode() == SHARED) { | ||
Collection<GridDeployment> created = getDeployments(); | ||
|
||
for (GridDeployment dep0 : created) { | ||
// hot redeploy from same node | ||
if (dep0.participants().containsKey(meta.senderNodeId()) || dep0.undeployed()) | ||
continue; | ||
|
||
IgniteBiTuple<Class<?>, Throwable> cls = dep0.deployedClass(meta.className(), meta.alias()); | ||
|
||
if (cls.getKey() != null && cls.getValue() == null) { | ||
((SharedDeployment)dep0).addParticipant(meta.senderNodeId(), meta.classLoaderId()); | ||
skipSearchDeployment = true; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why don't bracke the loop when you find the deployment? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I think we can assigned it into dep variable and brake the root while loop. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because in common - getDeployments() returns the collection an we need to update all participants |
||
} | ||
} | ||
|
||
if (!F.isEmpty(meta.participants())) { | ||
Map<UUID, IgniteUuid> participants = new LinkedHashMap<>(); | ||
|
||
|
@@ -376,7 +396,8 @@ else if (ctx.discovery().node(meta.senderNodeId()) == null) { | |
return null; | ||
} | ||
|
||
dep = (SharedDeployment)searchDeploymentCache(meta); | ||
if (!skipSearchDeployment) | ||
dep = (SharedDeployment)searchDeploymentCache(meta); | ||
|
||
if (dep == null) { | ||
List<SharedDeployment> deps = cache.get(meta.userVersion()); | ||
|
@@ -1243,8 +1264,6 @@ void onRemoved() { | |
|
||
/** {@inheritDoc} */ | ||
@Override public void onDeployed(Class<?> cls) { | ||
assert !Thread.holdsLock(mux); | ||
|
||
boolean isTask = isTask(cls); | ||
|
||
String msg = (isTask ? "Task" : "Class") + " was deployed in SHARED or CONTINUOUS mode: " + cls; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* 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.tests.p2p; | ||
|
||
import java.util.Map; | ||
import javax.cache.processor.EntryProcessorException; | ||
import javax.cache.processor.MutableEntry; | ||
import org.apache.ignite.cache.CacheEntryProcessor; | ||
import org.apache.ignite.tests.p2p.cache.Container; | ||
|
||
/** | ||
* Entry processor for p2p tests. | ||
*/ | ||
public class CacheDeploymentEntryProcessorMultipleEnts implements CacheEntryProcessor<String, CacheDeploymentTestValue, Boolean> { | ||
/** */ | ||
private Map<Long, CacheDeploymentTestValue> entToProcess; | ||
|
||
/** */ | ||
public CacheDeploymentEntryProcessorMultipleEnts(Object container) { | ||
entToProcess = (Map<Long, CacheDeploymentTestValue>)((Container)container).field; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public Boolean process(MutableEntry<String, CacheDeploymentTestValue> entry, | ||
Object... arguments) throws EntryProcessorException { | ||
boolean pr = false; | ||
|
||
for (CacheDeploymentTestValue ent : entToProcess.values()) { | ||
CacheDeploymentTestValue key = ent; | ||
pr = key != null; | ||
} | ||
CacheDeploymentTestValue val = entry.getValue(); | ||
|
||
return pr; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we skipping participan deployment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because the case of this part is to find participant by nodeId and register if such is not found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check code a bit below, if participant contains - skip, if not - register