{"action":"created","issue":{"url":"https://api.github.com/repos/lau/tzdata/issues/65","repository_url":"https://api.github.com/repos/lau/tzdata","labels_url":"https://api.github.com/repos/lau/tzdata/issues/65/labels{/name}","comments_url":"https://api.github.com/repos/lau/tzdata/issues/65/comments","events_url":"https://api.github.com/repos/lau/tzdata/issues/65/events","html_url":"https://github.com/lau/tzdata/pull/65","id":346754951,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1NTQyNzY5","number":65,"title":"re copy the default data when we can not open the ets table","user":{"login":"kf8a","id":20785,"node_id":"MDQ6VXNlcjIwNzg1","avatar_url":"https://avatars3.githubusercontent.com/u/20785?v=4","gravatar_id":"","url":"https://api.github.com/users/kf8a","html_url":"https://github.com/kf8a","followers_url":"https://api.github.com/users/kf8a/followers","following_url":"https://api.github.com/users/kf8a/following{/other_user}","gists_url":"https://api.github.com/users/kf8a/gists{/gist_id}","starred_url":"https://api.github.com/users/kf8a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kf8a/subscriptions","organizations_url":"https://api.github.com/users/kf8a/orgs","repos_url":"https://api.github.com/users/kf8a/repos","events_url":"https://api.github.com/users/kf8a/events{/privacy}","received_events_url":"https://api.github.com/users/kf8a/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-01T20:25:03Z","updated_at":"2018-08-02T18:10:21Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/lau/tzdata/pulls/65","html_url":"https://github.com/lau/tzdata/pull/65","diff_url":"https://github.com/lau/tzdata/pull/65.diff","patch_url":"https://github.com/lau/tzdata/pull/65.patch"},"body":"Thanks for a great library.\r\n\r\nWhile playing with a nerves system I encountered a crash that seemed to  imply that the ets table got corrupted. \r\n```\r\n03:49:52.724 [info]  Application tzdata exited: exited in: Tzdata.App.start(:normal, [])\r\n    ** (EXIT) an exception was raised:\r\n        ** (MatchError) no match of right hand side value: {:error, {:shutdown, {:failed_to_start_child, Tzdata.EtsHolder, {{:badmatch, {:error, {:read_error, {:not_a_log_file, '/root/elixir_tzdata_data/release_ets/2018e.ets'}}}}, [{Tzdata.EtsHolder, :load_ets_table, 1, [file: 'lib/tzdata/ets_holder.ex', line: 59]}, {Tzdata.EtsHolder, :load_release, 0, [file: 'lib/tzdata/ets_holder.ex', line: 52]}, {Tzdata.EtsHolder, :init, 1, [file: 'lib/tzdata/ets_holder.ex', line: 14]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 374]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 342]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}}}\r\n            (tzdata) lib/tzdata/tzdata_app.ex:15: Tzdata.App.start/2\r\n            (kernel) application_master.erl:277: :application_master.start_it_old/4\r\n```\r\nI think that in this case the offending file should be deleted and the files should be re-copied from `priv` to start over.  It would result in the time zone database reverting to an earlier version until the next update.\r\nI'm not sure if the successful branch should return `{:ok, table}`  instead of just `:ok` or something else."},"comment":{"url":"https://api.github.com/repos/lau/tzdata/issues/comments/410018569","html_url":"https://github.com/lau/tzdata/pull/65#issuecomment-410018569","issue_url":"https://api.github.com/repos/lau/tzdata/issues/65","id":410018569,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDAxODU2OQ==","user":{"login":"lau","id":12623,"node_id":"MDQ6VXNlcjEyNjIz","avatar_url":"https://avatars1.githubusercontent.com/u/12623?v=4","gravatar_id":"","url":"https://api.github.com/users/lau","html_url":"https://github.com/lau","followers_url":"https://api.github.com/users/lau/followers","following_url":"https://api.github.com/users/lau/following{/other_user}","gists_url":"https://api.github.com/users/lau/gists{/gist_id}","starred_url":"https://api.github.com/users/lau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lau/subscriptions","organizations_url":"https://api.github.com/users/lau/orgs","repos_url":"https://api.github.com/users/lau/repos","events_url":"https://api.github.com/users/lau/events{/privacy}","received_events_url":"https://api.github.com/users/lau/received_events","type":"User","site_admin":false},"created_at":"2018-08-02T18:10:21Z","updated_at":"2018-08-02T18:10:21Z","author_association":"OWNER","body":"> I suspect what happened in my case is that I removed the power from the system during the initial file copy operation.\r\n\r\nOK, that seems plausible.\r\n\r\nWhen Tzdata cannot find an .ets file in a `release_ets` dir in whatever the `config :tzdata, :data_dir` is set to, it copies it from its `priv` directory. However this copiing is kind of an exceptional last-ditch-effort of making sure that Tzdata can run. Ideally there would already be an `.ets` - file in the appropriate location.\r\n\r\nSee this: https://github.com/lau/tzdata#data-directory-and-releases \r\n\r\n> Add the release_ets directory from priv to that directory containing the 20xxx.ets file that ships with this library.\r\n\r\nIf the file is already there before it starts there is no need to copy anything. Can you burn the SD card with the .ets file already in place?\r\n\r\nRelated to this, there are the automatic updates from the internet. The way that works the files are first written using a temporary file name in a different directory. Then after it is written it is renamed and moved to the `release_ets` directory. This is exactly fore a case of the file writing operation not completing. If the file is not completely written it will not be moved to a location where Tzdata will try to load it."}}
{"actor":{"display_login":"lau"}}