Commit 19464797 authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Merge branch 'kvamme62/adjust-retry-count' into 'master'

Expose the maximum retry count for Seismic Store requests.

See merge request !93
parents 3546364f a0e5c112
Pipeline #59732 passed with stages
in 12 minutes and 59 seconds
...@@ -1207,7 +1207,7 @@ SeismicStoreFile::_sslogger(int priority, const std::ios& ss) const ...@@ -1207,7 +1207,7 @@ SeismicStoreFile::_sslogger(int priority, const std::ios& ss) const
void void
SeismicStoreFile::_set_backoff(seismicdrive::SDGenericDataset* sdgd) SeismicStoreFile::_set_backoff(seismicdrive::SDGenericDataset* sdgd)
{ {
int retries = Environment::getNumericEnv("OPENZGY_SD_BACKOFF", -1); const int retries = this->_config->_retry_count;
if (retries >= 0) { if (retries >= 0) {
seismicdrive::ExponentialRetryBackoffPolicy policy; seismicdrive::ExponentialRetryBackoffPolicy policy;
if (retries == 0) { if (retries == 0) {
......
...@@ -60,6 +60,7 @@ SeismicStoreIOContext::SeismicStoreIOContext() ...@@ -60,6 +60,7 @@ SeismicStoreIOContext::SeismicStoreIOContext()
setRoAfterWrite(Environment::getNumericEnv("OPENZGY_RO_AFTER_WRITE", 1) > 0); setRoAfterWrite(Environment::getNumericEnv("OPENZGY_RO_AFTER_WRITE", 1) > 0);
forceRoBeforeRead(Environment::getNumericEnv("OPENZGY_RO_BEFORE_READ", 0) > 0); forceRoBeforeRead(Environment::getNumericEnv("OPENZGY_RO_BEFORE_READ", 0) > 0);
forceRwBeforeWrite(Environment::getNumericEnv("OPENZGY_RW_BEFORE_WRITE", 0) > 0); forceRwBeforeWrite(Environment::getNumericEnv("OPENZGY_RW_BEFORE_WRITE", 0) > 0);
retryCount(Environment::getNumericEnv("OPENZGY_SD_BACKOFF", -1));
} }
std::string std::string
......
...@@ -120,6 +120,7 @@ private: ...@@ -120,6 +120,7 @@ private:
bool _set_ro_after_write; bool _set_ro_after_write;
bool _force_ro_before_read; bool _force_ro_before_read;
bool _force_rw_before_write; bool _force_rw_before_write;
std::int32_t _retry_count;
private: // really private. Keep off. private: // really private. Keep off.
std::int64_t _real_segsize; std::int64_t _real_segsize;
...@@ -546,6 +547,19 @@ public: ...@@ -546,6 +547,19 @@ public:
return *this; return *this;
} }
/**
* Maximum number of retries that SDAPI will use before concluding
* that a web service is unavailable and not just experiencing a
* transient problem. There is an exponential backoff between
* attempts. 1/2 second for the first one, then doubling for each
* attempt but never more than 32 seconds. Leaving the parameter
* unset or set to -1 will use the defaults hard coded in SDAPI.
*/
SeismicStoreIOContext& retryCount(int value)
{
this->_retry_count = value;
return *this;
}
}; };
/** \endcond */ /** \endcond */
......
...@@ -2390,6 +2390,10 @@ test_sderrors() ...@@ -2390,6 +2390,10 @@ test_sderrors()
SeismicStoreIOContext context(*Test_Utils::default_sd_context()); SeismicStoreIOContext context(*Test_Utils::default_sd_context());
// SDAPI should not retry a missing token, but currently there
// is a bug that does just that. Explicitly turn off retries.
context.retryCount(0);
// Neither token not token callback were provided. // Neither token not token callback were provided.
context.sdtoken("", ""); context.sdtoken("", "");
must_throw("Missing access token or callback in iocontext", [&](){ must_throw("Missing access token or callback in iocontext", [&](){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment