commit | 6d05dba08ce5935ea9ceba867c4ee7bcf7a1087c | [log] [tgz] |
---|---|---|
author | Martin Fick <mfick@codeaurora.org> | Wed Oct 16 12:24:13 2019 -0600 |
committer | Martin Fick <mfick@codeaurora.org> | Wed Oct 16 12:57:04 2019 -0600 |
tree | 04548ad9f0ec77960e8b5d73110d5d401771002d | |
parent | d8194b291bb0433b5c3abe059ebad6f00fcb3a22 [diff] |
Make persistent task keys stable GSON was used to create json as the input for sha1 task keys, however gson can order the json keys differently anytime. Use the values in a specific order to create stable keys. Bug: Issue 11760 Change-Id: I6900b5ddb3ba8ab7b5cf7803ae9dd551b5980a59
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java index cc1f10e..3b174a3 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
@@ -116,7 +116,8 @@ public Task(ReplicateRefUpdate update) { this.update = update; json = GSON.toJson(update) + "\n"; - taskKey = sha1(json).name(); + String key = update.project + "\n" + update.ref + "\n" + update.uri + "\n" + update.remote; + taskKey = sha1(key).name(); file = refUpdates().resolve(taskKey); }