MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / bdb_queue_dump_int

Function bdb_queue_dump_int

bdb/queue.c:1108–1222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1106}
1107
1108static int bdb_queue_dump_int(bdb_state_type *bdb_state, FILE *out, int *bdberr)
1109{
1110
1111 uint8_t hdrbuf[QUEUE_HDR_LEN];
1112 uint8_t *p_buf = hdrbuf, *p_buf_end = (p_buf + sizeof(hdrbuf));
1113 struct bdb_queue_header hdr;
1114 DBT dbt_key, dbt_data;
1115 DBC *dbcp;
1116 db_recno_t recno;
1117 int rc;
1118 DB_QUEUE_STAT qst;
1119
1120 /* First dump statistics for the queue */
1121 bzero(&qst, sizeof(qst));
1122 rc = bdb_state->dbp_data[0][0]->stat(bdb_state->dbp_data[0][0], &qst,
1123 DB_FAST_STAT);
1124 logmsgf(LOGMSG_USER, out, "Queue stats (rcode %d %s):-\n", rc, db_strerror(rc));
1125 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_magic", (unsigned)qst.qs_magic);
1126 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_version", (unsigned)qst.qs_version);
1127 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_nkeys", (unsigned)qst.qs_nkeys);
1128 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_ndata", (unsigned)qst.qs_ndata);
1129 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_pagesize", (unsigned)qst.qs_pagesize);
1130 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_extentsize", (unsigned)qst.qs_extentsize);
1131 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_pages", (unsigned)qst.qs_pages);
1132 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_re_len", (unsigned)qst.qs_re_len);
1133 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_re_pad", (unsigned)qst.qs_re_pad);
1134 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_pgfree", (unsigned)qst.qs_pgfree);
1135 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_first_recno", (unsigned)qst.qs_first_recno);
1136 logmsgf(LOGMSG_USER, out, "%16s = %u\n", "qs_cur_recno", (unsigned)qst.qs_cur_recno);
1137 logmsgf(LOGMSG_USER, out, "-----\n");
1138
1139 rc = bdb_state->dbp_data[0][0]->cursor(bdb_state->dbp_data[0][0], NULL,
1140 &dbcp, 0);
1141 if (rc != 0) {
1142 switch (rc) {
1143 case DB_REP_HANDLE_DEAD:
1144 case DB_LOCK_DEADLOCK:
1145 *bdberr = BDBERR_DEADLOCK;
1146 break;
1147
1148 default:
1149 logmsg(LOGMSG_ERROR, "bdb_queue_dump_int: cursor failed %d %s\n", rc,
1150 db_strerror(rc));
1151 *bdberr = BDBERR_MISC;
1152 break;
1153 }
1154 return -1;
1155 }
1156
1157 bzero(&dbt_key, sizeof(dbt_key));
1158 bzero(&dbt_data, sizeof(dbt_data));
1159
1160 dbt_key.ulen = sizeof(recno);
1161 dbt_key.data = &recno;
1162 dbt_key.flags = DB_DBT_USERMEM;
1163
1164 dbt_data.ulen = sizeof(hdr);
1165 dbt_data.doff = 0;

Callers 1

bdb_queue_dumpFunction · 0.85

Calls 3

logmsgfFunction · 0.85
queue_hdr_getFunction · 0.85
logmsgFunction · 0.50

Tested by

no test coverage detected