-
-
Notifications
You must be signed in to change notification settings - Fork 245
Make it possible to start multiple transactions using the same initial transaction snapshot - CORE-6018 #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it possible to start multiple transactions using the same initial transaction snapshot - CORE-6018 #193
Conversation
Good start. But it seems too heavy and complex at the part that ensure shared snapshot existence. When new snapshot is created using another snapshot number, all we need is to ensure that another
Caller application should ensure that base\source transaction is not finished while new transaction Last issue with this approach it how engine should know snapshot number of base transaction. |
What would be the implication if caller get the commit number, finish the transaction and later pass it to the new transaction? Would the part about SnapshotList scanning detect the problem, i.e., like current code detect that TR1 was already finished? |
You mean snapshot number here, correct ?
Sure. If snapshot number to reuse\share is present in SnapshotList while we allocate and fill new slot - it is safe |
@hvlad I changed the code accordingly to your comments. Could you check again? I didn't changed (not even thought about) the SQL command / TPB constant in regard to the change of "base transaction number" to "base snapshot number". |
Much better, thanks.
|
@hvlad a question about the original code: |
Ah, there is the |
Oops, i forget about |
case fb_info_tra_snapshot_cn: | ||
length = INF_convert(static_cast<SINT64>(transaction->tra_snapshot_number), buffer); | ||
break; | ||
|
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.
Seems we have misunderstanding here. At fb-devel we agree that:
I also suggest that new isc_info_tra_snapshot_number returns the same data as SNAPSHOT_CN variable.
Yes, no problem. But for RC it will be NULL as there is no request.
but code above returns 0 for every kind if RC transaction, while SNAPSHOT_CN variable returns request snapshot number, if available.
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.
Transaction info API have no request, so the request snapshot cannot be get. I did returned 0 meaning NULL in this context. How would you want to return NULL on transaction info?
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.
Transaction info API have no request, so the request snapshot cannot be get
Yes. But when we use the same naming (fb_info_tra_snapshot_cn, SNAPSHOT_CN) it suggests that both ways is the equal. Thus i propose to change fb_info_tra_snapshot_cn
by fb_info_tra_snapshot_number
.
As for 0 instead of NULL - no objection of course.
context SYSTEM/SNAPSHOT_CN returns with SNAPSHOT/CONSISTENCY transactions.
3044836
to
c000aba
Compare
|
||
if (!found) | ||
ERR_post(Arg::Gds(isc_tra_snapshot_does_not_exist)); | ||
} |
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.
Probably, it makes sense to add value of missing snapshot number into error message
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.
As string? isc_arg_number is 32-bit...
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.
The same way as isc_concurrent_transaction reports transaction number.
Hmm... is it broken ?
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 believe it is really broken now with 64-bit transaction numbers.
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 do not understand why Num::Num
constructor accepts an intptr_t instead of proper 32 bits.
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.
Because all items put into status-vector array ?
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.
But the constructor parameter does not need to be. But anyway, it does not seems to catch the 64 bits as a warning when changing it.
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.
Time to introduce isc_arg_number2
? :)
With this feature it's possible to create parallel (via different attachments) processes reading consistent data from a database.
For example, a backup process may create multiple threads paralleling read data from the database.
Also a web service may dispatch distributed sub services paralleling doing some processing.
That is accomplished creating a transaction with
SET TRANSACTION SNAPSHOT [ AT NUMBER <snapshot number> ]
orisc_tpb_at_snapshot_number
.The
<snapshot number>
from the first transaction may be obtained withRDB$GET_CONTEXT('SYSTEM', 'SNAPSHOT_NUMBER')
or transaction info call withfb_info_tra_snapshot_number
.Also added CORE-6017 - Add transaction info fb_info_tra_snapshot_number.