-
Type:
Bug
-
Resolution: Gone away
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
There is a redundant check in local_store.c. I've annotated the snippet below with comments to demonstrate the issue.
965 create = ((flags & WT_FS_OPEN_CREATE) != 0);
966 if (!create) {
967 ret = stat(name, &sb);
968 if (ret != 0 && errno != ENOENT) {
969 ret = local_err(local, session, errno, "%s: local_open stat", name);
970 goto err;
971 }
972 exists = (ret == 0);
973 } else
974 exists = false; // If `create` was true then `exists` gets set to false.
975 if (create || exists) {
976 /* The file has not been flushed, use the file directly in the file system. */
977 if ((local_fh->path = strdup(name)) == NULL) {
978 ret = local_err(local, session, ENOMEM, "local_open");
979 goto err;
980 }
981 } else {
982 if ((ret = local_location_path(file_system, name, &local_fh->path)) != 0)
983 goto err;
984 ret = stat(local_fh->path, &sb);
985 if (ret != 0 && errno != ENOENT) {
986 ret = local_err(local, session, errno, "%s: local_open stat", local_fh->path);
987 goto err;
988 }
989 exists = (ret == 0);
990 }
991 /*
992 * TODO: tiered: If the file doesn't exist locally, make a copy of it from the cloud here.
993 *
994 */
995#if 0
996 if ((flags & WT_FS_OPEN_READONLY) != 0 && !exists) {
997 }
998#endif
999
1000 if (create && !exists) { // Redundant check on `exists`.