Skip to content

Conversation

@youngjinj
Copy link
Contributor

@youngjinj youngjinj commented Nov 28, 2025

http://jira.cubrid.org/browse/CBRD-26374

Purpose

unload 파일에는 unload 시점의 버전 정보가 없어
load 시 --no-user-specified-name 옵션의 필요 여부를 판단하기 어렵습니다.

이 변경에서는 load 과정에서 unload 시점의 버전을 추정해
필요한 경우에만 --no-user-specified-name 옵션이 적용되도록 개선합니다.

또한 11.2 이상, 11.4 미만 버전에서 unload 받은 파일을 load 할 때,
저장 프로시저에 대해서만 부분적으로 옵션이 활성화되는 동작을 지원합니다.

Implementation

  1. client_type, statement_type 기반 호환성 단계 관리

    • db_client_type 확장
      • ADMIN_LOADDB_COMPAT_UNDER_11_2: unload version < 11.2
      • ADMIN_LOADDB_COMPAT_UNDER_11_4: unload version >= 11.2 and < 11.4
      • LOADDB_UTILITY (COMPAT_OFF): 호환성 옵션 미사용
    • db_Client_statement_type
      • 스키마를 제외한 동일 이름의 CREATE가 발생하면,
        해당 객체 타입이 사용자 스키마를 지원하는 버전에서 unload 받은 것으로 간주
      • 객체 타입별 사용자 스키마 지원 시점에 따라 호환성 단계 상향
  2. online _objects load

    • cub_server에서 변경된 db_client_type을 유틸리티로 전달
      • cubload::load_status: m_load_client_type, get_load_client_type() 추가
      • cubload::session: m_load_client_type, get_client_type(), set_client_type() 추가
  3. 호환성 옵션 적용 대상

    • 테이블, 뷰
      • do_find_class_by_query
      • ldr_find_class_by_query (_objects 파일)
    • 시리얼
      • do_find_serial_by_query
    • 트리거
      • do_find_trigger_by_query
    • 저장 프로시저
      • do_find_stored_procedure_by_query
  4. 호환성 단계 전환 조건

    • LOADDB_UTILITY (COMPAT_OFF) -> ADMIN_LOADDB_COMPAT_UNDER_11_2
      • --no-user-specified-name 옵션 사용
    • ADMIN_LOADDB_COMPAT_UNDER_11_2 -> ADMIN_LOADDB_COMPAT_UNDER_11_4
      • 서로 다른 스키마에 동일 이름의 객체 존재 (테이블, 뷰, 시리얼, 트리거)
      • 11.2 이상 버전에서 추가된 객체 존재 (동의어, DBLink 서버)
      • _objects 파일에 스키마 지정
    • ADMIN_LOADDB_COMPAT_UNDER_11_4 -> LOADDB_UTILITY (COMPAT_OFF)
      • 서로 다른 스키마에 동일 이름의 저장 프로시저 존재
  5. 안전 장치

    • 지정된 스키마가 현재 스키마 또는 AU_SET_USER() 이전 스키마와 다른 경우,
      다른 스키마 객체 검색을 수행하지 않음
    • 다른 스키마에 동일 이름의 객체가 2개 이상 존재하면 검색 실패로 처리

Remarks

N/A

@youngjinj youngjinj self-assigned this Nov 28, 2025
@youngjinj
Copy link
Contributor Author

/run sql medium

@youngjinj
Copy link
Contributor Author

/run shell

@xmilex-git
Copy link
Contributor

@codex review in korean

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 155 to 160
#if defined(SERVER_MODE)
/* This is the case when the loaddb utility is executed with the --no-user-specified-name option as the dba user. */
if (thread_ref.conn_entry->client_type == DB_CLIENT_TYPE_ADMIN_LOADDB_COMPAT)
if (thread_ref.conn_entry->client_type == DB_CLIENT_TYPE_ADMIN_LOADDB_COMPAT_UNDER_11_2)
{
found_again = locate_class_for_all_users (class_name, class_oid);
if (found_again == LC_CLASSNAME_EXIST)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 서버 로더에서 갱신된 loaddb 클라이언트 타입 반영

loaddb가 CREATE 구문을 만나면 클라이언트 측에서 db_set_client_type으로 타입을 ADMIN_LOADDB_COMPAT_UNDER_11_4LOADDB_UTILITY로 바꾸지만, 서버 세션의 conn_entry->client_type은 초기 핸드셰이크 시점(network_interface_sr.c:640)에만 설정되고 이후 갱신되지 않습니다. 이 분기에서 여전히 UNDER_11_2로 간주되어 locate_class_for_all_users가 계속 호출되므로, 호환 모드를 끄기로 판단한 >=11.2/11.4 덤프에서도 다른 소유자의 클래스를 잘못 찾아버릴 수 있습니다.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objects 파일을 load 하는 경우에만 실행되는 코드이며,
object 파일의 class 이름에 '.'이 없는 경우에만 실행하도록 변경했습니다.
이 경우는 DB_CLIENT_TYPE_ADMIN_LOADDB_COMPAT_UNDER_11_2 클라이언트 동작과 일치합니다.
0cc6d6e에서 변경했습니다.

@youngjinj
Copy link
Contributor Author

/run sql medium

@youngjinj
Copy link
Contributor Author

/run shell

@youngjinj
Copy link
Contributor Author

/run sql medium

@xmilex-git
Copy link
Contributor

@codex review in korean

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1449 to +1452
if (db_get_client_type() == DB_CLIENT_TYPE_ADMIN_LOADDB_COMPAT_UNDER_11_2)
{
/* Called by ldr_sa_load or ldr_server_load to load an object file; DDL must not be executed. */
assert (db_get_client_statement_type () == CUBRID_STMT_NONE);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 데이터 로드 전에 statement 타입 초기화 누락

호환 모드에서 ldr_exec_query_from_file는 각 DDL마다 db_set_client_statement_type을 갱신하지만 종료 시점을 막아주는 초기화가 없어 마지막 문장이 CREATE_*로 끝나면 타입이 그대로 남습니다. 바로 이어지는 객체 파일 로딩에서 ldr_find_class(lines 1449-1452)가 db_get_client_statement_type() == CUBRID_STMT_NONE를 단정하고 있어, 스키마 파일 끝이 CREATE 문인 흔한 경우(예: COMMIT 문이 없는 스크립트) 디버그 빌드에서는 데이터 로드 진입 즉시 abort가 발생합니다. 데이터 로드를 시작하기 전에 statement 타입을 리셋하거나 assert 조건을 완화하지 않으면 호환 모드에서 쉽게 재현됩니다.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2e050a6에서 해결했습니다.

@youngjinj
Copy link
Contributor Author

/run sql medium

@youngjinj
Copy link
Contributor Author

/run sql medium

@youngjinj
Copy link
Contributor Author

/run shell

@youngjinj
Copy link
Contributor Author

/run sql medium

@youngjinj
Copy link
Contributor Author

/run sql medium

@youngjinj
Copy link
Contributor Author

/run shell

@youngjinj youngjinj marked this pull request as ready for review December 17, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants