@@ -161,6 +161,13 @@ impl DirectoryLayer {
161161
162162 node. load_metadata ( & trx) . await ?;
163163
164+ println ! (
165+ "node under path {:?} exists ? {}, layer = {:?}" ,
166+ node. current_path,
167+ node. exists( ) ,
168+ node. layer
169+ ) ;
170+
164171 if !node. exists ( ) || node. layer . eq ( PARTITION_LAYER ) {
165172 return Ok ( node) ;
166173 }
@@ -231,6 +238,7 @@ impl DirectoryLayer {
231238 }
232239
233240 let node = self . find ( trx, path. to_owned ( ) ) . await ?;
241+ println ! ( "node exists? {}" , node. exists( ) ) ;
234242
235243 if node. exists ( ) {
236244 if node. is_in_partition ( false ) {
@@ -240,12 +248,24 @@ impl DirectoryLayer {
240248 None => unreachable ! ( "node's subspace is not set" ) ,
241249 Some ( s) => s,
242250 } ;
243- let dir_space =
244- self . contents_of_node ( subspace_node, node. current_path , node. layer ) ?;
245- dir_space
246- . create_or_open ( trx, sub_path. to_owned ( ) , prefix, layer)
247- . await ?;
248- Ok ( dir_space)
251+ match self . contents_of_node ( subspace_node, node. current_path , node. layer ) ? {
252+ DirectoryOutput :: DirectorySubspace ( _) => unreachable ! ( "already in partition" ) ,
253+ DirectoryOutput :: DirectoryPartition ( directory_partition) => {
254+ let dir_space = directory_partition
255+ . directory_subspace
256+ . directory_layer
257+ . create_or_open_internal (
258+ trx,
259+ sub_path. to_owned ( ) ,
260+ prefix,
261+ layer,
262+ allow_create,
263+ allow_open,
264+ )
265+ . await ?;
266+ Ok ( dir_space)
267+ }
268+ }
249269 } else {
250270 self . open_internal ( layer, & node, allow_open) . await
251271 }
0 commit comments