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))
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)) '''
def test_launch_ts_first(): """ Test launch TS first """ common.cluster_op('kill') common.cluster_op('launch') time.sleep(10) ret = subprocess.Popen('./teracli show', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) print ''.join(ret.stdout.readlines()) retinfo1 = common.parse_showinfo() nose.tools.assert_true(len(retinfo1) != 0) time.sleep(12) common.cluster_op('kill') common.cluster_op('launch_ts_first') ret = subprocess.Popen('./teracli show', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) print ''.join(ret.stdout.readlines()) retinfo2 = common.parse_showinfo() nose.tools.assert_true(len(retinfo2) != 0)
def test_launch_ts_first(): common.cluster_op('kill') common.cluster_op('launch') time.sleep(10) ret = subprocess.Popen('./teracli show', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) print ''.join(ret.stdout.readlines()) retinfo1 = common.parse_showinfo() nose.tools.assert_true(len(retinfo1) != 0) time.sleep(12) common.cluster_op('kill') common.cluster_op('launch_ts_first') ret = subprocess.Popen('./teracli show', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) print ''.join(ret.stdout.readlines()) retinfo2 = common.parse_showinfo() nose.tools.assert_true(len(retinfo2) != 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))