Establishing Backward Compatibility in our Data Systems #295
Replies: 7 comments 4 replies
-
Excellent job, sir 👏🏻 My 50 cents about some parts of the RFC: Multiple Publishers and Versioning
Should it not be each stream instead of the subject here?
The same here; I guess we should have each stream separated as a long process instead of each subject because there are too many subjects to track.
I like having multiple publishers running in parallel for each stream. As we discussed, we can separate resources, handlers, etc., avoiding that one stream affecting others when issues occur. However, the idea of splitting this into versions I guess is too much for now. Versioning suggestionAs I suggested, we can have an Since we control entirely how our users consume our streams, this approach makes it easy for us and our users to get the data from the correct place; they just need to update the crates. Also, for users that can't update the crate but can access the updated data, we can just add a config option Both approaches that I mentioned will simplify resources and deployment management. Data Prioritization Strategies
Chain ReorganizationFor this part, I guess we should think a bit more and get some opinion from @Voxelot about in which cases this could happen and which implications we can have. OtherSome other suggestions I would like to see here are:
|
Beta Was this translation helpful? Give feedback.
-
Ah, yes, it should be |
Beta Was this translation helpful? Give feedback.
-
Not sure If I misunderstood but that's what I meant here:
We could use an environment variable here or simply work with static guarantees i.e. Users using |
Beta Was this translation helpful? Give feedback.
-
Republishing are patch fixes that will not require any action from our users i.e. they won't need to update their crates since it's all data change. This is why we need to figure out if we should republish with data consistency or data availability prioritized in mind (?) |
Beta Was this translation helpful? Give feedback.
-
Yes, that would appreciated. Currently, I understand that Chain re-orgs are not possible ATM. But if there were data changes originating from the chain, maybe from Regenesis or related, we would have to republish. This could be a breaking interface change or simply a data patch, but in general, we will republish and document the update in the CHANGELOG allowing users to determine if they need re-aggregate their data or make certain actions. In the future, we could introduce an aggregation API to support indexing in specific stores (e.g., our planned SurrealDB). This would enable automated data migration management for users, streamlining the handling of these scenarios. |
Beta Was this translation helpful? Give feedback.
-
It may be challenging to generalize since each breaking interface change often comes with unique nuances. How difficult will it be to encourage high-value DApps to migrate to the latest version? Are there any instances of corrupt data in older versions that cannot be republished? What is the version distribution of DApps currently consuming our streams? Seems this will become clearer as we gain adoption. wdyt? |
Beta Was this translation helpful? Give feedback.
-
This may be somewhat outside the scope of this RFC, but I agree—ensuring data integrity is critical, and detecting data discrepancies could come from various sources. We definitely need a combination of robust validations, checksums, and extensive unit and end-to-end tests. Achieving this level of stability will be key for reliable data integrity. Increasing our test coverage is essential. Ideally, we can leverage tools from similar repositories within Fuel to enable more advanced mocking and simulations, which would significantly enhance our testing capabilities. |
Beta Was this translation helpful? Give feedback.
-
Overview
This RFC proposes a robust architectural framework to ensure that our data systems maintain a stable, backward-compatible interface as we release changes to production. Our primary objective is to minimize disruptions for downstream consumers, particularly to improve the developer experience for DApp integrators and consumers. This architecture will facilitate a controlled evolution of our data systems with minimized impact on DApps, regardless of the pace of updates.
Problem Context and Instability Risks
To build a reliable, scalable system, we must first understand the main sources of instability, which impact both DApp compatibility and data integrity. We categorize these risks as follows:
Data Correctness
Structural and Interface Changes
Proposed Solution Overview
Given the project’s early phase, some degree of data inaccuracy is probably expected. For this reason, we recommend primary support for presentational DApps, while transaction-based DApps are advised to limit reliance on the data stream until further stabilization.
To address these risks, we propose two complementary solutions that can be implemented concurrently:
Controlled Republishing
Description
Controlled Republishing supports patch-level updates and corrects erroneous data in a way that minimizes DX disruptions. By isolating republishing to specific data streams, we can correct targeted streams without requiring global updates across DApp codebases.
High-Level Implementation Summary
Streams Isolation: Each stream (e.g., blocks, transactions) is managed as an independent, long-running process. A
last_published
checkpoint is maintained per stream to track the state of each republish operation:Sample checkpoint structure:
Environment-Based Republishing Controls: Utilize environment variables to granularly control republishing across all streams or specific ones:
ALL_REPUBLISH_COUNT
: Specifies the number of blocks to republish.ALL_REPUBLISH_START_BLOCK
: Defines the starting block for republishing, defaulting to the genesis block.{STREAM}_REPUBLISH_COUNT
: Sets a republish count per stream.{STREAM}_REPUBLISH_START_BLOCK
: Specifies the starting block per stream.RepublisherFactory and Republisher Processes: A factory generates a dedicated
Republisher
process for each stream, which continuously monitors its environment variables. Ifrepublish_count
is incremented, republishing initiates; otherwise, normal publishing resumes.Data Prioritization Strategies:
Put
API from the key-value store. This approach maximizes data availability but may temporarily expose inconsistent data.Question: Which should we prioritize more? Data availability vs. consistency?
Versioned Publishing
Description
Versioned Publishing addresses structural or interface-breaking changes that could disrupt DApps relying on specific data formats or API versions. As it would be shown below, Versioned publishing introduces non-trivial complexity and resource requirements. Therefore, it should be reserved for cases where API stability is achieved and backward compatibility for high-value DApps is essential.
High-Level Implementation Summary
Subject and Payload Versioning:
To streamline version management and reduce code complexity, we introduce an ALLOW_REPUBLISHING environment variable that disables republishing for previous versions. This approach encourages users who require data corrections to upgrade to the latest version, simplifying maintenance. Otherwise, supporting multiple versions would require versioned Subjects and Payloads (e.g.,
BlockSubjectV_0_1
forBlockV_0_1
payload, andBlockSubjectV_0_2
forBlockV_0_2
payload), significantly increasing codebase complexity and the maintenance burden. This variable enables us to keep the system manageable and maintain a cleaner architecture as we evolve our data schemas.Instance Management
Deploy a separate Publisher instance for each supported version. For instance, maintain a
0.1
Publisher alongside a0.2
Publisher to ensure compatibility which would point to bucketsfuel_{stream}_0_1
andfuel_{stream}_0_2
in the NATS cluster respectively. As new versions are introduced, additional publisher instances will be deployed, incrementally increasing deployment complexity.Governance and Operational Considerations
Conclusion
The combination of Controlled Republishing and Versioned Publishing offers a flexible, scalable approach to maintaining a stable data interface amid rapid system evolution. Controlled Republishing allows us to address data inconsistencies with minimal impact on developers, while Versioned Publishing provides essential backward compatibility for critical DApps reliant on legacy schemas. Together, these strategies enable a controlled, developer-friendly upgrade path that minimizes disruption and enhances resilience, ensuring that both existing and future DApps can confidently interact with our evolving data systems.
Beta Was this translation helpful? Give feedback.
All reactions