/// <exception cref="System.IO.IOException"/> protected internal override void StartStorage() { Options options = new Options(); Path dbPath = new Path(GetConfig().Get(YarnConfiguration.TimelineServiceLeveldbStateStorePath ), DbName); FileSystem localFS = null; try { localFS = FileSystem.GetLocal(GetConfig()); if (!localFS.Exists(dbPath)) { if (!localFS.Mkdirs(dbPath)) { throw new IOException("Couldn't create directory for leveldb " + "timeline store " + dbPath); } localFS.SetPermission(dbPath, LeveldbDirUmask); } } finally { IOUtils.Cleanup(Log, localFS); } JniDBFactory factory = new JniDBFactory(); try { options.CreateIfMissing(false); db = factory.Open(new FilePath(dbPath.ToString()), options); Log.Info("Loading the existing database at th path: " + dbPath.ToString()); CheckVersion(); } catch (NativeDB.DBException e) { if (e.IsNotFound() || e.Message.Contains(" does not exist ")) { try { options.CreateIfMissing(true); db = factory.Open(new FilePath(dbPath.ToString()), options); Log.Info("Creating a new database at th path: " + dbPath.ToString()); StoreVersion(CurrentVersionInfo); } catch (DBException ex) { throw new IOException(ex); } } else { throw new IOException(e); } } catch (DBException e) { throw new IOException(e); } }