Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.

Commit 64f5d83

Browse files
authored
Transaction Atomicity Mode changes (#604)
1 parent b3dbbd4 commit 64f5d83

11 files changed

Lines changed: 289 additions & 7 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,6 @@ ignite/
106106
# python cache
107107
__pycache__/
108108

109+
110+
# vim swap files
111+
*.swp

config/ignite-config.xml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,99 @@ Copyright(c) 2020 Futurewei Cloud
3636
</property>
3737
</bean>
3838
</property>
39+
40+
<property name="cacheConfiguration">
41+
<list>
42+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
43+
<!-- Set the cache name. -->
44+
<property name="name" value="dpm_nodeinfo_cache"/>
45+
<!-- Set the cache mode. -->
46+
<property name="atomicityMode" value="TRANSACTIONAL"/>
47+
<!-- Other cache parameters. -->
48+
<property name="cacheMode" value="PARTITIONED"/>
49+
</bean>
50+
51+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
52+
<!-- Set the cache name. -->
53+
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalPorts"/>
54+
<!-- Set the cache mode. -->
55+
<property name="atomicityMode" value="TRANSACTIONAL"/>
56+
<!-- Other cache parameters. -->
57+
<property name="cacheMode" value="PARTITIONED"/>
58+
</bean>
59+
60+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
61+
<!-- Set the cache name. -->
62+
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalSubnets"/>
63+
<!-- Set the cache mode. -->
64+
<property name="atomicityMode" value="TRANSACTIONAL"/>
65+
<!-- Other cache parameters. -->
66+
<property name="cacheMode" value="PARTITIONED"/>
67+
</bean>
68+
69+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
70+
<!-- Set the cache name. -->
71+
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalSubnetPorts"/>
72+
<!-- Set the cache mode. -->
73+
<property name="atomicityMode" value="TRANSACTIONAL"/>
74+
<!-- Other cache parameters. -->
75+
<property name="cacheMode" value="PARTITIONED"/>
76+
</bean>
77+
78+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
79+
<!-- Set the cache name. -->
80+
<property name="name" value="com.futurewei.alcor.dataplane.entity.GatewayInfo"/>
81+
<!-- Set the cache mode. -->
82+
<property name="atomicityMode" value="TRANSACTIONAL"/>
83+
<!-- Other cache parameters. -->
84+
<property name="cacheMode" value="PARTITIONED"/>
85+
</bean>
86+
87+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
88+
<!-- Set the cache name. -->
89+
<property name="name" value="ncm_nodeinfo_cache"/>
90+
<!-- Set the cache mode. -->
91+
<property name="atomicityMode" value="TRANSACTIONAL"/>
92+
<!-- Other cache parameters. -->
93+
<property name="cacheMode" value="PARTITIONED"/>
94+
</bean>
95+
96+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
97+
<!-- Set the cache name. -->
98+
<property name="name" value="com.futurewei.alcor.netwconfigmanager.entity.ResourceMeta"/>
99+
<!-- Set the cache mode. -->
100+
<property name="atomicityMode" value="TRANSACTIONAL"/>
101+
<!-- Other cache parameters. -->
102+
<property name="cacheMode" value="PARTITIONED"/>
103+
</bean>
104+
105+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
106+
<!-- Set the cache name. -->
107+
<property name="name" value="com.futurewei.alcor.netwconfigmanager.entity.VpcResourceMeta"/>
108+
<!-- Set the cache mode. -->
109+
<property name="atomicityMode" value="TRANSACTIONAL"/>
110+
<!-- Other cache parameters. -->
111+
<property name="cacheMode" value="PARTITIONED"/>
112+
</bean>
113+
114+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
115+
<!-- Set the cache name. -->
116+
<property name="name" value="java.lang.Object"/>
117+
<!-- Set the cache mode. -->
118+
<property name="atomicityMode" value="TRANSACTIONAL"/>
119+
<!-- Other cache parameters. -->
120+
<property name="cacheMode" value="PARTITIONED"/>
121+
</bean>
122+
123+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
124+
<!-- Set the cache name. -->
125+
<property name="name" value="com.futurewei.alcor.dataplane.entity.VpcResourceMeta"/>
126+
<!-- Set the cache mode. -->
127+
<property name="atomicityMode" value="TRANSACTIONAL"/>
128+
<!-- Other cache parameters. -->
129+
<property name="cacheMode" value="PARTITIONED"/>
130+
</bean>
131+
</list>
132+
</property>
39133
</bean>
40134
</beans>

kubernetes/services/ignite_alcor.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ spec:
9292
- name: OPTION_LIBS
9393
value: ignite-kubernetes,ignite-rest-http
9494
- name: CONFIG_URI
95-
value: https://raw.githubusercontent.com/kevin-zhonghao/alcor/xml/kubernetes/services/ignite_config.xml
95+
value: https://github.com/futurewei-cloud/alcor/blob/master/kubernetes/services/ignite_config.xml
9696
- name: IGNITE_QUIET
9797
value: "false"
9898
- name: JVM_OPTS

kubernetes/services/ignite_config.xml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,100 @@ Copyright(c) 2020 Futurewei Cloud
4343
</bean>
4444
</property>
4545

46+
<property name="cacheConfiguration">
47+
<list>
48+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
49+
<!-- Set the cache name. -->
50+
<property name="name" value="dpm_nodeinfo_cache"/>
51+
<!-- Set the cache mode. -->
52+
<property name="atomicityMode" value="TRANSACTIONAL"/>
53+
<!-- Other cache parameters. -->
54+
<property name="cacheMode" value="PARTITIONED"/>
55+
</bean>
56+
57+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
58+
<!-- Set the cache name. -->
59+
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalPorts"/>
60+
<!-- Set the cache mode. -->
61+
<property name="atomicityMode" value="TRANSACTIONAL"/>
62+
<!-- Other cache parameters. -->
63+
<property name="cacheMode" value="PARTITIONED"/>
64+
</bean>
65+
66+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
67+
<!-- Set the cache name. -->
68+
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalSubnets"/>
69+
<!-- Set the cache mode. -->
70+
<property name="atomicityMode" value="TRANSACTIONAL"/>
71+
<!-- Other cache parameters. -->
72+
<property name="cacheMode" value="PARTITIONED"/>
73+
</bean>
74+
75+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
76+
<!-- Set the cache name. -->
77+
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalSubnetPorts"/>
78+
<!-- Set the cache mode. -->
79+
<property name="atomicityMode" value="TRANSACTIONAL"/>
80+
<!-- Other cache parameters. -->
81+
<property name="cacheMode" value="PARTITIONED"/>
82+
</bean>
83+
84+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
85+
<!-- Set the cache name. -->
86+
<property name="name" value="com.futurewei.alcor.dataplane.entity.GatewayInfo"/>
87+
<!-- Set the cache mode. -->
88+
<property name="atomicityMode" value="TRANSACTIONAL"/>
89+
<!-- Other cache parameters. -->
90+
<property name="cacheMode" value="PARTITIONED"/>
91+
</bean>
92+
93+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
94+
<!-- Set the cache name. -->
95+
<property name="name" value="ncm_nodeinfo_cache"/>
96+
<!-- Set the cache mode. -->
97+
<property name="atomicityMode" value="TRANSACTIONAL"/>
98+
<!-- Other cache parameters. -->
99+
<property name="cacheMode" value="PARTITIONED"/>
100+
</bean>
101+
102+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
103+
<!-- Set the cache name. -->
104+
<property name="name" value="com.futurewei.alcor.netwconfigmanager.entity.ResourceMeta"/>
105+
<!-- Set the cache mode. -->
106+
<property name="atomicityMode" value="TRANSACTIONAL"/>
107+
<!-- Other cache parameters. -->
108+
<property name="cacheMode" value="PARTITIONED"/>
109+
</bean>
110+
111+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
112+
<!-- Set the cache name. -->
113+
<property name="name" value="com.futurewei.alcor.netwconfigmanager.entity.VpcResourceMeta"/>
114+
<!-- Set the cache mode. -->
115+
<property name="atomicityMode" value="TRANSACTIONAL"/>
116+
<!-- Other cache parameters. -->
117+
<property name="cacheMode" value="PARTITIONED"/>
118+
</bean>
119+
120+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
121+
<!-- Set the cache name. -->
122+
<property name="name" value="java.lang.Object"/>
123+
<!-- Set the cache mode. -->
124+
<property name="atomicityMode" value="TRANSACTIONAL"/>
125+
<!-- Other cache parameters. -->
126+
<property name="cacheMode" value="PARTITIONED"/>
127+
</bean>
128+
129+
<bean class="org.apache.ignite.configuration.CacheConfiguration">
130+
<!-- Set the cache name. -->
131+
<property name="name" value="com.futurewei.alcor.dataplane.entity.VpcResourceMeta"/>
132+
<!-- Set the cache mode. -->
133+
<property name="atomicityMode" value="TRANSACTIONAL"/>
134+
<!-- Other cache parameters. -->
135+
<property name="cacheMode" value="PARTITIONED"/>
136+
</bean>
137+
</list>
138+
</property>
139+
46140
<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
47141
<property name="discoverySpi">
48142
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: ncm-configmap
5+
data:
6+
application.properties: |
7+
dataplane.grpc.port = 50001
8+
dataplane.isovs=true
9+
spring.redis.host=localhost
10+
spring.redis.port=6380
11+
12+
grpc.min-threads = 100
13+
grpc.max-threads = 200
14+
grpc.threads-pool-name = grpc-thread-pool
15+
protobuf.goal-state-message.version = 102
16+
17+
ignite.host=ignite-alcor-service.ignite-alcor.svc.cluster.local
18+
ignite.port=10800
19+
ignite.thin.client.enable=true
20+
#ignite.key-store-path=keystore.jks
21+
#ignite.key-store-password=123456
22+
#ignite.trust-store-path=truststore.jks
23+
#ignite.trust-store-password=123456
24+
logging.level.root=DEBUG
25+
spring.servlet.multipart.enabled=true
26+
spring.servlet.multipart.file-size-threshold=2KB
27+
spring.servlet.multipart.max-file-size=200MB
28+
spring.servlet.multipart.max-request-size=215MB
29+
microservices.netwconfigmanager.service.url=http://netwconfigmanager-service.default.svc.cluster.local:30016/network-configuration
30+
microservices.dataplane.nodeservice.url=http://dataplanemanager-service.default.svc.cluster.local:30010/nodes
31+
32+
---
33+
apiVersion: apps/v1
34+
kind: Deployment
35+
metadata:
36+
labels:
37+
app: networkconfigmanager
38+
name: networkconfigmanager
39+
spec:
40+
selector:
41+
matchLabels:
42+
app: networkconfigmanager
43+
replicas: 5
44+
template:
45+
metadata:
46+
labels:
47+
app: networkconfigmanager
48+
spec:
49+
volumes:
50+
- name: ncm-volume
51+
configMap:
52+
name: ncm-configmap
53+
items:
54+
- key: application.properties
55+
path: application.properties
56+
containers:
57+
- image: network_config_manager:v1.0
58+
name: networkconfigmanager-web
59+
imagePullPolicy: IfNotPresent
60+
command: ["java", "-jar", "/app/AlcorNetworkConfigManager-0.1.0.jar", "--spring.config.location=/etc/ncm/application.properties"]
61+
ports:
62+
- containerPort: 8080
63+
volumeMounts:
64+
- name: ncm-volume
65+
mountPath: /etc/ncm
66+
envFrom:
67+
- configMapRef:
68+
name: ncm-configmap
69+
---
70+
apiVersion: v1
71+
kind: Service
72+
metadata:
73+
name: netwconfigmanager-service
74+
labels:
75+
name: netwconfigmanager-service
76+
spec:
77+
type: NcmPort
78+
ports:
79+
- port: 9014
80+
targetPort: 8080
81+
nodePort: 30014
82+
selector:
83+
app: netwconfigmanager
84+

legacy/src/com/futurewei/alcor/controller/db/ignite/IgniteCache.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public IgniteCache(IgniteClient igniteClient, String name) {
4646

4747
try {
4848
cache = igniteClient.getOrCreateCache(name);
49+
logger.log(Level.INFO, "Cache " + name + " AtomicityMode is " + cache.getConfiguration().getAtomicityMode());
4950
} catch (ClientException e) {
5051
logger.log(Level.WARNING, "Create cache for vpc failed:" + e.getMessage());
5152
} catch (Exception e) {
@@ -125,4 +126,4 @@ public boolean remove(K key) throws CacheException {
125126
public Transaction getTransaction() {
126127
return transaction;
127128
}
128-
}
129+
}

lib/src/main/java/com/futurewei/alcor/common/db/ignite/IgniteClientDbCache.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class IgniteClientDbCache<K, V> implements IgniteICache<K, V> {
5252
public IgniteClientDbCache(IgniteClient igniteClient, String name) {
5353
try {
5454
this.cache = igniteClient.getOrCreateCache(name);
55+
logger.log(Level.INFO, "Cache " + name + " AtomicityMode is " + this.cache.getConfiguration().getAtomicityMode());
5556
} catch (ClientException e) {
5657
logger.log(Level.WARNING, "Create cache for client " + name + " failed:" + e.getMessage());
5758
}
@@ -63,6 +64,7 @@ public IgniteClientDbCache(IgniteClient igniteClient, String name) {
6364
public IgniteClientDbCache(IgniteClient igniteClient, String name, ExpiryPolicy ep) {
6465
try {
6566
this.cache = igniteClient.getOrCreateCache(name).withExpirePolicy(ep);
67+
logger.log(Level.INFO, "Cache " + name + " AtomicityMode is " + this.cache.getConfiguration().getAtomicityMode());
6668
} catch (ClientException e) {
6769
logger.log(Level.WARNING, "Create cache for client " + name + " failed:" + e.getMessage());
6870
}
@@ -203,4 +205,4 @@ public long size() {
203205
public Transaction getTransaction() {
204206
return transaction;
205207
}
206-
}
208+
}

lib/src/main/java/com/futurewei/alcor/common/db/ignite/IgniteClientDistributedLock.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public IgniteClientDistributedLock(IgniteClient igniteClient, String name, int t
5050
cfg.setName(name);
5151
cfg.setExpiryPolicy(ep);
5252
cache = igniteClient.getOrCreateCache(cfg);
53+
logger.log(Level.INFO, "Cache " + name + " AtomicityMode is " + cache.getConfiguration().getAtomicityMode());
5354
this.tryInterval = tryInterval;
5455
} catch (ClientException e) {
5556
logger.log(Level.WARNING, "Create distributed lock cache failed:" + e.getMessage());
@@ -105,4 +106,4 @@ public void unlock(String lockKey) throws DistributedLockException {
105106
public String getLockPrefix() {
106107
return this.name;
107108
}
108-
}
109+
}

lib/src/main/java/com/futurewei/alcor/common/db/ignite/IgniteDbCache.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public IgniteDbCache(Ignite ignite, String name) {
5757
try {
5858
this.cache = ignite.getOrCreateCache(name);
5959
} catch (javax.cache.CacheException e) {
60+
this.cache = ignite.getOrCreateCache(name);
6061
logger.log(Level.WARNING, "Create cache for client " + name + " failed:" + e.getMessage());
6162
} catch (Exception e) {
6263
logger.log(Level.WARNING, "Unexpected failure:" + e.getMessage());
@@ -214,4 +215,4 @@ public long size() {
214215
public Transaction getTransaction() {
215216
return transaction;
216217
}
217-
}
218+
}

lib/src/main/java/com/futurewei/alcor/common/service/IgniteCache.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public IgniteCache(IgniteClient igniteClient, String name) {
4545

4646
try {
4747
cache = igniteClient.getOrCreateCache(name);
48+
logger.log(Level.INFO, "Cache " + name + " AtomicityMode is " + cache.getConfiguration().getAtomicityMode());
4849
} catch (ClientException e) {
4950
logger.log(Level.WARNING, "Create cache for vpc failed:" + e.getMessage());
5051
} catch (Exception e) {
@@ -124,4 +125,4 @@ public boolean remove(K key) throws CacheException {
124125
public Transaction getTransaction() {
125126
return transaction;
126127
}
127-
}
128+
}

0 commit comments

Comments
 (0)