Skip to content

Commit 20b3c41

Browse files
mayastor-borsAbhinandan-Purkait
mayastor-bors
andcommitted
Merge #1800
1800: Cherry pick #1786 r=Abhinandan-Purkait a=Abhinandan-Purkait Cherry pick #1786 Co-authored-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>
2 parents 5bfb1cf + f7073b3 commit 20b3c41

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

io-engine/src/bdev/nexus/nexus_persistence.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ impl<'n> Nexus<'n> {
103103
};
104104
nexus_info.children.push(child_info);
105105
});
106-
// We started with this child because it was healthy in etcd, or isn't there at all.
107-
// Being unhealthy here means it is undergoing a fault/retire before nexus is open.
106+
// We started with this child because it was healthy in etcd, or
107+
// isn't there at all. Being unhealthy here
108+
// means it is undergoing a fault/retire before nexus is open.
108109
if nexus_info.children.len() == 1 && !nexus_info.children[0].healthy {
109110
warn!("{self:?} Not persisting: the only child went unhealthy during nexus creation");
110111
return Err(Error::NexusCreate {
@@ -211,6 +212,7 @@ impl<'n> Nexus<'n> {
211212
};
212213

213214
let mut retry = PersistentStore::retries();
215+
let mut logged = false;
214216
loop {
215217
let Err(err) = PersistentStore::put(&key, &info.inner).await else {
216218
trace!(?key, "{self:?}: the state was saved successfully");
@@ -225,10 +227,13 @@ impl<'n> Nexus<'n> {
225227
});
226228
}
227229

228-
error!(
229-
"{self:?}: failed to persist nexus information, \
230-
will retry ({retry} left): {err}"
231-
);
230+
if !logged {
231+
error!(
232+
"{self:?}: failed to persist nexus information, \
233+
will silently retry ({retry} left): {err}"
234+
);
235+
logged = true;
236+
}
232237

233238
// Allow some time for the connection to the persistent
234239
// store to be re-established before retrying the operation.

io-engine/src/core/env.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub struct MayastorCliArgs {
174174
pub ps_timeout: Duration,
175175
#[clap(long = "ps-retries", default_value = "30")]
176176
/// Persistent store operation retries.
177-
pub ps_retries: u8,
177+
pub ps_retries: u16,
178178
#[clap(long = "bdev-pool-size", default_value = "65535")]
179179
/// Number of entries in memory pool for bdev I/O contexts
180180
pub bdev_io_ctx_pool_size: u64,
@@ -374,7 +374,7 @@ pub struct MayastorEnvironment {
374374
pub registration_endpoint: Option<Uri>,
375375
ps_endpoint: Option<String>,
376376
ps_timeout: Duration,
377-
ps_retries: u8,
377+
ps_retries: u16,
378378
mayastor_config: Option<String>,
379379
ptpl_dir: Option<String>,
380380
pool_config: Option<String>,

io-engine/src/persistent_store.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct PersistentStoreBuilder {
3131
/// Operation timeout.
3232
timeout: Duration,
3333
/// Number of operation retries.
34-
retries: u8,
34+
retries: u16,
3535
}
3636

3737
impl Default for PersistentStoreBuilder {
@@ -74,7 +74,7 @@ impl PersistentStoreBuilder {
7474
}
7575

7676
/// Sets number of operation retries.
77-
pub fn with_retries(mut self, retries: u8) -> Self {
77+
pub fn with_retries(mut self, retries: u16) -> Self {
7878
self.retries = retries;
7979
self
8080
}
@@ -96,7 +96,7 @@ pub struct PersistentStore {
9696
/// Operation timeout.
9797
timeout: Duration,
9898
/// Number of operation retries.
99-
retries: u8,
99+
retries: u16,
100100
}
101101

102102
/// Persistent store global instance.
@@ -311,7 +311,7 @@ impl PersistentStore {
311311
}
312312

313313
/// Gets the number of operation retries.
314-
pub fn retries() -> u8 {
314+
pub fn retries() -> u16 {
315315
Self::instance().lock().retries
316316
}
317317

0 commit comments

Comments
 (0)