| Distributed databases are becoming increasingly popular among users due to their high scalability and high consistency.Distributed transactions are an important feature of distributed databases,and improving the isolation and performance of distributed transactions has become one of the research hotspots.However,current distributed transaction protocols still have some issues.In terms of isolation,most protocols have not achieved serializable isolation level,which cannot prevent exceptions during concurrent execution of transactions,thus increasing the complexity of application coding.In terms of performance,there has been no special optimization for the scenario where there are more reads and fewer writes in modern data storage systems,which reduces the execution speed of read-only transactions and affects the overall performance of the database.Therefore,designing a serializable and read-optimized distributed transaction protocol has significant importance.To address the aforementioned issues,this thesis proposes the MS-Percolator protocol,which is designed based on the Percolator distributed transaction protocol and is both serializable and optimized for reads.In terms of isolation,MS-Percolator adds read timestamps to the data and calculates the commit timestamp by collecting read timestamps from the write set data.It also adds a validation phase between the pre-write phase and the commit phase to verify if the data in the read set has changed between the start timestamp and the commit timestamp,thus eliminating read-write conflicts between transactions and achieving serializable isolation level.In terms of performance,MSPercolator optimized for reads uses cached timestamps updated at regular intervals as the start timestamp for transactions,eliminating the overhead of requesting timestamps from the central timestamp allocator when a transaction begins.This improves the performance of read-only transactions in scenarios where there are more reads than writes.When a transaction is unable to read the latest written data,it updates the cached timestamp and restarts the transaction to ensure causal consistency.This thesis implemented a serializable and read-optimized MS-Percolator protocol on TiDB and tests it.The results of the tests demonstrate that the MS-Percolator protocol achieved a serializable isolation level without significantly reducing the database’s read and write performance.Furthermore,after optimizing for read operations,the protocol increased transaction throughput by approximately 6% in scenarios where read operations are significantly more frequent than write operations. |