code: void writeMetadata(Config config) throws IOException {
  
      Path storeMetadataFileBkpPath =
          new Path(this.storeMetadataFilePath.getParent(), this.storeMetadataFilePath.getName() + ".bkp");
  
      // Delete old backup file if exists
      HadoopUtils.deleteIfExists(this.fs, storeMetadataFileBkpPath, true);
  
      // Move current storeMetadataFile to backup
      if (this.fs.exists(this.storeMetadataFilePath)) {
        HadoopUtils.renamePath(this.fs, this.storeMetadataFilePath, storeMetadataFileBkpPath);
      }
  
      // Write new storeMetadataFile
      try (FSDataOutputStream outputStream =
          FileSystem.create(this.fs, this.storeMetadataFilePath, FsDeploymentConfig.DEFAULT_STORE_PERMISSIONS);) {
        outputStream.write(config.root().render(ConfigRenderOptions.concise()).getBytes(Charsets.UTF_8));
      } catch (Exception e) {
        // Restore from backup
        HadoopUtils.deleteIfExists(this.fs, this.storeMetadataFilePath, true);
        HadoopUtils.renamePath(this.fs, storeMetadataFileBkpPath, this.storeMetadataFilePath);
        throw new IOException(
            String.format("Failed to write store metadata at %s. Restored existing store metadata file from backup",
                this.storeMetadataFilePath),
            e);
      }
    }
docs: Writes the <code>config</code> to {@link #storeMetadataFilePath}. Creates a backup file at
  <code>storeMetadataFilePath + ".bkp"</code> to recover old metadata in case of unexpected deployment failures
  
  @param config to be serialized
  @throws IOException if there was any problem writing the <code>config</code> to the store metadata file.