Friday, September 5, 2014

Programming: Programmer Memory

As one writes code, the mind changes state over time adding code artifacts to the brain's short-term and long-term memory.  Having every line of code memorized would be perfect for a programmer's brain  to work on code.    Only at first blush.  Maybe even better is to have the entire call graph memorized.  Well, even better than having all code memorized and the call graph memorized, is to have all possible states the computer will move through memorized as well.  So on and so forth.  One could imagine a graph or set of graphs indicating the amount of programmer memory (PM) on a project.

It's this programmer memory that benefits projects.  A project with low PM will take longer to implement and probably be more bug-ridden.   There's probably a real positive correlation between a programmer's experience on the project and PM.  So programmer experience on the project is very important, and cannot be discounted.

Frameworks that get reused across projects can also increase PM over time as long as the frameworks stay relatively stable.  So programmer experience with a framework is better than no experience.

How can a programming code (I do not like the term language) or set of coding tools decrease the value of PM?



Monday, June 2, 2014

MySQL 5.5 Maximum Sequence in Binary Logs

MySQL Binary Logs use a sequence number as the extension.

If you have binary logging turned on, the first binary log file will be mysql-bin.000001

What happens if you flush logs after mysql-bin.999999?

We could fire up the source code to take a look, or we could try it out.

I renamed the last binary log file to mysql-bin.999997 and changed the mysql-bin.index file to only list the one.    After a couple of flush logs we get the following.


This not like the odometer on your car. 

The filename is generated in sql/log.c  and it will throw an error when

if (max_found == MAX_LOG_UNIQUE_FN_EXT)

where  MAX_LOG_UNIQUE_FN_EXT is 0x7FFFFFFF or  2147483647, roughly 2.1 billion flushes. 

Let's try it out.


The error message definitely needs to be updated.  But the server didn't crash.  And that's a good thing.

The error log produced the following.
 140602 20:27:52 [ERROR] Log filename extension number exhausted: 2147483647. Please fix this by archiving old logs and updating the index files.
140602 20:27:52 [ERROR] Can't generate a unique log-filename mysqlbin.(1-999)


Conclusion
1.  There is a maximum sequence number in binary logs, and that is 2147483647.
2.  There's an error message update in the source code that could be more useful.
3.  Monitor your error logs!
4.  If mysql-bin.000001 doesn't exist, it seems to me that it's okay to roll over the odometer just like a good car.



Wednesday, April 2, 2014

New Variables in MariaDB 5.5 not in MySQL 5.5

By doing a diff between  MySQL 5.5 and MariaDB 5.5 with show global variables, the following are new variables in MariaDB 5.5.35 not found in MySQL 5.5

Documentation for these variables can be found on MariaDB's knowledge base:  Server System Variables

aria_block_size
aria_checkpoint_interval
aria_checkpoint_log_activity
aria_force_start_after_recovery_failures
aria_group_commit
aria_group_commit_interval
aria_log_file_size
aria_log_purge_type
aria_max_sort_file_size
aria_page_checksum
aria_pagecache_age_threshold
aria_pagecache_buffer_size
aria_pagecache_division_limit
aria_recover
aria_repair_threads
aria_sort_buffer_size
aria_stats_method
aria_sync_log_dir
aria_used_for_temp_tables
binlog_annotate_row_events
binlog_checksum
binlog_optimize_thread_scheduling
deadlock_search_depth_long
deadlock_search_depth_short
deadlock_timeout_long
deadlock_timeout_short
debug_no_thread_alarm
expensive_subquery_limit
extra_max_connections
extra_port
ignore_db_dirs
innodb_adaptive_flushing_method
innodb_adaptive_hash_index_partitions
innodb_blocking_buffer_pool_restore
innodb_buffer_pool_populate
innodb_buffer_pool_restore_at_startup
innodb_buffer_pool_shm_checksum
innodb_buffer_pool_shm_key
innodb_checkpoint_age_target
innodb_corrupt_table_action
innodb_dict_size_limit
innodb_doublewrite_file
innodb_fake_changes
innodb_fast_checksum
innodb_flush_neighbor_pages
innodb_ibuf_accel_rate
innodb_ibuf_active_contract
innodb_ibuf_max_size
innodb_import_table_from_xtrabackup
innodb_kill_idle_transaction
innodb_lazy_drop_table
innodb_locking_fake_changes
innodb_log_block_size
innodb_max_bitmap_file_size
innodb_max_changed_pages
innodb_merge_sort_block_size
innodb_page_size
innodb_print_all_deadlocks
innodb_read_ahead
innodb_recovery_stats
innodb_recovery_update_relay_log
innodb_show_locks_held
innodb_show_verbose_locks
innodb_stats_auto_update
innodb_stats_update_need_lock
innodb_thread_concurrency_timer_based
innodb_track_changed_pages
innodb_use_atomic_writes
innodb_use_fallocate
innodb_use_global_flush_log_at_trx_commit
innodb_use_stacktrace
innodb_use_sys_stats_table
join_buffer_space_limit
join_cache_level
key_cache_segments
log_slow_filter
log_slow_rate_limit
log_slow_verbosity
master_verify_checksum
mrr_buffer_size
myisam_block_size
old_mode
plugin_maturity
progress_report_time
query_cache_strip_comments
replicate_annotate_row_events
replicate_do_db
replicate_do_table
replicate_events_marked_for_skip
replicate_ignore_db
replicate_ignore_table
replicate_wild_do_table
replicate_wild_ignore_table
rowid_merge_buff_size
slave_sql_verify_checksum
thread_pool_idle_timeout
thread_pool_max_threads
thread_pool_oversubscribe
thread_pool_size
thread_pool_stall_limit
userstat