Example #1
0
		internal virtual Version LoadVersion()
		{
			byte[] data = stateDb.Get(JniDBFactory.Bytes(StateDbSchemaVersionKey));
			// if version is not stored previously, treat it as CURRENT_VERSION_INFO.
			if (data == null || data.Length == 0)
			{
				return GetCurrentVersion();
			}
			Version version = new VersionPBImpl(YarnServerCommonProtos.VersionProto.ParseFrom
				(data));
			return version;
		}
Example #2
0
		/// <exception cref="System.IO.IOException"/>
		internal virtual Version LoadVersion()
		{
			byte[] data = db.Get(JniDBFactory.Bytes(DbSchemaVersionKey));
			// if version is not stored previously, treat it as 1.0.
			if (data == null || data.Length == 0)
			{
				return Version.NewInstance(1, 0);
			}
			Version version = new VersionPBImpl(YarnServerCommonProtos.VersionProto.ParseFrom
				(data));
			return version;
		}
Example #3
0
 /// <exception cref="System.Exception"/>
 protected internal override Version LoadVersion()
 {
     lock (this)
     {
         Path       versionNodePath = GetNodePath(rootDirPath, VersionNode);
         FileStatus status          = GetFileStatusWithRetries(versionNodePath);
         if (status != null)
         {
             byte[]  data    = ReadFileWithRetries(versionNodePath, status.GetLen());
             Version version = new VersionPBImpl(YarnServerCommonProtos.VersionProto.ParseFrom
                                                     (data));
             return(version);
         }
         return(null);
     }
 }
        /// <exception cref="System.Exception"/>
        protected internal override Version LoadVersion()
        {
            Version version = null;

            try
            {
                byte[] data = db.Get(JniDBFactory.Bytes(VersionNode));
                if (data != null)
                {
                    version = new VersionPBImpl(YarnServerCommonProtos.VersionProto.ParseFrom(data));
                }
            }
            catch (DBException e)
            {
                throw new IOException(e);
            }
            return(version);
        }
 internal virtual Version LoadVersion()
 {
     try
     {
         byte[] data = db.Get(TimelineStateStoreVersionKey);
         // if version is not stored previously, treat it as CURRENT_VERSION_INFO.
         if (data == null || data.Length == 0)
         {
             return(GetCurrentVersion());
         }
         Version version = new VersionPBImpl(YarnServerCommonProtos.VersionProto.ParseFrom
                                                 (data));
         return(version);
     }
     catch (DBException e)
     {
         throw new IOException(e);
     }
 }