{"record":{"id":"1e4097602ca98680","repo":"apache/hadoop","slug":"getclass-getcanonicalname-does-not-support-m","errorCode":null,"errorMessage":"{getClass().getCanonicalName()} does not support method msync","messagePattern":"(.+?) does not support method msync","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java","lineNumber":1029,"sourceCode":"   * @throws UnresolvedLinkException unresolved link exception.\n   * @throws IOException raised on errors performing I/O.\n   * @return File Status\n   */\n  public abstract FileStatus getFileStatus(final Path f)\n      throws AccessControlException, FileNotFoundException,\n      UnresolvedLinkException, IOException;\n\n  /**\n   * Synchronize client metadata state.\n   * <p>\n   * In some FileSystem implementations such as HDFS metadata\n   * synchronization is essential to guarantee consistency of read requests\n   * particularly in HA setting.\n   * @throws IOException raised on errors performing I/O.\n   * @throws UnsupportedOperationException Unsupported Operation Exception.\n   */\n  public void msync() throws IOException, UnsupportedOperationException {\n    throw new UnsupportedOperationException(getClass().getCanonicalName() +\n        \" does not support method msync\");\n  }\n\n  /**\n   * The specification of this method matches that of\n   * {@link FileContext#access(Path, FsAction)}\n   * except that an UnresolvedLinkException may be thrown if a symlink is\n   * encountered in the path.\n   *\n   * @param path the path.\n   * @param mode fsaction mode.\n   * @throws AccessControlException access control exception.\n   * @throws FileNotFoundException file not found exception.\n   * @throws UnresolvedLinkException unresolved link exception.\n   * @throws IOException raised on errors performing I/O.\n   */\n  @InterfaceAudience.LimitedPrivate({\"HDFS\", \"Hive\"})\n  public void access(Path path, FsAction mode) throws AccessControlException,","sourceCodeStart":1011,"sourceCodeEnd":1047,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java#L1011-L1047","documentation":"msync() forces the client to refresh cached namespace metadata with the NameNode, needed for read-your-writes consistency after asynchronous HDFS operations. Only the HDFS AbstractFileSystem implements it; the base default throws UnsupportedOperationException naming the concrete class, so fc.msync() (FileContext delegates to defaultFS.msync()) fails on every non-HDFS filesystem.","triggerScenarios":"fc.msync() on file://, viewfs:, s3a://, adl://, etc.; library code that unconditionally calls msync after asynchronous Callables (Future* create/append) regardless of the scheme; unit tests of HDFS logic running against LocalFs.","commonSituations":"Client code parameterized over fs.defaultFS that works on HDFS but breaks in local tests; frameworks adopting the async-call + msync pattern; jobs migrated from HDFS to object stores.","solutions":["Gate the call by scheme: only invoke msync when the path/filesystem scheme is hdfs (msync is a no-op need everywhere else)","Catch UnsupportedOperationException and treat msync as best-effort metadata hygiene","Only call msync when you actually issued asynchronous operations whose metadata you must observe"],"exampleFix":"// before\nfc.msync(); // on file:// -> UnsupportedOperationException\n\n// after\nif (\"hdfs\".equalsIgnoreCase(path.toUri().getScheme())) {\n  fc.msync();\n}","handlingStrategy":"validation","validationCode":"if (\"hdfs\".equalsIgnoreCase(path.toUri().getScheme())) {\n  fc.msync();\n}","typeGuard":null,"tryCatchPattern":"try { fc.msync(); } catch (UnsupportedOperationException e) { /* non-HDFS backend: metadata caching not applicable, continue */ }","preventionTips":["Call msync only after asynchronous HDFS operations; sync reads do not need it","Guard scheme-sensitive calls when code must run on both HDFS and local/object stores","Unit-test shared client code against LocalFs to catch unconditional msync calls"],"tags":["msync","metadata-consistency","unsupported-feature","hdfs-ha","hadoop-fs"],"backgroundTag":"filesystem-capability-unsupported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}