Writes the connection string to the cluster file
| 146 | |
| 147 | // Writes the connection string to the cluster file |
| 148 | Future<bool> ClusterConnectionFile::persist() { |
| 149 | setPersisted(); |
| 150 | |
| 151 | if (filename.size()) { |
| 152 | try { |
| 153 | atomicReplace(filename, |
| 154 | "# DO NOT EDIT!\n# This file is auto-generated, it is not to be edited by hand\n" + |
| 155 | cs.toString().append("\n")); |
| 156 | |
| 157 | Future<bool> isUpToDate = IClusterConnectionRecord::upToDate(); |
| 158 | |
| 159 | // The implementation of upToDate in this class is synchronous |
| 160 | ASSERT(isUpToDate.isReady()); |
| 161 | |
| 162 | if (!isUpToDate.get()) { |
| 163 | // This should only happen in rare scenarios where multiple processes are updating the same file to |
| 164 | // different values simultaneously In that case, we don't have any guarantees about which file will |
| 165 | // ultimately be written |
| 166 | TraceEvent(SevWarnAlways, "ClusterFileChangedAfterReplace") |
| 167 | .detail("Filename", filename) |
| 168 | .detail("ConnectionString", cs.toString()); |
| 169 | return false; |
| 170 | } |
| 171 | |
| 172 | return true; |
| 173 | } catch (Error& e) { |
| 174 | TraceEvent(SevWarnAlways, "UnableToChangeConnectionFile") |
| 175 | .error(e) |
| 176 | .detail("Filename", filename) |
| 177 | .detail("ConnectionString", cs.toString()); |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | return false; |
| 182 | } |
nothing calls this directly
no test coverage detected