Skip to content

Instantly share code, notes, and snippets.

@tony2001
Created June 26, 2013 15:44
Show Gist options
  • Save tony2001/5868534 to your computer and use it in GitHub Desktop.
Save tony2001/5868534 to your computer and use it in GitHub Desktop.
diff --git a/src/ha_pinba.cc b/src/ha_pinba.cc
index 67175f4..271907f 100644
--- a/src/ha_pinba.cc
+++ b/src/ha_pinba.cc
@@ -787,7 +787,6 @@ static inline pinba_tag_report *pinba_regenerate_tag_info(PINBA_SHARE *share) /*
for (j = 0; j < record->timers_cnt; j++) {
tag_found = 0;
- pthread_rwlock_rdlock(&D->timer_lock);
timer = record_get_timer(&D->timer_pool, record, j);
for (k = 0; k < timer->tag_num; k++) {
@@ -800,7 +799,6 @@ static inline pinba_tag_report *pinba_regenerate_tag_info(PINBA_SHARE *share) /*
if (!tag_found) {
/* tag not found in this timer */
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -811,13 +809,11 @@ static inline pinba_tag_report *pinba_regenerate_tag_info(PINBA_SHARE *share) /*
ppvalue = JudySLIns(&report->results, (uint8_t *)word->str, NULL);
if (UNLIKELY(!ppvalue || ppvalue == PPJERR)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
data = (struct pinba_tag_info_data *)calloc(1, sizeof(struct pinba_tag_info_data));
if (UNLIKELY(!data)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -841,7 +837,6 @@ static inline pinba_tag_report *pinba_regenerate_tag_info(PINBA_SHARE *share) /*
data->req_count++;
data->prev_add_request_id = i;
}
- pthread_rwlock_unlock(&D->timer_lock);
}
}
pthread_rwlock_unlock(&report->lock);
@@ -951,7 +946,6 @@ static inline pinba_tag_report *pinba_regenerate_tag2_info(PINBA_SHARE *share) /
for (j = 0; j < record->timers_cnt; j++) {
tag1_pos = tag2_pos = -1;
- pthread_rwlock_rdlock(&D->timer_lock);
timer = record_get_timer(&D->timer_pool, record, j);
for (k = 0; k < timer->tag_num; k++) {
@@ -968,7 +962,6 @@ static inline pinba_tag_report *pinba_regenerate_tag2_info(PINBA_SHARE *share) /
}
if (tag1_pos == -1 || tag2_pos == -1) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -985,13 +978,11 @@ static inline pinba_tag_report *pinba_regenerate_tag2_info(PINBA_SHARE *share) /
ppvalue = JudySLIns(&report->results, index_val, NULL);
if (UNLIKELY(!ppvalue || ppvalue == PPJERR)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
data = (struct pinba_tag2_info_data *)calloc(1, sizeof(struct pinba_tag2_info_data));
if (UNLIKELY(!data)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -1018,7 +1009,6 @@ static inline pinba_tag_report *pinba_regenerate_tag2_info(PINBA_SHARE *share) /
data->req_count++;
data->prev_add_request_id = i;
}
- pthread_rwlock_unlock(&D->timer_lock);
}
}
pthread_rwlock_unlock(&report->lock);
@@ -1121,7 +1111,6 @@ static inline pinba_tag_report *pinba_regenerate_tag_report(PINBA_SHARE *share)
for (j = 0; j < record->timers_cnt; j++) {
tag_found = 0;
- pthread_rwlock_rdlock(&D->timer_lock);
timer = record_get_timer(&D->timer_pool, record, j);
for (k = 0; k < timer->tag_num; k++) {
@@ -1134,7 +1123,6 @@ static inline pinba_tag_report *pinba_regenerate_tag_report(PINBA_SHARE *share)
if (!tag_found) {
/* tag not found in this timer */
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -1143,7 +1131,6 @@ static inline pinba_tag_report *pinba_regenerate_tag_report(PINBA_SHARE *share)
if (!ppvalue_script) {
ppvalue_script = JudySLIns(&report->results, (uint8_t *)record->data.script_name, NULL);
if (UNLIKELY(!ppvalue_script || ppvalue_script == PPJERR)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
}
@@ -1154,13 +1141,11 @@ static inline pinba_tag_report *pinba_regenerate_tag_report(PINBA_SHARE *share)
ppvalue = JudySLIns(ppvalue_script, (uint8_t *)word->str, NULL);
if (UNLIKELY(!ppvalue || ppvalue == PPJERR)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
data = (struct pinba_tag_report_data *)calloc(1, sizeof(struct pinba_tag_report_data));
if (UNLIKELY(!data)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -1187,7 +1172,6 @@ static inline pinba_tag_report *pinba_regenerate_tag_report(PINBA_SHARE *share)
data->req_count++;
data->prev_add_request_id = i;
}
- pthread_rwlock_unlock(&D->timer_lock);
}
}
pthread_rwlock_unlock(&report->lock);
@@ -1299,7 +1283,6 @@ static inline pinba_tag_report *pinba_regenerate_tag2_report(PINBA_SHARE *share)
for (j = 0; j < record->timers_cnt; j++) {
tag1_pos = tag2_pos = -1;
- pthread_rwlock_rdlock(&D->timer_lock);
timer = record_get_timer(&D->timer_pool, record, j);
for (k = 0; k < timer->tag_num; k++) {
@@ -1316,7 +1299,6 @@ static inline pinba_tag_report *pinba_regenerate_tag2_report(PINBA_SHARE *share)
}
if (tag1_pos == -1 || tag2_pos == -1) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -1330,7 +1312,6 @@ static inline pinba_tag_report *pinba_regenerate_tag2_report(PINBA_SHARE *share)
if (!ppvalue_script) {
ppvalue_script = JudySLIns(&report->results, (uint8_t *)record->data.script_name, NULL);
if (UNLIKELY(!ppvalue_script || ppvalue_script == PPJERR)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
}
@@ -1340,13 +1321,11 @@ static inline pinba_tag_report *pinba_regenerate_tag2_report(PINBA_SHARE *share)
ppvalue = JudySLIns(ppvalue_script, index_val, NULL);
if (UNLIKELY(!ppvalue || ppvalue == PPJERR)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
data = (struct pinba_tag2_report_data *)calloc(1, sizeof(struct pinba_tag2_report_data));
if (UNLIKELY(!data)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -1374,7 +1353,6 @@ static inline pinba_tag_report *pinba_regenerate_tag2_report(PINBA_SHARE *share)
data->req_count++;
data->prev_add_request_id = i;
}
- pthread_rwlock_unlock(&D->timer_lock);
}
}
pthread_rwlock_unlock(&report->lock);
@@ -1476,7 +1454,6 @@ static inline pinba_tag_report *pinba_regenerate_tag_report2(PINBA_SHARE *share)
for (j = 0; j < record->timers_cnt; j++) {
tag_found = 0;
- pthread_rwlock_rdlock(&D->timer_lock);
timer = record_get_timer(&D->timer_pool, record, j);
for (k = 0; k < timer->tag_num; k++) {
@@ -1489,7 +1466,6 @@ static inline pinba_tag_report *pinba_regenerate_tag_report2(PINBA_SHARE *share)
if (!tag_found) {
/* tag not found in this timer */
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -1509,13 +1485,11 @@ static inline pinba_tag_report *pinba_regenerate_tag_report2(PINBA_SHARE *share)
ppvalue = JudySLIns(&report->results, index_val, NULL);
if (UNLIKELY(!ppvalue || ppvalue == PPJERR)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
data = (struct pinba_tag_report2_data *)calloc(1, sizeof(struct pinba_tag_report2_data));
if (UNLIKELY(!data)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -1544,7 +1518,6 @@ static inline pinba_tag_report *pinba_regenerate_tag_report2(PINBA_SHARE *share)
data->req_count++;
data->prev_add_request_id = i;
}
- pthread_rwlock_unlock(&D->timer_lock);
}
}
pthread_rwlock_unlock(&report->lock);
@@ -1660,7 +1633,6 @@ static inline pinba_tag_report *pinba_regenerate_tag2_report2(PINBA_SHARE *share
for (j = 0; j < record->timers_cnt; j++) {
tag1_pos = tag2_pos = -1;
- pthread_rwlock_rdlock(&D->timer_lock);
timer = record_get_timer(&D->timer_pool, record, j);
for (k = 0; k < timer->tag_num; k++) {
@@ -1677,7 +1649,6 @@ static inline pinba_tag_report *pinba_regenerate_tag2_report2(PINBA_SHARE *share
}
if (tag1_pos == -1 || tag2_pos == -1) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -1700,13 +1671,11 @@ static inline pinba_tag_report *pinba_regenerate_tag2_report2(PINBA_SHARE *share
ppvalue = JudySLIns(&report->results, index_val, NULL);
if (UNLIKELY(!ppvalue || ppvalue == PPJERR)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
data = (struct pinba_tag2_report2_data *)calloc(1, sizeof(struct pinba_tag2_report2_data));
if (UNLIKELY(!data)) {
- pthread_rwlock_unlock(&D->timer_lock);
continue;
}
@@ -1736,7 +1705,6 @@ static inline pinba_tag_report *pinba_regenerate_tag2_report2(PINBA_SHARE *share
data->req_count++;
data->prev_add_request_id = i;
}
- pthread_rwlock_unlock(&D->timer_lock);
}
}
pthread_rwlock_unlock(&report->lock);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment