@@ -2348,6 +2348,22 @@ impl DatadirModification<'_> {
23482348 Ok :: < _ , WalIngestError > ( ( ) )
23492349 }
23502350
2351+ async fn put_rel_creation_v1_placeholder (
2352+ & mut self ,
2353+ rel : RelTag ,
2354+ dbdir_exists : bool ,
2355+ _ctx : & RequestContext ,
2356+ ) -> Result < ( ) , WalIngestError > {
2357+ if !dbdir_exists {
2358+ let rel_dir_key = rel_dir_to_key ( rel. spcnode , rel. dbnode ) ;
2359+ self . put (
2360+ rel_dir_key,
2361+ Value :: Image ( Bytes :: from ( RelDirectory :: ser ( & RelDirectory :: default ( ) ) ?) ) ,
2362+ ) ;
2363+ }
2364+ Ok ( ( ) )
2365+ }
2366+
23512367 async fn put_rel_creation_v1 (
23522368 & mut self ,
23532369 rel : RelTag ,
@@ -2428,7 +2444,7 @@ impl DatadirModification<'_> {
24282444 // tablespace. Create the reldir entry for it if so.
24292445 let mut dbdir: DbDirectory = DbDirectory :: des ( & self . get ( DBDIR_KEY , ctx) . await ?) ?;
24302446 let mut is_dbdir_dirty = false ;
2431-
2447+
24322448 let dbdir_exists =
24332449 if let hash_map:: Entry :: Vacant ( e) = dbdir. dbdirs . entry ( ( rel. spcnode , rel. dbnode ) ) {
24342450 // Didn't exist. Update dbdir
@@ -2473,6 +2489,10 @@ impl DatadirModification<'_> {
24732489
24742490 if v2_mode. current_status != RelSizeMigration :: Migrated {
24752491 self . put_rel_creation_v1 ( rel, dbdir_exists, ctx) . await ?;
2492+ } else {
2493+ // collect_keyspace depends on the rel_dir_to_key to be present, so we need to create a placeholder
2494+ self . put_rel_creation_v1_placeholder ( rel, dbdir_exists, ctx)
2495+ . await ?;
24762496 }
24772497
24782498 if v2_mode. current_status != RelSizeMigration :: Legacy {
0 commit comments