Assignment1-fall2023-cs223

.pdf

School

University of California, Irvine *

*We aren’t endorsed by this school

Course

223

Subject

Information Systems

Date

Oct 30, 2023

Type

pdf

Pages

3

Uploaded by MegaMusicHornet18

Report
Assignment 1 Due : October 25, 2023, 11:59:59PM PST on Canvas Remember, assignments should be done in groups of size 3. One submission per group. Question 1: Consider an online social network application. The database of the application consists of the following tables: Table 1 (User table): This table maintains users information including a unique id, name, date of birth, and email address. Table 2 (Friendship table): This table stores data about the friendships between users. It includes columns for the IDs of the two users involved in the friendship and a timestamp indicating when the friendship was established. Table 3 (Post table): This table holds information about the posts made by users. It includes fields for the post ID, the user who created the post, the content of the post, how many likes the post has, and a timestamp for when the post was created. Table 4 (Comment table): This table tracks comments made on posts. It includes columns for the comment ID, the user who made the comment, the post to which the comment was added, the comment text, and a timestamp. Write five transactions for this application. For each transaction, provide: A few lines describing the transaction. The pseudocode of the transaction. The transaction representation using b, r(), w(), c, notation. The granularity of these operations is the row level. All transactions you propose must access (read or write) more than one record, and at least one of the operations is a write. At least three of the transactions must access more than one table. Explain briefly why it is important to put the operations in a single transaction. Example (‘:x’ represents inputs): - Transaction 0: A transaction to add a friendship relation between users :1 and :2 - Pseudocode: BEGIN TRANSACTION; -- Check for existence of user with ID :1 user1_exists = SELECT COUNT(*) FROM User WHERE id = :1; -- Check for existence of user with ID :2 user2_exists = SELECT COUNT(*) FROM User WHERE id = :2; -- If both users exist, add a friendship relation IF user1_exists > 0 AND user2_exists > 0 THEN INSERT INTO Friendship(user1_id, user2_id, timestamp) VALUES(:1, :2, NOW()); ELSE ABORT TRANSACTION; END IF;
COMMIT TRANSACTION; - Transaction t representation: b_t r_t(Table User ; id :1) r_t(Table User ; id :2) w_t(Table Friendship ; insert) c_t - Why as a transaction?: Having this as a transaction ensures that a friendship is only added if both users exist (and that one of them is not deleted concurrent to adding the friendship relation). Question 2: Consider the application defined in question 1. For each one of the ACID properties, provide an example of a transaction in this application that would lead to violating one of the ACID properties and why it is incorrect behavior (i.e., provide four examples, one for each property.) Question 3: Consider the application defined in question 1. Construct an example with transactions on the application that would lead to violating isolation if interleaved. 1. Show how the interleaving would lead to incorrect behavior 2. Show how Two-Phase Locking (2PL) would prevent the incorrect behavior. 3. Show how releasing the locks before the end of the transaction (instead of the correct algorithm of 2PL to hold the locks until the end of the transaction) would still lead to incorrect behavior. Question 4: Consider the application in Question 1 and consider that the tables are distributed across different resource managers (come up with a distribution and explain it). - Show an example of a transaction that commits - using 2PC - across more than one participant. - Show a scenario with transactions that illustrate that if the prepare phase was not done (i.e., a commit message is sent without prepare messages and responses), then it would lead to incorrect behavior. - What happens if after the coordinator sends a prepare message - but before it receives the votes - it crashes? Would the transaction commit, abort, or something else? Question 5: Consider the application in Question 1. - Show an example of a transaction and how it can guarantee being recovered by using logging even if a crash happened while executing the transaction. - If the log entry is not persisted before the operation is performed, what will happen?
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help

Browse Popular Homework Q&A

Q: Find the limit algebraically. lim h→0 f(1 +h)-f(1) h where f(x) = -9x² + 4x - 4
Q: get to a non-zero digit.) X 0 1 2 3 4 5 P(x) X 6 7 8 9 10 P(x) plac any as it
Q: Gekko Good Quality Poor Quality Good Quality Wonka = 10 Gekko = 10 Wonka = 12 Gekko = 9 Wonka Poor…
Q: Suppose parametric equations for the line segment between (8, 10) and (4, 1) have the form: a + bt…
Q: Use the rational roots theorem to find the possible roots of the following polynomial equation: 35x3…
Q: Ba - Br covalent F-Br Br - Br Nonpolar covalent Rb-Br lonic 0-Br
Q: 1. Create a vector of time ranging from 0 to 41 seconds with an increment of 0.01 seconds between…
Q: Use the t-distribution to find a confidence interval for a difference in means #₁ - ₂ given the…
Q: If 5 ml of 0.1 M AgNO3 and 1.5 ml of 0.25 M dextrose (C6H12O6) are reacted as in Equation (3), which…
Q: Find the following using the standard normal distribution table.  Sketch the area under        area…
Q: Find an equation of the ellipse that has center (-5, -4), a minor axis of length 6, and a vertex at…
Q: Given that lim f(x) = -5 and lim g(x) = 5, evaluate the following. lim (-f(x) + g(x)) Give your…
Q: From the following Is  Walmart haveing a Medical and Mental Health Centers  is a good idea why or…
Q: Find the probability P(−1.68 ≤ Z ≤ 0).
Q: The ages (in years) of a random sample of shoppers at a gaming store are shown. Determine the range,…
Q: If someone uses the equation (y= -20.5893(x) + 24.3929) to predict the percentage of weeds killed…
Q: what are some contemporary Issues prescription privileges and medical staff privileges
Q: what are some Prescription privileges Pos/Cons
Q: The accompanying table provides data for tar, nicotine, and carbon monoxide (CO) contents in a…
Q: 3. Synthesis: Place reagents in each box below that would produce each product shown in the highest…
Q: The graphs of x = 8, y = f(x) (solid) and y = h(x) (dashed) are shown; the graph is not drawn to…
Q: A company has 12 salespeople and 18 engineers. If a committee of 4 is randomly selected, what is the…