{"action":"created","issue":{"url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/2038","labels_url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/2038/labels{/name}","comments_url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/2038/comments","events_url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/2038/events","html_url":"https://github.com/wiredtiger/wiredtiger/pull/2038","id":92421671,"number":2038,"title":"track the tree's max-txn-ID in reconciliation, where the page's max-txn-ID is set.","user":{"login":"keithbostic","id":1393186,"avatar_url":"https://avatars.githubusercontent.com/u/1393186?v=3","gravatar_id":"","url":"https://api.github.com/users/keithbostic","html_url":"https://github.com/keithbostic","followers_url":"https://api.github.com/users/keithbostic/followers","following_url":"https://api.github.com/users/keithbostic/following{/other_user}","gists_url":"https://api.github.com/users/keithbostic/gists{/gist_id}","starred_url":"https://api.github.com/users/keithbostic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithbostic/subscriptions","organizations_url":"https://api.github.com/users/keithbostic/orgs","repos_url":"https://api.github.com/users/keithbostic/repos","events_url":"https://api.github.com/users/keithbostic/events{/privacy}","received_events_url":"https://api.github.com/users/keithbostic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"keithbostic","id":1393186,"avatar_url":"https://avatars.githubusercontent.com/u/1393186?v=3","gravatar_id":"","url":"https://api.github.com/users/keithbostic","html_url":"https://github.com/keithbostic","followers_url":"https://api.github.com/users/keithbostic/followers","following_url":"https://api.github.com/users/keithbostic/following{/other_user}","gists_url":"https://api.github.com/users/keithbostic/gists{/gist_id}","starred_url":"https://api.github.com/users/keithbostic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithbostic/subscriptions","organizations_url":"https://api.github.com/users/keithbostic/orgs","repos_url":"https://api.github.com/users/keithbostic/repos","events_url":"https://api.github.com/users/keithbostic/events{/privacy}","received_events_url":"https://api.github.com/users/keithbostic/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-07-01T16:04:20Z","updated_at":"2015-07-02T12:36:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/wiredtiger/wiredtiger/pulls/2038","html_url":"https://github.com/wiredtiger/wiredtiger/pull/2038","diff_url":"https://github.com/wiredtiger/wiredtiger/pull/2038.diff","patch_url":"https://github.com/wiredtiger/wiredtiger/pull/2038.patch"},"body":"@michaelcahill, I was staring at this code this morning, and it seemed like it would be easier (safer?) to set the tree's maximum transaction ID when we set/update the page's maximum transaction ID.\r\n\r\nThe \"safer\" part may be a misunderstanding on my part: the WT_BTREE.rec_max_txn field is used by sweep and close, but it's only set as part of the checkpoint operation.\r\n\r\nBut what if, by the time we get to checkpoint (WT_SYNC_CHECKPOINT), there aren't any leaf pages to write. Is it possible we won't update the tree's maximum transaction ID, since internal pages don't have a maximum transaction ID?"},"comment":{"url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/comments/118017342","html_url":"https://github.com/wiredtiger/wiredtiger/pull/2038#issuecomment-118017342","issue_url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/2038","id":118017342,"user":{"login":"keithbostic","id":1393186,"avatar_url":"https://avatars.githubusercontent.com/u/1393186?v=3","gravatar_id":"","url":"https://api.github.com/users/keithbostic","html_url":"https://github.com/keithbostic","followers_url":"https://api.github.com/users/keithbostic/followers","following_url":"https://api.github.com/users/keithbostic/following{/other_user}","gists_url":"https://api.github.com/users/keithbostic/gists{/gist_id}","starred_url":"https://api.github.com/users/keithbostic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithbostic/subscriptions","organizations_url":"https://api.github.com/users/keithbostic/orgs","repos_url":"https://api.github.com/users/keithbostic/repos","events_url":"https://api.github.com/users/keithbostic/events{/privacy}","received_events_url":"https://api.github.com/users/keithbostic/received_events","type":"User","site_admin":false},"created_at":"2015-07-02T12:36:52Z","updated_at":"2015-07-02T12:36:52Z","body":"@michaelcahill, second, I'm still not clear on why this is safe, there's something I'm missing. In these two tests:\r\n```\r\n__sweep_expire_handle():\r\n    /* Only sweep clean trees where all updates are visible. */\r\n    if (btree->modified ||\r\n        !__wt_txn_visible_all(session, btree->rec_max_txn))\r\n            goto err;\r\n\r\n__wt_checkpoint_close():\r\n    /*\r\n     * If closing an unmodified file, check that no update is required\r\n     * for active readers.\r\n     */\r\n    if (!btree->modified && !bulk) {\r\n            __wt_txn_update_oldest(session, 1);\r\n            return (__wt_txn_visible_all(session, btree->rec_max_txn) ?\r\n                __wt_cache_op(session, NULL, WT_SYNC_DISCARD) : EBUSY);\r\n    }\r\n```\r\n\r\nIf we have a tree where all of the leaf pages are written during the `WT_SYNC_WRITE_LEAVES` pass, I think the tree is clean, but `btree->rec_max_txn` won't ever have been set, and the tree could be closed while there are still be active readers looking for updates left in the tree."}}