public static long getLastReplicationId(HCatDatabase db){
    Map<String, String> props = db.getProperties();
    if (props != null){
      if (props.containsKey(REPL_STATE_ID)){
        return Long.parseLong(props.get(REPL_STATE_ID));
      }
    }
    return 0l; // default is to return earliest possible state.
  }
Gets the last known replication state of this db. This is
applicable only if it is the destination of a replication
and has had data replicated into it via imports previously.
Defaults to 0.
hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/repl/ReplicationUtils.java