Andrew Wong has uploaded this change for review. ( http://gerrit.cloudera.org:8080/8276
Change subject: once: report init_succeeded instead of initted ...................................................................... once: report init_succeeded instead of initted We use KuduOnceDynamic to lazily open various objects, ensuring various initializations happen once and only once. By design, after the first call to its function member, a KuduOnceDynamic will report that it has been initted, and further calls to Init() will no-op. This can be problematic if the function fails, as in a few places, we condition on this initted state, assuming "initted" means "init succeeded". This patch changes KuduOnceDynamic's API to report whether the init succeeded, still maintaining the property that the function is run once. One codepath that is particularly vulnerable to this is the InitOnce of DeltaFileReader, which reads some stats from disk into memory, and can go un-initialized until scan-time. Before, if a deltafile were corrupted and scanned, the scan would return with an error upon initializing the DeltaFileReader (which would at that point be considered "initted"). If it were scanned a second time, seeing that it had been initted, the DeltaFileReader would attempt to access the in-memory stats and hit a nullptr error. A test is added to tablet_server-test to demonstrate that this fails reliably. Change-Id: I7ac7131144392d673e0a72a1ba9920bcf9fd991c --- M src/kudu/cfile/bloomfile.cc M src/kudu/cfile/cfile-test.cc M src/kudu/cfile/cfile_reader.cc M src/kudu/cfile/cfile_reader.h M src/kudu/fs/fs-test-util.h M src/kudu/tablet/deltafile.cc M src/kudu/tablet/deltafile.h M src/kudu/tserver/tablet_copy_source_session.cc M src/kudu/tserver/tablet_copy_source_session.h M src/kudu/tserver/tablet_server-test.cc M src/kudu/util/once-test.cc M src/kudu/util/once.h 12 files changed, 131 insertions(+), 50 deletions(-) git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/76/8276/1 -- To view, visit http://gerrit.cloudera.org:8080/8276 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I7ac7131144392d673e0a72a1ba9920bcf9fd991c Gerrit-Change-Number: 8276 Gerrit-PatchSet: 1 Gerrit-Owner: Andrew Wong <[email protected]>
