Changeset 33223
- Timestamp:
- Feb 8, 2012, 2:02:25 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/photdbc
- Files:
-
- 8 edited
-
include/dvodist.h (modified) (2 diffs)
-
src/AssignSkyToHost.c (modified) (2 diffs)
-
src/CopyFromHostLocation.c (modified) (3 diffs)
-
src/CopyToHostLocation.c (modified) (6 diffs)
-
src/HostTableLoad.c (modified) (1 diff)
-
src/dvodist.c (modified) (2 diffs)
-
src/initialize_dvodist.c (modified) (1 diff)
-
src/md5_ops.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/include/dvodist.h
r33218 r33223 29 29 30 30 // these should be moved to dvo.h? 31 # define DATA_ON_TGT 0x4000 32 # define DATA_COPY_FAILURE 0x8000 33 # define DATA_HOST_ID 0x3fff 31 # define DATA_ON_TGT 0x01 32 # define DATA_COPY_FAILURE 0x02 34 33 35 34 /* global variables */ … … 44 43 void LockDatabase (char *catdir); 45 44 HostTable *HostTableLoad (char *catdir, char *rootname); 45 int CheckHostsAndPaths (HostTable *table); 46 46 47 int AssignSkyToHost (SkyList *skylist, HostTable *table); 47 48 int CopyToHostLocation (char *catdir, SkyList *skylist, HostTable *table); -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/AssignSkyToHost.c
r33218 r33223 18 18 // XXX some options; 19 19 # if (0) 20 if (CLEAR_ERRORS && (skylist->regions[i]->host ID& DATA_COPY_FAILURE)) {20 if (CLEAR_ERRORS && (skylist->regions[i]->hostFlags & DATA_COPY_FAILURE)) { 21 21 skylist->regions[i]->hostID = 0; 22 22 } … … 30 30 31 31 // assign all regions to one of the Nhost hosts 32 int N = MAX(table->Nhosts - 1, table->Nhosts * drand48()); 32 float f = drand48(); 33 float n = table->Nhosts * f; 34 int N = MIN(table->Nhosts - 1, n); 33 35 skylist->regions[i]->hostID = table->hosts[N].hostID; 36 // fprintf (stderr, "%f %f %d %d\n", f, n, N, skylist->regions[i]->hostID); 34 37 } 35 38 -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/CopyFromHostLocation.c
r33218 r33223 29 29 30 30 // skip catalogs which have not been copied back 31 if (skylist->regions[i]->host ID& DATA_ON_TGT) continue;31 if (skylist->regions[i]->hostFlags & DATA_ON_TGT) continue; 32 32 33 33 // skip catalogs which have an uncleared error 34 if (skylist->regions[i]->host ID& DATA_COPY_FAILURE) continue;34 if (skylist->regions[i]->hostFlags & DATA_COPY_FAILURE) continue; 35 35 36 36 // find the host for the table 37 int realID = (skylist->regions[i]->hostID & DATA_HOST_ID);37 int realID = skylist->regions[i]->hostID; 38 38 short index = table->index[realID]; 39 39 HostInfo *host = &table->hosts[index]; … … 111 111 // if we failed to make a copy, 112 112 113 skylist->regions[i]->host ID|= DATA_COPY_FAILURE;113 skylist->regions[i]->hostFlags |= DATA_COPY_FAILURE; 114 114 for (j = 0; success && (j < 4); j++) { 115 115 sprintf (tgtname, "%s/%s.%s", catdir, skylist->regions[i]->name, extname[j]); … … 118 118 Nfailure ++; 119 119 } else { 120 skylist->regions[i]->host ID&= ~DATA_ON_TGT;120 skylist->regions[i]->hostFlags &= ~DATA_ON_TGT; 121 121 for (j = 0; success && (j < 4); j++) { 122 122 sprintf (srcname, "%s/%s.%s", host->pathname, skylist->regions[i]->name, extname[j]); -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/CopyToHostLocation.c
r33218 r33223 12 12 char srcname[1024]; 13 13 char tgtname[1024]; 14 char outdir[1024]; 14 15 15 16 md5_byte_t srcDigest[NDIGEST]; … … 29 30 30 31 // skip catalogs which have already been copied 31 if (skylist->regions[i]->host ID& DATA_ON_TGT) continue;32 if (skylist->regions[i]->hostFlags & DATA_ON_TGT) continue; 32 33 33 34 // skip catalogs which have an uncleared error 34 if (skylist->regions[i]->host ID& DATA_COPY_FAILURE) continue;35 if (skylist->regions[i]->hostFlags & DATA_COPY_FAILURE) continue; 35 36 36 37 // find the host for the table 37 int realID = (skylist->regions[i]->hostID & DATA_HOST_ID);38 int realID = skylist->regions[i]->hostID; 38 39 short index = table->index[realID]; 39 40 HostInfo *host = &table->hosts[index]; … … 41 42 // have to succeed on all 4 tables; if we fail on any one, 42 43 int success = TRUE; 44 45 char *subdir = pathname (skylist->regions[i]->name); 46 sprintf (outdir, "%s/%s", host->pathname, subdir); 47 free (subdir); 48 49 int status = check_dir_access (outdir, DEBUG); 50 if (!status) { 51 fprintf (stderr, "failed to find / create target path\n"); 52 exit (2); 53 } 43 54 44 55 char extname[4][16] = {"cpm", "cpt", "cps", "cpn"}; … … 52 63 53 64 // check permission to read file 54 intstatus = stat (srcname, &filestat);55 if ( !status) {65 status = stat (srcname, &filestat); 66 if (status) { 56 67 if (errno == ENOENT) continue; // file does not exist (handle broken table with cpt + cpm but no cpn,cps?) 57 68 perror ("stat:"); … … 111 122 // if we failed to make a copy, 112 123 113 skylist->regions[i]->host ID|= DATA_COPY_FAILURE;124 skylist->regions[i]->hostFlags |= DATA_COPY_FAILURE; 114 125 for (j = 0; success && (j < 4); j++) { 115 126 sprintf (tgtname, "%s/%s.%s", host->pathname, skylist->regions[i]->name, extname[j]); … … 118 129 Nfailure ++; 119 130 } else { 120 skylist->regions[i]->host ID|= DATA_ON_TGT;131 skylist->regions[i]->hostFlags |= DATA_ON_TGT; 121 132 for (j = 0; success && (j < 4); j++) { 122 133 sprintf (srcname, "%s/%s.%s", catdir, skylist->regions[i]->name, extname[j]); -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/HostTableLoad.c
r33218 r33223 75 75 exit (1); 76 76 } 77 if (ID > 65535) {77 if (ID > 255) { 78 78 fprintf (stderr, "invalid host ID %d\n", ID); 79 79 exit (1); -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/dvodist.c
r33218 r33223 15 15 char *catdir = strcreate (argv[1]); 16 16 17 LockDatabase (catdir);17 // LockDatabase (catdir); 18 18 19 19 // load the current SkyTable. If SkyTable does not exist, we must fail … … 26 26 Shutdown ("failed to load Host Table %s for %s\n", catdir, sky->hosts); 27 27 } 28 29 CheckHostsAndPaths(hosts); 28 30 29 31 switch (MODE) { -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/initialize_dvodist.c
r33218 r33223 66 66 } 67 67 if ((N = get_argument (argc, argv, "-out"))) { 68 if ( !MODE) {68 if (MODE) { 69 69 fprintf (stderr, "ERROR: cannot use both -in and -out options!\n"); 70 70 usage(); -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/md5_ops.c
r33218 r33223 28 28 md5_append (&state, buffer, nbytes); 29 29 if (output) { 30 int nbytesOut = write (fdOutput, buffer, NBUFFER); 31 // XXX check that we actually write out all nbytes... 30 int nbytesOut = write (fdOutput, buffer, nbytes); 32 31 if (nbytesOut != nbytes) { 33 32 return FALSE; … … 36 35 } 37 36 md5_finish (&state, digest); 37 38 # if (0) 39 int i; 40 for (i = 0; i < NDIGEST; i++) { 41 fprintf (stderr, "%02x", digest[i]); 42 } 43 fprintf (stderr, " : %s\n", input); 44 # endif 38 45 39 46 fclose (fInput);
Note:
See TracChangeset
for help on using the changeset viewer.
