Skip to content

Oracle and testsuite fixes - #3583

Closed
butonic wants to merge 28 commits into
masterfrom
oracle_and_testsuite_fixes
Closed

butonic wants to merge 28 commits into
masterfrom
oracle_and_testsuite_fixes

Conversation

@butonic

@butonic butonic commented Jun 3, 2013

Copy link
Copy Markdown
Contributor

got the testsuite to execute on oracle:

  • added error checks and logging
  • missing backticks all over the place
  • WIP: encryption webdav tests seem to run indefinetly on oracle, still investigating, hints welcome

@karlitschek @DeepDiver1975 @tanghus @Raydiation @icewind1991 @MTGap @schiesbn

@butonic

butonic commented Jun 3, 2013

Copy link
Copy Markdown
Contributor Author

also ae612f5 fixes #2371

@karlitschek

Copy link
Copy Markdown
Contributor

👍

Comment thread lib/connector/sabre/locks.php Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add a comment explaining why to_char is necessary?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The query is still pretty much the same, so reuse everything except the uri part?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, other than the to_char the queries are the same. oracle needs a hack to enable comparing CLOB columns to strings.

regarding reusing everything except the uri part. I very much prefer complete sql queries over a statement that is assembled by concatenating several parts for a reason: readability. Try to follow the sql queries that are used in the sharing code and you can see an example of sql that is well, cut to pieces. There it might even be necessary to handle different cases. Forthermore, some of the IDEs around allow you to execute SQL with prepared statements when they are written as a single string (some also allow concatenated strings, but they fail when adding $variables)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@butonic So, if you have a query with n combinations, you write down 2^n queries?

You seem to have added a comment saying "//FIXME oracle hack" now. How about you turn that into something useful to the next reader? E.g. (using the information you just gave me) "//FIXME Need to explicitly cast CLOB to CHAR for comparison on Oracle"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@bantu depends on the tradeoff. Code should be optimized for human readability when not loosing performance. Furthermore, when having to deal with 2^n queries that cannot be handled with prepared statements there is something fundamentally wrong with the code. In this case I have been lamenting about CLOB columns for nearly half a year and used a fork without them to have oracle running at a customer. I'm glad I can now fallback to the to_char workaround, although we will have to measure the performance impact. But first, can we focus on making OC5 work on oracle - at all.

@butonic

butonic commented Jun 3, 2013

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 couldn't resist. strict mode working fine on sqlite, mysql and oracle. postgres untested.
I know we might run into timing issues, especially on a VM we should test that in this branch. I can remove it if we run into problems.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

I'm fine with it

Am Montag, dem 03.06.2013 um 21:52 schrieb Jörn Friedrich Dreyer:

@DeepDiver1975 couldn't resist. strict mode working fine on sqlite, mysql and oracle. postgres untested.
I know we might run into timing issues, especially on a VM we should test that in this branch. I can remove it if we run into problems.


Reply to this email directly or view it on GitHub:
#3583 (comment)

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@owncloud-bot retest this please

1 similar comment
@DeepDiver1975

Copy link
Copy Markdown
Contributor

@owncloud-bot retest this please

@butonic

butonic commented Jun 4, 2013

Copy link
Copy Markdown
Contributor Author

@Raydiation The apptemplateadvanced table Name is too long, producing a sequence name oft more than 30 characters, which is not supported in Oracle. Can I just rename it to apptmpladv?

@schiessle

Copy link
Copy Markdown
Contributor

I had a look at the code, mainly to the changes on the encryption app, looks good!

@butonic

butonic commented Jun 4, 2013

Copy link
Copy Markdown
Contributor Author

damn, contacts and calendar also seem to have problems ... on it

@butonic

butonic commented Jun 4, 2013

Copy link
Copy Markdown
Contributor Author

@georgehrke @tanghus could you shorten the table names of contacts and calendar to at most 30-3-4=23 chars?
Oracle only supports 30 characters. The prefix oc_ is 3 characters and sequences add _seq to the table name.

Another quick solution would be to not install these apps when testing oracle. @DeepDiver1975 disabling these apps is not enough. The code needs to be deleted to prevent the installation. Maybe we can do than in autotest.sh, but I don't know if that will interfere with the other tests or how and when their cod is checked out. Any idea?

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@butonic contacts and calendar repos are not pulled into the jenkins job - how do they get there?
Or did I miss understand your question?

@butonic

butonic commented Jun 5, 2013

Copy link
Copy Markdown
Contributor Author

@owncloud-bot retest this please

1 similar comment
@butonic

butonic commented Jun 5, 2013

Copy link
Copy Markdown
Contributor Author

@owncloud-bot retest this please

@butonic

butonic commented Jun 6, 2013

Copy link
Copy Markdown
Contributor Author

before:

........................................IIISS..SSEEEEEEF.FF...F  63 / 499 ( 12%)
.F.FF..FFFFFFFF................................................ 126 / 499 ( 25%)
..F.....F..F..............................IIIII...............I 189 / 499 ( 37%)
IIII.............I....FE......................E..E............. 252 / 499 ( 50%)
..................................................EE........E.. 315 / 499 ( 63%)
.E...........................IE................................ 378 / 499 ( 75%)
............................................................... 441 / 499 ( 88%)
...........I..............F...................FSSFFFEFF..F

@butonic

butonic commented Jun 6, 2013

Copy link
Copy Markdown
Contributor Author

Status update for OC5 on Oracle in PhPUnit words:

........................................IIISS..SSEEEEEE.......F  63 / 499 ( 12%)
...FF.......................................................... 126 / 499 ( 25%)
..F.......................................IIIII...............I 189 / 499 ( 37%)
IIII.............I....FE......................E..E............. 252 / 499 ( 50%)
..................................................EE........E.. 315 / 499 ( 63%)
.E...........................IE................................ 378 / 499 ( 75%)
............................................................... 441 / 499 ( 88%)
.....E.....I..................................FSS........

@karlitschek @MTRichards @msrex status update for OC5 on Oracle in words: breakthrough - I can install, login, fill and update the filecache, browse the web ui, enabel and disable apps. trash seems to work as well. I'll keep you posted.

@butonic

butonic commented Jun 6, 2013

Copy link
Copy Markdown
Contributor Author

Woooohooooooo!!!! @DeepDiver1975 @karlitschek @tanghus @Raydiation @icewind1991 @MTGap @schiesbn testsuite completing on oracle. I had to throw exceptions instead of just dying. But I consider this better practice anyway. This can be improved, but I'd like to get this in ASAP to have everything also tested on oracle.

When this reaches 3 👍 I'll merge

@butonic

butonic commented Jun 6, 2013

Copy link
Copy Markdown
Contributor Author

maybe I can also get 👍 from testing friends such as @bartv2 @blizzz or @kabum

@butonic

butonic commented Jun 6, 2013

Copy link
Copy Markdown
Contributor Author

Oh, this also requires fixes in the MDB2 oracle code that I commited to 3rdparty. I know this is against the rules ... well oracle is an abomination in itself ... I'll submit a PR to upstream when this is merged.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Awesome! Let's nominate @butonic for Oracle Masochist of the year! 

I'll have a look tomorrow. 

Thx

PS: I'll join your pain as soon as we get mssql available for ci.

Comment thread db_structure.xml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why was this necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Empty strings are considered null by oracle. #2389 uses the big hammer but just hides the problem. I think the cache stores '' for storage root nodes. I assume other columns with this problem will surface too. For now, this will allow the file scan to complete successfully.

@MTGap

MTGap commented Jun 6, 2013

Copy link
Copy Markdown
Contributor

I don't understand why some database queries have isError($result). This is rather annoying, that sort of thing should be done by the database class.

@butonic

butonic commented Jun 6, 2013

Copy link
Copy Markdown
Contributor Author

I agree that the isError() check should be handled by the database, unfortunately we can only add this to the PDOStatementWrapper. Currently I see unchecked db queries everywhere, which makes debugging impossible, and is the reason why I added the checks with isError() in the first place. I hope you agree that we should use exceptions which I started with throwExceptionOnError($result). I guess what we really want to do is introduce a wrapper around the pdo and mdb2 prepared statements. Buuuuuut thats out of scope for this PR.

Maybe we should implement a wrapper method OC_DB::execute($statement, $params) that executes the PDO/MDB2 statement and checks the result, logs errors and throws an exception.

@DeepDiver1975 @MTGap @bartv2 @karlitschek opinions?

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Maybe we should implement a wrapper method OC_DB::execute($statement, $params) that executes the PDO/MDB2 statement and checks the result, logs errors and throws an exception.

sounds better than isError() everywhere - but I cannot judge the impact of that change because as of today we don't catch these exceptions. The behavior is unpredictable - at least for me.

But we should just give it a try!

@butonic

butonic commented Jun 7, 2013

Copy link
Copy Markdown
Contributor Author

rebased

@butonic

butonic commented Jun 7, 2013

Copy link
Copy Markdown
Contributor Author

@MTGap @DeepDiver1975 @karlitschek @bartv2 @icewind1991 @schiesbn I added an OC_DB::executeAudited() which does some sanity checks and even handles creating a prepared statement when passed a string or an array with 'sql', 'limit' and 'offset' keys. The local testsuite is running fine and it revealed two other unquoted identifiers. Schema tests just reveal the known oracle problems.

I'd like to get this in as it is to get master tested on oracle. @DeepDiver1975 we can just catch exceptions in the index.php and show a message to the user. We are now at least getting a log for everything.

@karlitschek

Copy link
Copy Markdown
Contributor

👍

@butonic

butonic commented Jun 7, 2013

Copy link
Copy Markdown
Contributor Author

@owncloud-bot retest this please

@DeepDiver1975

Copy link
Copy Markdown
Contributor

We need to catch exceptions in index, public, remote, cron

Where else?

-------- Ursprüngliche Nachricht --------
Von: Jörn Friedrich Dreyer [email protected]
Datum:
An: owncloud/core [email protected]
Cc: Thomas Müller [email protected]
Betreff: Re: [core] Oracle and testsuite fixes (#3583)

@MTGap @DeepDiver1975 @karlitschek @bartv2 @icewind1991 @schiesbn I added an OC_DB::executeAudited() which does some sanity checks and even handles creating a prepared statement when passed a string or an array with 'sql', 'limit' and 'offset' keys. The local testsuite is running fine and it revealed two other unquoted identifiers. Schema tests just reveal the known oracle problems.

I'd like to get this in as it is to get master tested on oracle. @DeepDiver1975 we can just catch exceptions in the index.php and show a message to the user. We are now at least getting a log for everything.

—
Reply to this email directly or view it on GitHub.

@butonic

butonic commented Jun 7, 2013

Copy link
Copy Markdown
Contributor Author

not in the tests so they can bubble up and get logged ;)

@butonic

butonic commented Jun 10, 2013

Copy link
Copy Markdown
Contributor Author

I'll split this PR up into more digestable parts

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants