Skip to content

Commit 64a0073

Browse files
fix(redis-enterprise): correct max_aof_file_size type from String to u64 (#351)
* fix(redis-enterprise): correct max_aof_file_size type from String to u64 The Redis Enterprise API returns max_aof_file_size as an integer (322122547200), not a string. This caused deserialization errors when fetching database information. Related to #347 * test: add real API response fixtures for type validation - Captured actual API responses from Redis Enterprise - cluster.json: Cluster configuration response - bdbs_list.json: List of databases showing actual field types - bdb_single.json: Single database details - nodes.json: Node information These fixtures reveal the actual types returned by the API and will help prevent future type mismatches like #347, #348, #351. Related to #352 (comprehensive fixture-based testing strategy) * fix(redis-enterprise): correct field types to match API responses Based on actual API responses captured in fixtures: - max_aof_file_size: returns number (322122547200), not string - recovery_wait_time: returns i32 (-1 is valid), not u32 These type mismatches were causing deserialization errors. Related to #347, #352 * fix(redis-enterprise): correct ALL type mismatches based on actual API responses After capturing real API responses as fixtures, found and fixed multiple type mismatches: - max_aof_file_size: Option<String> -> Option<u64> (value: 322122547200) - recovery_wait_time: Option<u32> -> Option<i32> (can be -1) - skip_import_analyze: Option<bool> -> Option<String> (values: "disabled", "enabled", "auto") - sync_dedicated_threads: Option<bool> -> Option<u32> (numeric thread count) These were causing deserialization errors when fetching database information. Also added real API response fixtures for testing: - cluster.json: Real cluster configuration - bdbs_list.json: Actual database list response - bdb_single.json: Single database details - nodes.json: Node information Related to #347, #352
1 parent 66aac2c commit 64a0073

File tree

6 files changed

+789
-5
lines changed

6 files changed

+789
-5
lines changed

crates/redis-enterprise/src/bdb.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ pub struct DatabaseInfo {
247247

248248
// AOF (Append Only File) settings
249249
pub aof_policy: Option<String>,
250-
pub max_aof_file_size: Option<String>,
250+
pub max_aof_file_size: Option<u64>,
251251
pub max_aof_load_time: Option<u32>,
252252

253253
// Active defragmentation settings
@@ -277,7 +277,7 @@ pub struct DatabaseInfo {
277277
pub export_failure_reason: Option<String>,
278278
pub export_progress: Option<f64>,
279279
pub export_status: Option<String>,
280-
pub skip_import_analyze: Option<bool>,
280+
pub skip_import_analyze: Option<String>,
281281

282282
// Monitoring and metrics
283283
pub metrics_export_all: Option<bool>,
@@ -330,7 +330,7 @@ pub struct DatabaseInfo {
330330
// Sync and replication control
331331
pub sync: Option<String>,
332332
pub sync_sources: Option<Vec<Value>>,
333-
pub sync_dedicated_threads: Option<bool>,
333+
pub sync_dedicated_threads: Option<u32>,
334334
pub syncer_mode: Option<String>,
335335
pub syncer_log_level: Option<String>,
336336
pub support_syncer_reconf: Option<bool>,
@@ -349,7 +349,7 @@ pub struct DatabaseInfo {
349349

350350
// Scheduling and recovery
351351
pub sched_policy: Option<String>,
352-
pub recovery_wait_time: Option<u32>,
352+
pub recovery_wait_time: Option<i32>,
353353

354354
// Performance and optimization
355355
pub multi_commands_opt: Option<String>,

crates/redis-enterprise/tests/database_tests.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ fn test_database() -> serde_json::Value {
2828
"port": 12000,
2929
"status": "active",
3030
"master_persistence": false,
31-
"data_persistence": "disabled"
31+
"data_persistence": "disabled",
32+
"max_aof_file_size": 322122547200u64,
33+
"recovery_wait_time": -1,
34+
"skip_import_analyze": "disabled",
35+
"sync_dedicated_threads": 5
3236
})
3337
}
3438

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
{
2+
"acl": [],
3+
"active_defrag_cycle_max": 25,
4+
"active_defrag_cycle_min": 1,
5+
"active_defrag_ignore_bytes": "104857600",
6+
"active_defrag_max_scan_fields": 1000,
7+
"active_defrag_threshold_lower": 10,
8+
"active_defrag_threshold_upper": 100,
9+
"activedefrag": "no",
10+
"aof_policy": "appendfsync-every-sec",
11+
"authentication_admin_pass": "6KioqIaX0iEU4BbQ5sMjE471Q5wljEuVz4nwFts3x34KDkbT",
12+
"authentication_redis_pass": "",
13+
"authentication_sasl_pass": "",
14+
"authentication_sasl_uname": "",
15+
"authentication_ssl_client_certs": [],
16+
"authentication_ssl_crdt_certs": [],
17+
"authorized_subjects": [],
18+
"auto_upgrade": false,
19+
"background_op": [
20+
{
21+
"status": "idle"
22+
}
23+
],
24+
"backup": false,
25+
"backup_failure_reason": "",
26+
"backup_history": 0,
27+
"backup_interval": 86400,
28+
"backup_progress": 0.0,
29+
"backup_status": "",
30+
"bigstore": false,
31+
"bigstore_max_ram_ratio": 10,
32+
"bigstore_ram_size": 0,
33+
"bigstore_version": 1,
34+
"client_cert_subject_validation_type": "disabled",
35+
"compare_key_hslot": false,
36+
"conns": 5,
37+
"conns_type": "per-thread",
38+
"crdt": false,
39+
"crdt_causal_consistency": false,
40+
"crdt_config_version": 0,
41+
"crdt_ghost_replica_ids": "",
42+
"crdt_guid": "",
43+
"crdt_modules": "[]",
44+
"crdt_repl_backlog_size": "auto",
45+
"crdt_replica_id": 0,
46+
"crdt_replicas": "",
47+
"crdt_sources": [],
48+
"crdt_sync": "disabled",
49+
"crdt_sync_connection_alarm_timeout_seconds": 0,
50+
"crdt_sync_dist": true,
51+
"crdt_syncer_auto_oom_unlatch": true,
52+
"crdt_xadd_id_uniqueness_mode": "strict",
53+
"created_time": "2025-09-16T21:34:19Z",
54+
"data_internode_encryption": false,
55+
"data_persistence": "disabled",
56+
"dataset_import_sources": [],
57+
"db_conns_auditing": false,
58+
"default_user": true,
59+
"dns_address_master": "",
60+
"dns_suffixes": [],
61+
"email_alerts": false,
62+
"endpoints": [
63+
{
64+
"addr": [
65+
"192.168.32.2"
66+
],
67+
"addr_type": "external",
68+
"dns_name": "redis-11657.docker-cluster",
69+
"oss_cluster_api_preferred_endpoint_type": "ip",
70+
"oss_cluster_api_preferred_ip_type": "internal",
71+
"port": 11657,
72+
"proxy_policy": "single",
73+
"uid": "2:1"
74+
}
75+
],
76+
"eviction_policy": "volatile-lru",
77+
"export_failure_reason": "",
78+
"export_progress": 0.0,
79+
"export_status": "",
80+
"flush_on_fullsync": true,
81+
"generate_text_monitor": false,
82+
"gradual_src_max_sources": 1,
83+
"gradual_src_mode": "disabled",
84+
"gradual_sync_max_shards_per_source": 1,
85+
"gradual_sync_mode": "auto",
86+
"group_uid": 0,
87+
"hash_slots_policy": "16k",
88+
"implicit_shard_key": false,
89+
"import_failure_reason": "",
90+
"import_progress": 0.0,
91+
"import_status": "",
92+
"internal": false,
93+
"last_changed_time": "2025-09-16T21:34:19Z",
94+
"master_persistence": false,
95+
"max_aof_file_size": 322122547200,
96+
"max_aof_load_time": 3600,
97+
"max_client_pipeline": 200,
98+
"max_connections": 0,
99+
"max_pipelined": 2000,
100+
"maxclients": 10000,
101+
"memory_size": 107374182,
102+
"metrics_export_all": false,
103+
"mkms": true,
104+
"module_list": [
105+
{
106+
"module_args": "",
107+
"module_id": "4e6efe7fa848e35cbae142dd1e4564a2",
108+
"module_name": "search",
109+
"semantic_version": "7.99.91"
110+
},
111+
{
112+
"module_args": "",
113+
"module_id": "b14385b09778a335835ee3ae380bbc77",
114+
"module_name": "bf",
115+
"semantic_version": "8.0.1"
116+
},
117+
{
118+
"module_args": "",
119+
"module_id": "259bc961ae0ed766d6294bcdb7af9039",
120+
"module_name": "ReJSON",
121+
"semantic_version": "7.99.3"
122+
},
123+
{
124+
"module_args": "",
125+
"module_id": "891142de155df09c6739543b422178f4",
126+
"module_name": "timeseries",
127+
"semantic_version": "8.0.2"
128+
}
129+
],
130+
"mtls_allow_outdated_certs": false,
131+
"mtls_allow_weak_hashing": false,
132+
"multi_commands_opt": "auto",
133+
"name": "test-db",
134+
"oss_cluster": false,
135+
"oss_cluster_api_preferred_endpoint_type": "ip",
136+
"oss_cluster_api_preferred_ip_type": "internal",
137+
"oss_sharding": false,
138+
"port": 0,
139+
"proxy_policy": "single",
140+
"rack_aware": false,
141+
"recovery_wait_time": -1,
142+
"redis_cluster_enabled": false,
143+
"redis_version": "8.0",
144+
"repl_backlog_size": "auto",
145+
"replica_read_only": false,
146+
"replica_sources": [],
147+
"replica_sync": "disabled",
148+
"replica_sync_connection_alarm_timeout_seconds": 0,
149+
"replica_sync_dist": true,
150+
"replication": false,
151+
"resp3": true,
152+
"roles_permissions": [],
153+
"sched_policy": "cmp",
154+
"shard_block_crossslot_keys": false,
155+
"shard_block_foreign_keys": true,
156+
"shard_key_regex": [],
157+
"shard_list": [
158+
1
159+
],
160+
"sharding": false,
161+
"shards_count": 1,
162+
"shards_placement": "dense",
163+
"skip_import_analyze": "disabled",
164+
"slave_buffer": "auto",
165+
"slave_ha": false,
166+
"slave_ha_priority": 0,
167+
"snapshot_policy": [],
168+
"ssl": false,
169+
"status": "active",
170+
"support_syncer_reconf": true,
171+
"sync": "disabled",
172+
"sync_dedicated_threads": 5,
173+
"sync_sources": [],
174+
"syncer_log_level": "info",
175+
"syncer_mode": "distributed",
176+
"throughput_ingress": 0,
177+
"tls_mode": "disabled",
178+
"topology_epoch": 1,
179+
"tracking_table_max_keys": 1000000,
180+
"type": "redis",
181+
"uid": 2,
182+
"use_selective_flush": true,
183+
"version": "8.0.0",
184+
"wait_command": true
185+
}

0 commit comments

Comments
 (0)