-
Notifications
You must be signed in to change notification settings - Fork 74
MLE-26420 Can now perform incremental writes #1868
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
|
Copyright Validation Results ⏭️ Skipped (Excluded) Files
✅ Valid Files
✅ All files have valid copyright headers! |
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.
Pull request overview
This PR introduces an incremental write feature that prevents unnecessary document writes by comparing hash values of document content. The implementation uses a field-based hash stored in MarkLogic to determine if a document's content has changed since its last write, skipping writes for unchanged documents.
Key Changes:
- Added
IncrementalWriteFilterwith two retrieval strategies: Optic queries and server-side eval - Implemented JSON canonicalization to handle key ordering differences
- Added comprehensive test coverage for the incremental write functionality
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test-app/src/main/ml-config/databases/content-database.json | Adds field and range-field-index configurations for incrementalWriteHash field |
| marklogic-client-api/src/test/java/com/marklogic/client/datamovement/filter/IncrementalWriteTest.java | Integration tests for incremental write with Optic and eval filters, JSON canonicalization scenarios |
| marklogic-client-api/src/test/java/com/marklogic/client/datamovement/filter/IncrementalWriteFilterTest.java | Unit tests for metadata handling without database connection |
| marklogic-client-api/src/main/java/com/marklogic/client/datamovement/filter/IncrementalWriteOpticFilter.java | Optic-based implementation for retrieving existing hash values |
| marklogic-client-api/src/main/java/com/marklogic/client/datamovement/filter/IncrementalWriteFilter.java | Core filter logic with Builder pattern for customization |
| marklogic-client-api/src/main/java/com/marklogic/client/datamovement/filter/IncrementalWriteEvalFilter.java | Server-side JavaScript eval implementation for hash retrieval |
| marklogic-client-api/build.gradle | Adds dependencies for JSON canonicalization and hash generation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...lient-api/src/main/java/com/marklogic/client/datamovement/filter/IncrementalWriteFilter.java
Outdated
Show resolved
Hide resolved
...lient-api/src/main/java/com/marklogic/client/datamovement/filter/IncrementalWriteFilter.java
Show resolved
Hide resolved
...t-api/src/main/java/com/marklogic/client/datamovement/filter/IncrementalWriteEvalFilter.java
Outdated
Show resolved
Hide resolved
093f7ea to
2b6294e
Compare
| @Override | ||
| public DocumentWriteSet apply(DocumentWriteSetFilter.Context context) { | ||
| ArrayNode uris = new ObjectMapper().createArrayNode(); | ||
| for (DocumentWriteOperation op : context.getDocumentWriteSet()) { |
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.
nitpick - I would use a different variable name than "op" just to avoid confusion with optic DSL (particularly because of IncrementalWriteOpticFilter below).
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 had that exact same thought yesterday and I know I changed it to "doc" somewhere else, will definitely change it here. I think Copilot spits out "op" by default.
IncrementalWriteFilter is the entry point, with a Builder for customizing its behavior.
2b6294e to
ad22dcb
Compare
IncrementalWriteFilter is the entry point, with a Builder for customizing its behavior.