public class OptimisedBootstrapUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ABORT_TXNS_FILE
abort Txns file which contains all the txns that needs to be aborted on new source cluster(initial target)
|
static String |
BOOTSTRAP_TABLES_LIST |
static String |
EVENT_ACK_FILE
event ack file which contains the event id till which the cluster was last loaded.
|
static String |
FILE_ENTRY_SEPARATOR
Separator used to separate entries in the listing.
|
static String |
TABLE_DIFF_COMPLETE_DIRECTORY
table diff directory when complete
|
static String |
TABLE_DIFF_INPROGRESS_DIRECTORY
table diff directory when in progress
|
| Constructor and Description |
|---|
OptimisedBootstrapUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkFileExists(org.apache.hadoop.fs.Path dumpPath,
HiveConf conf,
String fileName) |
static Long |
createAndGetEventAckFile(org.apache.hadoop.fs.Path currentDumpPath,
DumpMetaData dmd,
org.apache.hadoop.fs.Path cmRoot,
String dbEventId,
String targetDbEventId,
HiveConf conf,
ReplDumpWork work)
Creates the event ack file and sets the dump metadata post that marking completion of dump flow for first round
of optimised failover dump.
|
static void |
createBootstrapTableList(org.apache.hadoop.fs.Path newDumpPath,
Set<String> tablesForBootstrap,
HiveConf conf)
Creates the bootstrap table list for the second load of optimised bootstrap to consume.
|
static String[] |
getBootstrapTableList(org.apache.hadoop.fs.Path dumpPath,
HiveConf conf)
Gets the list of tables for the second load of optimised bootstrap from the BOOTSTRAP_TABLE_LIST in the dump
directory.
|
static String[] |
getEventIdFromFile(org.apache.hadoop.fs.Path dumpPath,
HiveConf conf)
Gets the source & target event id from the event ack file
|
static List<org.apache.hadoop.hive.metastore.api.NotificationEvent> |
getListOfNotificationEvents(Long eventId,
Hive hiveDb,
ReplLoadWork work)
Returns list of notificationEvents starting from eventId that are related to the database.
|
static HashSet<String> |
getPathsFromTableFile(String file,
org.apache.hadoop.fs.Path dumpPath,
HiveConf conf)
Extracts the recursive listing from the table file.
|
static String |
getReplEventIdFromDatabase(String dbName,
Hive hiveDb)
Gets the event id stored in database denoting the last loaded event id.
|
static HashSet<String> |
getTablesFromTableDiffFile(org.apache.hadoop.fs.Path dumpPath,
HiveConf conf)
Gets the name of tables in the table diff file.
|
static String |
getTargetEventId(String dbName,
Hive hiveDb)
Fetches the notification id from the database with respect to target database.
|
static List<Long> |
getTxnIdFromAbortTxnsFile(org.apache.hadoop.fs.Path dumpPath,
HiveConf conf) |
static boolean |
isDbTargetOfFailover(String dbName,
Hive hive)
Gets & checks whether the database is target of replication.
|
static void |
isFirstIncrementalPending(String dbName,
Hive hiveDb)
Validates if the first incremental is done before starting optimised bootstrap
|
static void |
prepareAbortTxnsFile(List<org.apache.hadoop.hive.metastore.api.NotificationEvent> notificationEvents,
Set<Long> allOpenTxns,
org.apache.hadoop.fs.Path dumpPath,
HiveConf conf) |
static void |
prepareTableDiffFile(List<org.apache.hadoop.hive.metastore.api.NotificationEvent> notificationEvents,
Hive hiveDb,
ReplLoadWork work,
HiveConf conf)
Prepares the table diff file, with tables modified post the specified event id.
|
public static final String FILE_ENTRY_SEPARATOR
public static final String TABLE_DIFF_INPROGRESS_DIRECTORY
public static final String TABLE_DIFF_COMPLETE_DIRECTORY
public static final String ABORT_TXNS_FILE
public static final String EVENT_ACK_FILE
public static final String BOOTSTRAP_TABLES_LIST
public static boolean isDbTargetOfFailover(String dbName, Hive hive) throws HiveException
dbName - name of databasehive - hive objectHiveExceptionpublic static boolean checkFileExists(org.apache.hadoop.fs.Path dumpPath,
HiveConf conf,
String fileName)
throws IOException
IOExceptionpublic static void prepareAbortTxnsFile(List<org.apache.hadoop.hive.metastore.api.NotificationEvent> notificationEvents, Set<Long> allOpenTxns, org.apache.hadoop.fs.Path dumpPath, HiveConf conf) throws SemanticException
SemanticExceptionpublic static List<Long> getTxnIdFromAbortTxnsFile(org.apache.hadoop.fs.Path dumpPath, HiveConf conf) throws IOException
IOExceptionpublic static String[] getEventIdFromFile(org.apache.hadoop.fs.Path dumpPath, HiveConf conf) throws IOException
dumpPath - the dump pathconf - the hive configurationIOExceptionpublic static HashSet<String> getTablesFromTableDiffFile(org.apache.hadoop.fs.Path dumpPath, HiveConf conf) throws Exception
dumpPath - the dump pathconf - the hive configurationExceptionpublic static HashSet<String> getPathsFromTableFile(String file, org.apache.hadoop.fs.Path dumpPath, HiveConf conf) throws IOException
file - the name of tabledumpPath - the dump pathconf - the hive confIOExceptionpublic static String getReplEventIdFromDatabase(String dbName, Hive hiveDb) throws HiveException
dbName - the name of databasehiveDb - the hive objectHiveExceptionpublic static void isFirstIncrementalPending(String dbName, Hive hiveDb) throws HiveException
dbName - name of databasehiveDb - the hive objectHiveExceptionpublic static Long createAndGetEventAckFile(org.apache.hadoop.fs.Path currentDumpPath, DumpMetaData dmd, org.apache.hadoop.fs.Path cmRoot, String dbEventId, String targetDbEventId, HiveConf conf, ReplDumpWork work) throws Exception
currentDumpPath - the dump pathdmd - the dump metadatacmRoot - the cmRootdbEventId - the database event id to which we have to write in the file.targetDbEventId - the database event id with respect to target cluster.conf - the hive configurationwork - the repldump workSemanticExceptionExceptionpublic static List<org.apache.hadoop.hive.metastore.api.NotificationEvent> getListOfNotificationEvents(Long eventId, Hive hiveDb, ReplLoadWork work) throws Exception
eventId - Starting eventIdhiveDb - the hive objectwork - the load workExceptionpublic static void prepareTableDiffFile(List<org.apache.hadoop.hive.metastore.api.NotificationEvent> notificationEvents, Hive hiveDb, ReplLoadWork work, HiveConf conf) throws Exception
notificationEvents - Events that can possibly contain table DDL/DML metadata.hiveDb - the hive objectwork - the load workconf - hive configurationExceptionpublic static String getTargetEventId(String dbName, Hive hiveDb) throws Exception
dbName - name of databasehiveDb - the hive objectExceptionpublic static void createBootstrapTableList(org.apache.hadoop.fs.Path newDumpPath,
Set<String> tablesForBootstrap,
HiveConf conf)
throws SemanticException
newDumpPath - the dump pathtablesForBootstrap - the list of tables.conf - the hive configurationSemanticException - in case of any exceptionpublic static String[] getBootstrapTableList(org.apache.hadoop.fs.Path dumpPath, HiveConf conf) throws IOException
dumpPath - the dump pathconf - the hive configurationIOException - in case of any exception.Copyright © 2024 The Apache Software Foundation. All rights reserved.