Skip to content

Commit

Permalink
Merge branch 'PHP-5.5' into PHP-5.6
Browse files Browse the repository at this point in the history
* PHP-5.5:
  Log information about cached scripts and keys
  • Loading branch information
dstogov committed Jan 15, 2014
2 parents 77bc5b8 + 7359dd6 commit 299d893
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,9 @@ static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_ha
char *new_key = zend_shared_alloc(key_length + 1);
if (new_key) {
memcpy(new_key, key, key_length + 1);
zend_accel_hash_update(&ZCSG(hash), new_key, key_length + 1, 1, bucket);
if (zend_accel_hash_update(&ZCSG(hash), new_key, key_length + 1, 1, bucket)) {
zend_accel_error(ACCEL_LOG_INFO, "Added key '%s'", new_key);
}
} else {
zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_OOM TSRMLS_CC);
}
Expand Down Expand Up @@ -1209,16 +1211,21 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr

/* store script structure in the hash table */
bucket = zend_accel_hash_update(&ZCSG(hash), new_persistent_script->full_path, new_persistent_script->full_path_len + 1, 0, new_persistent_script);
if (bucket && !ZCG(accel_directives).revalidate_path &&
/* key may contain non-persistent PHAR aliases (see issues #115 and #149) */
memcmp(key, "phar://", sizeof("phar://") - 1) != 0 &&
(new_persistent_script->full_path_len != key_length ||
memcmp(new_persistent_script->full_path, key, key_length) != 0)) {
/* link key to the same persistent script in hash table */
if (!zend_accel_hash_update(&ZCSG(hash), key, key_length + 1, 1, bucket)) {
zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!");
ZSMMG(memory_exhausted) = 1;
zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH TSRMLS_CC);
if (bucket) {
zend_accel_error(ACCEL_LOG_INFO, "Cached script '%s'", new_persistent_script->full_path);
if (!ZCG(accel_directives).revalidate_path &&
/* key may contain non-persistent PHAR aliases (see issues #115 and #149) */
memcmp(key, "phar://", sizeof("phar://") - 1) != 0 &&
(new_persistent_script->full_path_len != key_length ||
memcmp(new_persistent_script->full_path, key, key_length) != 0)) {
/* link key to the same persistent script in hash table */
if (zend_accel_hash_update(&ZCSG(hash), key, key_length + 1, 1, bucket)) {
zend_accel_error(ACCEL_LOG_INFO, "Added key '%s'", key);
} else {
zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!");
ZSMMG(memory_exhausted) = 1;
zend_accel_schedule_restart_if_necessary(ACCEL_RESTART_HASH TSRMLS_CC);
}
}
}

Expand Down

0 comments on commit 299d893

Please sign in to comment.