Commit Graph

2992 Commits

Author SHA1 Message Date
Christian Schwarz
ea3c76a9d6 refactor: instead of 'overage', have two separate lists 2023-03-28 17:36:59 +02:00
Christian Schwarz
799576ab1e Merge branch 'problame/disk-usage-eviction' into heikki/disk-usage-eviction 2023-03-28 15:24:52 +02:00
Christian Schwarz
18ed0f9a06 enable disk-usage-based eviction in staging
We'll do some manual testing of the statvfs loop there.
2023-03-28 12:52:16 +02:00
Christian Schwarz
453c3fd2da doc: fix typo
Co-authored-by: Heikki Linnakangas <heikki@neon.tech>
2023-03-28 12:22:26 +02:00
Christian Schwarz
0428b6822a doc: more comment on lru_candidates to address questions from review 2023-03-28 11:53:48 +02:00
Christian Schwarz
42d63270a5 doc: add comment on extend_lru_candidates 2023-03-28 11:44:10 +02:00
Christian Schwarz
0056108c45 doc: remove stray comment 2023-03-28 11:44:10 +02:00
Christian Schwarz
54cc1d5064 doc: sub-headings for mechanics & policy in module comment 2023-03-28 11:44:10 +02:00
Joonas Koivunen
70c837a4b2 refactor: simplify max_layer_size as u64 2023-03-28 12:44:01 +03:00
Christian Schwarz
38d3061143 add comment on not-need to be 100% accurate about max_layer_size 2023-03-28 12:44:01 +03:00
Joonas Koivunen
75759f709f doc: explain "bug" message, log layers 2023-03-28 12:44:01 +03:00
Joonas Koivunen
03ab5df081 chore: remove dead code 2023-03-28 12:44:01 +03:00
Joonas Koivunen
6e8d7b449f refactor: combine nested macthes 2023-03-28 12:44:01 +03:00
Joonas Koivunen
17b5c8d1c4 refactor: get rid of ApproxAccurate 2023-03-28 12:44:01 +03:00
Joonas Koivunen
0943dd30eb chore: clippy 2023-03-28 12:44:01 +03:00
Joonas Koivunen
b599755042 refactor: rename DiskUsageEvictionState => State 2023-03-28 12:44:01 +03:00
Joonas Koivunen
244185e6e6 doc: comment changes
Co-authored-by: Christian Schwarz <christian@neon.tech>
2023-03-28 12:44:01 +03:00
Joonas Koivunen
0a5043fae5 refactor: less static mutexes 2023-03-28 12:44:01 +03:00
Heikki Linnakangas
041b708dc6 rustfmt 2023-03-28 11:08:35 +03:00
Heikki Linnakangas
11b16614a3 Fix test for change in behavior close to the min_resident_size boundary
This PR changed the behavior to match my expectation per my comment:
https://github.com/neondatabase/neon/pull/3809/files#r1149837135
2023-03-28 01:28:27 +03:00
Heikki Linnakangas
b6b8265450 Rewrite to make the algorithm more understandable (I hope).
The algorithm is the same (with two small exceptions), but rewrite the
way it's implemented to make it easier to follow.

The exceptions:
1. 'min_resident_size' now protects at least that much data in the first
   "respectful" phase of the algorithm. Previously, it would evict layers
   until the resident size fell below min_resident_size. In other words,
   we know protect one more layer of each tenant, so that the resident
   size stays just above min_resident_size, while previously we would
   evict enough to bring the resident size just under min_resident_size.

2. Previously, the "max layer size" that's used as the default
   min_resident_size was calculated from *all* layers in the tenant,
   including remote layers. Now it's only calculated across all
   locally-present layers. I don't know if that was a deliberate choice,
   but this is slightly simpler.
2023-03-28 01:28:27 +03:00
Christian Schwarz
0462563d31 doc: more explanation of the added config knobs 2023-03-27 19:52:48 +02:00
Christian Schwarz
ef39b3f067 rename: dedupe comment about allow(dead_code) 2023-03-27 19:27:41 +02:00
Christian Schwarz
e1ba2f96ab fix: post-merge, file_size() returns u64 2023-03-27 19:07:34 +02:00
Christian Schwarz
de3a7470de Merge remote-tracking branch 'origin/main' into problame/disk-usage-eviction 2023-03-27 19:04:55 +02:00
Christian Schwarz
504256a0cc rename: serde_percent::{Value => Percent} 2023-03-27 18:54:32 +02:00
Joonas Koivunen
e7d41c32ae fixup: import Dict 2023-03-27 19:40:32 +03:00
Joonas Koivunen
e2b7e2962e fixup: missing .get() as u64 2023-03-27 19:39:24 +03:00
Joonas Koivunen
849d850d07 fixup: no such variable request 2023-03-27 19:38:52 +03:00
Joonas Koivunen
bbeba32ec0 refactor: reorder added http handlers 2023-03-27 19:35:46 +03:00
Joonas Koivunen
c4b2d3e40a doc: obsolete todo 2023-03-27 19:33:18 +03:00
Joonas Koivunen
382abd5e31 test: approxaccurate 2023-03-27 19:31:59 +03:00
Christian Schwarz
67fc8ec5c4 fix: use Dict in type annotation
Co-authored-by: Dmitry Rodionov <dmitry@neon.tech>
2023-03-27 18:31:40 +02:00
Christian Schwarz
2f1324c015 fix: use parse_request_param
Co-authored-by: Dmitry Rodionov <dmitry@neon.tech>
2023-03-27 18:31:20 +02:00
Christian Schwarz
9d78e98467 refactor: move the percentage value deserialization to newtype in utils 2023-03-27 18:27:29 +02:00
Christian Schwarz
fe15624570 eviction_task: only refresh layer accesses once per p.threshold (#3877)
Without this, we run it every p.period, which can be quite low. For
example, the running experiment with 3000 tenants in prod uses a period
of 1 minute.

Doing it once per p.threshold is enough to prevent eviction.
2023-03-27 14:33:40 +03:00
Christian Schwarz
ff51e96fbd fix synthetic size for (last_record_lsn - gc_horizon) < initdb_lsn (#3874)
fix synthetic size for (last_record_lsn - gc_horizon) < initdb_lsn

Assume a single-timeline project.
If the gc_horizon covers all WAL (last_record_lsn < gc_horizon)
but we have written more data than just initdb, the synthetic
size calculation worker needs to calculate the logical size
at LSN initdb_lsn (Segment BranchStart).

Before this patch, that calculation would incorrectly return
the initial logical size calculation result that we cache in
the Timeline::initial_logical_size. Presumably, because there
was confusion around initdb_lsn vs. initial size calculation.

The fix is to only hand out the initialized_size() only if
the LSN matches.

The distinction in the metrics between "init logical size" and "logical
size" was also incorrect because of the above. So, remove it.

There was a special case for `size != 0`. This was to cover the case of
LogicalSize::empty_initial(), but `initial_part_end` is `None` in that
case, so the new `LogicalSize::initialized_size()` will return None
in that case as well.

Lastly, to prevent confusion like this in the future, rename all
occurrences of `init_lsn` to either just `lsn` or a more specific name.

Co-authored-by: Joonas Koivunen <joonas@neon.tech>
Co-authored-by: Heikki Linnakangas <heikki@neon.tech>
2023-03-27 12:45:10 +02:00
Vadim Kharitonov
e3cbcc2ea7 Revert "Add neondatabase/release team as a default reviewers for storage"
This reverts commit daeaa767c4.
2023-03-27 14:10:18 +04:00
Heikki Linnakangas
8d78329991 Remove some dead code.
whoami() was never called, 'is_test' was never set.

'restart()' might be useful, but it wasn't hooked up the CLI so it was
dead code. It's not clear what kind of a restart it should perform,
anyway: just restart Postgres, or re-initialize the data directory
from a fresh basebackup like "stop"+"start" does.
2023-03-27 12:24:35 +03:00
Dmitry Rodionov
4d8c765485 remove redundant dyn (#3878)
remove redundant dyn
2023-03-27 12:04:48 +03:00
dependabot[bot]
4071ff8c7b Bump openssl from 0.10.45 to 0.10.48 in /test_runner/pg_clients/rust/tokio-postgres (#3879) 2023-03-25 12:33:39 +00:00
Dmitry Rodionov
870ba43a1f return proper http codes in timeline delete endpoint (#3876)
return proper http codes in timeline delete endpoint
+ fix openapi spec for detach to include 404 responses
2023-03-24 19:25:39 +02:00
Joonas Koivunen
f5ca897292 fix: less logging at shutdown (#3866)
Log less during shutdown; don't log anything for quickly (less than 1s)
exiting tasks.
2023-03-23 12:00:52 +02:00
Kirill Bulatov
8bd565e09e Ensure branches with no layers have their remote storage counterpart created eventually (#3857)
Discovered during writing a test for
https://github.com/neondatabase/neon/pull/3843
2023-03-22 17:42:31 +02:00
Joonas Koivunen
6033dfdf4a Re-access layers before threshold eviction (#3867)
To avoid re-downloading evicted files on restart, re-compute logical
size and partitioning before each threshold based eviction run.

Cc: #3802

Co-authored-by: Christian Schwarz <christian@neon.tech>
2023-03-22 16:26:27 +02:00
mikecaat
14a40c9ca6 Fix minor things for the docker-compose file (#3862)
* Add the REPOSITORY env to build args to avoid the following error when
executing without the credentials for the repository.

```
ERROR: Service 'compute' failed to build: Head
"https://369495373322.dkr.ecr.eu-central-1.amazonaws.com/v2/compute-node-v15/manifests/2221":
no basic auth credentials
```

* update the tag version in the documentation to support storage broker
2023-03-22 08:10:53 +00:00
Shany Pozin
0f7de84785 Allow calling detach on ignored tenant (#3834)
## Describe your changes
Added a query param to detach API
Allow to remove local state of a tenant even if its not in the memory
(following ignore API)
## Issue ticket number and link
#3828
## Checklist before requesting a review
- [x] I have performed a self-review of my code.
- [ ] If it is a core feature, I have added thorough tests.
- [ ] Do we need to implement analytics? if so did you add the relevant
metrics to the dashboard?
- [ ] If this PR requires public announcement, mark it with
/release-notes label and add several sentences in this section.

---------

Co-authored-by: Kirill Bulatov <kirill@neon.tech>
2023-03-22 07:17:00 +00:00
Kirill Bulatov
dd22c87100 Remove older layer metadata format support code (#3854)
The PR enforces current newest `index_part.json` format in the type
system (version `1`), not allowing any previous forms of it, that were
used in the past.
Similarly, the code to mitigate the
https://github.com/neondatabase/neon/issues/3024 issue is now also
removed.

Current code does not produce old formats and extra files in the
index_part.json, in the future we will be able to use
https://github.com/neondatabase/aversion or other approach to make
version transitions more explicit.

See https://neondb.slack.com/archives/C033RQ5SPDH/p1679134185248119 for
the justification on the breaking changes.
2023-03-21 23:33:28 +02:00
Heikki Linnakangas
6fdd9c10d1 Read storage auth token from spec file.
We read the pageserver connection string from the spec file, so let's
read the auth token from the same place.

We've been talking about pre-launching compute nodes that are not
associated with any particular tenant at startup, so that the spec
file is delivered to the compute node later. We cannot change the env
variables after the process has been launched.

We still pass the token to 'postgres' binary in the NEON_AUTH_TOKEN
env variable, but compute_ctl is now responsible for setting it.
2023-03-21 20:12:09 +02:00
Dmitry Rodionov
4158e24e60 rfc: delete pageserver data from s3 (#3792)
[Rendered](https://github.com/neondatabase/neon/blob/main/docs/rfcs/022-pageserver-delete-from-s3.md)

---------

Co-authored-by: Joonas Koivunen <joonas@neon.tech>
2023-03-21 20:03:27 +02:00