Skip to content

/api/v1/batch endpoint fails with "Error on updating dictionary" on HA follower nodes #4122

@babasaikiran

Description

@babasaikiran

Environment

ArcadeDB version: 26.5.1-SNAPSHOT (build 25ed565)
Cluster: 3-node Raft HA

Expected behavior

The batch endpoint should handle dictionary updates on follower nodes the same way regular SQL INSERT does (which works fine).

Actual behavior

we are getting 500 response with below message

500 — {"error":"Internal error","detail":"Error on updating dictionary for key 'key_3'","exception":"com.arcadedb.exception.SchemaException"}

Steps to reproduce

The script below creates a fresh database, tests BATCH with different numbers of new keys on a follower node,
and reports pass/fail. No external dependencies beyond Python 3 standard library.

Save as batch_bug_repro.py and run:

python issue_follower.py --url http://10.95.125.241:2480/api/v1 --user root --password <password>
#!/usr/bin/env python3

import argparse
import json
import requests
from requests.auth import HTTPBasicAuth

DB = "repro_batch_bug"


def main():
    p = argparse.ArgumentParser()
    p.add_argument("--url", required=True, help="Follower node URL")
    p.add_argument("--user", default="root")
    p.add_argument("--password", default="root")
    args = p.parse_args()

    s = requests.Session()
    s.auth = HTTPBasicAuth(args.user, args.password)
    url = args.url.rstrip("/")

    # Test with increasing number of properties: 3, 5, 10, 15, 20, 30, 50
    for num_keys in [3, 5, 10, 15, 20, 30, 50]:
        # Fresh DB each time
        s.post(f"{url}/server",
               json={"command": f"drop database {DB}"}, timeout=30)
        s.post(f"{url}/server",
               json={"command": f"create database {DB}"}, timeout=30)
        s.post(f"{url}/command/{DB}",
               json={"language": "sql",
                     "command": "CREATE VERTEX TYPE Person"},
               timeout=30)

        record = {f"key_{i}": f"val_{i}" for i in range(num_keys)}
        payload = json.dumps({
            "@type": "vertex", "@class": "Person", **record
        })

        r = s.post(f"{url}/batch/{DB}",
                   data=payload.encode(),
                   headers={"Content-Type": "application/x-ndjson"},
                   timeout=30)

        icon = "✅" if r.status_code == 200 else "❌"
        print(f"  {icon} {num_keys:3d} keys — {r.status_code}{r.text[:200]}")

    # Cleanup
    s.post(f"{url}/server",
           json={"command": f"drop database {DB}"}, timeout=30)


if __name__ == "__main__":
    main()

Sample output (bug confirmed)

**follower node - 10.95.125.241 **

python issue_follower.py --url http://10.95.125.241:2480/api/v1 --user root --password <password>
  ✅   3 keys — 200 — {"verticesCreated":1,"edgesCreated":0,"elapsedMs":17}
  ❌   5 keys — 500 — {"error":"Internal error","detail":"Error on updating dictionary for key 'key_3'","exception":"com.arcadedb.exception.SchemaException"}
  ❌  10 keys — 500 — {"error":"Internal error","detail":"Error on updating dictionary for key 'key_3'","exception":"com.arcadedb.exception.SchemaException"}
  ❌  15 keys — 500 — {"error":"Internal error","detail":"Error on updating dictionary for key 'key_3'","exception":"com.arcadedb.exception.SchemaException"}
  ❌  20 keys — 500 — {"error":"Internal error","detail":"Error on updating dictionary for key 'key_3'","exception":"com.arcadedb.exception.SchemaException"}
  ❌  30 keys — 500 — {"error":"Internal error","detail":"Type with name 'Person' was not found","exception":"com.arcadedb.exception.SchemaException"}
  ❌  50 keys — 500 — {"error":"Internal error","detail":"Error on updating dictionary for key 'key_3'","exception":"com.arcadedb.exception.SchemaException"}

**leader node - 10.95.125.242 **

python issue_follower.py --url http://10.95.125.242:2480/api/v1 --user root --password <password>
  ✅   3 keys — 200 — {"verticesCreated":1,"edgesCreated":0,"elapsedMs":14}
  ✅   5 keys — 200 — {"verticesCreated":1,"edgesCreated":0,"elapsedMs":24}
  ✅  10 keys — 200 — {"verticesCreated":1,"edgesCreated":0,"elapsedMs":42}
  ✅  15 keys — 200 — {"verticesCreated":1,"edgesCreated":0,"elapsedMs":60}
  ✅  20 keys — 200 — {"verticesCreated":1,"edgesCreated":0,"elapsedMs":75}
  ✅  30 keys — 200 — {"verticesCreated":1,"edgesCreated":0,"elapsedMs":115}
  ✅  50 keys — 200 — {"verticesCreated":1,"edgesCreated":0,"elapsedMs":197}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions