Skip to content

Commit 0d1dc8c

Browse files
committed
better
1 parent 36847af commit 0d1dc8c

3,616 files changed

Lines changed: 970230 additions & 104726 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codeclimate.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
exclude_patterns:
2+
- "src/backend/distributed/utils/citus_outfuncs.c"
3+
- "src/backend/distributed/deparser/ruleutils_*.c"
4+
- "src/include/distributed/citus_nodes.h"
5+
- "src/backend/distributed/safeclib"
6+
- "src/backend/columnar/safeclib"
7+
- "**/vendor/"

.codecov.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
codecov:
2+
notify:
3+
require_ci_to_pass: yes
4+
5+
coverage:
6+
precision: 2
7+
round: down
8+
range: "70...100"
9+
10+
ignore:
11+
- "src/backend/distributed/utils/citus_outfuncs.c"
12+
- "src/backend/distributed/deparser/ruleutils_*.c"
13+
- "src/include/distributed/citus_nodes.h"
14+
- "src/backend/distributed/safeclib"
15+
- "vendor"
16+
17+
status:
18+
project:
19+
default:
20+
target: 87.5
21+
threshold: 0.5
22+
23+
patch:
24+
default:
25+
target: 75
26+
27+
changes: no
28+
29+
parsers:
30+
gcov:
31+
branch_detection:
32+
conditional: yes
33+
loop: yes
34+
method: no
35+
macro: no
36+
37+
comment:
38+
layout: "header, diff"
39+
behavior: default
40+
require_changes: no

.devcontainer/.gdbinit

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# gdbpg.py contains scripts to nicely print the postgres datastructures
2+
# while in a gdb session. Since the vscode debugger is based on gdb this
3+
# actually also works when debugging with vscode. Providing nice tools
4+
# to understand the internal datastructures we are working with.
5+
source /root/gdbpg.py
6+
7+
# when debugging postgres it is convenient to _always_ have a breakpoint
8+
# trigger when an error is logged. Because .gdbinit is sourced before gdb
9+
# is fully attached and has the sources loaded. To make sure the breakpoint
10+
# is added when the library is loaded we temporary set the breakpoint pending
11+
# to on. After we have added out breakpoint we revert back to the default
12+
# configuration for breakpoint pending.
13+
# The breakpoint is hard to read, but at entry of the function we don't have
14+
# the level loaded in elevel. Instead we hardcode the location where the
15+
# level of the current error is stored. Also gdb doesn't understand the
16+
# ERROR symbol so we hardcode this to the value of ERROR. It is very unlikely
17+
# this value will ever change in postgres, but if it does we might need to
18+
# find a way to conditionally load the correct breakpoint.
19+
set breakpoint pending on
20+
break elog.c:errfinish if errordata[errordata_stack_depth].elevel == 21
21+
set breakpoint pending auto
22+
23+
echo \n
24+
echo ----------------------------------------------------------------------------------\n
25+
echo when attaching to a postgres backend a breakpoint will be set on elog.c:errfinish \n
26+
echo it will only break on errors being raised in postgres \n
27+
echo \n
28+
echo to disable this breakpoint from vscode run `-exec disable 1` in the debug console \n
29+
echo this assumes it's the first breakpoint loaded as it is loaded from .gdbinit \n
30+
echo this can be verified with `-exec info break`, enabling can be done with \n
31+
echo `-exec enable 1` \n
32+
echo ----------------------------------------------------------------------------------\n
33+
echo \n

.devcontainer/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
postgresql-*.tar.bz2

.devcontainer/.psqlrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
\timing on
2+
\pset linestyle unicode
3+
\pset border 2
4+
\setenv PAGER 'pspg --no-mouse -bX --no-commandbar --no-topbar'
5+
\set HISTSIZE 100000
6+
\set PROMPT1 '\n%[%033[1m%]%M %n@%/:%> (PID: %p)%R%[%033[0m%]%# '
7+
\set PROMPT2 ' '

.devcontainer/.vscode/Pipfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
docopt = "*"
8+
9+
[dev-packages]
10+
11+
[requires]
12+
python_version = "3.9"

.devcontainer/.vscode/Pipfile.lock

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#! /usr/bin/env pipenv-shebang
2+
"""Generate C/C++ properties file for VSCode.
3+
4+
Uses pgenv to iterate postgres versions and generate
5+
a C/C++ properties file for VSCode containing the
6+
include paths for the postgres headers.
7+
8+
Usage:
9+
generate_c_cpp_properties-json.py <target_path>
10+
generate_c_cpp_properties-json.py (-h | --help)
11+
generate_c_cpp_properties-json.py --version
12+
13+
Options:
14+
-h --help Show this screen.
15+
--version Show version.
16+
17+
"""
18+
import json
19+
import subprocess
20+
21+
from docopt import docopt
22+
23+
24+
def main(args):
25+
target_path = args['<target_path>']
26+
27+
output = subprocess.check_output(['pgenv', 'versions'])
28+
# typical output is:
29+
# 14.8 pgsql-14.8
30+
# * 15.3 pgsql-15.3
31+
# 16beta2 pgsql-16beta2
32+
# where the line marked with a * is the currently active version
33+
#
34+
# we are only interested in the first word of each line, which is the version number
35+
# thus we strip the whitespace and the * from the line and split it into words
36+
# and take the first word
37+
versions = [line.strip('* ').split()[0] for line in output.decode('utf-8').splitlines()]
38+
39+
# create the list of configurations per version
40+
configurations = []
41+
for version in versions:
42+
configurations.append(generate_configuration(version))
43+
44+
# create the json file
45+
c_cpp_properties = {
46+
"configurations": configurations,
47+
"version": 4
48+
}
49+
50+
# write the c_cpp_properties.json file
51+
with open(target_path, 'w') as f:
52+
json.dump(c_cpp_properties, f, indent=4)
53+
54+
55+
def generate_configuration(version):
56+
"""Returns a configuration for the given postgres version.
57+
58+
>>> generate_configuration('14.8')
59+
{
60+
"name": "Citus Development Configuration - Postgres 14.8",
61+
"includePath": [
62+
"/usr/local/include",
63+
"/home/citus/.pgenv/src/postgresql-14.8/src/**",
64+
"${workspaceFolder}/**",
65+
"${workspaceFolder}/src/include/",
66+
],
67+
"configurationProvider": "ms-vscode.makefile-tools"
68+
}
69+
"""
70+
return {
71+
"name": f"Citus Development Configuration - Postgres {version}",
72+
"includePath": [
73+
"/usr/local/include",
74+
f"/home/citus/.pgenv/src/postgresql-{version}/src/**",
75+
"${workspaceFolder}/**",
76+
"${workspaceFolder}/src/include/",
77+
],
78+
"configurationProvider": "ms-vscode.makefile-tools"
79+
}
80+
81+
82+
if __name__ == '__main__':
83+
arguments = docopt(__doc__, version='0.1.0')
84+
main(arguments)

.devcontainer/.vscode/launch.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Attach Citus (devcontainer)",
6+
"type": "cppdbg",
7+
"request": "attach",
8+
"processId": "${command:pickProcess}",
9+
"program": "/home/citus/.pgenv/pgsql/bin/postgres",
10+
"additionalSOLibSearchPath": "/home/citus/.pgenv/pgsql/lib",
11+
"setupCommands": [
12+
{
13+
"text": "handle SIGUSR1 noprint nostop pass",
14+
"description": "let gdb not stop when SIGUSR1 is sent to process",
15+
"ignoreFailures": true
16+
}
17+
],
18+
},
19+
{
20+
"name": "Open core file",
21+
"type": "cppdbg",
22+
"request": "launch",
23+
"program": "/home/citus/.pgenv/pgsql/bin/postgres",
24+
"coreDumpPath": "${input:corefile}",
25+
"cwd": "${workspaceFolder}",
26+
"MIMode": "gdb",
27+
}
28+
],
29+
"inputs": [
30+
{
31+
"id": "corefile",
32+
"type": "command",
33+
"command": "extension.commandvariable.file.pickFile",
34+
"args": {
35+
"dialogTitle": "Select core file",
36+
"include": "**/core*",
37+
},
38+
},
39+
],
40+
}

0 commit comments

Comments
 (0)