Search code examples
phparangodbarangodb-php

How to increase `maxTransactionSize` for Streaming Transactions in arangodb-php


The documentation says to pass as transaction-attribute (the call to /begin):

maxTransactionSize: Transaction size limit in bytes. Honored by the RocksDB storage engine only.

I manage to do just that, despite the fact that the php-client ignores the attribute, by setting it manually before I hand the transaction-instance over to the handler:

 $trx->set('maxTransactionSize', $config['maxTransactionSize'])

This is var_dump of the transaction attributes ($trx->attributes) directly prior to the call to begin:

includes/libs/arangodb/lib/ArangoDBClient/StreamingTransactionHandler.php:50:
array(2) {
  'collections' =>
    array(3) {
      'read' =>
       array(0) {
      }
      'write' =>
       array(0) {
      }
      'exclusive' =>
       array(1) {
         [0] =>
          string(7) "actions"
       }
    }
  'maxTransactionSize' =>
  int(536870912)
}

But the transaction fails with:

error : AQL: aborting transaction because maximal transaction size limit of 134217728 bytes is reached (while executing)

What am I missing/doing wrong?

I tested this on 3.5.4 and 3.6.1, with the same result.


Solution

  • Turns out it's prudent to read the whole documentation. 128MB is a hard upper limit for the size of a streaming transaction.

    A maximum lifetime and transaction size for stream transactions is enforced on the Coordinator to ensure that transactions cannot block the cluster from operating properly:

    Maximum idle timeout of 10 seconds between operations Maximum transaction size of 128 MB per DB-Server These limits are also enforced for stream transactions on single servers.

    This means you have to use a js-transaction for queries that need more memory. The arangodb-php client provides Transaction.php to wrap these on the client side, there's no need to write/extend a foxx-app -- at least, there are no limitations mentioned in the documentation of js-transactions (https://www.arangodb.com/docs/devel/http/transaction-js-transaction.html).

    Edit: I re-implemented my case as js-transaction, and it completes unhindered.