Cluster information is not persisted to database when connected to case
sensitive MS SQL Server 2005
----------------------------------------------------------------------------------------------------
Key: JCR-1322
URL: https://issues.apache.org/jira/browse/JCR-1322
Project: Jackrabbit
Issue Type: Bug
Components: clustering
Affects Versions: 1.3.3
Environment: Microsoft SQL Server 2005 on Windows Server. Database is
setup to be case-sensitive.
Reporter: Vijai Kalyan
After a call to Session::save, we observed that cluster information was not
written to the ${schemaObjectPrefix}JOURNAL and
${schemaObjectPrefix}GLOBAL_REVISION tables. We tested against Oracle 10
database servers and MS Sql Server 2005 servers. The problem was noticed only
with MS Sql Server 2005.
Initially, the problem was masked since the test was written as part of our
unit test environment and the exceptions generated by JDBC were not showing up
in the logs. A separate test with was carried out as shown by the code below
<pre>
import java.io.FileInputStream;
import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import org.apache.jackrabbit.core.TransientRepository;
import org.apache.jackrabbit.core.config.RepositoryConfig;
public class Main
{
public static void main(String[] args)
throws Exception
{
System.setProperty("org.apache.jackrabbit.core.cluster.node_id",
"testid");
RepositoryConfig config = RepositoryConfig.create(new
FileInputStream("repository.xml"), "repository");
Repository repository = new TransientRepository();
Session session = repository.login(new SimpleCredentials("username",
"password".toCharArray()));
Node root = session.getRootNode();
root.addNode("node1");
root.addNode("node2");
root.addNode("node3");
session.save();
}
}
</pre>
The configuration file used to configure the repository is attached.
After debugging this, we obtained the exceptions that were previously not
visible. Note that, JackRabbit continues to run (is that because the cluster
code is running in a separate thread?) even after this exception. The problem
was that the 'revision_id' field did not exist. The mssql.ddl schema file sets
up the table names in capitals. However, at least two of the SQL statements in
DatabaseJournal use lower case table names. For example:-
<pre>
updateGlobalStmt = con.prepareStatement(
"update " + schemaObjectPrefix + "global_revision " +
"set revision_id = revision_id + 1");
selectGlobalStmt = con.prepareStatement(
"select revision_id " +
"from " + schemaObjectPrefix + "global_revision");
</pre>
An additional error is that the mssql.ddl file is missing the following:
<pre>
# Inserting the one and only revision counter record now helps avoiding race
conditions
insert into ${schemaObjectPrefix}GLOBAL_REVISION VALUES(0)
</pre>
Fixing the above two issues, fixed the problem with MS SQL Server 2005.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.