|
| 1 | +diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java |
| 2 | +index 24df9481..6451a97d 100755 |
| 3 | +--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java |
| 4 | ++++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java |
| 5 | +@@ -1196,6 +1196,14 @@ public class Configuration implements Iterable<Map.Entry<String,String>>, |
| 6 | + + MAX_SUBST + " " + expr); |
| 7 | + } |
| 8 | + |
| 9 | ++ private String getStackTrace() { |
| 10 | ++ String stacktrace = " "; |
| 11 | ++ for (StackTraceElement element : Thread.currentThread().getStackTrace()) { |
| 12 | ++ stacktrace = stacktrace.concat(element.getClassName() + "\t"); |
| 13 | ++ } |
| 14 | ++ return stacktrace; |
| 15 | ++ } |
| 16 | ++ |
| 17 | + String getenv(String name) { |
| 18 | + return System.getenv(name); |
| 19 | + } |
| 20 | +@@ -1220,11 +1228,14 @@ public class Configuration implements Iterable<Map.Entry<String,String>>, |
| 21 | + * or null if no such property exists. |
| 22 | + */ |
| 23 | + public String get(String name) { |
| 24 | ++ String ctestParam = name; //CTEST |
| 25 | + String[] names = handleDeprecation(deprecationContext.get(), name); |
| 26 | + String result = null; |
| 27 | + for(String n : names) { |
| 28 | ++ ctestParam = n; //CTEST |
| 29 | + result = substituteVars(getProps().getProperty(n)); |
| 30 | + } |
| 31 | ++ LOG.warn("[CTEST][GET-PARAM] " + ctestParam); //CTEST |
| 32 | + return result; |
| 33 | + } |
| 34 | + |
| 35 | +@@ -1312,11 +1323,14 @@ public class Configuration implements Iterable<Map.Entry<String,String>>, |
| 36 | + * its replacing property and null if no such property exists. |
| 37 | + */ |
| 38 | + public String getRaw(String name) { |
| 39 | ++ String ctestParam = name; //CTEST |
| 40 | + String[] names = handleDeprecation(deprecationContext.get(), name); |
| 41 | + String result = null; |
| 42 | + for(String n : names) { |
| 43 | ++ ctestParam = n; //CTEST |
| 44 | + result = getProps().getProperty(n); |
| 45 | + } |
| 46 | ++ LOG.warn("[CTEST][GET-PARAM] " + ctestParam); //CTEST |
| 47 | + return result; |
| 48 | + } |
| 49 | + |
| 50 | +@@ -1364,6 +1378,10 @@ public class Configuration implements Iterable<Map.Entry<String,String>>, |
| 51 | + set(name, value, null); |
| 52 | + } |
| 53 | + |
| 54 | ++ public void set(String name, String value, String source) { |
| 55 | ++ set(name, value, source, true); |
| 56 | ++ } |
| 57 | ++ |
| 58 | + /** |
| 59 | + * Set the <code>value</code> of the <code>name</code> property. If |
| 60 | + * <code>name</code> is deprecated, it also sets the <code>value</code> to |
| 61 | +@@ -1376,7 +1394,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>, |
| 62 | + * (For debugging). |
| 63 | + * @throws IllegalArgumentException when the value or name is null. |
| 64 | + */ |
| 65 | +- public void set(String name, String value, String source) { |
| 66 | ++ public void set(String name, String value, String source, boolean log_enabled) { |
| 67 | + Preconditions.checkArgument( |
| 68 | + name != null, |
| 69 | + "Property name must not be null"); |
| 70 | +@@ -1388,6 +1406,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>, |
| 71 | + if (deprecations.getDeprecatedKeyMap().isEmpty()) { |
| 72 | + getProps(); |
| 73 | + } |
| 74 | ++ if(log_enabled) LOG.warn("[CTEST][SET-PARAM] " + name + getStackTrace()); //CTEST |
| 75 | + getOverlay().setProperty(name, value); |
| 76 | + getProps().setProperty(name, value); |
| 77 | + String newSource = (source == null ? "programmatically" : source); |
| 78 | +@@ -1398,6 +1417,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>, |
| 79 | + if(altNames != null) { |
| 80 | + for(String n: altNames) { |
| 81 | + if(!n.equals(name)) { |
| 82 | ++ if(log_enabled) LOG.warn("[CTEST][SET-PARAM] " + n + getStackTrace()); //CTEST |
| 83 | + getOverlay().setProperty(n, value); |
| 84 | + getProps().setProperty(n, value); |
| 85 | + putIntoUpdatingResource(n, new String[] {newSource}); |
| 86 | +@@ -1409,6 +1429,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>, |
| 87 | + String[] names = handleDeprecation(deprecationContext.get(), name); |
| 88 | + String altSource = "because " + name + " is deprecated"; |
| 89 | + for(String n : names) { |
| 90 | ++ if(log_enabled) LOG.warn("[CTEST][SET-PARAM] " + n + getStackTrace()); //CTEST |
| 91 | + getOverlay().setProperty(n, value); |
| 92 | + getProps().setProperty(n, value); |
| 93 | + putIntoUpdatingResource(n, new String[] {altSource}); |
| 94 | +@@ -1481,11 +1502,14 @@ public class Configuration implements Iterable<Map.Entry<String,String>>, |
| 95 | + * doesn't exist. |
| 96 | + */ |
| 97 | + public String get(String name, String defaultValue) { |
| 98 | ++ String ctestParam = name; //CTEST |
| 99 | + String[] names = handleDeprecation(deprecationContext.get(), name); |
| 100 | + String result = null; |
| 101 | + for(String n : names) { |
| 102 | ++ ctestParam = n; //CTEST |
| 103 | + result = substituteVars(getProps().getProperty(n, defaultValue)); |
| 104 | + } |
| 105 | ++ LOG.warn("[CTEST][GET-PARAM] " + ctestParam); //CTEST |
| 106 | + return result; |
| 107 | + } |
| 108 | + |
0 commit comments