Commit 93a8bf99 authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1360 Add db->row_size_supported(DB*,u_int32_t) function to aid handlerton

in determining if a table schema is supported (for size)

git-svn-id: file:///svn/toku/tokudb@9772 c7de825b-a66e-492c-adef-691d508d4ae1
parent dc510188
......@@ -183,7 +183,8 @@ struct __toku_db {
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
void* __toku_dummy0[26];
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
void* __toku_dummy0[25];
char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=236 size=4, 64=bit offset=376 size=8 */
void* __toku_dummy2[5];
......
......@@ -193,7 +193,8 @@ struct __toku_db {
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
void* __toku_dummy0[29];
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
void* __toku_dummy0[28];
char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=248 size=4, 64=bit offset=400 size=8 */
void* __toku_dummy2[5];
......
......@@ -196,7 +196,8 @@ struct __toku_db {
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
void* __toku_dummy0[31];
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
void* __toku_dummy0[30];
char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=256 size=4, 64=bit offset=416 size=8 */
void* __toku_dummy2[5];
......
......@@ -195,7 +195,8 @@ struct __toku_db {
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
void* __toku_dummy0[34];
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
void* __toku_dummy0[33];
char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=268 size=4, 64=bit offset=440 size=8 */
void* __toku_dummy2[5];
......
......@@ -199,7 +199,8 @@ struct __toku_db {
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
void* __toku_dummy1[38];
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
void* __toku_dummy1[37];
char __toku_dummy2[80];
void *api_internal; /* 32-bit offset=276 size=4, 64=bit offset=464 size=8 */
void* __toku_dummy3[5];
......
......@@ -321,6 +321,7 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un
"const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/",
"const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/",
"int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */",
"int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */",
NULL};
print_struct("db", 1, db_fields32, db_fields64, sizeof(db_fields32)/sizeof(db_fields32[0]), extra);
}
......
......@@ -199,7 +199,8 @@ struct __toku_db {
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
void* __toku_dummy1[38];
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
void* __toku_dummy1[37];
char __toku_dummy2[80];
void *api_internal; /* 32-bit offset=276 size=4, 64=bit offset=464 size=8 */
void* __toku_dummy3[5];
......
......@@ -3072,6 +3072,27 @@ db_put_check_size_constraints(DB *db, DBT *key, DBT *val) {
return r;
}
//Return 0 if supported.
//Return ERANGE if out of range.
static int
db_row_size_supported(DB *db, u_int32_t size) {
DBT key, val;
toku_fill_dbt(&key, NULL, size);
toku_fill_dbt(&val, NULL, 0);
int r = db_put_check_size_constraints(db, &key, &val);
if (r!=0) r = ERANGE;
return r;
}
static int
locked_db_row_size_supported(DB *db, u_int32_t size) {
toku_ydb_lock();
int r = db_row_size_supported(db, size);
toku_ydb_unlock();
return r;
}
//Return 0 if insert is legal
static int
db_put_check_overwrite_constraint(DB *db, DB_TXN *txn, DBT *key, DBT *UU(val),
......@@ -3592,6 +3613,7 @@ static int toku_db_create(DB ** db, DB_ENV * env, u_int32_t flags) {
SDB(pre_acquire_read_lock);
SDB(pre_acquire_table_lock);
SDB(truncate);
SDB(row_size_supported);
#undef SDB
result->dbt_pos_infty = toku_db_dbt_pos_infty;
result->dbt_neg_infty = toku_db_dbt_neg_infty;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment