This program is about implementation of replication algorithm on simple database tables through the transactions [login to view URL] can be done in
JAVA and it requires some database concepts to complete the program.
## Deliverables
** Create 5 flat file structures D1,D2,D3,D4,D5**
**Assume the databases are connected as shown below:**
** **
** Look in the ZIP file attached**
** **
Transactions are presented to the database.
A transaction is specified as follows:
** **
** **
**Transaction :::= <T_number : start_time, Database> <T_Op,time>* <END>**
** **
· T_Op ::= <READ [login to view URL]> | <WRTIE rec> | <[login to view URL] =[login to view URL] + value> | <[login to view URL] = [login to view URL] ??" value>
* means that this may be repeated
| means an OR
· [login to view URL] (primary key of rec), time, start_time, value, [login to view URL] (a field
of rec) are numeric values
· T_number is the number of the transaction (T1, T2, …)
· start_time is the time the transaction starts
· time is the time it takes for the operation to execute
· rec is the name assigned to a record
· pk is the primary key
· [login to view URL] is a feld in rec
· READ([login to view URL]) reads from database a record rec whose primary key is pk
· WRITE(rec) writes to database the record rec.
Database is one of the 5 databases D1, D2,…, D5
** **
**Example of a transaction::**
** **
T1:0 \\transactionT1 starts at time 0
READ R1.5,5 \\read the record whose primary key is 5 and store the
record in R1. It takes 5 time units for this to execute
READ R2.10,4 \\read the record whose primary key is 10 and store the
record in R2 It takes 4 time units for this to execute
[login to view URL] = [login to view URL] + 10,6 \add 10 to the age field. It takes 6 time units
[login to view URL] = [login to view URL] + 3,2 \add 3 to the age field. It takes 2 time units
WRITE R1,3 \\ save the updated record to the database. It takes 3 time
units
WRITE R2,1 \save the updated record to the database. It takes 1 time
Unit
END \end of transaction
Task
**There is no replicated data in the databases.**
**Use a dynamic replication algorithm to replicate data in this distributed system.**
**Task 1:** Write a dynamic replication algorithm.
**Task 2:** Write a program to implement your algorithm written in task 1.
The input to the program will be a set of transactions as specified above. The
transaction inputs will all be syntactically correct. Each transaction will be input in its
entirety and in chronological order, that is, T1, T2, T3 …
The output will show the contents of:
- each database before and after each transaction executes
- the log at each of the databases before and after each transaction executes.
**Assumptions:**
** **
- A block size of 5 In other words when replication takes place only 5 rows can be
replicated at one time.
- Each block holds rows 1 to 5, 6 to 10 etc of a table.
- To make matters simpler, assume that there is only one table, but the table is
partitioned across the different databases in the initial state. For example, rows 1 ??"
100 are in D1, 101 ??" 500 in D2, 501 ??" 1000 in D3, 1001 ??" 1200 in D4 and 1201 to
1500 in D5
**Report.:** The report will:
- describe the dynamic replication algorithm. The algorithm should be presented in
algorithmic form.
- outline implementation details
- provide instructions to create the databases D1 to D5
- provide instructions to input transactions
- view the contents of each database before execution starts and after execution of
each transaction
- view the contents of each log before execution starts and after execution of each
transaction
- provide instructions to the user of you system to compile your program, run your
program, create databases, view contents of each database and log.