Skip to content

More fixups to git branch determination and data migrator #117

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

Merged
merged 2 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions infrastructure/src/main/java/scala/bench/DataMigrator.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.influxdb.dto.Query;
import org.influxdb.dto.QueryResult;

import java.io.IOException;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -54,7 +53,13 @@ public static void main(String[] args) {
LinkedHashMap<String, Object> newFieldsMap = new LinkedHashMap<>();
assert (newFieldNames.size() == newValues.size());
for (int i = 0; i < newFieldNames.size(); i++) {
newFieldsMap.put(newFieldNames.get(i), newValues.get(i));
String fieldName = newFieldNames.get(i);
boolean isLong = fieldName.equals("sampleCount");
if (isLong) {
newFieldsMap.put(fieldName, ((Number) newValues.get(i)).longValue());
} else {
newFieldsMap.put(fieldName, newValues.get(i));
}
}
builder.fields(newFieldsMap);
Instant parse = Instant.parse(time);
Expand Down
23 changes: 15 additions & 8 deletions infrastructure/src/main/java/scala/bench/GitWalker.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ public static GitWalkerResult walk(Repository repo) {
.retentionPolicy("autogen")
.consistency(InfluxDB.ConsistencyLevel.ALL)
.build();
createPoints("2.13.x", "fc1aea6712", batchPoints, repo, branchesMap);
createPoints("2.12.x", "132a0587ab", batchPoints, repo, branchesMap);
createPoints("v2.12.0", "05016d9035", batchPoints, repo, branchesMap);
createPoints("2.11.x", "7ac15a1210", batchPoints, repo, branchesMap);
createPoints("2.10.x", "cc672b023e", batchPoints, repo, branchesMap);
createPoints("2.9.x", "33e1dac4e4", batchPoints, repo, branchesMap);
createPoints("2.13.x", null,"fc1aea6712", batchPoints, repo, branchesMap);
createPoints("2.12.x", null, "132a0587ab", batchPoints, repo, branchesMap);

// There used to be a release branch v2.12.0. Looks to be deleted now? Use the v2.12.0 tag as the tip of this
// virtual branch.
createPoints("v2.12.0", "9a6ace1637053c094bfd395de540fe43c658b335","05016d9035", batchPoints, repo, branchesMap);

createPoints("2.11.x", null, "7ac15a1210", batchPoints, repo, branchesMap);
createPoints("2.10.x", null, "cc672b023e", batchPoints, repo, branchesMap);
createPoints("2.9.x", null, "33e1dac4e4", batchPoints, repo, branchesMap);
return new GitWalkerResult(batchPoints, branchesMap, repo);
}

Expand All @@ -50,14 +54,17 @@ private static int countParentsWithSameCommitTime(RevCommit revCommit) {

static long adjustCommitTime(RevCommit revCommit) {
int numParentsWithSameCommitTime = countParentsWithSameCommitTime(revCommit);
return (long) revCommit.getCommitTime() * 1000L + numParentsWithSameCommitTime * 10;
return (long) revCommit.getCommitTime() * 1000L + numParentsWithSameCommitTime * 10L;
}

public void upload(BatchPoints batchPoints) {

}

private static BatchPoints createPoints(String branch, String forkPoint, BatchPoints batchPoints, Repository repo, Map<String, String> branchesMap) {
private static BatchPoints createPoints(String branch, String branchRef, String forkPoint, BatchPoints batchPoints, Repository repo, Map<String, String> branchesMap) {
if (branchRef != null) {
branch = branchRef;
}
try {
ObjectId resolvedBranch = resolve(branch, repo);
ObjectId resolvedForkPoint = resolve(forkPoint, repo);
Expand Down