Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix concurrency issue on virtual router #1465

Closed

Conversation

remibergsma
Copy link
Contributor

The json files now have UUIDs to prevent them from getting overwritten before they've been executed. Prevents config to be pushed to the wrong router :-s

2016-02-25 18:32:23,797 DEBUG [c.c.a.t.Request] (AgentManager-Handler-1:null) (logid:) Seq 2-4684025087442026584: Processing:  { Ans: , MgmtId: 90520732674657, via: 2, Ver: v1, Flags: 10, [{"com.cloud.agent.api.routing.GroupA
nswer":{"results":["null - success: null","null - success: [INFO] update_config.py :: Processing incoming file => vm_dhcp_entry.json.4ea45061-2efb-4467-8eaa-db3d77fb0a7b\n[INFO] Processing JSON file vm_dhcp_entry.json.4ea4506
1-2efb-4467-8eaa-db3d77fb0a7b\n"],"result":true,"wait":0}}] }

On the router:

2016-02-25 18:32:23,416  merge.py __moveFile:298 Processed file written to /var/cache/cloud/processed/vm_dhcp_entry.json.4ea45061-2efb-4467-8eaa-db3d77fb0a7b.gz

screen shot 2016-02-25 at 19 33 17

@@ -91,7 +91,7 @@ do
done < $cfg

#remove the configuration file, log file should have all the records as well
rm -f $cfg
mv $cfg /var/cache/cloud/processed/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know this will get cleaned?

@DaanHoogland
Copy link
Contributor

code LGTM running integration suite

@remibergsma
Copy link
Contributor Author

@DaanHoogland This can be pointed towards 4.7 so I will close this and open one to 4.7 instead of master.

@remibergsma remibergsma closed this Apr 7, 2016
@@ -104,13 +109,25 @@ public static AbstractConfigItemFacade getInstance(final Class<? extends Network
return instance;
}


private static String appendUuidToJsonFiles(final String filename) {
String remoteFileName = new String(filename);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are is a new String(filename) being done? This avoids the constant pool, and is extremely expensive. Consider the following usage of StringBuilder to avoid unnecessary pressure on the String constant pool due to the new call and string concatenation:

final StringBuilder remoteFileName = new StringBuilder(filename);
if (filename.endWith("json")) {
    remoteFileName.append(".");
    remoteFileName.append(UUID.randomUUID()); // implicit call to toString
}
return remoteFileName.toString();

@DaanHoogland
Copy link
Contributor

it was already started :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants