setting option to enable/disable backup during delete record#8728
Conversation
|
|
||
| this.cancelWorkingCopy = function (md) { | ||
| return gnMetadataManager.remove(md.id); | ||
| return gnMetadataManager.remove(md.id, gnConfig["metadata.delete.enablebackup"]); |
There was a problem hiding this comment.
The parameter should be system wide and have nothing to do with extra parameters supplied to an api.
i.e. If backup option is disabled, it should not be possible for someone to indicate that they do want a backup by setting the backup flag to true on the api.
Maybe if someone does call the api with the backup option set to true then it should fail if backup option is disabled.
Not sure if the configuration options should be
Backup options
- Enabled
- Disabled (Optionally Enabled in API)
- Disabled
In this case your current PR seem to be implementing "Disabled (Optionally Enabled in API)". But in some case, the option should be completely disabled and no API option exists to perform the backup.
I question a use case where someone would mostly want the backups disabled when deleting records however sometimes want the backup?
@josegar74 - what are your thought on this implementation.
There was a problem hiding this comment.
I see that the backend service has a default of true (
Maybe it can be changed like this:
- If the parameter is provided, use what is provided.
- If the parameter is not provided, use the new setting.
There was a problem hiding this comment.
There are 3 options
- Enabled
- Disabled (Optionally Enabled in API)
- Disabled
The suggestion that @josegar74 supplied is cleaner than modifying the ui however it still uses the option " Disabled (Optionally Enabled in API)"
In some cases, we may want to completely disable the backup. And if someone supplied withBackup=true then we want it to fail indicating that that feature has been disabled. (This would be the "Disabled" option)
There was a problem hiding this comment.
Maybe the configuration options should be the following?
- Enabled (Default)
- Disabled (Optionally enabled in API using withBackup=true)
- Disabled Feature. (Will fail if API attempts to supply withBackup=true)
There was a problem hiding this comment.
I scan the project and I dont see anywhere it intentionally to pass this parameter. Therefore it was defaulted to true.
I have simplify the logic. Simply allow nullable to this withBackup param. So it will default to the setting value. Otherwise, we will do mismatch checking and throw an error accordingly. It will fit into the scenario that you are describing here. Please take a look of the code.
c081ffb to
1077817
Compare
| INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('metadata/history/accesslevel', 'Editor', 0, 12021, 'n'); | ||
|
|
||
| INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('metadata/delete/profilePublishedMetadata', 'Editor', 0, 12011, 'n'); | ||
| INSERT INTO Settings (name, value, datatype, position, internal) VALUES ('metadata/delete/backupOptions', 'NoPreference', 0, 12012, 'n'); |
There was a problem hiding this comment.
NoPreference is confusing? What does NoPreference? does it mean that a backup will be performed or not be performed?
There was a problem hiding this comment.
Add what @josegar74 suggested for the name change
|
@wangf1122 would not be better like this?
|
I have change the name for the option called "Use API parameter" and made the help text description change accordingly |
| {{'Force backup' | translate}} | ||
| </option> | ||
| <option | ||
| value="ForceNoBackup" | ||
| ng-selected="'ForceNoBackup' == s.value" | ||
| > | ||
| {{'Force no backup' | translate}} | ||
| </option> | ||
| <option value="UseAPIParameter" ng-selected="'UseAPIParameter' == s.value"> | ||
| {{'UseAPIParameter' | translate}} |
There was a problem hiding this comment.
Add translation keys for these values.
There was a problem hiding this comment.
I added the translation in en-admin.json. Please check
josegar74
left a comment
There was a problem hiding this comment.
Tested and works fine, once updated the translations looks fine to be merged.
|
The backport to stderrstdoutTo backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.2.x 4.2.x
# Navigate to the new working tree
cd .worktrees/backport-4.2.x
# Create a new branch
git switch --create backport-8728-to-4.2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick 4ed8e7d4dfcf04d487dc47e9b84f6e8d420d6c59,17b4ed4402239105b8797daa7f277aeb59517e83,71bb392c41fbee52b30fb2ce6ac399aeb8a89efc,1077817a8ce60f13f6e3887fa78f31435e9d23ad,d1d7ab1a95d9cd4c493f14da3daec00a5448a417,2419f219552eeb2e41f5e905b46028fa0b569b94
# Push it to GitHub
git push --set-upstream origin backport-8728-to-4.2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.2.xThen, create a pull request where the |
…e record (geonetwork#8728) * setting option to enable/disable backup during delete record * Change default of withBackup to allow null and default with setting value. * System setting of delete record backup options * Change no preference to Use API parameter option * update translation
…e record (#8728) (#8784) * setting option to enable/disable backup during delete record * Change default of withBackup to allow null and default with setting value. * System setting of delete record backup options * Change no preference to Use API parameter option * update translation Co-authored-by: wangf1122 <74916635+wangf1122@users.noreply.github.com>
The current delete record process will always force to backup the data and do delete after. The issue is if there is very big size attachment (for example over 1tb) with the metadata. The tomcat server will easily get clogged.
So this feature added such option to the setting table
It will override or do nothing to the API withbackup parameter. There are three scenarios
When the parameter is not supplied, it is currently defaulted as true. It will remain like this unless the setting is set to ForceNoBackup and this flag will override the withbackup to be false
When the parameter is supplied and set to true, it will remain as true unless the setting is set to ForceNoBackup, therefore it will cause some conflicting error
When the parameter is supplied and set to false, it will remain as false unless the setting is set to ForceBackup, therefore it will cause some conflicting error