DRD Stats — Group 16, Code 148

Returns four totals describing this RAIDA’s user directory: how many live records it holds, how many tombstones are still within retention, the newest write time, and the oldest account. Open read, no parameters. Sync clients use it to size progress bars before a get_changes (147) pull and to detect drift between RAIDAs; monitoring uses it as a cheap health probe.

Quick reference

Command Group16 (DRD)
Command Code148 (0x94)
Server functioncmd_drd_stats in cmd_drd.c
Request bodyExactly 18 bytes: challenge(16) + terminator(2). No parameters.
AuthenticationNone — totals are public
TransportUDP or TCP; the response always fits one datagram
Success responseStatus 250 + 32-byte payload (four big-endian 64-bit values)

Request body (18 bytes)

Challenge random (12 bytes, part 1 of 2) 0 7 Challenge random (part 2) 8 11 Challenge CRC32 (BE) 12 15 3E 3E (term) 16 17
Body offsetSizeFieldDescription
0–1112Challenge randomRandom bytes generated by the client.
12–154Challenge CRC32Big-endian CRC32 of bytes 0–11.
16–172TerminatorFixed 3E 3E. The body must be exactly 18 bytes.

Response (32 bytes)

+--------------+-----------------+----------------+----------------+
| record_count | tombstone_count | max_updated_at | min_created_at |
| 8 (BE)       | 8 (BE)          | 8 (BE)         | 8 (BE)         |
+--------------+-----------------+----------------+----------------+
offset 0         8                 16               24
Payload offsetSizeFieldDescription
0–78record_countNumber of live (non-tombstoned) user records on this RAIDA.
8–158tombstone_countNumber of deleted records still within the 90-day tombstone retention window. These appear in the changes feed (mode 0 or 2) but never in get_user or search.
16–238max_updated_atUnix seconds of the newest write, live or tombstone. 0 if the directory is empty. A client whose shard cursors all reach this time is fully caught up.
24–318min_created_atUnix seconds of the oldest live account’s created_at. 0 if the directory is empty.

All four values are unsigned big-endian 64-bit integers. The counts are exact at the moment of the query; they are not cached.

Status codes

DecimalHexSymbolMeaning
2500xFASTATUS_SUCCESSTotals returned in the payload.
160x10ERROR_INVALID_PACKET_LENGTHBody is not exactly 18 bytes.
360x24ERROR_EMPTY_REQUESTBody missing.
2520xFCERROR_INTERNALDatabase failure.
2540xFEERROR_MEMORY_ALLOCServer allocation failure.

Common mistakes

Comparing counts across RAIDAs and expecting equality

Each RAIDA’s DRD is independent. A small difference in record_count usually means one server missed a post while offline. Large differences are the signal to run a repair sync with 147.

Using record_count as the number of 147 entries to expect

A mode-0 changes pull returns live records plus tombstones. Sum record_count and tombstone_count when sizing a full pull, or use mode 1 and record_count alone.