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 2017/09/01 17:08:01 UTC

[jira] [Comment Edited] (PHOENIX-4148) COUNT(DISTINCT(...)) should have a memory size limit

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

James Taylor edited comment on PHOENIX-4148 at 9/1/17 5:07 PM:
---------------------------------------------------------------

See example in GroupedAggregateRegionObserver of {{GlobalCache.getTenantCache(env, tenantId)}}. You'll want to retrieve the tenantId using {{ScanUtil.getTenantId(scan)}}. It might be null or not, depending on if the query was done through a tenant-specific connection. Also, this javadoc explains it:
{code}
    /**
     * Get the tenant cache associated with the tenantId. If tenantId is not applicable, null may be
     * used in which case a global tenant cache is returned.
     * @param env the HBase configuration
     * @param tenantId the tenant ID or null if not applicable.
     * @return TenantCache
     */
    public static TenantCache getTenantCache(RegionCoprocessorEnvironment env, ImmutableBytesPtr tenantId) {
{code}


was (Author: jamestaylor):
Use null as the tenantId. See example in GroupedAggregateRegionObserver of {{GlobalCache.getTenantCache(env, tenantId)}} and this javadoc:
{code}
    /**
     * Get the tenant cache associated with the tenantId. If tenantId is not applicable, null may be
     * used in which case a global tenant cache is returned.
     * @param env the HBase configuration
     * @param tenantId the tenant ID or null if not applicable.
     * @return TenantCache
     */
    public static TenantCache getTenantCache(RegionCoprocessorEnvironment env, ImmutableBytesPtr tenantId) {
{code}

> COUNT(DISTINCT(...)) should have a memory size limit
> ----------------------------------------------------
>
>                 Key: PHOENIX-4148
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4148
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Lars Hofhansl
>
> I just managed to kill (hang) a region server by issuing a COUNT(DISTINCT(...)) query over a column with very high cardinality (20m in this case).
> This is perhaps not a useful thing to do, but Phoenix should nonetheless not allow to have a server fail because of a query.
> [~jamestaylor], I see there GlobalMemoryManager, but I do not quite see how I'd get a reference to one, once needs a tenant id, etc.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)