Skip to content

Commit 6dba1a3

Browse files
authored
Merge pull request #9745 from neondatabase/compute-release-2024-11-13
Compute release 2024-11-13 Includes Postgres minor version upgrades and various other bugfixes and improvements.
2 parents 61ff18d + 10aaa36 commit 6dba1a3

File tree

75 files changed

+1848
-597
lines changed

Some content is hidden

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

75 files changed

+1848
-597
lines changed

Diff for: .github/actionlint.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ config-variables:
2020
- REMOTE_STORAGE_AZURE_REGION
2121
- SLACK_UPCOMING_RELEASE_CHANNEL_ID
2222
- DEV_AWS_OIDC_ROLE_ARN
23+
- BENCHMARK_INGEST_TARGET_PROJECTID

Diff for: .github/actions/allure-report-generate/action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ runs:
221221
REPORT_URL: ${{ steps.generate-report.outputs.report-url }}
222222
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
223223
with:
224+
# Retry script for 5XX server errors: https://github.com/actions/github-script#retries
225+
retries: 5
224226
script: |
225227
const { REPORT_URL, COMMIT_SHA } = process.env
226228

Diff for: .github/pull_request_template.md

-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
## Problem
22

33
## Summary of changes
4-
5-
## Checklist before requesting a review
6-
7-
- [ ] I have performed a self-review of my code.
8-
- [ ] If it is a core feature, I have added thorough tests.
9-
- [ ] Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?
10-
- [ ] If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.
11-
12-
## Checklist before merging
13-
14-
- [ ] Do not forget to reformat commit message to not include the above checklist

Diff for: .github/workflows/build_and_test.yml

+2
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@ jobs:
497497
REPORT_URL_NEW: ${{ steps.upload-coverage-report-new.outputs.report-url }}
498498
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
499499
with:
500+
# Retry script for 5XX server errors: https://github.com/actions/github-script#retries
501+
retries: 5
500502
script: |
501503
const { REPORT_URL_NEW, COMMIT_SHA } = process.env
502504

Diff for: .github/workflows/ingest_benchmark.yml

+372
Large diffs are not rendered by default.

Diff for: .github/workflows/neon_extra_builds.yml

+2
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ jobs:
201201
REPORT_URL: ${{ steps.upload-stats.outputs.report-url }}
202202
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
203203
with:
204+
# Retry script for 5XX server errors: https://github.com/actions/github-script#retries
205+
retries: 5
204206
script: |
205207
const { REPORT_URL, SHA } = process.env
206208

Diff for: .github/workflows/report-workflow-stats-batch.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Report Workflow Stats Batch
2+
3+
on:
4+
schedule:
5+
- cron: '*/15 * * * *'
6+
- cron: '25 0 * * *'
7+
8+
jobs:
9+
gh-workflow-stats-batch:
10+
name: GitHub Workflow Stats Batch
11+
runs-on: ubuntu-22.04
12+
permissions:
13+
actions: read
14+
steps:
15+
- name: Export Workflow Run for the past 2 hours
16+
uses: neondatabase/[email protected]
17+
with:
18+
db_uri: ${{ secrets.GH_REPORT_STATS_DB_RW_CONNSTR }}
19+
db_table: "gh_workflow_stats_batch_neon"
20+
gh_token: ${{ secrets.GITHUB_TOKEN }}
21+
duration: '2h'
22+
- name: Export Workflow Run for the past 24 hours
23+
if: github.event.schedule == '25 0 * * *'
24+
uses: neondatabase/[email protected]
25+
with:
26+
db_uri: ${{ secrets.GH_REPORT_STATS_DB_RW_CONNSTR }}
27+
db_table: "gh_workflow_stats_batch_neon"
28+
gh_token: ${{ secrets.GITHUB_TOKEN }}
29+
duration: '24h'

Diff for: Cargo.lock

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: compute/compute-node.Dockerfile

+4-6
Original file line numberDiff line numberDiff line change
@@ -624,16 +624,12 @@ FROM build-deps AS pg-cron-pg-build
624624
ARG PG_VERSION
625625
COPY --from=pg-build /usr/local/pgsql/ /usr/local/pgsql/
626626

627-
# 1.6.4 available, supports v17
628627
# This is an experimental extension that we do not support on prod yet.
629628
# !Do not remove!
630629
# We set it in shared_preload_libraries and computes will fail to start if library is not found.
631630
ENV PATH="/usr/local/pgsql/bin/:$PATH"
632-
RUN case "${PG_VERSION}" in "v17") \
633-
echo "v17 extensions are not supported yet. Quit" && exit 0;; \
634-
esac && \
635-
wget https://github.com/citusdata/pg_cron/archive/refs/tags/v1.6.0.tar.gz -O pg_cron.tar.gz && \
636-
echo "383a627867d730222c272bfd25cd5e151c578d73f696d32910c7db8c665cc7db pg_cron.tar.gz" | sha256sum --check && \
631+
RUN wget https://github.com/citusdata/pg_cron/archive/refs/tags/v1.6.4.tar.gz -O pg_cron.tar.gz && \
632+
echo "52d1850ee7beb85a4cb7185731ef4e5a90d1de216709d8988324b0d02e76af61 pg_cron.tar.gz" | sha256sum --check && \
637633
mkdir pg_cron-src && cd pg_cron-src && tar xzf ../pg_cron.tar.gz --strip-components=1 -C . && \
638634
make -j $(getconf _NPROCESSORS_ONLN) && \
639635
make -j $(getconf _NPROCESSORS_ONLN) install && \
@@ -1475,6 +1471,8 @@ RUN mkdir -p /etc/local_proxy && chown postgres:postgres /etc/local_proxy
14751471
COPY --from=postgres-exporter /bin/postgres_exporter /bin/postgres_exporter
14761472
COPY --from=sql-exporter /bin/sql_exporter /bin/sql_exporter
14771473

1474+
COPY --chown=postgres compute/etc/postgres_exporter.yml /etc/postgres_exporter.yml
1475+
14781476
COPY --from=sql_exporter_preprocessor --chmod=0644 /home/nonroot/compute/etc/sql_exporter.yml /etc/sql_exporter.yml
14791477
COPY --from=sql_exporter_preprocessor --chmod=0644 /home/nonroot/compute/etc/neon_collector.yml /etc/neon_collector.yml
14801478
COPY --from=sql_exporter_preprocessor --chmod=0644 /home/nonroot/compute/etc/sql_exporter_autoscaling.yml /etc/sql_exporter_autoscaling.yml

Diff for: compute/etc/postgres_exporter.yml

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SELECT neon.backpressure_throttling_time()::float8 / 1000 AS throttled;
1+
SELECT (neon.backpressure_throttling_time()::float8 / 1000000) AS throttled;

Diff for: compute/patches/pg_anon.patch

+42
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
commit 00aa659afc9c7336ab81036edec3017168aabf40
2+
Author: Heikki Linnakangas <[email protected]>
3+
Date: Tue Nov 12 16:59:19 2024 +0200
4+
5+
Temporarily disable test that depends on timezone
6+
7+
diff --git a/tests/expected/generalization.out b/tests/expected/generalization.out
8+
index 23ef5fa..9e60deb 100644
9+
--- a/ext-src/pg_anon-src/tests/expected/generalization.out
10+
+++ b/ext-src/pg_anon-src/tests/expected/generalization.out
11+
@@ -284,12 +284,9 @@ SELECT anon.generalize_tstzrange('19041107','century');
12+
["Tue Jan 01 00:00:00 1901 PST","Mon Jan 01 00:00:00 2001 PST")
13+
(1 row)
14+
15+
-SELECT anon.generalize_tstzrange('19041107','millennium');
16+
- generalize_tstzrange
17+
------------------------------------------------------------------
18+
- ["Thu Jan 01 00:00:00 1001 PST","Mon Jan 01 00:00:00 2001 PST")
19+
-(1 row)
20+
-
21+
+-- temporarily disabled, see:
22+
+-- https://gitlab.com/dalibo/postgresql_anonymizer/-/commit/199f0a392b37c59d92ae441fb8f037e094a11a52#note_2148017485
23+
+--SELECT anon.generalize_tstzrange('19041107','millennium');
24+
-- generalize_daterange
25+
SELECT anon.generalize_daterange('19041107');
26+
generalize_daterange
27+
diff --git a/tests/sql/generalization.sql b/tests/sql/generalization.sql
28+
index b868344..b4fc977 100644
29+
--- a/ext-src/pg_anon-src/tests/sql/generalization.sql
30+
+++ b/ext-src/pg_anon-src/tests/sql/generalization.sql
31+
@@ -61,7 +61,9 @@ SELECT anon.generalize_tstzrange('19041107','month');
32+
SELECT anon.generalize_tstzrange('19041107','year');
33+
SELECT anon.generalize_tstzrange('19041107','decade');
34+
SELECT anon.generalize_tstzrange('19041107','century');
35+
-SELECT anon.generalize_tstzrange('19041107','millennium');
36+
+-- temporarily disabled, see:
37+
+-- https://gitlab.com/dalibo/postgresql_anonymizer/-/commit/199f0a392b37c59d92ae441fb8f037e094a11a52#note_2148017485
38+
+--SELECT anon.generalize_tstzrange('19041107','millennium');
39+
40+
-- generalize_daterange
41+
SELECT anon.generalize_daterange('19041107');
42+
143
commit 7dd414ee75f2875cffb1d6ba474df1f135a6fc6f
244
Author: Alexey Masterov <[email protected]>
345
Date: Fri May 31 06:34:26 2024 +0000

Diff for: compute/vm-image-spec-bookworm.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ commands:
2626
- name: postgres-exporter
2727
user: nobody
2828
sysvInitAction: respawn
29-
shell: 'DATA_SOURCE_NAME="user=cloud_admin sslmode=disable dbname=postgres application_name=postgres-exporter" /bin/postgres_exporter'
29+
shell: 'DATA_SOURCE_NAME="user=cloud_admin sslmode=disable dbname=postgres application_name=postgres-exporter" /bin/postgres_exporter --config.file=/etc/postgres_exporter.yml'
3030
- name: sql-exporter
3131
user: nobody
3232
sysvInitAction: respawn

Diff for: compute/vm-image-spec-bullseye.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ commands:
2626
- name: postgres-exporter
2727
user: nobody
2828
sysvInitAction: respawn
29-
shell: 'DATA_SOURCE_NAME="user=cloud_admin sslmode=disable dbname=postgres application_name=postgres-exporter" /bin/postgres_exporter'
29+
shell: 'DATA_SOURCE_NAME="user=cloud_admin sslmode=disable dbname=postgres application_name=postgres-exporter" /bin/postgres_exporter --config.file=/etc/postgres_exporter.yml'
3030
- name: sql-exporter
3131
user: nobody
3232
sysvInitAction: respawn

Diff for: compute_tools/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ clap.workspace = true
1818
flate2.workspace = true
1919
futures.workspace = true
2020
hyper0 = { workspace = true, features = ["full"] }
21+
metrics.workspace = true
2122
nix.workspace = true
2223
notify.workspace = true
2324
num_cpus.workspace = true
25+
once_cell.workspace = true
2426
opentelemetry.workspace = true
2527
opentelemetry_sdk.workspace = true
2628
postgres.workspace = true
@@ -39,6 +41,7 @@ tracing-subscriber.workspace = true
3941
tracing-utils.workspace = true
4042
thiserror.workspace = true
4143
url.workspace = true
44+
prometheus.workspace = true
4245

4346
compute_api.workspace = true
4447
utils.workspace = true

Diff for: compute_tools/src/http/api.rs

+25
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::catalog::SchemaDumpError;
99
use crate::catalog::{get_database_schema, get_dbs_and_roles};
1010
use crate::compute::forward_termination_signal;
1111
use crate::compute::{ComputeNode, ComputeState, ParsedSpec};
12+
use crate::installed_extensions;
1213
use compute_api::requests::{ConfigurationRequest, ExtensionInstallRequest, SetRoleGrantsRequest};
1314
use compute_api::responses::{
1415
ComputeStatus, ComputeStatusResponse, ExtensionInstallResult, GenericAPIError,
@@ -19,6 +20,8 @@ use anyhow::Result;
1920
use hyper::header::CONTENT_TYPE;
2021
use hyper::service::{make_service_fn, service_fn};
2122
use hyper::{Body, Method, Request, Response, Server, StatusCode};
23+
use metrics::Encoder;
24+
use metrics::TextEncoder;
2225
use tokio::task;
2326
use tracing::{debug, error, info, warn};
2427
use tracing_utils::http::OtelName;
@@ -65,6 +68,28 @@ async fn routes(req: Request<Body>, compute: &Arc<ComputeNode>) -> Response<Body
6568
Response::new(Body::from(serde_json::to_string(&metrics).unwrap()))
6669
}
6770

71+
// Prometheus metrics
72+
(&Method::GET, "/metrics") => {
73+
debug!("serving /metrics GET request");
74+
75+
let mut buffer = vec![];
76+
let metrics = installed_extensions::collect();
77+
let encoder = TextEncoder::new();
78+
encoder.encode(&metrics, &mut buffer).unwrap();
79+
80+
match Response::builder()
81+
.status(StatusCode::OK)
82+
.header(CONTENT_TYPE, encoder.format_type())
83+
.body(Body::from(buffer))
84+
{
85+
Ok(response) => response,
86+
Err(err) => {
87+
let msg = format!("error handling /metrics request: {err}");
88+
error!(msg);
89+
render_json_error(&msg, StatusCode::INTERNAL_SERVER_ERROR)
90+
}
91+
}
92+
}
6893
// Collect Postgres current usage insights
6994
(&Method::GET, "/insights") => {
7095
info!("serving /insights GET request");

Diff for: compute_tools/src/http/openapi_spec.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ paths:
3737
schema:
3838
$ref: "#/components/schemas/ComputeMetrics"
3939

40+
/metrics
41+
get:
42+
tags:
43+
- Info
44+
summary: Get compute node metrics in text format.
45+
description: ""
46+
operationId: getComputeMetrics
47+
responses:
48+
200:
49+
description: ComputeMetrics
50+
content:
51+
text/plain:
52+
schema:
53+
type: string
54+
description: Metrics in text format.
4055
/insights:
4156
get:
4257
tags:

Diff for: compute_tools/src/installed_extensions.rs

+28-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use compute_api::responses::{InstalledExtension, InstalledExtensions};
2+
use metrics::proto::MetricFamily;
23
use std::collections::HashMap;
34
use std::collections::HashSet;
45
use tracing::info;
@@ -8,6 +9,10 @@ use anyhow::Result;
89
use postgres::{Client, NoTls};
910
use tokio::task;
1011

12+
use metrics::core::Collector;
13+
use metrics::{register_uint_gauge_vec, UIntGaugeVec};
14+
use once_cell::sync::Lazy;
15+
1116
/// We don't reuse get_existing_dbs() just for code clarity
1217
/// and to make database listing query here more explicit.
1318
///
@@ -59,6 +64,12 @@ pub async fn get_installed_extensions(connstr: Url) -> Result<InstalledExtension
5964

6065
for (extname, v) in extensions.iter() {
6166
let version = v.to_string();
67+
68+
// increment the number of databases where the version of extension is installed
69+
INSTALLED_EXTENSIONS
70+
.with_label_values(&[extname, &version])
71+
.inc();
72+
6273
extensions_map
6374
.entry(extname.to_string())
6475
.and_modify(|e| {
@@ -74,9 +85,11 @@ pub async fn get_installed_extensions(connstr: Url) -> Result<InstalledExtension
7485
}
7586
}
7687

77-
Ok(InstalledExtensions {
88+
let res = InstalledExtensions {
7889
extensions: extensions_map.values().cloned().collect(),
79-
})
90+
};
91+
92+
Ok(res)
8093
})
8194
.await?
8295
}
@@ -97,6 +110,18 @@ pub fn get_installed_extensions_sync(connstr: Url) -> Result<()> {
97110
"[NEON_EXT_STAT] {}",
98111
serde_json::to_string(&result).expect("failed to serialize extensions list")
99112
);
100-
101113
Ok(())
102114
}
115+
116+
static INSTALLED_EXTENSIONS: Lazy<UIntGaugeVec> = Lazy::new(|| {
117+
register_uint_gauge_vec!(
118+
"installed_extensions",
119+
"Number of databases where the version of extension is installed",
120+
&["extension_name", "version"]
121+
)
122+
.expect("failed to define a metric")
123+
});
124+
125+
pub fn collect() -> Vec<MetricFamily> {
126+
INSTALLED_EXTENSIONS.collect()
127+
}

Diff for: docs/rfcs/038-aux-file-v2.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ generating the basebackup by scanning the `REPL_ORIGIN_KEY_PREFIX` keyspace.
9191
There are two places we need to read the aux files from the pageserver:
9292

9393
* On the write path, when the compute node adds an aux file to the pageserver, we will retrieve the key from the storage, append the file to the hashed key, and write it back. The current `get` API already supports that.
94-
* We use the vectored get API to retrieve all aux files during generating the basebackup. Because we need to scan a sparse keyspace, we slightly modified the vectored get path. The vectorized API will attempt to retrieve every single key within the requested key range, and therefore, we modified it in a way that keys within `NON_INHERITED_SPARSE_RANGE` will not trigger missing key error.
94+
* We use the vectored get API to retrieve all aux files during generating the basebackup. Because we need to scan a sparse keyspace, we slightly modified the vectored get path. The vectorized API used to always attempt to retrieve every single key within the requested key range, and therefore, we modified it in a way that keys within `NON_INHERITED_SPARSE_RANGE` will not trigger missing key error. Furthermore, as aux file reads usually need all layer files intersecting with that key range within the branch and cover a big keyspace, it incurs large overhead for tracking keyspaces that have not been read. Therefore, for sparse keyspaces, we [do not track](https://github.com/neondatabase/neon/pull/9631) `ummapped_keyspace`.
9595

9696
## Compaction and Image Layer Generation
9797

Diff for: libs/pageserver_api/src/record.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ impl NeonWalRecord {
8080
}
8181

8282
#[cfg(feature = "testing")]
83-
pub fn wal_clear() -> Self {
83+
pub fn wal_clear(s: impl AsRef<str>) -> Self {
8484
Self::Test {
85-
append: "".to_string(),
85+
append: s.as_ref().to_string(),
8686
clear: true,
8787
will_init: false,
8888
}
8989
}
9090

9191
#[cfg(feature = "testing")]
92-
pub fn wal_init() -> Self {
92+
pub fn wal_init(s: impl AsRef<str>) -> Self {
9393
Self::Test {
94-
append: "".to_string(),
94+
append: s.as_ref().to_string(),
9595
clear: true,
9696
will_init: true,
9797
}

Diff for: libs/utils/src/auth.rs

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ pub enum Scope {
4040
/// Allows access to storage controller APIs used by the scrubber, to interrogate the state
4141
/// of a tenant & post scrub results.
4242
Scrubber,
43+
44+
/// This scope is used for communication with other storage controller instances.
45+
/// At the time of writing, this is only used for the step down request.
46+
#[serde(rename = "controller_peer")]
47+
ControllerPeer,
4348
}
4449

4550
/// JWT payload. See docs/authentication.md for the format

0 commit comments

Comments
 (0)