[Fix]remove OBKV unstable test case which has been covered by other use cases in farm
This commit is contained in:
@ -9563,177 +9563,6 @@ TEST_F(TestBatchExecute, query_sync_multi_task)
|
||||
}
|
||||
}
|
||||
|
||||
// the table should be single partition for this case:
|
||||
// create table if not exists batch_operation_with_same_keys_test
|
||||
// (C1 bigint primary key, C2 bigint, C3 varchar(100))
|
||||
TEST_F(TestBatchExecute, batch_operation_with_same_keys)
|
||||
{
|
||||
OB_LOG(INFO, "begin batch_operation_with_duplicated_keys");
|
||||
// setup
|
||||
ObTable *the_table = NULL;
|
||||
int ret = service_client_->alloc_table(ObString::make_string("batch_operation_with_same_keys_test"), the_table);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
// start case
|
||||
ObTableEntityFactory<ObTableEntity> entity_factory;
|
||||
ObTableBatchOperation batch_operation;
|
||||
ObITableEntity *entity = NULL;
|
||||
for (int64_t i = 0; i < BATCH_SIZE; ++i) {
|
||||
entity = entity_factory.alloc();
|
||||
ASSERT_TRUE(NULL != entity);
|
||||
ObObj key;
|
||||
key.set_int(i*2 % 10);
|
||||
ObObj value;
|
||||
value.set_int(100+i);
|
||||
ASSERT_EQ(OB_SUCCESS, entity->add_rowkey_value(key));
|
||||
ASSERT_EQ(OB_SUCCESS, entity->set_property(C2, value));
|
||||
//fprintf(stderr, "put key=%ld value=%ld i=%ld\n", (i*2%10), value.get_int(), i);
|
||||
ASSERT_EQ(OB_SUCCESS, batch_operation.insert_or_update(*entity));
|
||||
}
|
||||
ASSERT_TRUE(!batch_operation.is_readonly());
|
||||
ASSERT_TRUE(batch_operation.is_same_type());
|
||||
ASSERT_TRUE(batch_operation.is_same_properties_names());
|
||||
ObTableBatchOperationResult result;
|
||||
ASSERT_EQ(OB_SUCCESS, the_table->batch_execute(batch_operation, result));
|
||||
OB_LOG(INFO, "batch execute result", K(result));
|
||||
ASSERT_EQ(BATCH_SIZE, result.count());
|
||||
for (int64_t i = 0; i < BATCH_SIZE; ++i)
|
||||
{
|
||||
const ObTableOperationResult &r = result.at(i);
|
||||
ASSERT_EQ(OB_SUCCESS, r.get_errno());
|
||||
ASSERT_EQ(1, r.get_affected_rows());
|
||||
ASSERT_EQ(ObTableOperationType::INSERT_OR_UPDATE, r.type());
|
||||
const ObITableEntity *result_entity = NULL;
|
||||
ASSERT_EQ(OB_SUCCESS, r.get_entity(result_entity));
|
||||
ASSERT_TRUE(result_entity->is_empty());
|
||||
} // end for
|
||||
|
||||
// get and verify
|
||||
const ObITableEntity *result_entity = NULL;
|
||||
{
|
||||
batch_operation.reset();
|
||||
entity_factory.free_and_reuse();
|
||||
ObObj null_obj;
|
||||
for (int64_t i = 0; i < BATCH_SIZE; ++i) {
|
||||
entity = entity_factory.alloc();
|
||||
ASSERT_TRUE(NULL != entity);
|
||||
ObObj key;
|
||||
key.set_int(i*2%10);
|
||||
ASSERT_EQ(OB_SUCCESS, entity->add_rowkey_value(key));
|
||||
ASSERT_EQ(OB_SUCCESS, entity->set_property(C2, null_obj));
|
||||
ASSERT_EQ(OB_SUCCESS, batch_operation.retrieve(*entity));
|
||||
}
|
||||
ASSERT_TRUE(batch_operation.is_readonly());
|
||||
ASSERT_TRUE(batch_operation.is_same_type());
|
||||
ASSERT_TRUE(batch_operation.is_same_properties_names());
|
||||
ASSERT_EQ(OB_SUCCESS, the_table->batch_execute(batch_operation, result));
|
||||
OB_LOG(INFO, "batch execute result", K(result));
|
||||
ASSERT_EQ(BATCH_SIZE, result.count());
|
||||
for (int64_t i = 0; i < BATCH_SIZE; ++i) {
|
||||
const ObTableOperationResult &r = result.at(i);
|
||||
ASSERT_EQ(OB_SUCCESS, r.get_errno());
|
||||
ASSERT_EQ(ObTableOperationType::GET, r.type());
|
||||
ASSERT_EQ(0, r.get_affected_rows());
|
||||
ASSERT_EQ(OB_SUCCESS, r.get_entity(result_entity));
|
||||
ASSERT_EQ(0, result_entity->get_rowkey_size());
|
||||
ObObj value;
|
||||
ASSERT_EQ(OB_SUCCESS, result_entity->get_property(C2, value));
|
||||
//fprintf(stderr, "get C2 value=%ld i=%ld key=%ld\n", value.get_int(), i, i*2%10);
|
||||
ASSERT_EQ(195+i%5, value.get_int());
|
||||
}
|
||||
}
|
||||
{
|
||||
// all the same key
|
||||
batch_operation.reset();
|
||||
entity_factory.free_and_reuse();
|
||||
ObObj null_obj;
|
||||
for (int64_t i = 0; i < BATCH_SIZE; ++i) {
|
||||
entity = entity_factory.alloc();
|
||||
ASSERT_TRUE(NULL != entity);
|
||||
ObObj key;
|
||||
key.set_int(0);
|
||||
ASSERT_EQ(OB_SUCCESS, entity->add_rowkey_value(key));
|
||||
ASSERT_EQ(OB_SUCCESS, entity->set_property(C2, null_obj));
|
||||
ASSERT_EQ(OB_SUCCESS, batch_operation.retrieve(*entity));
|
||||
}
|
||||
ASSERT_TRUE(batch_operation.is_readonly());
|
||||
ASSERT_TRUE(batch_operation.is_same_type());
|
||||
ASSERT_TRUE(batch_operation.is_same_properties_names());
|
||||
ASSERT_EQ(OB_SUCCESS, the_table->batch_execute(batch_operation, result));
|
||||
OB_LOG(INFO, "batch execute result", K(result));
|
||||
ASSERT_EQ(BATCH_SIZE, result.count());
|
||||
for (int64_t i = 0; i < BATCH_SIZE; ++i) {
|
||||
const ObTableOperationResult &r = result.at(i);
|
||||
ASSERT_EQ(OB_SUCCESS, r.get_errno());
|
||||
ASSERT_EQ(ObTableOperationType::GET, r.type());
|
||||
ASSERT_EQ(0, r.get_affected_rows());
|
||||
ASSERT_EQ(OB_SUCCESS, r.get_entity(result_entity));
|
||||
ASSERT_EQ(0, result_entity->get_rowkey_size());
|
||||
ObObj value;
|
||||
ASSERT_EQ(OB_SUCCESS, result_entity->get_property(C2, value));
|
||||
//fprintf(stderr, "get C2 value=%ld i=%ld\n", value.get_int(), i);
|
||||
ASSERT_EQ(195, value.get_int());
|
||||
}
|
||||
}
|
||||
{
|
||||
// pattern: empty empty exist exist empty empty exist exist ...
|
||||
batch_operation.reset();
|
||||
entity_factory.free_and_reuse();
|
||||
ObObj null_obj;
|
||||
int64_t key1_not_exist = 1;
|
||||
int64_t key2_not_exist = 3;
|
||||
for (int64_t i = 0; i < BATCH_SIZE; ++i) {
|
||||
entity = entity_factory.alloc();
|
||||
ASSERT_TRUE(NULL != entity);
|
||||
ObObj key;
|
||||
if (i < BATCH_SIZE/4) {
|
||||
key.set_int(key1_not_exist);
|
||||
} else if (i < BATCH_SIZE/4*2) {
|
||||
key.set_int(0);
|
||||
} else if (i < BATCH_SIZE/4*3) {
|
||||
key.set_int(key2_not_exist);
|
||||
} else {
|
||||
key.set_int(2);
|
||||
}
|
||||
ASSERT_EQ(OB_SUCCESS, entity->add_rowkey_value(key));
|
||||
ASSERT_EQ(OB_SUCCESS, entity->set_property(C2, null_obj));
|
||||
ASSERT_EQ(OB_SUCCESS, batch_operation.retrieve(*entity));
|
||||
}
|
||||
ASSERT_TRUE(batch_operation.is_readonly());
|
||||
ASSERT_TRUE(batch_operation.is_same_type());
|
||||
ASSERT_TRUE(batch_operation.is_same_properties_names());
|
||||
ASSERT_EQ(OB_SUCCESS, the_table->batch_execute(batch_operation, result));
|
||||
OB_LOG(INFO, "batch execute result", K(result));
|
||||
ASSERT_EQ(BATCH_SIZE, result.count());
|
||||
for (int64_t i = 0; i < BATCH_SIZE; ++i) {
|
||||
const ObTableOperationResult &r = result.at(i);
|
||||
ASSERT_EQ(OB_SUCCESS, r.get_errno());
|
||||
ASSERT_EQ(ObTableOperationType::GET, r.type());
|
||||
ASSERT_EQ(0, r.get_affected_rows());
|
||||
ASSERT_EQ(OB_SUCCESS, r.get_entity(result_entity));
|
||||
ASSERT_EQ(0, result_entity->get_rowkey_size());
|
||||
if (i < BATCH_SIZE/4) {
|
||||
ASSERT_TRUE(result_entity->is_empty());
|
||||
} else if (i < BATCH_SIZE/4*2) {
|
||||
ObObj value;
|
||||
ASSERT_EQ(OB_SUCCESS, result_entity->get_property(C2, value));
|
||||
//fprintf(stderr, "get C2 value=%ld i=%ld\n", value.get_int(), i);
|
||||
ASSERT_EQ(195, value.get_int());
|
||||
} else if (i < BATCH_SIZE/4*3) {
|
||||
ASSERT_TRUE(result_entity->is_empty());
|
||||
} else {
|
||||
ObObj value;
|
||||
ASSERT_EQ(OB_SUCCESS, result_entity->get_property(C2, value));
|
||||
//fprintf(stderr, "get C2 value=%ld i=%ld\n", value.get_int(), i);
|
||||
ASSERT_EQ(196, value.get_int());
|
||||
}
|
||||
} // end for
|
||||
}
|
||||
// teardown
|
||||
service_client_->free_table(the_table);
|
||||
the_table = NULL;
|
||||
}
|
||||
|
||||
|
||||
// create table if not exists query_with_filter (C1 bigint primary key, C2 bigint default null, C3 varchar(100) default null, C4 double default 0);
|
||||
TEST_F(TestBatchExecute, table_query_with_filter)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user