-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add kv store implementation for rs3 (#362)
* add kv store implementation for rs3 This patch adds a key-value store implementation for RS3: Adds the rs3 repo as a submodule so that we can get to the rs3 proto file Extends the flush writing path to pass the relevant changelog offset to the flush manager. RS3 uses this to specify the end offset of the WAL segments that it writes during flush. Adds the RS3 RemoteKVTable implementation. The RS3 table uses the RS3 grpc protocol to do writes/reads to/from RS3. The grpc protocol is behind a more generic RS3Client type that exposes apis for writing wal segments, reading keys, and getting the current written/flushed offsets. When the table is initialized, it fetches the current written offset for all PSSs, and uses the lowest of these as the restore point. On a write, RS3KVFlushManager builds up a WAL segment for each PSS for a given LSS/partition, adding entires to the segment based on the record key. This mapping (from key to PSS) is provided by PssPartitioner. When it has all the writes in the current flush, it completes the WAL segment write rpcs to RS3. On a read, RS3KVTable fetches the value from the PSS that corresponds to the requested key. Range scans are currently not supported. Adds a new store type called RS3 for specifying an RS3 store. Adds some simple config for talking to the rs3 server that allows specifying the hostname/port. The store->PSS mapping is still hard-coded. I'll make it configurable in a follow-up. * add token to checkout * use the published server * apply basic feedback * fix build errors in ttdkeyvaluetable * clean up psspartitioner interface * add direct partitioner that maps lss 1:1 to pss * missed final * remove PssRangePartitioner for now * rebase * fix test
- Loading branch information
Showing
48 changed files
with
1,972 additions
and
57 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
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
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
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
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
31 changes: 31 additions & 0 deletions
31
kafka-client/src/main/java/dev/responsive/kafka/internal/db/rs3/PssDirectPartitioner.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,31 @@ | ||
/* | ||
* Copyright 2024 Responsive Computing, Inc. | ||
* | ||
* This source code is licensed under the Responsive Business Source License Agreement v1.0 | ||
* available at: | ||
* | ||
* https://www.responsive.dev/legal/responsive-bsl-10 | ||
* | ||
* This software requires a valid Commercial License Key for production use. Trial and commercial | ||
* licenses can be obtained at https://www.responsive.dev | ||
*/ | ||
|
||
package dev.responsive.kafka.internal.db.rs3; | ||
|
||
import dev.responsive.kafka.internal.db.rs3.client.LssId; | ||
import java.util.List; | ||
|
||
/** | ||
* PSS partitioner that does a 1:1 mapping from LSS to PSS | ||
*/ | ||
public class PssDirectPartitioner implements PssPartitioner { | ||
@Override | ||
public int pss(byte[] key, LssId lssId) { | ||
return lssId.id(); | ||
} | ||
|
||
@Override | ||
public List<Integer> pssForLss(LssId lssId) { | ||
return List.of(lssId.id()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
kafka-client/src/main/java/dev/responsive/kafka/internal/db/rs3/PssPartitioner.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,22 @@ | ||
/* | ||
* Copyright 2024 Responsive Computing, Inc. | ||
* | ||
* This source code is licensed under the Responsive Business Source License Agreement v1.0 | ||
* available at: | ||
* | ||
* https://www.responsive.dev/legal/responsive-bsl-10 | ||
* | ||
* This software requires a valid Commercial License Key for production use. Trial and commercial | ||
* licenses can be obtained at https://www.responsive.dev | ||
*/ | ||
|
||
package dev.responsive.kafka.internal.db.rs3; | ||
|
||
import dev.responsive.kafka.internal.db.rs3.client.LssId; | ||
import java.util.List; | ||
|
||
public interface PssPartitioner { | ||
int pss(byte[] key, LssId lssId); | ||
|
||
List<Integer> pssForLss(LssId lssId); | ||
} |
Oops, something went wrong.