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

Solomon Rutzky commented on OAK-8918:
-------------------------------------

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&view=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&view=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&view=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 "{{SQL_*}}" collation, if 
the user does make 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's possible 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}}".

> 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_8
>             Fix For: 1.26.0, 1.10.9, 1.22.2
>
>




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

Reply via email to