Skip to content

Commit 5328121

Browse files
authored
Merge pull request #5103 from gchq/gh-5101-folder-reprocess-selection
PR for #5101 - Reprocessing of Errors from Folder level sometimes isn't filtering correctly
2 parents 4f244b5 + fb1ca6d commit 5328121

File tree

2 files changed

+105
-32
lines changed

2 files changed

+105
-32
lines changed

stroom-meta/stroom-meta-impl-db/src/main/java/stroom/meta/impl/db/MetaDaoImpl.java

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,38 +1661,51 @@ private SelectionSummary getReprocessSelectionSummary(final Collection<Condition
16611661
final int offset,
16621662
final int numberOfRows,
16631663
final Set<Integer> usedValKeys) {
1664-
return JooqUtil.contextResult(metaDbConnProvider, context ->
1665-
metaExpressionMapper.addJoins(context
1666-
.select(
1667-
DSL.countDistinct(parent.ID),
1668-
DSL.countDistinct(parent.FEED_ID),
1669-
DSL.groupConcatDistinct(parentFeed.NAME)
1670-
.separator(GROUP_CONCAT_DELIMITER),
1671-
DSL.countDistinct(parent.TYPE_ID),
1672-
DSL.groupConcatDistinct(parentType.NAME)
1673-
.separator(GROUP_CONCAT_DELIMITER),
1674-
DSL.countDistinct(meta.PROCESSOR_ID),
1675-
DSL.countDistinct(metaProcessor.PIPELINE_UUID),
1676-
DSL.countDistinct(parent.STATUS),
1677-
DSL.groupConcatDistinct(parent.STATUS)
1678-
.separator(GROUP_CONCAT_DELIMITER),
1679-
DSL.min(parent.CREATE_TIME),
1680-
DSL.max(parent.CREATE_TIME)
1681-
)
1682-
.from(meta)
1683-
.straightJoin(metaFeed).on(meta.FEED_ID.eq(metaFeed.ID))
1684-
.straightJoin(metaType).on(meta.TYPE_ID.eq(metaType.ID))
1685-
.leftOuterJoin(metaProcessor).on(meta.PROCESSOR_ID.eq(metaProcessor.ID))
1686-
.leftOuterJoin(parent).on(meta.PARENT_ID.eq(parent.ID))
1687-
.straightJoin(parentFeed).on(parent.FEED_ID.eq(parentFeed.ID))
1688-
.straightJoin(parentType).on(parent.TYPE_ID.eq(parentType.ID)),
1689-
meta.ID,
1690-
usedValKeys)
1691-
.where(conditions)
1692-
.and(parent.ID.isNotNull())
1693-
.and(parent.STATUS.eq(MetaStatusId.getPrimitiveValue(Status.UNLOCKED)))
1694-
.limit(offset, numberOfRows)
1695-
.fetchOptional())
1664+
// CheckStyle is a bit fussy about this block
1665+
return JooqUtil.contextResult(
1666+
metaDbConnProvider,
1667+
context -> {
1668+
final var baseQuery = context.select(
1669+
DSL.countDistinct(parent.ID),
1670+
DSL.countDistinct(parent.FEED_ID),
1671+
DSL.groupConcatDistinct(parentFeed.NAME)
1672+
.separator(GROUP_CONCAT_DELIMITER),
1673+
DSL.countDistinct(parent.TYPE_ID),
1674+
DSL.groupConcatDistinct(parentType.NAME)
1675+
.separator(GROUP_CONCAT_DELIMITER),
1676+
DSL.countDistinct(meta.PROCESSOR_ID),
1677+
DSL.countDistinct(metaProcessor.PIPELINE_UUID),
1678+
DSL.countDistinct(parent.STATUS),
1679+
DSL.groupConcatDistinct(parent.STATUS)
1680+
.separator(GROUP_CONCAT_DELIMITER),
1681+
DSL.min(parent.CREATE_TIME),
1682+
DSL.max(parent.CREATE_TIME)
1683+
)
1684+
.from(meta)
1685+
.straightJoin(metaFeed).on(meta.FEED_ID.eq(metaFeed.ID))
1686+
.straightJoin(metaType).on(meta.TYPE_ID.eq(metaType.ID))
1687+
.leftOuterJoin(metaProcessor).on(meta.PROCESSOR_ID.eq(metaProcessor.ID))
1688+
.leftOuterJoin(parent).on(meta.PARENT_ID.eq(parent.ID))
1689+
.straightJoin(parentFeed).on(parent.FEED_ID.eq(parentFeed.ID))
1690+
.straightJoin(parentType).on(parent.TYPE_ID.eq(parentType.ID));
1691+
1692+
// Status predicates need to be consistent with those in
1693+
// stroom.processor.impl.ProcessorTaskCreatorImpl.runSelectMetaQuery
1694+
// The default status=Unlocked term gets removed by the UI prior to
1695+
// getting here.
1696+
final var sql = metaExpressionMapper.addJoins(
1697+
baseQuery,
1698+
meta.ID,
1699+
usedValKeys)
1700+
.where(conditions)
1701+
.and(parent.ID.isNotNull())
1702+
.and(parent.STATUS.notEqual(MetaStatusId.getPrimitiveValue(Status.DELETED)))
1703+
.and(meta.STATUS.notEqual(MetaStatusId.getPrimitiveValue(Status.DELETED)))
1704+
.limit(offset, numberOfRows);
1705+
1706+
LOGGER.debug("getReprocessSelectionSummary() - sql:\n{}", sql);
1707+
return sql.fetchOptional();
1708+
})
16961709
.map(record -> {
16971710
final Set<String> distinctFeeds = splitGroupConcat(record.get(2, String.class));
16981711
final Set<String> distinctTypes = splitGroupConcat(record.get(4, String.class));
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
* Issue **#5101** : Fix select-all filtering when doing a reprocess of everything in a folder. It no longer tries to re-process deleted items streams.
2+
3+
4+
```sh
5+
# ********************************************************************************
6+
# Issue title: Reprocessing of Errors from Folder level sometimes isn't filtering correctly
7+
# Issue link: https://github.com/gchq/stroom/issues/5101
8+
# ********************************************************************************
9+
10+
# ONLY the top line will be included as a change entry in the CHANGELOG.
11+
# The entry should be in GitHub flavour markdown and should be written on a SINGLE
12+
# line with no hard breaks. You can have multiple change files for a single GitHub issue.
13+
# The entry should be written in the imperative mood, i.e. 'Fix nasty bug' rather than
14+
# 'Fixed nasty bug'.
15+
#
16+
# Examples of acceptable entries are:
17+
#
18+
#
19+
# * Issue **123** : Fix bug with an associated GitHub issue in this repository
20+
#
21+
# * Issue **namespace/other-repo#456** : Fix bug with an associated GitHub issue in another repository
22+
#
23+
# * Fix bug with no associated GitHub issue.
24+
25+
26+
# --------------------------------------------------------------------------------
27+
# The following is random text to make this file unique for git's change detection
28+
# EMPXWUDZpt5Ms2kIXxwbkZ7V2neugzyrHQTmBhItSYqPbk0RHr6GXjo5hraai6zmMa4eL7P7jYJLrpUY
29+
# pcPFzlq6LYSlIrTqugr7SomG8bQmaKv571D9boQsKnFUhmRh2yP6Oa6qCmiDD5brPlq9vRzUX43z1XCN
30+
# VXbzS5n52D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reOgfencqSinVIshkdOTpt6xNDvollM
56+
# 97u2wKLIKZI7Jva3mOpfQ4iYkHxy2G1cXeq0kENugw4dRAKlCpt8qxurCi09eghqJ2HosMLUOHSBN8wD
57+
# dJZWY6HD8pMuPRhFkd1cj6MU1WwWVD7zPg38x65EKoisLS540zCBK6QVjVc6L1JRULPXoHnC5isKFkoS
58+
# --------------------------------------------------------------------------------
59+
60+
```

0 commit comments

Comments
 (0)