Browse Source

ckdb - display seq trans messages as seqnum ranges rather than one per seqnum

master
kanoi 9 years ago
parent
commit
a54c265ea9
  1. 78
      src/ckdb.c
  2. 6
      src/ckdb.h

78
src/ckdb.c

@ -2036,14 +2036,16 @@ static void trans_process(SEQSET *seqset, tv_t *now, K_STORE *store)
static void trans_seq(tv_t *now) static void trans_seq(tv_t *now)
{ {
char t_buf[DATE_BUFSIZ], t_buf2[DATE_BUFSIZ]; char t_buf[DATE_BUFSIZ], t_buf2[DATE_BUFSIZ];
char range[64];
K_STORE *store; K_STORE *store;
SEQSET *seqset = NULL; SEQSET *seqset = NULL;
K_ITEM *item = NULL, *lastitem = NULL; K_ITEM *item = NULL, *lastitem = NULL;
SEQTRANS *seqtrans; SEQTRANS *seqtrans;
K_ITEM *st_item; K_ITEM *st_item;
uint64_t seqstt = 0, seqpid = 0; uint64_t seqstt = 0, seqpid = 0, seqnum0, seqnum1;
bool more = true; tv_t seqsec;
int i, j; bool more = true, gotseq;
int i, j, nam;
store = k_new_store(seqtrans_free); store = k_new_store(seqtrans_free);
for (i = 0; more; i++) { for (i = 0; more; i++) {
@ -2077,18 +2079,72 @@ static void trans_seq(tv_t *now)
SEQUNLOCK(); SEQUNLOCK();
st_item = STORE_TAIL_NOLOCK(store); st_item = STORE_TAIL_NOLOCK(store);
/* Display one line for all records that would display the same
* excluding the sequence number - displayed as a continuous
* range */
seqnum0 = seqnum1 = 0;
seqsec.tv_sec = 0;
gotseq = false;
nam = -1;
while (st_item) { while (st_item) {
DATA_SEQTRANS(seqtrans, st_item); DATA_SEQTRANS(seqtrans, st_item);
btu64_to_buf(&seqstt, t_buf, sizeof(t_buf)); if (!gotseq) {
bt_to_buf(&(seqtrans->entry.time.tv_sec), t_buf2, seqnum0 = seqnum1 = seqtrans->seqnum;
sizeof(t_buf2)); nam = seqtrans->seq;
LOGWARNING("Seq trans %s %"PRIu64" set:%d/%"PRIu64 seqsec.tv_sec = seqtrans->entry.time.tv_sec;
"=%s/%"PRIu64" %s/%s", gotseq = true;
seqnam[seqtrans->seq], seqtrans->seqnum, } else {
i, seqstt, t_buf, seqpid, if (seqtrans->seqnum == seqnum1+1 &&
t_buf2, seqtrans->entry.code); seqtrans->seq == nam &&
seqtrans->entry.time.tv_sec == seqsec.tv_sec) {
seqnum1++;
} else {
// Display the previous range
if (seqnum0 == seqnum1) {
snprintf(range, sizeof(range),
"%"PRIu64, seqnum1);
} else {
snprintf(range, sizeof(range),
"%"PRIu64"-%"PRIu64,
seqnum0, seqnum1);
}
btu64_to_buf(&seqstt, t_buf,
sizeof(t_buf));
bt_to_buf(&(seqsec.tv_sec), t_buf2,
sizeof(t_buf2));
LOGWARNING("Seq trans %s %s set:%d/"
"%"PRIu64"=%s/%"PRIu64" %s",
seqnam[nam], range,
i, seqstt, t_buf, seqpid,
t_buf2);
// Current record is a new range
seqnum0 = seqnum1 = seqtrans->seqnum;
nam = seqtrans->seq;
seqsec.tv_sec = seqtrans->entry.time.tv_sec;
gotseq = true;
}
}
st_item = st_item->prev; st_item = st_item->prev;
} }
// Display the last range if there was one
if (gotseq) {
if (seqnum0 == seqnum1) {
snprintf(range, sizeof(range),
"%"PRIu64, seqnum1);
} else {
snprintf(range, sizeof(range),
"%"PRIu64"-%"PRIu64,
seqnum0, seqnum1);
}
btu64_to_buf(&seqstt, t_buf, sizeof(t_buf));
bt_to_buf(&(seqsec.tv_sec), t_buf2, sizeof(t_buf2));
LOGWARNING("Seq trans %s %s set:%d/"
"%"PRIu64"=%s/%"PRIu64" %s",
seqnam[nam], range, i, seqstt, t_buf,
seqpid, t_buf2);
}
if (store->count) { if (store->count) {
K_WLOCK(seqtrans_free); K_WLOCK(seqtrans_free);
k_list_transfer_to_head(store, seqtrans_free); k_list_transfer_to_head(store, seqtrans_free);

6
src/ckdb.h

@ -51,7 +51,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.5" #define DB_VERSION "1.0.5"
#define CKDB_VERSION DB_VERSION"-2.007" #define CKDB_VERSION DB_VERSION"-2.008"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@ -1344,8 +1344,8 @@ typedef struct seqset {
* the first time it processes a record with sequences */ * the first time it processes a record with sequences */
// SEQALL and SHARES */ // SEQALL and SHARES */
#define SEQ_LARGE_TRANS_LIM 16 #define SEQ_LARGE_TRANS_LIM 32
#define SEQ_LARGE_SIZ (65536*SEQ_LARGE_TRANS_LIM) #define SEQ_LARGE_SIZ (65536*16)
// WORKERSTATS, AUTH and ADDRAUTH // WORKERSTATS, AUTH and ADDRAUTH
#define SEQ_MEDIUM_TRANS_LIM 32 #define SEQ_MEDIUM_TRANS_LIM 32
#define SEQ_MEDIUM_SIZ 65536 #define SEQ_MEDIUM_SIZ 65536

Loading…
Cancel
Save