You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Taylor (JIRA)" <ji...@apache.org> on 2016/01/14 20:15:39 UTC

[jira] [Commented] (PHOENIX-2119) Do not copy underlying HBase configuration properties when connection properties are supplied

    [ https://issues.apache.org/jira/browse/PHOENIX-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15098662#comment-15098662 ] 

James Taylor commented on PHOENIX-2119:
---------------------------------------

[~samarthjain] - would you have some spare cycles for this one? It's pretty straightforward and will help our ReadOnlyDatabase use case. The fix would be isolated in ReadOnlyProps and here's what would be required:
- Define a new member variable in ReadOnlyProps such as overrideProps that would define a nested ReadOnlyProps for overrides.
- In the private ReadOnlyProps(ReadOnlyProps defaultProps, Properties overrides) constructor, instead of creating a new flattened Map with the overrides (which is expensive because the defaultProps can be quite large), create a new ReadOnlyProps with just the overrides and set the new member overrideProps variable.
{code}
    private ReadOnlyProps(ReadOnlyProps defaultProps, Properties overrides) {
        Map<String,String> combinedProps = Maps.newHashMapWithExpectedSize(defaultProps.props.size() + overrides.size());
        combinedProps.putAll(defaultProps.props);
        for (Entry<Object, Object> entry : overrides.entrySet()) {
            String key = entry.getKey().toString();
            String value = entry.getValue().toString();
            combinedProps.put(key, value);
        }
        this.props = ImmutableMap.copyOf(combinedProps);
    }
{code}
- In the ReadOnlyProps.getRaw() method, if overrideProps is non null, call getRaw() on that first. If null, then proceed with existing logic.
- Make sure we have some test coverage of this in new ReadOnlyPropsTest or existing PhoenixDriverTest.

This will prevent us from making a copy of a very large map on every new connection (because at SFDC, it turns out we always have override props that pass in the org iD).

> Do not copy underlying HBase configuration properties when connection properties are supplied
> ---------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-2119
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2119
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: James Taylor
>              Labels: ReadOnlyDB, SFDC
>
> Related to PHOENIX-1958, we can avoid copying the underlying HBase configuration properties when connection properties are supplied by keeping an override maps on ConnectionQueryServices. In this case, a ReadOnlyProperty get will be first done on the override map and then subsequently on the base/shared map for the HBase configuration properties.
> The reason to do this is because some applications always provide connection properties (usually for custom annotations that identify the tenant and request) and the memory overhead of copying *all* properties is too high.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)