Skip to content

Add pluggable WAL storage providers - #6598

Draft
dlmarion wants to merge 3 commits into
apache:mainfrom
dlmarion:wal-spi
Draft

dlmarion wants to merge 3 commits into
apache:mainfrom
dlmarion:wal-spi

Conversation

@dlmarion

Copy link
Copy Markdown
Contributor

Introduce the WalProvider SPI and properties to configure the available set of WAL providers and the current provider.

This commit converts the current DFS implementation to a DfsWalProvider and the upgrade code converts all existing wal entries in ZooKeeper and the root and metadata tables to use the 'dfs' provider id.

Post-upgrade and on instance restart the
`instance.wal.provider' property can be set to the class name of a WALProvider SPI implementation. The
'instance.wal.providers' property must contain the class name and configuration properties for the current and all in-use providers.

An InMemoryWalProvider class in the test module provides an example implementation and is used in various ITs.

Assisted-By: OpenAI GPT-6 Luna

Introduce the WalProvider SPI and properties to configure
the available set of WAL providers and the current provider.

This commit converts the current DFS implementation to a
DfsWalProvider and the upgrade code converts all existing
wal entries in ZooKeeper and the root and metadata tables
to use the 'dfs' provider id.

Post-upgrade and on instance restart the
`instance.wal.provider' property can be set to the class
name of a WALProvider SPI implementation. The
'instance.wal.providers' property must contain the
class name and configuration properties for the current
and all in-use providers.

An InMemoryWalProvider class in the test module provides
an example implementation and is used in various ITs.

Assisted-By: OpenAI GPT-6 Luna
@dlmarion dlmarion added this to the 4.0.0 milestone Oct 16, 2026
@dlmarion dlmarion self-assigned this Oct 16, 2026
Comment thread WAL-SPI.md

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file will be removed before merge and moved over to the website repo

@keith-turner keith-turner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a quick look at the SPI, have not looked at the impl changes yet. Will do that soon.

* Returns the current replication level when the provider can report one, or {@code -1} when
* that information is unavailable.
*/
default int getCurrentReplication() throws IOException {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way this is used is to determine if a wal file is healthy and if its not it abandons it and starts a new one. Could make this method more generic.

Suggested change
default int getCurrentReplication() throws IOException {
default boolean isHealthy() throws IOException {

* Returns a diagnostic description of the current storage pipeline, or an empty array when the
* provider has no pipeline information.
*/
default String[] getPipeline() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could make this more generic and avoid the specifics of HDFS impl.

Suggested change
default String[] getPipeline() {
default String getDiagnostics() throws IOException {

* {@link #sync(Durability)} while other threads append through the output stream; implementations
* must ensure a sync covers all bytes written before it is requested.
*/
interface Writer extends AutoCloseable {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not work well at all, so not suggesting we following this path was just curious about this approach. Was wondering if instead of having a getOutputStream() method we could extend OutputStream instead

Suggested change
interface Writer extends AutoCloseable {
interface Writer extends OutputStream {

Again not recommending we do this, not sure how it would impact the code if it would be an improvement or not. Was wondering if you had a sense of how it would play out in these changes and if it would be beneficial or not.

@dlmarion

Copy link
Copy Markdown
Contributor Author

@keith-turner - before looking at this further, take a look at #6601. That should probably be merged first and will help isolate some of the changes in this PR a little better.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants