blob: b678f624dc717f9cc81e2a32f1a419910d06444f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.content.storagecluster;
import com.yahoo.vespa.config.content.StorFilestorConfig;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
import com.yahoo.vespa.model.content.PriorityMapping;
import com.yahoo.vespa.model.content.cluster.ContentCluster;
import java.util.ArrayList;
import java.util.List;
/**
* Serves stor-filestor for storage clusters.
*/
public class FileStorProducer implements StorFilestorConfig.Producer {
public static class Builder {
protected FileStorProducer build(ContentCluster parent, ModelElement clusterElem) {
return new FileStorProducer(parent, getThreads(clusterElem));
}
private List<StorFilestorConfig.Threads.Builder> getThreads(ModelElement clusterElem) {
ModelElement tuning = clusterElem.getChild("tuning");
if (tuning == null) {
return null;
}
ModelElement threads = tuning.getChild("persistence-threads");
if (threads == null) {
return null;
}
List<StorFilestorConfig.Threads.Builder> retVal = new ArrayList<>();
PriorityMapping mapping = new PriorityMapping(clusterElem);
for (ModelElement thread : threads.subElements("thread")) {
String priorityName = thread.getStringAttribute("lowest-priority");
if (priorityName == null) {
priorityName = "LOWEST";
}
Integer count = thread.getIntegerAttribute("count");
if (count == null) {
count = 1;
}
for (int i = 0; i < count; ++i) {
retVal.add(new StorFilestorConfig.Threads.Builder().lowestpri(mapping.getPriorityMapping(priorityName)));
}
}
return retVal;
}
}
private List<StorFilestorConfig.Threads.Builder> threads;
private ContentCluster cluster;
public FileStorProducer(ContentCluster parent, List<StorFilestorConfig.Threads.Builder> threads) {
this.threads = threads;
this.cluster = parent;
}
@Override
public void getConfig(StorFilestorConfig.Builder builder) {
if (threads != null) {
for (StorFilestorConfig.Threads.Builder t : threads) {
builder.threads.add(t);
}
}
builder.enable_multibit_split_optimalization(cluster.getPersistence().enableMultiLevelSplitting());
}
}
|