Esempio n. 1
0
    int ObPermInfoKey::build_get_param(ObGetParam & get_param)
    {
      int ret = OB_SUCCESS;
      ObCellInfo cell_info;
      ObRowkey rowkey;
      ObObj rowkey_obj;
      ObVersionRange ver_range;
      int64_t pos = 0;
      if (NULL == buffer_)
      {
        buffer_ = reinterpret_cast<char*>(ob_malloc(BUF_SIZE, ObModIds::OB_PERM_INFO));
      }

      if (NULL != buffer_)
      {
        int64_t encode_pos = pos;
        ret = serialization::encode_i64(buffer_, BUF_SIZE, encode_pos, table_id_);
        if (OB_SUCCESS != ret)
        {
          TBSYS_LOG(ERROR, "encode failed table_id=%ld", table_id_);
        }
        else
        {
          memcpy(buffer_ + encode_pos, user_name_, length_);
          encode_pos += length_;
          rowkey_obj.set_varchar(
              ObString(0, static_cast<int32_t>(encode_pos - pos), buffer_ + pos));
          rowkey.assign(&rowkey_obj, 1);
          get_param.set_is_result_cached(true);
          cell_info.table_id_  = PERM_TABLE_ID;
          cell_info.row_key_   = rowkey;
          cell_info.column_id_ = PERM_COL_ID;
          ret = get_param.add_cell(cell_info);
          if (OB_SUCCESS != ret)
          {
            TBSYS_LOG(ERROR, "Get param add cell failed table_id[%lu]", cell_info.table_id_);
          }
          else
          {
            ver_range.start_version_ = 0;
            ver_range.end_version_   = INT64_MAX - 1;
            ver_range.border_flag_.set_inclusive_start();
            ver_range.border_flag_.set_inclusive_end();
            get_param.set_version_range(ver_range);
          }
        }
      }
      else
      {
        TBSYS_LOG(ERROR, "malloc key buffer failed");
        ret = OB_ERROR;
      }
      return ret;
    }
Esempio n. 2
0
    int ObSKeyInfoKey::build_get_param(ObGetParam& get_param)
    {
      int ret = OB_SUCCESS;
      ObCellInfo cell_info;
      ObRowkey rowkey;
      ObObj rowkey_obj;
      ObVersionRange ver_range;
      int64_t pos = 0;
      if (NULL == buffer_)
      {
        buffer_ = reinterpret_cast<char*>(ob_malloc(BUF_SIZE, ObModIds::OB_SKEY_INFO_KEY));
      }

      ret = serialization::encode_i64(buffer_, BUF_SIZE, pos, skey_version_);
      if (OB_SUCCESS != ret)
      {
        TBSYS_LOG(ERROR, "encode failed pkey_version=%ld", skey_version_);
      }
      else
      {
        rowkey_obj.set_varchar(ObString(0, static_cast<int32_t>(pos), buffer_));
        rowkey.assign(&rowkey_obj, 1);
        get_param.reset();
        get_param.set_is_result_cached(true);
        cell_info.table_id_  = SKEY_TABLE_ID;
        cell_info.row_key_   = rowkey;
        cell_info.column_id_ = SKEY_COL_ID;
        ret = get_param.add_cell(cell_info);
        if (OB_SUCCESS != ret)
        {
          TBSYS_LOG(ERROR, "Get param add cell failed table_id[%lu]", cell_info.table_id_);
        }
        else
        {
          ver_range.start_version_ = 0;
          ver_range.end_version_   = INT64_MAX - 1;
          ver_range.border_flag_.set_inclusive_start();
          ver_range.border_flag_.set_inclusive_end();
          get_param.set_version_range(ver_range);
        }
      }
      return ret;
    }
Esempio n. 3
0
int ObMergerPrefetchData::modify_prefetch_param(ObGetParam & param)
{
  ObVersionRange range;
  int ret = version_.get_version(range.end_version_.version_);
  if ((ret != OB_SUCCESS) || (range.end_version_ <= 0))
  {
    TBSYS_LOG(WARN, "get last version failed:version[%ld], ret[%d]", (int64_t)range.end_version_, ret);
  }
  else
  {
    cur_version_ = range.end_version_;
    range.border_flag_.set_min_value();
    range.border_flag_.set_inclusive_end();
    // maybe not need someday
    param.set_is_result_cached(true);
    param.set_is_read_consistency(true);
    param.set_version_range(range);
  }
  return ret;
}
Esempio n. 4
0
    int ObUserInfoKey:: build_get_param(ObGetParam& get_param)
    {
      int ret = OB_SUCCESS;
      ObCellInfo cell_info;
      ObString rowkey;
      ObVersionRange ver_range;
      if (NULL == buffer_)
      {
        buffer_ = reinterpret_cast<char*>(ob_malloc(BUF_SIZE));
      }
      
      if (NULL != buffer_)
      {
        memcpy(buffer_, user_name_, length_);
        rowkey.assign(buffer_, static_cast<int32_t>(length_));

        get_param.set_is_result_cached(true);
        cell_info.table_id_  = USER_TABLE_ID;
        cell_info.row_key_   = rowkey;
        cell_info.column_id_ = USER_COL_ID;
        ret = get_param.add_cell(cell_info);
        if (OB_SUCCESS != ret)
        {
          TBSYS_LOG(ERROR, "Get param add cell failed table_id[%lu]", cell_info.table_id_);
        }
        else
        {
          ver_range.start_version_ = 0;
          ver_range.end_version_   = INT64_MAX - 1;
          ver_range.border_flag_.set_inclusive_start();
          ver_range.border_flag_.set_inclusive_end();
          get_param.set_version_range(ver_range);
        }
      }
      else
      {
        TBSYS_LOG(ERROR, "malloc key buffer failed");
        ret = OB_ERROR;
      }
      return ret;
    }