private static boolean isAlterDbWritable(HookContext hookContext) {
    final HiveOperation hiveOperation = hookContext.getQueryState().getHiveOperation();
    if (hiveOperation == HiveOperation.ALTERDATABASE) {
      final List<Task<?>> rootTasks = hookContext.getQueryPlan().getRootTasks();
      if (rootTasks.size() == 1) {
        final Serializable rootWork = rootTasks.get(0).getWork();
        if (rootWork instanceof DDLWork) {
          final DDLWork ddlWork = (DDLWork) rootWork;
          final DDLDesc ddlDesc = ddlWork.getDDLDesc();
          if (ddlDesc instanceof AlterDatabaseSetPropertiesDesc) {
            final AlterDatabaseSetPropertiesDesc alterDatabaseDesc = (AlterDatabaseSetPropertiesDesc) ddlDesc;
            final Map<String, String> properties = alterDatabaseDesc.getDatabaseProperties();
            if (properties == null) {
              // The properties are removed.
              return true;
            }
            if (!properties.containsKey(READONLY)) {
              // "readonly" is removed from the properties.
              return true;
            }
            if (!"true".equalsIgnoreCase(properties.get(READONLY))) {
              // "readonly" becomes non-true value.
              return true;
            }
          }
        }
      }
    }
    return false;
  }
Checks whether it's an ALTERDATABASE statement without {"readonly":"true"} property.
1. The properties are removed.
2. "readonly" is removed from the properties.
3. "readonly" becomes non-true value.
ql/src/java/org/apache/hadoop/hive/ql/hooks/EnforceReadOnlyDatabaseHook.java