pgpool-II在故障切换过程中是如何选举新主节点的
在pgpool的源代码中有有一个pgpool_main.c文件,在该文件中有一个pgpool的主函数pgpoolmain控制着pgpool的运行及相关操作。
libpcp_ext.h文件中定义了pgpool在一个集群中所运行的数据库节点个数如下宏定义及128个;
#define MAX_NUM_BACKENDS 128
#define MAX_CONNECTION_SLOTS MAX_NUM_BACKENDS
#define MAX_DB_HOST_NAMELEN 128
#define MAX_PATH_LENGTH 256
在pgpool中对后端数据库状态的几种定义如下:
typedef enum {
CON_UNUSED, /* unused slot */
CON_CONNECT_WAIT, /* waiting for connection starting */
CON_UP, /* up and running */
CON_DOWN /* down, disconnected */
} BACKEND_STATUS;
/* backend status name strings */
#define BACKEND_STATUS_CON_UNUSED "unused"
#define BACKEND_STATUS_CON_CONNECT_WAIT "waiting"
#define BACKEND_STATUS_CON_UP "up"
#define BACKEND_STATUS_CON_DOWN "down"
PostgreSQL数据库在pgpool集群中的描述信息如下:
/*
* PostgreSQL backend descriptor. Placed on shared memory area.
*/
typedef struct {
char backend_hostname[MAX_DB_HOST_NAMELEN]; /* backend host name */
int backend_port; /* backend port numbers */
BACKEND_STATUS backend_status; /* backend status */
double backend_weight; /* normalized backend load balance ratio */
double unnormalized_weight; /* descripted parameter */
char backend_data_directory[MAX_PATH_LENGTH];
unsigned short flag; /* various flags */
unsigned long long int standby_delay; /* The replication delay against the primary */
} BackendInfo;
typedef struct {
sig_atomic_t num_backends; /* Number of used PostgreSQL backends.
* This needs to be a sig_atomic_t type
* since it is replaced by a local
* variable while reloading pgpool.conf.
*/
BackendInfo backend_info[MAX_NUM_BACKENDS];#记录了pgpool中数据库的最大数;
} BackendDesc;
/*
* Calculate next valid master node id.
* If no valid node found, returns -1.
*/
这个函数就是控制选举下一个master节点的函数;
static int get_next_master_node(void)
{
int i;
for (i=0;i<pool_config->backend_desc->num_backends;i++)
{
/*
* Do not use VALID_BACKEND macro in raw mode.
* VALID_BACKEND return true only if the argument is master
* node id. In other words, standby nodes are false. So need
* to check backend status with VALID_BACKEND_RAW.
*/
if (RAW_MODE)
{
if (VALID_BACKEND_RAW(i))
break;
}
else
{
if (VALID_BACKEND(i))
break;
}
}
if (i == pool_config->backend_desc->num_backends)
i = -1;
return i;
}
/*
* backend connection error, failover/failback request, if possible
* failover() must be called under protecting signals.
*/
static void failover(void)
{
int i, j, k;
int node_id;
int new_master;
int new_primary;
int nodes[MAX_NUM_BACKENDS];
bool need_to_restart_children;
bool partial_restart;
int status;
int sts;
bool need_to_restart_pcp = false;
bool all_backend_down = true;
ereport(DEBUG1,
(errmsg("failover handler called")));
memset(nodes, 0, sizeof(int) * MAX_NUM_BACKENDS);
/*
* this could happen in a child process if a signal has been sent
* before resetting signal handler
*/
if (getpid() != mypid)
{
ereport(DEBUG1,
(errmsg("failover handler called"),
errdetail("I am not parent")));
kill(pcp_pid, SIGUSR2);
return;
}
/*
* processing SIGTERM, SIGINT or SIGQUIT
*/
if (exiting)
{
ereport(DEBUG1,
(errmsg("failover handler called while exiting")));
kill(pcp_pid, SIGUSR2);
return;
}
/*
* processing fail over or switch over
*/
if (switching)
{
ereport(DEBUG1,
(errmsg("failover handler called while switching")));
kill(pcp_pid, SIGUSR2);
return;
}
Req_info->switching = true;
switching = 1;
for(;;)
{
POOL_REQUEST_KIND reqkind;
int queue_index;
int node_id_set[MAX_NUM_BACKENDS];
int node_count;
unsigned char request_details;
WDFailoverCMDResults wdInterlockingRes;
pool_semaphore_lock(REQUEST_INFO_SEM);
if(Req_info->request_queue_tail == Req_info->request_queue_head) /* request queue is empty*/
{
switching = 0;
Req_info->switching = false;
pool_semaphore_unlock(REQUEST_INFO_SEM);
break;
}
/* make a local copy of request */
Req_info->request_queue_head++;
queue_index = Req_info->request_queue_head % MAX_REQUEST_QUEUE_SIZE;
memcpy(node_id_set, Req_info->request[queue_index].node_id , (sizeof(int) * Req_info->request[queue_index].count));
reqkind = Req_info->request[queue_index].kind;
request_details = Req_info->request[queue_index].request_details;
node_count = Req_info->request[queue_index].count;
pool_semaphore_unlock(REQUEST_INFO_SEM);
ereport(DEBUG1,
(errmsg("failover handler"),
errdetail("kind: %d flags: %x node_count: %d index:%d", reqkind, request_details, node_count, queue_index)));
if (reqkind == CLOSE_IDLE_REQUEST)
{
kill_all_children(SIGUSR1);
continue;
}
/* start watchdog interlocking */
wdInterlockingRes = wd_start_failover_interlocking();
/*
* if not in replication mode/master slave mode, we treat this a restart request.
* otherwise we need to check if we have already failovered.
*/
ereport(DEBUG1,
(errmsg("failover handler"),
errdetail("starting to select new master node")));
node_id = node_id_set[0];
/* failback request? */
if (reqkind == NODE_UP_REQUEST)
{
if (node_id < 0 || node_id >= MAX_NUM_BACKENDS ||
(reqkind == NODE_UP_REQUEST && !(RAW_MODE &&
BACKEND_INFO(node_id).backend_status == CON_DOWN) && VALID_BACKEND(node_id)) ||
(reqkind == NODE_DOWN_REQUEST && !VALID_BACKEND(node_id)))
{
if (node_id < 0 || node_id >= MAX_NUM_BACKENDS)
ereport(LOG,
(errmsg("invalid failback request, node id: %d is invalid. node id must be between [0 and %d]",node_id,MAX_NUM_BACKENDS)));
else
ereport(LOG,
(errmsg("invalid failback request, status: [%d] of node id : %d is invalid for failback",BACKEND_INFO(node_id).backend_status,node_id)));
if (wdInterlockingRes == FAILOVER_RES_I_AM_LOCK_HOLDER)
wd_end_failover_interlocking();
continue;
}
ereport(LOG,
(errmsg("starting fail back. reconnect host %s(%d)",
BACKEND_INFO(node_id).backend_hostname,
BACKEND_INFO(node_id).backend_port)));
/* Check to see if all backends are down */
for (i=0;i<NUM_BACKENDS;i++)
{
if (BACKEND_INFO(i).backend_status != CON_DOWN &&
BACKEND_INFO(i).backend_status != CON_UNUSED)
{
ereport(LOG,
(errmsg("Node %d is not down (status: %d)",
i, BACKEND_INFO(i).backend_status)));
all_backend_down = false;
break;
}
}
BACKEND_INFO(node_id).backend_status = CON_CONNECT_WAIT; /* unset down status */
(void)write_status_file();
/* Aquire failback start command lock */
if (wdInterlockingRes == FAILOVER_RES_I_AM_LOCK_HOLDER)
{
trigger_failover_command(node_id, pool_config->failback_command,
MASTER_NODE_ID, get_next_master_node(), PRIMARY_NODE_ID);
wd_failover_lock_release(FAILBACK_LOCK);
}
else
{
/*
* Okay we are not allowed to execute the failover command
* so we need to wait till the one who is executing the command
* finish with it.
*/
wd_wait_until_command_complete_or_timeout(FAILBACK_LOCK);
}
}
else if (reqkind == PROMOTE_NODE_REQUEST)
{
if (node_id != -1 && VALID_BACKEND(node_id))
{
ereport(LOG,
(errmsg("starting promotion. promote host %s(%d)",
BACKEND_INFO(node_id).backend_hostname,
BACKEND_INFO(node_id).backend_port)));
}
else
{
ereport(LOG,
(errmsg("failover: no backends are promoted")));
if (wdInterlockingRes == FAILOVER_RES_I_AM_LOCK_HOLDER)
wd_end_failover_interlocking();
continue;
}
}
else /* NODE_DOWN_REQUEST */
{
int cnt = 0;
for (i = 0; i < node_count; i++)
{
if (node_id_set[i] != -1 &&
((RAW_MODE && VALID_BACKEND_RAW(node_id_set[i])) ||
VALID_BACKEND(node_id_set[i])))
{
ereport(LOG,
(errmsg("starting degeneration. shutdown host %s(%d)",
BACKEND_INFO(node_id_set[i]).backend_hostname,
BACKEND_INFO(node_id_set[i]).backend_port)));
BACKEND_INFO(node_id_set[i]).backend_status = CON_DOWN; /* set down status */
(void)write_status_file();
/* save down node */
nodes[node_id_set[i]] = 1;
cnt++;
}
}
if (cnt == 0)
{
ereport(LOG,
(errmsg("failover: no backends are degenerated")));
if (wdInterlockingRes == FAILOVER_RES_I_AM_LOCK_HOLDER)
wd_end_failover_interlocking();
continue;
}
}
new_master = get_next_master_node();
if (new_master < 0)
{
ereport(LOG,
(errmsg("failover: no valid backends node found")));
}
ereport(DEBUG1, (errmsg("failover/failback request details: STREAM: %d reqkind: %d detail: %x node_id: %d",
STREAM, reqkind, request_details & REQ_DETAIL_SWITCHOVER,
node_id)));
/* On 2011/5/2 Tatsuo Ishii says: if mode is streaming replication
* and request is NODE_UP_REQUEST (failback case) we don't need to
* restart all children. Existing session will not use newly
* attached node, but load balanced node is not changed until this
* session ends, so it's harmless anyway.
*/
/*
* On 2015/9/21 Tatsuo Ishii says: this judgment is not sufficient if
* all backends were down. Child process has local status in which all
* backends are down. In this case even if new connection arrives from
* frontend, the child will not accept it because the local status
* shows all backends are down. For this purpose we refer to
* "all_backend_down" variable, which was set before updating backend status.
*
* See bug 248 for more details.
*/
if (STREAM && reqkind == NODE_UP_REQUEST && all_backend_down == false)
{
ereport(LOG,
(errmsg("Do not restart children because we are failbacking node id %d host: %s port: %d and we are in streaming replication mode and not all backends were down", node_id,
BACKEND_INFO(node_id).backend_hostname,
BACKEND_INFO(node_id).backend_port)));
need_to_restart_children = false;
partial_restart = false;
}
/*
* If the mode is streaming replication and the request is
* NODE_DOWN_REQUEST and it's actually a switch over request, we don't
* need to restart all children, except the node is primary.
*/
else if (STREAM && reqkind == NODE_DOWN_REQUEST &&
request_details & REQ_DETAIL_SWITCHOVER && node_id != PRIMARY_NODE_ID)
{
ereport(LOG,
(errmsg("Do not restart children because we are switching over node id %d host: %s port: %d and we are in streaming replication mode", node_id,
BACKEND_INFO(node_id).backend_hostname,
BACKEND_INFO(node_id).backend_port)));
need_to_restart_children = true;
partial_restart = true;
for (i = 0; i < pool_config->num_init_children; i++)
{
bool restart = false;
for (j=0;j<pool_config->max_pool;j++)
{
for (k=0;k<NUM_BACKENDS;k++)
{
ConnectionInfo *con = pool_coninfo(i, j, k);
if (con->connected && con->load_balancing_node == node_id)
{
ereport(LOG,
(errmsg("child pid %d needs to restart because pool %d uses backend %d",
process_info[i].pid, j, node_id)));
restart = true;
break;
}
}
}
if (restart)
{
pid_t pid = process_info[i].pid;
if (pid)
{
kill(pid, SIGQUIT);
ereport(DEBUG1,
(errmsg("failover handler"),
errdetail("kill process with PID:%d", pid)));
}
}
}
}
else
{
ereport(LOG,
(errmsg("Restart all children")));
/* kill all children */
for (i = 0; i < pool_config->num_init_children; i++)
{
pid_t pid = process_info[i].pid;
if (pid)
{
kill(pid, SIGQUIT);
ereport(DEBUG1,
(errmsg("failover handler"),
errdetail("kill process with PID:%d", pid)));
}
}
need_to_restart_children = true;
partial_restart = false;
}
if (wdInterlockingRes == FAILOVER_RES_I_AM_LOCK_HOLDER)
{
/* Exec failover_command if needed */
for (i = 0; i < pool_config->backend_desc->num_backends; i++)
{
if (nodes[i])
trigger_failover_command(i, pool_config->failover_command,
MASTER_NODE_ID, new_master, PRIMARY_NODE_ID);
}
wd_failover_lock_release(FAILOVER_LOCK);
}
else
{
wd_wait_until_command_complete_or_timeout(FAILOVER_LOCK);
}
/* no need to wait since it will be done in reap_handler */
#ifdef NOT_USED
while (wait(NULL) > 0)
;
if (errno != ECHILD)
ereport(LOG,
(errmsg("failover_handler: wait() failed. reason:%s", strerror(errno))));
#endif
if (reqkind == PROMOTE_NODE_REQUEST && VALID_BACKEND(node_id))
new_primary = node_id;
/*
* If the down node was a standby node in streaming replication
* mode, we can avoid calling find_primary_node_repeatedly() and
* recognize the former primary as the new primary node, which
* will reduce the time to process standby down.
*/
else if (MASTER_SLAVE && pool_config->master_slave_sub_mode == STREAM_MODE &&
reqkind == NODE_DOWN_REQUEST)
{
if (Req_info->primary_node_id != node_id)
new_primary = Req_info->primary_node_id;
else
new_primary = find_primary_node_repeatedly();
}
else
new_primary = find_primary_node_repeatedly();
/*
* If follow_master_command is provided and in master/slave
* streaming replication mode, we start degenerating all backends
* as they are not replicated anymore.
*/
int follow_cnt = 0;
if (MASTER_SLAVE && pool_config->master_slave_sub_mode == STREAM_MODE)
{
if (*pool_config->follow_master_command != '\0' ||
reqkind == PROMOTE_NODE_REQUEST)
{
/* only if the failover is against the current primary */
if (((reqkind == NODE_DOWN_REQUEST) &&
(nodes[Req_info->primary_node_id])) ||
((reqkind == PROMOTE_NODE_REQUEST) &&
(VALID_BACKEND(node_id))))
{
for (i = 0; i < pool_config->backend_desc->num_backends; i++)
{
/* do not degenerate the new primary */
if ((new_primary >= 0) && (i != new_primary)) {
BackendInfo *bkinfo;
bkinfo = pool_get_node_info(i);
ereport(LOG,
(errmsg("starting follow degeneration. shutdown host %s(%d)",
bkinfo->backend_hostname,
bkinfo->backend_port)));
bkinfo->backend_status = CON_DOWN; /* set down status */
(void)write_status_file();
follow_cnt++;
}
}
if (follow_cnt == 0)
{
ereport(LOG,
(errmsg("failover: no follow backends are degenerated")));
}
else
{
/* update new master node */
new_master = get_next_master_node();
ereport(LOG,
(errmsg("failover: %d follow backends have been degenerated", follow_cnt)));
}
}
}
}
/*
* follow master command also uses the same locks used by trigring command
*/
if (wdInterlockingRes == FAILOVER_RES_I_AM_LOCK_HOLDER)
{
if ((follow_cnt > 0) && (*pool_config->follow_master_command != '\0'))
{
follow_pid = fork_follow_child(Req_info->master_node_id, new_primary,
Req_info->primary_node_id);
}
wd_failover_lock_release(FOLLOW_MASTER_LOCK);
}
else
{
wd_wait_until_command_complete_or_timeout(FOLLOW_MASTER_LOCK);
}
/* Save primary node id */
Req_info->primary_node_id = new_primary;
ereport(LOG,
(errmsg("failover: set new primary node: %d", Req_info->primary_node_id)));
if (new_master >= 0)
{
Req_info->master_node_id = new_master;
ereport(LOG,
(errmsg("failover: set new master node: %d", Req_info->master_node_id)));
}
/* Kill children and restart them if needed */
if (need_to_restart_children)
{
for (i=0;i<pool_config->num_init_children;i++)
{
/*
* Try to kill pgpool child because previous kill signal
* may not be received by pgpool child. This could happen
* if multiple PostgreSQL are going down (or even starting
* pgpool, without starting PostgreSQL can trigger this).
* Child calls degenerate_backend() and it tries to aquire
* semaphore to write a failover request. In this case the
* signal mask is set as well, thus signals are never
* received.
*/
bool restart = false;
if (partial_restart)
{
for (j=0;j<pool_config->max_pool;j++)
{
for (k=0;k<NUM_BACKENDS;k++)
{
ConnectionInfo *con = pool_coninfo(i, j, k);
if (con->connected && con->load_balancing_node == node_id)
{
ereport(LOG,
(errmsg("child pid %d needs to restart because pool %d uses backend %d",
process_info[i].pid, j, node_id)));
restart = true;
break;
}
}
}
}
else
restart = true;
if (restart)
{
if (process_info[i].pid)
{
kill(process_info[i].pid, SIGQUIT);
process_info[i].pid = fork_a_child(fds, i);
process_info[i].start_time = time(NULL);
}
}
else
process_info[i].need_to_restart = 1;
}
}
else
{
/* Set restart request to each child. Children will exit(1)
* whenever they are convenient.
*/
for (i=0;i<pool_config->num_init_children;i++)
{
process_info[i].need_to_restart = 1;
}
}
/*
* Send restart request to worker child.
*/
kill(worker_pid, SIGUSR1);
if (wdInterlockingRes == FAILOVER_RES_I_AM_LOCK_HOLDER)
wd_end_failover_interlocking();
if (reqkind == NODE_UP_REQUEST)
{
ereport(LOG,
(errmsg("failback done. reconnect host %s(%d)",
BACKEND_INFO(node_id).backend_hostname,
BACKEND_INFO(node_id).backend_port)));
}
else if (reqkind == PROMOTE_NODE_REQUEST)
{
ereport(LOG,
(errmsg("promotion done. promoted host %s(%d)",
BACKEND_INFO(node_id).backend_hostname,
BACKEND_INFO(node_id).backend_port)));
}
else
{
/* Temporary black magic. Without this regression 055 does not finish */
fprintf(stderr, "failover done. shutdown host %s(%d)",
BACKEND_INFO(node_id).backend_hostname,
BACKEND_INFO(node_id).backend_port);
ereport(LOG,
(errmsg("failover done. shutdown host %s(%d)",
BACKEND_INFO(node_id).backend_hostname,
BACKEND_INFO(node_id).backend_port)));
}
need_to_restart_pcp = true;
}
switching = 0;
Req_info->switching = false;
/* kick wakeup_handler in pcp_child to notice that
* failover/failback done
*/
kill(pcp_pid, SIGUSR2);
if(need_to_restart_pcp)
{
sleep(1);
/*
* Send restart request to pcp child.
*/
kill(pcp_pid, SIGUSR1);
for (;;)
{
sts = waitpid(pcp_pid, &status, 0);
if (sts != -1)
break;
if (sts == -1)
{
if (errno == EINTR)
continue;
else
{
ereport(WARNING,
(errmsg("failover: waitpid failed. reason: %s", strerror(errno))));
continue;
}
}
}
if (WIFSIGNALED(status))
ereport(LOG,
(errmsg("PCP child %d exits with status %d by signal %d in failover()", pcp_pid, status, WTERMSIG(status))));
else
ereport(LOG,
(errmsg("PCP child %d exits with status %d in failover()", pcp_pid, status)));
pcp_pid = pcp_fork_a_child(pcp_unix_fd, pcp_inet_fd, pcp_conf_file);
ereport(LOG,
(errmsg("fork a new PCP child pid %d in failover()", pcp_pid)));
}
}
pgpool-II在故障切换过程中是如何选举新主节点的的更多相关文章
- 为Secure Store Service生成新密钥,解决“生成密钥过程中发现错误”的问题
我们集成TFS和SharePoint Server以后,一个最常见的需求是通过SharePoint Server的Excel Service读取TFS报表中的信息,利用Excel Service的强大 ...
- ESXi与物理交换机静态链路聚合配置过程中的小陷阱
作者:陆斌文章来自微信公众号:平台人生 内容简介:ESXi与物理交换机之间配置静态链路聚合时,因为静态链路聚合的特点,在进行down网卡和从虚拟交换机移除网卡的操作时,可能会无法完成故障流量切换,影响 ...
- [简单-剑指 Offer 53 - II. 0~n-1中缺失的数字]
[简单-剑指 Offer 53 - II. 0-n-1中缺失的数字] 一个长度为n-1的递增排序数组中的所有数字都是唯一的,并且每个数字都在范围0-n-1之内.在范围0-n-1内的n个数字中有且只有一 ...
- WINDOWS系统下MYSQL安装过程中的注意事项
1.首先MySQL的安装方式有两种:一种是MSI安装方式,很简单就像安装Windows软件一样.另外一种就是ZIP安装方式.这种相对而言比较麻烦.新手推荐MSI安装方式. 安装方式有以下两种: MSI ...
- 【转】SQL Server -- 已成功与服务器建立连接,但是在登录过程中发生错误
SQL Server -- 已成功与服务器建立连接,但是在登录过程中发生错误 最近在VS2013上连接远程数据库时,突然连接不上,在跑MSTest下跑的时候,QTAgent32 crash.换成IIS ...
- zabbix 3.0.3 (nginx)安装过程中的问题排错记录
特殊注明:安装zabbix 2.4.8和2.4.6遇到2个问题,如下:找了很多解决办法,实在无解,只能换版本,尝试换(2.2.2正常 | 3.0.3正常)都正常,最后决定换3.0.3 1.Error ...
- C语言调试过程中duplicate symbol错误分析
说明:在我们调试C语言的过程中,经常会遇到duplicate symbol错误(在Mac平台下利用Xcode集成开发环境).如下图: 一.简单分析一下C语言程序的开发步骤. 由上图我们可以看出C语言由 ...
- 测试或运维工作过程中最常用的几个linux命令?
大家在测试工作过程中,可能会遇到需要你去服务器修改一些配置文件,譬如说某个字段的值是1 则关联老版本,是0则关联新版本,这时候你可能就需要会下vi的命令操作:或者查看session设置的时长,可能需 ...
- Atomikos的使用过程中要注意的事
在使用Atomikos过程中遇到的一些问题,以作记录: MySQL does not support TMJOIN MySQL does not allow for joining an existi ...
随机推荐
- 将maven项目中依赖的jar包导出到指定的目录
<plugin> <artifactId>maven-dependency-plugin</artifactId> <configuration> &l ...
- PHP验证器类Validator
Particle\Validator是一个小巧优雅的实用的PHP验证类库,提供了一个非常简洁的API.它无需依赖其他组件,提供友好的文档,并且有利于扩展. 安装 composer require pa ...
- MFC+OpenGL可编程管线
[github链接] 网上的代码大都是固定管线渲染的,今天下午整理了下,把setPixelFormat.初始化glew.创建GL 4,2 context等操作封装到一个MFC类OpenGLWidget ...
- Unity 指定区域随机实例化预制体Prefab 代码
using UnityEngine; public class NewBehaviourScript : MonoBehaviour { public GameObject prefab; void ...
- Spring Boot 20170913
SpringBoot 是做微服务的,比如只用来发邮件,只用来上载文件等等.优点是开发极其简单,约定大于俗成,缺点是不适合小型项目.通常用来分解大型项目,做成多个微服务. 参考: http://www. ...
- 关于背景颜色、TEXT、<b>、<i>、<u>、<br>、< >、<br>、<br>、h1-h6、<span>、<div>、<ol>、<ul>、<a>标签的用法(下载、跳转、锚点)、Img插入的用法
<html> <head> <meta charset="UTF-8"> <title></ ...
- HDU1027 Ignatius and the Princess II( 逆康托展开 )
链接:传送门 题意:给出一个 n ,求 1 - n 全排列的第 m 个排列情况 思路:经典逆康托展开,需要注意的时要在原来逆康托展开的模板上改动一些地方. 分析:已知 1 <= M <= ...
- [读书笔记] R语言实战 (二) 创建数据集
R中的数据结构:标量,向量,数组,数据框,列表 1. 向量:储存数值型,字符型,或者逻辑型数据的一维数组,用c()创建 ** R中没有标量,标量以单元素向量的形式出现 2. 矩阵:二维数组,和向量一 ...
- 大数据相关文档&Api下载
IT相关文档&Api下载(不断更新中) 下载地址:https://download.csdn.net/user/qq_42797237/uploads 如有没有你需要的API,可和我留言,留下 ...
- vue 过滤器使用的传参说明
在table中,需要对obj的数据类型进行文字转换,例如后台接口返回的姓别值:1,2.其中需要页面根据字典需要把1=>男,2=>女进行转换. 以前的习惯是每一个过滤方法都写一个方法进行转换 ...