mirror of
https://github.com/neondatabase/neon.git
synced 2026-02-06 12:10:37 +00:00
Compare commits
12 Commits
xid_cmp_in
...
arpad/remo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bf395df76 | ||
|
|
24bc6ddec4 | ||
|
|
f49fe734d1 | ||
|
|
872e645f7d | ||
|
|
648fe7c92d | ||
|
|
21045477a3 | ||
|
|
125f24ca49 | ||
|
|
443d4ce868 | ||
|
|
3290fb09bf | ||
|
|
efdb2bf948 | ||
|
|
5559b16953 | ||
|
|
1aea65eb9d |
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -5031,9 +5031,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.1.0"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook"
|
||||
|
||||
@@ -143,6 +143,8 @@ RUN wget https://github.com/pgRouting/pgrouting/archive/v3.4.2.tar.gz -O pgrouti
|
||||
#########################################################################################
|
||||
FROM build-deps AS plv8-build
|
||||
COPY --from=pg-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
|
||||
ARG PG_VERSION
|
||||
RUN apt update && \
|
||||
apt install -y ninja-build python3-dev libncurses5 binutils clang
|
||||
|
||||
@@ -617,6 +619,7 @@ RUN wget https://github.com/theory/pg-semver/archive/refs/tags/v0.32.1.tar.gz -O
|
||||
FROM build-deps AS pg-embedding-pg-build
|
||||
COPY --from=pg-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
|
||||
ARG PG_VERSION
|
||||
ENV PATH "/usr/local/pgsql/bin/:$PATH"
|
||||
RUN case "${PG_VERSION}" in \
|
||||
"v14" | "v15") \
|
||||
@@ -779,6 +782,8 @@ RUN wget https://github.com/eulerto/wal2json/archive/refs/tags/wal2json_2_5.tar.
|
||||
#
|
||||
#########################################################################################
|
||||
FROM build-deps AS neon-pg-ext-build
|
||||
ARG PG_VERSION
|
||||
|
||||
# Public extensions
|
||||
COPY --from=postgis-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
COPY --from=postgis-build /sfcgal/* /
|
||||
|
||||
@@ -329,8 +329,8 @@ impl CheckPoint {
|
||||
///
|
||||
/// Returns 'true' if the XID was updated.
|
||||
pub fn update_next_xid(&mut self, xid: u32) -> bool {
|
||||
// nextXid should nw greater than any XID in WAL, so increment provided XID and check for wraparround.
|
||||
let mut new_xid = std::cmp::max(xid + 1, pg_constants::FIRST_NORMAL_TRANSACTION_ID);
|
||||
// nextXid should be greater than any XID in WAL, so increment provided XID and check for wraparround.
|
||||
let mut new_xid = std::cmp::max(xid.wrapping_add(1), pg_constants::FIRST_NORMAL_TRANSACTION_ID);
|
||||
// To reduce number of metadata checkpoints, we forward align XID on XID_CHECKPOINT_INTERVAL.
|
||||
// XID_CHECKPOINT_INTERVAL should not be larger than BLCKSZ*CLOG_XACTS_PER_BYTE
|
||||
new_xid =
|
||||
|
||||
@@ -449,6 +449,7 @@ pub enum CreateTimelineError {
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
enum InitdbError {
|
||||
Other(anyhow::Error),
|
||||
#[allow(unused)]
|
||||
Cancelled,
|
||||
Spawn(std::io::Result<()>),
|
||||
Failed(std::process::ExitStatus, Vec<u8>),
|
||||
@@ -3732,7 +3733,7 @@ async fn run_initdb(
|
||||
conf: &'static PageServerConf,
|
||||
initdb_target_dir: &Utf8Path,
|
||||
pg_version: u32,
|
||||
cancel: &CancellationToken,
|
||||
_cancel: &CancellationToken,
|
||||
) -> Result<(), InitdbError> {
|
||||
let initdb_bin_path = conf
|
||||
.pg_bin_dir(pg_version)
|
||||
@@ -3746,7 +3747,7 @@ async fn run_initdb(
|
||||
|
||||
let _permit = INIT_DB_SEMAPHORE.acquire().await;
|
||||
|
||||
let initdb_command = tokio::process::Command::new(&initdb_bin_path)
|
||||
let mut initdb_command = tokio::process::Command::new(&initdb_bin_path)
|
||||
.args(["-D", initdb_target_dir.as_ref()])
|
||||
.args(["-U", &conf.superuser])
|
||||
.args(["-E", "utf8"])
|
||||
@@ -3767,15 +3768,19 @@ async fn run_initdb(
|
||||
.spawn()?;
|
||||
|
||||
tokio::select! {
|
||||
initdb_output = initdb_command.wait_with_output() => {
|
||||
let initdb_output = initdb_output?;
|
||||
if !initdb_output.status.success() {
|
||||
return Err(InitdbError::Failed(initdb_output.status, initdb_output.stderr));
|
||||
exit_status = initdb_command.wait() => {
|
||||
let exit_status = exit_status?;
|
||||
if !exit_status.success() {
|
||||
let mut stderr = initdb_command.stderr.take().unwrap();
|
||||
let mut stderr_vec = Vec::new();
|
||||
tokio::io::copy(&mut stderr, &mut stderr_vec).await?;
|
||||
return Err(InitdbError::Failed(exit_status, stderr_vec));
|
||||
}
|
||||
}
|
||||
_ = cancel.cancelled() => {
|
||||
/*_ = cancel.cancelled() => {
|
||||
initdb_command.kill().await?;
|
||||
return Err(InitdbError::Cancelled);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
2
proxy/src/cache/project_info.rs
vendored
2
proxy/src/cache/project_info.rs
vendored
@@ -266,7 +266,7 @@ impl ProjectInfoCacheImpl {
|
||||
tokio::time::interval(self.config.gc_interval / (self.cache.shards().len()) as u32);
|
||||
loop {
|
||||
interval.tick().await;
|
||||
if self.cache.len() <= self.config.size {
|
||||
if self.cache.len() < self.config.size {
|
||||
// If there are not too many entries, wait until the next gc cycle.
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import concurrent.futures
|
||||
import enum
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
from threading import Thread
|
||||
|
||||
import pytest
|
||||
@@ -556,6 +557,216 @@ def test_tenant_delete_concurrent(
|
||||
assert ps_http.get_metric_value("pageserver_tenant_manager_slots") == 0
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_01(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_02(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_03(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_04(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_05(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_06(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_07(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_08(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_09(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_10(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_11(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_12(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_13(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_14(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_15(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_16(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_17(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_18(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_19(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_20(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_21(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_22(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_23(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_24(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_25(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_26(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_27(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_28(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_29(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation_30(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
):
|
||||
test_tenant_delete_races_timeline_creation(neon_env_builder, pg_bin)
|
||||
|
||||
|
||||
def test_tenant_delete_races_timeline_creation(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
pg_bin: PgBin,
|
||||
@@ -578,6 +789,9 @@ def test_tenant_delete_races_timeline_creation(
|
||||
".*POST.*Cancelled request finished with an error: InternalServerError\\(.*ancelled"
|
||||
)
|
||||
|
||||
# This can occur sometimes.
|
||||
CONFLICT_MESSAGE = ".*Precondition failed: Invalid state Stopping. Expected Active or Broken.*"
|
||||
|
||||
env.pageserver.allowed_errors.extend(
|
||||
[
|
||||
# lucky race with stopping from flushing a layer we fail to schedule any uploads
|
||||
@@ -586,6 +800,9 @@ def test_tenant_delete_races_timeline_creation(
|
||||
".*POST.*/timeline.* request was dropped before completing",
|
||||
# Timeline creation runs into this error
|
||||
CANCELLED_ERROR,
|
||||
# Timeline deletion can run into this error during deletion
|
||||
CONFLICT_MESSAGE,
|
||||
".*tenant_delete_handler.*still waiting, taking longer than expected.*",
|
||||
]
|
||||
)
|
||||
|
||||
@@ -643,6 +860,8 @@ def test_tenant_delete_races_timeline_creation(
|
||||
except PageserverApiException:
|
||||
pass
|
||||
|
||||
time.sleep(4)
|
||||
|
||||
# Physical deletion should have happened
|
||||
assert_prefix_empty(
|
||||
neon_env_builder.pageserver_remote_storage,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import pytest
|
||||
from fixtures.log_helper import log
|
||||
from fixtures.neon_fixtures import NeonEnv, fork_at_current_lsn
|
||||
|
||||
@@ -117,6 +118,8 @@ def test_vm_bit_clear(neon_simple_env: NeonEnv):
|
||||
# Test that the ALL_FROZEN VM bit is cleared correctly at a HEAP_LOCK
|
||||
# record.
|
||||
#
|
||||
# FIXME: This test is broken
|
||||
@pytest.mark.skip("See https://github.com/neondatabase/neon/pull/6412#issuecomment-1902072541")
|
||||
def test_vm_bit_clear_on_heap_lock(neon_simple_env: NeonEnv):
|
||||
env = neon_simple_env
|
||||
|
||||
@@ -150,7 +153,7 @@ def test_vm_bit_clear_on_heap_lock(neon_simple_env: NeonEnv):
|
||||
# Remember the XID. We will use it later to verify that we have consumed a lot of
|
||||
# XIDs after this.
|
||||
cur.execute("select pg_current_xact_id()")
|
||||
locking_xid = int(cur.fetchall()[0][0])
|
||||
locking_xid = cur.fetchall()[0][0]
|
||||
|
||||
# Stop and restart postgres, to clear the buffer cache.
|
||||
#
|
||||
@@ -191,17 +194,17 @@ def test_vm_bit_clear_on_heap_lock(neon_simple_env: NeonEnv):
|
||||
tup = cur.fetchall()
|
||||
log.info(f"tuple = {tup}")
|
||||
xmax = tup[0][1]
|
||||
assert xmax == "0" or xmax == xmax_before
|
||||
assert xmax == xmax_before
|
||||
|
||||
if i % 50 == 0:
|
||||
cur.execute("select datfrozenxid from pg_database where datname='postgres'")
|
||||
datfrozenxid = int(cur.fetchall()[0][0])
|
||||
datfrozenxid = cur.fetchall()[0][0]
|
||||
if datfrozenxid > locking_xid:
|
||||
break
|
||||
|
||||
cur.execute("select pg_current_xact_id()")
|
||||
curr_xid = int(cur.fetchall()[0][0])
|
||||
assert curr_xid - locking_xid >= 100000
|
||||
curr_xid = cur.fetchall()[0][0]
|
||||
assert int(curr_xid) - int(locking_xid) >= 100000
|
||||
|
||||
# Now, if the VM all-frozen bit was not correctly cleared on
|
||||
# replay, we will try to fetch the status of the XID that was
|
||||
@@ -211,4 +214,3 @@ def test_vm_bit_clear_on_heap_lock(neon_simple_env: NeonEnv):
|
||||
cur.execute("select xmin, xmax, * from vmtest_lock where id = 40000 for update")
|
||||
tup = cur.fetchall()
|
||||
log.info(f"tuple = {tup}")
|
||||
cur.execute("commit transaction")
|
||||
|
||||
Reference in New Issue
Block a user