Search in sources :

Example 1 with DBSerializer

use of org.apache.hadoop.hive.ql.parse.repl.dump.io.DBSerializer in project hive by apache.

the class EximUtil method createDbExportDump.

public static void createDbExportDump(FileSystem fs, Path metadataPath, Database dbObj, ReplicationSpec replicationSpec) throws IOException, SemanticException {
    // WARNING NOTE : at this point, createDbExportDump lives only in a world where ReplicationSpec is in replication scope
    // If we later make this work for non-repl cases, analysis of this logic might become necessary. Also, this is using
    // Replv2 semantics, i.e. with listFiles laziness (no copy at export time)
    // Remove all the entries from the parameters which are added for bootstrap dump progress
    Map<String, String> parameters = dbObj.getParameters();
    if (parameters != null) {
        Map<String, String> tmpParameters = new HashMap<>(parameters);
        tmpParameters.entrySet().removeIf(e -> e.getKey().startsWith(Utils.BOOTSTRAP_DUMP_STATE_KEY_PREFIX));
        dbObj.setParameters(tmpParameters);
    }
    try (JsonWriter jsonWriter = new JsonWriter(fs, metadataPath)) {
        new DBSerializer(dbObj).writeTo(jsonWriter, replicationSpec);
    }
    if (parameters != null) {
        dbObj.setParameters(parameters);
    }
}
Also used : DBSerializer(org.apache.hadoop.hive.ql.parse.repl.dump.io.DBSerializer) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) JsonWriter(org.apache.hadoop.hive.ql.parse.repl.dump.io.JsonWriter)

Aggregations

HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 DBSerializer (org.apache.hadoop.hive.ql.parse.repl.dump.io.DBSerializer)1 JsonWriter (org.apache.hadoop.hive.ql.parse.repl.dump.io.JsonWriter)1