[CBRD-27043] Expose db_histogram with name columns and the standard SELECT-privilege filter - #7976
Merged
Merged
Conversation
✅ TC Merge Gate — Merge AllowedAll TC PRs are merged, closed, or not present. TC Repositories & Branches:
|
🧪 TC Test Environment ReadyCircleCI Testing:
TC Repositories & Branches:
Next Steps:
|
soheejung-cs
marked this pull request as ready for review
September 17, 2026 11:00
Contributor
|
확인된 차단 또는 비차단 결함이 없어 현재 변경은 병합해도 안전해 보인다. Reviews (1) · Last reviewed commit: "[CBRD-27043] Note that with_fullscan is ..." |
Contributor
Author
|
/run all |
shparkcubrid
approved these changes
Sep 18, 2026
Contributor
Author
|
/run all |
soheejung-cs
force-pushed
the
CBRD-27043
branch
2 times, most recently
from
September 18, 2026 05:16
077e55b to
742a4cc
Compare
Contributor
Author
|
/run all |
added 2 commits
September 18, 2026 15:25
…ELECT-privilege filter
- class_name was the raw class object (type OBJECT) because _db_histogram.class_of
stores the class MOP; join _db_class to report owner_name / class_name as strings
- apply the DBA / owner / SELECT-grantee filter used by db_index and db_partition so
a user cannot see histogram rows of classes he has no SELECT privilege on
- rename key_attr -> attr_name and with_fullscan -> scan_type ('FULL SCAN' /
'SAMPLING SCAN'), declare null_frequency as NUMERIC(18,12) to match the spec's
CAST (the view domain overrode it to double), drop the ORDER BY from the spec
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QBMgWWzmrvFiQBSBUiL2YD
# 제목: 변경 요약 (50자 이내) (refactor, hotfix, feature)
# 본문: 변경 사항에 대한 자세한 설명
# - 주요 변경 사항 1
# - 주요 변경 사항 2
# 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다.
# 제목: 변경 요약 (50자 이내) (refactor, hotfix, feature)
# 본문: 변경 사항에 대한 자세한 설명
# - 주요 변경 사항 1
# - 주요 변경 사항 2
# 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다.
# 제목: 변경 요약 (50자 이내) (refactor, hotfix, feature)
# 본문: 변경 사항에 대한 자세한 설명
# - 주요 변경 사항 1
# - 주요 변경 사항 2
# 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다.
# 제목: 변경 요약 (50자 이내) (refactor, hotfix, feature)
# 본문: 변경 사항에 대한 자세한 설명
# - 주요 변경 사항 1
# - 주요 변경 사항 2
# 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다.
…pe CASE Self-review: the ELSE branch of the CASE folds NULL into 'FULL SCAN'; record that the column is always written as an int by smt_add_histogram so the ELSE only covers 1. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QBMgWWzmrvFiQBSBUiL2YD # 제목: 변경 요약 (50자 이내) (refactor, hotfix, feature) # 본문: 변경 사항에 대한 자세한 설명 # - 주요 변경 사항 1 # - 주요 변경 사항 2 # 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다. # 제목: 변경 요약 (50자 이내) (refactor, hotfix, feature) # 본문: 변경 사항에 대한 자세한 설명 # - 주요 변경 사항 1 # - 주요 변경 사항 2 # 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다. # 제목: 변경 요약 (50자 이내) (refactor, hotfix, feature) # 본문: 변경 사항에 대한 자세한 설명 # - 주요 변경 사항 1 # - 주요 변경 사항 2 # 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다. # 제목: 변경 요약 (50자 이내) (refactor, hotfix, feature) # 본문: 변경 사항에 대한 자세한 설명 # - 주요 변경 사항 1 # - 주요 변경 사항 2 # 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다.
soheejung-cs
force-pushed
the
CBRD-27043
branch
from
September 18, 2026 06:25
742a4cc to
04dd64c
Compare
Making db_histogram.class_name a VARCHAR removes the last general object domain that view contributed, so system classes hold one fewer than before. CBRD-27382 had just raised the count to 10 by storing a referential class in _db_index; this change takes one back off, leaving 9. CNT_CATCLS_OBJECTS is the baseline schema_class_truncator.cpp compares against to decide whether a user class references the table being truncated: it counts general object domains plus domains pointing at the class, capped at CNT_CATCLS_OBJECTS + 1, and treats "over the baseline" as "a user class references this one". Left too high, a referenced DONT_REUSE_OID table never clears the baseline, reads as unreferenced, and TRUNCATE destroys and recreates the heap instead of deleting rows -- which is exactly the OID reuse the option exists to prevent. The shell case use_delete caught it as a changed heap vfid across TRUNCATE. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QBMgWWzmrvFiQBSBUiL2YD # 제목: 변경 요약 (50자 이내) (refactor, hotfix, feature) # 본문: 변경 사항에 대한 자세한 설명 # - 주요 변경 사항 1 # - 주요 변경 사항 2 # 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다.
beyondykk9
approved these changes
Sep 18, 2026
Contributor
Author
|
/run all |
Contributor
Author
|
/run rerun 35326279522 |
soheejung-cs
pushed a commit
to CUBRID/cubrid-testcases
that referenced
this pull request
Sep 21, 2026
[CBRD-27043] TC changes for PR CUBRID/cubrid#7976 (#3536) One answer realigned for the db_histogram view change in CUBRID/cubrid#7976. - sql/_05_plcsql/_01_testspec/_05_bug_fix/answers/19_user_cursor_system_view.answer: db_histogram.class_name leaves the OBJECT domain, so the per-owner db_attribute counts the case prints go up by one. Output difference only; the case's intent (which system view rows each user sees) is unchanged. Regenerated against the PR head build and reviewed line by line.
|
✅ TC Branch Finalized for Engine PR was merged. Cleanup Results: TC base branch is ready for the next PR. |
|
✅ TC Branch Finalized for Engine PR was merged. Cleanup Results: TC base branch is ready for the next PR. |
hyunikn
added a commit
to hyunikn/cubrid
that referenced
this pull request
Sep 21, 2026
… and the standard SELECT-privilege filter (CUBRID#7976)
tw-kang
added a commit
to CUBRID/cubrid-testcases
that referenced
this pull request
Sep 21, 2026
kwangsoochae
added a commit
to kwangsoochae/cubrid-testcases
that referenced
this pull request
Sep 24, 2026
…ange after the develop sync (#12) Epic: https://gist.github.com/kwangsoochae/1fd9217c27867a141b4dd161e9259cbc Task 50011: https://gist.github.com/kwangsoochae/9aceb8375d654bb29ec03ab103f0b26a The integration branch took CBRD-27043 (CUBRID/cubrid#7976, the db_histogram change) in the develop sync, and with it one more catalog class. 19_user_cursor_system_view counts the DBA's catalog objects in three lines, so it fell by one in each whichever way the body ran. Upstream had already fixed the answer in 4a7a4ae; this brings that commit over with cherry-pick -x. The answer follows the engine's version rather than the native executor, so the PL engine gives the same values - run with the native path off, it prints the new answer's numbers. The case is therefore not added to any list the PL engine run skips; listing it would drop a sound case from that baseline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
http://jira.cubrid.org/browse/CBRD-27043
Purpose
db_histogram시스템 뷰에서 두 가지를 고칩니다.class_name컬럼이OBJECT타입이었습니다._db_histogram.class_of가 클래스 객체(MOP) 자체를 저장하는데 뷰가 이를 그대로 내보내서,WHERE class_name = 't1'같은 문자열 비교가'=' operator is not defined on types object and char로 실패했습니다.권한 필터가 없었습니다. 다른 시스템 뷰(
db_index,db_partition,db_attribute)는 DBA 그룹 / 소유자 / SELECT 피부여자만 행을 볼 수 있게 WHERE 절로 걸러내는데, 이 뷰만 예외여서 SELECT 권한이 없는 테이블의 히스토그램 존재 여부·수집 방식·NULL 비율을 누구나 조회할 수 있었습니다.class_name이 OBJECT 를 벗어나면서 시스템 클래스의 일반 object 도메인 개수가 9 에서 8 로 줄어듭니다. 이 개수는CNT_CATCLS_OBJECTS로 하드코딩돼 있고 TRUNCATE 가 "이 테이블을 참조하는 사용자 클래스가 있는가" 를 판정하는 기준선이라, 함께 내리지 않으면 참조를 놓칩니다.겸사겸사 컬럼 이름과 도메인을 다른 시스템 뷰의 규약에 맞춰 정리했습니다.
Implementation
sm_define_view_histogram_spec()(schema_system_catalog_install_query_spec.cpp)_db_class [c]를[h].[class_of] = [c].[class_of]로 조인해owner_name,class_name을 문자열로 내보냅니다.db_attribute뷰와 같은 3단 권한 필터를 WHERE 에 추가했습니다._db_auth.object_of와_db_histogram.class_of가 같은 클래스 객체이므로{[h].[class_of]} SUBSETEQ (SELECT SUM (SET {[au].[object_of]}) …)로 바로 비교합니다.owner_name,class_name,attr_name(구key_attr),scan_type(구with_fullscan,'FULL SCAN'/'SAMPLING SCAN'),null_frequency. 스펙의ORDER BY는 다른 시스템 뷰처럼 제거했습니다.system_catalog_initializer::get_view_db_histogram()(schema_system_catalog_install.cpp)class_name을VARCHAR(255)로,null_frequency를 스펙의 CAST 와 같은NUMERIC(18, 12)로 선언했습니다(기존에는double이라 CAST 가 무효였고0.000000000000000e+00로 출력됐습니다).CNT_CATCLS_OBJECTS(schema_system_catalog_constants.h) 9 → 8schema_class_truncator.cpp는 일반 object 도메인 개수 + 대상 클래스를 가리키는 도메인 개수를CNT_CATCLS_OBJECTS + 1로 캡을 걸어 세고, 기준선을 넘으면 "사용자 클래스가 참조한다" 로 봅니다. 9 로 두면 참조가 있는 DONT_REUSE_OID 테이블도 8 + 1 = 9 가 되어 참조 없음으로 읽히고, TRUNCATE 가 행 삭제 대신 heap 을 파괴·재생성합니다 — 그 옵션이 막으려던 OID 재사용이 그대로 일어납니다.동작 확인 (새 DB, csql 출력 그대로)
준비:
수정 전 (upstream/develop 과 동일한 뷰 정의):
수정 후 (이 PR):
Remarks
뷰 정의는
createdb시점에 카탈로그에 저장되므로 이 변경 전에 만든 DB 에는 반영되지 않습니다(다른 시스템 뷰 변경과 같은 조건). 히스토그램은 미출시 기능이라 마이그레이션은 두지 않았습니다.컬럼 이름 변경(
key_attr→attr_name,with_fullscan→scan_type)은 매뉴얼·TC·엔진 소스에 기존 참조가 없음을 확인했습니다.히스토그램 값(MCV·버킷 경계)은 계속 뷰에 내보내지 않습니다.
;info histogram경로가 SELECT 권한을 검사합니다(JIRA 종결 코멘트 참조).자기 리뷰(리뷰 하네스)에서 걸러낸 것:
scan_typeCASE 의 ELSE 가 NULL 을 접는 이유를 주석으로 남겼습니다(with_fullscan은 항상 0/1 int).기존 JIRA 종결 코멘트의 「비고」에서 "메타데이터라 결함 아님" 으로 남겨 두었던 항목을 이번에 함께 고쳤습니다.
CI 실패 5건을 분류해 전부 이 변경으로 귀속시켰습니다. 그 중 둘은 답안이 아니라 위 상수 누락이 만든 실제 회귀였습니다.
use_delete(cbrd_23954)bug_3339(CUBRIDSUS-3339)catcls_general_object(cbrd_23954)bug_xdbms_sus575compactdb -v의_db_attribute·_db_domain인스턴스 수19_user_cursor_system_viewdb_attribute소유자별 건수 +1cbrd_20149_xasl의 truncate 답안 5건은 플랜 덤프가 truncator 의 질의문을 그대로 싣기 때문에ROWNUM <= 10→<= 9로 함께 정렬했습니다.CBRD-27382 과 같은 상수를 반대 방향으로 움직입니다 — 머지 순서에 따라 값이 달라집니다. CBRD-27382(
_db_index가 인덱스 행 OID 대신 참조 클래스를 저장)는 일반 object 도메인을 하나 늘려 9 → 10 으로 만들고, 이 PR 은 하나 줄여 9 → 8 로 만듭니다. 둘 다 들어가면 9 입니다. 지금은 CBRD-27382 의 엔진이 develop 에 없으므로(develop 상수 = 9) 이 PR 기준은 8 이고 TC 답안도 8 /ROWNUM <= 9입니다. 나중에 머지되는 쪽이 상수와 답안을 ±1 조정해야 합니다 — CBRD-27382 의 TC 답안(10 /<= 11)은 이미 TC develop 에 있으니, 그 엔진이 먼저 들어가면 이 PR 을 리베이스해 9 /<= 10으로 올려야 합니다.upstream/develop
882e87144위로 리베이스했습니다. 그 과정에서 들어온 CBRD-26354 때문에 필요해진 답안(bug_bts_4670.answer)만 TC 브랜치로 체리픽했고, CBRD-27382 의 답안 변경은 이 PR 의 엔진 상태와 맞지 않으므로 의도적으로 가져오지 않았습니다.로컬 검증(release
15279602e, 리베이스 전 트리 — 리베이스로 들어온 develop 4건은 TRUNCATE·카탈로그를 건드리지 않습니다):use_delete24/24 OK,catcls_general_object2/2 OK,bug_3339는22 / NULL / 22두 블록 모두 답안과 일치(자동커밋 off). TC 브랜치tc/pr-7976는 양쪽 리포에 푸시했습니다.🤖 Generated with Claude Code
https://claude.ai/code/session_01QBMgWWzmrvFiQBSBUiL2YD