Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:4411:    " (%s,%d,UNIX_TIMESTAMP()," MYSQL__BINARY "%s," MYSQL__BINARY "%s)",    id, strlen(data)+strlen(meta_data), meta_data, data );    } else {    // We need to perform multiple queries.   #ifdef ARG_CACHE_DEBUG    werror("Writing %d bytes of padding for %s.\n", sizeof(data), id);   #endif    array(string) a = data/(8.0*1024*1024);    // NB: We clear the meta field to ensure that the entry    // is invalid while we perform the insert. +  int data_size = sizeof(data); +  int allocate_max = 16777216; // 16 MB (16*1024*1024) +  if (data_size > allocate_max) { data_size = allocate_max; }    QUERY("REPLACE INTO " + name +    " (id,size,atime,meta,data) VALUES"    " (%s,%d,UNIX_TIMESTAMP(),'',SPACE(%d))", -  id, strlen(data)+strlen(meta_data), sizeof(data)); +  id, strlen(data)+strlen(meta_data), data_size);    int pos; -  foreach(a, string frag) { +  for (int i = 0; i < sizeof(a); i++) {   #ifdef ARG_CACHE_DEBUG    werror("Writing fragment at position %d for %s.\n", pos, id);   #endif -  +  string frag = a[i]; +  if (data_size > allocate_max && i < (sizeof(a)-1)) { +  frag += " "; +  }    QUERY("UPDATE " + name +    " SET data = INSERT(data, %d, %d, "MYSQL__BINARY "%s)"    " WHERE id = %s",    pos+1, sizeof(frag), frag, id);    pos += sizeof(frag); -  +  if (data_size > allocate_max) { +  pos -= 1;    } -  +  }    /* Set the meta data field to a valid value to enable the entry. */   #ifdef ARG_CACHE_DEBUG    werror("Writing metadata for %s.\n", id);   #endif    QUERY("UPDATE " + name +    " SET meta = " MYSQL__BINARY "%s"    " WHERE id = %s",    meta_data, id);    }   #ifdef ARG_CACHE_DEBUG