[jira] [Comment Edited] (OAK-8918) RDBBlobStore: warn when legacy (SQLServer) default collation is active

2023-09-13 Thread Julian Reschke (Jira)


[ 
https://issues.apache.org/jira/browse/OAK-8918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17093793#comment-17093793
 ] 

Julian Reschke edited comment on OAK-8918 at 9/13/23 7:47 AM:
--

trunk: (1.26.0) 
[453908eb0a|https://github.com/apache/jackrabbit-oak/commit/453908eb0aaf06141969d1fdcd4b28eaea906b26]
1.22: (1.22.2) 
[fbc40ca106|https://github.com/apache/jackrabbit-oak/commit/fbc40ca1066533e45b180330c85e7990bc15c5e9]

...in retired branches:
1.10: 
[9382863b55|https://github.com/apache/jackrabbit-oak/commit/9382863b558aa2887238fd8b1a5ce74047ddd533]
1.8: (1.8.22) 
[322acca6fd|https://github.com/apache/jackrabbit-oak/commit/322acca6fdefd940a21479e55009a49f5a482b84]



was (Author: reschke):
trunk: (1.26.0) [r1874271|http://svn.apache.org/r1874271]
1.22: (1.22.2) [r1874838|http://svn.apache.org/r1874838]
1.8: [r1877087|http://svn.apache.org/r1877087]

...in retired branches:
1.10: [r1875416|http://svn.apache.org/r1875416]


> RDBBlobStore: warn when legacy (SQLServer) default collation is active
> --
>
> Key: OAK-8918
> URL: https://issues.apache.org/jira/browse/OAK-8918
> Project: Jackrabbit Oak
>  Issue Type: Technical task
>  Components: rdbmk
>Reporter: Julian Reschke
>Assignee: Julian Reschke
>Priority: Minor
>  Labels: candidate_oak_1_22
> Fix For: 1.26.0, 1.22.2, 1.8.22
>
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Comment Edited] (OAK-8918) RDBBlobStore: warn when legacy (SQLServer) default collation is active

2020-03-20 Thread Solomon Rutzky (Jira)


[ 
https://issues.apache.org/jira/browse/OAK-8918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17063685#comment-17063685
 ] 

Solomon Rutzky edited comment on OAK-8918 at 3/21/20, 3:36 AM:
---

Hi [~reschke]. I just looked at the code a little more closely and noticed a 
minor issue with these changes. Assuming that the "collation_name" value on 
this line:

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStoreDB.java?revision=1874271=markup#l83]

 

comes from this line:

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBCommonVendorSpecificCode.java?revision=1874174=markup#l96]

 

then the warning message on this line (i.e. "Default server collation is..."):

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStoreDB.java?revision=1874271=markup#l85]

 

is not entirely correct. The collation being discovered in 
RDBCommonVendorSpecificCode via {{sys.databases}} is the _database_ default 
collation, not the server (or instance) default collation. While they are often 
the same, there is no guarantee that they are the same. And to be clear, the 
database collation is the more correct choice, so the warning message should be 
updated to reflect that.

Now, to be even more pedantic, the {{ID}} column uses the database's default 
collation because the {{COLLATE}} clause is not ( yet: OAK-8963 ) specified. 
The assumption here is that the database's default collation has not changed 
since the tables were created. Again, this is true most of the time, but cannot 
be guaranteed. At the very least it should be noted that, in the current state 
of the code (assuming the commits noted in this issue), it's at least 
_possible_ that a false positive will result in the user being shown a warning 
for a situation that is, in fact, _not_ a problem (e.g. if the DB's collation 
is changed from a non-"SQL_" collation to a "SQL_" collation after the tables 
were created).

*IN FACT*, now that I have explained the steps of that scenario I realize that 
even in the case where the column's collation does match the database's default 
collation, and that collation is a "{{SQL_*}}" collation, if the user gets the 
warning message and makes the change recommended in OAK-8908 (i.e. changing the 
collation of the two ID columns to {{Latin1_General_BIN}} ), then they will 
_still_ receive this warning because the code isn't checking the collation of 
the _columns_. Hence, it would seem that this issue has been implemented 
incorrectly, and should instead be changed to:

 
{code:sql}
SELECT col.[collation_name]
FROM sys.columns col
WHERE col.[object_id] = OBJECT_ID(?)
AND col.[name] = N'ID'; 
{code}
 

where the "{{?}}" is set to "{{tableName}}". Just call it twice, once for each 
table.

 


was (Author: solomon.rutzky):
Hi [~reschke]. I just looked at the code a little more closely and noticed a 
minor issue with these changes. Assuming that the "collation_name" value on 
this line:

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStoreDB.java?revision=1874271=markup#l83]

 

comes from this line:

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBCommonVendorSpecificCode.java?revision=1874174=markup#l96]

 

then the warning message on this line (i.e. "Default server collation is..."):

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStoreDB.java?revision=1874271=markup#l85]

 

is not entirely correct. The collation being discovered in 
RDBCommonVendorSpecificCode via {{sys.databases}} is the _database_ default 
collation, not the server (or instance) default collation. While they are often 
the same, there is no guarantee that they are the same. And to be clear, the 
database collation is the more correct choice, so the warning message should be 
updated to reflect that.

Now, to be even more pedantic, the {{ID}} column uses the database's default 
collation because the {{COLLATE}} clause is not ( yet ) specified. The 
assumption here is that the database's default collation has not changed since 
the tables were created. Again, this is true most of the time, but cannot be 
guaranteed. At the very least it should be noted that, in the current state of 
the code (assuming the commits noted in this issue), it's at least _possible_ 
that a false positive will result in the user being shown a warning for a 
situation that is, in fact, _not_ a problem (e.g. if the DB's collation is 
changed from a non-"SQL_" collation to a 

[jira] [Comment Edited] (OAK-8918) RDBBlobStore: warn when legacy (SQLServer) default collation is active

2020-03-20 Thread Solomon Rutzky (Jira)


[ 
https://issues.apache.org/jira/browse/OAK-8918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17063685#comment-17063685
 ] 

Solomon Rutzky edited comment on OAK-8918 at 3/21/20, 3:34 AM:
---

Hi [~reschke]. I just looked at the code a little more closely and noticed a 
minor issue with these changes. Assuming that the "collation_name" value on 
this line:

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStoreDB.java?revision=1874271=markup#l83]

 

comes from this line:

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBCommonVendorSpecificCode.java?revision=1874174=markup#l96]

 

then the warning message on this line (i.e. "Default server collation is..."):

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStoreDB.java?revision=1874271=markup#l85]

 

is not entirely correct. The collation being discovered in 
RDBCommonVendorSpecificCode via {{sys.databases}} is the _database_ default 
collation, not the server (or instance) default collation. While they are often 
the same, there is no guarantee that they are the same. And to be clear, the 
database collation is the more correct choice, so the warning message should be 
updated to reflect that.

Now, to be even more pedantic, the {{ID}} column uses the database's default 
collation because the {{COLLATE}} clause is not ( yet ) specified. The 
assumption here is that the database's default collation has not changed since 
the tables were created. Again, this is true most of the time, but cannot be 
guaranteed. At the very least it should be noted that, in the current state of 
the code (assuming the commits noted in this issue), it's at least _possible_ 
that a false positive will result in the user being shown a warning for a 
situation that is, in fact, _not_ a problem (e.g. if the DB's collation is 
changed from a non-"SQL_" collation to a "SQL_" collation after the tables were 
created).

*IN FACT*, now that I have explained the steps of that scenario I realize that 
even in the case where the column's collation does match the database's default 
collation, and that collation is a "{{SQL_*}}" collation, if the user gets the 
warning message and makes the change recommended in OAK-8908 (i.e. changing the 
collation of the two ID columns to {{Latin1_General_BIN}} ), then they will 
_still_ receive this warning because the code isn't checking the collation of 
the _columns_. Hence, it would seem that this issue has been implemented 
incorrectly, and should instead be changed to:

 
{code:sql}
SELECT col.[collation_name]
FROM sys.columns col
WHERE col.[object_id] = OBJECT_ID(?)
AND col.[name] = N'ID'; 
{code}
 

where the "{{?}}" is set to "{{tableName}}". Just call it twice, once for each 
table.

 


was (Author: solomon.rutzky):
Hi [~reschke]. I just looked at the code a little bit closer and noticed a 
minor issue with these changes. Assuming that the "collation_name" value on 
this line:

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStoreDB.java?revision=1874271=markup#l83]

 

comes from this line:

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBCommonVendorSpecificCode.java?revision=1874174=markup#l96]

 

then the warning message on this line (i.e. "Default server collation is..."):

[http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStoreDB.java?revision=1874271=markup#l85]

 

is not entirely correct. The collation being discovered in 
RDBCommonVendorSpecificCode via {{sys.databases}} is the _database_ default 
collation, not the server (or instance) default collation. While they are often 
the same, there is no guarantee that they are the same.

 

Now, to be even more pedantic, the {{ID}} column uses the database's default 
collation because the {{COLLATE}} clause is not (yet) specified. The assumption 
here is that the database's default collation has not changed since the tables 
were created. Again, this is true most of the time, but cannot be guaranteed. 
I'm not sure how much effort should be spent in being 100% accurate here, but 
at the very least it should be noted that in the current state of the code 
(assuming the commits noted in this issue), it is at least _possible_ that a 
false positive will result in the user being shown a warning for a situation 
that is, in fact, _not_ a problem.

*IN FACT*, even in the case where the column's collation does match the 
database's default collation, and that collation is a 

[jira] [Comment Edited] (OAK-8918) RDBBlobStore: warn when legacy (SQLServer) default collation is active

2020-03-16 Thread Solomon Rutzky (Jira)


[ 
https://issues.apache.org/jira/browse/OAK-8918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17059980#comment-17059980
 ] 

Solomon Rutzky edited comment on OAK-8918 at 3/16/20, 6:27 AM:
---

While it's probably not a bad thing that this condition is being checked for, 
this code really shouldn't even be necessary given the two solutions I noted in 
my comment on 
[OAK-8908|https://issues.apache.org/jira/browse/OAK-8908?focusedCommentId=17059698=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17059698].
 Ideally, the datatype of the two {{ID}} columns would be {{VARBINARY(32)}} (or 
even {{BINARY(32)}} if there will always be 32 bytes), thus there is no 
collation to deal with. Or, if that's not possible, then at least use a binary 
collation in the {{CREATE TABLE}} statements (which will be faster than your 
current setup).

 

Take care,
Solomon...
[https://SqlQuantumLift.com/|https://sqlquantumlift.com/]
[https://SqlQuantumLeap.com/|https://sqlquantumleap.com/]
[https://SQLsharp.com/|https://sqlsharp.com/]

 


was (Author: solomon.rutzky):
While it's probably not a bad thing that this condition is being checked for, 
this code really shouldn't even be necessary given the two solutions I noted in 
my comment on OAK-8908. Ideally, the datatype of the two {{ID}} columns would 
be {{VARBINARY(32)}} (or even {{BINARY(32)}} if there will always be 32 bytes), 
thus there is no collation to deal with. Or, if that's not possible, then at 
least use a binary collation in the {{CREATE TABLE}} statements (which will be 
faster than your current setup).

 

Take care,
Solomon...
[https://SqlQuantumLift.com/|https://sqlquantumlift.com/]
[https://SqlQuantumLeap.com/|https://sqlquantumleap.com/]
[https://SQLsharp.com/|https://sqlsharp.com/]

 

> RDBBlobStore: warn when legacy (SQLServer) default collation is active
> --
>
> Key: OAK-8918
> URL: https://issues.apache.org/jira/browse/OAK-8918
> Project: Jackrabbit Oak
>  Issue Type: Technical task
>  Components: rdbmk
>Reporter: Julian Reschke
>Assignee: Julian Reschke
>Priority: Minor
>  Labels: candidate_oak_1_10
> Fix For: 1.26.0, 1.22.2
>
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Comment Edited] (OAK-8918) RDBBlobStore: warn when legacy (SQLServer) default collation is active

2020-03-05 Thread Julian Reschke (Jira)


[ 
https://issues.apache.org/jira/browse/OAK-8918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17051077#comment-17051077
 ] 

Julian Reschke edited comment on OAK-8918 at 3/5/20, 12:39 PM:
---

trunk: [r1874271|http://svn.apache.org/r1874271]
1.22: [r1874838|http://svn.apache.org/r1874838]



was (Author: reschke):
trunk: [r1874271|http://svn.apache.org/r1874271]

> RDBBlobStore: warn when legacy (SQLServer) default collation is active
> --
>
> Key: OAK-8918
> URL: https://issues.apache.org/jira/browse/OAK-8918
> Project: Jackrabbit Oak
>  Issue Type: Technical task
>  Components: rdbmk
>Reporter: Julian Reschke
>Assignee: Julian Reschke
>Priority: Minor
>  Labels: candidate_oak_1_10
> Fix For: 1.26.0, 1.22.2
>
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)