mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-26 01:20:38 +00:00
Hold list of all layers in memory.
Previously, the LayerMap was only used as a cache to hold the snapshot layers that were loaded into memory. As a result, we often had to scan the filesystem to get list of all the other snapshot files that exist on disk, but hadn't been loaded into memory yet. That was very slow, consuming huge amounts of CPU and causing timeouts in any non-trivial tests. Refactor so that on startup, we scan the directory once and keep the list of layers in memory.
This commit is contained in:
@@ -32,6 +32,11 @@ def test_snapfiles_gc(zenith_cli, pageserver, postgres, pg_bin):
|
||||
# Create a test table
|
||||
cur.execute("CREATE TABLE foo(x integer)")
|
||||
|
||||
print("Inserting two more rows and running GC")
|
||||
cur.execute("select relfilenode from pg_class where oid = 'foo'::regclass");
|
||||
row = cur.fetchone();
|
||||
print("relfilenode is {}", row[0]);
|
||||
|
||||
# Run GC, to clear out any garbage left behind in the catalogs by
|
||||
# the CREATE TABLE command. We want to have a clean slate with no garbage
|
||||
# before running the actual tests below, otherwise the counts won't match
|
||||
|
||||
Reference in New Issue
Block a user