示例#1
0
文件: index.c 项目: fdr/pg_check
/* checks index tuples on the page, one by one */
uint32 check_index_tuples(Relation rel, PageHeader header, char *buffer, int block) {

	/* tuple checks */
	int ntuples = PageGetMaxOffsetNumber(buffer);
	int i;
	uint32 nerrs = 0;
  
	ereport(DEBUG1, (errmsg("[%d] max number of tuples = %d", block, ntuples)));
	
	for (i = 0; i < ntuples; i++) {
		nerrs += check_index_tuple(rel, header, block, i, buffer);
	}
	
	if (nerrs > 0) {
		ereport(WARNING, (errmsg("[%d] is probably corrupted, there were %d errors reported", block, nerrs)));
	}
	
	return nerrs;
  
}
示例#2
0
/* checks index tuples on the page, one by one */
uint32 check_index_tuples(Relation rel, PageHeader header, char *buffer, int block) {

	/* tuple checks */
	int ntuples = PageGetMaxOffsetNumber(buffer);
	int i;
	uint32 nerrs = 0;
  
	ereport(DEBUG1, (errmsg("[%d] max number of tuples = %d", block, ntuples)));
	
	/* FIXME check btpo_flags (BTP_LEAF, BTP_ROOT, BTP_DELETED, BTP_META, BTP_HALF_DEAD,
	 *       BTP_SPLIT_END and BTP_HAS_GARBAGE) and act accordingly */
	
	for (i = 0; i < ntuples; i++) {
		/* FIXME this should check lp_flags, just as the heap check */
		nerrs += check_index_tuple(rel, header, block, i, buffer);
	}
	
	if (nerrs > 0) {
		ereport(WARNING, (errmsg("[%d] is probably corrupted, there were %d errors reported", block, nerrs)));
	}
	
	return nerrs;
  
}