Ai
1 Star 0 Fork 0

opengauss_sharding/pipeline_script

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
rx_config.py 2.32 KB
一键复制 编辑 原始数据 按行查看 历史
周斌 提交于 2023-11-13 11:31 +08:00 . add orm
#!/usr/bin/evn python
# -*- coding: utf-8 -*-
"""
description: please input using description
author: justbk
date: 2022/3/4
modify_records:
- 2022/3/4 justbk create this file
"""
#common = 0xfffffff
# common = 0x000f0000
#
# values = ["%08x"% ((1 << i) | common) for i in range(16)]
# print(values)
import time
import binascii
import binhex
binarys = """00 00 00 2f 00 00 00 00 3c 18
d5 c0 42 45 47 49 4e 20 43 53
4e 3a 20 34 33 30 32 36 20 63
6f 6d 6d 69 74 5f 6c 73 6e 3a
20 30 2f 33 43 31 38 44 35 43
30 00 00 00 f7 00 00 00 00 3c
18 d5 c0 7b 22 74 61 62 6c 65
5f 6e 61 6d 65 22 3a 22 74 65
73 74 2e 72 65 70 6c 69 63 61
74 65 5f 74 65 73 74 22 2c 22
6f 70 5f 74 79 70 65 22 3a 22
49 4e 53 45 52 54 22 2c 22 63
6f 6c 75 6d 6e 73 5f 6e 61 6d
65 22 3a 5b 22 69 64 22 2c 22
64 61 74 61 30 22 2c 22 64 61
74 61 31 22 5d 2c 22 63 6f 6c
75 6d 6e 73 5f 74 79 70 65 22
3a 5b 22 69 6e 74 65 67 65 72
22 2c 22 69 6e 74 65 67 65 72
22 2c 22 63 68 61 72 61 63 74
65 72 20 76 61 72 79 69 6e 67
22 5d 2c 22 63 6f 6c 75 6d 6e
73 5f 76 61 6c 22 3a 5b 22 30
22 2c 22 36 30 22 2c 22 27 61
61 61 27 22 5d 2c 22 6f 6c 64
5f 6b 65 79 73 5f 6e 61 6d 65
22 3a 5b 5d 2c 22 6f 6c 64 5f
6b 65 79 73 5f 74 79 70 65 22
3a 5b 5d 2c 22 6f 6c 64 5f 6b
65 79 73 5f 76 61 6c 22 3a 5b
5d 7d 00 00 00 19 00 00 00 00
3c 18 d7 88 63 6f 6d 6d 69 74
20 78 69 64 3a 20 35 36 35 34
30 00 00 00 00"""
def str_lsn(lsn_arr):
return lsn_arr[3] + "/" + "".join(lsn_arr[4:])
values = list(map(lambda x: x.lstrip(),binarys.split(" ")))
print(values)
i = 0
while i < len(values):
start_pos = i + 4
item_len = int("".join(values[i:start_pos]), 16)
if item_len == 0:
i += 4
continue
i += item_len + 4
item_values = values[(start_pos):(start_pos + item_len)]
lsn_values = item_values[0: 8]
lsn = str_lsn(lsn_values)
hex_data = "".join(item_values[8:]).encode("utf-8")
data_bin = binascii.unhexlify(hex_data)
data_str = data_bin.decode('utf-8')
print("lsn:{}, data:{}".format(lsn, data_str))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/opengauss_sharding/pipeline_script.git
git@gitee.com:opengauss_sharding/pipeline_script.git
opengauss_sharding
pipeline_script
pipeline_script
master

搜索帮助