YARN-5921. Incorrect synchronization in RMContextImpl#setHAServiceState/getHAServiceState. Contributed by Varun Saxena.

This commit is contained in:
Naganarasimha 2016-11-27 23:31:27 +05:30
parent 07825f2b49
commit 9f2960be19
8 changed files with 21 additions and 26 deletions

View File

@ -334,7 +334,7 @@ private static void loadData() throws Exception {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.write(cluster, user, flow, flowVersion, runid, entity.getId(), te); hbi.write(cluster, user, flow, flowVersion, runid, entity.getId(), te);
hbi.write(cluster, user, flow, flowVersion, runid, entity1.getId(), te1); hbi.write(cluster, user, flow, flowVersion, runid, entity1.getId(), te1);

View File

@ -182,7 +182,7 @@ static void loadApps(HBaseTestingUtility util) throws IOException {
te2.addEntity(entity2); te2.addEntity(entity2);
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
try { try {
hbi = new HBaseTimelineWriterImpl(util.getConfiguration()); hbi = new HBaseTimelineWriterImpl();
hbi.init(util.getConfiguration()); hbi.init(util.getConfiguration());
hbi.start(); hbi.start();
String cluster = "cluster1"; String cluster = "cluster1";
@ -360,7 +360,7 @@ static void loadEntities(HBaseTestingUtility util) throws IOException {
te.addEntity(entity2); te.addEntity(entity2);
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
try { try {
hbi = new HBaseTimelineWriterImpl(util.getConfiguration()); hbi = new HBaseTimelineWriterImpl();
hbi.init(util.getConfiguration()); hbi.init(util.getConfiguration());
hbi.start(); hbi.start();
String cluster = "cluster1"; String cluster = "cluster1";

View File

@ -155,7 +155,7 @@ public void testWriteNullApplicationToHBase() throws Exception {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
try { try {
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.start(); hbi.start();
String cluster = "cluster_check_null_application"; String cluster = "cluster_check_null_application";
@ -275,7 +275,7 @@ public void testWriteApplicationToHBase() throws Exception {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
try { try {
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.start(); hbi.start();
String cluster = "cluster_test_write_app"; String cluster = "cluster_test_write_app";
@ -502,7 +502,7 @@ public void testEvents() throws IOException {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
try { try {
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.start(); hbi.start();
String cluster = "cluster_test_events"; String cluster = "cluster_test_events";
@ -620,7 +620,7 @@ public void testNonIntegralMetricValues() throws IOException {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
try { try {
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.start(); hbi.start();
// Writing application entity. // Writing application entity.

View File

@ -194,7 +194,7 @@ public void testWriteEntityToHBase() throws Exception {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
try { try {
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.start(); hbi.start();
String cluster = "cluster_test_write_entity"; String cluster = "cluster_test_write_entity";
@ -391,7 +391,7 @@ public void testEventsWithEmptyInfo() throws IOException {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
try { try {
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.start(); hbi.start();
String cluster = "cluster_test_empty_eventkey"; String cluster = "cluster_test_empty_eventkey";
@ -496,7 +496,7 @@ public void testEventsEscapeTs() throws IOException {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
try { try {
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.start(); hbi.start();
String cluster = "clus!ter_\ttest_ev ents"; String cluster = "clus!ter_\ttest_ev ents";

View File

@ -119,7 +119,7 @@ public void testWriteFlowRunMinMax() throws Exception {
.getEntityMinStartTime(minStartTs); .getEntityMinStartTime(minStartTs);
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.write(cluster, user, flow, flowVersion, runid, appName, te); hbi.write(cluster, user, flow, flowVersion, runid, appName, te);
@ -228,7 +228,7 @@ public void testWriteFlowActivityOneFlow() throws Exception {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
String appName = "application_1111999999_1234"; String appName = "application_1111999999_1234";
hbi.write(cluster, user, flow, flowVersion, runid, appName, te); hbi.write(cluster, user, flow, flowVersion, runid, appName, te);
@ -341,7 +341,7 @@ public void testFlowActivityTableOneFlowMultipleRunIds() throws IOException {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
String appName = "application_11888888888_1111"; String appName = "application_11888888888_1111";
hbi.write(cluster, user, flow, flowVersion1, runid1, appName, te); hbi.write(cluster, user, flow, flowVersion1, runid1, appName, te);

View File

@ -184,7 +184,7 @@ public void testWriteFlowRunMinMax() throws Exception {
.getEntityMinStartTime(minStartTs); .getEntityMinStartTime(minStartTs);
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.write(cluster, user, flow, flowVersion, runid, appName, te); hbi.write(cluster, user, flow, flowVersion, runid, appName, te);
@ -290,7 +290,7 @@ public void testWriteFlowRunMetricsOneFlow() throws Exception {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
String appName = "application_11111111111111_1111"; String appName = "application_11111111111111_1111";
hbi.write(cluster, user, flow, flowVersion, runid, appName, te); hbi.write(cluster, user, flow, flowVersion, runid, appName, te);
@ -559,7 +559,7 @@ public void testWriteFlowRunMetricsPrefix() throws Exception {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
String appName = "application_11111111111111_1111"; String appName = "application_11111111111111_1111";
hbi.write(cluster, user, flow, flowVersion, 1002345678919L, appName, te); hbi.write(cluster, user, flow, flowVersion, 1002345678919L, appName, te);
@ -644,7 +644,7 @@ public void testWriteFlowRunsMetricFields() throws Exception {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
String appName = "application_11111111111111_1111"; String appName = "application_11111111111111_1111";
hbi.write(cluster, user, flow, flowVersion, runid, appName, te); hbi.write(cluster, user, flow, flowVersion, runid, appName, te);
@ -737,7 +737,7 @@ public void testWriteFlowRunFlush() throws Exception {
TimelineEntity entityApp1 = null; TimelineEntity entityApp1 = null;
TimelineEntity entityApp2 = null; TimelineEntity entityApp2 = null;
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
for (int i = start; i < count; i++) { for (int i = start; i < count; i++) {
@ -826,7 +826,7 @@ public void testFilterFlowRunsByCreatedTime() throws Exception {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.write(cluster, user, flow, "CF7022C10F1354", 1002345678919L, hbi.write(cluster, user, flow, "CF7022C10F1354", 1002345678919L,
"application_11111111111111_1111", te); "application_11111111111111_1111", te);
@ -908,7 +908,7 @@ public void testMetricFilters() throws Exception {
HBaseTimelineWriterImpl hbi = null; HBaseTimelineWriterImpl hbi = null;
Configuration c1 = util.getConfiguration(); Configuration c1 = util.getConfiguration();
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
hbi.write(cluster, user, flow, "CF7022C10F1354", 1002345678919L, hbi.write(cluster, user, flow, "CF7022C10F1354", 1002345678919L,
"application_11111111111111_1111", te); "application_11111111111111_1111", te);

View File

@ -287,7 +287,7 @@ public void testWriteFlowRunCompaction() throws Exception {
TimelineEntities te1 = null; TimelineEntities te1 = null;
TimelineEntity entityApp1 = null; TimelineEntity entityApp1 = null;
try { try {
hbi = new HBaseTimelineWriterImpl(c1); hbi = new HBaseTimelineWriterImpl();
hbi.init(c1); hbi.init(c1);
// now insert count * ( 100 + 100) metrics // now insert count * ( 100 + 100) metrics
// each call to getEntityMetricsApp1 brings back 100 values // each call to getEntityMetricsApp1 brings back 100 values

View File

@ -101,11 +101,6 @@ public HBaseTimelineWriterImpl() {
super(HBaseTimelineWriterImpl.class.getName()); super(HBaseTimelineWriterImpl.class.getName());
} }
public HBaseTimelineWriterImpl(Configuration conf) throws IOException {
super(conf.get("yarn.application.id",
HBaseTimelineWriterImpl.class.getName()));
}
/** /**
* initializes the hbase connection to write to the entity table. * initializes the hbase connection to write to the entity table.
*/ */