Skip to content

Commit 3cd601b

Browse files
authored
Merge pull request #10501 from neondatabase/rc/release-compute/2025-01-24
Compute release 2025-01-24
2 parents c68b346 + 44ef8c8 commit 3cd601b

Some content is hidden

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

73 files changed

+2661
-767
lines changed

Diff for: .github/workflows/_build-and-test-locally.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,13 @@ jobs:
229229
${cov_prefix} cargo nextest run $CARGO_FLAGS $CARGO_FEATURES -E '!package(pageserver)'
230230
231231
# run pageserver tests with different settings
232-
for io_engine in std-fs tokio-epoll-uring ; do
233-
NEON_PAGESERVER_UNIT_TEST_VIRTUAL_FILE_IOENGINE=$io_engine ${cov_prefix} cargo nextest run $CARGO_FLAGS $CARGO_FEATURES -E 'package(pageserver)'
232+
for get_vectored_concurrent_io in sequential sidecar-task; do
233+
for io_engine in std-fs tokio-epoll-uring ; do
234+
NEON_PAGESERVER_UNIT_TEST_GET_VECTORED_CONCURRENT_IO=$get_vectored_concurrent_io \
235+
NEON_PAGESERVER_UNIT_TEST_VIRTUAL_FILE_IOENGINE=$io_engine \
236+
${cov_prefix} \
237+
cargo nextest run $CARGO_FLAGS $CARGO_FEATURES -E 'package(pageserver)'
238+
done
234239
done
235240
236241
# Run separate tests for real S3
@@ -314,6 +319,7 @@ jobs:
314319
CHECK_ONDISK_DATA_COMPATIBILITY: nonempty
315320
BUILD_TAG: ${{ inputs.build-tag }}
316321
PAGESERVER_VIRTUAL_FILE_IO_ENGINE: tokio-epoll-uring
322+
PAGESERVER_GET_VECTORED_CONCURRENT_IO: sidecar-task
317323
USE_LFC: ${{ matrix.lfc_state == 'with-lfc' && 'true' || 'false' }}
318324

319325
# Temporary disable this step until we figure out why it's so flaky

Diff for: .github/workflows/build_and_test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -892,14 +892,14 @@ jobs:
892892
run: |
893893
for repo in neondatabase 369495373322.dkr.ecr.eu-central-1.amazonaws.com; do
894894
docker buildx imagetools create -t $repo/neon:latest \
895-
$repo/neon:${{ needs.tag.outputs.build-tag }}
895+
neondatabase/neon:${{ needs.tag.outputs.build-tag }}
896896
897897
for version in ${VERSIONS}; do
898898
docker buildx imagetools create -t $repo/compute-node-${version}:latest \
899-
$repo/compute-node-${version}:${{ needs.tag.outputs.build-tag }}
899+
neondatabase/compute-node-${version}:${{ needs.tag.outputs.build-tag }}
900900
901901
docker buildx imagetools create -t $repo/vm-compute-node-${version}:latest \
902-
$repo/vm-compute-node-${version}:${{ needs.tag.outputs.build-tag }}
902+
neondatabase/vm-compute-node-${version}:${{ needs.tag.outputs.build-tag }}
903903
done
904904
done
905905
docker buildx imagetools create -t neondatabase/neon-test-extensions-v16:latest \

Diff for: .github/workflows/release.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ name: Create Release Branch
33
on:
44
schedule:
55
# It should be kept in sync with if-condition in jobs
6-
- cron: '0 6 * * FRI' # Storage release
76
- cron: '0 6 * * THU' # Proxy release
7+
- cron: '0 6 * * FRI' # Storage release
8+
- cron: '0 7 * * FRI' # Compute release
89
workflow_dispatch:
910
inputs:
1011
create-storage-release-branch:
@@ -55,7 +56,7 @@ jobs:
5556
ci-access-token: ${{ secrets.CI_ACCESS_TOKEN }}
5657

5758
create-compute-release-branch:
58-
if: inputs.create-compute-release-branch
59+
if: ${{ github.event.schedule == '0 7 * * FRI' || inputs.create-compute-release-branch }}
5960

6061
permissions:
6162
contents: write

Diff for: Cargo.lock

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

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ tokio-tar = "0.3"
187187
tokio-util = { version = "0.7.10", features = ["io", "rt"] }
188188
toml = "0.8"
189189
toml_edit = "0.22"
190-
tonic = {version = "0.12.3", features = ["tls", "tls-roots"]}
190+
tonic = {version = "0.12.3", default-features = false, features = ["channel", "tls", "tls-roots"]}
191191
tower = { version = "0.5.2", default-features = false }
192192
tower-http = { version = "0.6.2", features = ["request-id", "trace"] }
193193
tower-service = "0.3.3"

Diff for: compute/compute-node.Dockerfile

+5-6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ RUN cd postgres && \
6767
# Enable some of contrib extensions
6868
echo 'trusted = true' >> /usr/local/pgsql/share/extension/autoinc.control && \
6969
echo 'trusted = true' >> /usr/local/pgsql/share/extension/dblink.control && \
70+
echo 'trusted = true' >> /usr/local/pgsql/share/extension/postgres_fdw.control && \
71+
file=/usr/local/pgsql/share/extension/postgres_fdw--1.0.sql && [ -e $file ] && \
72+
echo 'GRANT USAGE ON FOREIGN DATA WRAPPER postgres_fdw TO neon_superuser;' >> $file && \
7073
echo 'trusted = true' >> /usr/local/pgsql/share/extension/bloom.control && \
7174
echo 'trusted = true' >> /usr/local/pgsql/share/extension/earthdistance.control && \
7275
echo 'trusted = true' >> /usr/local/pgsql/share/extension/insert_username.control && \
@@ -360,6 +363,8 @@ COPY compute/patches/pgvector.patch /pgvector.patch
360363
RUN wget https://github.com/pgvector/pgvector/archive/refs/tags/v0.8.0.tar.gz -O pgvector.tar.gz && \
361364
echo "867a2c328d4928a5a9d6f052cd3bc78c7d60228a9b914ad32aa3db88e9de27b0 pgvector.tar.gz" | sha256sum --check && \
362365
mkdir pgvector-src && cd pgvector-src && tar xzf ../pgvector.tar.gz --strip-components=1 -C . && \
366+
wget https://github.com/pgvector/pgvector/raw/refs/tags/v0.7.4/sql/vector.sql -O ./sql/vector--0.7.4.sql && \
367+
echo "10218d05dc02299562252a9484775178b14a1d8edb92a2d1672ef488530f7778 ./sql/vector--0.7.4.sql" | sha256sum --check && \
363368
patch -p1 < /pgvector.patch && \
364369
make -j $(getconf _NPROCESSORS_ONLN) OPTFLAGS="" && \
365370
make -j $(getconf _NPROCESSORS_ONLN) OPTFLAGS="" install && \
@@ -1347,9 +1352,6 @@ COPY --from=pg-roaringbitmap-pg-build /pg_roaringbitmap.tar.gz /ext-src
13471352
COPY --from=pg-semver-pg-build /pg_semver.tar.gz /ext-src
13481353
#COPY --from=pg-embedding-pg-build /home/nonroot/pg_embedding-src/ /ext-src
13491354
#COPY --from=wal2json-pg-build /wal2json_2_5.tar.gz /ext-src
1350-
#pg_anon is not supported yet for pg v17 so, don't fail if nothing found
1351-
COPY --from=pg-anon-pg-build /pg_anon.tar.g? /ext-src
1352-
COPY compute/patches/pg_anon.patch /ext-src
13531355
COPY --from=pg-ivm-build /pg_ivm.tar.gz /ext-src
13541356
COPY --from=pg-partman-build /pg_partman.tar.gz /ext-src
13551357
RUN cd /ext-src/ && for f in *.tar.gz; \
@@ -1360,9 +1362,6 @@ RUN cd /ext-src/rum-src && patch -p1 <../rum.patch
13601362
RUN cd /ext-src/pgvector-src && patch -p1 <../pgvector.patch
13611363
RUN cd /ext-src/pg_hint_plan-src && patch -p1 < /ext-src/pg_hint_plan_${PG_VERSION}.patch
13621364
COPY --chmod=755 docker-compose/run-tests.sh /run-tests.sh
1363-
RUN case "${PG_VERSION}" in "v17") \
1364-
echo "postgresql_anonymizer does not yet support PG17" && exit 0;; \
1365-
esac && patch -p1 </ext-src/pg_anon.patch
13661365
RUN patch -p1 </ext-src/pg_cron.patch
13671366
ENV PATH=/usr/local/pgsql/bin:$PATH
13681367
ENV PGHOST=compute

Diff for: compute/patches/pgvector.patch

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1+
diff --git a/Makefile b/Makefile
2+
index 7a4b88c..56678af 100644
3+
--- a/Makefile
4+
+++ b/Makefile
5+
@@ -3,7 +3,10 @@ EXTVERSION = 0.8.0
6+
7+
MODULE_big = vector
8+
DATA = $(wildcard sql/*--*--*.sql)
9+
-DATA_built = sql/$(EXTENSION)--$(EXTVERSION).sql
10+
+# This change is needed to install different per-version SQL files
11+
+# like pgvector--0.8.0.sql and pgvector--0.7.4.sql
12+
+# The corresponding file is downloaded during the Docker image build process
13+
+DATA_built = sql/$(EXTENSION)--$(EXTVERSION).sql sql/vector--0.7.4.sql
14+
OBJS = src/bitutils.o src/bitvec.o src/halfutils.o src/halfvec.o src/hnsw.o src/hnswbuild.o src/hnswinsert.o src/hnswscan.o src/hnswutils.o src/hnswvacuum.o src/ivfbuild.o src/ivfflat.o src/ivfinsert.o src/ivfkmeans.o src/ivfscan.o src/ivfutils.o src/ivfvacuum.o src/sparsevec.o src/vector.o
15+
HEADERS = src/halfvec.h src/sparsevec.h src/vector.h
16+
117
diff --git a/src/hnswbuild.c b/src/hnswbuild.c
2-
index dcfb2bd..d5189ee 100644
18+
index b667478..fc1897c 100644
319
--- a/src/hnswbuild.c
420
+++ b/src/hnswbuild.c
5-
@@ -860,9 +860,17 @@ HnswParallelBuildMain(dsm_segment *seg, shm_toc *toc)
21+
@@ -843,9 +843,17 @@ HnswParallelBuildMain(dsm_segment *seg, shm_toc *toc)
622

723
hnswarea = shm_toc_lookup(toc, PARALLEL_KEY_HNSW_AREA, false);
824

@@ -20,7 +36,7 @@ index dcfb2bd..d5189ee 100644
2036
/* Close relations within worker */
2137
index_close(indexRel, indexLockmode);
2238
table_close(heapRel, heapLockmode);
23-
@@ -1117,12 +1125,38 @@ BuildIndex(Relation heap, Relation index, IndexInfo *indexInfo,
39+
@@ -1100,12 +1108,38 @@ BuildIndex(Relation heap, Relation index, IndexInfo *indexInfo,
2440
SeedRandom(42);
2541
#endif
2642

Diff for: compute_tools/src/compute.rs

+89-15
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ use crate::local_proxy;
4141
use crate::pg_helpers::*;
4242
use crate::spec::*;
4343
use crate::spec_apply::ApplySpecPhase::{
44-
CreateAndAlterDatabases, CreateAndAlterRoles, CreateAvailabilityCheck, CreateSuperUser,
45-
DropInvalidDatabases, DropRoles, HandleNeonExtension, HandleOtherExtensions,
46-
RenameAndDeleteDatabases, RenameRoles, RunInEachDatabase,
44+
CreateAndAlterDatabases, CreateAndAlterRoles, CreateAvailabilityCheck, CreateSchemaNeon,
45+
CreateSuperUser, DropInvalidDatabases, DropRoles, FinalizeDropLogicalSubscriptions,
46+
HandleNeonExtension, HandleOtherExtensions, RenameAndDeleteDatabases, RenameRoles,
47+
RunInEachDatabase,
4748
};
4849
use crate::spec_apply::PerDatabasePhase;
4950
use crate::spec_apply::PerDatabasePhase::{
50-
ChangeSchemaPerms, DeleteDBRoleReferences, DropSubscriptionsForDeletedDatabases,
51-
HandleAnonExtension,
51+
ChangeSchemaPerms, DeleteDBRoleReferences, DropLogicalSubscriptions, HandleAnonExtension,
5252
};
5353
use crate::spec_apply::{apply_operations, MutableApplyContext, DB};
5454
use crate::sync_sk::{check_if_synced, ping_safekeeper};
@@ -340,6 +340,15 @@ impl ComputeNode {
340340
self.state.lock().unwrap().status
341341
}
342342

343+
pub fn get_timeline_id(&self) -> Option<TimelineId> {
344+
self.state
345+
.lock()
346+
.unwrap()
347+
.pspec
348+
.as_ref()
349+
.map(|s| s.timeline_id)
350+
}
351+
343352
// Remove `pgdata` directory and create it again with right permissions.
344353
fn create_pgdata(&self) -> Result<()> {
345354
// Ignore removal error, likely it is a 'No such file or directory (os error 2)'.
@@ -929,6 +938,48 @@ impl ComputeNode {
929938
.map(|role| (role.name.clone(), role))
930939
.collect::<HashMap<String, Role>>();
931940

941+
// Check if we need to drop subscriptions before starting the endpoint.
942+
//
943+
// It is important to do this operation exactly once when endpoint starts on a new branch.
944+
// Otherwise, we may drop not inherited, but newly created subscriptions.
945+
//
946+
// We cannot rely only on spec.drop_subscriptions_before_start flag,
947+
// because if for some reason compute restarts inside VM,
948+
// it will start again with the same spec and flag value.
949+
//
950+
// To handle this, we save the fact of the operation in the database
951+
// in the neon.drop_subscriptions_done table.
952+
// If the table does not exist, we assume that the operation was never performed, so we must do it.
953+
// If table exists, we check if the operation was performed on the current timelilne.
954+
//
955+
let mut drop_subscriptions_done = false;
956+
957+
if spec.drop_subscriptions_before_start {
958+
let timeline_id = self.get_timeline_id().context("timeline_id must be set")?;
959+
let query = format!("select 1 from neon.drop_subscriptions_done where timeline_id = '{}'", timeline_id);
960+
961+
info!("Checking if drop subscription operation was already performed for timeline_id: {}", timeline_id);
962+
963+
drop_subscriptions_done = match
964+
client.simple_query(&query).await {
965+
Ok(result) => {
966+
matches!(&result[0], postgres::SimpleQueryMessage::Row(_))
967+
},
968+
Err(e) =>
969+
{
970+
match e.code() {
971+
Some(&SqlState::UNDEFINED_TABLE) => false,
972+
_ => {
973+
// We don't expect any other error here, except for the schema/table not existing
974+
error!("Error checking if drop subscription operation was already performed: {}", e);
975+
return Err(e.into());
976+
}
977+
}
978+
}
979+
}
980+
};
981+
982+
932983
let jwks_roles = Arc::new(
933984
spec.as_ref()
934985
.local_proxy_config
@@ -996,7 +1047,7 @@ impl ComputeNode {
9961047
jwks_roles.clone(),
9971048
concurrency_token.clone(),
9981049
db,
999-
[DropSubscriptionsForDeletedDatabases].to_vec(),
1050+
[DropLogicalSubscriptions].to_vec(),
10001051
);
10011052

10021053
Ok(spawn(fut))
@@ -1024,6 +1075,7 @@ impl ComputeNode {
10241075
CreateAndAlterRoles,
10251076
RenameAndDeleteDatabases,
10261077
CreateAndAlterDatabases,
1078+
CreateSchemaNeon,
10271079
] {
10281080
info!("Applying phase {:?}", &phase);
10291081
apply_operations(
@@ -1064,19 +1116,25 @@ impl ComputeNode {
10641116
}
10651117

10661118
let conf = Arc::new(conf);
1119+
let mut phases = vec![
1120+
DeleteDBRoleReferences,
1121+
ChangeSchemaPerms,
1122+
HandleAnonExtension,
1123+
];
1124+
1125+
if spec.drop_subscriptions_before_start && !drop_subscriptions_done {
1126+
info!("Adding DropLogicalSubscriptions phase because drop_subscriptions_before_start is set");
1127+
phases.push(DropLogicalSubscriptions);
1128+
}
1129+
10671130
let fut = Self::apply_spec_sql_db(
10681131
spec.clone(),
10691132
conf,
10701133
ctx.clone(),
10711134
jwks_roles.clone(),
10721135
concurrency_token.clone(),
10731136
db,
1074-
[
1075-
DeleteDBRoleReferences,
1076-
ChangeSchemaPerms,
1077-
HandleAnonExtension,
1078-
]
1079-
.to_vec(),
1137+
phases,
10801138
);
10811139

10821140
Ok(spawn(fut))
@@ -1088,12 +1146,20 @@ impl ComputeNode {
10881146
handle.await??;
10891147
}
10901148

1091-
for phase in vec![
1149+
let mut phases = vec![
10921150
HandleOtherExtensions,
1093-
HandleNeonExtension,
1151+
HandleNeonExtension, // This step depends on CreateSchemaNeon
10941152
CreateAvailabilityCheck,
10951153
DropRoles,
1096-
] {
1154+
];
1155+
1156+
// This step depends on CreateSchemaNeon
1157+
if spec.drop_subscriptions_before_start && !drop_subscriptions_done {
1158+
info!("Adding FinalizeDropLogicalSubscriptions phase because drop_subscriptions_before_start is set");
1159+
phases.push(FinalizeDropLogicalSubscriptions);
1160+
}
1161+
1162+
for phase in phases {
10971163
debug!("Applying phase {:?}", &phase);
10981164
apply_operations(
10991165
spec.clone(),
@@ -1463,6 +1529,14 @@ impl ComputeNode {
14631529
Ok(())
14641530
},
14651531
)?;
1532+
1533+
let postgresql_conf_path = pgdata_path.join("postgresql.conf");
1534+
if config::line_in_file(
1535+
&postgresql_conf_path,
1536+
"neon.disable_logical_replication_subscribers=false",
1537+
)? {
1538+
info!("updated postgresql.conf to set neon.disable_logical_replication_subscribers=false");
1539+
}
14661540
self.pg_reload_conf()?;
14671541
}
14681542
self.post_apply_config()?;

Diff for: compute_tools/src/config.rs

+7
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ pub fn write_postgres_conf(
129129

130130
writeln!(file, "neon.extension_server_port={}", extension_server_port)?;
131131

132+
if spec.drop_subscriptions_before_start {
133+
writeln!(file, "neon.disable_logical_replication_subscribers=true")?;
134+
} else {
135+
// be explicit about the default value
136+
writeln!(file, "neon.disable_logical_replication_subscribers=false")?;
137+
}
138+
132139
// This is essential to keep this line at the end of the file,
133140
// because it is intended to override any settings above.
134141
writeln!(file, "include_if_exists = 'compute_ctl_temp_override.conf'")?;

0 commit comments

Comments
 (0)