mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
key_range lsn txn_active
git-svn-id: file:///svn/tokudb@264 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
ce9eba64d4
commit
b2193274eb
3 changed files with 60 additions and 4 deletions
|
@ -34,7 +34,7 @@ void print_struct (const char *structname, int need_internal, struct fieldinfo *
|
|||
// int total32 = fields32[N-1].size;
|
||||
// int total64 = fields32[N-1].size;
|
||||
printf("struct __toku_%s {\n", structname);
|
||||
for (i=0; i<N; i++) {
|
||||
for (i=0; i<N-1; i++) {
|
||||
unsigned int this_32 = fields32[i].off;
|
||||
unsigned int this_64 = fields64[i].off;
|
||||
//fprintf(stderr, "this32=%d current32=%d this64=%d current64=%d\n", this_32, current_32, this_64, current_64);
|
||||
|
@ -50,14 +50,14 @@ void print_struct (const char *structname, int need_internal, struct fieldinfo *
|
|||
n_dummys--;
|
||||
did_toku_internal=1;
|
||||
}
|
||||
if (n_dummys>0) printf(" void* dummy%d[%d];\n", dummy_counter++, n_dummys);
|
||||
if (n_dummys>0) printf(" void* __toku_dummy%d[%d];\n", dummy_counter++, n_dummys);
|
||||
diff64-=diff*2;
|
||||
diff32-=diff;
|
||||
|
||||
}
|
||||
assert(diff32==diff64);
|
||||
if (diff32>0) {
|
||||
printf(" char dummy%d[%d];\n", dummy_counter++, diff32);
|
||||
printf(" char __toku_dummy%d[%d];\n", dummy_counter++, diff32);
|
||||
}
|
||||
current_32 = this_32;
|
||||
current_64 = this_64;
|
||||
|
@ -75,8 +75,27 @@ void print_struct (const char *structname, int need_internal, struct fieldinfo *
|
|||
current_32 += fields32[i].size;
|
||||
current_64 += fields64[i].size;
|
||||
}
|
||||
assert(did_toku_internal || !need_internal);
|
||||
{
|
||||
unsigned int this_32 = fields32[N-1].off;
|
||||
unsigned int this_64 = fields64[N-1].off;
|
||||
unsigned int diff32 = this_32-current_32;
|
||||
unsigned int diff64 = this_64-current_64;
|
||||
if (diff32>0 && diff32<diff64) {
|
||||
unsigned int diff = diff64-diff32;
|
||||
printf(" void* __toku_dummy%d[%d]; /* Padding at the end */ \n", dummy_counter++, diff/4);
|
||||
diff64-=diff*2;
|
||||
diff32-=diff;
|
||||
}
|
||||
if (diff32>0) {
|
||||
printf(" char __toku_dummy%d[%d]; /* Padding at the end */ \n", dummy_counter++, diff32);
|
||||
diff64-=diff32;
|
||||
diff32=0;
|
||||
}
|
||||
if (diff64>0) printf(" /* %d more bytes of alignment in the 64-bit case. */\n", diff64);
|
||||
assert(diff64<8); /* there could be a few left from alignment. */
|
||||
}
|
||||
printf("};\n");
|
||||
assert(did_toku_internal || !need_internal);
|
||||
}
|
||||
|
||||
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) {
|
||||
|
|
|
@ -116,10 +116,29 @@ void sample_db_env_offsets (void) {
|
|||
STRUCT_SETUP(DB_ENV, set_verbose, "int (*%s) (DB_ENV *, u_int32_t, int)");
|
||||
STRUCT_SETUP(DB_ENV, txn_checkpoint, "int (*%s) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)");
|
||||
STRUCT_SETUP(DB_ENV, txn_stat, "int (*%s) (DB_ENV *, DB_TXN_STAT **, u_int32_t)");
|
||||
STRUCT_SETUP(DB_ENV, txn_begin, "int (*%s) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)");
|
||||
sort_and_dump_fields("db_env", sizeof(DB_ENV));
|
||||
}
|
||||
|
||||
void sample_db_key_range_offsets (void) {
|
||||
field_counter=0;
|
||||
STRUCT_SETUP(DB_KEY_RANGE, less, "double %s");
|
||||
STRUCT_SETUP(DB_KEY_RANGE, equal, "double %s");
|
||||
STRUCT_SETUP(DB_KEY_RANGE, greater, "double %s");
|
||||
sort_and_dump_fields("db_key_range", sizeof(DB_ENV));
|
||||
}
|
||||
|
||||
void sample_db_lsn_offsets (void) {
|
||||
field_counter=0;
|
||||
sort_and_dump_fields("db_lsn", sizeof(DB_LSN));
|
||||
}
|
||||
|
||||
void sample_db_txn_active_offsets (void) {
|
||||
field_counter=0;
|
||||
STRUCT_SETUP(DB_TXN_ACTIVE, lsn, "DB_LSN %s");
|
||||
STRUCT_SETUP(DB_TXN_ACTIVE, txnid, "u_int32_t %s");
|
||||
sort_and_dump_fields("db_txn_active", sizeof(DB_TXN_ACTIVE));
|
||||
}
|
||||
|
||||
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) {
|
||||
open_file();
|
||||
|
@ -129,5 +148,8 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un
|
|||
sample_db_txn_offsets();
|
||||
sample_dbc_offsets();
|
||||
sample_db_env_offsets();
|
||||
sample_db_key_range_offsets();
|
||||
sample_db_lsn_offsets();
|
||||
sample_db_txn_active_offsets();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,22 @@ struct fieldinfo db_env_fields32[] = {
|
|||
{"int (*set_lk_detect) (DB_ENV *, u_int32_t)", 392, 4},
|
||||
{"int (*set_lk_max) (DB_ENV *, u_int32_t)", 396, 4},
|
||||
{"int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int)", 460, 4},
|
||||
{"int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)", 548, 4},
|
||||
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 552, 4},
|
||||
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 564, 4},
|
||||
{0, 584, 584} /* size of whole struct */
|
||||
};
|
||||
struct fieldinfo db_key_range_fields32[] = {
|
||||
{"double less", 0, 8},
|
||||
{"double equal", 8, 8},
|
||||
{"double greater", 16, 8},
|
||||
{0, 584, 584} /* size of whole struct */
|
||||
};
|
||||
struct fieldinfo db_lsn_fields32[] = {
|
||||
{0, 8, 8} /* size of whole struct */
|
||||
};
|
||||
struct fieldinfo db_txn_active_fields32[] = {
|
||||
{"u_int32_t txnid", 0, 4},
|
||||
{"DB_LSN lsn", 8, 8},
|
||||
{0, 16, 16} /* size of whole struct */
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue