当前位置:网站首页>[tcaplusdb knowledge base] Introduction to tcaplusdb tcapulogmgr tool (II)
[tcaplusdb knowledge base] Introduction to tcaplusdb tcapulogmgr tool (II)
2022-06-29 03:32:00 【Database master】
4. updatefields
updatefields The command is used to return files and dynamically change the table structure , The command format is ./tcapulogmgr updatefields --directory= --engine-directory= --tbusid= --conf= [--speed= --seqcontinuous], among , The meanings of the first four required parameters are :
--directory ulog File directory
--engine-directory Cold standby file directory
--tbusid Indicates that you want to perform a fileback operation and dynamically change the table structure svr_id, Used to filter the corresponding... From the directory binlog file
--conf updatefields The configuration file for the command , It specifies DirServerAddr、PassWord、 Tables to retrieve and import data and tables to convert records so file
updatefields Command configuration file template and description
<?xml version="1.0" encoding="GBK" standalone="yes" ?> <tcapulogmgr> <!-- Dynamically change the configuration of the table structure --> <UpdateFieldsCfg UpdateFieldsCfgNum="1"> <!--SourceAppID、SourceZoneID、SourceTableName Used to specify the business of the data table to be archived ID、 District Service ID And table name --> <!--DestAppID、DestZoneID、DestTableName Used to specify the business to save the converted records ID、 District Service ID And table name --> <!--LibFile Used to specify user generated to convert the record structure so file --> <UpdateFieldsCfgItem SourceAppID="2" SourceZoneID="3" SourceTableName="TestData" DestAppID="2" DestZoneID="3" DestTableName="TestData_new" LibFile="do_nothing.so"/> <!--PassWord Is used to specify the DestTableName Password of the business --> <ServiceApiCfg PassWord="**********" ConnectTimeOut="10000" RegistTableTimeOut="10000" DirServerNum="1" > <!--DirServerAddr Is used to specify the DestTableName Directory server address of the business --> <DirServerAddr>tcp://*.*.*.*:9999</DirServerAddr> </ServiceApiCfg> </UpdateFieldsCfg> </tcapulogmgr>
The parameters in square brackets are optional :
--speed Speed control parameters
--seqcontinuous Express binlog The serial number of must be continuous , If it is not continuous, an error will be reported
Suppose the code file used to convert the record structure is do_nothing.cpp, have access to g++ -shared -fPIC -o do_nothing.so do_nothing.cpp Generate the corresponding dynamic link library file . stay do_nothing.cpp In file , It needs to be realized according to specific requirements TransferRecord function .
TransferRecord Example of function
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <assert.h>
#include <sstream>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <tr1/functional>
#define TCAPLUS_MAX_TABLE_NAME_LEN_FOR_PLUGIN 128
enum EnumTransRecordStatus {
ENUM_TRANS_RECORD_SUC = 0,
ENUM_TRANS_RECORD_NOT_EXIST = 1,
ENUM_TRANS_RECORD_FAIL= -1,
};
typedef int int32_t;
typedef struct {
int32_t iAppID;
int32_t iZoneID;
char szTableName[TCAPLUS_MAX_TABLE_NAME_LEN_FOR_PLUGIN];
std::tr1::function<int(const char*)> pFuncForBillLog;
} TcapsvrImportCallBackPara;
typedef std::map<std::string, std::string> TcapFieldNameValueMap;
typedef std::vector<TcapFieldNameValueMap> VALUELIST;
typedef std::vector<EnumTransRecordStatus> STATUSLIST;
using namespace std;
extern "C" int TransferRecord(const VALUELIST& old_list,
VALUELIST& new_list, STATUSLIST& status_list,
TcapsvrImportCallBackPara* pCallBackPara)
{
if (NULL == pCallBackPara)
{
return -1;
}
VALUELIST::const_iterator it_list;
new_list.clear();
for (it_list = old_list.begin(); it_list != old_list.end(); ++it_list)
{
int ret = ENUM_TRANS_RECORD_SUC;
TcapFieldNameValueMap new_map;
const TcapFieldNameValueMap& old_map = *it_list;
TcapFieldNameValueMap::const_iterator it;
for (it = old_map.begin(); it != old_map.end(); ++it)
{
std::pair<TcapFieldNameValueMap::iterator, bool> result;
result = new_map.insert(std::make_pair(it->first, it->second));
if(!result.second)
{
status_list.push_back(ENUM_TRANS_RECORD_FAIL);
return -1;
}
}
// add new filed: platformid, use default value 0
// int32_t platformid = 0;
// std::string new_value((char*)&platformid, sizeof(platformid));
// std::string new_key = "platformid";
// std::pair<TcapFieldNameValueMap::iterator, bool> result = new_map.insert(std::make_pair(new_key, new_value));
// if(!result.second)
// {
// status_list.push_back(ENUM_TRANS_RECORD_FAIL);
// return -1;
// }
new_list.push_back(new_map);
status_list.push_back((EnumTransRecordStatus)ret);
}
return 0;
}Generate... According to the above function example so file , And in tcapulogmgr_cfg.xml After configuring relevant parameters in , perform ./tcapulogmgr updatefields --directory=/txh/ulog/1.2.2.1 --engine-directory=/txh --tbusid=1.2.2.1 --conf=tcapulogmgr_cfg.xml --seqcontinuous. hypothesis /txh In the configuration file SourceTableName Field of the engine file of the data table specified checkpoint by 50,/txh/ulog/1.2.2.1 The largest in the directory sequence by 60, Then the command will redo sequence stay 51 To 60 Between binlog, Yes SourceTableName Field to perform a file retrieval operation on the data table specified by the ; meanwhile , Will use so File right here 10 strip binlog Transform the corresponding record structure , Put it redo To DestTableName In the data table specified by the field .
For more information, please pay attention to TcaplusDB WeChat official account , In the wind and rain , We've been waiting for you !

TcaplusDB It's a distributed product of Tencent NoSQL database , The code for storage and scheduling is completely self-developed . With cache + Landing fusion architecture 、PB Levels of storage 、 Millisecond delay 、 Lossless horizontal expansion and complex data structure . At the same time, it has rich ecological environment 、 Easy migration 、 Extremely low operation and maintenance costs and five nine high availability features . Customer coverage game 、 Internet 、 government affairs 、 Finance 、 Manufacturing and the Internet of things .
边栏推荐
- leetcode:304. 二维区域和检索 - 矩阵不可变
- Stm32l4 Series MCU ADC accurately calculates input voltage through internal reference voltage
- vim配置与使用
- Web GIS 航拍实现的智慧园区数字孪生应用
- 【TcaplusDB知识库】修改业务修改集群cluster
- Etcd教程 — 第七章 Etcd之事务API
- 需求分析说明书和需求规格说明书
- 88.(cesium篇)cesium聚合图
- 不同的二叉搜索树[自下而上回溯生成树+记忆搜索--空间换时间]
- Laravel v. about laravel using the pagoda panel to connect to the cloud database (MySQL)
猜你喜欢

2022-2028 global bubble CPAP system industry survey and trend analysis report
![相同的树[从部分到整体]](/img/2d/997b9cb9cd4f8ea8620f5a66fcf00a.png)
相同的树[从部分到整体]
![[yunyuanyuan] it's so hot. Why don't you come and understand it?](/img/a8/99037ec5b796e39b9e76eac95deb86.png)
[yunyuanyuan] it's so hot. Why don't you come and understand it?

凌晨三点学习的你,感到迷茫了吗?

Stm32l4 Series MCU ADC accurately calculates input voltage through internal reference voltage

Tupu software intelligent energy integrated management and control platform
![二叉树的层序遍历 II[层序遍历方式之一 ->递归遍历 + level]](/img/f9/efb73dd6047e6d5833581376904788.png)
二叉树的层序遍历 II[层序遍历方式之一 ->递归遍历 + level]
![The continued movement of Jerry's watch [chapter]](/img/3e/f8b98997320580431a8e7117f4a506.jpg)
The continued movement of Jerry's watch [chapter]

FPGA (VIII) RTL code IV (basic circuit design 1)

迅为龙芯开发板pmon下Ejtag-设置硬件断点指令
随机推荐
Probe into metacosmic storage, the next explosive point in the data storage market?
Problème - Ajouter shellerror: permissions d'instrumentation pour le périphérique: vérifier les règles udev.
Synchronous real-time data of Jerry's watch [chapter]
19.03 vessel description and simple application examples continued
设备监理师证书含金量怎样?值得考吗?
Yyds dry inventory difference between bazel and gradle tools
set time format
FortiGate firewall configuration log uploading regularly
2022-2028 global sound insulation coating industry research and trend analysis report
Zigzag sequence traversal of binary tree [one of layered traversal methods - > preorder traversal +level]
FortiGate firewall filters the specified session and cleans it up
Basic concepts of graph theory
二叉树的层序遍历 II[层序遍历方式之一 ->递归遍历 + level]
ssm项目环境初步搭建
Connect error: no route to host (errno:113)
Stm32l4 Series MCU ADC accurately calculates input voltage through internal reference voltage
PHP实现 mqtt通信
不同的二叉搜索樹[自下而上回溯生成樹+記憶搜索--空間換時間]
2022-2028 global secondary butyl lithium industry research and trend analysis report
Geth --- Error: authentication needed: password or unlock