当前位置: 首页>>代码示例>>C++>>正文


C++ TableItem::get_memtable方法代码示例

本文整理汇总了C++中TableItem::get_memtable方法的典型用法代码示例。如果您正苦于以下问题:C++ TableItem::get_memtable方法的具体用法?C++ TableItem::get_memtable怎么用?C++ TableItem::get_memtable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TableItem的用法示例。


在下文中一共展示了TableItem::get_memtable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv)
{
  if (4 != argc)
  {
    fprintf(stderr, "./test_tablemgr [store_root] [raid_regex] [store_regex]\n");
    exit(-1);
  }

  ob_init_memory_pool();
  char *root = argv[1];
  char *raid = argv[2];
  char *store = argv[3];
  TableMgr tm;
  SSTableMgr &sstm = UPS.get_sstable_mgr();
  CommonSchemaManagerWrapper schema_mgr;
  tbsys::CConfig config;
  schema_mgr.parse_from_file("test_schema.ini", config);
  UPS.get_table_mgr().set_schemas(schema_mgr);

  common::ObRoleMgr role_mgr;
  common::ObSlaveMgr slave_mgr;
  role_mgr.set_role(ObRoleMgr::MASTER);
  int ret = slave_mgr.init(0, &UPS.get_ups_rpc_stub(), 1000000, 6000000, 4000000, 3);
  assert(OB_SUCCESS == ret);
  ret = UPS.get_log_mgr().init("./commitlog", 64 * 1024 * 1024, &slave_mgr, &role_mgr, 0);
  assert(OB_SUCCESS == ret);
  ret = UPS.get_log_mgr().replay_log(UPS.get_table_mgr());
  assert(OB_SUCCESS == ret);

  ret = tm.init();
  assert(OB_SUCCESS == ret);

  sstable::ObBlockCacheConf bc_conf;
  bc_conf.block_cache_memsize_mb = 100;
  sstable::ObBlockIndexCacheConf bic_conf;
  bic_conf.cache_mem_size = 100 * 1024 * 1024;
  ret = UPS.get_sstable_query().init(bc_conf, bic_conf);
  assert(OB_SUCCESS == ret);

  ret = sstm.init(root, raid, store);
  assert(OB_SUCCESS == ret);

  ret = sstm.reg_observer(&tm);
  assert(OB_SUCCESS == ret);

  sstm.load_new();
  tm.sstable_scan_finished(3);

  TableItem *ti = tm.get_active_memtable();
  assert(NULL != ti);
  fill_memtable(ti->get_memtable());
  tm.revert_active_memtable(ti);

  ret = tm.replay_freeze_memtable(SSTableID::get_id(11, 2, 2), SSTableID::get_id(11, 1, 1), 7);
  assert(OB_SUCCESS == ret);
  tm.log_table_info();

  ObVersionRange vg;
  vg.start_version_ = 10;
  vg.end_version_ = 10;
  vg.border_flag_.set_inclusive_start();
  vg.border_flag_.set_inclusive_end();
  uint64_t max_version = 0;
  ObList<ITableEntity*> tlist;
  ret = tm.acquire_table(vg, max_version, tlist);
  assert(OB_SUCCESS == ret);
  assert(10 == max_version);
  assert(3 == tlist.size());
  tm.revert_table(tlist);

  tm.try_dump_memtable();

  ti = tm.get_active_memtable();
  fill_memtable(ti->get_memtable());
  tm.revert_active_memtable(ti);
  uint64_t new_version = 0;
  uint64_t frozen_version = 0;
  uint64_t clog_id = 9;
  int64_t time_stamp = 0;
  bool major_version_changed = false;
  ret = tm.try_freeze_memtable(0, 0, 0, new_version, frozen_version, clog_id, time_stamp, major_version_changed);
  assert(OB_SUCCESS == ret);
  assert(new_version == SSTableID::get_id(12, 1, 1));
  assert(frozen_version == SSTableID::get_id(11, 2, 2));
  assert(major_version_changed);

  tm.try_dump_memtable();

  vg.start_version_ = 10;
  vg.end_version_ = 100;
  vg.border_flag_.set_inclusive_start();
  vg.border_flag_.set_inclusive_end();
  max_version = 0;
  ret = tm.acquire_table(vg, max_version, tlist);
  assert(OB_SUCCESS == ret);
  assert(12 == max_version);
  assert(6 == tlist.size());
  get_table(tlist);

  tm.log_table_info();
//.........这里部分代码省略.........
开发者ID:CCoder123,项目名称:pproj,代码行数:101,代码来源:test_tablemgr.cpp


注:本文中的TableItem::get_memtable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。