Principles Of Distributed Database Systems Exercise Solutions -

Principles Of Distributed Database Systems Exercise Solutions -

If you are looking for resources related to the textbook " Principles of Distributed Database Systems " (by M. Tamer Özsu and Patrick Valduriez), 📚 Official & Academic Resources

Official Author Site: The authors often provide slide decks and supplementary materials. Check the official book website for potential sample solutions or instructor resources.

GitHub Repositories: Many students and researchers post their own implementations of the book's concepts (like join algorithms or deadlock detection). Searching GitHub for "Principles of Distributed Database Systems Solutions" often yields community-driven answer keys.

University Course Pages: Many universities use this as a standard text. Searching for site:.edu "Principles of Distributed Database Systems" assignment solutions can lead to public course archives from past semesters. 🛠️ Common Topics in Exercises Exercises in this field typically focus on:

Data Fragmentation: Defining horizontal and vertical fragments for a given schema.

Distributed Query Optimization: Calculating the cost of distributed joins and semi-joins.

Transaction Management: Solving problems related to 2-Phase Commit (2PC) and distributed deadlock detection.

Reliability Protocols: Analyzing how systems handle site or network failures. 💻 Peer-Shared Solutions

For specific step-by-step answers to the textbook's problems, platforms like Course Hero and Scribd have user-uploaded PDFs. Note that these often require a subscription to view in full.

Are you working on a specific chapter or problem number? If you share the question text, I can help you work through the logic of the solution.


Dr. Elara Vance stared at the error log. It wasn't just red; it was a deep, angry crimson that seemed to pulse on her terminal. Twenty-three nodes in her distributed database cluster, spread across three continents, were returning a "referential integrity anomaly." It was 3:00 AM. The CET-SAT simulation, a global test of their distributed financial ledger, had failed catastrophically.

"Not tonight," she whispered, kneading her temples. The exercise was simple in theory: execute a series of atomic transactions that moved virtual currency between accounts while maintaining ACID properties across the network. The solution, the beautiful theoretical proof on her whiteboard, had promised convergence. Reality, as always, had other plans.

The problem was a phantom read. A classic edge case in multi-version concurrency control (MVCC). Node Alpha in London and Node Gamma in Tokyo had both approved a withdrawal from the same phantom account within 50 milliseconds of each other. Their local timestamps had conflicted, and the global consensus protocol—a modified Paxos—had chosen both. Now the ledger was in a superposition of states: both rich and poor.

Elara pulled up her copy of the instructor's manual, Principles of Distributed Database Systems: Exercise Solutions. It wasn't a book she had written; rather, it was the accumulated wisdom of a hundred previous failures, curated by her mentor, Professor Hideo Tanaka. He called it "The Grimoire."

She flipped to Chapter 9: Global Commit Protocols. Exercise 9.4 read:

Problem: Two-phase commit (2PC) is blocking. Describe a scenario where a coordinator failure leads to an indefinite wait for subordinate nodes. Propose a remedy using three-phase commit (3PC) or Paxos.

The solution in the grimoire was clear. But her current problem wasn't just a blocking coordinator. It was a lying coordinator. Node Alpha's leader had crashed after sending "PREPARE" but before logging its decision. Upon recovery, it had no memory of the transaction. The other nodes, waiting for a "GLOBAL-COMMIT," had timed out and unilaterally aborted—except Node Gamma, which had already applied the withdrawal due to a rogue heuristic.

She reached for the physical, dog-eared copy of the Grimoire. Inside, a handwritten note from Professor Tanaka said: "The exercise is never the storm. The exercise is learning how to patch the hull while the storm is still raging."

The official solution to 9.4 was a Paxos-based replacement for 2PC. But Paxos assumes a fair leader. She didn't have a leader. She had anarchy.

So she closed the book. She would not follow the solution. She would extend it. If you are looking for resources related to

She opened a new terminal window and began to write a corrective algorithm. She called it the "Phoenix Commit."

Step 1 (Detect): Run a distributed diff on the write-ahead logs of all 23 nodes. Find the anomaly: transaction #A442.

Step 2 (Quarantine): 2PC is blocking. 3PC is non-blocking but assumes no network partitions. Phoenix Commit would assume a byzantine failure—a node that lies about its state. She instructed each node to broadcast not just its vote, but its entire log hash since the last global checkpoint.

Step 3 (Reconcile): Use a quorum of 15 nodes (a strict majority + 2) to rebuild the true sequence of events. The majority spoke: Node Gamma had acted alone. The withdrawal from account #LK-99 was invalid.

Step 4 (Heal): Issue a compensating transaction. Not a rollback (that would violate isolation in their current read-committed snapshot), but a reverse transfer with a zero-value timestamp. A ghost transaction that would cancel the error without ever having existed in the official timeline.

She typed the final command:

EXECUTE PHOENIX_COMMIT ('A442', 'HEAL');

Silence.

Then, one by one, the nodes turned from angry red to calm green. Node London. Node Singapore. Node São Paulo. Finally, Node Tokyo. All 23 nodes reported STATE: CONSISTENT. The ledger re-converged. The virtual accounts balanced. The CET-SAT simulation passed with a score of 99.9999%—the 0.0001% being the ephemeral trace of the ghost transaction, a scar that only Elara would ever know to look for.

She leaned back, exhausted. The principles from the textbook—atomicity, consistency, isolation, durability—weren't commandments. They were constraints. And the exercise solutions weren't recipes. They were starting points.

Professor Tanaka's voice echoed from a memory: "The best solution to a distributed systems problem is the one you don't have to deploy. The second best is the one that survives first contact with the enemy—which is always the network, the clock, or your own hubris."

Elara looked at her whiteboard, at the beautiful theoretical proof. Then she looked at her terminal, at the ugly, elegant, 47-line Phoenix Commit patch.

She saved the patch as exercise_9.4_vance_solution.pdf and added a new note to the Grimoire:

Addendum: The official solution works for 99% of failures. For the other 1%, you must be willing to forget the exercise and solve the principle. The principle is not "don't fail." The principle is "fail in a way you can survive."

Outside, dawn bled over the data center. The distributed database hummed, its 23 hearts beating in silent agreement. And Elara Vance, for the first time that night, smiled.

The storm had passed. The hull was patched. And the ledger was true.

Introduction

Distributed database systems have become increasingly popular in recent years due to the growing need for scalable and fault-tolerant data storage and retrieval. A distributed database system is a collection of multiple databases that are connected through a network, allowing data to be shared and accessed across different locations. In this essay, we will discuss the principles of distributed database systems and provide solutions to common exercises.

Principles of Distributed Database Systems Problem: Two-phase commit (2PC) is blocking

There are several key principles that govern the design and implementation of distributed database systems. These include:

  1. Fragmentation: Fragmentation refers to the process of dividing a large database into smaller fragments that can be stored on different nodes in the system. This allows for more efficient data storage and retrieval, as well as improved fault tolerance.
  2. Replication: Replication involves maintaining multiple copies of data on different nodes in the system. This ensures that data is always available, even in the event of node failures.
  3. Distribution: Distribution refers to the process of allocating data fragments to different nodes in the system. This involves determining which nodes should store which fragments of data, and how data should be retrieved from multiple nodes.
  4. Autonomy: Autonomy refers to the ability of each node in the system to operate independently, making its own decisions about data storage and retrieval.

Exercise Solutions

Here are solutions to some common exercises in distributed database systems:

Exercise 1: Fragmentation and Replication

Suppose we have a large database that contains information about customers, orders, and products. We want to fragment this database into smaller pieces that can be stored on different nodes in the system.

Solution:

We can fragment the database into three fragments:

We can then replicate each fragment on multiple nodes in the system, for example:

This ensures that data is always available, even in the event of node failures.

Exercise 2: Distributed Query Processing

Suppose we have a distributed database system with three nodes, each storing a different fragment of a large database. We want to process a query that retrieves all customers who have placed an order for a specific product.

Solution:

We can process this query using the following steps:

  1. Node 1: Receive query from user and fragment it into smaller sub-queries that can be executed on each node.
  2. Node 2: Execute sub-query on orders fragment to retrieve customer IDs who have placed an order for the specific product.
  3. Node 3: Execute sub-query on products fragment to retrieve product information.
  4. Node 1: Combine results from Node 2 and Node 3 to retrieve all customers who have placed an order for the specific product.

Exercise 3: Distributed Transaction Management

Suppose we have a distributed database system with two nodes, each storing a different fragment of a large database. We want to execute a transaction that updates the customer address on Node 1 and also updates the corresponding order information on Node 2.

Solution:

We can execute this transaction using the following steps:

  1. Node 1: Begin transaction and update customer address.
  2. Node 2: Begin transaction and update order information.
  3. Node 1: Prepare transaction for commit.
  4. Node 2: Prepare transaction for commit.
  5. Node 1: Commit transaction.
  6. Node 2: Commit transaction.

This ensures that the transaction is executed atomically and consistently across both nodes.

Conclusion

In conclusion, distributed database systems are complex systems that require careful consideration of several key principles, including fragmentation, replication, distribution, and autonomy. By understanding these principles and applying them to common exercises, we can design and implement efficient and fault-tolerant distributed database systems. The solutions provided in this essay demonstrate how to apply these principles to real-world problems, and provide a foundation for further study and exploration of distributed database systems.


9. Performance and correctness trade-offs


5. Replication & consistency


Exercise 4.1 – Two-Phase Commit (2PC) Failure Scenario

Scenario:
Coordinator C, Participants P1, P2. All vote YES. Coordinator sends COMMIT, fails after writing COMMIT log but before sending to P2. P1 receives COMMIT, P2 still in READY state.

Question: Can the protocol guarantee atomicity? How is recovery handled?

Solution:
Yes, atomicity is guaranteed.

11. Answer structure (for written exercise solutions)

  1. Short intro: specify model & assumptions (1–2 lines).
  2. Key idea/approach (one sentence).
  3. Step-by-step derivation or algorithm (numbered steps).
  4. Small worked example or table of states.
  5. Final conclusion and complexity/cost summary (messages, rounds, time).

Exercise 2: Cost-Based Optimization

Problem:

Compare the cost of:

  1. Moving $R$ to Site 2.
  2. Moving $S$ to Site 1.
  3. Using a Semi-Join strategy.

Solution:

Strategy 1: Move R to Site 2

Strategy 2: Move S to Site 1

Strategy 3: Semi-Join (Reduce R before moving) Step 1: Send join column of $S$ to Site 1.

Step 2: Reduce $R$ at Site 1.

Step 3: Send $R'$ to Site 2 (if result needed there) or proceed.

Comparison:


4. Use formal tools where useful


2. Distributed Query Processing: Semi-Join Reduction

A classic exercise is to optimize a distributed join between two relations stored at different sites using semi-joins.

Exercise 4.1: Two-Phase Commit (2PC) with Coordinator Failure

Problem:
Participants P1, P2, P3. Coordinator C sends PREPARE, receives YES from all, sends COMMIT to P1 and P2, then crashes before sending to P3. What happens?

Solution:
2PC protocol guarantees atomicity.

Step 1 – P1 and P2 receive COMMIT: commit locally (enter committed state).
Step 2 – P3 still in “ready” state (voted YES, waiting for commit/abort).
Step 3 – After recovery, coordinator checks log: finds COMMIT decision. Sends COMMIT to P3.
Step 4 – P3 commits.

But what if coordinator crashes before writing COMMIT decision? Then all participants waiting. They timeout and ask each other. If any participant has committed (e.g., P1), then P3 must commit. This is the “presumed commit” protocol.

Answer: Upon restart, coordinator sends COMMIT to P3 (if decision logged). If no decision logged and some participant already committed (via unilateral decision), P3 must commit → but this violates 2PC’s blocking property? Actually, 2PC can block if coordinator crashes without decision. That’s why 3PC is non-blocking. P3. Coordinator C sends PREPARE

Главная / Радио онлайн / ТВ онлайн / Настройки / О сайте / Правообладателям

© 2022 Радио и ТВ онлайн

Все права на аудио и видео материалы, представленные на нашем сайте принадлежат их законным владельцам.

Обратная связь:

Вверх