Skip to content
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

[WIP] REP-45 Add option to delete replication data through UI #52

Closed
wants to merge 3 commits into from

Conversation

peterhuffer
Copy link
Contributor

What does this PR do?

More tests coming.

  • Fixes an issue with erroneous data transfer if 2 replications had overlapping filters. The fix was making sure a replication item always has a unique id (changed from metacard id)
  • Fixes an issue with karaf configuration delete command not cleaning up replication items.
  • Fixes an issue in the UI where clicking the save configuration button twice quickly would save 2 configurations with the same name
  • Adds option to delete replicated data when deleting a configuration. Only data replicated from another node to the local node will be deleted.
  • Add a scheduled deleter that checks for deleted configurations and cleans them up (runs every minute)
  • Add checks for deleting orphaned replication items (replication items without corresponding configurations or metacards).

Who is reviewing it (please choose AT LEAST two reviewers that need to approve the PR before it can get merged)?

@clockard @paouelle @kcover @mcalcote

How should this be tested? (List steps with links to updated documentation)

  • Replicate and verify deleting data along with the replication.
  • Replicate and delete a config (preserver data). Delete a metacard and verify its corresponding replication item entry gets cleaned up.

Any background context you want to provide?

What are the relevant tickets?

Fixes #45

Screenshots (if appropriate)

image

Checklist:

  • Documentation Updated
  • Update / Add Unit Tests
  • Update / Add Integration Tests

@peterhuffer peterhuffer mentioned this pull request Mar 27, 2019
3 tasks
Copy link
Contributor

@paouelle paouelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions and comments left.

@@ -249,9 +267,18 @@ public ReplicatorConfig getConfigForId(String id) {
return siteFields;
}

public ListField<ReplicationField> getReplications() {
public ListField<ReplicationField> getReplications(boolean filterDeleted) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✏️ We should move part of this method into the ReplicatorConfigManager as objects(boolean includeDeleted)

if (filterDeleted) {
configManager
.objects()
.filter(c -> !c.isDeleted())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.filter(c -> !c.isDeleted())
.filter(((Predicate<ReplicatorConfig>)ReplicationConfig::isDeleted).negate())

try {
configManager.remove(id);
ReplicatorConfig config = configManager.get(id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Should we modify updateReplication() setConfigSuspended() above to check if the config was deleted before deciding to update it? Same thing anywhere else we get a config to update it.
❓ Should we first check here if the object has already been deleted before changing it?

replication-api-impl/pom.xml Outdated Show resolved Hide resolved

Optional<ReplicationItem> getItem(String id, String source, String destination);
Optional<ReplicationItem> getItem(String metacardId, String source, String destination);

List<ReplicationItem> getItemsForConfig(String configId, int startIndex, int pageSize)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗️ That start index is concerning. Are we guaranteed that items are always returned in the same order on every queries and that new ones are only added at the end? What about if some are deleted, wouldn't that starting index be impacted and suddenly miss or skip items?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had similar concerns. I haven't investigated it too much yet though but I will take a closer look.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure the index and page size are passed directly on to solr so as long as it is doing it's job we are ok. When we switch out the backend we will need to make sure that is still the case with whatever we use.

* @return if {@code true}, delete the associated data replicated by this {@code
* ReplicatorConfig}, otherwise retain the data.
*/
boolean deleteData();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
boolean deleteData();
boolean shouldDeleteData();

Copy link
Contributor

@kcover kcover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I might've already asked this question before but why do we have to mark the configs as deleted rather than just deleting them directly?

@@ -249,9 +267,18 @@ public ReplicatorConfig getConfigForId(String id) {
return siteFields;
}

public ListField<ReplicationField> getReplications() {
public ListField<ReplicationField> getReplications(boolean filterDeleted) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✏️ at first glance I wasn't sure if this meant filter out deleted replications or apply a filter so that I just get deleted replications. excludeDeleted or something similar might be more clear.

.map(Result::getMetacard)
.map(Metacard::getId)
.collect(Collectors.toSet());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Instead of creating this new method, why not use the getTypeForFilter() method in the calling class and passing in the filter and getId function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I copy pasted this from the config delete command.

@peterhuffer
Copy link
Contributor Author

I need to close this PR and open it against 0.2.x.

@peterhuffer
Copy link
Contributor Author

@kcover Because if a config replicates millions of resources, it could take quite awhile to delete, and we would not want to block the UI for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for more clean up options when deleting Replications
4 participants