-
Notifications
You must be signed in to change notification settings - Fork 96
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
Fix DruidNavigator loading multiple tables #309
Conversation
There was a problem hiding this 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:
- Changelog entry needed (probably in the
Fixes
section) - It would be nice to have a test in place that shows the issue and that this change fixes it.
- 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 inFuture::get
), so I'm a little confused there as well. - 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...
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; | ||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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); | ||
}); | ||
; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid start import
] | ||
} | ||
|
||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good
There was a problem hiding this 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
.
fili-generic-example/README.md
Outdated
@@ -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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; | ||
|
There was a problem hiding this comment.
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<>(); |
There was a problem hiding this comment.
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
0b71c98
to
558fe3f
Compare
I added a note in the readme of the version this was last tested with. |
There was a problem hiding this 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
4b13f9a
to
b6d2420
Compare
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.