已关闭
[Bug]: 【测试类型:工具功能】【测试版本:7.0.0-RC2】pagehack解析前,应校验被解析文件及索引类型,是否支持及匹配 #7102
李鑫创建于  2025年6月5日关闭于  2025年6月26日
李鑫
李鑫成员
2025年6月5日 创建

测试类型

工具功能

测试版本

7.0.0-RC2

问题描述

pagehack解析前,应校验被解析文件及索引类型,是否支持及匹配

操作系统和硬件信息

CentOS Linux release 7.6.1810 (Core)
Linux upgrade-test-0001 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

测试环境

企业版主备

被测功能

pagehack

预置条件

数据库状态正常

操作步骤

  • 用例1
    创建pcr索引,pagehack -t指定ubtree_index
    -- 创建ustore表
    drop table if exists t_pagehack_0001 cascade;
    create table t_pagehack_0001 (
    id serial primary key,
    user_name varchar(50),
    create_time timestamp,
    score int
    ) with (storage_type=ustore);
    -- 创建ubtree索引
    create index i_pagehack_0001 on t_pagehack_0001 using ubtree (score) with (index_type=pcr);
    -- 插入数据
    insert into t_pagehack_0001 (user_name, create_time, score)
    select 'user_' || (random()*100)::int, now() - (random()*365)::int * '1 day'::interval,
    (random()*100)::int from generate_series(1, 1000);
    -- 查询索引文件路径
    SELECT pg_relation_filepath('i_pagehack_0001');
    -- 解析
    cd $PGDATA
    pagehack -f base/15945/47909 -t ubtree_index

  • 用例2
    创建rcr索引,pagehack -t指定ubtree_pcr_index
    -- 创建ustore表
    drop table if exists t_pagehack_0001 cascade;
    create table t_pagehack_0001 (
    id serial primary key,
    user_name varchar(50),
    create_time timestamp,
    score int
    ) with (storage_type=ustore);
    -- 创建ubtree索引
    create index i_pagehack_0001 on t_pagehack_0001 using ubtree (score) with (index_type=rcr);
    -- 插入数据
    insert into t_pagehack_0001 (user_name, create_time, score)
    select 'user_' || (random()*100)::int, now() - (random()*365)::int * '1 day'::interval,
    (random()*100)::int from generate_series(1, 1000);
    -- 查询索引文件路径
    SELECT pg_relation_filepath('i_pagehack_0001');
    -- 解析
    cd $PGDATA
    pagehack -f base/15945/47909 -t ubtree_pcr_index

  • 用例3
    创建rcr索引,pagehack -t指定ubtree_pcr_index
    -- 创建ustore表
    drop table if exists t_pagehack_0025 cascade;
    create table t_pagehack_0025 (
        id serial primary key,
        user_name varchar(50),
        create_time timestamp,
        score int
    ) with (storage_type=ustore);
    -- 创建ubtree索引
    create index i_pagehack_0025 on t_pagehack_0025 using ubtree (score) with (index_type=pcr);
    --插入数据
    insert into t_pagehack_0025 (user_name, create_time, score)
    select 'user_' || (random()*100)::int, now() - (random()*365)::int * '1 day'::interval,
    (random()*100)::int from generate_series(1, 1000);
    -- 查询表文件路径
    SELECT pg_relation_filepath('t_pagehack_0025');
    -- 解析 -f指定表文件路径
    cd $PGDATA
    pagehack -f base/15945/47909 -t ubtree_pcr_index

  • 用例4
    非ustore表,btree索引、hash索引、gin索引、gist索引、psort索引等,使用pagehack解析,指定ubtree参数
    -- 建表
    drop table if exists test_all_indexes cascade;
    create table test_all_indexes (
    id serial primary key,
    name varchar(50),
    description text,
    points point,
    tags text[],
    score double precision,
    created_at timestamp default current_timestamp
    ) with (orientation=row);
    -- 插入数据
    insert into test_all_indexes (name, description, points, tags, score)
    select
    'product_' || n::text,
    'description for product ' || n::text,
    point(random() * 100, random() * 100),
    array[('tag' || (floor(random() * 10)::int)::text), ('category' || (floor(random() * 5)::int)::text)],
    random() * 100
    from generate_series(1, 1000) as n;
    -- 创建 btree 索引
    create index idx_btree_name on test_all_indexes using btree(name);
    -- 创建 hash 索引
    create index idx_hash_description on test_all_indexes using hash(description);
    -- 创建 gin 索引
    create index idx_gin_tags on test_all_indexes using gin(tags);
    -- 创建 gist 索引
    create index idx_gist_points on test_all_indexes using gist(points);

预期输出

解析合理报错,提示参数正确用法,以引导用户

实际输出

image.png
image.png
image.png
image.png
image.png
image.png
image.png

日志信息

无

提单组织

内部测试

测试代码

无

likedislike
opengauss_botopengauss_bot成员
2025年6月5日 添加了label:sig/Community
opengauss_bot
opengauss_bot成员
2025年6月5日 评论:

Welcome To openGauss Community

Hey @li-xin12345 , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: Community ,
and any of the committers: @ywzq1161327784, @chendong76, @congzhou2603, @dodders, @quemingjian, @CarrotGo, @muyulinzhong, @chenxiaobin19, @libiao2024, @wangfeihuo, @jemappellehc, @totaj, @hwworkholic, @zhangfengzhi123, @shenzheng4, @superlchf .

likedislike
李鑫李鑫成员
2025年6月5日 将 Vincent__Sun 设为负责人
李鑫李鑫成员
2025年6月5日 修改了issue 的描述
Vincent__Sun
Vincent__Sun成员
2025年6月13日 评论:

对非ubtree index和ubtree pcr index文件通过ubtree index和ubtree pcr index 解析进行拦截,显示类型不正确报错
image.png
image.png

likedislike
Vincent__SunVincent__Sun成员
2025年6月14日 关联了pull request:修复pagehack解析ubtree rcr和pcr索引问题
Vincent__Sun
Vincent__Sun成员
2025年6月18日 评论:

image.png
image.png
image.png

likedislike
Vincent__SunVincent__Sun成员
2025年6月18日 issue状态由 待办的 改变为 待回归
李鑫李鑫成员
2025年6月26日 issue状态由 待回归 改变为 测试中
李鑫李鑫成员
2025年6月26日 issue状态由 测试中 改变为 已验收
李鑫李鑫成员
2025年6月26日 关闭了 issue