Skip to content

Commit

Permalink
Resilience, Version 2, March 2016
Browse files Browse the repository at this point in the history
Full commit of all modifications and additions, including junit tests.
  • Loading branch information
alrossi authored and alrossi committed Mar 25, 2016
1 parent 655671a commit 69cc5b9
Show file tree
Hide file tree
Showing 144 changed files with 25,144 additions and 223 deletions.
Expand Up @@ -77,7 +77,10 @@ public enum PredefinedAlarm implements Alarm {
POOL_SIZE,
POOL_FREE_SPACE,
BROKEN_FILE,
CHECKSUM;
CHECKSUM,
INACCESSIBLE_FILE,
FAILED_REPLICATION,
RESILIENCE_SYNC_FAILURE;

@Override
public String getType() {
Expand Down
Expand Up @@ -107,5 +107,4 @@
<description>ACL command line</description>
<property name="nameSpaceProvider" ref="name-space-provider"/>
</bean>

</beans>
Expand Up @@ -4,7 +4,7 @@
import org.slf4j.LoggerFactory;

import dmg.cells.nucleus.UOID;

import org.dcache.services.info.base.BooleanStateValue;
import org.dcache.services.info.base.StateComposite;
import org.dcache.services.info.base.StatePath;
import org.dcache.services.info.base.StateUpdate;
Expand All @@ -29,21 +29,22 @@ public void process(Object msgPayload, long metricLifetime)
LOGGER.trace("processing new poolgroup information");

if (!msgPayload.getClass().isArray()) {
LOGGER.error("received a message that isn't an array");
LOGGER.error("Pool group info, received a message that isn't an array");
return;
}

Object array[] = (Object []) msgPayload;

if (array.length != 3) {
LOGGER.error("Unexpected array size: {}", array.length);
return;
}
if (array.length != 4) {
LOGGER.error("Pool group info, unexpected array size: {}", array.length);
return;
}

// Map the array into slightly more meaningful components.
String poolgroupName = (String) array[0];
Object poolNames[] = (Object []) array[1];
Object linkNames[] = (Object []) array[2];
Boolean resilient = (Boolean) array[3];

StateUpdate update = new StateUpdate();

Expand All @@ -55,6 +56,8 @@ public void process(Object msgPayload, long metricLifetime)
} else {
addItems(update, thisPoolGroupPath.newChild("pools"), poolNames, metricLifetime);
addItems(update, thisPoolGroupPath.newChild("links"), linkNames, metricLifetime);
update.appendUpdate(thisPoolGroupPath.newChild("resilient"),
new BooleanStateValue(resilient, metricLifetime));
}

applyUpdates(update);
Expand Down
Expand Up @@ -32,23 +32,26 @@ public UnitInfoMsgHandler(StateUpdateManager sum,
public void process(Object msgPayload, long metricLifetime)
{
if (!msgPayload.getClass().isArray()) {
LOGGER.error("unexpected received non-array payload");
LOGGER.error("Unit info, unexpected received non-array payload");
return;
}

Object array[] = (Object []) msgPayload;

if (array.length != 3) {
LOGGER.error("Unexpected array size: {}", array.length);
if (array.length > 5 || array.length < 3) {
LOGGER.error("Unit info, unexpected array size: {}", array.length);
return;
}

/*
* array[0] = name
* array[1] = type
* array[2] = list of unitgroups.
*
* for storage,
* array[3] = required (number of copies)
* array[4] = list of tags for partitioning copies
*/

String unitName = array[0].toString();
String unitType = array[1].toString();

Expand All @@ -61,6 +64,19 @@ public void process(Object msgPayload, long metricLifetime)

addItems(update, thisUnitPath.newChild("unitgroups"), (Object []) array [2], metricLifetime);

if ("store".equals(unitType)) {
if (array.length == 5) {
if (array[3] != null) {
addItems(update, thisUnitPath.newChild("required"),
(Object[]) array[3], metricLifetime);
}
if (array[4] != null) {
addItems(update, thisUnitPath.newChild("oneCopyPer"),
(Object[]) array[4], metricLifetime);
}
}
}

applyUpdates(update);
}
}
87 changes: 87 additions & 0 deletions modules/dcache-resilience/pom.xml
@@ -0,0 +1,87 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.dcache</groupId>
<artifactId>dcache-parent</artifactId>
<version>2.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>dcache-resilience</artifactId>
<packaging>jar</packaging>

<name>dCache resilience handling provider</name>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>

<dependency>
<groupId>org.dcache</groupId>
<artifactId>dcache-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.dcache</groupId>
<artifactId>dcache-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.dcache</groupId>
<artifactId>common-cli</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.dcache</groupId>
<artifactId>chimera</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.dcache</groupId>
<artifactId>dcache-chimera</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.dcache</groupId>
<artifactId>acl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>

<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>

0 comments on commit 69cc5b9

Please sign in to comment.