Skip to content

Commit

Permalink
0003866: Support for oracle select hints to run parallel processes
Browse files Browse the repository at this point in the history
during initial load extraction
  • Loading branch information
jumpmind-josh committed Jan 29, 2019
1 parent ae60f82 commit 4456268
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
Expand Up @@ -254,7 +254,7 @@ public OracleTriggerTemplate(ISymmetricDialect symmetricDialect) {
"end;\n");

sqlTemplates.put("initialLoadSqlTemplate" ,
"select $(oracleToClob)$(columns) from $(schemaName)$(tableName) t where $(whereClause)");
"select $(oracleQueryHint) $(oracleToClob)$(columns) from $(schemaName)$(tableName) t where $(whereClause)");
}

protected String getCreateTimeExpression(ISymmetricDialect symmetricDialect) {
Expand Down
Expand Up @@ -237,6 +237,7 @@ private ParameterConstants() {
public final static String DBDIALECT_ORACLE_BULK_LOAD_SQLLDR_CMD = "oracle.bulk.load.sqlldr.cmd";
public final static String DBDIALECT_ORACLE_BULK_LOAD_SQLLDR_OPTIONS = "oracle.bulk.load.sqlldr.options";
public final static String DBDIALECT_ORACLE_BULK_LOAD_EZCONNECT = "oracle.bulk.load.ezconnect";
public final static String DBDIALECT_ORACLE_LOAD_QUERY_HINT_PARALLEL_COUNT = "oracle.load.query.hint.parallel.count";

public final static String DBDIALECT_TIBERO_USE_TRANSACTION_VIEW = "tibero.use.transaction.view";
public final static String DBDIALECT_TIBERO_TEMPLATE_NUMBER_SPEC = "tibero.template.precision";
Expand Down
Expand Up @@ -257,7 +257,8 @@ public String createInitalLoadSql(Node node, TriggerRouter triggerRouter, Table
sql = FormatUtils.replace("prefixName", symmetricDialect.getTablePrefix(), sql);
sql = FormatUtils.replace("oracleToClob",
triggerRouter.getTrigger().isUseCaptureLobs() ? toClobExpression(table) : "", sql);

sql = replaceOracleQueryHint(sql);

return sql;
}

Expand Down Expand Up @@ -357,7 +358,8 @@ public String createCsvDataSql(Trigger trigger, TriggerHistory triggerHistory, T
sql = FormatUtils.replace("columns", columnsText, sql);
sql = FormatUtils.replace("oracleToClob",
trigger.isUseCaptureLobs() ? toClobExpression(table) : "", sql);

sql = replaceOracleQueryHint(sql);

sql = FormatUtils.replace("tableName", SymmetricUtils.quote(symmetricDialect, table.getName()), sql);
sql = FormatUtils.replace("schemaName",
triggerHistory == null ? getSourceTablePrefix(originalTable)
Expand All @@ -370,6 +372,8 @@ public String createCsvDataSql(Trigger trigger, TriggerHistory triggerHistory, T
table.hasPrimaryKey() ? table.getPrimaryKeyColumns() : table.getColumns()),
sql);

sql = replaceOracleQueryHint(sql);

sql = replaceDefaultSchemaAndCatalog(sql);

return sql;
Expand All @@ -386,6 +390,8 @@ public String createCsvPrimaryKeySql(Trigger trigger, TriggerHistory triggerHist
sql = FormatUtils.replace("columns", columnsText, sql);
sql = FormatUtils.replace("oracleToClob",
trigger.isUseCaptureLobs() ? toClobExpression(table) : "", sql);
sql = replaceOracleQueryHint(sql);

sql = FormatUtils.replace("tableName", SymmetricUtils.quote(symmetricDialect, table.getName()), sql);
sql = FormatUtils.replace("schemaName",
triggerHistory == null ? getSourceTablePrefix(table)
Expand Down Expand Up @@ -1197,4 +1203,11 @@ public int toHashedValue() {
}
return hashedValue;
}

public String replaceOracleQueryHint(String sql) {
return FormatUtils.replace("oracleQueryHint",
this.symmetricDialect.getParameterService().getInt(ParameterConstants.DBDIALECT_ORACLE_LOAD_QUERY_HINT_PARALLEL_COUNT) > 1 ?
"/*+ parallel(" + this.symmetricDialect.getParameterService()
.getString(ParameterConstants.DBDIALECT_ORACLE_LOAD_QUERY_HINT_PARALLEL_COUNT) + ") */": "", sql);
}
}
Expand Up @@ -1627,6 +1627,12 @@ oracle.bulk.load.sqlldr.options=silent=(header,discards) direct=false readsize=4
# DatabaseOverridable: false
oracle.bulk.load.ezconnect=

# For initial load extracting data to specify the number of parallel processes to use while selecting data from a table
#
# Tags: other
# DatabaseOverridable: true
oracle.load.query.hint.parallel.count=1

# Path to the tbloader executable for running Tibero tbLoader.
# If blank, it will check for TB_HOME environment variable and find tbLoader there.
# Otherwise, it will run "tbloader" and expect the operating system to find it.
Expand Down

0 comments on commit 4456268

Please sign in to comment.