{"action":"created","issue":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/6636","repository_url":"https://api.github.com/repos/orientechnologies/orientdb","labels_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/6636/labels{/name}","comments_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/6636/comments","events_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/6636/events","html_url":"https://github.com/orientechnologies/orientdb/issues/6636","id":174039236,"number":6636,"title":"Cluster Strategy inexplicably changes to round-robin in distributed setup","user":{"login":"bwRavencl","id":775727,"avatar_url":"https://avatars.githubusercontent.com/u/775727?v=3","gravatar_id":"","url":"https://api.github.com/users/bwRavencl","html_url":"https://github.com/bwRavencl","followers_url":"https://api.github.com/users/bwRavencl/followers","following_url":"https://api.github.com/users/bwRavencl/following{/other_user}","gists_url":"https://api.github.com/users/bwRavencl/gists{/gist_id}","starred_url":"https://api.github.com/users/bwRavencl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwRavencl/subscriptions","organizations_url":"https://api.github.com/users/bwRavencl/orgs","repos_url":"https://api.github.com/users/bwRavencl/repos","events_url":"https://api.github.com/users/bwRavencl/events{/privacy}","received_events_url":"https://api.github.com/users/bwRavencl/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/orientechnologies/orientdb/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"lvca","id":312606,"avatar_url":"https://avatars.githubusercontent.com/u/312606?v=3","gravatar_id":"","url":"https://api.github.com/users/lvca","html_url":"https://github.com/lvca","followers_url":"https://api.github.com/users/lvca/followers","following_url":"https://api.github.com/users/lvca/following{/other_user}","gists_url":"https://api.github.com/users/lvca/gists{/gist_id}","starred_url":"https://api.github.com/users/lvca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lvca/subscriptions","organizations_url":"https://api.github.com/users/lvca/orgs","repos_url":"https://api.github.com/users/lvca/repos","events_url":"https://api.github.com/users/lvca/events{/privacy}","received_events_url":"https://api.github.com/users/lvca/received_events","type":"User","site_admin":false},"assignees":[{"login":"lvca","id":312606,"avatar_url":"https://avatars.githubusercontent.com/u/312606?v=3","gravatar_id":"","url":"https://api.github.com/users/lvca","html_url":"https://github.com/lvca","followers_url":"https://api.github.com/users/lvca/followers","following_url":"https://api.github.com/users/lvca/following{/other_user}","gists_url":"https://api.github.com/users/lvca/gists{/gist_id}","starred_url":"https://api.github.com/users/lvca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lvca/subscriptions","organizations_url":"https://api.github.com/users/lvca/orgs","repos_url":"https://api.github.com/users/lvca/repos","events_url":"https://api.github.com/users/lvca/events{/privacy}","received_events_url":"https://api.github.com/users/lvca/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2016-08-30T14:45:08Z","updated_at":"2016-10-12T16:27:31Z","closed_at":null,"body":"## OrientDB Version, operating system, or hardware.\n- v2.0 SNAPSHOT[ ] - .18[ ] .17[ ] .16[ ] .15[ ] .14[ ] .13[ ] .12[ ] .11[ ] .10[ ] .9[ ] .8[ ] .7[ ] .6[ ] .5[ ] .4[ ] .3[ ] .2[ ] .1[ ] .0[ ]\n- v2.1 SNAPSHOT[ ] - .16[ ] .15[ ] .14[ ] .13[ ] .12[ ] .11[ ] .10[ ] .9[ ] .8[ ] .7[ ] .6[ ] .5[ ] .4[ ] .3[ ] .2[ ] .1[ ] .0[ ]\n- v2.2 SNAPSHOT[x] - .rc1[ ] .beta2[ ] .beta1[ ]\n- v3.0 SNAPSHOT[x]\n\n## Operating System\n- [ ] Linux\n- [x] MacOSX\n- [ ] Windows\n- [ ] Other Unix\n- [ ] Other, name? \n\n## Expected behavior and actual behavior\nThis issue concerns 2.2 and 3.0-SNAPSHOT in distributed + embedded mode with transactions enabled:\n\nAfter adding multiple vertices of a previously added vertex type, the cluster selection strategy inexplicably changes from `OLocalClusterStrategy` to `ORoundRobinClusterSelectionStrategy`, leading to an `OSchemaException`. \nMeanwhile `OClass::setClusterSelection()` is not getting called.\n## Steps to reproduce the problem\n - Launch a single embedded node, setup schema and shutdown:  \n\n```java\nfinal String nodeName = \"devel1\";\nSystem.setProperty(\"ORIENTDB_NODE_NAME\", nodeName);\nSystem.setProperty(\"ORIENTDB_HOME\", new File(\"\").getAbsolutePath() + File.separator + nodeName);\nSystem.setProperty(\"ORIENTDB_ROOT_PASSWORD\", \"123\");\nfinal OServer server = OServerMain.create(true);\nserver.startup(config);\nserver.activate();\n\nfinal OrientGraphFactory factory = new OrientGraphFactory(\"plocal:\" + nodeName + File.separator + \"databases\" + File.separator + \"test\");\nfinal OrientGraphNoTx graphNoTx = factory.getNoTx();\n\nif (graphNoTx.getVertexType(\"Person\") == null)\n\tgraphNoTx.createVertexType(\"Person\", 1)\n\nfinal OrientVertexType vtPerson = graphNoTx.getVertexType(\"Person\");\n // explicitely set cluster selction strategy to 'local'\nvtPerson.setClusterSelection(OLocalClusterStrategy.NAME);\n\nif (vtPerson.getProperty(\"firstName\") == null)\n\tvtPerson.createProperty(\"firstName\", OType.STRING);\n\nif (vtPerson.getProperty(\"lastName\") == null)\n\tvtPerson.createProperty(\"lastName\", OType.STRING);\n\nif (vtPerson.getProperty(\"out_lives\") == null)\n\tvtPerson.createEdgeProperty(Direction.OUT, \"lives\");\n\nif (vtPerson.getProperty(\"out_history\") == null)\n\tvtPerson.createEdgeProperty(Direction.OUT, \"history\");\n\nvtPerson.setStrictMode(true);\n\ngraphNoTx.shutdown();\nfactory.close();\nserver.shutdown();\n```\n\n- Relaunch first node and add multiple vertices of class 'Person':\n\n```java\nfinal String nodeName = \"devel1\";\nSystem.setProperty(\"ORIENTDB_NODE_NAME\", nodeName);\nSystem.setProperty(\"ORIENTDB_HOME\", new File(\"\").getAbsolutePath() + File.separator + nodeName);\nSystem.setProperty(\"ORIENTDB_ROOT_PASSWORD\", \"123\");\nfinal OServer server = OServerMain.create(true);\nserver.startup(config);\nserver.activate();\n\nfinal OrientGraphFactory factory = new OrientGraphFactory(\"plocal:\" + nodeName + File.separator + \"databases\" + File.separator + \"test\");\n\nwhile (true) {\n\t// press 'return' a few times and then launch second node\n\tSystem.in.read();\n\n\tfinal OrientGraph graph = factory.getTx();\n\n\t// should always be 'local'\n\tSystem.out.println(\"ClusterSelectionStrategy: \" + graph.getVertexType(\"Person\").getClusterSelection().getName());\n\n\tgraph.addVertex(\"class:Person\", \"firstName\", \"Roger\", \"lastName\", \"Smith\");\n\tgraph.getRawGraph().commit();\n\n\tgraph.shutdown();\n}\n\nfactory.close();\nserver.shutdown();\n```\n\n- Launching the second node and also adding multiple vertices of class 'Person' triggers the described behavior:\n\n```java\nfinal String nodeName = \"devel2\";\nSystem.setProperty(\"ORIENTDB_NODE_NAME\", nodeName);\nSystem.setProperty(\"ORIENTDB_HOME\", new File(\"\").getAbsolutePath() + File.separator + nodeName);\nSystem.setProperty(\"ORIENTDB_ROOT_PASSWORD\", \"123\");\nfinal OServer server = OServerMain.create(true);\nserver.startup(config);\nserver.activate();\n\nfinal OrientGraphFactory factory = new OrientGraphFactory(\"plocal:\" + nodeName + File.separator + \"databases\" + File.separator + \"test\");\n\nwhile (true) {\n\t// pressing 'return' 2 to 10 times should trigger the described behavior\n\tSystem.in.read();\n\n\tfinal OrientGraph graph = factory.getTx();\n\n\t// should always be 'local', but eventually changes to 'round-robin'\n\tSystem.out.println(\"ClusterSelectionStrategy: \" + graph.getVertexType(\"Person\").getClusterSelection().getName());\n\n\tgraph.addVertex(\"class:Person\", \"firstName\", \"Roger\", \"lastName\", \"Smith\");\n\tgraph.getRawGraph().commit();\n\n\tgraph.shutdown();\n}\n\nfactory.close();\nserver.shutdown();\n```\n\n## Used configuration:\n\n- orientdb-server-config.xml: \n\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n\n<orient-server>\n\t<handlers>\n\t\t<handler\n\t\t\tclass=\"com.orientechnologies.orient.graph.handler.OGraphServerHandler\">\n\t\t\t<parameters>\n\t\t\t\t<parameter name=\"enabled\" value=\"true\" />\n\t\t\t\t<parameter name=\"graph.pool.max\" value=\"50\" />\n\t\t\t</parameters>\n\t\t</handler>\n\t\t<!-- CLUSTER PLUGIN, TO TURN ON SET THE 'ENABLED' PARAMETER TO 'true' -->\n\t\t<handler\n\t\t\tclass=\"com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin\">\n\t\t\t<parameters>\n\t\t\t\t<!-- <parameter name=\"nodeName\" value=\"europe1\" /> -->\n\t\t\t\t<parameter name=\"enabled\" value=\"true\" />\n\t\t\t\t<parameter name=\"configuration.db.default\"\n\t\t\t\t\tvalue=\"${ORIENTDB_HOME}/config/default-distributed-db-config.json\" />\n\t\t\t\t<parameter name=\"configuration.hazelcast\" value=\"${ORIENTDB_HOME}/config/hazelcast.xml\" />\n\t\t\t</parameters>\n\t\t</handler>\n\t\t<!-- JMX SERVER, TO TURN ON SET THE 'ENABLED' PARAMETER TO 'true' -->\n\t\t<handler class=\"com.orientechnologies.orient.server.handler.OJMXPlugin\">\n\t\t\t<parameters>\n\t\t\t\t<parameter name=\"enabled\" value=\"false\" />\n\t\t\t\t<parameter name=\"profilerManaged\" value=\"true\" />\n\t\t\t</parameters>\n\t\t</handler>\n\t\t<!-- AUTOMATIC BACKUP, TO TURN ON SET THE 'ENABLED' PARAMETER TO 'true' -->\n\t\t<handler\n\t\t\tclass=\"com.orientechnologies.orient.server.handler.OAutomaticBackup\">\n\t\t\t<parameters>\n\t\t\t\t<parameter name=\"enabled\" value=\"false\" />\n\t\t\t\t<!-- LOCATION OF JSON CONFIGURATION FILE -->\n\t\t\t\t<parameter name=\"config\"\n\t\t\t\t\tvalue=\"${ORIENTDB_HOME}/config/automatic-backup.json\" />\n\t\t\t</parameters>\n\t\t</handler>\n\t\t<!-- SERVER SIDE SCRIPT INTERPRETER. WARNING, THIS CAN BE A SECURITY HOLE \n\t\t\tBECAUSE MALICIOUS CODE COULD BE INJECTED. ENABLE IT ONLY IF CLIENTS ARE TRUSTED, \n\t\t\tTO TURN ON SET THE 'ENABLED' PARAMETER TO 'true' -->\n\t\t<handler\n\t\t\tclass=\"com.orientechnologies.orient.server.handler.OServerSideScriptInterpreter\">\n\t\t\t<parameters>\n\t\t\t\t<parameter name=\"enabled\" value=\"true\" />\n\t\t\t\t<parameter name=\"allowedLanguages\" value=\"SQL\" />\n\t\t\t</parameters>\n\t\t</handler>\n\n\t</handlers>\n\t<network>\n\t\t<sockets>\n\t\t\t<socket\n\t\t\t\timplementation=\"com.orientechnologies.orient.server.network.OServerTLSSocketFactory\"\n\t\t\t\tname=\"ssl\">\n\t\t\t\t<parameters>\n\t\t\t\t\t<parameter value=\"false\" name=\"network.ssl.clientAuth\" />\n\t\t\t\t\t<parameter value=\"config/cert/orientdb.ks\" name=\"network.ssl.keyStore\" />\n\t\t\t\t\t<parameter value=\"password\" name=\"network.ssl.keyStorePassword\" />\n\t\t\t\t\t<parameter value=\"config/cert/orientdb.ks\" name=\"network.ssl.trustStore\" />\n\t\t\t\t\t<parameter value=\"password\" name=\"network.ssl.trustStorePassword\" />\n\t\t\t\t</parameters>\n\t\t\t</socket>\n\t\t\t<socket\n\t\t\t\timplementation=\"com.orientechnologies.orient.server.network.OServerTLSSocketFactory\"\n\t\t\t\tname=\"https\">\n\t\t\t\t<parameters>\n\t\t\t\t\t<parameter value=\"false\" name=\"network.ssl.clientAuth\" />\n\t\t\t\t\t<parameter value=\"config/cert/orientdb.ks\" name=\"network.ssl.keyStore\" />\n\t\t\t\t\t<parameter value=\"password\" name=\"network.ssl.keyStorePassword\" />\n\t\t\t\t\t<parameter value=\"config/cert/orientdb.ks\" name=\"network.ssl.trustStore\" />\n\t\t\t\t\t<parameter value=\"password\" name=\"network.ssl.trustStorePassword\" />\n\t\t\t\t</parameters>\n\t\t\t</socket>\n\t\t</sockets>\n\t\t<protocols>\n\t\t\t<!-- Default registered protocol. It reads commands using the HTTP protocol \n\t\t\t\tand write data locally -->\n\t\t\t<protocol name=\"binary\"\n\t\t\t\timplementation=\"com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary\" />\n\t\t\t<protocol name=\"http\"\n\t\t\t\timplementation=\"com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb\" />\n\t\t</protocols>\n\t\t<listeners>\n\t\t\t<listener protocol=\"binary\" ip-address=\"0.0.0.0\" port-range=\"2424-2430\"\n\t\t\t\tsocket=\"default\" />\n\t\t\t<listener protocol=\"http\" ip-address=\"0.0.0.0\" port-range=\"2480-2490\"\n\t\t\t\tsocket=\"default\">\n\t\t\t\t<parameters>\n\t\t\t\t\t<!-- Connection's custom parameters. If not specified the global configuration \n\t\t\t\t\t\twill be taken -->\n\t\t\t\t\t<parameter name=\"network.http.charset\" value=\"utf-8\" />\n\t\t\t\t\t<parameter value=\"true\" name=\"network.http.jsonResponseError\" />\n\t\t\t\t\t<!-- Define additional HTTP headers to always send as response -->\n\t\t\t\t\t<!-- Allow cross-site scripting -->\n\t\t\t\t\t<!-- parameter name=\"network.http.additionalResponseHeaders\" value=\"Access-Control-Allow-Origin: \n\t\t\t\t\t\t*;Access-Control-Allow-Credentials: true\" / -->\n\t\t\t\t</parameters>\n\t\t\t\t<commands>\n\t\t\t\t\t<command\n\t\t\t\t\t\tpattern=\"GET|www GET|studio/ GET| GET|*.htm GET|*.html GET|*.xml GET|*.jpeg GET|*.jpg GET|*.png GET|*.gif GET|*.js GET|*.css GET|*.swf GET|*.ico GET|*.txt GET|*.otf GET|*.pjs GET|*.svg GET|*.json GET|*.woff GET|*.woff2 GET|*.ttf GET|*.svgz\"\n\t\t\t\t\t\timplementation=\"com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent\">\n\t\t\t\t\t\t<parameters>\n\t\t\t\t\t\t\t<!-- Don't cache html resources in development mode -->\n\t\t\t\t\t\t\t<entry name=\"http.cache:*.htm *.html\"\n\t\t\t\t\t\t\t\tvalue=\"Cache-Control: no-cache, no-store, max-age=0, must-revalidate\\r\\nPragma: no-cache\" />\n\t\t\t\t\t\t\t<!-- Default caching -->\n\t\t\t\t\t\t\t<entry name=\"http.cache:default\" value=\"Cache-Control: max-age=120\" />\n\t\t\t\t\t\t</parameters>\n\t\t\t\t\t</command>\n\t\t\t\t\t<command pattern=\"GET|gephi/*\"\n\t\t\t\t\t\timplementation=\"com.orientechnologies.orient.graph.server.command.OServerCommandGetGephi\" />\n\t\t\t\t</commands>\n\t\t\t</listener>\n\t\t</listeners>\n\t\t<cluster>\n\t\t</cluster>\n\t</network>\n\t<storages>\n\t</storages>\n\t<users>\n\t\t<user name=\"root\" password=\"123\" resources=\"*\" />\n\t</users>\n\t<properties>\n\t\t<!-- DATABASE POOL: size min/max -->\n\t\t<entry name=\"db.pool.min\" value=\"1\" />\n\t\t<entry name=\"db.pool.max\" value=\"50\" />\n\n\t\t<!-- PROFILER: configures the profiler as <seconds-for-snapshot>,<archive-snapshot-size>,<summary-size> -->\n\t\t<entry name=\"profiler.enabled\" value=\"false\" />\n\t\t<!-- <entry name=\"profiler.config\" value=\"30,10,10\" /> -->\n\t</properties>\n</orient-server>\n```\n\n- default-distributed-db-config.json:\n\n```json\n{\n  \"autoDeploy\": true,\n  \"hotAlignment\": false,\n  \"readQuorum\": 1,\n  \"writeQuorum\": \"majority\",\n  \"executionMode\": \"undefined\",\n  \"readYourWrites\": true,\n  \"servers\": {\n    \"*\": \"master\"\n  },\n  \"clusters\": {\n    \"internal\": {\n    },\n    \"*\": {\n      \"servers\": [\"<NEW_NODE>\"]\n    }\n  }\n}\n```\n"},"comment":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/comments/253264401","html_url":"https://github.com/orientechnologies/orientdb/issues/6636#issuecomment-253264401","issue_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/6636","id":253264401,"user":{"login":"lvca","id":312606,"avatar_url":"https://avatars.githubusercontent.com/u/312606?v=3","gravatar_id":"","url":"https://api.github.com/users/lvca","html_url":"https://github.com/lvca","followers_url":"https://api.github.com/users/lvca/followers","following_url":"https://api.github.com/users/lvca/following{/other_user}","gists_url":"https://api.github.com/users/lvca/gists{/gist_id}","starred_url":"https://api.github.com/users/lvca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lvca/subscriptions","organizations_url":"https://api.github.com/users/lvca/orgs","repos_url":"https://api.github.com/users/lvca/repos","events_url":"https://api.github.com/users/lvca/events{/privacy}","received_events_url":"https://api.github.com/users/lvca/received_events","type":"User","site_admin":false},"created_at":"2016-10-12T16:27:31Z","updated_at":"2016-10-12T16:27:31Z","body":"Thanks for the report, I'm investigating into it."}}
{"actor":{"display_login":"lvca"}}