Skip to content
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

Wrong transaction can be passed to external engine [CORE5645] #5911

Closed
firebird-issue-importer opened this issue Oct 19, 2017 · 10 comments
Closed

Comments

@firebird-issue-importer

Submitted by: @artyom-smirnov

Can't give reproducible code+query right now, but may be description may be enough.

In ExtEngineManager.cpp in ExtEngineManager::ExternalContextImpl::setTransaction newTransaction obtained from tdbb and assigned to internalTransaction if newTransaction is differs from internalTransaction, and then externalTransaction created. But if transaction were committed, and by chance object of newly created internal transaction will have same address, new external transaction will not be created, and thus plugin will get wrong transaction.

Commits: 4226f7c a6bd7a5

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 26, 2017

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 26, 2017

Commented by: @asfernandes

Would you please review/test the fixed code in master?

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 26, 2017

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 26, 2017

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Deferred

Test Details: No idea how it can eb implemented uising fbtest. Any suggestions will be appreciated.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 26, 2017

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

Test Details: No idea how it can eb implemented uising fbtest. Any suggestions will be appreciated. => No idea how it can be implemented using fbtest. Any suggestions will be appreciated.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 27, 2017

Commented by: @artyom-smirnov

In some cases I've got NULL in newTransaction, shouldn't getInterface called with 'true'?

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 27, 2017

Commented by: @asfernandes

Pavel, a way to test external engine code:

-------------
create database '/tmp/slave.fdb';
create table persons (
id integer not null,
name varchar(60) not null,
address varchar(60),
info blob sub_type text
);
commit;

create database '/tmp/master.fdb';
create table persons (
id integer not null,
name varchar(60) not null,
address varchar(60),
info blob sub_type text
);

create table replicate_config (
name varchar(31) not null,
data_source varchar(255) not null
);

insert into replicate_config (name, data_source)
values ('ds1', '/tmp/slave.fdb');

create trigger persons_replicate
after insert on persons
external name 'udrcpp_example!replicate!ds1'
engine udr;

create trigger persons_replicate2
after insert on persons
external name 'udrcpp_example!replicate_persons!ds1'
engine udr;

insert into persons values (1, 'One', 'X', 'Y');
commit;

connect '/tmp/slave.fdb';
select * from persons;

-- There must exist a identical record to the one inserted in master and another one identical except that ADDRESS has NULL.
-------------

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 27, 2017

Modified by: @asfernandes

Fix Version: 3.0.3 [ 10810 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 28, 2020

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Deferred => Done successfully

Test Details: No idea how it can be implemented using fbtest. Any suggestions will be appreciated. =>

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 28, 2020

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

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