Description
Two disaster-recovery entry points from fdb_c.h are not bound in NativeClient.php:
FDBFuture* fdb_database_create_snapshot(FDBDatabase* db,
uint8_t const* uid, int uid_length,
uint8_t const* snap_command, int snap_command_length);
FDBFuture* fdb_database_force_recovery_with_data_loss(FDBDatabase* db,
uint8_t const* dcid, int dcid_length);
AdminClient::forceRecovery() (src/AdminClient.php:282) currently implements force recovery by writing to the special key \xff\xff/management/force_recovery. That path works, but it is not the same entry point the other bindings use, and it inherits the unvalidated-special-key concerns tracked in #43. There is no equivalent at all for create_snapshot, which is how the fdbcli snapshot disaster-recovery flow is driven.
What needs to be done
- Bind both functions in
NativeClient.php.
- Add to
AdminClient.php:
createSnapshot(string $uid, string $snapCommand): void — $uid must be a 32-character hex UID; validate it before passing it through.
forceRecoveryWithDataLoss(string $dcId): void — the direct C API call.
- Decide what happens to the existing special-key
forceRecovery(): either reimplement it on top of the C call, or keep both and document the difference. Reimplementing is preferred — it removes one unvalidated special-key write.
Notes
create_snapshot is destructive/operational and requires snapshot support to be configured on the cluster; the integration test needs to be guarded or skipped by default.
- Data loss is in the name of the second call — the docblock must say so plainly.
Acceptance Criteria
Description
Two disaster-recovery entry points from
fdb_c.hare not bound inNativeClient.php:AdminClient::forceRecovery()(src/AdminClient.php:282) currently implements force recovery by writing to the special key\xff\xff/management/force_recovery. That path works, but it is not the same entry point the other bindings use, and it inherits the unvalidated-special-key concerns tracked in #43. There is no equivalent at all forcreate_snapshot, which is how thefdbcli snapshotdisaster-recovery flow is driven.What needs to be done
NativeClient.php.AdminClient.php:createSnapshot(string $uid, string $snapCommand): void—$uidmust be a 32-character hex UID; validate it before passing it through.forceRecoveryWithDataLoss(string $dcId): void— the direct C API call.forceRecovery(): either reimplement it on top of the C call, or keep both and document the difference. Reimplementing is preferred — it removes one unvalidated special-key write.Notes
create_snapshotis destructive/operational and requiressnapshotsupport to be configured on the cluster; the integration test needs to be guarded or skipped by default.Acceptance Criteria
AdminClient::createSnapshot()with UID validationAdminClient::forceRecoveryWithDataLoss()implementedforceRecovery()either reimplemented on the C call or documented as distinctdocs/admin.mdupdatedcomposer lintandcomposer testclean