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

Fix blob errors in Oracle backend issue #1141 #1142

Closed
wants to merge 3 commits into from

Conversation

avpalienko
Copy link

The LOB opening and closing mechanism in Oracle has some restrictions which makes it implicitly usage is dangerous This commit remove the call OCILobOpen from fetching and add some oracle blob tests

The LOB opening and closing mechanism in Oracle has some restrictions which makes it implicitly usage is dangerous
This commit remove the call OCILobOpen from fetching and add some oracle blob tests
@vadz
Copy link
Member

vadz commented Apr 15, 2024

Thanks for the fixes!

I don't know much about LOBs in Oracle, but we definitely shouldn't be keeping this code commented out, if we prefer/have to rely on implicit LOB opening, it should be just removed.

@Krzmbrzl Any comments?

@vadz vadz added the Oracle label Apr 15, 2024
@avpalienko
Copy link
Author

avpalienko commented Apr 15, 2024

Thanks for the fixes!

I don't know much about LOBs in Oracle, but we definitely shouldn't be keeping this code commented out, if we prefer/have to rely on implicit LOB opening, it should be just removed.

It's commented as TODO. It will be good to have an explicit Open/Close for oracle blob in future
Oracle says "These functions allow an application to mark the beginning and end of a series of LOB operations so that specific processing (e.g., updating indexes, etc.) can be performed when a LOB is closed."

Could you restart pipelines, please?

@vadz
Copy link
Member

vadz commented Apr 15, 2024

Thanks for the fixes!
I don't know much about LOBs in Oracle, but we definitely shouldn't be keeping this code commented out, if we prefer/have to rely on implicit LOB opening, it should be just removed.

It's commented as TODO. It will be good to have an explicit Open/Close for oracle blob in future Oracle says "These functions allow an application to mark the beginning and end of a series of LOB operations so that specific processing (e.g., updating indexes, etc.) can be performed when a LOB is closed."

I think we need to either do it now, if it's possible, or remove this completely. Keeping a chunk of code commented out is just never a good idea.

Could you restart pipelines, please?

I had already done it and just did it again but they just keep failing, I have no idea what's going on here but will try to look tomorrow if it still doesn't work then.

@Krzmbrzl
Copy link
Contributor

Do the regular Blob test cases (the Backend independent ones) still work with these changes? I thought I needed explicit opening/closing for consistent-ish behavior across?backends but I don't recall the exact details 👀

@avpalienko
Copy link
Author

I've deleted commented code

@avpalienko
Copy link
Author

Do the regular Blob test cases (the Backend independent ones) still work with these changes? I thought I needed explicit opening/closing for consistent-ish behavior across?backends but I don't recall the exact details 👀

All existing tests are passed

@vadz
Copy link
Member

vadz commented Apr 17, 2024

@Krzmbrzl Do you have any objections to merging this?

Copy link
Contributor

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting is inconsistent with other code parts (the extra space before parenthesis when calling functions for constructing objects is not used anywhere else afaict).
I'll leave it to @vadz to decide whether that needs fixing or not though.

Comment on lines +1420 to +1422
// append does not work (Oracle bug #886191 ?)
// b.append(buf, sizeof(buf));
// assert(b.get_len() == sizeof(buf) + 10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this be? If the common test cases succeed, then that means that

soci/tests/common-tests.h

Lines 6563 to 6566 in 8a5ed87

written_bytes = blob.append(dummy_data + 5, 3);
CHECK(written_bytes == 3);
CHECK(blob.get_len() == 8);

succeeded, which implies that the append function works 🤔

{
blob b ( sql );
sql << "select img from soci_test where id = 7", into ( b );
// assert(b.get_len() == sizeof(buf) + 10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// assert(b.get_len() == sizeof(buf) + 10);

}
};

TEST_CASE ( "Oracle blob", "[oracle][blob]" )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly is this test case testing that is not covered in the test cases shared across backends? The reasoning for having a Oracle-specific Blob test case should probably be written down here as a comment

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have restored the code from previous commits. We can remove it and use common test, but we need add test cases using blob before start transaction and after commit/rollback

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need add test cases using blob before start transaction and after commit/rollback

This would be an Oracle-specific test then as this is undefined behavior in a cross-DB setting (as specified in SOCI docs). So for this specific scenario, a backend-specific test case makes sense

@Krzmbrzl
Copy link
Contributor

Do you have any objections to merging this?

No - as long as the common Blob interface remains functional (which seems to be the case), I'm fine with the changes.

@vadz
Copy link
Member

vadz commented Sep 3, 2024

Sorry, just to confirm: is this still needed even with/after #1145?

@avpalienko
Copy link
Author

Sorry, just to confirm: is this still needed even with/after #1145?

I think no

@avpalienko avpalienko closed this Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants