This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
doris-doris-dispatch/server/doris_server_receive.h

170 lines
3.7 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __DORIS_SERVER_RECEIVE_H__
#define __DORIS_SERVER_RECEIVE_H__
#include <stdio.h>
#include <sys/queue.h>
#include <event.h>
#include <openssl/md5.h>
#include <cjson/cJSON.h>
#include <evhttp.h>
#include "doris_producer_client.h"
#if(__GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__ >= 410)
#define atomic_inc(x) __sync_add_and_fetch((x),1)
#define atomic_dec(x) __sync_sub_and_fetch((x),1)
#define atomic_add(x,y) __sync_add_and_fetch((x),(y))
#define atomic_sub(x,y) __sync_sub_and_fetch((x),(y))
#define atomic_read(x) __sync_add_and_fetch((x),0)
#define atomic_set(x,y) __sync_lock_test_and_set((x),y)
#else
#error "GCC version should be 4.1.2 later"
#endif
#include <map>
using namespace std;
enum DORIS_SERVER_FS_FILED
{
DRS_FSSTAT_RECV_ERR_VER=0,
DRS_FSSTAT_RECV_START_FILES,
DRS_FSSTAT_RECV_CMPLT_FILES,
DRS_FSSTAT_CLIENT_INVALID_REQ,
DRS_FSSTAT_CLIENT_META_REQ,
DRS_FSSTAT_SEND_META_NONEW,
DRS_FSSTAT_CLIENT_FILE_REQ,
DRS_FSSTAT_SEND_FILES,
DRS_FSSTAT_SEND_FILE_BYTES,
DRS_FSSTAT_SEND_FILE_RES_404,
DRS_FSSTAT_VERSION_EXPIRES,
DRS_FSSTAT_FIELD_NUM,
};
enum DORIS_SERVER_FS_COLUMN
{
DRS_FSCLM_RECV_FULL_VER=0,
DRS_FSCLM_RECV_INC_VER,
DRS_FSCLM_RECV_FILES,
DRS_FSCLM_POST_ON_THE_WAY,
DRS_FSCLM_SEND_META_RES,
DRS_FSCLM_CUR_FULL_VERSION,
DRS_FSCLM_CUR_INC_VERSION,
DRS_FSCLM_CONFIG_TOTAL_NUM,
DRS_FSSTAT_CLUMN_NUM,
};
enum DORIS_SERVER_FS_STATUS
{
DRS_FSSTAT_MEMORY_USED=0,
DRS_FSSTAT_STATUS_NUM,
};
struct cont_frag_node
{
size_t start;
size_t end;
size_t totalsize;
size_t cur_fraglen;
char *content;
TAILQ_ENTRY(cont_frag_node) frag_node;
};
struct internal_tablemeta
{
char tablename[64];
char filename[64];
size_t offset;
int32_t islast;
};
struct table_list_node
{
char tablename[64];
char localpath[256];
size_t filesize;
size_t cur_totallen;
/*this part for http post server*/
bool onceupload;
int32_t finished;
MD5_CTX md5ctx;
char tmppath[256];
char filename[128];
char fragmd5[36];
u_int32_t cfgnum;
char *fragcontent;
size_t fragsize;
cJSON *table_meta;
FILE *fp_cfg_file;
struct cont_frag_node *cur_frag;
TAILQ_HEAD(__table_cont_node, cont_frag_node) frag_head;
TAILQ_ENTRY(table_list_node) table_node;
};
struct doris_business;
struct version_list_node
{
int64_t version;
char *metacont;
int32_t metalen;
int16_t cfg_type; //1-full, 2-inc
int8_t cont_in_disk;
int8_t version_finished;
cJSON *metajson, *arrayjson;
cJSON *table_meta;
/*this part for http post server*/
FILE *fp_idx_file;
char token[64];
char tmp_index_path[256]; //incĿ¼<C4BF>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱÿ<CAB1><C3BF><EFBFBD><EFBFBD><E6B1BE>һ<EFBFBD><D2BB>
int16_t retry_times;
int16_t syncing;
int32_t total_cfgs;
struct doris_business *business;
struct evhttp_request *req;
struct doris_upload_ctx *synctx;
struct table_list_node *cur_table;
struct event timer_expire;
TAILQ_HEAD(__table_list_node, table_list_node) table_head;
TAILQ_ENTRY(version_list_node) version_node;
};
struct version_list_handle
{
TAILQ_HEAD(__version_list_node, version_list_node) version_head;
int64_t latest_version;
int32_t references;
u_int32_t version_num;
map<int64_t, struct version_list_node*> *version2node;
struct version_list_node *oldest_vernode; //δ<><CEB4><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>̭<EFBFBD><CCAD><EFBFBD><EFBFBD><EFBFBD>ϰ汾
};
struct version_list_handle *config_version_handle_new(void);
struct common_timer_event
{
struct event timer_event;
void *data;
};
struct doris_business;
struct bufferevent *doris_https_bufferevent_cb(struct event_base *evabse, void *arg);
struct doris_business *lookup_bizstruct_from_name(const struct evkeyvalq *params);
void business_set_sync_peer_abnormal(struct doris_business *business);
void business_resume_sync_peer_normal(struct doris_business *business);
void* thread_doris_client_recv_cfg(void *arg);
void* thread_index_file_recv_cfg(void *arg);
void* thread_http_post_recv_cfg(void *arg);
#endif