From cdc15cb84a69f7c04192adfe09690da7ffc5dceb Mon Sep 17 00:00:00 2001 From: Mehmet YILMAZ Date: Wed, 21 Aug 2024 13:11:26 +0000 Subject: [PATCH 1/3] Add debugging subsegment to devcontainer part of the document --- CONTRIBUTING.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e1900642d3e..ee8d3fabebd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,6 +35,16 @@ To get citus installed from source we run `make install -s` in the first termina With the Citus cluster running you can connect to the coordinator in the first terminal via `psql -p9700`. Because the coordinator is the most common entrypoint the `PGPORT` environment is set accordingly, so a simple `psql` will connect directly to the coordinator. +#### Debugging in the devcontainer +Debugging within the devcontainer setup is straightforward and fully integrated with Visual Studio Code's debugging tools. +1. Start Debugging: Press F5 to start debugging. You'll be prompted to select the running PostgreSQL process to attach the debugger to. Typically, if you're executing a psql command, you'll want to attach to a process named something like: +``` +postgres: citus citus [local] idle +``` +2. Set Breakpoints and Debug: Once the debugger attaches to the correct process, you can set breakpoints within the code. From here, you'll be able to step through the code execution, inspect variables, and fully debug the PostgreSQL instance running within the devcontainer. + +This setup provides a seamless way to troubleshoot and optimize the Citus extension by taking advantage of the integrated debugging features in VS Code. + ### Getting and building [PostgreSQL documentation](https://www.postgresql.org/support/versioning/) has a From 150c515021f97ea6da032104e2e0c3aee4d35845 Mon Sep 17 00:00:00 2001 From: Mehmet YILMAZ Date: Wed, 21 Aug 2024 19:58:48 +0000 Subject: [PATCH 2/3] update --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ee8d3fabebd..ce38d1c5891 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,8 +35,8 @@ To get citus installed from source we run `make install -s` in the first termina With the Citus cluster running you can connect to the coordinator in the first terminal via `psql -p9700`. Because the coordinator is the most common entrypoint the `PGPORT` environment is set accordingly, so a simple `psql` will connect directly to the coordinator. -#### Debugging in the devcontainer -Debugging within the devcontainer setup is straightforward and fully integrated with Visual Studio Code's debugging tools. +### Debugging in the VS code + 1. Start Debugging: Press F5 to start debugging. You'll be prompted to select the running PostgreSQL process to attach the debugger to. Typically, if you're executing a psql command, you'll want to attach to a process named something like: ``` postgres: citus citus [local] idle From b096b85704633f56f86349d4cddb844cd34ed0f6 Mon Sep 17 00:00:00 2001 From: Mehmet YILMAZ Date: Thu, 22 Aug 2024 14:08:29 +0000 Subject: [PATCH 3/3] review update --- .devcontainer/.psqlrc | 2 +- CONTRIBUTING.md | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.devcontainer/.psqlrc b/.devcontainer/.psqlrc index 7642a97149d..07ea06cddcc 100644 --- a/.devcontainer/.psqlrc +++ b/.devcontainer/.psqlrc @@ -3,5 +3,5 @@ \pset border 2 \setenv PAGER 'pspg --no-mouse -bX --no-commandbar --no-topbar' \set HISTSIZE 100000 -\set PROMPT1 '\n%[%033[1m%]%M %n@%/:%>-%p%R%[%033[0m%]%# ' +\set PROMPT1 '\n%[%033[1m%]%M %n@%/:%> (PID: %p)%R%[%033[0m%]%# ' \set PROMPT2 ' ' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ce38d1c5891..70cc486e74e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,13 +37,25 @@ With the Citus cluster running you can connect to the coordinator in the first t ### Debugging in the VS code -1. Start Debugging: Press F5 to start debugging. You'll be prompted to select the running PostgreSQL process to attach the debugger to. Typically, if you're executing a psql command, you'll want to attach to a process named something like: +1. Start Debugging: Press F5 in VS Code to start debugging. When prompted, you'll need to attach the debugger to the appropriate PostgreSQL process. + +2. Identify the Process: If you're running a psql command, take note of the PID that appears in your psql prompt. For example: +``` +[local] citus@citus:9700 (PID: 5436)=# +``` +This PID (5436 in this case) indicates the process that you should attach the debugger to. +If you are uncertain about which process to attach, you can list all running PostgreSQL processes using the following command: +``` +ps aux | grep postgres +``` + +Look for the process associated with the PID you noted. For example: ``` -postgres: citus citus [local] idle +citus 5436 0.0 0.0 0 0 ? S 14:00 0:00 postgres: citus citus ``` -2. Set Breakpoints and Debug: Once the debugger attaches to the correct process, you can set breakpoints within the code. From here, you'll be able to step through the code execution, inspect variables, and fully debug the PostgreSQL instance running within the devcontainer. +4. Attach the Debugger: Once you've identified the correct PID, select that process when prompted in VS Code to attach the debugger. You should now be able to debug the PostgreSQL session tied to the psql command. -This setup provides a seamless way to troubleshoot and optimize the Citus extension by taking advantage of the integrated debugging features in VS Code. +5. Set Breakpoints and Debug: With the debugger attached, you can set breakpoints within the code. This allows you to step through the code execution, inspect variables, and fully debug the PostgreSQL instance running in your container. ### Getting and building