Yujia Zhu, yz10317, yz10317@nyu.edu
For this project, we firstly design two entities: Operation and Transaction, and then two main components for RepCRec: Transaction Manager and Data Site.
Each operation has the following attributes: time, type(read, write or some else), transaction_id(belong to which transaction), site_id(operate on which site), value(for write operation).
Each transaction has the following attributes: id, start_time, end_time, status(waiting or commited), operation_list, locally writes (hasn't committed), write_set, read_set.
-
The Transaction Manager is used to translate read and write requests on variables to read and write requests on copies using the available copy algorithm.
-
Send read and write requests to a Data Site; Monitor the availability of each site and reroutes transactions if a site fails
-
Main functions
begin(t_id, time): starts a new transaction at current time.read(t_id, operation): takes a read type operation as input, return the committed value as output; If a site is down, it retries at another site. Transaction waits if no sites are available.write(t_id, operation): takes a write type operation as input, write all available copies of a variable with the value.dump(): prints out the committed values of all copies of all variables at all sites.validate(t_id, time): report whether a transaction can commit or abort in the formatfail(site_id): cause a site to failrecover(site_id): cause a site to recovercommit(t_id, time): commit a transaction, ensure serializable snapshot isolation using the First Committer Wins rule and by aborting transactions in the presence of consecutive RW edges in a cycle, also check available ruleabort(t_id, time): cause a transaction to abort
-
Stores and manages copies of data items. Data Manager in each site controls access to its local copy of data variables.
-
Receives read and write requests from the Transaction Manager. Reports failure/recovery to Transaction Manager. Handles commit and abort requests based on Transaction Manager instructions.
-
Main functions
get_record(x_id, time): read the last committed variable prior to certain time at this siteupdate_record(x_id, value, time): write a value to variable at this sitefail(): cause this site to failrecover(): recover this site
Environment setting: Cmake 3.31.2, GCC/G++ 14.0.3, GNU Make 3.81
Just run ./build.sh to build the project
Detailed step are listed below
Create a build directory:
mkdir build
cd buildGenerate build files:
cmake ..Build the project:
makeMove executable file to home directory and return back:
mv RepCRec ..
cd ..Just use ./run.sh to run the RepCRec project
Run the project:
## Run without filename, using interactive mode
./RepCRec
## Or run with filename, as input file
./RepCRec <filename>Test files are located in input directory, with an extra file expected_output to explain outcome for each test data.
RepCRec allows these instructions below:
begin(T1): Transaction1beginsR(T1, x1): Transaction1wishes to readx1W(T1, x1, v): Transaction1wishes to write valuevto all available copies ofx1dump(): Prints out committed values for all copies of all variables at all sitesend(T1): Transaction1ends, report whether it can commit or abortfail(1): Site1failsrecover(1): Site1recoversEnd: only for interactive mode, end of all instructions