-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[Connector API] Support soft deletes of connectors #118282
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
Conversation
@elasticmachine merge upstream |
Hi @jedrazb, I've created a changelog YAML for you. |
Pinging @elastic/search-eng (Team:SearchOrg) |
Pinging @elastic/search-extract-and-transform (Team:Search - Extract & Transform) |
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 don't feel I can review Java code in the PR well, but I left a couple comments/questions about features introduced by the PR and other minor stuff
- class: org.elasticsearch.xpack.application.connector.ConnectorIndexServiceTests | ||
issue: https://github.com/elastic/elasticsearch/issues/116087 |
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.
What about unmuting the tests?
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.
++
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.
It got muted due couple of flakey runs recently ... I checked the logs and it seemed to be weird ES error. It has been running for almost a year now fine
"deleted": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "A flag indicating whether to list connectors that have been soft-deleted." |
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.
Should we say that it's listing "only" deleted connectors, not all together?
@@ -0,0 +1,307 @@ | |||
{ |
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.
Is it possible to have a test that checks that both deleted and non-deleted indices have the same schema?
Additionally, does it make sense to make a lot of properties here searchable? Or we wanna have filters on deleted connectors too?
cluster: | ||
- manage_search_application | ||
- manage_behavioral_analytics | ||
- manage_connector |
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.
Can you add a comment on why this and below permissions are needed? What does it practically mean for users, if it does anything?
- do: | ||
connector.list: {} | ||
|
||
- match: { count: 2 } |
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.
Curious - why 2? It's some sort of initial setup?
|
||
- match: { count: 3 } | ||
|
||
# Alphabetical order by index_name for results |
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.
Curious - is it possible to do same matching without relying on sorting being stable?
* @param listener The action listener to invoke on response/failure. | ||
*/ | ||
public void getConnector(String connectorId, ActionListener<ConnectorSearchResult> listener) { | ||
public void getConnector(String connectorId, Boolean isDeleted, ActionListener<ConnectorSearchResult> listener) { |
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.
One interesting side effect of it is that it's possible to have a non-deleted and deleted connectors with same id that will actually point to really different connectors. That can cause some confusion, but probably nothing flow-breaking, other than customer restoring deleted connector manually breaking something, but that's on them? Should we document this more?
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.
Also in same scenario, deleting a live connector would erase previous record of a deleted connector. I guess it's also fine given our limitations, but might be nice to document.
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 found this to be a little confusing. As a user I would assume that passing a deleted flag into a list call would have included all of the connectors including the soft deleted ones - ideally with metadata indicating which ones were deleted. Or, I would have expect a different API call to get only deletions. Why did we choose to combine these in an exclusive way?
Another option we could have taken is to add a deleted flag to the connectors index. Was this determined to be unmanageable?
- class: org.elasticsearch.xpack.application.connector.ConnectorIndexServiceTests | ||
issue: https://github.com/elastic/elasticsearch/issues/116087 |
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.
++
We’ve discussed this with Jim, and there might be a better way to implement logic to handle soft-deleted documents, with mappings update. I’m implementing his suggestion as a separate branch of this PR. Suggested approach involves updating the template and applying new mappings if needed using the onClusterChange listener. |
@kderusso Thank you for looking into this!
Jim made me aware that there is a way to upgrade connector index template mappings in clusterChanged logic, so we can just add a new field to the existing index. I’m following this approach and will have something to share soon.
I don’t have a strong opinion here. For me, passing
Do you know if ES endpoints conventions prefer either approach? |
Closing in favour of #118669 |
Soft deletes for connectors
Add support for soft-deletes of connectors. Why?
Changes
.connectors-deleted
that stores deleted connectorsdelete
,get
andlist
operations logic to support this feature.elastic-connectors-*
patternmanage_connector
andmonitor_connector
privilegesWhy new system index and not new
is_deleted
flag in existing indexThe existing connector index is not a system index. Instead, we rely on index templates with non-dynamic mappings. This means that even if we update the template and incorporate logic to use the is_deleted field in the current index, it won’t be backward compatible, since the new field wouldn’t be present in mappings for users who created their connector indexes in the past. The is_deleted field will be included in the source, but we wouldn’t be able to run any queries against it, making it useless.
By using a separate index, we maintain backward compatibility for users who depend on direct access to the connector index. Deleted connectors will actually disappear from the original connector index and be moved into the deleted connectors index.
Followup work:
Other work we might need to do in the future:
force=true
to delete endpoint to completely remove the connectorValidation