Merge branch 'haoyetian' of https://github.com/SerVal-DTF/fixminer_source into haoyetian

This commit is contained in:
ANIL KOYUNCU
2020-01-20 12:37:25 +01:00
2 changed files with 25 additions and 22 deletions
@@ -7,10 +7,7 @@ import redis.clients.jedis.JedisPool;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.ScanResult;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -87,13 +84,14 @@ public class AkkaTreeParser {
}
// inner.select(1);
Map<String, String> filenames = inner.hgetAll("compare");
Set<String> compare = inner.hkeys("compare");
// compare.size();
result= new ArrayList<String>(compare);
for (Map.Entry<String, String> stringStringEntry : filenames.entrySet().stream().collect(Collectors.toList())) {
// fileMap.put(stringStringEntry.getKey(),stringStringEntry.getValue());
result.add(stringStringEntry.getKey());
}
// for (Map.Entry<String, String> stringStringEntry : filenames.entrySet().stream().collect(Collectors.toList())) {
//// fileMap.put(stringStringEntry.getKey(),stringStringEntry.getValue());
// result.add(stringStringEntry.getKey());
// }
@@ -103,20 +103,21 @@ public class CompareTrees {
@Override
public void run() {
int dbsize = 1;
while(dbsize>0) {
try (Jedis outer = outerPool.getResource()) {
dbsize = Math.toIntExact(outer.scard("compare"));
}
if (dbsize != 0){
newCoreCompare(job, errorPairs, filenames, outerPool);
}
// int dbsize = 1;
boolean stop = true;
while(stop) {
// try (Jedis outer = outerPool.getResource()) {
// dbsize = Math.toIntExact(outer.scard("compare"));
// }
// if (dbsize != 0){
stop = newCoreCompare(job, errorPairs, filenames, outerPool);
// }
}
}
}
public static void newCoreCompare( String treeType,ArrayList<String> errorPairs, HashMap<String, String> filenames,JedisPool outerPool ) {
public static boolean newCoreCompare( String treeType,ArrayList<String> errorPairs, HashMap<String, String> filenames,JedisPool outerPool ) {
String pairName;
try (Jedis outer = outerPool.getResource()) {
@@ -138,7 +139,7 @@ public class CompareTrees {
case "single":
if (matchKey == null){
System.out.println();
return false;
}
Map<String, String> oldTreeString = EDiffHelper.getTreeString(keyName, i, outerPool, filenames);
Map<String, String> newTreeString = EDiffHelper.getTreeString(keyName, j, outerPool, filenames);
@@ -165,16 +166,20 @@ public class CompareTrees {
}
}
}
return;
return true;
default:
break;
return true;
// break;
}
}catch (Exception e) {
errorPairs.add(matchKey);
if (pairName == null)
return false;
log.debug("{} not comparable", pairName);
}
return true;
}
public static void coreCompare(String pairName, String treeType,JedisPool innerPool,ArrayList<String> samePairs,ArrayList<String> errorPairs, HashMap<String, String> filenames,JedisPool outerPool ) {