Exemplo n.º 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))
Exemplo n.º 2
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))
Exemplo n.º 3
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))
Exemplo n.º 4
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))
        
        '''
Exemplo n.º 5
0
def test_showsize_kv_table():
    table_name = "test"
    scan_file = 'scan.out'
    common.run_tera_mark([], op='w', table_name='test', random='random',
                         key_seed=1, value_seed=10, value_size=100, num=5000, key_size=20)
    time.sleep(3)
    show_ret = common.parse_showinfo()
    size = float(show_ret[table_name]["size"][:-1])
    if size >= 774 * 0.9 and size <= 774 * 1.1:
        nose.tools.assert_true(True)
    else:
        nose.tools.assert_true(False)
Exemplo n.º 6
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))
    
        '''
Exemplo n.º 7
0
    def test_rowreader_lowlevelscan(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:q00,cf0:q01,cf0:q02,cf1:q00,cf1:q01,cf1:q02', random='seq',
                             key_seed=1, value_seed=10, value_size=64, num=10, key_size=20)
        common.rowread_table(table_name=table_name, file_path=scan_file)
        nose.tools.assert_true(common.compare_files(dump_file, scan_file, need_sort=False))
    
        '''
Exemplo n.º 8
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")
Exemplo n.º 9
0
 def test_showsize_table(self):
     common.create_singleversion_table()
     table_name = "test"
     scan_file = 'scan.out'
     common.run_tera_mark([], op='w', table_name='test', cf='cf0:q,cf1:q', random='random',
                          key_seed=1, value_seed=10, value_size=100, num=5000, key_size=20)
     show_ret = common.parse_showinfo()
     time.sleep(3)
     show_ret = common.parse_showinfo()
     size = float(show_ret[table_name]["size"][:-1])
     if size >= 1.65 * 0.95 and size <= 1.65 * 1.05:
         nose.tools.assert_true(True)
     else:
         nose.tools.assert_true(False)
Exemplo n.º 10
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))
Exemplo n.º 11
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))
Exemplo n.º 12
0
def test_rowreader_lowlevelscan():
    """
    table rowreader_lowlevelscan
    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:q00,cf0:q01,cf0:q02,cf1:q00,cf1:q01,cf1:q02', random='seq',
                         key_seed=1, value_seed=10, value_size=64, num=10, key_size=20)
    common.rowread_table(table_name=table_name, file_path=scan_file)
    nose.tools.assert_true(common.compare_files(dump_file, scan_file, need_sort=False))
Exemplo n.º 13
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))
    
        '''
Exemplo n.º 14
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))
    
        '''
Exemplo n.º 15
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))
Exemplo n.º 16
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))

        '''
Exemplo n.º 17
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))
Exemplo n.º 18
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))
        '''
Exemplo n.º 19
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")
Exemplo n.º 20
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))
Exemplo n.º 21
0
    def test_table_write_multiversion_snapshot(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)], 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))

        '''
Exemplo n.º 22
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))
Exemplo n.º 23
0
def test_table_snapshot_relaunch():
    """
    table 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,
                         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))