MINOR: Governance Workflows fixes (#18744)

* Add annotation to turn delete_recursive test into the last one to be executed

* Improve Fetching Entities by only fetching the FQN

* Cut back default batchsize to 500
This commit is contained in:
IceS2 2024-11-24 20:30:56 +01:00 committed by GitHub
parent 31c2dee533
commit b3d765dce1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 28 additions and 3 deletions

View File

@ -53,6 +53,7 @@ public class PeriodicBatchEntityTrigger implements TriggerInterface {
StartEvent startEvent = StartEvent startEvent =
new StartEventBuilder().id(getFlowableElementId(triggerWorkflowId, "startEvent")).build(); new StartEventBuilder().id(getFlowableElementId(triggerWorkflowId, "startEvent")).build();
startEvent.setAsynchronousLeave(true);
oTimerDefinition.ifPresent(startEvent::addEventDefinition); oTimerDefinition.ifPresent(startEvent::addEventDefinition);
process.addFlowElement(startEvent); process.addFlowElement(startEvent);

View File

@ -64,7 +64,13 @@ public class FetchEntitiesImpl implements JavaDelegate {
try { try {
return searchRepository.listWithDeepPagination( return searchRepository.listWithDeepPagination(
entityType, null, searchFilter, searchSortFilter, batchSize, searchAfter); entityType,
null,
searchFilter,
new String[] {"fullyQualifiedName"},
searchSortFilter,
batchSize,
searchAfter);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -174,6 +174,7 @@ public interface SearchClient {
String index, String index,
String query, String query,
String filter, String filter,
String[] fields,
SearchSortFilter searchSortFilter, SearchSortFilter searchSortFilter,
int size, int size,
Object[] searchAfter) Object[] searchAfter)

View File

@ -841,13 +841,20 @@ public class SearchRepository {
String entityType, String entityType,
String query, String query,
String filter, String filter,
String[] fields,
SearchSortFilter searchSortFilter, SearchSortFilter searchSortFilter,
int size, int size,
Object[] searchAfter) Object[] searchAfter)
throws IOException { throws IOException {
IndexMapping index = entityIndexMap.get(entityType); IndexMapping index = entityIndexMap.get(entityType);
return searchClient.listWithDeepPagination( return searchClient.listWithDeepPagination(
index.getIndexName(clusterAlias), query, filter, searchSortFilter, size, searchAfter); index.getIndexName(clusterAlias),
query,
filter,
fields,
searchSortFilter,
size,
searchAfter);
} }
public Response searchBySourceUrl(String sourceUrl) throws IOException { public Response searchBySourceUrl(String sourceUrl) throws IOException {

View File

@ -700,6 +700,7 @@ public class ElasticSearchClient implements SearchClient {
String index, String index,
String query, String query,
String filter, String filter,
String[] fields,
SearchSortFilter searchSortFilter, SearchSortFilter searchSortFilter,
int size, int size,
Object[] searchAfter) Object[] searchAfter)
@ -710,6 +711,10 @@ public class ElasticSearchClient implements SearchClient {
if (!nullOrEmpty(query)) { if (!nullOrEmpty(query)) {
searchSourceBuilder = getSearchSourceBuilder(index, query, 0, size); searchSourceBuilder = getSearchSourceBuilder(index, query, 0, size);
} }
if (!nullOrEmpty(fields)) {
searchSourceBuilder.fetchSource(fields, null);
}
if (Optional.ofNullable(filter).isPresent()) { if (Optional.ofNullable(filter).isPresent()) {
getSearchFilter(filter, searchSourceBuilder, !nullOrEmpty(query)); getSearchFilter(filter, searchSourceBuilder, !nullOrEmpty(query));
} }

View File

@ -691,6 +691,7 @@ public class OpenSearchClient implements SearchClient {
String index, String index,
String query, String query,
String filter, String filter,
String[] fields,
SearchSortFilter searchSortFilter, SearchSortFilter searchSortFilter,
int size, int size,
Object[] searchAfter) Object[] searchAfter)
@ -699,6 +700,9 @@ public class OpenSearchClient implements SearchClient {
if (!nullOrEmpty(query)) { if (!nullOrEmpty(query)) {
searchSourceBuilder = getSearchSourceBuilder(index, query, 0, size); searchSourceBuilder = getSearchSourceBuilder(index, query, 0, size);
} }
if (!nullOrEmpty(fields)) {
searchSourceBuilder.fetchSource(fields, null);
}
List<Map<String, Object>> results = new ArrayList<>(); List<Map<String, Object>> results = new ArrayList<>();

View File

@ -731,6 +731,7 @@ public class GlossaryTermResourceTest extends EntityResourceTest<GlossaryTerm, C
} }
@Test @Test
@Order(Integer.MAX_VALUE)
void delete_recursive(TestInfo test) throws IOException { void delete_recursive(TestInfo test) throws IOException {
Glossary g1 = createGlossary(test, null, emptyList()); Glossary g1 = createGlossary(test, null, emptyList());

View File

@ -25,7 +25,7 @@
"batchSize": { "batchSize": {
"description": "Number of Entities to process at once.", "description": "Number of Entities to process at once.",
"type": "integer", "type": "integer",
"default": 1000 "default": 500
} }
}, },
"required": ["schedule", "entityType", "filters"], "required": ["schedule", "entityType", "filters"],