private long sanityCheckAndConvertSemanticLongVersion(String version) {
    long majorVersion;
    long minorVersion;
    long patchVersion;
    long revisionVersion;
    try {
      String[] versionArray = version.split("[.]", 4);
      revisionVersion = Long.parseLong(versionArray[3]);
      patchVersion = Long.parseLong(versionArray[2]);
      minorVersion = Long.parseLong(versionArray[1]);
      majorVersion = Long.parseLong(versionArray[0]);
      if (revisionVersion < 0 || patchVersion < 0 || minorVersion < 0 || majorVersion < 0) {
        throw new IllegalArgumentException(
            "The major, minor, patch, or revision version is less than 0, major version: " + majorVersion + " minor version: "
                + minorVersion + " patch version: " + patchVersion + " revision version: " + revisionVersion);
      }
      if (revisionVersion > 999 || patchVersion > 999 || minorVersion > 999) {
        throw new IllegalArgumentException(
            "The minor, patch, or revision version exceeded max allowed number: 999, minor version: " + minorVersion
                + " patch version: " + patchVersion + " revision version: " + revisionVersion);
      }
      //We set the max major version same as revision/patch/minor version based on current use cases.
      if (majorVersion > mySqlAccountServiceConfig.maxMajorVersionForSemanticSchemaDataset) {
        throw new IllegalArgumentException("The major version exceeded max allowed number: "
            + mySqlAccountServiceConfig.maxMajorVersionForSemanticSchemaDataset + " major version: " + majorVersion);
      }
    } catch (Exception e) {
      throw new IllegalArgumentException(
          "Version does not match the semantic version format MAJOR.MINOR.PATCH, version: " + version);
    }
    return majorVersion * 1000000000 + minorVersion * 1000000 + patchVersion * 1000 + revisionVersion;
  }
Sanity check for semantic long version.
@param version The version from request.
@return the converted version which will be stored in DatasetVersions DB.
ambry-account/src/main/java/com/github/ambry/account/mysql/DatasetDao.java