mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
2ea6c866da
Summary: Once a mount point has been unmounted we no longer need to care about outstanding FUSE reference counts--we can treat them as if they are all zero. This updates EdenMount to tell the InodeMap when the mount point is unloaded, and changes InodeMap::unloadInode() to make use of this information when deciding if it needs to remember the inode information. Previously InodeMap would save information for inodes with outstanding FUSE reference counts. Writing all of this state to the overlay could take a non-trivial amount of time. Reviewed By: chadaustin Differential Revision: D7555998 fbshipit-source-id: 0896f867ce850ab3e61c262776d536de003685ff
61 lines
2.2 KiB
Python
61 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
#
|
|
# Copyright (c) 2016-present, Facebook, Inc.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the BSD-style license found in the
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
import os
|
|
import unittest
|
|
from typing import Dict
|
|
|
|
from .lib import testcase
|
|
|
|
|
|
@testcase.eden_repo_test
|
|
class PersistenceTest(testcase.EdenRepoTest):
|
|
def populate_repo(self) -> None:
|
|
self.repo.write_file('file_in_root', 'contents1')
|
|
self.repo.write_file('subdir/file_in_subdir', 'contents2')
|
|
self.repo.write_file('subdir2/file_in_subdir2', 'contents3')
|
|
self.repo.commit('Initial commit.')
|
|
|
|
# These tests restart Eden and expect data to have persisted.
|
|
def select_storage_engine(self) -> str:
|
|
return 'sqlite'
|
|
|
|
def edenfs_logging_settings(self) -> Dict[str, str]:
|
|
return {'eden.strace': 'DBG7', 'eden.fs.fuse': 'DBG7'}
|
|
|
|
@unittest.skip('TODO: this is not fully implemented yet')
|
|
def test_preserves_nonmaterialized_inode_numbers(self) -> None:
|
|
inode_paths = [
|
|
'file_in_root',
|
|
'subdir', # we care about trees too
|
|
'subdir/file_in_subdir',
|
|
]
|
|
|
|
old_stats = [
|
|
os.lstat(os.path.join(self.mount, path))
|
|
for path in inode_paths]
|
|
|
|
self.eden.shutdown()
|
|
self.eden.start()
|
|
|
|
new_stats = [
|
|
os.lstat(os.path.join(self.mount, path))
|
|
for path in inode_paths]
|
|
|
|
for (path, old_stat,
|
|
new_stat) in zip(inode_paths, old_stats, new_stats):
|
|
self.assertEqual(old_stat.st_ino, new_stat.st_ino,
|
|
f"inode numbers must line up for path {path}")
|
|
self.assertEqual(old_stat.st_atime, new_stat.st_atime,
|
|
f"atime must line up for path {path}")
|
|
self.assertEqual(old_stat.st_mtime, new_stat.st_mtime,
|
|
f"mtime must line up for path {path}")
|
|
self.assertEqual(old_stat.st_ctime, new_stat.st_ctime,
|
|
f"ctime must line up for path {path}")
|