Optimize serialization for WriteOnly with PendingWritesQueue - #4420
Open
jjezra wants to merge 8 commits into
Open
Optimize serialization for WriteOnly with PendingWritesQueue#4420jjezra wants to merge 8 commits into
jjezra wants to merge 8 commits into
Conversation
jjezra
marked this pull request as ready for review
August 4, 2026 22:00
ScottDugas
requested changes
Aug 5, 2026
ScottDugas
requested changes
Aug 11, 2026
| .as("removing a record the filter excludes must not be deferred either") | ||
| .isNull(); | ||
|
|
||
| assertThat(nearestRecNos(index, query, 10)) |
Collaborator
There was a problem hiding this comment.
Is this supposed to have a call to updateFromQueue?
Contributor
Author
There was a problem hiding this comment.
All the Any returned from serializations in this test are null and cannot be used in updateFromQueue. What am I missing?
Comment on lines
+856
to
+865
| final Tuple primaryKey = stored.getPrimaryKey(); | ||
| final Message rec = VectorRecord.newBuilder() | ||
| .setGroupId(Ints.checkedCast(primaryKey.getLong(0))) | ||
| .setRecNo(primaryKey.getLong(1)) | ||
| .setVectorData(ByteString.copyFrom(vector.getRawData())) | ||
| .build(); | ||
| return FDBStoredRecord.newBuilder(rec) | ||
| .setPrimaryKey(primaryKey) | ||
| .setRecordType(stored.getRecordType()) | ||
| .build(); |
Collaborator
There was a problem hiding this comment.
This could be simpler and cleaner with:
return stored.toBuilder().setVectorData(ByteString.copyFrom(vector.getRawData())).build()
Contributor
Author
There was a problem hiding this comment.
Seems like stored.asBuilder() returns a generic FDBStoredRecordBuilder which wouldn't support setVectorData. Casting may be a little tricky in this elegant one liner.
| @Nonnull | ||
| private VectorIndexMaintainer maintainerExcludingRecordsWithoutVector(@Nonnull final Index index) { | ||
| final IndexMaintenanceFilter filter = (ignored, record) -> | ||
| record instanceof VectorRecord && ((VectorRecord)record).hasVectorData() |
Collaborator
There was a problem hiding this comment.
Suggested change
| record instanceof VectorRecord && ((VectorRecord)record).hasVectorData() | |
| final IndexMaintenanceFilter filter = (ignored, rec) -> | |
| rec instanceof VectorRecord && ((VectorRecord)record).hasVectorData() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a followup of #4370.
If an update is not needed (i.e both new and old records were filtered out), skip pushing a pending write queue item as the operation is a no-op.
Vector index, when updating from queue, will remove common entries (i.e. replacing an entry with an exact copy) similar to what
IndexStandardMaintainerdoes during regular update.