之前在虚拟机上编译成功过,但今天启动数据库的时候出现权限错误问题,我重新删除了data文件夹,重新初始化启动数据库还是不成功,后来对报错文件进行赋权,成功解决!

问题(一)

1.启动数据库报错

gs_ctl start -D /home/omm/data -Z single_node -l /home/omm/log/openGauss.log
报错

在这里插入图片描述

2.解决报错问题

出现权限不够问题,采用chmod命令进行赋权操作

chown -R omm /home/omm/log/

在这里插入图片描述

3. 连接数据库

gsql -d postgres -p 5432 -r

问题(二)

1. 连接vscode配置launch.json出错

一开始配置attach的形式,一直报错找不到路径文件,最后将attach替换为launch可以成功调试。
个人认为,attach和launch都可以成功调试,可能是我本人虚拟机环境过于杂乱,导致有些不兼容问题出现吧,故本人将两种方法的配置文件均post上来,如下:

launch方案

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "gaussdb --help",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/omm/openGauss-server/mppdb_temp_install/bin/gaussdb",
            "args": [
                "--help"
            ],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },
        {
            "name": "gaussdb --D mppdb_temp_install/data/single_node/",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/omm/openGauss-server/mppdb_temp_install/bin/gaussdb",
            "args": [
                "--D",
                "/home/omm/openGauss-server/mppdb_temp_install/data/single_node/"
            ],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

attach方案

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "openGauss-debug",
            "type": "cppdbg",
            "request": "attach",
            "program": "/home/omm/openGauss-server/mppdb_temp_install/bin/gaussdb",
            "processId": "${command:pickProcess}",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description":  "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

2.成功进入单步调试界面

gaussdb的服务进程入口为src/gausskernel/process/main/main.cpp下的main函数。本文测试的断点文件为此路径。
在这里插入图片描述

参考资料

[1] docker搭建环境编译和调试openGauss源码https://zhuanlan.zhihu.com/p/533602866
[2] opengauss官网 https://docs.opengauss.org/zh/docs/5.0.0/docs/CompilationGuide/%E7%89%88%E6%9C%AC%E7%BC%96%E8%AF%91.html
[3] openGauss源码安装 https://www.cnblogs.com/AnkleBreaker-ZHX/p/16747576.html

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐