Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
erp5 erp5
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 140
    • Merge requests 140
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • erp5erp5
  • Merge requests
  • !1636

Merged
Created Jun 03, 2022 by Jérome Perrin@jeromeOwner

core: repair ERP5Site_reindexLatestIndexedObjects

  • Overview 0
  • Commits 1
  • Pipelines 3
  • Changes 3

This script stopped working since Catalog changed to be ERP5 document, because it was calling the unindex method of the catalog (which itself is indexable like any other ERP5 document). Update to use the uncatalogObject which is the method to unindex a document by uid.

Even though it was somehow working before, it was not really correct in selecting objects, because it was using - operator on TIMESTAMP column, which is not computing a difference in seconds as this script was expecting. See for example https://stackoverflow.com/a/24504132/7607763 or the example below for an explanation. Instead, use TIMESTAMPADD to compute the start timestamp only once and use >= operator, which works as expected.

This query was also sorting by indexation_timestamp, which does not use an index. Remove the sort because it's not really needed.

Excluding reserved path was also not needed, we no longer use these since 69aefdff (ZSQLCatalog: Drop support for "reserved" path., 2017-09-18)


Another reproduction of the timestamp arithmetic problem

select
   TIMESTAMP('2021-01-02 00:00:00') - TIMESTAMP('2021-01-01 00:00:00') a,
   20210102000000 - 20210101000000 aa,
   TIMESTAMP('2021-06-01 00:00:00') - TIMESTAMP('2021-05-31 00:00:00') b,
   20210601000000 - 20210531000000 bb,
   TIMESTAMPDIFF(second, TIMESTAMP('2021-05-31 00:00:00'), TIMESTAMP('2021-06-01 00:00:00')) c
a aa b bb c
1000000 1000000 70000000 70000000 86400
Edited Jun 05, 2022 by Jérome Perrin
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: fix/ERP5Site_reindexLatestIndexedObjects
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7