- Notifications
You must be signed in to change notification settings - Fork620
Read-Only TxnContext Interface; Read-Only (single-statement select, txn) optimizations#1402
base:master
Are you sure you want to change the base?
Conversation
lmwnshn commentedJun 11, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Currently, I am only failing copy_test (1/181). If I add traffic_cop.SetStatement(statement) to copy_testhere, I will pass. The question is, should I do that? I'm looking into what else is using SetStatement right now. |
apavlo left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
| // if no modifying queries, treat as read-only | ||
| if (rw_set.empty()) { | ||
| EndTransaction(current_txn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I would just add aLOG_TRACE statement here to record what is happening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Added
coveralls commentedJun 12, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
| auto &rw_set = current_txn->GetReadWriteSet(); | ||
| // if no modifying queries, treat as read-only | ||
| if (rw_set.empty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Based on the implementation of the is_written_ flag in#1401 could we also check the is_written_ flag here? That would tell us if the RWSet is just reads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@mbutrovich I've tried changing it to use is_written_ instead of empty(), but I keep breaking onmulti_granularity_access_test. Did you and/or@pervazea say something about SCAN being broken earlier?
In particular, I added an IsWritten() getter and the check became if (!current_txn->IsWritten()). Haven't been able to find the bug, for now, I'm leaving it as empty().
mbutrovich commentedJun 18, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The more I look at this, the more it seems like we're building a hack on top of an unstable foundation -- at least part 4 of@lmwnshn's description. We're trying to find a shortcut if the RWSet only contains Reads/is empty. However, we shouldn't even be putting Reads in the RWSet in the first place.@yingjunwusays as much. The only reason we even add READ_OWNs is for releasing the write lock at Commit/Abort. Commit and Abort do nothing if an element is READ when they iterate through the RWSet, so they shouldn't really be there in the first place. This PR looks fine on its own, but it seems like a workaround for what a larger design issue that should be addressed. |
yingjunwu commentedJun 18, 2018
I am not sure what you guys are currently working on, but I wanna mention that the original rwset was design to be general enough -- We didn't assume the underlying CC protocol, and the rwset was supposed to be compatible with any protocol, like OCC and 2PL. While our experiments show that timestamp ordering performs best, it seems that some people (e.g., Phil Bernstein) have a strong faith in 2PL :-) |
mbutrovich commentedJun 18, 2018
So that’s sort of emblematic of the issues I feel like I’m finding in the current system. Things like maitaining a doubly-linked version chain, reads getting added to the RWSet, etc. seem to be preventing us from making the best MVTO system possible. I definitely see why it was necessary in the context of comparing CC systems, but if MVTO is what we’re sticking with I think we can improve it. |
apavlo commentedJun 21, 2018
@mbutrovich Do we want to merge this PR? |
mbutrovich commentedJun 25, 2018
2a965b2 toe24ddafComparelmwnshn commentedJun 26, 2018
@mbutrovich Undid the formatting changes |
mbutrovich left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Let's discuss the object stuff. It might be as simple as moving the check later in CommitTransaction, or maybe relying on a different flag that nothing was dropped.
| LOG_TRACE("Transaction not yet written, ending transaction."); | ||
| EndTransaction(current_txn); | ||
| return ResultType::SUCCESS; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
What happens if the transaction just drops an object, like an index?IsWritten will still return false since that doesn't touch theRWSet yet we'll directly commit the transaction without adding the objects to thegc_object_set. I'm not sure we support drop index yet, but I foresee problems with this.
mbutrovich commentedJun 28, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I can't get your change for#1395 to work. I put a breakpointhere and then ran the following in psql: The breakpoint doesn't trigger with the second |
Uh oh!
There was an error while loading.Please reload this page.
#1396
4.1 assumption: if transaction is marked read-only, then READ transactions are not added to ReadWriteSet
#1395Single-statement selects are marked asread-only
Unable to exercise this code path, possibly due to#1441