sv2000 commented on a change in pull request #2924: [GOBBLIN-1084] Refresh
flowgraph when templates are modified
URL: https://github.com/apache/incubator-gobblin/pull/2924#discussion_r393159757
##########
File path:
gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java
##########
@@ -128,11 +131,15 @@ public boolean shouldPollGit() {
*/
@Override
void processGitConfigChanges() throws GitAPIException, IOException {
- if (flowTemplateCatalog.isPresent() && (flowTemplateCatalog.get()
instanceof ObservingFSFlowEdgeTemplateCatalog)) {
- ObservingFSFlowEdgeTemplateCatalog catalog =
(ObservingFSFlowEdgeTemplateCatalog) flowTemplateCatalog.get();
- if (catalog.isShouldRefreshFlowGraph()) {
- this.gitRepo.initRepository();
- catalog.setShouldRefreshFlowGraph(false);
+ if (lock.tryLock()) {
Review comment:
So here is the race condition I was thinking of:
1. FlowCatalog has been refreshed, so it sets shouldRefreshFlowGraph to
true.
2. GitMonitoringService then calls processGitConfigChanges(), and at some
point before the end of this method, FlowCatalog observes another refresh and
sets shouldRefreshFlowGraph flag to true.
3. shouldRefreshFlowGraph is reset by GitMonitoringService to false at the
end of processGitConfigChanges().
So the GitMonitoringService can miss the 2nd catalog refresh and fail to add
edges. LMK, if this is still not clear.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services