Changeset 8937

Show
Ignore:
Timestamp:
07/12/11 15:09:48 (23 months ago)
Author:
bligon
Message:

Updated 3-way logic to use new UUID functions.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/orange-next/src/server/create-immutable-copies.sm

    r8935 r8937  
    2424 
    2525/*all bits turned on*/ 
    26 static uint64_t UINT64_HIGH = 0xffffffffffffffffULL;  
     26//static uint64_t UINT64_HIGH = 0xffffffffffffffffULL;  
     27static const uuid_t UUID_INIT; 
     28PVFS_handle_generate(UUID_INIT); 
    2729 
    2830/*attribute keys used for the mirroring process*/ 
     
    228230   } 
    229231 
    230    gossip_debug(GOSSIP_MIRROR_DEBUG,"\tdfile_count: %d\tmetadata_handle: %llu" 
     232   memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LENGTH); 
     233   PVFS_handle_unparse(imm_p->metadata_handle,PVFS_handle_string); 
     234   gossip_debug(GOSSIP_MIRROR_DEBUG,"\tdfile_count: %d\tmetadata_handle: %s" 
    231235                                    "\tfs_id: %u" 
    232236                                    "\tio_servers_count: %d\n" 
    233237                                   ,imm_p->dfile_count 
    234                                    ,llu(imm_p->metadata_handle) 
     238                                   ,PVFS_handle_string 
    235239                                   ,imm_p->fs_id 
    236240                                   ,imm_p->io_servers_count ); 
     
    583587         goto error_exit; 
    584588      } 
     589      memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LENGTH); 
     590      PVFS_handle_unparse(imm_p->handle_array_base[i],PVFS_handle_string); 
    585591      gossip_debug(GOSSIP_MIRROR_DEBUG,"\tValue of server_name is %s " 
    586                                        "for handle %llu\n" 
     592                                       "for handle %s\n" 
    587593                                      ,imm_p->io_servers[i] 
    588                                       ,llu(imm_p->handle_array_base[i])); 
     594                                      ,PVFS_handle_string); 
    589595   }/*end for*/ 
    590596 
     
    633639 
    634640            imm_p->handle_array_base_local_count++; 
    635             gossip_debug(GOSSIP_MIRROR_DEBUG,"\tlocal source handle(%d):%llu\n" 
     641            PVFS_handle_unparse(imm_p->handle_array_base_local[imm_p->handle_array_base_local_count 
     642                               ,PVFS_handle_string); 
     643            gossip_debug(GOSSIP_MIRROR_DEBUG,"\tlocal source handle(%d):%s\n" 
    636644              ,imm_p->handle_array_base_local_count 
    637     ,llu(imm_p->handle_array_base_local[imm_p->handle_array_base_local_count])); 
     645              ,PVFS_handle_string); 
    638646         } 
    639647 
     
    10571065      return SM_ACTION_COMPLETE; 
    10581066   } 
    1059    memset(imm_p->writes_completed,UINT64_HIGH,sizeof(PVFS_handle)  
    1060                                             * imm_p->dfile_count 
    1061                                             * imm_p->copies); 
     1067   for (i=0; i<(imm_p->dfile_count * imm_p->copies); i++) 
     1068       PVFS_handle_copy(imm_p->writes_completed[i],UUID_INIT); 
     1069   //memset(imm_p->writes_completed,UINT64_HIGH,sizeof(PVFS_handle)  
     1070   //                                         * imm_p->dfile_count 
     1071   //                                         * imm_p->copies); 
    10621072 
    10631073   /*the retry count is used to monitor how many times we retry a write. */ 
     
    10801090   int src,row,cols,i,index,wc; 
    10811091 
     1092   char PVFS_handle_string[PVFS_HANDLE_STRING_LEN]; 
     1093 
    10821094   /*this variable helps to understand the logic better.  it is a redeclara- */ 
    10831095   /*tion of the one dimensional imm_p->handle_array_copies and can be ac-   */ 
     
    10941106   { 
    10951107       for (cols=0; cols<imm_p->io_servers_required; cols++) 
     1108       { 
     1109        memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LEN); 
     1110        PVFS_handle_unparse(handle_array_copies[row][cols],PVFS_handle_string); 
    10961111        gossip_debug(GOSSIP_MIRROR_DEBUG,"\t\thandle_array_copies[%d][%d] : " 
    1097                                          "%llu\n" 
     1112                                         "%sn" 
    10981113                                        ,row,cols 
    1099                                         ,llu(handle_array_copies[row][cols])); 
     1114                                        ,PVFS_handle_string); 
     1115       } 
    11001116   } 
    11011117 
     
    11171133           /* cleanup and fix */ 
    11181134           /*this will capture UINT64_HIGH or handle*/ 
    1119 /* 
    1120            if (   imm_p->writes_completed[index] > 0 
    1121                    || imm_p->writes_completed[index] == UINT64_HIGH) 
     1135           if (     (PVFS_handle_compare(imm_p->writes_completed[index],UUID_INIT) == 0) 
     1136                || !(PVFS_handle_is_null(imm_p->writes_completed[index])  ) 
     1137           //if (   imm_p->writes_completed[index] > 0 
     1138           //        || imm_p->writes_completed[index] == UINT64_HIGH) 
    11221139              break; 
    1123  */ 
    11241140       } 
    11251141 
     
    11771193       index = imm_p->copies*src; /*first copy for this source*/ 
    11781194        
    1179        /* cleanup and fix 
    1180        if (imm_p->writes_completed[index] == UINT64_HIGH) 
    1181         */ 
    1182        if( 1 ) 
     1195       //if (imm_p->writes_completed[index] == UINT64_HIGH) 
     1196        if ( PVFS_handle_compare(imm_p->writes_completed[index],UUID_INIT) == 0 ) 
    11831197       { 
    11841198          /*handle_array_copies[copy,server#] is accessed as a two-dimensional*/ 
     
    12011215          { 
    12021216              index = (imm_p->copies*row) + cols; 
    1203               if (imm_p->writes_completed[index] > 0) 
     1217              //if (imm_p->writes_completed[index] > 0) 
     1218               if ( !PVFS_handle_is_null(imm_p->writes_completed[index]) ) 
    12041219              { 
    12051220                 PVFS_handle_copy(req->u.mirror.dst_handle[i], 
     
    12161231       req->u.mirror.encoding      = fs->encoding; 
    12171232 
    1218        gossip_debug(GOSSIP_MIRROR_DEBUG,"\treq->: src:%llu\tfs_id:%d" 
     1233       memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LEN); 
     1234       PVFS_handle_unparse(req->u.mirror.src_handle,PVFS_handle_string); 
     1235       gossip_debug(GOSSIP_MIRROR_DEBUG,"\treq->: src:%s\tfs_id:%d" 
    12191236                                        "\tdist name:%s\tsrc server_nr:%d\n" 
    1220                                        ,llu(req->u.mirror.src_handle) 
     1237                                       ,PVFS_handle_string 
    12211238                                       ,req->u.mirror.fs_id 
    12221239                                       ,req->u.mirror.dist->dist_name 
    12231240                                       ,req->u.mirror.src_server_nr ); 
    12241241       for (i=0; i<req->u.mirror.dst_count; i++) 
    1225            gossip_debug(GOSSIP_MIRROR_DEBUG,"\treq->dst_handle[%d] : %llu\n" 
     1242       { 
     1243           memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LEN); 
     1244           PVFS_handle_unparse(req->u.mirror.dst_handle[i],PVFS_handle_string); 
     1245           gossip_debug(GOSSIP_MIRROR_DEBUG,"\treq->dst_handle[%d] : %s\n" 
    12261246                                           ,i 
    1227                                            ,llu(req->u.mirror.dst_handle[i])); 
    1228  
     1247                                           ,PVFS_handle_string); 
     1248       } 
    12291249       struct PINT_server_op *mirror_op =  
    12301250                              malloc(sizeof(struct PINT_server_op)); 
     
    12931313          } 
    12941314 
     1315          memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LEN); 
     1316          PVFS_handle_unparse(msg_p->handle,PVFS_handle_string); 
    12951317          gossip_debug(GOSSIP_MIRROR_DEBUG,"\tmsg_p->req.op:%d" 
    12961318                                           "\tmsg_p->fs_id:%d" 
    1297                                            "\tmsg_p->handle:%llu\n" 
     1319                                           "\tmsg_p->handle:%s\n" 
    12981320                                           ,msg_p->req.op 
    12991321                                           ,msg_p->fs_id 
    1300                                            ,llu(msg_p->handle) ); 
     1322                                           ,PVFS_handle_string ); 
    13011323 
    13021324          PINT_sm_push_frame(smcb, REMOTE_SRC, mirror_op); 
     
    13211343   struct PVFS_servresp_mirror *respmir   = NULL; 
    13221344   struct PVFS_servreq_mirror  *reqmir    = NULL;    
     1345   char PVFS_handle_string[PVFS_HANDLE_STRING_LEN] = {0}; 
    13231346 
    13241347   gossip_debug(GOSSIP_MIRROR_DEBUG,"\tjs_p->error_code:%d\n" 
     
    13471370                                       ,error_code,error_code 
    13481371                                       ,remaining); 
    1349        gossip_debug(GOSSIP_MIRROR_DEBUG,"\tresp.src_handle:%llu " 
     1372       memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LEN); 
     1373       PVFS_handle_unparse(respmir->src_handle,PVFS_handle_string); 
     1374       gossip_debug(GOSSIP_MIRROR_DEBUG,"\tresp.src_handle:%s " 
    13501375                                        "\tresp.src_server_nr:%d\n" 
    1351                                    ,llu(respmir->src_handle) 
    1352                                    ,respmir->src_server_nr ); 
     1376                                       ,PVFS_handle_string 
     1377                                       ,respmir->src_server_nr ); 
    13531378       for (i=0; i<respmir->dst_count; i++) 
    13541379       { 
     
    14041429               && respmir->write_status_code[i] == 0) 
    14051430           { 
    1406                 /* cleanup and fix 
    1407                imm_p->writes_completed[index] = 0; 
    1408                  */ 
    1409                assert(0); 
     1431               //imm_p->writes_completed[index] = 0; 
     1432               PVFS_handle_clear(imm_p->writes_completed[index]); 
    14101433           } else if (error_code == 0) 
    14111434           { 
     
    14141437           } else 
    14151438           { 
    1416                 /* cleanup and fix  
    1417                imm_p->writes_completed[index] = UINT64_HIGH; 
    1418                  */ 
    1419                assert(0); 
     1439               //imm_p->writes_completed[index] = UINT64_HIGH; 
     1440               PVFS_handle_copy(imm_p->writes_completed[index],UUID_INIT); 
    14201441           }  
    14211442       } 
     
    14681489     { 
    14691490       index = (imm_p->dfile_count * i) + j; 
    1470        gossip_debug(GOSSIP_MIRROR_DEBUG,"\t\t[%d][%d]:%llu\n" 
     1491       char PVFS_handle_string[PVFS_HANDLE_STRING_LEN]; 
     1492       uuid_unparse(imm_p->writes_completed[index],PVFS_handle_string); 
     1493       gossip_debug(GOSSIP_MIRROR_DEBUG,"\t\t[%d][%d]:%s\n" 
    14711494                                       ,i,j 
    1472                                        ,llu(imm_p->writes_completed[index])); 
     1495                                       ,PVFS_handle_string); 
     1496       //gossip_debug(GOSSIP_MIRROR_DEBUG,"\t\t[%d][%d]:%llu\n" 
     1497       //                                ,i,j 
     1498       //                                ,llu(imm_p->writes_completed[index])); 
    14731499     } 
    14741500   } 
     
    14981524   for (i=0; i<(imm_p->dfile_count * imm_p->copies); i++) 
    14991525   { 
    1500        gossip_debug(GOSSIP_MIRROR_DEBUG,"\twrites_complete[%d]:%llu\n" 
    1501                                        ,i,llu(imm_p->writes_completed[i])); 
    1502        if (imm_p->writes_completed[i] != 0) 
     1526       char PVFS_handle_string[PVFS_handle_string_len] = {0}; 
     1527       PVFS_handle_unparse(imm_p->writes_completed[i],PVFS_handle_string); 
     1528       gossip_debug(GOSSIP_MIRROR_DEBUG,"\twrites_complete[%d]:%s\n" 
     1529                                       ,i,PVFS_handle_string); 
     1530       //if (imm_p->writes_completed[i] != 0) 
     1531        if ( !PVFS_handle_is_null(imm_p->writes_completed[i]) ) 
    15031532       { 
    15041533          js_p->error_code = RETRY; 
     
    15991628                                   ,sm_p->key_a[i].buffer_sz); 
    16001629   PVFS_handle *myHandle = (PVFS_handle *)sm_p->val_a[i].buffer; 
     1630   char PVFS_handle_string[PVFS_HANDLE_STRING_LEN]; 
    16011631   for (j=0; j<(imm_p->dfile_count*imm_p->copies); j++) 
    16021632   { 
    1603        gossip_debug(GOSSIP_MIRROR_DEBUG,"\t\thandle(%d):%llu\n" 
     1633       memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LEN); 
     1634       PVFS_handle_unparse(myHandle[j],PVFS_handle_string); 
     1635       gossip_debug(GOSSIP_MIRROR_DEBUG,"\t\thandle(%d):%s\n" 
    16041636       ,j 
    1605        ,llu(myHandle[j])); 
     1637       ,PVFS_handle_string); 
    16061638   } 
    16071639 
     
    16201652   for (j=0; j<(imm_p->dfile_count * imm_p->copies); j++) 
    16211653   { 
    1622        gossip_debug(GOSSIP_MIRROR_DEBUG,"\thandle(%d):status(%llu)\n" 
     1654       memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LEN); 
     1655       PVFS_handle_unparse(myStatus[j],PVFS_handle_string); 
     1656       gossip_debug(GOSSIP_MIRROR_DEBUG,"\thandle(%d):status(%s)\n" 
    16231657                                       ,j 
    1624                                        ,llu(myStatus[j])); 
     1658                                       ,PVFS_handle_string); 
    16251659   } 
    16261660 
     
    16491683   { 
    16501684       PVFS_handle *myHandle = (PVFS_handle *)sm_p->val_a[i].buffer; 
    1651        gossip_debug(GOSSIP_MIRROR_DEBUG,"\t\thandle(%d):%llu\n" 
     1685       memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LEN); 
     1686       PVFS_handle_unparse(myHandle[j],PVFS_handle_string); 
     1687       gossip_debug(GOSSIP_MIRROR_DEBUG,"\t\thandle(%d):%s\n" 
    16521688       ,j 
    1653        ,llu(myHandle[j])); 
     1689       ,PVFS_handle_string); 
    16541690   } 
    16551691 
     
    17011737   if (js_p->error_code) 
    17021738   { 
     1739      memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LENGTH); 
     1740      PVFS_handle_unparse(imm_p->metadata_handle); 
    17031741      gossip_err("Unable to store datahandles and number of copies for this " 
    17041742                 "mirror operation.\n"); 
    1705       gossip_err("\tMeta data handle is %llu\n",llu(imm_p->metadata_handle)); 
     1743      gossip_err("\tMeta data handle is %s\n",PVFS_handle_string); 
    17061744      return SM_ACTION_COMPLETE; 
    17071745   } 
     
    19261964      return(resp_p->status); 
    19271965 
    1928    gossip_debug(GOSSIP_MIRROR_DEBUG,"\tresp->src_handle:%llu " 
     1966   memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LEN); 
     1967   PVFS_handle_unparse(resp_p->u.mirror.src_handle,PVFS_handle_string); 
     1968   gossip_debug(GOSSIP_MIRROR_DEBUG,"\tresp->src_handle:%s " 
    19291969                                    "\tresp->src_server_nr:%d " 
    19301970                                    "\tresp->status:%d\n" 
    1931                                    ,llu(resp_p->u.mirror.src_handle) 
     1971                                   ,PVFS_handle_string 
    19321972                                   ,resp_p->u.mirror.src_server_nr 
    19331973                                   ,resp_p->status ); 
     
    20062046   for (i=0; i<(in_cols*rows); i++) 
    20072047   { 
    2008        gossip_debug(GOSSIP_MIRROR_DEBUG,"\thandle_array_copies(%d):%llu\n" 
     2048       memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LEN); 
     2049       PVFS_unparse(copies_in[i],PVFS_handle_string); 
     2050       gossip_debug(GOSSIP_MIRROR_DEBUG,"\thandle_array_copies(%d):%s\n" 
    20092051                                       ,(int)i 
    2010                                        ,llu(copies_in[i])); 
     2052                                       ,PVFS_handle_string); 
    20112053   } 
    20122054 
     
    20282070       for (j=0; j<out_cols; j++) 
    20292071       { 
    2030            gossip_debug(GOSSIP_MIRROR_DEBUG,"\t\t(%d,%d):%llu\n" 
     2072           memset(PVFS_handle_string,0,PVFS_HANDLE_STRING_LENGTH); 
     2073           PVFS_handle_unparse(copies_out[(i*out_cols)+j],PVFS_handle_string); 
     2074           gossip_debug(GOSSIP_MIRROR_DEBUG,"\t\t(%d,%d):%s\n" 
    20312075                                ,(int)i,(int)j 
    2032                                 ,llu(copies_out[(i*out_cols)+j])); 
     2076                                ,PVFS_handle_string); 
    20332077       } 
    20342078   }