Feature request: do not fire triggers on restore
When restoring, "create" and/or "update" triggers should NOT fire, since documents aren't actually created or updated, merely read back from a previous state.
Actually, I think we could achieve the same outcome but with a revision to the request. How about instead:
The Triggers API should be enhanced so that a Trigger is aware if it is firing due to the restore of a Backup. Triggers can then decide whether they are interested or not in responding to events during a restore. Existing Triggers should be appropriately updated to take this into account.
yes @wolfgang and I have been talking about this; this is the design we (I) had in mind.
I agree it would be useful for triggers to be aware of events during a restore procedure vs regular operation.
Also, the same thing would also be useful for some indexes, to allow them to be disabled during a restore (as the index may rely on information in the database that is not yet present). Granted this means a re-index would need to be performed after the restore, but it would be better than the alternative.
What is the progress on this? My thinking on this is, as a rule of thumb. the provision of eXist service-like features e.g. triggers, indexing and scheduler should apart from their initial configuration should have associated to functions
- to enable or disable the in place configuration
- to start or stop the enabled (registered) service
So although the configuration is in place unless enabled, the service wont start on boot. Once enabled the service will start on boot, unless disabled. When the service, is running you can start or stop it to do something like backups. The above approach is pretty much how systemd works.
The approach that the comes closest to this in the restXQ exrest module, where the service won't be enabled until you register it
exrest:deregister-module($module as xs:anyURI) exrest:register-module($module as xs:anyURI)
AFAIK there is no progress.
related PR #3338
@line-o I don't think #3338 is really related to this.
I am pretty sure that some triggers are not fired during restore (e.g. replication)