@@ -15,7 +15,8 @@ Log::~Log() {}
1515
1616int create_or_open (const Options& options,
1717 Backend *backend, const std::string& name,
18- std::string *hoid_out, std::string *prefix_out)
18+ std::string *hoid_out, std::string *prefix_out,
19+ bool *created)
1920{
2021 std::string hoid;
2122 std::string prefix;
@@ -54,7 +55,9 @@ int create_or_open(const Options& options,
5455 return ret;
5556 }
5657 }
57-
58+ if (created) {
59+ *created = true ;
60+ }
5861 break ;
5962 }
6063
@@ -81,10 +84,11 @@ int Log::Open(const Options& options,
8184 }
8285 }
8386
87+ bool created = false ;
8488 std::string hoid;
8589 std::string prefix;
8690 int ret = create_or_open (options, backend.get (),
87- name, &hoid, &prefix);
91+ name, &hoid, &prefix, &created );
8892 if (ret) {
8993 return ret;
9094 }
@@ -110,8 +114,14 @@ int Log::Open(const Options& options,
110114 // gh#343
111115 impl->striper .update_current_view (0 );
112116
113- // TODO: initialize the first stripe so that cost isn't incurred by clients
114- // when they start performing I/O.
117+ // kick start initialization of the first stripe
118+ if (options.init_stripe_on_create && created) {
119+ // if there actually is a stripe. this is controlled by the
120+ // create_init_view_stripes option
121+ if (!impl->striper .view ()->object_map ().empty ()) {
122+ impl->striper .async_init_stripe (0 );
123+ }
124+ }
115125
116126 *logpp = impl.release ();
117127
0 commit comments