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

Commit

Permalink
Transaction Atomicity Mode changes (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkommoju authored May 10, 2021
1 parent b3dbbd4 commit 64f5d83
Show file tree
Hide file tree
Showing 11 changed files with 289 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ ignite/
# python cache
__pycache__/


# vim swap files
*.swp
94 changes: 94 additions & 0 deletions config/ignite-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,99 @@ Copyright(c) 2020 Futurewei Cloud
</property>
</bean>
</property>

<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="dpm_nodeinfo_cache"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalPorts"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalSubnets"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalSubnetPorts"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.dataplane.entity.GatewayInfo"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="ncm_nodeinfo_cache"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.netwconfigmanager.entity.ResourceMeta"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.netwconfigmanager.entity.VpcResourceMeta"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="java.lang.Object"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.dataplane.entity.VpcResourceMeta"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>
</list>
</property>
</bean>
</beans>
2 changes: 1 addition & 1 deletion kubernetes/services/ignite_alcor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ spec:
- name: OPTION_LIBS
value: ignite-kubernetes,ignite-rest-http
- name: CONFIG_URI
value: https://raw.githubusercontent.com/kevin-zhonghao/alcor/xml/kubernetes/services/ignite_config.xml
value: https://github.com/futurewei-cloud/alcor/blob/master/kubernetes/services/ignite_config.xml
- name: IGNITE_QUIET
value: "false"
- name: JVM_OPTS
Expand Down
94 changes: 94 additions & 0 deletions kubernetes/services/ignite_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,100 @@ Copyright(c) 2020 Futurewei Cloud
</bean>
</property>

<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="dpm_nodeinfo_cache"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalPorts"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalSubnets"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.dataplane.entity.InternalSubnetPorts"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.dataplane.entity.GatewayInfo"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="ncm_nodeinfo_cache"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.netwconfigmanager.entity.ResourceMeta"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.netwconfigmanager.entity.VpcResourceMeta"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="java.lang.Object"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>

<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="com.futurewei.alcor.dataplane.entity.VpcResourceMeta"/>
<!-- Set the cache mode. -->
<property name="atomicityMode" value="TRANSACTIONAL"/>
<!-- Other cache parameters. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>
</list>
</property>

<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
Expand Down
84 changes: 84 additions & 0 deletions kubernetes/services/network_config_manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: ncm-configmap
data:
application.properties: |
dataplane.grpc.port = 50001
dataplane.isovs=true
spring.redis.host=localhost
spring.redis.port=6380
grpc.min-threads = 100
grpc.max-threads = 200
grpc.threads-pool-name = grpc-thread-pool
protobuf.goal-state-message.version = 102
ignite.host=ignite-alcor-service.ignite-alcor.svc.cluster.local
ignite.port=10800
ignite.thin.client.enable=true
#ignite.key-store-path=keystore.jks
#ignite.key-store-password=123456
#ignite.trust-store-path=truststore.jks
#ignite.trust-store-password=123456
logging.level.root=DEBUG
spring.servlet.multipart.enabled=true
spring.servlet.multipart.file-size-threshold=2KB
spring.servlet.multipart.max-file-size=200MB
spring.servlet.multipart.max-request-size=215MB
microservices.netwconfigmanager.service.url=http://netwconfigmanager-service.default.svc.cluster.local:30016/network-configuration
microservices.dataplane.nodeservice.url=http://dataplanemanager-service.default.svc.cluster.local:30010/nodes
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: networkconfigmanager
name: networkconfigmanager
spec:
selector:
matchLabels:
app: networkconfigmanager
replicas: 5
template:
metadata:
labels:
app: networkconfigmanager
spec:
volumes:
- name: ncm-volume
configMap:
name: ncm-configmap
items:
- key: application.properties
path: application.properties
containers:
- image: network_config_manager:v1.0
name: networkconfigmanager-web
imagePullPolicy: IfNotPresent
command: ["java", "-jar", "/app/AlcorNetworkConfigManager-0.1.0.jar", "--spring.config.location=/etc/ncm/application.properties"]
ports:
- containerPort: 8080
volumeMounts:
- name: ncm-volume
mountPath: /etc/ncm
envFrom:
- configMapRef:
name: ncm-configmap
---
apiVersion: v1
kind: Service
metadata:
name: netwconfigmanager-service
labels:
name: netwconfigmanager-service
spec:
type: NcmPort
ports:
- port: 9014
targetPort: 8080
nodePort: 30014
selector:
app: netwconfigmanager

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public IgniteCache(IgniteClient igniteClient, String name) {

try {
cache = igniteClient.getOrCreateCache(name);
logger.log(Level.INFO, "Cache " + name + " AtomicityMode is " + cache.getConfiguration().getAtomicityMode());
} catch (ClientException e) {
logger.log(Level.WARNING, "Create cache for vpc failed:" + e.getMessage());
} catch (Exception e) {
Expand Down Expand Up @@ -125,4 +126,4 @@ public boolean remove(K key) throws CacheException {
public Transaction getTransaction() {
return transaction;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class IgniteClientDbCache<K, V> implements IgniteICache<K, V> {
public IgniteClientDbCache(IgniteClient igniteClient, String name) {
try {
this.cache = igniteClient.getOrCreateCache(name);
logger.log(Level.INFO, "Cache " + name + " AtomicityMode is " + this.cache.getConfiguration().getAtomicityMode());
} catch (ClientException e) {
logger.log(Level.WARNING, "Create cache for client " + name + " failed:" + e.getMessage());
}
Expand All @@ -63,6 +64,7 @@ public IgniteClientDbCache(IgniteClient igniteClient, String name) {
public IgniteClientDbCache(IgniteClient igniteClient, String name, ExpiryPolicy ep) {
try {
this.cache = igniteClient.getOrCreateCache(name).withExpirePolicy(ep);
logger.log(Level.INFO, "Cache " + name + " AtomicityMode is " + this.cache.getConfiguration().getAtomicityMode());
} catch (ClientException e) {
logger.log(Level.WARNING, "Create cache for client " + name + " failed:" + e.getMessage());
}
Expand Down Expand Up @@ -203,4 +205,4 @@ public long size() {
public Transaction getTransaction() {
return transaction;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public IgniteClientDistributedLock(IgniteClient igniteClient, String name, int t
cfg.setName(name);
cfg.setExpiryPolicy(ep);
cache = igniteClient.getOrCreateCache(cfg);
logger.log(Level.INFO, "Cache " + name + " AtomicityMode is " + cache.getConfiguration().getAtomicityMode());
this.tryInterval = tryInterval;
} catch (ClientException e) {
logger.log(Level.WARNING, "Create distributed lock cache failed:" + e.getMessage());
Expand Down Expand Up @@ -105,4 +106,4 @@ public void unlock(String lockKey) throws DistributedLockException {
public String getLockPrefix() {
return this.name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public IgniteDbCache(Ignite ignite, String name) {
try {
this.cache = ignite.getOrCreateCache(name);
} catch (javax.cache.CacheException e) {
this.cache = ignite.getOrCreateCache(name);
logger.log(Level.WARNING, "Create cache for client " + name + " failed:" + e.getMessage());
} catch (Exception e) {
logger.log(Level.WARNING, "Unexpected failure:" + e.getMessage());
Expand Down Expand Up @@ -214,4 +215,4 @@ public long size() {
public Transaction getTransaction() {
return transaction;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public IgniteCache(IgniteClient igniteClient, String name) {

try {
cache = igniteClient.getOrCreateCache(name);
logger.log(Level.INFO, "Cache " + name + " AtomicityMode is " + cache.getConfiguration().getAtomicityMode());
} catch (ClientException e) {
logger.log(Level.WARNING, "Create cache for vpc failed:" + e.getMessage());
} catch (Exception e) {
Expand Down Expand Up @@ -124,4 +125,4 @@ public boolean remove(K key) throws CacheException {
public Transaction getTransaction() {
return transaction;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ server.port=9014

# Node Manager Microservice url configuration
microservices.node.service.url=http://localhost:9007/nodes
microservices.dataplane.nodeservice.url=http://localhost:9010/nodes

dataplane.grpc.port = 50001
dataplane.isovs=true
Expand Down Expand Up @@ -43,4 +44,4 @@ management.health.redis.enabled=false
#####Logging configuration#####
#logging.file.path=./
#logging.file.name=port-manager.log
logging.level.root=INFO
logging.level.root=INFO

0 comments on commit 64f5d83

Please sign in to comment.