Skip to content

Commit

Permalink
TEIID-3209 making ttl and on error action optional
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Dec 9, 2014
1 parent 71b0746 commit 60b2995
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
Expand Up @@ -1488,14 +1488,12 @@ public static int array_length(Object array) throws FunctionExecutionException,

@TeiidFunction(category=FunctionCategoryConstants.SYSTEM, determinism = Determinism.COMMAND_DETERMINISTIC)
public static int mvstatus(CommandContext context, String schemaName, String viewName, Boolean validity, String status, String action) throws BlockedException, FunctionExecutionException {
if (!validity) {
if (!validity && !MaterializationMetadataRepository.ErrorAction.IGNORE.name().equalsIgnoreCase(action)) {
if (MaterializationMetadataRepository.ErrorAction.THROW_EXCEPTION.name().equalsIgnoreCase(action)) {
throw new FunctionExecutionException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31147, schemaName, viewName));
}
if (MaterializationMetadataRepository.ErrorAction.WAIT.name().equalsIgnoreCase(action)){
context.getWorkItem().scheduleWork(30000);
throw BlockedException.INSTANCE;
}
context.getWorkItem().scheduleWork(10000);
throw BlockedException.INSTANCE;
}
return 1;
}
Expand Down
Expand Up @@ -69,10 +69,8 @@ public void loadMetadata(MetadataFactory factory, ExecutionFactory executionFact
String afterScript = table.getProperty(MATVIEW_AFTER_LOAD_SCRIPT, false);
String stageTable = table.getProperty(MATVIEW_STAGE_TABLE, false);
String loadScript = table.getProperty(MATVIEW_LOAD_SCRIPT, false);
String exception = table.getProperty(MATVIEW_ONERROR_ACTION, false);
String ttl = table.getProperty(MATVIEW_TTL, false);

if (statusTable == null || (stageTable == null && loadScript == null) || exception == null || ttl == null ) {
if (statusTable == null || (stageTable == null && loadScript == null)) {
throw new TranslatorException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31154));
}

Expand Down
Expand Up @@ -352,7 +352,7 @@ private void validate(VDBMetaData vdb, ModelMetaData model, AbstractMetadataReco
QueryNode node = QueryResolver.resolveView(symbol, new QueryNode(selectTransformation), SQLConstants.Reserved.SELECT, metadata);
CacheHint cacheHint = node.getCommand().getCacheHint();
Long ttl = -1L;
if (cacheHint != null && cacheHint.getTtl() != null && addCacheHint) {
if (cacheHint != null && cacheHint.getTtl() != null && addCacheHint && t.getProperty(MaterializationMetadataRepository.MATVIEW_TTL, false) == null) {
ttl = cacheHint.getTtl();
t.setProperty(MaterializationMetadataRepository.MATVIEW_TTL, String.valueOf(ttl));
}
Expand Down
2 changes: 1 addition & 1 deletion engine/src/main/resources/org/teiid/query/i18n.properties
Expand Up @@ -1116,7 +1116,7 @@ TEIID31142=Invalid row based security permission filter containing correlated su
TEIID31143=Global table {1} load determinism {0} is less than vdb deterministic.
TEIID31145=Expected array or object type for array_get, but was {0}: {1}
TEIID31146=Translator {2} not found for vdb {0} {1}
TEIID31154=One or more of required properties for materialization management is missing. Required properties are teiid_rel:MATVIEW_STATUS_TABLE, teiid_rel:MATERIALIZED_STAGE_TABLE if teiid_rel:MATVIEW_LOAD_SCRIPT is not provided, teiid_rel:MATVIEW_ONERROR_ACTION and teiid_rel:MATVIEW_TTL or Cache Hint in query.
TEIID31154=One or more of required properties for materialization management is missing. Required properties are teiid_rel:MATVIEW_STATUS_TABLE, teiid_rel:MATERIALIZED_STAGE_TABLE if teiid_rel:MATVIEW_LOAD_SCRIPT is not provided.
TEIID31147=The materialized view {0}.{1} materialization table is currently not in valid state.
TEIID31148=Invalid virtual model {0} specified in conformed sources for {1}.
TEIID31149=No columns are specified on key {1} for table {0}.
Expand Down

0 comments on commit 60b2995

Please sign in to comment.