@@ -37,12 +37,12 @@ async_disk_writer_t::async_disk_writer_t(int validate_flush_efd, int signal_chec
3737 ASSERT_PRECONDITION (validate_flush_efd >= 0 , " Invalid validate flush eventfd" );
3838 ASSERT_PRECONDITION (signal_checkpoint_efd >= 0 , " Invalid signal checkpoint eventfd" );
3939
40- m_validate_flush_efd = validate_flush_efd;
41- m_signal_checkpoint_efd = signal_checkpoint_efd;
40+ m_validate_flush_eventfd = validate_flush_efd;
41+ m_signal_checkpoint_eventfd = signal_checkpoint_efd;
4242
4343 // Used to block new writes to disk when a batch is already getting flushed.
44- s_flush_efd = eventfd (1 , 0 );
45- if (s_flush_efd == -1 )
44+ s_flush_eventfd = eventfd (1 , 0 );
45+ if (s_flush_eventfd == -1 )
4646 {
4747 const char * reason = ::explain_eventfd (1 , 0 );
4848 throw_system_error (reason);
@@ -62,7 +62,7 @@ async_disk_writer_t::~async_disk_writer_t()
6262
6363void async_disk_writer_t::teardown ()
6464{
65- close_fd (s_flush_efd );
65+ close_fd (s_flush_eventfd );
6666}
6767
6868void async_disk_writer_t::throw_error (std::string err_msg, int err, uint64_t user_data)
@@ -76,12 +76,7 @@ void async_disk_writer_t::throw_error(std::string err_msg, int err, uint64_t use
7676 throw_system_error (ss.str (), err);
7777}
7878
79- void async_disk_writer_t::map_commit_ts_to_session_decision_efd (gaia_txn_id_t commit_ts, int session_decision_fd)
80- {
81- m_ts_to_session_decision_fd_map.insert (std::pair (commit_ts, session_decision_fd));
82- }
83-
84- void async_disk_writer_t::add_decisions_to_batch (decision_list_t & decisions)
79+ void async_disk_writer_t::add_decisions_to_batch (const decision_list_t & decisions)
8580{
8681 for (const auto & decision : decisions)
8782 {
@@ -106,7 +101,7 @@ void async_disk_writer_t::perform_post_completion_maintenance()
106101 // Signal to checkpointing thread the upper bound of files that it can process.
107102 if (max_file_seq_to_close > 0 )
108103 {
109- signal_eventfd (m_signal_checkpoint_efd , max_file_seq_to_close);
104+ signal_eventfd (m_signal_checkpoint_eventfd , max_file_seq_to_close);
110105 }
111106
112107 const decision_list_t & decisions = m_in_flight_batch->get_decision_batch_entries ();
@@ -116,10 +111,10 @@ void async_disk_writer_t::perform_post_completion_maintenance()
116111 transactions::txn_metadata_t::set_txn_durable (decision.commit_ts );
117112
118113 // Unblock session thread.
119- auto itr = m_ts_to_session_decision_fd_map .find (decision.commit_ts );
120- ASSERT_INVARIANT (itr != m_ts_to_session_decision_fd_map .end (), " Unable to find session durability eventfd from committing txn's commit_ts" );
114+ auto itr = m_ts_to_session_decision_eventfd_map .find (decision.commit_ts );
115+ ASSERT_INVARIANT (itr != m_ts_to_session_decision_eventfd_map .end (), " Unable to find session durability eventfd from committing txn's commit_ts" );
121116 signal_eventfd_single_thread (itr->second );
122- m_ts_to_session_decision_fd_map .erase (itr);
117+ m_ts_to_session_decision_eventfd_map .erase (itr);
123118 }
124119
125120 m_in_flight_batch->clear_decision_batch ();
@@ -130,7 +125,7 @@ void async_disk_writer_t::submit_and_swap_in_progress_batch(int file_fd, bool sh
130125 eventfd_t event_counter;
131126
132127 // Block on any pending disk flushes.
133- eventfd_read (s_flush_efd , &event_counter);
128+ eventfd_read (s_flush_eventfd , &event_counter);
134129
135130 // Perform any maintenance on the in_flight batch.
136131 perform_post_completion_maintenance ();
@@ -147,7 +142,7 @@ void async_disk_writer_t::finish_and_submit_batch(int file_fd, bool should_wait_
147142 swap_batches ();
148143
149144 // Nothing to submit; reset the flush efd that got burnt in submit_and_swap_in_progress_batch() function.
150- signal_eventfd_single_thread (s_flush_efd );
145+ signal_eventfd_single_thread (s_flush_eventfd );
151146
152147 // Reset metadata buffer.
153148 m_metadata_buffer.clear ();
@@ -158,8 +153,8 @@ void async_disk_writer_t::finish_and_submit_batch(int file_fd, bool should_wait_
158153 m_in_progress_batch->add_fdatasync_op_to_batch (file_fd, get_enum_value (uring_op_t ::fdatasync), IOSQE_IO_LINK);
159154
160155 // Signal eventfd's as part of batch.
161- m_in_progress_batch->add_pwritev_op_to_batch (static_cast <void *>(&c_default_iov), 1 , s_flush_efd , 0 , get_enum_value (uring_op_t ::pwritev_eventfd_flush), IOSQE_IO_LINK);
162- m_in_progress_batch->add_pwritev_op_to_batch (static_cast <void *>(&c_default_iov), 1 , m_validate_flush_efd , 0 , get_enum_value (uring_op_t ::pwritev_eventfd_validate), IOSQE_IO_DRAIN);
156+ m_in_progress_batch->add_pwritev_op_to_batch (static_cast <void *>(&c_default_iov), 1 , s_flush_eventfd , 0 , get_enum_value (uring_op_t ::pwritev_eventfd_flush), IOSQE_IO_LINK);
157+ m_in_progress_batch->add_pwritev_op_to_batch (static_cast <void *>(&c_default_iov), 1 , m_validate_flush_eventfd , 0 , get_enum_value (uring_op_t ::pwritev_eventfd_validate), IOSQE_IO_DRAIN);
163158
164159 swap_batches ();
165160 auto flushed_batch_size = m_in_flight_batch->get_unsubmitted_entries_count ();
@@ -187,7 +182,7 @@ void async_disk_writer_t::perform_file_close_operations(int file_fd, file_sequen
187182 m_in_progress_batch->append_file_to_batch (file_fd, log_seq);
188183}
189184
190- unsigned char * async_disk_writer_t::copy_into_metadata_buffer (void * source, size_t size, int file_fd)
185+ unsigned char * async_disk_writer_t::copy_into_metadata_buffer (const void * source, size_t size, int file_fd)
191186{
192187 auto current_ptr = m_metadata_buffer.get_current_ptr ();
193188 ASSERT_PRECONDITION (current_ptr, " Invalid metadata buffer pointer." );
0 commit comments