Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

METRON-672: SolrIndexingIntegrationTest fails intermittently #424

Closed
wants to merge 4 commits into from

Conversation

cestella
Copy link
Member

This failure is due to a change in default behavior when indexing was split off into a separate configuration file. The default batch size was changed from 5 to 1 in particular. This, by itself, is not a problem, but the IndexingIntegrationTest (base class for Solr and Elastic search integration tests):

  • submits the configs
  • starts the indexing topology
  • writes the input data

The writing of the input data may happen before the topology fully loads or the configuration fully loads, especially if the machine running the unit tests is under load (like with travis). As a result, the first record may end up with the default batch size (of 1) and write out immediately because the indexing configs haven't loaded into zookeeper just yet. In that circumstance, eventually the configs load and the batch size is set to 5. Meanwhile we've written 10 records and are expecting 10 in return, but because you wrote the first out already and then the next 5, we have another 4 pending to be written by the BulkMessageWriterBolt.

So, the failure scenario is as follows:

  • Message 1 is received and the indexing config hasn't loaded yet, so the batch size is 1 and it immediately gets written out
  • Message 2 - 5 are each received and the indexing config has loaded, so the batch size is 5 and it queues up
  • Message 6 is received and the batch writes out
  • Messages 7 - 10 are received, but never make a full batch, so we time out waiting for them to write out

The fix is to ensure that we don't write out messages to kafka until the configs are loaded, which is what this PR does.

@cestella
Copy link
Member Author

cestella commented Jan 26, 2017

To test this locally, because it's extremely sporadic that it happens locally (1 out of every 50 times I run the test), I did the following:

  • Built and installed the project in Maven: mvn -DskipTests clean install
  • Ran the metron-solr project integration tests for at least 2 hours in a row ensuring that they don't fail. So, from metron-platform/metron-solr: echo "" > /tmp/output;while [ $(cat /tmp/output | grep "vs 6" | wc -l) -lt 1 ];do mvn install >& /tmp/output;done

isLoaded.set(true);
return null;
}
);
;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you kill the extra semicolon?

}
}
while(bytes == null || bytes.length == 0);
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop the return, since it's a void method.

@@ -38,6 +39,7 @@
private String enrichmentConfigsPath;
private String indexingConfigsPath;
private String profilerConfigPath;
private Optional<Function<ConfigUploadComponent, Void>> postStartCallback = Optional.empty();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this just use Consumer instead of Function? Since the second type parameter is Void, it seems like the Function is just being a Consumer anyway

@justinleet
Copy link
Contributor

Thanks for taking the effort to dig into this. Great work. Other than a couple minor comments, I'm very happy with this.

@cestella cestella closed this Jan 26, 2017
@cestella cestella reopened this Jan 26, 2017
@cestella
Copy link
Member Author

@justinleet comments addressed, let me know if there's anything else.

@justinleet
Copy link
Contributor

Thanks again for this. I'm +1 on it.

@asfgit asfgit closed this in 0219e56 Jan 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants