1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@ -30,7 +30,6 @@
#include "calpontsystemcatalog.h"
#include "we_index.h"
/** @file
* Brief description of the file contents
*
@ -41,134 +40,121 @@ using namespace std;
void usage()
{
cout << "Usage: print_indexlist filename <S> block_offset subblock sbentry" << endl;
cout << " Where S=0 means print the whole block, S=1 means print the subblock" << endl;
cout << " Where subblock_number indicates which subblock to print." << endl;
cout << " Where sbentry indicates the first entry to print" << endl;
exit(1);
cout << "Usage: print_indexlist filename <S> block_offset subblock sbentry" << endl;
cout << " Where S=0 means print the whole block, S=1 means print the subblock" << endl;
cout << " Where subblock_number indicates which subblock to print." << endl;
cout << " Where sbentry indicates the first entry to print" << endl;
exit(1);
}
int main(int argc, char** argv)
{
char buf[8192];
int s, fd, subblock, byteoffset, i, entries, sbentry;
string filename;
off_t offset;
off_t err;
IndexListEntry* entry;
IndexListParam* ptr;
uint32_t fbo;
char buf[8192];
int s, fd, subblock, byteoffset, i, entries, sbentry;
string filename;
off_t offset;
off_t err;
IndexListEntry* entry;
IndexListParam* ptr;
uint32_t fbo;
if (argc == 1)
usage();
if (argc == 1)
usage();
filename = argv[1];
s = atoi(argv[2]);
fbo = strtoul(argv[3], 0, 0);
subblock = atoi(argv[4]);
sbentry = atoi(argv[5]);
filename = argv[1];
s = atoi(argv[2]);
fbo = strtoul(argv[3], 0, 0);
subblock = atoi(argv[4]);
sbentry = atoi(argv[5]);
fd = open(filename.c_str(), O_RDONLY);
fd = open(filename.c_str(), O_RDONLY);
if (fd < 0)
{
perror("open");
exit(1);
}
if (fd < 0)
{
perror("open");
exit(1);
}
offset = ((off_t)fbo * BLOCK_SIZE);
// cout << "BLOCK_SIZE = " << BLOCK_SIZE << " fbo=" << fbo << ", seeking to offset " << offset << endl;
err = lseek(fd, offset, SEEK_SET);
offset = ((off_t)fbo * BLOCK_SIZE);
// cout << "BLOCK_SIZE = " << BLOCK_SIZE << " fbo=" << fbo << ", seeking to offset " << offset << endl;
err = lseek(fd, offset, SEEK_SET);
if (err < 0)
{
perror("lseek");
exit(1);
}
err = read(fd, buf, BLOCK_SIZE);
if (err != BLOCK_SIZE)
{
if (err < 0)
perror("read");
cerr << "read error." << endl;
exit(1);
}
close(fd);
byteoffset = subblock * 256;
// cout << "subblock=" << subblock << " byte offset=" << byteoffset << endl;
entry = reinterpret_cast<IndexListEntry*>(&buf[byteoffset]);
if (s == 0 && subblock == 0)
entries = 1024;
else
entries = 32;
for (i = sbentry; i < entries; i++)
{
cout << i << ": ";
switch (entry[i].type)
{
perror("lseek");
exit(1);
}
case LLP_SUBBLK:
ptr = reinterpret_cast<IndexListParam*>(&entry[i]);
cout << "Subblock pointer. Rid count=" << entry[i].ridCt << " LBID=" << ptr->fbo
<< " subblock=" << ptr->sbid << " SBentry=" << ptr->entry << endl;
break;
err = read(fd, buf, BLOCK_SIZE);
case LLP_BLK:
ptr = reinterpret_cast<IndexListParam*>(&entry[i]);
cout << "Block pointer. Rid count=" << entry[i].ridCt << " LBID=" << ptr->fbo
<< " subblock=" << ptr->sbid << " SBentry=" << ptr->entry << endl;
break;
if (err != BLOCK_SIZE)
{
if (err < 0)
perror("read");
case RID: cout << "RID: " << entry[i].value << endl; break;
cerr << "read error." << endl;
exit(1);
}
close(fd);
byteoffset = subblock * 256;
// cout << "subblock=" << subblock << " byte offset=" << byteoffset << endl;
entry = reinterpret_cast<IndexListEntry*>(&buf[byteoffset]);
if (s == 0 && subblock == 0)
entries = 1024;
else
entries = 32;
for (i = sbentry; i < entries; i++)
{
cout << i << ": ";
switch (entry[i].type)
case LIST_SIZE:
if (i == sbentry)
{
case LLP_SUBBLK:
ptr = reinterpret_cast<IndexListParam*>(&entry[i]);
cout << "Subblock pointer. Rid count=" << entry[i].ridCt <<
" LBID=" << ptr->fbo << " subblock=" << ptr->sbid <<
" SBentry=" << ptr->entry << endl;
break;
case LLP_BLK:
ptr = reinterpret_cast<IndexListParam*>(&entry[i]);
cout << "Block pointer. Rid count=" << entry[i].ridCt <<
" LBID=" << ptr->fbo << " subblock=" <<
ptr->sbid << " SBentry=" << ptr->entry << endl;
break;
case RID:
cout << "RID: " << entry[i].value << endl;
break;
case LIST_SIZE:
if (i == sbentry)
{
u_int64_t* val = reinterpret_cast<u_int64_t*>(&entry[i + 1]);
cout << "List Header. Rid count=" << entry[i].value;
cout << " key value=0x" << hex << *val << dec << endl;
i++;
}
else if (i + 1 < entries)
{
u_int64_t* val = reinterpret_cast<u_int64_t*>(&entry[i + 1]);
cout << "List Size entry. Rid count=" << entry[i].value
<< " (if a header) value=0x" << hex << *val << dec << endl;
}
else
cout << "List Size entry. Rid count=" << entry[i].value << endl;
break;
case NOT_IN_USE:
cout << "Not in use (ignored by p_idxlist)" << endl;
break;
case EMPTY_LIST_PTR:
cout << "Empty List Pointer (?) (ignored by p_idxlist)" << endl;
break;
case EMPTY_PTR:
cout << "Empty Pointer entry (?) (ignored by p_idxlist)" << endl;
break;
default:
cout << "Unknown entry type (" << entry[i].type << ")" << endl;
break;
u_int64_t* val = reinterpret_cast<u_int64_t*>(&entry[i + 1]);
cout << "List Header. Rid count=" << entry[i].value;
cout << " key value=0x" << hex << *val << dec << endl;
i++;
}
}
else if (i + 1 < entries)
{
u_int64_t* val = reinterpret_cast<u_int64_t*>(&entry[i + 1]);
cout << "List Size entry. Rid count=" << entry[i].value << " (if a header) value=0x" << hex << *val
<< dec << endl;
}
else
cout << "List Size entry. Rid count=" << entry[i].value << endl;
return 0;
break;
case NOT_IN_USE: cout << "Not in use (ignored by p_idxlist)" << endl; break;
case EMPTY_LIST_PTR: cout << "Empty List Pointer (?) (ignored by p_idxlist)" << endl; break;
case EMPTY_PTR: cout << "Empty Pointer entry (?) (ignored by p_idxlist)" << endl; break;
default: cout << "Unknown entry type (" << entry[i].type << ")" << endl; break;
}
}
return 0;
}