Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DruidNavigator loading multiple tables #309

Merged
merged 12 commits into from
Jun 22, 2017

Conversation

kevinhinterlong
Copy link
Member

It appears the locking mechanism was forced to time out while loading
multiple tables because the lock for getting all the tables was still active.

Now only the lock for getting all the tables (loadAllDatasources()) is used.

Copy link
Collaborator

@cdeszaq cdeszaq left a comment

Choose a reason for hiding this comment

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

A few things here:

  1. Changelog entry needed (probably in the Fixes section)
  2. It would be nice to have a test in place that shows the issue and that this change fixes it.
  3. I'm not sure I understand how this is fixing the problem. The main change I see is to move the get to the caller. I don't really understand how that solves the problem which, as I understand it, is that the follow-on calls are trying to run while the 1st call isn't finished. Given how the AsyncHttpClient works, multiple calls in flight at once shouldn't be a problem. And there's no lock involved (other than the implicit one in Future::get), so I'm a little confused there as well.
  4. Don't we still want to have the later calls timeout or at least finish executing before the rest of the application starts up? I think this change would allow the app to start w/o having any of the tables configured...

@QubitPi QubitPi self-assigned this May 26, 2017
import java.util.function.Supplier;
import java.util.stream.Collectors;

/**
* Hold all the dimension configurations for a generic druid configuration.
*/
public class GenericDimensionConfigs {
private final Set<DimensionConfig> dimensionConfigs;
private final Map<String, Set<DimensionConfig>> dimensionConfigs;

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not clear what the String in this map is.

} else if (druidWebService.lastUrl.equals("/datasources/table2/?full")) {
return getFullTable(datasources[1], table2_metrics, table2_dimensions)
}
println "No response for " + druidWebService.lastUrl
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you forgot to delete it?

@@ -53,7 +52,7 @@ public class AutomaticDruidConfigLoaderSpec extends Specification {
} else if (druidWebService.lastUrl == '/datasources/' + datasource + "/?full") {
return expectedMetricsAndDimensions
}
return "Unexpected URL"
println "No response for " + druidWebService.lastUrl
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you forgot to delete this?


dimensionConfigs.put(dataSourceConfiguration.getName(), tableDimensionConfigs);
});
;
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this for?

/**
* Get all the dimension configurations associated with this datasource.
*
* @param dataSourceConfiguration the datasource configuration's dimensions to load
Copy link
Contributor

Choose a reason for hiding this comment

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

Two spaces before description. Capitalize the

import java.util.List;
import java.util.Set;
import javax.validation.constraints.NotNull;
import java.util.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid start import

]
}

"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Align indentation

Copy link
Contributor

@michael-mclawhorn michael-mclawhorn left a comment

Choose a reason for hiding this comment

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

Looks pretty good

Copy link
Collaborator

@cdeszaq cdeszaq left a comment

Choose a reason for hiding this comment

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

Partial review. Didn't get as far as GenericDimensionConfigs.

@@ -90,4 +95,6 @@ Here are some sample queries that you can run to verify your server:

1. In IntelliJ, go to `File -> Open`
2. Select the `pom.xml` file at the root of the project
3. Run `GenericMain` which can be found in `fili-generic-example` (e.g. right click and choose run)
3. Under `src/main/resources/applicationConfig.properties`, change `bard__non_ui_druid_broker`,
`bard__ui_druid_broker`, `bard__druid_coord`, and other properties as needed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these properties set correctly already for what the Druid wikipedia walkthrough results in? If not, we should set them so that they are probably correct.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep these are set correctly for running it locally and they work with the wikipedia walkthrough.

I added the following note in README.md to clarify:

NOTE: if you're running this locally and haven't changed any settings (like the Wikipedia example) you can skip step 3.

import com.yahoo.bard.webservice.data.time.DefaultTimeGrain;
import com.yahoo.bard.webservice.data.time.TimeGrain;
import com.yahoo.bard.webservice.druid.client.DruidWebService;
import com.yahoo.bard.webservice.druid.client.SuccessCallback;
import com.yahoo.bard.webservice.util.IntervalUtils;

import com.fasterxml.jackson.databind.JsonNode;

Copy link
Collaborator

Choose a reason for hiding this comment

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

This import should stay down here.

@@ -69,15 +67,35 @@ public DruidNavigator(DruidWebService druidWebService) {
* ["wikiticker"]
*/
private void loadAllDatasources() {
queryDruid(rootNode -> {
final List<Future<Response>> fullTableResponses = new ArrayList<>();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't need to be final

@kevinhinterlong kevinhinterlong force-pushed the fixMultipleTableConfiguration branch from 0b71c98 to 558fe3f Compare June 8, 2017 20:41
@yahoo yahoo deleted a comment Jun 8, 2017
@yahoo yahoo deleted a comment Jun 8, 2017
@yahoo yahoo deleted a comment Jun 8, 2017
@kevinhinterlong
Copy link
Member Author

I added a note in the readme of the version this was last tested with.
I think this should be good to merge now.

@yahoo yahoo deleted a comment Jun 9, 2017
@yahoo yahoo deleted a comment Jun 9, 2017
@yahoo yahoo deleted a comment Jun 9, 2017
Copy link
Collaborator

@garyluoex garyluoex left a comment

Choose a reason for hiding this comment

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

Rebase, and Im ok with it

It appears the locking mechanism was forced to time out while loading
multiple tables
- This also adds a test to make sure that multiple tables get configured properly.
- There was also an issue with the GenericTableLoader showing the same metrics,
   granularities, etc for all tables
Now dimensions show up only in the correct table.
Also made a few fields final.
- The druid dimension loader is now causing it to fail because the
tables can not be found in the DataSourceMetadataService
- Enabled DruidDimensionLoader
- Also fix list of required settings to top of readme
@kevinhinterlong kevinhinterlong force-pushed the fixMultipleTableConfiguration branch from 4b13f9a to b6d2420 Compare June 22, 2017 18:14
@yahoo yahoo deleted a comment Jun 22, 2017
@yahoo yahoo deleted a comment Jun 22, 2017
@yahoo yahoo deleted a comment Jun 22, 2017
@garyluoex garyluoex merged commit 0e599c9 into yahoo:master Jun 22, 2017
@kevinhinterlong kevinhinterlong deleted the fixMultipleTableConfiguration branch August 8, 2017 14:52
@QubitPi QubitPi mentioned this pull request Jan 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants