title: Invalid value of TX counter when delete vertexes with orientdb 2.1.x
body: <p>While deleting vertexes from a class with more than 1600000 instances using the console:</p>
  
  <pre><code>delete vertex program batch 5000
  </code></pre>
  
  <p>I encounter this error:</p>
  
  <pre><code>com.orientechnologies.orient.core.exception.OStorageException: Invalid value of TX counter
      at com.orientechnologies.orient.core.tx.OTransactionOptimistic.rollback(OTransactionOptimistic.java:175)
      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2595)
      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.close(ODatabaseDocumentTx.java:1137)
      at com.orientechnologies.orient.server.network.protocol.http.command.post.OServerCommandPostCommand.execute(OServerCommandPostCommand.java:107)
      at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.service(ONetworkProtocolHttpAbstract.java:180)
      at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.execute(ONetworkProtocolHttpAbstract.java:627)
      at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)
  </code></pre>
  
  <p>I don't run inside a transaction and I was able to reproduce the error with plocal and remote connection, with enterprise version v2.1.4.
  The database was created with another server instance, but with the same major version (2.1.x).</p>
  
  <p><strong>Update</strong></p>
  
  <p>My database is really huge (~29G) but I managed to reproduce the issue with a smaller graph and starting the console with a small heap (-Xmx32M).</p>
  
  <pre><code>OrientGraphFactory factory = ...
  
  OrientBaseGraph graph = factory.getTx();
  
  graph.createVertexType("Program");
  graph.createVertexType("Variable");
  
  graph.getRawGraph().getLocalCache().setEnable(false);
  graph.declareIntent(new OIntentMassiveInsert());
  
  try {                       
      Vertex vr = graph.addVertex("class:Program");
  
      for (int i = 0; i &lt; 20000; i++) {               
          Vertex v;
  
          v = graph.addVertex("class:Variable");              
          graph.addEdge(null, v, vr, "has");              
      }
  } finally {
     graph.shutdown();
  }
  </code></pre>
  
  <p><strong>Update 2</strong></p>
  
  <p>With orient enterprise 2.1.5, the error is a little bit different. I ran with remote connection (because I wasn't able to configure the logging in client console) and with the same memory restriction (-Xmx32M):</p>
  
  <pre><code>2015-11-02 11:50:49:936 FINE  {db=db1} Deleted record #13:468 v.2 [OLocalPaginatedStorage]{db=db1} Error on transaction commit
  com.orientechnologies.orient.core.exception.OTransactionException: Transaction was committed more times than it is started.
      at com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:160)
      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2653)
      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2622)
      at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.commit(OrientTransactionalGraph.java:161)
      at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteVertex.end(OCommandExecutorSQLDeleteVertex.java:279)
      at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.execute(OCommandExecutorSQLSelect.java:437)
      at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:90)
      at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:1538)
      at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:1519)
      at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:72)
      at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:33)
      at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteVertex$2.call(OCommandExecutorSQLDeleteVertex.java:212)
      at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteVertex$2.call(OCommandExecutorSQLDeleteVertex.java:207)
      at com.orientechnologies.orient.graph.sql.OGraphCommandExecutorSQLFactory.runInTx(OGraphCommandExecutorSQLFactory.java:130)
      at com.orientechnologies.orient.graph.sql.OCommandExecutorSQLDeleteVertex.execute(OCommandExecutorSQLDeleteVertex.java:207)
      at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:90)
      at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:1538)
      at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:1519)
      at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:63)
      at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.command(ONetworkProtocolBinary.java:1319)
      at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:396)
      at com.orientechnologies.orient.server.network.protocol.binary.OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:223)
      at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)
  
  2015-11-02 11:50:54:101 FINE  {db=db1} Sent run-time exception to the client /127.0.0.1:37943: com.orientechnologies.orient.core.exception.OStorageException: Invalid value of TX counter [ONetworkProtocolBinary]
  </code></pre>