User with manage_statistics privilege unable to create stats for Hive table

Bug #1425748 reported by Barry Fritchman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Trafodion
In Progress
Medium
Barry Fritchman

Bug Description

Under the following circumstances, Update Statistics will fail with an error trying to create the sb_histograms table in a schema (trafodion.hivestats) that does not exist:

1) The user is not db__root
2) The user has the manage_statistics component privilege
3) The user does NOT have the create_schema component privilege
4) There have been no previous successful attempts to update statistics on a Hive table

Without schema creating privilege, the attempt by Update Stats to create the trafodion.hivestats schema will fail without terminating execution of the statement, the assumption being that the failure was due to the schema already existing. Subsequently, the attempt to create trafodion.hivestats.sb_histograms will fail because the containing schema does not exist.

The addition of the create_schema component privilege introduces the possibility of another error besides the harmless "schema already exists" error. Even though create_schema is granted to public by default, this can't be relied on, and the error needs to be checked before deciding to continue execution. This requires some changes to the general-purpose function that executes internal statements on behalf of Update Statistics. A cleaner solution would be possible if the IF NOT EXISTS clause was supported for creation of schemas, as it is for creation of tables.

Tags: sql-cmp
Changed in trafodion:
importance: Undecided → High
status: New → In Progress
Changed in trafodion:
importance: High → Medium
Revision history for this message
Trafodion-Gerrit (neo-devtools) wrote : Fix proposed to core (master)

Fix proposed to branch: master
Review: https://review.trafodion.org/1194

Revision history for this message
Trafodion-Gerrit (neo-devtools) wrote : Fix merged to core (master)

Reviewed: https://review.trafodion.org/1194
Committed: https://github.com/trafodion/core/commit/070d1570d5b8eae9981535a93639cee6e4004559
Submitter: Trafodion Jenkins
Branch: master

commit 070d1570d5b8eae9981535a93639cee6e4004559
Author: Barry Fritchman <email address hidden>
Date: Thu Feb 26 17:17:13 2015 +0000

    Misleading error when Hivestats can't be created

    When Update Statistics is performed on a Hive table, the
    trafodion.hivestats schema is created if it doesn't already
    exist. If the user issuing the ustat statement does not
    have the create_schema component privilege, this will fail, but
    the code as it existed ignored the error, assuming it was
    a "schema already exists" error, which is expected in most
    cases. If the schema does not exist, an error is then given
    when an attempt is made to create the histograms table in
    the non-existing schema.

    This has been changed to check the error when the schema
    creation attempt fails, so the correct error is generated.
    This is a partial fix, because a user with manage_statistics
    privilege should not be prevented from executing Update
    Statistics just because the trafodion.hivestats schema did
    not already exist. The likely full solution would be to
    create the schema automatically at Trafodion initialization.

    Change-Id: I26561100bab9f6a59f3f5d0d56ce9d2aab380fa3
    Partial-Bug: #1425748

Changed in trafodion:
milestone: none → r2.0
tags: added: sql-cmp
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.