@@ -128,15 +128,16 @@ db_copy_thread_t::thread_t::thread_t(connection_params_t connection_params,
128128void db_copy_thread_t::thread_t::operator ()()
129129{
130130 try {
131- m_conn = std::make_unique<pg_conn_t >(m_connection_params, " copy" );
131+ m_db_connection =
132+ std::make_unique<pg_conn_t >(m_connection_params, " copy" );
132133
133134 // Disable sequential scan on database tables in the copy threads.
134135 // The copy threads only do COPYs (which are unaffected by this
135136 // setting) and DELETEs which we know benefit from the index. For
136137 // some reason PostgreSQL chooses in some cases not to use that index,
137138 // possibly because the DELETEs get a large list of ids to delete of
138139 // which many are not in the table which confuses the query planner.
139- m_conn ->exec (" SET enable_seqscan = off" );
140+ m_db_connection ->exec (" SET enable_seqscan = off" );
140141
141142 bool done = false ;
142143 while (!done) {
@@ -167,7 +168,7 @@ void db_copy_thread_t::thread_t::operator()()
167168
168169 finish_copy ();
169170
170- m_conn .reset ();
171+ m_db_connection .reset ();
171172 } catch (std::runtime_error const &e) {
172173 log_error (" DB copy thread failed: {}" , e.what ());
173174 std::exit (2 ); // NOLINT(concurrency-mt-unsafe)
@@ -181,13 +182,13 @@ void db_copy_thread_t::thread_t::write_to_db(db_cmd_copy_t *buffer)
181182 finish_copy ();
182183 }
183184
184- buffer->delete_data (m_conn .get ());
185+ buffer->delete_data (m_db_connection .get ());
185186
186187 if (!m_inflight) {
187188 start_copy (buffer->target );
188189 }
189190
190- m_conn ->copy_send (buffer->buffer , buffer->target ->name ());
191+ m_db_connection ->copy_send (buffer->buffer , buffer->target ->name ());
191192}
192193
193194void db_copy_thread_t::thread_t::start_copy (
@@ -208,15 +209,15 @@ void db_copy_thread_t::thread_t::start_copy(
208209 }
209210
210211 sql.push_back (' \0 ' );
211- m_conn ->copy_start (sql.data ());
212+ m_db_connection ->copy_start (sql.data ());
212213
213214 m_inflight = target;
214215}
215216
216217void db_copy_thread_t::thread_t::finish_copy ()
217218{
218219 if (m_inflight) {
219- m_conn ->copy_end (m_inflight->name ());
220+ m_db_connection ->copy_end (m_inflight->name ());
220221 m_inflight.reset ();
221222 }
222223}
0 commit comments