17
17
-export ([parse_tags /1 , update_metadata /2 , tag_with /2 , untag_from /2 , update_tags /2 , update_tags /3 ]).
18
18
-export ([lookup /1 ]).
19
19
-export ([info /1 , info /2 , info_all /0 , info_all /1 , info_all /2 , info_all /3 ]).
20
- -export ([dir /1 , msg_store_dir_path /1 , msg_store_dir_wildcard /0 , config_file_path /1 ]).
20
+ -export ([dir /1 , msg_store_dir_path /1 , msg_store_dir_wildcard /0 , config_file_path /1 , ensure_config_file / 1 ]).
21
21
-export ([delete_storage /1 ]).
22
22
-export ([vhost_down /1 ]).
23
23
-export ([put_vhost /5 ]).
@@ -85,7 +85,7 @@ ensure_config_file(VHost) ->
85
85
% % default of 16384 for forward compatibility. Historic
86
86
% % default calculated as trunc(math:pow(2,?REL_SEQ_BITS)).
87
87
_ ->
88
- 16384
88
+ ? LEGACY_INDEX_SEGMENT_ENTRY_COUNT
89
89
end ,
90
90
rabbit_log :info (" Setting segment_entry_count for vhost '~s ' with ~b queues to '~b '" ,
91
91
[VHost , length (QueueDirs ), SegmentEntryCount ]),
@@ -96,8 +96,15 @@ ensure_config_file(VHost) ->
96
96
end .
97
97
98
98
read_config (VHost ) ->
99
- {ok , Config } = file :consult (config_file_path (VHost )),
100
- maps :from_list (Config ).
99
+ Config = case file :consult (config_file_path (VHost )) of
100
+ {ok , Val } -> Val ;
101
+ % % the file does not exist yet, likely due to an upgrade from a pre-3.7
102
+ % % message store layout so use the history default.
103
+ {error , _ } -> #{
104
+ segment_entry_count => ? LEGACY_INDEX_SEGMENT_ENTRY_COUNT
105
+ }
106
+ end ,
107
+ rabbit_data_coercion :to_map (Config ).
101
108
102
109
-define (INFO_KEYS , vhost :info_keys ()).
103
110
0 commit comments