15
15
set_limits /2 , vhost_cluster_state /1 , is_running_on_all_nodes /1 , await_running_on_all_nodes /2 ,
16
16
list /0 , count /0 , list_names /0 , all /0 , parse_tags /1 ]).
17
17
-export ([info /1 , info /2 , info_all /0 , info_all /1 , info_all /2 , info_all /3 ]).
18
- -export ([dir /1 , msg_store_dir_path /1 , msg_store_dir_wildcard /0 , config_file_path /1 ]).
18
+ -export ([dir /1 , msg_store_dir_path /1 , msg_store_dir_wildcard /0 , config_file_path /1 , ensure_config_file / 1 ]).
19
19
-export ([delete_storage /1 ]).
20
20
-export ([vhost_down /1 ]).
21
21
-export ([put_vhost /5 ]).
@@ -80,7 +80,7 @@ ensure_config_file(VHost) ->
80
80
% % default of 16384 for forward compatibility. Historic
81
81
% % default calculated as trunc(math:pow(2,?REL_SEQ_BITS)).
82
82
_ ->
83
- 16384
83
+ ? LEGACY_INDEX_SEGMENT_ENTRY_COUNT
84
84
end ,
85
85
_ = rabbit_log :info (" Setting segment_entry_count for vhost '~s ' with ~b queues to '~b '" ,
86
86
[VHost , length (QueueDirs ), SegmentEntryCount ]),
@@ -91,8 +91,15 @@ ensure_config_file(VHost) ->
91
91
end .
92
92
93
93
read_config (VHost ) ->
94
- {ok , Config } = file :consult (config_file_path (VHost )),
95
- maps :from_list (Config ).
94
+ Config = case file :consult (config_file_path (VHost )) of
95
+ {ok , Val } -> Val ;
96
+ % % the file does not exist yet, likely due to an upgrade from a pre-3.7
97
+ % % message store layout so use the history default.
98
+ {error , _ } -> #{
99
+ segment_entry_count => ? LEGACY_INDEX_SEGMENT_ENTRY_COUNT
100
+ }
101
+ end ,
102
+ rabbit_data_coercion :to_map (Config ).
96
103
97
104
-define (INFO_KEYS , vhost :info_keys ()).
98
105
0 commit comments