<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Nuxeo cluster and SQL Server shared instance problem in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313396#M397</link>
    <description>&lt;P&gt;And thanks for the report.&lt;/P&gt;</description>
    <pubDate>Fri, 25 Jul 2014 15:02:05 GMT</pubDate>
    <dc:creator>Florent_Guillau</dc:creator>
    <dc:date>2014-07-25T15:02:05Z</dc:date>
    <item>
      <title>Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313383#M384</link>
      <description>&lt;P&gt;We have a Nuxeo-5.9.3 cluster consisting in two Tomcat server and a SQL Server geo-cluster.
The SQL instance is shared among many applications.&lt;/P&gt;
&lt;P&gt;We have observed that the cleanup of the table cluster_invals and cluster_nodes was not working properly, and Nuxeo performance plummeted (due to 30 rows in cluster_nodes and millions in cluster_invals).
After doing some research, we found that the way Nuxeo handles the cleanup of those tables only works if you have a dedicated SQL Server instance.&lt;/P&gt;
&lt;P&gt;We were able to work-around the problem by:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;Adding a column to cluster_nodes (hostname nvarchar(128)).&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Modify the file sqlserver.sql.txt included in nuxeo-core-storage-sql-5.9.3.jar. Now nodes are deleted and inserted this way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;  -- DB Collation is CI but Nuxeo DB is CS
  DELETE FROM [cluster_nodes] WHERE hostname =
    (SELECT host_name COLLATE DATABASE_DEFAULT FROM sys.dm_exec_sessions S
     WHERE S.session_id = @@SPID)

  INSERT INTO [cluster_nodes] (nodeid, created, hostname)
    SELECT @@SPID, CURRENT_TIMESTAMP, host_name FROM sys.dm_exec_sessions S
    WHERE S.session_id = @@SPID
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The work-around can be easily improved (it doesn't currently work for many nuxeo instances on the same node).&lt;/P&gt;
&lt;P&gt;Do you think there is a better approach for this problem?
Should it be reported as a bug?&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jul 2014 10:21:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313383#M384</guid>
      <dc:creator>arubiom00_</dc:creator>
      <dc:date>2014-07-16T10:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313384#M385</link>
      <description>&lt;P&gt;Thanks for the report. I opened &lt;A href="https://jira.nuxeo.com/browse/NXP-14795"&gt;NXP-14795&lt;/A&gt; to track this issue and its resolution.&lt;/P&gt;
&lt;P&gt;We haven't tested or validated Nuxeo with a clustered SQL Server. Can you explain why the host_name is needed in addition to the session_id? The session_id is not unique globally on the server cluster? Also host_name is provided by the client application and marked not reliable in the documentation.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2014 15:39:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313384#M385</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2014-07-17T15:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313385#M386</link>
      <description>&lt;P&gt;Hi Florent,&lt;/P&gt;
&lt;P&gt;The problem is not the SQL cluster but the use of shared instance. The original cleanup is:&lt;BR /&gt;&lt;/P&gt;
&lt;DIV&gt;
DELETE FROM N FROM [cluster_nodes] N WHERE&lt;BR /&gt;
  HAS\_PERMS\_BY\_NAME(null, null, 'VIEW SERVER STATE') = 1&lt;BR /&gt;
  AND NOT EXISTS(&lt;BR /&gt;
    SELECT 1 FROM sys.dm_exec_sessions S WHERE&lt;BR /&gt;
      S.is\_user\_process = 1 AND N.nodeid = S.session\_id);&lt;BR /&gt;
&lt;/DIV&gt;&lt;BR /&gt;
&lt;P&gt;When there are connections that are not originated from nuxeo this doesn't work as expected. Session_id is unique, but it may not be assigned to a nuxeo session under these circumstances. Let's consider the following:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;One nuxeo server is started and connects to the database with session_id=50 (one row with that session_id is added to cluster_nodes)&lt;/LI&gt;
&lt;LI&gt;That nuxeo server goes offline.&lt;/LI&gt;
&lt;LI&gt;Other session is started from a different application (e.g. Team Foundation Server), connects to database and gets session_id=50&lt;/LI&gt;
&lt;LI&gt;The nuxeo instance is started again. The row in cluster_node is not removed because there is an active session with session_id=50.&lt;/LI&gt;
&lt;LI&gt;A new row is added. As a result, the same node has added two rows to cluster_nodes. In a quite busy database, after many restarts you can get too many rows in cluster_nodes.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Adding host_name allows us to clean all previous rows inserted from one node. It's not a full solution and there are still some situation where it doesn't work:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Multiple Nuxeo Instances in the same host.&lt;/LI&gt;
&lt;LI&gt;Another application in the same host that connects to the same database.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If there were some field or parameter that uniquely identifies the instance, using it would resolve the problem. Is there such a thing?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2014 17:49:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313385#M386</guid>
      <dc:creator>arubiom00_</dc:creator>
      <dc:date>2014-07-17T17:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313386#M387</link>
      <description>&lt;P&gt;But in step 2, if the Nuxeo server is correctly shut down then it will clean up its entry in cluster_nodes.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2014 18:30:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313386#M387</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2014-07-17T18:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313387#M388</link>
      <description>&lt;P&gt;In that case we are having some problem in our instances, because cluster_nodes is only cleaned up when starting an instance. It's been the behaviour since we install Nuxeo.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2014 19:53:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313387#M388</guid>
      <dc:creator>arubiom00_</dc:creator>
      <dc:date>2014-07-17T19:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313388#M389</link>
      <description>&lt;P&gt;Hi Florent,&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 09:25:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313388#M389</guid>
      <dc:creator>arubiom00_</dc:creator>
      <dc:date>2014-07-18T09:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313389#M390</link>
      <description>&lt;P&gt;If you look at sqlserver.sql.txt you'll see a section&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 11:25:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313389#M390</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2014-07-18T11:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313390#M391</link>
      <description>&lt;P&gt;As the triggered test showed, apparently there is no DELETE is executed during shutdown.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 13:08:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313390#M391</guid>
      <dc:creator>arubiom00_</dc:creator>
      <dc:date>2014-07-18T13:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313391#M392</link>
      <description>&lt;P&gt;No sql traces during shutdown even if I enable more logging.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 13:34:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313391#M392</guid>
      <dc:creator>arubiom00_</dc:creator>
      <dc:date>2014-07-18T13:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313392#M393</link>
      <description>&lt;P&gt;It's working correctly in the current 5.9.5-SNAPSHOT version. We have refactored a few things related to repository shutdown. Maybe try 5.9.4 first?  Your 5.9.3 is a Fast Track version, so you should always upgrade asap.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 14:23:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313392#M393</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2014-07-18T14:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313393#M394</link>
      <description>&lt;P&gt;I've tested both versions (5.9.3 and 5.9.4) and no delete was executed during shutdown. I tested in the lab with H2 database and I got the same result.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2014 08:51:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313393#M394</guid>
      <dc:creator>arubiom00_</dc:creator>
      <dc:date>2014-07-21T08:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313394#M395</link>
      <description>&lt;P&gt;I've tested versions 5.9.3 and 5.9.4 with H2 databases using the virtual machines availables at&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2014 10:51:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313394#M395</guid>
      <dc:creator>arubiom00_</dc:creator>
      <dc:date>2014-07-23T10:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313395#M396</link>
      <description>&lt;P&gt;I can confirm that 5.9.4 indeed has this problem, but it's fixed for the next 5.9.5 (release in around 2 weeks). I don't have an exact ticket to pinpoint when the problem was introduced or when the fix occurred, but we've done a number of changes in the repository shutdown mechanism and one of them has fixed it.&lt;/P&gt;
&lt;P&gt;You can try a 5.9.5-SNAPSHOT from &lt;A href="http://qa.nuxeo.org/jenkins/job/IT-nuxeo-master-build/" target="test_blank"&gt;http://qa.nuxeo.org/jenkins/job/IT-nuxeo-master-build/&lt;/A&gt; if you want to confirm.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jul 2014 15:01:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313395#M396</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2014-07-25T15:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313396#M397</link>
      <description>&lt;P&gt;And thanks for the report.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jul 2014 15:02:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313396#M397</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2014-07-25T15:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Nuxeo cluster and SQL Server shared instance problem</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313397#M398</link>
      <description>&lt;P&gt;Great!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2014 10:42:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-cluster-and-sql-server-shared-instance-problem/m-p/313397#M398</guid>
      <dc:creator>arubiom00_</dc:creator>
      <dc:date>2014-07-28T10:42:08Z</dc:date>
    </item>
  </channel>
</rss>

