-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[server][common][vpj] Introduce ComplexVenicePartitioner to materiali…
…zed view (#1509) * [server][common][vpj] Introduce VeniceComplexPartitioner to materialized view The change will not work if record is actually large and chunked. Proper chunking support is needed and will be addressed in a separate PR. 1. Introduced VeniceComplexPartitioner which extends VenicePartitioner and offer a new API to partition by value and provide possible one-to-many partition mapping. 2. Added value provider of type Lazy<GenericRecord> to VeniceViewWriter's processRecord API to access deserialized value if needed. e.g. when a VeniceComplexPartitioner is involved. 3. MergeConflictResult will now provide deserialized value in a best effort manner. This is useful when we already deserialized the value for a partial update operation so that the deserialized value can be provided directly to the materialized view writer. 4. Refactored VeniceWriter to expose an API to write to desired partition with new DIV. This is only used by the new method writeWithComplexPartitioner for now to handle the partitioning and writes of the same value to multiple partitions. However, this newly exposed API should also come handy when we build proper chunking support to forward chunks to predetermined view topic partitions. 5. writeWithComplexPartitioner in VeniceWriter will re-chunk when writing to each partition. This should be optimized/refactored when we build proper chunking support.
- Loading branch information
Showing
36 changed files
with
1,523 additions
and
173 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
29 changes: 29 additions & 0 deletions
29
...da-vinci-client/src/main/java/com/linkedin/davinci/kafka/consumer/WriteComputeResult.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.linkedin.davinci.kafka.consumer; | ||
|
||
import javax.annotation.Nullable; | ||
import org.apache.avro.generic.GenericRecord; | ||
|
||
|
||
/** | ||
* Write compute result wrapper class holding the deserialized updated value and the serialized and potentially | ||
* compressed updated value bytes. | ||
*/ | ||
public class WriteComputeResult { | ||
private final byte[] updatedValueBytes; | ||
private final GenericRecord updatedValue; | ||
|
||
public WriteComputeResult(byte[] updatedValueBytes, GenericRecord updatedValue) { | ||
this.updatedValueBytes = updatedValueBytes; | ||
this.updatedValue = updatedValue; | ||
} | ||
|
||
@Nullable | ||
public byte[] getUpdatedValueBytes() { | ||
return updatedValueBytes; | ||
} | ||
|
||
@Nullable | ||
public GenericRecord getUpdatedValue() { | ||
return updatedValue; | ||
} | ||
} |
Oops, something went wrong.