* Avoid service inventory object concurrency situation.

* Fix concurrency for minute persistence and others

* Fix document todo.

* Update license. Fix package with dirty agent plugin jar files.

* Fixed not combine error in persistence register worker.
This commit is contained in:
吴晟 Wu Sheng 2018-10-31 23:11:52 +08:00 committed by 彭勇升 pengys
parent 279c81e9fc
commit 07e799e422
7 changed files with 30 additions and 12 deletions

View File

@ -225,15 +225,15 @@ Apache 2.0 licenses
The following components are provided under the Apache License. See project link for details.
The text of each license is the standard Apache 2.0 license.
raphw (byte-buddy) 1.7.9: http://bytebuddy.net/ , Apache 2.0
Google: grpc 1.8.0: https://grpc.io/ , Apache 2.0
Google: gprc-java 1.8.0: https://github.com/grpc/grpc-java, Apache 2.0
raphw (byte-buddy) 1.9.2: http://bytebuddy.net/ , Apache 2.0
Google: grpc 1.10.0: https://grpc.io/ , Apache 2.0
Google: gprc-java 1.10.0: https://github.com/grpc/grpc-java, Apache 2.0
Google: guava 19.0: https://github.com/google/guava , Apache 2.0
Google: gson 2.8.1: https://github.com/google/gson , Apache 2.0
Google: opencensus-java 0.8.0: https://github.com/census-instrumentation/opencensus-java , Apache 2.0
Google: proto-google-common-protos 0.1.9: https://github.com/googleapis/googleapis , Apache 2.0
Google: jsr305 3.0.0: http://central.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.pom , Apache 2.0
Elasticsearch BV (Elasticsearch) 5.5.0: https://www.elastic.co/products/elasticsearch , Apache 2.0
Elasticsearch BV (Elasticsearch) 6.3.2: https://www.elastic.co/products/elasticsearch , Apache 2.0
lang-mustache-client 5.5.0: https://github.com/elastic/elasticsearch/tree/master/modules/lang-mustache , Apache 2.0
parent-join-client 5.5.0: https://github.com/elastic/elasticsearch/tree/master/modules/parent-join , Apache 2.0
reindex-client 5.5.0: https://github.com/elastic/elasticsearch/tree/master/modules/reindex , Apache 2.0

View File

@ -103,6 +103,7 @@
</goals>
<configuration>
<tasks>
<delete dir="${project.basedir}/../../skywalking-agent" />
<mkdir dir="${project.basedir}/../../skywalking-agent" />
<copy file="${project.build.directory}/skywalking-agent.jar" tofile="${project.basedir}/../../skywalking-agent/skywalking-agent.jar" overwrite="true" />
<mkdir dir="${project.basedir}/../../skywalking-agent/config" />

View File

@ -38,7 +38,3 @@ cluster:
labelSelector: app=collector,release=skywalking
uidEnvName: SKYWALKING_COLLECTOR_UID
```
TODO @hanahmily
settings descriptions.

View File

@ -48,9 +48,6 @@ public class IndicatorTransWorker extends AbstractWorker<Indicator> {
}
@Override public void in(Indicator indicator) {
if (Objects.nonNull(minutePersistenceWorker)) {
minutePersistenceWorker.in(indicator);
}
if (Objects.nonNull(hourPersistenceWorker)) {
hourPersistenceWorker.in(indicator.toHour());
}
@ -60,5 +57,12 @@ public class IndicatorTransWorker extends AbstractWorker<Indicator> {
if (Objects.nonNull(monthPersistenceWorker)) {
monthPersistenceWorker.in(indicator.toMonth());
}
/**
* Minute persistent must be at the end of all time dimensionalities
* Because #toHour, #toDay, #toMonth include clone inside, which could avoid concurrency situation.
*/
if (Objects.nonNull(minutePersistenceWorker)) {
minutePersistenceWorker.in(indicator);
}
}
}

View File

@ -76,6 +76,20 @@ public class ServiceInventory extends RegisterSource {
return result;
}
public ServiceInventory getClone() {
ServiceInventory inventory = new ServiceInventory();
inventory.setSequence(getSequence());
inventory.setRegisterTime(getRegisterTime());
inventory.setHeartbeatTime(getHeartbeatTime());
inventory.setName(name);
inventory.setIsAddress(isAddress);
inventory.setAddressId(addressId);
inventory.setMappingLastUpdateTime(mappingLastUpdateTime);
inventory.setMappingServiceId(mappingServiceId);
return inventory;
}
@Override public boolean equals(Object obj) {
if (this == obj)
return true;

View File

@ -103,6 +103,7 @@ public class ServiceInventoryRegister implements IServiceInventoryRegister {
@Override public void updateMapping(int serviceId, int mappingServiceId) {
ServiceInventory serviceInventory = getServiceInventoryCache().get(serviceId);
if (Objects.nonNull(serviceInventory)) {
serviceInventory = serviceInventory.getClone();
serviceInventory.setMappingServiceId(mappingServiceId);
serviceInventory.setMappingLastUpdateTime(System.currentTimeMillis());

View File

@ -22,7 +22,7 @@ import java.util.*;
import org.apache.skywalking.apm.commons.datacarrier.DataCarrier;
import org.apache.skywalking.apm.commons.datacarrier.consumer.IConsumer;
import org.apache.skywalking.oap.server.core.analysis.data.EndOfBatchContext;
import org.apache.skywalking.oap.server.core.register.*;
import org.apache.skywalking.oap.server.core.register.RegisterSource;
import org.apache.skywalking.oap.server.core.source.Scope;
import org.apache.skywalking.oap.server.core.storage.*;
import org.apache.skywalking.oap.server.core.worker.AbstractWorker;
@ -63,6 +63,8 @@ public class RegisterPersistentWorker extends AbstractWorker<RegisterSource> {
private void onWork(RegisterSource registerSource) {
if (!sources.containsKey(registerSource)) {
sources.put(registerSource, registerSource);
} else {
sources.get(registerSource).combine(registerSource);
}
if (registerSource.getEndOfBatchContext().isEndOfBatch()) {