@@ -782,8 +782,12 @@ func (js *jetStream) setupMetaGroup() error {
782
782
sysAcc := s .SystemAccount ()
783
783
storeDir := filepath .Join (js .config .StoreDir , sysAcc .Name , defaultStoreDirName , defaultMetaGroupName )
784
784
785
+ js .srv .optsMu .RLock ()
786
+ syncAlways := js .srv .opts .SyncAlways
787
+ syncInterval := js .srv .opts .SyncInterval
788
+ js .srv .optsMu .RUnlock ()
785
789
fs , err := newFileStoreWithCreated (
786
- FileStoreConfig {StoreDir : storeDir , BlockSize : defaultMetaFSBlkSize , AsyncFlush : false , srv : s },
790
+ FileStoreConfig {StoreDir : storeDir , BlockSize : defaultMetaFSBlkSize , AsyncFlush : false , SyncAlways : syncAlways , SyncInterval : syncInterval , srv : s },
787
791
StreamConfig {Name : defaultMetaGroupName , Storage : FileStorage },
788
792
time .Now ().UTC (),
789
793
s .jsKeyGen (s .getOpts ().JetStreamKey , defaultMetaGroupName ),
@@ -2078,8 +2082,13 @@ func (js *jetStream) createRaftGroup(accName string, rg *raftGroup, storage Stor
2078
2082
storeDir := filepath .Join (js .config .StoreDir , sysAcc .Name , defaultStoreDirName , rg .Name )
2079
2083
var store StreamStore
2080
2084
if storage == FileStorage {
2085
+ // If the server is set to sync always, do the same for the Raft log.
2086
+ js .srv .optsMu .RLock ()
2087
+ syncAlways := js .srv .opts .SyncAlways
2088
+ syncInterval := js .srv .opts .SyncInterval
2089
+ js .srv .optsMu .RUnlock ()
2081
2090
fs , err := newFileStoreWithCreated (
2082
- FileStoreConfig {StoreDir : storeDir , BlockSize : defaultMediumBlockSize , AsyncFlush : false , SyncInterval : 5 * time . Minute , srv : s },
2091
+ FileStoreConfig {StoreDir : storeDir , BlockSize : defaultMediumBlockSize , AsyncFlush : false , SyncAlways : syncAlways , SyncInterval : syncInterval , srv : s },
2083
2092
StreamConfig {Name : rg .Name , Storage : FileStorage , Metadata : labels },
2084
2093
time .Now ().UTC (),
2085
2094
s .jsKeyGen (s .getOpts ().JetStreamKey , rg .Name ),
0 commit comments