Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

TransactionContext Read-Only Interface #1396

Open
apavlo opened this issue Jun 8, 2018 · 0 comments
Open

TransactionContext Read-Only Interface #1396

apavlo opened this issue Jun 8, 2018 · 0 comments
Assignees
Labels

Comments

@apavlo
Copy link
Member

apavlo commented Jun 8, 2018

We need to think about how we want to set the read-only flag for a TransactionContext. There are currently two ways to set this flag:

  1. When the txn is created in TransactionManager::BeginTransaction()
    https://github.com/cmu-db/peloton/blob/master/src/include/concurrency/transaction_manager.h#L226-L228

  2. After it has started using TransactionContext::SetReadOnly():
    https://github.com/cmu-db/peloton/blob/master/src/include/concurrency/transaction_context.h#L273

I first note that TransactionContext::SetReadOnly() does not check whether a txn has already executed a query that modified the database when we set the flag. This could lead to problems if somebody calls this incorrectly. It also doesn't make sense to support this functionality because if the system doesn't know that a txn is read-only when it starts, then it won't know whether it is read-only until commit time.

Things to fix:

  1. Remove the default value for the read_only flag in TransactionManager::BeginTransaction().

  2. Remove the TransactionContext::SetReadOnly() method.

  3. Add a read_only flag to the TransactionContext constructors.
    https://github.com/cmu-db/peloton/blob/master/src/include/concurrency/transaction_context.h#L47-L51

  4. Modify TimestampOrderingTransactionManager::CommitTransaction() so that it checks whether a txn has not executed any modifying queries. If so, then it can then be treated as read-only and commit right away. This should happen after we check whether the read-only flag is set.
    https://github.com/cmu-db/peloton/blob/master/src/concurrency/timestamp_ordering_transaction_manager.cpp#L610

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants