-
Notifications
You must be signed in to change notification settings - Fork 34
[Data-Plane Mgr] Add Local Cache Support to DPM #486
Conversation
chenpiaoping
commented
Nov 26, 2020
•
edited
Loading
edited
- When creating a port, save the basic information of all port in all subnet to the local cache of dpm.
- When creating router configuration get the basic information of port from the local cache of dpm according to subnet id.
- Rename DataPlane to Dpm: DataPlaneController--->DpmController, DataPlaneService--->DpmService.
- Split DpmService into multiple files according to resource type.
- Modify the content of dpm processing result.
3049555
to
3b20ef1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chenpiaoping Do we have the logics to use the cache in case of cache hit and cache miss?
Left a few minor comments. The rest looks pretty good to me.
List<Map<String, List<GoalStateOperationStatus>>> updateGoalStates(List<UnicastGoalState> unicastGoalStates) throws Exception; | ||
|
||
List<Map<String, List<GoalStateOperationStatus>>> deleteGoalStates(List<UnicastGoalState> unicastGoalStates) throws Exception; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick question: why do we remove these interfaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it is okay to keep the interfaces which reminds us that we need to implement in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about adding it when I needed it.
|
||
import com.futurewei.alcor.schema.Common.OperationType; | ||
|
||
public class ResourceService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResourceService class could be moved on layer up to com.futurewei.alcor.dataplane.service;
for (InternalPortEntity portEntity: portEntities) { | ||
List<PortEntity.FixedIp> fixedIps = portEntity.getFixedIps(); | ||
if (fixedIps == null) { | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to log this unusual portEntity (at least on the DEBUG level) as this is an unexpected scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
subnetPorts.setGatewayPortMac(subnetEntity.getGatewayMacAddress()); | ||
subnetPorts.setGatewayPortIp(subnetEntity.getGatewayIp()); | ||
|
||
//FIXME: get the gateway port id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GW port could be retrieved from SubnetEntity I believe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll check it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
@chenpiaoping Let us get back on this PR. It has been a while. |
BTW #468 is merged to master. After the cache is in, we can start testing E2E. |
OK,there seems to be a lot of conflict. |
Under what circumstances will miss occur? |
yeah, DPM is very popular these days :-) |
In an ideal situation, the port creation should always reach DPM earlier than RM reaches DPM for routing rule update. We can imagine that in some rare (but possible) race condition, the second call could reach DPM earlier than the first call. |
d36fa80
to
6961a9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. Left a comment on one place that might have potential issue. Please take a look to see if we could further optimize shortly. @chenpiaoping
public List<Map<String, List<Goalstateprovisioner.GoalStateOperationReply.GoalStateOperationStatus>>> createGoalStates(List<UnicastGoalState> unicastGoalStates) throws Exception { | ||
public List<String> createGoalStates(List<UnicastGoalState> unicastGoalStates) throws Exception { | ||
List<String> failedHosts = new ArrayList<>(); | ||
|
||
for (UnicastGoalState unicastGoalState: unicastGoalStates) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of large number of neighbors, this for-loop could slow down potentially. See if we can optimize this part. @chenpiaoping