This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch testing
in repository sanlock.
commit abab5e6f19abc927dba11635614c19a5590f9c04
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Nov 20 15:00:54 2017 -0600
sanlock: add all dblock vals to debug
for first four hosts.
TODO: make configurable
---
src/paxos_lease.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 77 insertions(+), 7 deletions(-)
diff --git a/src/paxos_lease.c b/src/paxos_lease.c
index 726056f..777757b 100644
--- a/src/paxos_lease.c
+++ b/src/paxos_lease.c
@@ -431,6 +431,8 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
uint64_t next_lver, uint64_t our_mbal,
struct paxos_dblock *dblock_out)
{
+ char bk_debug[256];
+ char bk_str[64];
struct paxos_dblock dblock;
struct paxos_dblock bk_in;
struct paxos_dblock bk_max;
@@ -477,7 +479,7 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
* component is greater than dblock[p].mbal."
*/
- log_token(token, "ballot %llu phase1 mbal %llu",
+ log_token(token, "ballot %llu phase1 write mbal %llu",
(unsigned long long)next_lver,
(unsigned long long)our_mbal);
@@ -491,6 +493,7 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
num_writes = 0;
for (d = 0; d < num_disks; d++) {
+ /* acquire io: write 1 */
rv = write_dblock(task, token, &token->disks[d], token->host_id,
&dblock);
if (rv < 0)
continue;
@@ -504,6 +507,8 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
goto out;
}
+ memset(bk_debug, 0, sizeof(bk_debug));
+
num_reads = 0;
for (d = 0; d < num_disks; d++) {
@@ -513,6 +518,7 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
continue;
memset(iobuf[d], 0, iobuf_len);
+ /* acquire io: read 2 */
rv = read_iobuf(disk->fd, disk->offset, iobuf[d], iobuf_len, task,
token->io_timeout, NULL);
if (rv == SANLK_AIO_TIMEOUT)
iobuf[d] = NULL;
@@ -528,6 +534,19 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
paxos_dblock_in(bk_end, &bk_in);
bk = &bk_in;
+ if (q < 4) {
+ memset(bk_str, 0, sizeof(bk_str));
+ snprintf(bk_str, 64, "%d:%llu:%llu:%llu:%llu:%llu:%llu,", q,
+ (unsigned long long)bk_in.mbal,
+ (unsigned long long)bk_in.bal,
+ (unsigned long long)bk_in.inp,
+ (unsigned long long)bk_in.inp2,
+ (unsigned long long)bk_in.inp3,
+ (unsigned long long)bk_in.lver);
+ bk_str[63] = '\0';
+ strcat(bk_debug, bk_str);
+ }
+
rv = verify_dblock(token, bk, checksum);
if (rv < 0)
continue;
@@ -576,6 +595,9 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
}
}
+ log_token(token, "ballot %llu phase1 read %s",
+ (unsigned long long)next_lver, bk_debug);
+
if (!majority_disks(num_disks, num_reads)) {
log_errot(token, "ballot %llu dblock read error %d",
(unsigned long long)next_lver, rv);
@@ -634,7 +656,7 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
phase2 = 1;
- log_token(token, "ballot %llu phase2 bal %llu inp %llu %llu %llu q_max %d",
+ log_token(token, "ballot %llu phase2 write bal %llu inp %llu %llu %llu q_max
%d",
(unsigned long long)dblock.lver,
(unsigned long long)dblock.bal,
(unsigned long long)dblock.inp,
@@ -645,6 +667,7 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
num_writes = 0;
for (d = 0; d < num_disks; d++) {
+ /* acquire io: write 2 */
rv = write_dblock(task, token, &token->disks[d], token->host_id,
&dblock);
if (rv < 0)
continue;
@@ -658,6 +681,8 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
goto out;
}
+ memset(bk_debug, 0, sizeof(bk_debug));
+
num_reads = 0;
for (d = 0; d < num_disks; d++) {
@@ -667,6 +692,7 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
continue;
memset(iobuf[d], 0, iobuf_len);
+ /* acquire io: read 3 */
rv = read_iobuf(disk->fd, disk->offset, iobuf[d], iobuf_len, task,
token->io_timeout, NULL);
if (rv == SANLK_AIO_TIMEOUT)
iobuf[d] = NULL;
@@ -682,6 +708,19 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
paxos_dblock_in(bk_end, &bk_in);
bk = &bk_in;
+ if (q < 4) {
+ memset(bk_str, 0, sizeof(bk_str));
+ snprintf(bk_str, 64, "%d:%llu:%llu:%llu:%llu:%llu:%llu,", q,
+ (unsigned long long)bk->mbal,
+ (unsigned long long)bk->bal,
+ (unsigned long long)bk->inp,
+ (unsigned long long)bk->inp2,
+ (unsigned long long)bk->inp3,
+ (unsigned long long)bk->lver);
+ bk_str[63] = '\0';
+ strcat(bk_debug, bk_str);
+ }
+
rv = verify_dblock(token, bk, checksum);
if (rv < 0)
continue;
@@ -731,6 +770,9 @@ static int run_ballot(struct task *task, struct token *token, int
num_hosts,
}
}
+ log_token(token, "ballot %llu phase2 read %s",
+ (unsigned long long)next_lver, bk_debug);
+
if (!majority_disks(num_disks, num_reads)) {
log_errot(token, "ballot %llu dblock read2 error %d",
(unsigned long long)next_lver, rv);
@@ -1120,8 +1162,11 @@ static int _lease_read_one(struct task *task,
struct paxos_dblock *our_dblock,
uint64_t *max_mbal,
int *max_q,
- const char *caller)
+ const char *caller,
+ int log_bk_vals)
{
+ char bk_debug[256];
+ char bk_str[64];
struct leader_record leader_end;
struct paxos_dblock our_dblock_end;
struct paxos_dblock bk;
@@ -1162,6 +1207,8 @@ static int _lease_read_one(struct task *task,
if (rv < 0)
goto out;
+ memset(bk_debug, 0, sizeof(bk_debug));
+
for (q = 0; q < leader_ret->num_hosts; q++) {
bk_end = (struct paxos_dblock *)(iobuf + ((2 + q) * sector_size));
@@ -1169,6 +1216,19 @@ static int _lease_read_one(struct task *task,
paxos_dblock_in(bk_end, &bk);
+ if (log_bk_vals && (q < 4)) {
+ memset(bk_str, 0, sizeof(bk_str));
+ snprintf(bk_str, 64, "%d:%llu:%llu:%llu:%llu:%llu:%llu,", q,
+ (unsigned long long)bk.mbal,
+ (unsigned long long)bk.bal,
+ (unsigned long long)bk.inp,
+ (unsigned long long)bk.inp2,
+ (unsigned long long)bk.inp3,
+ (unsigned long long)bk.lver);
+ bk_str[63] = '\0';
+ strcat(bk_debug, bk_str);
+ }
+
rv = verify_dblock(token, &bk, checksum);
if (rv < 0)
goto out;
@@ -1181,6 +1241,14 @@ static int _lease_read_one(struct task *task,
*max_mbal = tmp_mbal;
*max_q = tmp_q;
+ if (log_bk_vals)
+ log_token(token, "leader %llu owner %llu %llu %llu dblocks %s",
+ (unsigned long long)leader_ret->lver,
+ (unsigned long long)leader_ret->owner_id,
+ (unsigned long long)leader_ret->owner_generation,
+ (unsigned long long)leader_ret->timestamp,
+ bk_debug);
+
out:
if (rv != SANLK_AIO_TIMEOUT)
free(iobuf);
@@ -1227,7 +1295,7 @@ static int _lease_read_num(struct task *task,
for (d = 0; d < num_disks; d++) {
rv = _lease_read_one(task, token, &token->disks[d], &leader_one,
- &dblock_one, &mbal_one, &q_one, caller);
+ &dblock_one, &mbal_one, &q_one, caller, 0);
if (rv < 0)
continue;
@@ -1297,7 +1365,7 @@ static int _lease_read_num(struct task *task,
static int paxos_lease_read(struct task *task, struct token *token,
struct leader_record *leader_ret,
- uint64_t *max_mbal, const char *caller)
+ uint64_t *max_mbal, const char *caller, int log_bk_vals)
{
struct paxos_dblock our_dblock;
int rv, q = -1;
@@ -1307,7 +1375,7 @@ static int paxos_lease_read(struct task *task, struct token *token,
leader_ret, &our_dblock, max_mbal, &q, caller);
else
rv = _lease_read_one(task, token, &token->disks[0],
- leader_ret, &our_dblock, max_mbal, &q, caller);
+ leader_ret, &our_dblock, max_mbal, &q, caller, log_bk_vals);
if (rv == SANLK_OK)
log_token(token, "%s leader %llu owner %llu %llu %llu max mbal[%d] %llu "
@@ -1427,7 +1495,8 @@ int paxos_lease_acquire(struct task *task,
restart:
- error = paxos_lease_read(task, token, &cur_leader, &max_mbal,
"paxos_acquire");
+ /* acquire io: read 1 */
+ error = paxos_lease_read(task, token, &cur_leader, &max_mbal,
"paxos_acquire", 1);
if (error < 0)
goto out;
@@ -1730,6 +1799,7 @@ int paxos_lease_acquire(struct task *task,
copy_cur_leader = 0;
memcpy(&tmp_leader, &cur_leader, sizeof(struct leader_record));
} else {
+ /* acquire io: read 1 (for retry) */
error = paxos_lease_leader_read(task, token, &tmp_leader,
"paxos_acquire");
if (error < 0)
goto out;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.