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

TransactionContext Read-Only Interface #1396

Open
@apavlo

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions