Skip to content

Commit

Permalink
some bugfix. 1. 修复自定义文件一些操作递归创建父目录时如果创建两级以上父目录会将原来的行为变成创建目录的bug. 2. 修…
Browse files Browse the repository at this point in the history
…复在初次并发处理自定义文件名的请求时可能在连接rootserver时core的bug. 3. 增加一些错误日志. 4. 读小文件时若远程block cache命中时没有设置某个状态位,导致如果远程block cache是脏cache的时候不会重试从ns获取block info.
  • Loading branch information
zhcn381 committed Jan 14, 2013
1 parent edde495 commit 38beb2f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
16 changes: 13 additions & 3 deletions src/ngx_http_tfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1901,9 +1901,6 @@ ngx_http_tfs_misc_ctx_init(ngx_http_tfs_t *t, ngx_http_tfs_rcs_info_t *rc_info)
/* update root server & meta table */
t->loc_conf->meta_root_server = rc_info->meta_root_server;
t->loc_conf->meta_server_table.version = 0;
ngx_http_tfs_peer_set_addr(t->pool,
&t->tfs_peer_servers[NGX_HTTP_TFS_ROOT_SERVER],
(ngx_http_tfs_inet_t *)&rc_info->meta_root_server);
}

/* next => root server */
Expand All @@ -1920,6 +1917,11 @@ ngx_http_tfs_misc_ctx_init(ngx_http_tfs_t *t, ngx_http_tfs_rcs_info_t *rc_info)

ngx_http_tfs_peer_set_addr(t->pool,
&t->tfs_peer_servers[NGX_HTTP_TFS_META_SERVER], addr);

} else {
ngx_http_tfs_peer_set_addr(t->pool,
&t->tfs_peer_servers[NGX_HTTP_TFS_ROOT_SERVER],
(ngx_http_tfs_inet_t *)&rc_info->meta_root_server);
}
}

Expand Down Expand Up @@ -2052,6 +2054,8 @@ ngx_http_tfs_batch_process_start(ngx_http_tfs_t *t)
for (i = 0; i < block_count; i++) {
st = ngx_http_tfs_alloc_st(t);
if (st == NULL) {
ngx_log_error(NGX_LOG_ERR, t->log, 0,
"alloc st[%uD] failed.", i);
return NGX_ERROR;
}

Expand Down Expand Up @@ -2103,6 +2107,8 @@ ngx_http_tfs_batch_process_start(ngx_http_tfs_t *t)
/* select data server */
addr = ngx_http_tfs_select_data_server(st, st->file.segment_data);
if (addr == NULL) {
ngx_log_error(NGX_LOG_ERR, t->log, 0,
"st[%uD] select data server failed.", i);
return NGX_ERROR;
}

Expand All @@ -2115,11 +2121,15 @@ ngx_http_tfs_batch_process_start(ngx_http_tfs_t *t)
data_server->peer_addr_text);

if (ngx_http_tfs_reinit(t->data, st) != NGX_OK) {
ngx_log_error(NGX_LOG_ERR, t->log, 0,
"st[%uD] reinit failed.", i);
return NGX_ERROR;
}

st->tfs_peer = ngx_http_tfs_select_peer(st);
if (st->tfs_peer == NULL) {
ngx_log_error(NGX_LOG_ERR, t->log, 0,
"st[%uD] select peer failed.", i);
return NGX_ERROR;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ngx_http_tfs_rc_server_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,9 @@ ngx_http_tfs_parse_rc_info(ngx_http_tfs_rcs_info_t *rc_info_node,
}
ngx_memcpy(physical_cluster->cluster_id_text.data, p,
physical_cluster->cluster_id_text.len);
p += physical_cluster->cluster_id_text.len + 1;
/* this cluster id need get from ns */
physical_cluster->cluster_id = 0;
p += physical_cluster->cluster_id_text.len + 1;

/* name server vip */
len = *((uint32_t *) p);
Expand Down
1 change: 1 addition & 0 deletions src/ngx_http_tfs_remote_block_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ ngx_http_tfs_remote_block_cache_get_handler(ngx_http_tair_key_value_t *kv,
t->state += 1;

segment_data->cache_hit = NGX_HTTP_TFS_REMOTE_BLOCK_CACHE;
segment_data->block_info_src = NGX_HTTP_TFS_FROM_CACHE;

/* select data server */
addr = ngx_http_tfs_select_data_server(t, segment_data);
Expand Down
4 changes: 2 additions & 2 deletions src/ngx_http_tfs_server_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ ngx_http_tfs_process_ms(ngx_http_tfs_t *t)
}
t->last_dir_level = 0;
t->dir_lens[0] = t->last_file_path.len;
t->orig_action = t->r_ctx.action.code;

} else {
parent_dir_len = ngx_http_tfs_get_parent_dir(&t->last_file_path,
Expand All @@ -150,7 +151,6 @@ ngx_http_tfs_process_ms(ngx_http_tfs_t *t)
t->last_dir_level++;
t->dir_lens[t->last_dir_level] = parent_dir_len;
t->last_file_path.len = t->dir_lens[t->last_dir_level];
t->orig_action = t->r_ctx.action.code;
/* temporarily modify */
t->r_ctx.action.code = NGX_HTTP_TFS_ACTION_CREATE_DIR;
return NGX_OK;
Expand Down Expand Up @@ -778,7 +778,7 @@ ngx_http_tfs_reset_segment_data(ngx_http_tfs_t *t)
segment_data = &t->file.segment_data[t->file.segment_index];
for (i = 0; i < block_count; i++, segment_data++) {
segment_data->cache_hit = NGX_HTTP_TFS_NO_BLOCK_CACHE;
segment_data->block_info_src = NGX_HTTP_TFS_FROM_CACHE;
segment_data->block_info_src = NGX_HTTP_TFS_FROM_NONE;
segment_data->block_info.ds_addrs = NULL;
segment_data->ds_retry = 0;
segment_data->ds_index = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/ngx_tfs_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,8 @@ ngx_http_tfs_alloc_st(ngx_http_tfs_t *t)
ngx_memcpy(&st->tfs_peer_servers[NGX_HTTP_TFS_DATA_SERVER],
&t->tfs_peer_servers[NGX_HTTP_TFS_DATA_SERVER],
sizeof(ngx_http_tfs_peer_connection_t));
st->tfs_peer_servers[NGX_HTTP_TFS_DATA_SERVER].peer.connection = NULL;

b = &st->tfs_peer_servers[NGX_HTTP_TFS_DATA_SERVER].body_buffer;
if (t->r_ctx.action.code == NGX_HTTP_TFS_ACTION_WRITE_FILE) {
b->start = NULL;
Expand Down

0 comments on commit 38beb2f

Please sign in to comment.