Skip to content

Commit 877c7d5

Browse files
committed
clean code 2
1 parent 93bf6f1 commit 877c7d5

File tree

15 files changed

+242
-302
lines changed

15 files changed

+242
-302
lines changed

Diff for: build_mysql.sh

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ IS_DEBUG=0
1313
BUILD_NAME="-DUNIV_PMEMOBJ_PPL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PL -DUNIV_TRACE_RECOVERY_TIME"
1414
#BUILD_NAME="-DUNIV_PMEMOBJ_PPL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PART_PL_DEBUG -DUNIV_PMEMOBJ_PL -DUNIV_TRACE_FLUSH_TIME"
1515

16+
####debug with valid mtr
17+
#BUILD_NAME="-DUNIV_PMEMOBJ_VALID_MTR -DUNIV_PMEMOBJ_PPL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PL -DUNIV_TRACE_RECOVERY_TIME"
1618

1719
## Standalone PL-NVM
1820
## Standard version

Diff for: storage/innobase/buf/buf0flu.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,8 @@ buf_flush_write_block_low(
11341134
#endif /*UNIV_PMEMOBJ_BUF*/
11351135

11361136
#if defined (UNIV_PMEMOBJ_PART_PL)
1137-
pm_ppl_set_flush_state(gb_pmw->pop, gb_pmw->ppl, bpage);
1137+
/*We don't set state anymore*/
1138+
//pm_ppl_set_flush_state(gb_pmw->pop, gb_pmw->ppl, bpage);
11381139
#endif /*UNIV_PMEMOBJ_PART_PL*/
11391140

11401141
/* Disable use of double-write buffer for temporary tablespace.

Diff for: storage/innobase/include/log0recv.h

+4
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ typedef std::vector<recv_encryption_t, ut_allocator<recv_encryption_t> >
289289

290290
/** Recovery system data structure */
291291
struct recv_sys_t{
292+
#if defined (UNIV_TRACE_RECOVERY_TIME)
293+
ulint redo1_time;
294+
#endif //UNIV_TRACE_RECOVERY_TIME
295+
292296
#ifndef UNIV_HOTBACKUP
293297
ib_mutex_t mutex; /*!< mutex protecting the fields apply_log_recs,
294298
n_addrs, and the state field in each recv_addr

Diff for: storage/innobase/include/mtr0log.h

+5
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,12 @@ mlog_parse_index(
250250
#ifndef UNIV_HOTBACKUP
251251
/** Insert, update, and maybe other functions may use this value to define an
252252
extra mlog buffer size for variable size data */
253+
#if defined (UNIV_PMEMOBJ_PART_PL)
254+
/*we need to increase this value for Linkbench*/
255+
#define MLOG_BUF_MARGIN 512
256+
#else //original
253257
#define MLOG_BUF_MARGIN 256
258+
#endif //UNIV_PMEMOBJ_PART_PL
254259
#endif /* !UNIV_HOTBACKUP */
255260

256261
#ifndef UNIV_NONINL

Diff for: storage/innobase/include/mtr0mtr.h

-2
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,6 @@ struct mtr_t {
643643

644644
cur_max_size = m_impl.max_buf_size;
645645
if (m_impl.cur_off + size > cur_max_size){
646-
//since reallocate cause some bugs (e.g. b-tree split) we report bug here
647-
//assert(0);
648646

649647
new_size = ((size / cur_max_size) + 2) * cur_max_size;
650648
new_ptr = (byte*) realloc(m_impl.buf, new_size);

Diff for: storage/innobase/include/my_pmemobj.h

+50-4
Original file line numberDiff line numberDiff line change
@@ -1147,14 +1147,31 @@ pm_ppl_hash_get(
11471147
PMEM_PAGE_LOG_HASHED_LINE* pline,
11481148
uint64_t key );
11491149

1150-
plog_hash_t*
1150+
/*
1151+
* Add a plogblock's key on the pline hashtable
1152+
* @param[in] pop
1153+
* @param[in] ppl
1154+
* @param[in] pline pointer to the line that has hashtable to add on
1155+
* @param[in] plog_block pointer to the logblock
1156+
* @param[in] idx index of the block on the line
1157+
* @return: the hash item added
1158+
* */
1159+
static inline void
11511160
pm_ppl_hash_add(
1152-
PMEMobjpool* pop,
1153-
PMEM_PAGE_PART_LOG* ppl,
11541161
PMEM_PAGE_LOG_HASHED_LINE* pline,
11551162
PMEM_PAGE_LOG_BLOCK* plog_block,
11561163
uint32_t idx
1157-
);
1164+
)
1165+
{
1166+
1167+
plog_hash_t* item;
1168+
1169+
item = (plog_hash_t*) malloc(sizeof(plog_hash_t));
1170+
item->key = plog_block->key;
1171+
item->block_off = idx;
1172+
HASH_INSERT(plog_hash_t, addr_hash, pline->addr_hash, plog_block->key, item);
1173+
1174+
}
11581175

11591176
plog_hash_t*
11601177
pm_ppl_hash_check_and_add(
@@ -1302,6 +1319,35 @@ __pm_write_log_buf(
13021319
PMEM_PAGE_LOG_BLOCK* plog_block,
13031320
bool is_first_write);
13041321

1322+
static inline void
1323+
pm_write_log_rec_low(
1324+
PMEMobjpool* pop,
1325+
byte* log_des,
1326+
byte* log_src,
1327+
uint64_t size)
1328+
{
1329+
pmemobj_memcpy_persist(
1330+
pop,
1331+
log_des,
1332+
log_src,
1333+
size);
1334+
//if (size <= CACHELINE_SIZE){
1335+
// //We need persistent copy, Do not need a transaction for atomicity
1336+
// pmemobj_memcpy_persist(
1337+
// pop,
1338+
// log_des,
1339+
// log_src,
1340+
// size);
1341+
1342+
//}
1343+
//else{
1344+
// TX_BEGIN(pop) {
1345+
// TX_MEMCPY(log_des, log_src, size);
1346+
// }TX_ONABORT {
1347+
// }TX_END
1348+
//}
1349+
}
1350+
13051351
void
13061352
__pm_write_log_rec_low(
13071353
PMEMobjpool* pop,

Diff for: storage/innobase/log/log0log.cc

+14-20
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,9 @@ log_close(void)
585585

586586
log_has_printed_chkp_warning = true;
587587
log_last_warning_time = time(NULL);
588-
588+
#if defined (UNIV_SKIPLOG)
589+
printf("===> SKIPLOG ERROR lsn %zu last_checkpoint_lsn %zu age %zu \n", lsn, log->last_checkpoint_lsn, checkpoint_age );
590+
#endif
589591
ib::error() << "The age of the last checkpoint is "
590592
<< checkpoint_age << ", which exceeds the log"
591593
" group capacity " << log->log_group_capacity
@@ -1948,8 +1950,8 @@ log_checkpoint(
19481950
}
19491951
#endif /* !_WIN32 */
19501952

1951-
//#if defined (UNIV_PMEMOBJ_PL) || defined (UNIV_SKIPLOG)
1952-
#if defined (UNIV_PMEMOBJ_PL)
1953+
#if defined (UNIV_PMEMOBJ_PL) || defined (UNIV_SKIPLOG)
1954+
//#if defined (UNIV_PMEMOBJ_PL)
19531955
//printf("PL DEBUG ====> log_checkpoint()\n");
19541956
//hot fix bug: when start server recv_recovery_rollback_active() ->
19551957
// row_merge_drop_temp_indexes() -> que_eval_sql() -> que_run_threads()
@@ -2015,6 +2017,9 @@ log_checkpoint(
20152017
#if defined (UNIV_PMEMOBJ_WAL)
20162018
//no flush log at checkpoint
20172019
#else //original
2020+
//tdnguyen test
2021+
// ulint t = ut_time_us(NULL);
2022+
// printf("===> ckpt_trace LOGWRITE time %zu log_write_up_to flush_lsn %zu sync %zu\n", t, flush_lsn, sync);
20182023
log_write_up_to(flush_lsn, true);
20192024
#endif
20202025
DBUG_EXECUTE_IF(
@@ -2087,31 +2092,20 @@ pm_ppl_checkpoint(
20872092

20882093
new_oldest = ppl->max_oldest_lsn;
20892094

2090-
printf("PMEM_INFO: call pm_ppl_checkpoint new_oldest %zu ppl->ckpt_lsn %zu\n",
2091-
new_oldest, ppl->ckpt_lsn);
2095+
float delta = (ppl->max_oldest_lsn - ppl->ckpt_lsn) * 1.0 / 1000000;
2096+
2097+
printf("PMEM_INFO: call pm_ppl_checkpoint new_oldest %zu ppl->ckpt_lsn %zu delta %f seconds \n",
2098+
new_oldest, ppl->ckpt_lsn, delta);
20922099

20932100
/*(2) simulate fil_names_clear()*/
20942101
pm_ppl_fil_names_clear(new_oldest);
20952102

20962103
/*(3) Write pages in buffer pool upto the ckpt_lsn*/
2097-
//success = log_preflush_pool_modified_pages(new_oldest);
2098-
20992104
/*simulate buf_flush_request_force() without call buf_flush_wait_flushed() as in log_preflush_pool_modified_pages() */
21002105
pm_ppl_buf_flush_request_force(new_oldest);
21012106

21022107
buf_flush_wait_flushed(new_oldest);
21032108

2104-
///*(4) reset the ckpt_lsn */
2105-
//for (i = 0; i < n; i++){
2106-
// pline = D_RW(D_RW(ppl->buckets)[i]);
2107-
2108-
// pmemobj_rwlock_wrlock(pop, &pline->lock);
2109-
// if (pline->ckpt_lsn > 0){
2110-
// pline->ckpt_lsn = 0;
2111-
// }
2112-
// pmemobj_rwlock_unlock(pop, &pline->lock);
2113-
//}
2114-
21152109
/* (5) update the global ckpt_lsn*/
21162110
pmemobj_rwlock_wrlock(pop, &ppl->ckpt_lock);
21172111
ppl->ckpt_lsn = new_oldest;
@@ -2130,7 +2124,8 @@ log_make_checkpoint_at(
21302124
bool write_always)
21312125
{
21322126
//tdnguyen test
2133-
//printf("=========== \nCKPT: call log_checkpoint() from log_make_checkpoint_at()\n===========\n");
2127+
ulint t = ut_time_ms();
2128+
printf("=========== \n%zu CKPT: call log_checkpoint() from log_make_checkpoint_at()\n===========\n", t);
21342129
/* Preflush pages synchronously */
21352130

21362131
while (!log_preflush_pool_modified_pages(lsn)) {
@@ -2203,7 +2198,6 @@ log_checkpoint_margin(void)
22032198

22042199
if (advance) {
22052200
lsn_t new_oldest = oldest_lsn + advance;
2206-
22072201
success = log_preflush_pool_modified_pages(new_oldest);
22082202

22092203
/* If the flush succeeded, this thread has done its part

0 commit comments

Comments
 (0)