示例#1
0
def test_table_write_delete_version():
    """
    table write and deletion w/versions
    1. write data set 1, 2, 3, 4
    2. scan
    3. delete data set 3
    4. scan & compare
    :return: None
    """
    table_name = 'test'
    dump_file1 = 'dump1.out'
    dump_file2 = 'dump2.out'
    scan_file1 = 'scan1.out'
    scan_file2 = 'scan2.out'
    common.run_tera_mark([(dump_file1, False), (dump_file2, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q',
                         random='random', key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([(dump_file1, True), (dump_file2, True)], op='w', table_name=table_name, cf='cf0:q,cf1:q',
                         random='random', key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([(dump_file1, True)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=12, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([(dump_file1, True), (dump_file2, True)], op='w', table_name=table_name, cf='cf0:q,cf1:q',
                         random='random', key_seed=1, value_seed=13, value_size=100, num=10000, key_size=20)
    common.compact_tablets(common.get_tablet_list(table_name))
    common.scan_table(table_name=table_name, file_path=scan_file1, allversion=True, snapshot=0)
    common.run_tera_mark([], op='d', table_name=table_name, cf='cf0:q,cf1:q', random='random', key_seed=1,
                         value_seed=12, value_size=100, num=10000, key_size=20)
    common.compact_tablets(common.get_tablet_list(table_name))
    common.scan_table(table_name=table_name, file_path=scan_file2, allversion=True, snapshot=0)
    nose.tools.assert_true(common.compare_files(dump_file1, scan_file1, need_sort=True))
    nose.tools.assert_true(common.compare_files(dump_file2, scan_file2, need_sort=True))
示例#2
0
def test_table_random_write():
    """
    table write simple
    1. write data set 1
    2. scan & compare
    :return: None
    """
    table_name = 'test'
    dump_file = 'dump.out'
    scan_file = 'scan.out'
    common.run_tera_mark([(dump_file, False)],
                         op='w',
                         table_name=table_name,
                         cf='cf0:q,cf1:q',
                         random='random',
                         key_seed=1,
                         value_seed=10,
                         value_size=100,
                         num=10000,
                         key_size=20)
    common.scan_table(table_name=table_name,
                      file_path=scan_file,
                      allversion=False)
    nose.tools.assert_true(
        common.compare_files(dump_file, scan_file, need_sort=True))

    common.scan_table(table_name=table_name,
                      file_path=scan_file,
                      allversion=False,
                      snapshot=0,
                      is_async=True)
    nose.tools.assert_true(
        common.compare_files(dump_file, scan_file, need_sort=True))
示例#3
0
    def test_table_random_write(self):

        common.create_singleversion_table()
        table_name = 'test'
        dump_file = 'dump.out'
        scan_file = 'scan.out'
        common.run_tera_mark([(dump_file, False)],
                             op='w',
                             table_name=table_name,
                             cf='cf0:q,cf1:q',
                             random='random',
                             key_seed=1,
                             value_seed=10,
                             value_size=100,
                             num=10000,
                             key_size=20)
        common.scan_table(table_name=table_name,
                          file_path=scan_file,
                          allversion=False)
        nose.tools.assert_true(
            common.compare_files(dump_file, scan_file, need_sort=True))

        common.scan_table(table_name=table_name,
                          file_path=scan_file,
                          allversion=False,
                          snapshot=0,
                          is_async=True)
        nose.tools.assert_true(
            common.compare_files(dump_file, scan_file, need_sort=True))
        '''
示例#4
0
def test_table_write_multiversion_snapshot():
    """
    table write w/version w/snapshot
    1. write data set 1, 2
    2. create snapshot
    3. write data set 3, 4
    4. scan w/snapshot, scan w/o snapshot & compare
    :return: None
    """
    table_name = 'test'
    dump_file1 = 'dump1.out'
    dump_file2 = 'dump2.out'
    scan_file1 = 'scan1.out'
    scan_file2 = 'scan2.out'
    common.run_tera_mark([(dump_file1, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([(dump_file1, True)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
    snapshot = common.snapshot_op(table_name)
    common.run_tera_mark([(dump_file2, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([(dump_file2, True)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
    common.compact_tablets(common.get_tablet_list(table_name))
    common.scan_table(table_name=table_name, file_path=scan_file1, allversion=True, snapshot=snapshot)
    common.scan_table(table_name=table_name, file_path=scan_file2, allversion=True, snapshot=0)
    nose.tools.assert_true(common.compare_files(dump_file1, scan_file1, need_sort=True))
    nose.tools.assert_true(common.compare_files(dump_file2, scan_file2, need_sort=True))
示例#5
0
def test_table_write_delete_version():
    """
    table write and deletion w/versions
    1. write data set 1, 2, 3, 4
    2. scan
    3. delete data set 3
    4. scan & compare
    :return: None
    """
    table_name = 'test'
    dump_file1 = 'dump1.out'
    dump_file2 = 'dump2.out'
    scan_file1 = 'scan1.out'
    scan_file2 = 'scan2.out'
    common.run_tera_mark([(dump_file1, False), (dump_file2, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q',
                         random='random', key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([(dump_file1, True), (dump_file2, True)], op='w', table_name=table_name, cf='cf0:q,cf1:q',
                         random='random', key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([(dump_file1, True)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=12, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([(dump_file1, True), (dump_file2, True)], op='w', table_name=table_name, cf='cf0:q,cf1:q',
                         random='random', key_seed=1, value_seed=13, value_size=100, num=10000, key_size=20)
    common.compact_tablets(common.get_tablet_list(table_name))
    common.scan_table(table_name=table_name, file_path=scan_file1, allversion=True, snapshot=0)
    common.run_tera_mark([], op='d', table_name=table_name, cf='cf0:q,cf1:q', random='random', key_seed=1,
                         value_seed=12, value_size=100, num=10000, key_size=20)
    common.compact_tablets(common.get_tablet_list(table_name))
    common.scan_table(table_name=table_name, file_path=scan_file2, allversion=True, snapshot=0)
    nose.tools.assert_true(common.compare_files(dump_file1, scan_file1, need_sort=True))
    nose.tools.assert_true(common.compare_files(dump_file2, scan_file2, need_sort=True))
示例#6
0
def test_scan_empty_table():
    """
    scan empty table table
    """
    table_name = 'test'
    scan_file = 'scan.out'
    common.scan_table(table_name=table_name, file_path=scan_file, allversion=True)
    nose.tools.assert_true(common.file_is_empty(scan_file))
示例#7
0
    def test_scan_empty_table(self):

        common.create_singleversion_table()
        table_name = 'test'
        scan_file = 'scan.out'
        common.scan_table(table_name=table_name, file_path=scan_file, allversion=True)
        nose.tools.assert_true(common.file_is_empty(scan_file))
    
        '''
示例#8
0
def test_scan_empty_table():
    """
    scan empty table table
    """
    table_name = 'test'
    scan_file = 'scan.out'
    common.scan_table(table_name=table_name,
                      file_path=scan_file,
                      allversion=True)
    nose.tools.assert_true(common.file_is_empty(scan_file))
示例#9
0
    def test_scan_empty_table(self):

        common.create_singleversion_table()
        table_name = 'test'
        scan_file = 'scan.out'
        common.scan_table(table_name=table_name,
                          file_path=scan_file,
                          allversion=True)
        nose.tools.assert_true(common.file_is_empty(scan_file))
        '''
示例#10
0
    def test_kv_random_write(self):

        common.create_kv_table()
        table_name = 'test'
        dump_file = 'dump.out'
        scan_file = 'scan.out'
        common.run_tera_mark([(dump_file, False)], op='w', table_name='test', random='random',
                             value_size=100, num=5000, key_size=20)
        common.scan_table(table_name=table_name, file_path=scan_file, allversion=True)
        nose.tools.assert_true(common.compare_files(dump_file, scan_file, need_sort=True))
    
        '''
示例#11
0
def test_showsize_table():

    time.sleep(10)
    show_ret = common.parse_showinfo()
    table_name = "test"
    nose.tools.assert_equal(show_ret[table_name]["size"], "4K")
    dump_file = 'dump.out'
    scan_file = 'scan.out'
    common.run_tera_mark([(dump_file, False)], op='w', table_name='test', cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=10, value_size=100, num=500000, key_size=20)
    common.scan_table(table_name=table_name, file_path=scan_file, allversion=True)
    nose.tools.assert_true(common.compare_files(dump_file, scan_file, need_sort=True))
    nose.tools.assert_not_equal(show_ret[table_name]["size"], "4K")
示例#12
0
    def table_snapshot_relaunch(self):

        table_name = 'test'
        dump_file1 = 'dump1.out'
        dump_file2 = 'dump2.out'
        scan_file1 = 'scan1.out'
        scan_file2 = 'scan2.out'
        common.run_tera_mark([(dump_file1, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
        snapshot = common.snapshot_op(table_name)
        common.run_tera_mark([(dump_file2, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
        common.compact_tablets(common.get_tablet_list(table_name))
        common.scan_table(table_name=table_name, file_path=scan_file1, allversion=True, snapshot=snapshot)
        common.scan_table(table_name=table_name, file_path=scan_file2, allversion=True, snapshot=0)
        nose.tools.assert_true(common.compare_files(dump_file1, scan_file1, need_sort=True))
        nose.tools.assert_true(common.compare_files(dump_file2, scan_file2, need_sort=True))
    
        common.cluster_op('kill')
        common.cluster_op('launch')
        time.sleep(2)
        common.scan_table(table_name=table_name, file_path=scan_file1, allversion=True, snapshot=snapshot)
        common.scan_table(table_name=table_name, file_path=scan_file2, allversion=True, snapshot=0)
        nose.tools.assert_true(common.compare_files(dump_file1, scan_file1, need_sort=True))
        nose.tools.assert_true(common.compare_files(dump_file2, scan_file2, need_sort=True))
        
        '''
示例#13
0
def test_table_random_write_versions():
    """
    table write w/versions
    1. write data set 1
    2. write data set 2
    3. scan & compare
    :return: None
    """
    table_name = 'test'
    dump_file1 = 'dump1.out'
    dump_file2 = 'dump2.out'
    scan_file = 'scan.out'
    common.run_tera_mark([(dump_file1, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q',
                         random='random', key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([(dump_file1, True), (dump_file2, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
    common.scan_table(table_name=table_name, file_path=scan_file, allversion=True)
    nose.tools.assert_true(common.compare_files(dump_file1, scan_file, need_sort=True))

    common.scan_table(table_name=table_name, file_path=scan_file, allversion=True, snapshot=0, is_async=True)
    nose.tools.assert_true(common.compare_files(dump_file1, scan_file, need_sort=True))

    common.scan_table(table_name=table_name, file_path=scan_file, allversion=False)
    nose.tools.assert_true(common.compare_files(dump_file2, scan_file, need_sort=True))

    common.scan_table(table_name=table_name, file_path=scan_file, allversion=False, snapshot=0, is_async=True)
    nose.tools.assert_true(common.compare_files(dump_file2, scan_file, need_sort=True))
示例#14
0
def test_kv_random_write():
    """
    kv table write
    1. write data set 1
    2. scan & compare
    :return: None
    """
    table_name = 'test'
    dump_file = 'dump.out'
    scan_file = 'scan.out'
    common.run_tera_mark([(dump_file, False)], op='w', table_name='test', random='random',
                         value_size=100, num=5000, key_size=20)
    common.scan_table(table_name=table_name, file_path=scan_file, allversion=True)
    nose.tools.assert_true(common.compare_files(dump_file, scan_file, need_sort=True))
示例#15
0
def test_table_random_write():
    """
    table write simple
    1. write data set 1
    2. scan & compare
    :return: None
    """
    table_name = 'test'
    dump_file = 'dump.out'
    scan_file = 'scan.out'
    common.run_tera_mark([(dump_file, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
    common.scan_table(table_name=table_name, file_path=scan_file, allversion=False)
    nose.tools.assert_true(common.compare_files(dump_file, scan_file, need_sort=True))
示例#16
0
    def table_snapshot_relaunch(self):

        table_name = 'test'
        dump_file1 = 'dump1.out'
        dump_file2 = 'dump2.out'
        scan_file1 = 'scan1.out'
        scan_file2 = 'scan2.out'
        common.run_tera_mark([(dump_file1, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
        snapshot = common.snapshot_op(table_name)
        common.run_tera_mark([(dump_file2, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
        common.compact_tablets(common.get_tablet_list(table_name))
        common.scan_table(table_name=table_name, file_path=scan_file1, allversion=True, snapshot=snapshot)
        common.scan_table(table_name=table_name, file_path=scan_file2, allversion=True, snapshot=0)
        nose.tools.assert_true(common.compare_files(dump_file1, scan_file1, need_sort=True))
        nose.tools.assert_true(common.compare_files(dump_file2, scan_file2, need_sort=True))
    
        common.cluster_op('kill')
        common.cluster_op('launch')
        time.sleep(2)
        common.scan_table(table_name=table_name, file_path=scan_file1, allversion=True, snapshot=snapshot)
        common.scan_table(table_name=table_name, file_path=scan_file2, allversion=True, snapshot=0)
        nose.tools.assert_true(common.compare_files(dump_file1, scan_file1, need_sort=True))
        nose.tools.assert_true(common.compare_files(dump_file2, scan_file2, need_sort=True))
        
        '''
示例#17
0
def test_kv_snapshot_relaunch():
    """
    kv cluster relaunch
    1. write data set 1
    2. create snapshot
    3. write data set 2
    4. scan w/snapshot, scan w/o snapshot & compare
    5. kill & launch cluster
    6. repeat 4
    :return: None
    """
    table_name = 'test'
    dump_file1 = 'dump1.out'
    dump_file2 = 'dump2.out'
    scan_file1 = 'scan1.out'
    scan_file2 = 'scan2.out'
    common.run_tera_mark([(dump_file1, False)], op='w', table_name=table_name, random='random',
                         key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
    snapshot = common.snapshot_op(table_name)
    common.run_tera_mark([(dump_file2, False)], op='w', table_name=table_name, random='random',
                         key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
    common.compact_tablets(common.get_tablet_list(table_name))
    common.scan_table(table_name=table_name, file_path=scan_file1, allversion=True, snapshot=snapshot)
    common.scan_table(table_name=table_name, file_path=scan_file2, allversion=True, snapshot=0)
    nose.tools.assert_true(common.compare_files(dump_file1, scan_file1, need_sort=True))
    nose.tools.assert_true(common.compare_files(dump_file2, scan_file2, need_sort=True))
    common.cluster_op('kill')
    common.cluster_op('launch')
    time.sleep(2)
    common.scan_table(table_name=table_name, file_path=scan_file1, allversion=False, snapshot=snapshot)
    common.scan_table(table_name=table_name, file_path=scan_file2, allversion=False, snapshot=0)
    nose.tools.assert_true(common.compare_files(dump_file1, scan_file1, need_sort=True))
    nose.tools.assert_true(common.compare_files(dump_file2, scan_file2, need_sort=True))
示例#18
0
    def test_table_random_write(self):

        common.create_singleversion_table()
        table_name = 'test'
        dump_file = 'dump.out'
        scan_file = 'scan.out'
        common.run_tera_mark([(dump_file, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
        common.scan_table(table_name=table_name, file_path=scan_file, allversion=False)
        nose.tools.assert_true(common.compare_files(dump_file, scan_file, need_sort=True))
    
        common.scan_table(table_name=table_name, file_path=scan_file, allversion=False, snapshot=0, is_async=True)
        nose.tools.assert_true(common.compare_files(dump_file, scan_file, need_sort=True))
    
        '''
示例#19
0
def test_table_write_snapshot():
    """
    table write w/snapshot
    1. write data set 1
    2. create snapshot
    3. write data set 2
    4. scan w/snapshot, scan w/o snapshot & compare
    :return: None
    """
    table_name = 'test'
    dump_file1 = 'dump1.out'
    dump_file2 = 'dump2.out'
    scan_file1 = 'scan1.out'
    scan_file2 = 'scan2.out'
    common.run_tera_mark([(dump_file1, False)],
                         op='w',
                         table_name=table_name,
                         cf='cf0:q,cf1:q',
                         random='random',
                         key_seed=1,
                         value_seed=10,
                         value_size=100,
                         num=10000,
                         key_size=20)
    snapshot = common.snapshot_op(table_name)
    common.run_tera_mark([(dump_file2, False)],
                         op='w',
                         table_name=table_name,
                         cf='cf0:q,cf1:q',
                         random='random',
                         key_seed=1,
                         value_seed=11,
                         value_size=100,
                         num=10000,
                         key_size=20)
    common.compact_tablets(common.get_tablet_list(table_name))
    common.scan_table(table_name=table_name,
                      file_path=scan_file1,
                      allversion=False,
                      snapshot=snapshot)
    common.scan_table(table_name=table_name,
                      file_path=scan_file2,
                      allversion=False,
                      snapshot=0)
    nose.tools.assert_true(
        common.compare_files(dump_file1, scan_file1, need_sort=True))
    nose.tools.assert_true(
        common.compare_files(dump_file2, scan_file2, need_sort=True))
示例#20
0
def test_table_write_delete():
    """
    table write and deletion
    1. write data set 1
    2. delete data set 1
    3. scan & compare
    :return: None
    """
    table_name = 'test'
    scan_file = 'scan.out'
    common.run_tera_mark([], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=1, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([], op='d', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=1, value_size=100, num=10000, key_size=20)
    common.scan_table(table_name=table_name, file_path=scan_file, allversion=True)
    nose.tools.assert_true(common.file_is_empty(scan_file))
示例#21
0
    def test_table_write_delete(self):

        common.create_singleversion_table()
        table_name = 'test'
        scan_file = 'scan.out'
        common.run_tera_mark([], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=1, value_size=100, num=10000, key_size=20)
        common.run_tera_mark([], op='d', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=1, value_size=100, num=10000, key_size=20)
        common.scan_table(table_name=table_name, file_path=scan_file, allversion=True)
        nose.tools.assert_true(common.file_is_empty(scan_file))
    
        common.scan_table(table_name=table_name, file_path=scan_file, allversion=False, snapshot=0, is_async=True)
        nose.tools.assert_true(common.file_is_empty(scan_file))
    
        '''
示例#22
0
def test_table_write_delete():
    """
    table write and deletion
    1. write data set 1
    2. delete data set 1
    3. scan & compare
    :return: None
    """
    table_name = 'test'
    scan_file = 'scan.out'
    common.run_tera_mark([], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=1, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([], op='d', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=1, value_size=100, num=10000, key_size=20)
    common.scan_table(table_name=table_name, file_path=scan_file, allversion=True)
    nose.tools.assert_true(common.file_is_empty(scan_file))
示例#23
0
    def test_kv_random_write(self):

        common.create_kv_table()
        table_name = 'test'
        dump_file = 'dump.out'
        scan_file = 'scan.out'
        common.run_tera_mark([(dump_file, False)],
                             op='w',
                             table_name='test',
                             random='random',
                             value_size=100,
                             num=5000,
                             key_size=20)
        common.scan_table(table_name=table_name,
                          file_path=scan_file,
                          allversion=True)
        nose.tools.assert_true(
            common.compare_files(dump_file, scan_file, need_sort=True))
        '''
示例#24
0
    def test_table_write_del_snapshot(self):

        common.create_singleversion_table()
        table_name = 'test'
        dump_file = 'dump.out'
        scan_file1 = 'scan1.out'
        scan_file2 = 'scan2.out'
        common.run_tera_mark([(dump_file, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
        snapshot = common.snapshot_op(table_name)
        common.run_tera_mark([], op='d', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
        common.compact_tablets(common.get_tablet_list(table_name))
        common.scan_table(table_name=table_name, file_path=scan_file1, allversion=False, snapshot=snapshot)
        common.scan_table(table_name=table_name, file_path=scan_file2, allversion=False, snapshot=0)
        nose.tools.assert_true(common.compare_files(dump_file, scan_file1, need_sort=True))
        nose.tools.assert_true(common.file_is_empty(scan_file2))

        '''
示例#25
0
    def test_table_write_del_snapshot(self):

        common.create_singleversion_table()
        table_name = 'test'
        dump_file = 'dump.out'
        scan_file1 = 'scan1.out'
        scan_file2 = 'scan2.out'
        common.run_tera_mark([(dump_file, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
        snapshot = common.snapshot_op(table_name)
        common.run_tera_mark([], op='d', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
        common.compact_tablets(common.get_tablet_list(table_name))
        common.scan_table(table_name=table_name, file_path=scan_file1, allversion=False, snapshot=snapshot)
        common.scan_table(table_name=table_name, file_path=scan_file2, allversion=False, snapshot=0)
        nose.tools.assert_true(common.compare_files(dump_file, scan_file1, need_sort=True))
        nose.tools.assert_true(common.file_is_empty(scan_file2))

        '''
示例#26
0
def test_table_random_write_versions():
    """
    table write w/versions
    1. write data set 1
    2. write data set 2
    3. scan & compare
    :return: None
    """
    table_name = 'test'
    dump_file1 = 'dump1.out'
    dump_file2 = 'dump2.out'
    scan_file = 'scan.out'
    common.run_tera_mark([(dump_file1, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q',
                         random='random', key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
    common.run_tera_mark([(dump_file1, True), (dump_file2, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
    common.scan_table(table_name=table_name, file_path=scan_file, allversion=True)
    nose.tools.assert_true(common.compare_files(dump_file1, scan_file, need_sort=True))
    common.scan_table(table_name=table_name, file_path=scan_file, allversion=False)
    nose.tools.assert_true(common.compare_files(dump_file2, scan_file, need_sort=True))
示例#27
0
def test_showsize_kv_table():

    time.sleep(10)
    show_ret = common.parse_showinfo()
    table_name = "test"
    nose.tools.assert_equal(show_ret[table_name]["size"], "4K")
    dump_file = 'dump.out'
    scan_file = 'scan.out'
    common.run_tera_mark([(dump_file, False)],
                         op='w',
                         table_name='test',
                         random='random',
                         key_seed=1,
                         value_seed=10,
                         value_size=100,
                         num=5000,
                         key_size=20)
    common.scan_table(table_name=table_name,
                      file_path=scan_file,
                      allversion=True)
    nose.tools.assert_true(
        common.compare_files(dump_file, scan_file, need_sort=True))
    nose.tools.assert_not_equal(show_ret[table_name]["size"], "4K")
示例#28
0
def test_table_write_del_snapshot():
    """
    table write deletion w/snapshot
    1. write data set 1
    2. take snapshot
    3. delete data set 1
    4. scan w/snapshot, scan w/o snapshot & compare
    :return: None
    """
    table_name = 'test'
    dump_file = 'dump.out'
    scan_file1 = 'scan1.out'
    scan_file2 = 'scan2.out'
    common.run_tera_mark([(dump_file, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
    snapshot = common.snapshot_op(table_name)
    common.run_tera_mark([], op='d', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                         key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
    common.compact_tablets(common.get_tablet_list(table_name))
    common.scan_table(table_name=table_name, file_path=scan_file1, allversion=False, snapshot=snapshot)
    common.scan_table(table_name=table_name, file_path=scan_file2, allversion=False, snapshot=0)
    nose.tools.assert_true(common.compare_files(dump_file, scan_file1, need_sort=True))
    nose.tools.assert_true(common.file_is_empty(scan_file2))
示例#29
0
    def test_table_write_delete(self):

        common.create_singleversion_table()
        table_name = 'test'
        scan_file = 'scan.out'
        common.run_tera_mark([],
                             op='w',
                             table_name=table_name,
                             cf='cf0:q,cf1:q',
                             random='random',
                             key_seed=1,
                             value_seed=1,
                             value_size=100,
                             num=10000,
                             key_size=20)
        common.run_tera_mark([],
                             op='d',
                             table_name=table_name,
                             cf='cf0:q,cf1:q',
                             random='random',
                             key_seed=1,
                             value_seed=1,
                             value_size=100,
                             num=10000,
                             key_size=20)
        common.scan_table(table_name=table_name,
                          file_path=scan_file,
                          allversion=True)
        nose.tools.assert_true(common.file_is_empty(scan_file))

        common.scan_table(table_name=table_name,
                          file_path=scan_file,
                          allversion=False,
                          snapshot=0,
                          is_async=True)
        nose.tools.assert_true(common.file_is_empty(scan_file))
        '''
示例#30
0
    def test_table_write_delete_version(self):

        common.create_multiversion_table()
        table_name = 'test'
        dump_file1 = 'dump1.out'
        dump_file2 = 'dump2.out'
        scan_file1 = 'scan1.out'
        scan_file2 = 'scan2.out'
        common.run_tera_mark([(dump_file1, False), (dump_file2, False)], op='w', table_name=table_name, cf='cf0:q,cf1:q',
                             random='random', key_seed=1, value_seed=10, value_size=100, num=10000, key_size=20)
        common.run_tera_mark([(dump_file1, True), (dump_file2, True)], op='w', table_name=table_name, cf='cf0:q,cf1:q',
                             random='random', key_seed=1, value_seed=11, value_size=100, num=10000, key_size=20)
        common.run_tera_mark([(dump_file1, True)], op='w', table_name=table_name, cf='cf0:q,cf1:q', random='random',
                             key_seed=1, value_seed=12, value_size=100, num=10000, key_size=20)
        common.run_tera_mark([(dump_file1, True), (dump_file2, True)], op='w', table_name=table_name, cf='cf0:q,cf1:q',
                             random='random', key_seed=1, value_seed=13, value_size=100, num=10000, key_size=20)
        common.compact_tablets(common.get_tablet_list(table_name))
        common.scan_table(table_name=table_name, file_path=scan_file1, allversion=True, snapshot=0)
        common.run_tera_mark([], op='d', table_name=table_name, cf='cf0:q,cf1:q', random='random', key_seed=1,
                             value_seed=12, value_size=100, num=10000, key_size=20)
        common.compact_tablets(common.get_tablet_list(table_name))
        common.scan_table(table_name=table_name, file_path=scan_file2, allversion=True, snapshot=0)
        nose.tools.assert_true(common.compare_files(dump_file1, scan_file1, need_sort=True))
        nose.tools.assert_true(common.compare_files(dump_file2, scan_file2, need_sort=True))
示例#31
0
    def test_table_write_delete_version(self):

        common.create_multiversion_table()
        table_name = 'test'
        dump_file1 = 'dump1.out'
        dump_file2 = 'dump2.out'
        scan_file1 = 'scan1.out'
        scan_file2 = 'scan2.out'
        common.run_tera_mark([(dump_file1, False), (dump_file2, False)],
                             op='w',
                             table_name=table_name,
                             cf='cf0:q,cf1:q',
                             random='random',
                             key_seed=1,
                             value_seed=10,
                             value_size=100,
                             num=10000,
                             key_size=20)
        common.run_tera_mark([(dump_file1, True), (dump_file2, True)],
                             op='w',
                             table_name=table_name,
                             cf='cf0:q,cf1:q',
                             random='random',
                             key_seed=1,
                             value_seed=11,
                             value_size=100,
                             num=10000,
                             key_size=20)
        common.run_tera_mark([(dump_file1, True)],
                             op='w',
                             table_name=table_name,
                             cf='cf0:q,cf1:q',
                             random='random',
                             key_seed=1,
                             value_seed=12,
                             value_size=100,
                             num=10000,
                             key_size=20)
        common.run_tera_mark([(dump_file1, True), (dump_file2, True)],
                             op='w',
                             table_name=table_name,
                             cf='cf0:q,cf1:q',
                             random='random',
                             key_seed=1,
                             value_seed=13,
                             value_size=100,
                             num=10000,
                             key_size=20)
        common.compact_tablets(common.get_tablet_list(table_name))
        common.scan_table(table_name=table_name,
                          file_path=scan_file1,
                          allversion=True,
                          snapshot=0)
        common.run_tera_mark([],
                             op='d',
                             table_name=table_name,
                             cf='cf0:q,cf1:q',
                             random='random',
                             key_seed=1,
                             value_seed=12,
                             value_size=100,
                             num=10000,
                             key_size=20)
        common.compact_tablets(common.get_tablet_list(table_name))
        common.scan_table(table_name=table_name,
                          file_path=scan_file2,
                          allversion=True,
                          snapshot=0)
        nose.tools.assert_true(
            common.compare_files(dump_file1, scan_file1, need_sort=True))
        nose.tools.assert_true(
            common.compare_files(dump_file2, scan_file2, need_sort=True))
示例#32
0
def test_kv_snapshot_relaunch():
    """
    kv cluster relaunch
    1. write data set 1
    2. create snapshot
    3. write data set 2
    4. scan w/snapshot, scan w/o snapshot & compare
    5. kill & launch cluster
    6. repeat 4
    :return: None
    """
    table_name = 'test'
    dump_file1 = 'dump1.out'
    dump_file2 = 'dump2.out'
    scan_file1 = 'scan1.out'
    scan_file2 = 'scan2.out'
    common.run_tera_mark([(dump_file1, False)],
                         op='w',
                         table_name=table_name,
                         random='random',
                         key_seed=1,
                         value_seed=10,
                         value_size=100,
                         num=10000,
                         key_size=20)
    snapshot = common.snapshot_op(table_name)
    common.run_tera_mark([(dump_file2, False)],
                         op='w',
                         table_name=table_name,
                         random='random',
                         key_seed=1,
                         value_seed=11,
                         value_size=100,
                         num=10000,
                         key_size=20)
    common.compact_tablets(common.get_tablet_list(table_name))
    common.scan_table(table_name=table_name,
                      file_path=scan_file1,
                      allversion=True,
                      snapshot=snapshot)
    common.scan_table(table_name=table_name,
                      file_path=scan_file2,
                      allversion=True,
                      snapshot=0)
    nose.tools.assert_true(
        common.compare_files(dump_file1, scan_file1, need_sort=True))
    nose.tools.assert_true(
        common.compare_files(dump_file2, scan_file2, need_sort=True))
    common.cluster_op('kill')
    common.cluster_op('launch')
    time.sleep(2)
    common.scan_table(table_name=table_name,
                      file_path=scan_file1,
                      allversion=False,
                      snapshot=snapshot)
    common.scan_table(table_name=table_name,
                      file_path=scan_file2,
                      allversion=False,
                      snapshot=0)
    nose.tools.assert_true(
        common.compare_files(dump_file1, scan_file1, need_sort=True))
    nose.tools.assert_true(
        common.compare_files(dump_file2, scan_file2, need_sort=True))