public static LocalCacheManager create(CacheManagerOptions options,
                                         PageMetaStore pageMetaStore)
      throws IOException {
    LocalCacheManager manager = new LocalCacheManager(options, pageMetaStore);
    List<PageStoreDir> pageStoreDirs = pageMetaStore.getStoreDirs();
    if (manager.mInitService.isPresent()) {
      manager.mInitService.get().submit(() -> {
        try {
          manager.restoreOrInit(pageStoreDirs);
        } catch (IOException e) {
          LOG.error("Failed to restore LocalCacheManager", e);
        }
      });
    } else {
      manager.restoreOrInit(pageStoreDirs);
    }
    return manager;
  }
@Test
  public void createUnwritableRootDirSyncRestore() throws Exception {
    File root = mTemp.newFolder();
    mConf.set(PropertyKey.USER_CLIENT_CACHE_ASYNC_RESTORE_ENABLED, false);
    mConf.set(PropertyKey.USER_CLIENT_CACHE_DIRS, root.getAbsolutePath());
    mCacheManagerOptions = CacheManagerOptions.create(mConf);
    Assume.assumeTrue(root.setWritable(false));
    try {
      mPageMetaStore =
          new DefaultPageMetaStore(PageStoreDir.createPageStoreDirs(mCacheManagerOptions));
      LocalCacheManager.create(mCacheManagerOptions, mPageMetaStore);
      fail();
    } catch (Exception e) {
      // expected
    } finally {
      root.setWritable(true);
    }
  }