Who Owns the Data?
Establishing authority without breaking the monolith.
This article is part of ZibiWorks, an ongoing fictional modernization case study. The ZibiWorks site is the canonical home of the series, with the full company context, starting architecture, and related installments. Explore the full series at ZibiWorks.
In the last few installments, ZibiWorks has been working toward extracting Fulfillment from the monolith. We've identified the business boundary, established a seam through which the old and new implementations can operate, and worked through which responsibilities belong in the new service.
But there's something we haven't addressed yet. The data.
Fulfillment's operational state still lives in the monolith's SQL Server database, alongside the order information that the rest of the business depends on. And while we've established how the new service will take responsibility for Fulfillment, moving that responsibility is not as simple as moving the tables.
The monolith still needs that information. Its screens, reports, and background processes depend on it, and the business isn't prepared to rewrite those components just to accommodate the extraction.
There's another complication. Until the new service has proven itself, the business expects a way to fall back to the legacy implementation. That means the legacy system needs more than access to Fulfillment's information. It needs enough current, meaningful state to resume operations if necessary.
So how do we give Fulfillment ownership of its data without forcing the rest of the monolith to change along with it? And how do we preserve a usable fallback when the new service is eventually going to support capabilities the legacy implementation never had?
The problem we've inherited
The Orders table did not become shared by accident. When ZibiWorks shipped from a single warehouse, an order was one shipment and the path from placed to shipped was close to linear, so keeping everything about the order on one record was the simplest thing that worked.
Anyone who needed to know where an order stood read one row, and a change in how orders moved through the warehouse meant adding a column to a table every part of the application already understood.
Installment 04 described how that convenience accumulated into a record shared by several business capabilities. The slice that matters here is the one Fulfillment cares about. A reduced view of the legacy model from Installment 04. Inventory's columns share the same row and are left out, as are the other columns on the shipment records.
Order Management and Fulfillment are separate business responsibilities, and nothing in this schema reflects that. OrderStatus belongs to Order Management: it records what the business has done with the order. PickStatus, PackStatus, and ShipStatus belong to Fulfillment: they record how far the warehouse work has progressed, yet they sit on the same row and are saved together with it. The shipment records hang off the order and belong to Fulfillment as well.
The diagram is not here for its columns. It shows two responsibilities that are physically one thing, and the rest of this installment follows from that.
For years this was fine. It is becoming a constraint because the business is asking more of Fulfillment than a handful of status fields can hold. Partial shipments already turn some orders into several deliveries, and the business expects more of them. It also expects split fulfillment, where one order is filled from more than one warehouse, and additional carriers for the accessories and other products that Handle With Care, the robot-shipping specialist, does not carry, which is the flexibility Installment 06 gave Fulfillment room to grow into.
Each of these brings state that does not fit on the order row. Three order-level columns can report that an order is packed or shipped. They cannot report that two of three packages are with the carrier, one is waiting on a backorder, and a second warehouse has not started picking.
The shipment records can carry some of that detail, but the code the rest of the business depends on reads the order-level columns. So the business wants Fulfillment to evolve on its own schedule, with a data model shaped like fulfillment rather than like an order, and it wants the monolith to carry on as though nothing had changed.
Location is not ownership
It is tempting to treat giving Fulfillment its data as a single act, moving the tables. In practice that phrase bundles together three different things, and they can be decided independently of one another. Before deciding how to migrate anything, we need to separate where the data lives, who has authority to change it, and how other components access it.
- Concern: Location
- Before: Fulfillment state resides in the monolith SQL Server alongside Ordering data.
- After: Fulfillment's database holds the authoritative state. The legacy tables temporarily retain synchronized copies.
- Concern: Ownership
- Before: The legacy implementation is authoritative. Several code paths, some in Ordering, write the Fulfillment columns.
- After: The extracted Fulfillment service is authoritative. The monolith cannot independently modify Fulfillment-owned state.
- Concern: Access
- Before: Existing components query the monolith's tables directly.
- After: New consumers use Fulfillment's API or appropriate read models. Existing legacy consumers may temporarily read the synchronized legacy tables.
The first row is the one that gets the attention, and it is the least important of the three. A database can move to a new server, or a new schema, and leave everything about ownership untouched. If the code paths in Ordering that write ShipStatus today are still free to write it tomorrow, wherever it lives, then Fulfillment does not own that state.
It shares it with whoever else can change it, and it still cannot evolve its model without checking who might be affected. A service owns its data when it is the only thing with the authority to change it. Moving data does not establish ownership. Authority does.
Single authority does not mean single copy. The monolith will go on needing Fulfillment information in the shape it has always had, which means a copy of that information will exist in the legacy tables for some time. A copy is not a second source of truth merely because it exists. It becomes one only when someone can change it and have that change count, so that the system has two places to look and no way to decide which to believe when they disagree.
Installment 03 described the target as dual presence, single authority: the data is present in both places, and only one side is the source of truth. Keeping it that way is most of the work ahead.
What happens to work already in progress?
Authority cannot transfer in the abstract. On the day it does, ZibiWorks will have fulfillment requests in flight in the monolith: orders being picked, parcels packed but not yet collected, shipments handed to carriers and awaiting delivery, orders held for a backorder. Whatever the new service does about those requests is a decision, and there are two reasonable ways to make it.
The first is to drain. The legacy implementation finishes everything it has already accepted, while new requests go to the Fulfillment service. It is an attractive answer because nothing has to be migrated and no request ever changes hands midway. Each request is handled by one implementation from start to finish, which makes the ownership question easy to answer.
The trouble is how long draining takes. Open requests do not close on a schedule, and an order waiting on a backorder can stay open for weeks. Until the last one closes, the monolith is still carrying Fulfillment, two implementations each own part of the work, and the extraction has not delivered the independence it was supposed to.
The second is to migrate. The active requests, and the history Fulfillment needs in order to operate correctly, are copied into Fulfillment's database and validated, and authority switches at a controlled boundary. This costs a migration to build and check, and a short pause in writes while the switch happens, but it lets the new service take over without waiting for the slowest request. It is also consistent with the Strangler Fig approach chosen in Installment 03, where responsibility moves a piece at a time while the old system keeps running.
ZibiWorks chooses to migrate. The deciding fact is the calendar. Peak season is approaching, Fulfillment is the capability under the most pressure, and an extraction that waits for every open order to complete could slip past the point where it was supposed to help. So ZibiWorks migrates open requests and the history Fulfillment needs, and leaves older history in the legacy database until someone has a business reason to move it.
A company whose requests close in a day or two, or whose deadline is further away, could reasonably drain instead and avoid writing a migration at all. The decision is about ZibiWorks' calendar and the length of its open requests, and the same analysis with different inputs would come out the other way.
Whichever approach is chosen, authority has to move deliberately, and the principle under it does not change. At any moment exactly one implementation owns the state, and the transfer from one to the other is an explicit event that the legacy side is told about, not something that happens as a side effect of routing requests somewhere else.
- Phase: Before cutover - Legacy is authoritative while the new database is seeded and validated.
- Phase: During cutover - Legacy writes are stopped, final changes are transferred, and validation completes. Authority has not yet transferred.
- Phase: Successful cutover - Fulfillment becomes authoritative and the legacy representation is maintained through synchronization.
- Phase: Failed cutover - Legacy resumes as the authoritative implementation without an incomplete ownership transfer.
- Phase: Deliberate fallback - Authority returns to legacy through an explicit, controlled procedure after the necessary state has been reconciled.
ZibiWorks chooses a single, controlled transfer of authority. Until that transfer is complete, the legacy implementation remains responsible for Fulfillment. Afterward, the new service takes over. There is no period where both implementations independently own the same work.
The mechanics of making that transition safely are important, but we'll address those later in the series.
The monolith isn't going away
The migration decision settles who owns the data. It says nothing yet about what happens to everything that still reads it, and this is the part of the problem that most strongly shapes the architecture. Three requirements apply, and each one constrains the others.
The first is continued legacy operation. The status screens, the reports, the Inventory process, and the shipment confirmations depend on Fulfillment information today, and they must keep working as authority transfers to the new service. None of them has been touched by the extraction so far, and most of them belong to teams who have other things to do this quarter.
The second is a usable fallback. The business needs to be able to resume processing through the legacy implementation if the new service runs into a serious problem while it is still earning trust. Installment 05 made that reversible at the application boundary, where pointing Ordering back at LegacyFulfillmentService is a single change, but a change of routing is only the first half of a fallback. The legacy implementation also needs state that is current enough and meaningful enough to resume from. Falling back onto stale tables risks losing track of work already performed, and a configuration change is all it takes to trigger the problem.
These dependencies are not all alike, and the useful way to see the difference is to ask what each one needs and what it costs when the data is wrong.
Legacy Dependency and Compatibility Matrix
For each component that reads the data being moved, record what it needs, what stale or missing data would cost, and therefore what it must be able to rely on. The last column is the output. It turns a vague worry that the monolith depends on this data into a requirement an approach can be tested against, and the same four questions apply to any extraction. These are ZibiWorks' dependencies, assessed qualitatively.
- Legacy dependency: Order status screens
- What it needs: Current fulfillment status
- Consequence of stale data: Shows an earlier status than the real one
- Compatibility requirement: Short delay acceptable. Status reasonably current.
- Legacy dependency: Operations and finance reports
- What it needs: Complete fulfillment activity
- Consequence of stale data: Totals incomplete or inconsistent until corrected
- Compatibility requirement: Complete and consistent when relied on. Delay acceptable.
- Legacy dependency: Inventory processing
- What it needs: Whether reserved units have left, or the order was cancelled
- Consequence of stale data: Stock released or committed wrongly, such as released for a parcel that already shipped
- Compatibility requirement: Handoffs and cancellations reflected promptly, never silently missed
- Legacy dependency: Shipment confirmations
- What it needs: Which shipments have reached carriers
- Consequence of stale data: Customer told the wrong status, such as still packing after it shipped
- Compatibility requirement: Handoffs reflected promptly and accurately
- Legacy dependency: Legacy fallback
- What it needs: Complete, meaningful state for the work the business agreed to resume
- Consequence of stale data: Work resumes on a parcel already with a carrier, or work in progress is lost
- Compatibility requirement: Reconciled state before authority returns. Work the legacy model cannot represent is not resumed.
Nothing in the matrix requires every consumer to see the data at the same instant. What differs is the cost of a wrong or missing answer, which is small for a status screen and considerable for Inventory or a fallback. ZibiWorks has to understand those costs before it chooses how to keep the legacy side informed.
The third requirement is the one this design leans on hardest: the impact on legacy functionality should be as small as possible. Every row in the matrix is a component some team would have to change if it had to read from Fulfillment i
Comments
No comments yet. Start the discussion.