-
-
Notifications
You must be signed in to change notification settings - Fork 605
XWIKI-23420: Notifications that aren't pre-filtered in time aren't sent by schedulers #4782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
surli
wants to merge
1
commit into
master
Choose a base branch
from
XWIKI-23420
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+171
−4
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
...a/org/xwiki/eventstream/store/solr/internal/migration/SolrDocumentMigration171000000.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| /* | ||
| * See the NOTICE file distributed with this work for additional | ||
| * information regarding copyright ownership. | ||
| * | ||
| * This is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation; either version 2.1 of | ||
| * the License, or (at your option) any later version. | ||
| * | ||
| * This software is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this software; if not, write to the Free | ||
| * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
| */ | ||
| package org.xwiki.eventstream.store.solr.internal.migration; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Date; | ||
|
|
||
| import javax.inject.Inject; | ||
|
|
||
| import org.apache.solr.client.solrj.SolrQuery; | ||
| import org.apache.solr.client.solrj.SolrServerException; | ||
| import org.apache.solr.client.solrj.response.QueryResponse; | ||
| import org.apache.solr.common.SolrDocument; | ||
| import org.apache.solr.common.SolrDocumentList; | ||
| import org.apache.solr.common.SolrInputDocument; | ||
| import org.slf4j.Logger; | ||
| import org.xwiki.component.annotation.Component; | ||
| import org.xwiki.eventstream.Event; | ||
| import org.xwiki.search.solr.SolrException; | ||
| import org.xwiki.search.solr.SolrUtils; | ||
| import org.xwiki.search.solr.XWikiSolrCore; | ||
|
|
||
| import jakarta.inject.Singleton; | ||
|
|
||
| /** | ||
| * Migration of documents after introducing {@link Event#FIELD_PREFILTERING_DATE}. | ||
| * | ||
| * @version $Id$ | ||
| * @since 17.10.0 | ||
| */ | ||
| @Component(roles = SolrDocumentMigration171000000.class) | ||
| @Singleton | ||
| public class SolrDocumentMigration171000000 | ||
| { | ||
| /** | ||
| * Number of documents to consider at once for migration. | ||
| */ | ||
| private static final int BATCH_MIGRATION_SIZE = 100; | ||
|
|
||
| @Inject | ||
| private SolrUtils solrUtils; | ||
|
|
||
| @Inject | ||
| private Logger logger; | ||
|
|
||
| /** | ||
| * Perform migration of documents to fill the field {@link Event#FIELD_PREFILTERING_DATE}. | ||
| * | ||
| * @param core the core for which to perform the migration. | ||
| * @throws SolrException in case of problem when performing the migration. | ||
| */ | ||
| public void migrateAllDocuments(XWikiSolrCore core) throws SolrException | ||
| { | ||
| SolrDocumentList documentList; | ||
| int startIndex = 0; | ||
| int totalMigrated = 0; | ||
| long totalNumber = 0; | ||
| do { | ||
| SolrQuery solrQuery = new SolrQuery("*:*") | ||
| .setStart(startIndex) | ||
| .setRows(BATCH_MIGRATION_SIZE) | ||
| .setSort(Event.FIELD_DATE, SolrQuery.ORDER.desc); | ||
| try { | ||
| QueryResponse queryResponse = core.getClient().query(solrQuery); | ||
| documentList = queryResponse.getResults(); | ||
| totalNumber = queryResponse.getResults().getNumFound(); | ||
| if (!documentList.isEmpty()) { | ||
| for (SolrDocument solrDocument : documentList) { | ||
| String id = this.solrUtils.getId(solrDocument); | ||
| Date date = this.solrUtils.get(Event.FIELD_DATE, solrDocument); | ||
|
|
||
| SolrInputDocument solrInputDocument = new SolrInputDocument(); | ||
| this.solrUtils.setId(id, solrInputDocument); | ||
| this.solrUtils.set(Event.FIELD_PREFILTERING_DATE, date, solrInputDocument); | ||
| core.getClient().add(solrInputDocument); | ||
| } | ||
| startIndex += BATCH_MIGRATION_SIZE; | ||
| totalMigrated += documentList.size(); | ||
| logger.info("[{}] Solr events information migrated on [{}].", totalMigrated, totalNumber); | ||
| } | ||
| } catch (SolrServerException | IOException e) { | ||
| throw new SolrException("Error when performing 171000000 Solr events documents migration", e); | ||
| } | ||
| } while (!documentList.isEmpty() && totalMigrated < totalNumber); | ||
|
|
||
| if (totalMigrated > 0) { | ||
| // We commit when all documents are migrated. | ||
| try { | ||
| core.getClient().commit(); | ||
| } catch (SolrServerException | IOException e) { | ||
| throw new SolrException("Error when committing after performing 171000000 Solr " | ||
| + "events documents migration.", | ||
| e); | ||
| } | ||
| } | ||
| } | ||
| } |
1 change: 1 addition & 0 deletions
1
...m-stores/xwiki-platform-eventstream-store-solr/src/main/resources/META-INF/components.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| org.xwiki.eventstream.store.solr.internal.migration.SolrDocumentMigration171000000 | ||
| org.xwiki.eventstream.store.solr.internal.EventsSolrCoreInitializer | ||
| org.xwiki.eventstream.store.solr.internal.SolrEventStore | ||
| org.xwiki.eventstream.store.solr.internal.WikiDeletedListener |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect it to be set as an atomic update too.